Skip to content

fix(no-ticket): show the real progress of a single-part push upload - #558

Draft
cloudsmith-iduffy wants to merge 1 commit into
masterfrom
iduffy/fix-push-progress-bar
Draft

cloudsmith-iduffy wants to merge 1 commit into
masterfrom
iduffy/fix-push-progress-bar

Conversation

@cloudsmith-iduffy

@cloudsmith-iduffy cloudsmith-iduffy commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Description

On a single-part cloudsmith push, the progress bar filled up almost at once, long before the file had finished uploading. The upload callback passed monitor.bytes_read to ProgressBar.update(). That is a running total, but update() adds its argument to the current position, so the bar raced ahead. With a 10 MB file it showed 100% after about 4% of the file had been sent, and it finished at about 643x the file size.

The callback now moves the bar to the part of the request body that has been read. The body also holds the form fields, so the count is scaled to the file size. The bar reaches 100% only when the whole body has been sent. It never moves back, and it never goes past the end. This matters once #544 lands: it makes the body rewindable, so on a retry bytes_read starts again from 0.

The multi-part path (pb.update(1) per chunk) was already correct, and I did not change it.

Before (10 MB file):

bytes actually read when bar reached 100%: 417792 (3.98% of the file)
final pb.pos     : 6737101256 (643x the length)

After: the bar position follows the read bytes and is full only at the end of the body.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe)

Additional Notes

The two new tests in cli/tests/test_push.py run upload_file with a fake upload that reads a real MultipartEncoderMonitor in 1 KB blocks:

  • The bar is full only when the whole body has been read.
  • When an attempt fails part-way and the count starts again from 0, the bar never moves back and ends at 100%.

Both tests fail on master.

🤖 Generated with Claude Code

The upload callback gave the running byte count to ProgressBar.update,
which adds its argument. The bar was full after a small part of the
file. The callback now moves the bar to the read part of the body,
scaled to the file size. The bar does not move back when a rewound
body counts again from 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 24, 2026 18:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The localized calculation fix handles cumulative counts and retry resets correctly, with regression coverage and no unresolved findings.

No open issues 🎉

What changed in this PR

Corrects single-part upload progress in cloudsmith push by converting cumulative bytes read into bounded progress increments, while preserving progress when retries reset the byte count.

Changes:

  • Scale request-body progress to the file size without moving backward or exceeding the bar length.
  • Add regression tests for completion timing and retry behavior.
  • Document the fix in the changelog; multi-part uploads remain unchanged.
File Description
cloudsmith_cli/​cli/​tests/​test_push.py Tests single-part progress completion and retry resets.
cloudsmith_cli/​cli/​commands/​push.py Corrects cumulative byte accounting in the progress callback.
CHANGELOG.md Records the single-part upload progress fix.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants