Skip to content

fix(cli,client): put the entry floor on the multi-source path - #2141

Merged
thiras merged 1 commit into
mainfrom
fix/multi-source-entry-floor
Sep 24, 2026
Merged

thiras merged 1 commit into
mainfrom
fix/multi-source-entry-floor

Conversation

@thiras

@thiras thiras commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Refs #2123 (bullet: entry floor on the multi-source path)

The drive-level throughput floor from #2120 (--min-throughput-bps over --stall-timeout-ms, measured across every leg) covered single-source and range-dedup drives only. The multi-source scheduler's --unit-deadline-ms watchdog judges one lane's unit at a time. A fetch where every lane crawled just inside its deadline therefore never tripped anything, and -v showed no rate/ETA line.

Changes

  • decdn-client
    • New multi_source_fetch_until and Downloader::fetch_to_paths_until take a stop future. The existing entry points delegate with pending().
    • The stop has the same contract as drive_range_set's: it races only the workers inside drive_with_interval_flush. A pending record write lands, the final flush runs, and finalize is never timed.
    • A stop returns its own error, not wrapped in the "all sources failed" summary.
    • The progress callbacks on these entry points take a borrowed trait object (+ '_), as drive_range_set's already do. The public-api snapshot is regenerated.
  • CLI
    • multi_source_download runs under drive_floor, with one EntryWatch across all lanes and the funder wrapped in PausingFunder.
    • A trip returns EntryStalled (RetryElsewhere). fetch_over / fetch_to_staging already fall back to single-source failover on a retryable multi-source error and resume the .partial. Every lane's watermark is still persisted before the result is examined.
    • EntryWatch::observing builds the observe-then-forward callback for both drives. It is always installed, because the scheduler reports no progress without a callback (bars off).
  • Docs: ADR 039 § Failure handling, appendix-bundles § Failover and retry, CHANGELOG.

Tests

  • scheduler::a_stop_ends_the_fetch_and_keeps_the_landed_bytes_recorded: two crawling lanes with the unit watchdog off. The stop error comes back unwrapped, and both lanes' landed checkpoints are recorded.
    • Mutation-checked: removing the stop arm fails it.
  • downloader::a_stop_leaves_the_partial_for_a_resume: the target is not promoted, and the landed prefix is recorded.
  • fetch::observing_feeds_the_watch_with_or_without_a_ui_callback.

Local verification

  • cargo fmt --check, workspace clippy -D warnings --all-targets --all-features, and rustdoc -D warnings all pass.
  • nextest -p decdn-client -p decdn-cli -p decdn-common --all-features: 1653 pass, including public_api.
  • anvil e2e (cli_fetch_multi_source, cli_bundle_pull_multi_source, cli_fetch_resume, cli_bundle_pull_range_dedup): 10 pass.

🤖 Generated with Claude Code

The drive-level throughput floor covered single-source and range-dedup
drives only. The multi-source scheduler's unit watchdog judges one lane's
unit at a time, so a fetch whose lanes all crawl inside their deadlines
never tripped anything.

- `multi_source_fetch_until` and `Downloader::fetch_to_paths_until` take a
  `stop` that races only the workers, so the final present-record flush
  still runs and finalize is never timed.
- `multi_source_download` runs under `drive_floor` with an `EntryWatch`
  across every lane and a `PausingFunder`. A trip is `EntryStalled`, which
  falls back to single-source failover on the resumed `.partial`.
- `EntryWatch::observing` builds the observe-then-forward callback both
  drives install.
- The scheduler and Downloader progress callbacks take a borrowed trait
  object.

Refs #2123

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Copilot AI lite review requested due to automatic review settings September 24, 2026 06:34
@thiras thiras self-assigned this Sep 24, 2026

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.

Copilot review overview

🟡 Changes recommended

Two critical missing Future imports prevent the client crate from compiling.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity

Open (2)
What changed in this PR

Extends the throughput floor to multi-source downloads while preserving partial progress for failover and resume.

Changes:

  • Adds stop-aware scheduler and downloader APIs.
  • Applies entry-wide monitoring across multi-source lanes.
  • Updates tests, API snapshots, changelog, and ADRs.
File Summary
crates/​client/​tests/​snapshots/​public_api__public_api.snap Updates public API snapshots.
crates/​client/​src/​scheduler.rs Adds stoppable multi-source fetching.
crates/​client/​src/​lib.rs Re-exports the new API.
crates/​client/​src/​downloader.rs Adds stoppable download orchestration.
crates/​cli/​src/​commands/​fetch.rs Applies entry-level throughput monitoring.
CHANGELOG.md Documents the fix.
adr/​appendix-bundles.md Documents multi-source throughput behavior.
adr/​039-multi-source-parallel-fetch.md Records the throughput-floor design.

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

Comment thread crates/client/src/downloader.rs Resolved
Comment thread crates/client/src/scheduler.rs Resolved
@github-code-quality

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit 797421d in the fix/multi-source-ent... branch remains at 85%, unchanged from commit 93e2af9 in the main branch.

Show a line coverage summary of the most impacted files.
File main 93e2af9 fix/multi-source-ent... 797421d +/-
crates/client/src/streamer.rs 92% 91% -1%
crates/client/src/scheduler.rs 95% 95% 0%
crates/cli/src/...mmands/fetch.rs 53% 54% +1%
crates/node/src...gin/pull_leg.rs 88% 89% +1%
crates/client/s...c/downloader.rs 96% 97% +1%

@thiras
thiras merged commit dc4813c into main Sep 24, 2026
29 checks passed
@thiras
thiras deleted the fix/multi-source-entry-floor branch September 24, 2026 09:05
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