Skip to content

fix(cli,client): batch fix bundle-pull lane, watchdog and dedup bugs - #2212

Merged
thiras merged 9 commits into
mainfrom
fix/cli-bug-batch
Sep 28, 2026
Merged

thiras merged 9 commits into
mainfrom
fix/cli-bug-batch

Conversation

@thiras

@thiras thiras commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

What

Batch fix for the open bug,cli issues, one commit per issue.

Closes #2203, Closes #2193, Closes #2204, Closes #2209, Closes #2208
Refs #2211

Reviewer notes

  • bundle pull: whole-entry lane permits starve a proxy lane to width 1 #2208 is the one to read first.
    • SessionWalk::fill reserves the permit batch while holding none: the last drive gave its permits back, and a second batch in one fill only follows a pass in which every open failed.
    • Waits take one global sorted-Address order, as permit_set does.
    • The batch assumes the sessions of one pass have distinct providers. The stripe admits one per operator, and a reserve opens only when no session is open.
  • decdn-client API change, recorded under CHANGELOG Changed (BREAKING): new fields RangeLane::release, StreamCandidate::lease, SourceLane::lease, new types LaneRelease and LaneLease. The public-api snapshot is regenerated.
  • Not tested: LiveSessions::drive itself, which needs a live PullCtx. FakeSessions asserts that each drive gets exactly one permit per open session and that a reserve never holds one early. LaneGrant, the driver hook and the scheduler lease each have a unit test.
  • Out of scope for bundle pull: one SELECT_K sample for the whole run hides holders from every entry #2204: bundle pull still ignores the region allowlist (select_candidates_filtered) that decdn fetch honours.

Verification

  • cargo fmt -- --check
  • cargo clippy --workspace --all-targets -- -D warnings, plus cargo check -p decdn-e2e --features anvil-e2e --all-targets
  • cargo nextest run --workspace: 4207 passed
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items
  • public-api snapshot regenerated (decdn-client)
  • User-visible change: CHANGELOG.md entry added
  • Design change: ADR 039 and appendix-bundles.md updated

🤖 Generated with Claude Code

thiras and others added 7 commits September 28, 2026 12:13
spawn_harvest discarded every upsert_identity, record_sample and
prune_and_cap error. Probe samples are the only input to the latency
ranking, so a store that refuses writes froze the ranking with no log.
Each refused write now logs at debug with its peer, and a probe round
whose every record write fails logs once at warn.

ADR 039 said the client persists no per-lane outcome. A drive or stripe
lane that fails through a fault of the peer sets the failure stamp; the
ADR now says so.

Closes #2203

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…2193)

A failed donor's re-fetch spans whole chunk groups, so it can cover part
of a neighbour that spliced cleanly, and the drive then writes and pays
for those bytes. The neighbour's whole dst still counted as spliced, so
the run summary under-reported paid bytes.

reassemble_dedup now keeps one SpliceLedger per entry: the dst spans that
spliced and the spans every re-fetch or fallback drive covered, across the
first splice and every tail pass. spliced_bytes is the spliced union less
the driven union.

Closes #2193

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bundle pull read the registry once and kept one SELECT_K sample for the
whole run, so with 7 registered nodes two were invisible to every entry,
even when they were the only nearby holders. The run now keeps the whole
registry read and each entry draws its own sample before it probes. Each
entry already probes its candidates, so the fresh sample costs no extra
probe.

Closes #2204

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ts (#2209)

The multi-source unit watchdog sampled the store's missing-byte count,
which moves only when a 4 MiB ingest checkpoint lands. A proxy warming a
cold miss draws ~1 MB every ~2.5 s, so it landed no checkpoint within the
10 s default deadline and the watchdog killed it, failing the fan-out over
to single-source.

Each unit now keeps a verified-byte counter that fill_gap's reporter
advances on every bao-verified leaf, before the checkpoint is durable.
The watchdog trips only when a whole window passes with no verified byte
and the range still has bytes missing.

Closes #2209

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…2211)

Diagnostics for proxies that stall stripe legs for 30 s with no node-side
fault. At debug:

- each paid leg's open, with peer, hash, byte_offset and byte_len, so a
  stalled leg can be matched to the node's serve_stream of that range;
- each throughput-floor trip, with the range, cumulative against expected
  wire bytes, the bytes across the window, and the gap since the previous
  floor sample (a long gap means the reader was not polled);
- each ingest wait of 1 s or more on a checkpoint slot.

No behaviour change. #2211 stays open for the testnet rerun.

Refs #2211

Co-Authored-By: Claude Opus 5.5 <[email protected]>
)

bundle pull held --max-lane-streams permits for a whole entry: the range
path took one on every candidate, reserve and proxies included, across
every sub-drive and the waits on siblings; the multi-source path held one
per admitted provider for the whole fan-out, even after a lane died. A
proxy lane that needed width stayed at width 1.

