Repository navigation
perf(cli): prefer manifest node for bundle chunks - #1328
Conversation
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughBundle pulling now preserves the node and provider selected for each manifest, reuses that target for chunk retrieval, and conditionally discovers a fallback holder after typed delivery refusals. Tests cover reuse, fallback, pinning, and voucher rejection. The protocol documentation clarifies retry guidance for oversized blobs. ChangesBundle pull target reuse
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant PullCtx
participant Delivery
participant Discovery
PullCtx->>Delivery: Fetch manifest and selected FetchTarget
Delivery-->>PullCtx: Manifest bytes and target
PullCtx->>Delivery: Fetch chunks using preferred target
Delivery-->>PullCtx: Typed delivery refusal
PullCtx->>Discovery: Discover holder when entry is not pinned
Discovery-->>PullCtx: Fallback target
PullCtx->>Delivery: Retry chunk fetch using fallback target
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 |
There was a problem hiding this comment.
Code Review
This pull request optimizes the bundle pull command by allowing manifest chunks (for DECDNMAN entries) to reuse the holder node that served the manifest, bypassing discovery unless a typed delivery refusal occurs. It introduces a fetch_preferred helper function to manage this fallback behavior and updates PullCtx to track and pass the preferred target. Additionally, comprehensive unit tests have been added to verify the chunk reuse and fallback logic. I have no feedback to provide as there are no review comments.
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.
Coverage reportTotal: 81.72% (was 81.74%, ▼ 0.02%) — 51002/62413 lines
History
|
`fetch_preferred` falls back to discovery only on a delivery-side refusal. `VoucherRejected` is deliberately excluded: it is the one wire code that arrives ONLY mid-stream, after bytes were delivered and paid for, and it reports a buyer-side voucher fault that would follow the retry to the next node — so falling back on it would re-fetch and re-pay the chunk to lose the same way twice, once per remaining chunk. Nothing pinned that exclusion from this side. Replacing the `is_delivery_side()` gate with a bare `is_some()` left all ten existing `bundle_pull` tests green; the new test fails there with two fetches where one is expected. (`StreamError`'s own domain split stays covered by `decdn_protocol`, so the delivery-side variants need no restating here.) Also thread the `FetchTarget` alias through `fetch_from` — destructured in parameter position, since a `target` binding would shadow the `EndpointAddr` local of that name — and let `fetch` delegate to `fetch_with_target` rather than repeat pick-then-fetch. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Gas snapshotNo gas changes vs base. |
Contracts coverageLine coverage: 88.96% (2499/2809 lines) |
|
Reviewed the diff against 1. The fallback discovery can re-select the node that just refused. 2. The tests all exercise the free function, never the wiring. All four cases drive Minor: The |
What
--node-idpulls pinned and keep sibling bundle entries independently selectedWhy
The previous reconstruction callback called normal discovery for every missing chunk. Large files therefore paid one full probe fan-out per chunk even though the node that served the manifest commonly serves its chunks too.
Impact
Auto-discovered DECDNMAN reconstruction now performs one initial entry discovery in the common case instead of probing before every chunk. If the serving node no longer holds or cannot serve a chunk, normal per-hash discovery preserves availability. Explicit node selection remains strict.
Validation
cargo test -p decdn-cli bundle_pullcargo test -p decdn-clicargo clippy --workspace --all-targets -- -D warningscargo fmt --all -- --checkRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemsCloses #1294
Summary by CodeRabbit
Bug Fixes
Documentation
BlobTooLargeerrors: try a different node rather than retrying the same one.