Repository navigation
feat(cli): show a delivery progress bar in decdn fetch (#1118) - #1121
Conversation
`decdn fetch` printed nothing between channel setup and the final `fetched N bytes` line, so a large or slow pull looked hung. The receive loop already tracked wire bytes against a known total but never surfaced them. Thread an optional progress callback `(wire_bytes_received, wire_bytes_expected)` from `receive_and_pay` up through `fetch_inner`, exposed via a new `stream_fetch_tracked_with_progress` wrapper so the payment-critical `stream_fetch_tracked` and all its callers/tests stay unchanged. `decdn fetch` renders a TTY-aware `indicatif` bar (silent when stderr is piped/CI, steady tick during the pre-byte handshake); the node-side `node_origin` pull and `bundle pull` pass `None` and are unaffected. Covered by a loopback test asserting the callback fires monotonically and reaches the full promised wire length. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Warning Review limit reached
Next review available in: 41 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (1)
WalkthroughThe pull kernel now emits optional wire-byte progress callbacks. The CLI renders these updates with an ChangesDelivery Progress Reporting
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant fetch
participant fetch_blob
participant stream_fetch_tracked_with_progress
participant receive_and_pay
participant ProgressBar
User->>fetch: start blob fetch
fetch->>ProgressBar: create progress bar
fetch->>fetch_blob: pass progress callback
fetch_blob->>stream_fetch_tracked_with_progress: fetch with callback
stream_fetch_tracked_with_progress->>receive_and_pay: receive paid chunks
receive_and_pay-->>fetch: report cumulative and expected wire bytes
fetch->>ProgressBar: update position and length
fetch->>ProgressBar: clear before final outcome
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Gas snapshotNo gas changes vs base. |
Contracts coverageLine coverage: 88.71% (2452/2764 lines) |
There was a problem hiding this comment.
Code Review
This pull request introduces a delivery progress bar for the decdn fetch command using the indicatif crate. It adds a new stream_fetch_tracked_with_progress function in decdn-client-pull that accepts an optional progress callback, which is invoked as chunks are received. The fetch command utilizes this callback to update a TTY-aware progress bar on stderr. A new integration test is also added to verify the monotonic progress reporting. The feedback suggests optimizing the progress callback in fetch.rs by using an AtomicBool to avoid redundantly calling set_length on every chunk, which reduces lock contention in the hot receive loop.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage reportTotal: 80.34% (was 80.37%, ▼ 0.03%) — 44804/55770 lines
History
|
`expected` is constant across a pull and `ProgressBar::set_length` takes a write lock, so calling it every chunk added needless contention in the hot receive loop. Guard it with an `AtomicBool` so the length is set on the first callback only. (review feedback, #1121) Co-Authored-By: Claude Opus 4.8 <[email protected]>
Closes #1118.
Problem
decdn fetchprinted nothing between channel setup and the finalfetched N bytes -> <path>line. On a large or slow pull it looked hung — no bytes-received, no ETA, no sign it was alive.Fix
The delivery already knew the total up front (
StreamResponse.total_bytes→expected_wire) and counted bytes as they arrived inreceive_and_pay, but nothing surfaced it. This PR threads an optional progress callback(wire_bytes_received, wire_bytes_expected)fromreceive_and_payup throughfetch_inner, exposed via a newstream_fetch_tracked_with_progresswrapper. The payment-criticalstream_fetch_trackedbecomes a thin delegate (… , None), so all its existing callers and tests — including thenode_originpull path — are unchanged.decdn fetchrenders the bar withindicatif:bundle pullreusesfetch_bloband passesNone(per-entry byte bars would interleave illegibly across concurrent pulls; it reports at entry granularity). Scope here is the single-blobfetchpath; multi-entry progress forbundle pullis a possible follow-up.Testing
progress_callback_reports_monotonic_deliverydrives a real 256 KiB pull over iroh and asserts the callback fires, the expected total stays constant, received bytes advance monotonically without overshoot, and the final observation reaches the full promised wire length.cargo nextest rungreen fordecdn-client-pull(35),decdn-node::client_loopback(29),decdn-cli(271).cargo clippy(workspace,-D warnings),cargo fmt --check, andcargo deny checkall pass;indicatif(MIT) clears the license allow-list.Note: the byte bar is not exercised by an automated end-to-end
decdn fetchrun (that needs a live node + chain); the loopback test verifies the callback data path it consumes, and theindicatifglue isset_length/set_position.🤖 Generated with Claude Code
Summary by CodeRabbit
decdn fetch.