Range path: the entry-wide permit set is gone. SessionWalk reserves one
permit per session it drives, in one sorted batch before it opens new
sessions, and hands them to the drive. Each lane's LaneGrant starts on
that base permit and grows as before. A new driver hook, LaneRelease,
fires as each gap worker stops, and the grant gives one permit back, so a
lane that faults or runs out of gaps frees its provider at once.

Multi-source path: each admitted provider's permit rides on its
StreamCandidate as a LaneLease, which the scheduler drops when that
lane's worker stops.

Closes #2208

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 28, 2026 09:48
@thiras thiras self-assigned this Sep 28, 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

Critical lane-permit assignment and cancellation-release bugs remain unresolved.

Review effort: Lite
Findings: 2 High severity

Open (2)
What changed in this PR

This PR fixes bundle-pull discovery, deduplication, watchdog progress tracking, diagnostics, and lane-permit handling across the client and CLI.

Changes:

  • Adds per-entry candidate sampling and corrected splice accounting.
  • Tracks verified-byte progress and expands operational diagnostics.
  • Introduces lane lease/release APIs and updates related consumers, tests, and documentation.
File Description
crates/​common/​src/​cli/​fetch.rs Updates watchdog option documentation.
crates/​client/​tests/​snapshots/​public_api__public_api.snap Regenerates the public API snapshot.
crates/​client/​src/​streamer.rs Threads lane leases into sources.
crates/​client/​src/​source.rs Adds paid-leg diagnostics.
crates/​client/​src/​scheduler.rs Adds leases and verified-progress watchdog logic; contains an unresolved cancellation-path lease-release issue.
crates/​client/​src/​ranged_store.rs Logs long checkpoint waits.
crates/​client/​src/​progress.rs Exposes throughput-floor diagnostics.
crates/​client/​src/​lib.rs Extends pull state and public exports.
crates/​client/​src/​driver.rs Adds per-worker release hooks; contains an unresolved permit-assignment race during worker growth.
crates/​client/​src/​downloader.rs Updates lane construction.
crates/​client/​examples/​common/​mod.rs Updates example lane construction.
crates/​cli/​src/​commands/​fetch.rs Adds harvest logging and lease plumbing.
crates/​cli/​src/​commands/​bundle_pull.rs Fixes sampling, deduplication, and permit handling.
CHANGELOG.md Documents user-visible changes.
adr/​appendix-bundles.md Documents bundle lane semantics.
adr/​039-multi-source-parallel-fetch.md Clarifies persisted failure-stamp behavior.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

github-code-quality Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit c4d67a2 in the fix/cli-bug-batch branch remains at 86%, unchanged from commit 8886c85 in the main branch.

Show a line coverage summary of the most impacted files.
File main 8886c85 fix/cli-bug-batch c4d67a2 +/-
crates/client/src/progress.rs 99% 97% -2%
crates/cli/src/.../bundle_pull.rs 77% 77% 0%
crates/client/src/lib.rs 92% 92% 0%
crates/client/src/scheduler.rs 95% 95% 0%
crates/client/src/source.rs 93% 93% 0%
crates/client/src/streamer.rs 91% 91% 0%
crates/cli/src/...mmands/fetch.rs 53% 54% +1%
crates/node/src...gin/pull_leg.rs 88% 89% +1%
crates/client/s...c/peer_store.rs 96% 97% +1%
crates/incentiv...eth_identity.rs 98% 99% +1%

Updated September 28, 2026 10:36 UTC

thiras and others added 2 commits September 28, 2026 13:04
…n stop (#2208)

Review follow-ups for the lane-permit change:

- A gap worker with no gap left sat in `notified.await` until the whole
  drive drained, so a lane that ran out of gaps kept every permit while
  another lane finished its last gap. A lane with a release hook now
  keeps one idle worker, for gaps a faulted lane puts back, and lets the
  others stop and give their permits back. The check runs under the gap
  queue lock, so two idle workers of one lane cannot both leave.
- A fetch that its `stop` future ended dropped each worker future
  unfinished, which skipped the lease release after `.await`. The lease
  now rides in a drop guard moved into the worker future.

Refs #2208

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…2208, #2209)

Review follow-ups:

- A lane shrinks its idle workers only when it has a growth hook too, so
  a release-only lane cannot drop to one worker for good.
- LaneGrant takes its base permit as required and derives the lane width
  from the permits it holds, so width and permits cannot drift apart.
- A lane-permit invariant break (no permit reserved for a session, or two
  sessions of one pass on one provider) is a typed LanePermitFault. It
  ends the walk and the entry instead of failing over and blaming each
  provider, and a duplicate provider no longer waits on its own permit.
- New tests: the watchdog through fill_gap with no progress callback (it
  fails if run_worker passes no counter, or if the counter moves below the
  on_progress early return), a candidate's lease reaching its lane, and a
  walk ended by a lane-permit fault.
- Doc accuracy: region-first sampling, one idle permit per drained lane,
  per-worker release on a fault, a stopped drive skipping the release
  hook, the watchdog's per-window sampling, and ADR 039's size-mismatch
  exclusion. A test doc line moves back to its own test.

Refs #2208, #2209

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants