Skip to content

fix(client): log the held range and re-queued bytes when a stolen-from lane faults - #2762

Merged
thiras merged 2 commits into
mainfrom
fix/lane-fault-held-range
Oct 29, 2026
Merged

thiras merged 2 commits into
mainfrom
fix/lane-fault-held-range

Conversation

@thiras

@thiras thiras commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What

A slow-victim steal trims the victim's in-flight range so that it ends at the split. The lane-fault WARN still printed the range the lane first picked. Read together with "its remainder goes to the other lanes", the line made the stolen tail look as if it went back to the queue and downloaded twice.

  • LaneRange.offset/len are now the range the lane held when it faulted, after any steal. The new fields are:
    • picked_offset / picked_len: the range as the lane picked it.
    • requeued: the missing bytes of the held range that the other lanes still fetch.
  • The run_worker Faulted arm keeps the Requeued value that it used to drop, and fills LaneRange from it. The early owed-span fault re-queues nothing, so there picked == held and requeued = 0.
  • record_fault and log_extra_fault log the new fields. The message text does not change.
  • Work stores the blob hash. The "stole the tail of a lane's missing remainder" line logs hash at debug (covered suffix) and at info (slow victim).

Closes #2376

Reviewer notes

  • requeued is Requeued.missing, not Requeued.bytes. requeue_from extends a run back to the paid frontier. The verified-but-unpaid span is already in the store, and only the lane that owes it bills it again, so bytes would overstate what other lanes fetch. missing keeps landed + requeued == len. Requeued.bytes and the Cancelled arm's debug line do not change.
  • The covered-refusal count now spans the held range only (record_covered_refusal in source_set.rs). The stolen tail is the stealer's, and a refusal of it counts on the stealer's lane. A refusal that arrives before any steal sees held == picked. A leg opened after a steal requests only the held range, because the steal lowers stop_at. So in practice the count changes only where it was wrong before.
  • landed reads the store, not the unit's verified counter. It is the bytes of the held range that were missing at the pick, minus the bytes still missing at the fault (landed_within). A healed leg or an owed span re-delivers bytes the store already holds, and the counter counts them again. The counter is now LaneRange::verified. It feeds the decisions that ask whether the provider sent any verified byte at all: the timestamp-refusal guard, the covered-refusal start and the extra-stream fault level. This addresses the Copilot review; see the thread.
  • LaneRange is #[doc(hidden)] and is not in the public-api snapshot.
  • Not done here: wire bytes received per lane (the issue's optional item 3). That is bundle pull: count wire bytes received per lane so arrived-but-unverified bytes show in the summary #2444.

Verification

  • New test a_fault_after_a_steal_logs_the_range_the_lane_held. A slow source is stolen from and then faults. It checks that the steal line carries hash=, that offset + len == split, that landed + requeued == len, that picked_offset == offset, and that picked_len > len.
  • Mutation: going back to offset: r_start, len: r_len fails the test ("the held range ends at the split"). Logging Requeued.bytes fails landed + requeued == len.
  • a_leg_that_only_re_delivers_lands_nothing: a second leg that only re-delivers the first leg's owed span logs landed=0. With landed read from the counter, it logs landed=245760 and the test fails.
  • landed_counts_each_new_byte_of_the_held_range_once (the helper). Removing the clip to the held range fails it and the steal test.
  • cargo nextest run -p decdn-client: 1214 passed
  • Public-api snapshot test for decdn-client
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • CARGO_BUILD_WARNINGS=deny cargo doc -p decdn-client --no-deps --document-private-items
  • pre-commit hooks on commit
  • CHANGELOG entry under ### Changed
  • No test reaches the info-level (slow-victim) steal line. This fixture produces a covered-suffix steal, so the test checks hash= on the debug arm. The same edit adds hash to both arms.

🤖 Generated with Claude Code

@thiras thiras self-assigned this Oct 29, 2026
Copilot AI balanced review requested due to automatic review settings October 29, 2026 19:23

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.

🟡 Changes recommended

The scheduler’s landed count includes replayed bytes after watermark healing, breaking the landed-plus-requeued invariant; it needs distinct-coverage accounting and a healed-then-faulted regression test.

1 open issue
What changed in this PR

This PR improves client diagnostics for lane faults after a steal, making the held range distinct from the original pick and the stolen tail.

Changes:

  • Logs held and picked ranges alongside missing bytes re-queued after a fault.
  • Adds the blob hash to both steal log variants.
  • Adds regression coverage and documents the updated log fields.
File Description
crates/​client/​src/​source_set/​tests.rs Updates range fixtures and checks fault log fields.
crates/​client/​src/​source_set.rs Extends LaneRange and logs held-range details.
crates/​client/​src/​scheduler/​tests.rs Adds a steal-then-fault logging regression test.
crates/​client/​src/​scheduler.rs Preserves held-range requeue details and adds hashes to steal logs.
CHANGELOG.md Documents the revised diagnostics and refusal-counting scope.

Review effort: Balanced

Comment thread crates/client/src/scheduler.rs Outdated
Comment on lines +2795 to +2796
landed,
requeued,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 254f91d.

unit.progress.verified goes up for every byte a leg reports. That includes bytes a leg delivers again after a heal, and an owed span that a gap reopens at the pick (rebills). So landed could count a byte twice, while requeued counts distinct bytes.

  • The logged landed now reads the store. landed_within counts the bytes of the held range that were missing at the pick, minus the bytes still missing at the fault. A byte never leaves the store, so each byte counts once. The watchdog and the rate counter are unchanged.
  • The counter moves to a new LaneRange::verified field. It doesn't go away, because three decisions ask whether the provider sent any verified byte at all, not how many were new:
    • The timestamp-refusal guard (source_set.rs). If the guard read the distinct count, a peer could re-deliver an owed span and then send TIMESTAMP_SKEW to have its fault booked as clock skew. The guard test now sets only verified, with landed: 0.
    • The covered-refusal start, offset + verified. Its behaviour is unchanged.
    • The extra-stream fault level. Its behaviour is unchanged.
  • Regression test: a_leg_that_only_re_delivers_lands_nothing. Two readers fault at the same wire offset. The second re-delivers the first one's owed span and makes nothing new present, so its fault line must say landed=0 and re-queue what the first did. With landed read from the counter, it logs landed=245760 and fails.
    • This drives the owed-span re-delivery, not a voucher heal. The scheduler's ScriptedSource has no heal injection. Both paths re-deliver through the same counter, and landed no longer reads that counter.
  • landed_counts_each_new_byte_of_the_held_range_once pins the helper: a prefix that was present at the pick doesn't count, and the count is clipped to the held range.

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main f3e6938 fix/lane-fault-held-... f2b11ab +/-
77% 77% 0%
View coverage of the 4 most impacted files.
File main f3e6938 fix/lane-fault-held-... f2b11ab +/-
crates/client/src/scheduler.rs 94% 94% 0%
crates/node/src...s/client/mod.rs 91% 91% 0%
crates/client/s...c/source_set.rs 93% 93% 0%
crates/node/src/dht/publish.rs 78% 80% +2%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

thiras and others added 2 commits October 29, 2026 22:55
…m lane faults

A steal trims the victim's in-flight range to end at the split, but the
lane-fault line printed the range the lane first picked. Read with "its
remainder goes to the other lanes", the stolen tail looked re-queued.

The Faulted arm of run_worker keeps the Requeued value and fills
LaneRange from it: offset/len are the held range after any trim,
requeued is the missing bytes of that range (Requeued.missing, which
leaves out the owed span the run is extended to), and
picked_offset/picked_len are the pick. With no byte held at the pick,
landed + requeued == len. The covered-refusal count in SourceSet now
spans the held range only; the stolen tail is the stealer's.

Work stores the blob hash, and the steal line logs it at debug and info.

Closes #2376

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The lane-fault line logged `landed` from the unit's verified counter. A
leg that delivers bytes the store already holds, after a heal or when it
bills an owed span, adds them to that counter again, so `landed` could
count a byte twice while `requeued` counts distinct bytes.

`landed` now reads the store: the bytes of the held range that were
missing at the pick, less the bytes still missing at the fault
(`landed_within`). A byte never leaves the store, so it counts once.

The counter moves to a new `LaneRange::verified` field. The decisions
that ask whether the provider sent any verified byte keep reading it:
the timestamp-refusal guard (a peer that re-delivers an owed span and
then sends a clock code stays an ordinary source fault), the
covered-refusal start, and the extra-stream fault level. The watchdog
and the rate keep the counter, unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thiras
thiras force-pushed the fix/lane-fault-held-range branch from 254f91d to 905b9ad Compare October 29, 2026 19:56
@thiras
thiras merged commit c44dfb2 into main Oct 29, 2026
3 checks passed
@thiras
thiras deleted the fix/lane-fault-held-range branch October 29, 2026 19:56
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.

client: lane-fault WARN prints the pre-steal range, so a stolen tail reads as re-queued

2 participants