Skip to content

fix(cli): show bundle-pull speed and ETA on the total bar, not per file - #2004

Merged
alpergundogdu merged 2 commits into
mainfrom
claude/bundle-pull-speed-eta-e678ec
Sep 14, 2026
Merged

alpergundogdu merged 2 commits into
mainfrom
claude/bundle-pull-speed-eta-e678ec

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Summary

With --jobs pulls sharing one link, a per-file rate is only that lane's share of the bandwidth and its ETA reads as stuck whenever another file has the link. This moves the rate/ETA readout to the bottom total bar, computed from total content bytes, and leaves per-file bars with just their byte counts.

  • pull_progress.rs: the total bar is wrapped in a TotalBar that owns a rate meter. Every transferred increment folded into the total samples the meter and rewrites the bar's {msg} as (rate, ETA). Bytes credited for already-present files move the bar but shift the meter's baseline instead of feeding it, so a resumed run reports transfer speed, not disk speed.
  • fetch.rs: the existing smoothing math is extracted into SpeedState::observe so single-blob fetch and bundle pull share one estimator. The per-file bar template loses its rate slot, and the fetch callback drops its dead delta-forwarding parameter (its docstring described a total-bar design that no longer exists).

Test plan

  • cargo clippy -p decdn-cli --all-targets --all-features -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo doc -p decdn-cli --no-deps --document-private-items
  • cargo nextest run -p decdn-cli (650 passed; 3 new tests: rate-free file callback, total-bar message, skipped credit does not leak into the rate)
  • Visual check of a live decdn bundle pull with --jobs > 1: total bar shows a moving rate/ETA while file bars show bytes only

🤖 Generated with Claude Code

With `--jobs` pulls sharing one link, a per-file rate is only that lane's
share of the bandwidth and its ETA reads as stuck whenever another file
has the link. Move the rate/ETA readout to the bottom total bar, computed
from total content bytes with the same time-weighted moving average
`decdn fetch` uses; per-file bars keep only their byte counts.

Already-present files credited to the total shift the meter's baseline
without feeding the rate, so a resumed run reports transfer speed rather
than disk speed. The smoothing math is extracted into
`SpeedState::observe` so both commands share one estimator, and the
fetch callback drops its dead delta-forwarding parameter.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 14, 2026 10:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The functional changes are cohesive and well-tested; only a minor documentation typo remains.

Pull request overview

This PR improves decdn bundle pull progress reporting by moving speed/ETA to the bottom total bar (whole-download throughput) and simplifying per-file bars to show bytes only, avoiding misleading per-file rate/ETA when --jobs shares bandwidth.

Changes:

  • Introduces a TotalBar wrapper in pull_progress.rs to own the total progress bar plus a shared rate/ETA estimator, with a separate “credit” path for already-present bytes that should not affect transfer rate.
  • Refactors the existing rate smoothing logic in fetch.rs into SpeedState::observe (and shift) so it can be reused by both fetch and bundle pull.
  • Updates the labeled per-file progress bar template to remove the {msg} slot (rate/ETA), and removes the no-longer-used delta-forwarding hook from the fetch-side callback.
File summaries
File Description
crates/cli/src/commands/pull_progress.rs Adds TotalBar (total-only rate/ETA) and updates per-file callbacks to position-only updates while folding scaled progress into the total.
crates/cli/src/commands/fetch.rs Extracts shared speed/ETA estimator (SpeedState::observe/shift) and simplifies per-file bar rendering and callback wiring.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 82.77% (was 82.74%, ▲ +0.03%) — 77204/93275 lines

File Coverage Lines Δ
crates/cli/src/commands/fetch.rs 43.22% 953/2205 ▲ +1.22%
crates/cli/src/commands/pull_progress.rs 78.89% 370/469 ▲ +2.73%
History
Commit Total Δ vs base
81c7a7a 82.77% ▲ +0.03%
bc052f4 (HEAD) 82.77% ▲ +0.03%

@alpergundogdu
alpergundogdu merged commit 2c4934d into main Sep 14, 2026
25 checks passed
@alpergundogdu
alpergundogdu deleted the claude/bundle-pull-speed-eta-e678ec branch September 14, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants