Repository navigation
fix(no-ticket): show the real progress of a single-part push upload - #558
Draft
cloudsmith-iduffy wants to merge 1 commit into
Draft
cloudsmith-iduffy wants to merge 1 commit into
cloudsmith-iduffy wants to merge 1 commit into
Conversation
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>
Contributor
There was a problem hiding this comment.
🟢 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 passedmonitor.bytes_readtoProgressBar.update(). That is a running total, butupdate()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_readstarts 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):
After: the bar position follows the read bytes and is full only at the end of the body.
Type of Change
Additional Notes
The two new tests in
cli/tests/test_push.pyrunupload_filewith a fake upload that reads a realMultipartEncoderMonitorin 1 KB blocks:Both tests fail on master.
🤖 Generated with Claude Code