Skip to content

refactor(cli): route bundle pull through the gap-driven driver + delete the legacy fetch loop (P4 of #1621) - #1633

Merged
alpergundogdu merged 5 commits into
mainfrom
feat/1621-p4-bundle-pull
Aug 7, 2026
Merged

alpergundogdu merged 5 commits into
mainfrom
feat/1621-p4-bundle-pull

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

What

P4 (Phase A') of #1621 — finishes the CLIENT side of range-minimized fetch and removes the "two parallel fetch paths" smell.

Stacked on #1631 (Phase A / P3-client) — base is feat/1621-p3-client-blobsource; this PR shows only P4's diff. It'll retarget to main once #1631 merges.

Four commits:

  1. refactor: extract drive_fetch — pull decdn fetch's gap-driven driver core (header-probe → ClientRangedStore → PeerSource/BudgetPacer → drive → watermark) into a reusable fetch::drive_fetch(deps, ctx, target, hash, output, progress, finish_progress). Behavior-preserving for decdn fetch.
  2. fix: bar-clear ordering — restore the pre-extraction ordering (a rare persist_watermark warning must print after the progress bar is cleared, not during) via a finish_progress hook.
  3. refactor: route bundle pull + delete legacy loop — decdn bundle pull now fetches each blob through the same drive_fetch (range-minimized, resumable via sidecars). Staging files become plain finalized blobs (drive_fetch owns the .partial/.obao4/.ranges). Deletes fetch_blob_streaming, verify_resumed_prefix, combine_pull_and_flush, existing_partial_len, watermark_after, and the fetch-local resume_may_be_stale (the driver's own copy stays). Net −856 lines in fetch.rs.
  4. test: staging_path naming guard — the plain-<hex> staging name is now load-bearing (sidecar names derive from it).

Why it's safe

  • Both decdn fetch and bundle pull now run the one gap-driven path — same resume/top-up/pacing, same per-byte bao verification + finalize valid_ranges sweep. The old whole-file re-hash (verify_resumed_prefix) is subsumed, so no unverified byte reaches a materialized output.
  • bundle pull gains range-minimized resume + reactive top-up for free (it inherited neither before).
  • The staging "left in place on error for retry" contract is preserved — now the .partial+sidecars are the resume state.

Verification

  • cargo build && cargo clippy --all-targets --all-features -- -D warnings — clean
  • cargo nextest run -p decdn-cli — 415/415 (incl. the new staging_path guard)
  • cargo fmt -- --check — clean
  • cargo test --no-run -p decdn-e2e --features anvil-e2e — compiles
  • cli_bundle_pull_adopts_one_channel_for_the_whole_bundle anvil e2e ran locally and passed
  • cargo tree -p decdn-cli -e normal -i iroh-blobs — nothing (CLI binary-split regression: publisher links cache crate (iroh-blobs/AWS SDK) #578 holds)

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 6, 2026 17:28
@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@alpergundogdu, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Free

Run ID: 0185eeb6-16a6-44d7-8303-3c6f2ee8e9ae

📥 Commits

Reviewing files that changed from the base of the PR and between afc7062 and 0689370.

📒 Files selected for processing (2)
  • crates/cli/src/commands/bundle_pull.rs
  • crates/cli/src/commands/fetch.rs

Note

🎁 Summarized by CodeRabbit Free

Your 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 @coderabbitai help to get the list of available commands.

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR consolidates decdn fetch and bundle pull onto the shared gap-driven fetch driver by extracting a reusable drive_fetch core and removing the legacy streaming fetch path.

Changes:

  • Removed the legacy fetch_blob_streaming implementation (and its helpers/tests) from fetch.rs.
  • Introduced DriveFetchDeps + drive_fetch as the shared fetch core for both fetch and bundle pull.
  • Updated bundle staging paths/cleanup to align with drive_fetch’s finalize-to-plain-file behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
crates/cli/src/commands/fetch.rs Removes streaming fetch path; adds shared DriveFetchDeps + drive_fetch and wires fetch() through it.
crates/cli/src/commands/bundle_pull.rs Switches bundle entry fetches to fetch::drive_fetch, updates staging path semantics, and expands staging cleanup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/cli/src/commands/fetch.rs Resolved
Comment thread crates/cli/src/commands/bundle_pull.rs Resolved
Comment thread crates/cli/src/commands/bundle_pull.rs Resolved
@alpergundogdu
alpergundogdu force-pushed the feat/1621-p4-bundle-pull branch from c1eafd7 to f4d12b2 Compare August 7, 2026 09:42
alpergundogdu and others added 5 commits August 7, 2026 10:47
…le pull

Pulls the gap-driven driver core (header-probe -> ClientRangedStore -> PeerSource
-> drive -> watermark) out of fetch() into fetch::drive_fetch(deps, ctx, ...) so
bundle pull can share it (P4.2). Behavior-preserving for decdn fetch.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Restores the pre-extraction ordering: persist_watermark's rare non-advance
warning must print after the indicatif bar is cleared, not while it's active.
drive_fetch now takes a finish_progress hook called right after drive() returns.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…cy fetch loop

decdn bundle pull now fetches each blob through the shared gap-driven drive_fetch
(range-minimized, resumable via sidecars) instead of the single-cursor
fetch_blob_streaming loop. Staging files become plain finalized blobs (drive_fetch
owns the .partial + outboard sidecars). Deletes fetch_blob_streaming,
verify_resumed_prefix, combine_pull_and_flush, existing_partial_len, watermark_after,
and the fetch-local resume_may_be_stale — the two parallel fetch paths are now one.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
The plain <hex> (no .partial) naming is now load-bearing: drive_fetch derives
the .partial/.obao4/.ranges sidecar names from the staging stem.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
… nits

Extracts drive_fetch's money-critical watermark-reader selection (committed on
success/voucher-reject, settlement on ambiguous failure) into a pure helper with
a unit test for the three cases — restoring coverage lost with the legacy
watermark_after. Binds the staging hex name to a local and renames remove_staging's
cleanup array to paths_to_remove.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alpergundogdu
alpergundogdu force-pushed the feat/1621-p4-bundle-pull branch from f4d12b2 to 0689370 Compare August 7, 2026 09:47
@alpergundogdu
alpergundogdu changed the base branch from feat/1621-p3-client-blobsource to main August 7, 2026 09:47
@alpergundogdu
alpergundogdu merged commit 5973ab0 into main Aug 7, 2026
3 checks passed
@alpergundogdu
alpergundogdu deleted the feat/1621-p4-bundle-pull branch August 7, 2026 09:48
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Coverage report

Total: 80.74% (was 80.46%, ▲ +0.27%) — 59289/73435 lines

File Coverage Lines Δ
crates/cli/src/commands/bundle_pull.rs 49.79% 471/946 ▲ +0.81%
crates/cli/src/commands/fetch.rs 39.70% 507/1277 ▲ +0.32%
History
Commit Total Δ vs base
0689370 (HEAD) 80.74% ▲ +0.27%

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