Skip to content

fix(client,node,cli): bar refused pull-through, refuse over-ceiling ranges, heal stale under-fold, hold expiry margins - #2263

Merged
thiras merged 13 commits into
mainfrom
fix/cli-batch-2262-2257-2256-2242
Oct 1, 2026
Merged

thiras merged 13 commits into
mainfrom
fix/cli-batch-2262-2257-2256-2242

Conversation

@thiras

@thiras thiras commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What

Four bugs that make decdn bundle pull re-ask the wrong provider or abort a pull that could finish, plus the missing expiry/deadline margins.

Closes #2262
Closes #2257
Closes #2256
Closes #2242

Reviewer notes

Verification

  • cargo fmt -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo nextest run --workspace: 4385/4385 passed, none flaky on the final run
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items
  • public-api snapshot (decdn-client): regenerated (LaneRange::uncovered, exhausted arity, no_pull_through/record_pull_through/expire_pull_through_bars, PULL_THROUGH_BAR, HealExhausted, BlobTooLarge::reached) and passing
  • cargo build --bin decdn-node + anvil_settlement_e2e: 4/4 passed
  • check_crate_edges.py: OK
  • User-visible change: CHANGELOG.md entries added
  • Design change: ADR 003, 005 and 039 updated

🤖 Generated with Claude Code

thiras and others added 9 commits October 1, 2026 11:03
…rage

A probed partial holder that cannot serve a block by pull-through refuses
it with NotFound. The scheduler kept handing that block back to the
holder each time its cooldown ended, because a probed holder's NotFound
only cools it.

The worker now marks a pick that lies wholly outside its lane's coverage,
and the fault's LaneRange carries it as `uncovered`. Three NotFound
answers for such ranges bar the holder from pull-through in the
SourceSet. The loop mirrors the bar into the Work state, so a barred lane
takes only the blocks it covers: pick skips uncovered parts, and
has_work_for and growth_wanted no longer count them for it. A verified
byte on an uncovered pick, or a discovery that reports wider coverage,
lifts the bar. A covered byte does not.

When every source is absent or barred, and no work left lies inside a
barred holder's coverage, `exhausted` ends the item with the refusal, as
a unanimous NotFound does. Discovery keeps looking for a wider holder
until then.

Closes #2262

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A proxy whose size ceiling is below the blob refuses it with
BlobTooLarge. The fault only cooled it, so the client sent it the same
range again each time the cooldown ended.

The SourceSet now keeps a per-blob too-large exclusion. record_fault adds
a provider whose refusal is BlobTooLarge, and next_to_start (and so
lanes_to_start) never starts it again for this blob. The ceiling is a
stable node policy (ADR 005: do not retry the same node), so neither a
verified byte nor a rediscovery lifts it. The unanimous verdict counts it
like an absent source, so an item where every source is excluded still
ends, with the refusal in its error chain.

Refs #2256

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

After a payer crash, the new process opens a fresh root at its persisted
watermark and keeps releasing reveals before the node's UnderFold lands.
The rejection rewinds only the last reveal, so the ledger already covers
the bundle: reseed refuses it, the heal returns Stale, and the refused
root stays live. Every retry re-anchors under it and draws the same
UnderFold until the resume budget runs out, and the UpstreamVoucherRejected
then aborts the whole bundle as Fatal(Command).

- PoolLedger::retire_unadopted_chain folds the pipeline to settlement()
  and retires the chain under the issuance lock, which is the state a new
  process starts in. The next stream opens a fresh root over the whole
  fold, which the node adopts. settlement() does not move, so the persist
  path needs no unsaved-rebase overwrite.
- A healed_from watermark, set by reseed, rebase, and the retire, lets
  sibling streams that took the same rejection skip the retire, so they
  leave alone the chain the healed lane opened next.
- already_covered retires on an UnderFold in both the past and the equal
  branch: a ledger can sit exactly at the bundle when the surviving
  reveals match the node's frontier, and the guard covers the
  sibling-reseeded case the equal branch used to stand for.
- fault::classify makes a lane-desync rejection (AmountRegression,
  BytesRegression, Underpaid, UnderFold) a Source fault, so a heal that
  still fails cools one source instead of ending the command. Capability,
  signer, and SpendingCapExhausted rejections stay Fatal(Command).
- Reseeds, retires, and the driver's heal retry log at info, so -v shows
  why a leg reopened. ADR 039 states the narrower fatal set.

Closes #2257

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

A proxy whose max_blob_size sits below a blob signed ok: true for an
over-ceiling range, then cut the stream when the received bytes crossed
the ceiling. The client saw a bare stream fault and sent the same range
back to the same proxy.

serve_via_window_pull_through now checks the requester's own range
against the ceiling before it commits, and refuses with the wire
BlobTooLarge, which the client must not retry against this node:

- a start at or past the ceiling is refused before discovery and the
  upstream handshake;
- a bounded range whose end, clipped to the blob, crosses the ceiling
  is refused once total_bytes is known.

Both gates read only byte_offset and byte_len. The upstream's
total_bytes claim can only pull the end down, so it cannot push a
request over the ceiling (#1895), and an over-long byte_len on a blob
within the ceiling is still served. An open-ended request below the
ceiling still commits and is bounded by the received-byte abort.

The refusal is a new ServeRejectReason::BlobTooLarge, metered on the
sibling counter decdn_serve_stream_rejected_blob_too_large_total, which
joins INBOUND_FAILURE_REASONS and both dashboards. ADR 005 and the
decdn_node_pull_too_large_total and StreamResponseBody::total_bytes docs
now say the ceiling binds on received bytes, not on the claim. The
client's BlobTooLarge message names the byte position it reached.

Closes #2256

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e deadlines

ADR 003 promises that a node stops serving a signer with a margin before
the capability's expiry, so it never holds a voucher it cannot redeem.
The node accepted vouchers right up to the expiry, the redeemer planned
redemptions right up to a Closing deadline and for expired capabilities,
and pool assign checked the expiry against the local clock.

- Voucher acceptance rejects with CapabilityExpired once
  now + margin >= expiry. The margin is one redeem interval plus a
  120 s landing slack (REDEEM_LANDING_SLACK_SECS), so a voucher accepted
  at the edge still meets one sweep before the expiry. The handler takes
  blockchain.redeem_interval_secs through ClientHandlerDeps.
- The redeemer drops a funded Closing pool once its deadline falls
  within the landing slack: a PoolClosed revert takes the whole
  redeemMany batch down.
- plan_lanes takes now from its callers and skips a lane whose
  capability expires within the slack, since the contract pays 0 for
  it. The skip is metered on the sibling counter
  decdn_redemption_skipped_expired_total, also on the chain dashboard.
- pool assign checks the expiry against the chain head's timestamp, the
  clock the contract applies. When the head cannot be read it warns and
  falls back to the local clock, so offline issuance stays valid.

ADR 003 states the margin and the planner's skips; the CapabilityExpired
docs in the protocol crate and ADR 005 name the node's expiry margin.

Closes #2242

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…side the node margin

The redeemer checked capability expiry before plan_lane dropped a lane
with nothing owed. A fully redeemed lane stays in the store until its
pool is reclaimed, so once its capability expired it bumped
decdn_redemption_skipped_expired_total on every sweep. The expiry skip
now runs on a planned lane only, so the counter counts stranded value.

pool assign issued a capability whose lifetime lies within the default
node's expiry margin without a word, though such a node refuses every
voucher under it. It now warns. REDEEM_LANDING_SLACK_SECS and
capability_expiry_margin_secs move to decdn-common so the CLI computes
the same margin as the node.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ll-through on a too-large partial holder

A bare watermark-gated voucher rejection is Fatal(Command) again, as ADR 005
says: BytesRegression, Underpaid with no bundle, and a trailing proof the
ledger covers on amount but not bytes have nothing to retry from. Only a
rejection the driver heals after the lane spends MAX_RESUME_ATTEMPTS is
marked HealExhausted (a context marker that keeps the rejection in the
chain), which classify reads as a Source fault, so that source cools.

A BlobTooLarge refusal from a partial holder bars only its pull-through,
because the node applies its size ceiling only on the miss path. Whole
holders and proxies keep the whole-blob exclusion.

ADR 039 states the narrower rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A heal past the resume budget marks the rejection HealExhausted, which
classifies as a source fault. A spending-cap rejection whose bundle
reseeds the ledger took that path too, skipped the exhaustion check, and
cooled one source for a cap that is the pool's. It now falls through to
the exhaustion check and, when not genuine, ends the command.

Refs #2257

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thiras thiras self-assigned this Oct 1, 2026
Copilot AI balanced review requested due to automatic review settings October 1, 2026 09:11

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

Stable size-ceiling bars can be cleared incorrectly, and some fatal voucher regressions can be downgraded to source faults.

Review effort: Balanced
Findings: 2 High severity · 1 Medium severity · 1 Low severity

Open (4)
What changed in this PR

Fixes provider retry loops, over-ceiling range handling, stale payment-lane healing, and expiry/deadline safety margins.

Changes:

  • Adds source exclusion and payment-ledger recovery logic.
  • Enforces node size ceilings and redemption safety margins.
  • Updates tests, metrics, dashboards, ADRs, and user documentation.
File Description
CHANGELOG.md Documents the four fixes.
adr/​003-payments.md Defines expiry and redemption margins.
adr/​005-protocol.md Updates rejection and size-ceiling semantics.
adr/​039-multi-source-parallel-fetch.md Clarifies healed lane-fault handling.
crates/​common/​src/​cli/​pool.rs Documents chain-based expiry timing.
crates/​common/​src/​config/​mod.rs Adds shared margin constants.
crates/​protocol/​src/​client.rs Updates protocol documentation.
crates/​client/​src/​driver.rs Handles exhausted healing retries.
crates/​client/​src/​fault.rs Adds HealExhausted classification.
crates/​client/​src/​first_open.rs Applies updated source exhaustion behavior.
crates/​client/​src/​ledger.rs Retires unadopted payment chains.
crates/​client/​src/​lib.rs Implements watermark healing changes.
crates/​client/​src/​scheduler.rs Prevents barred pull-through scheduling.
crates/​client/​src/​source.rs Extends source test doubles.
crates/​client/​src/​source_set.rs Tracks unavailable and over-ceiling sources.
crates/​client/​tests/​snapshots/​public_api__public_api.snap Updates the public API snapshot.
crates/​cli/​src/​commands/​pool.rs Uses chain time and warns on short expiry.
crates/​node/​src/​handlers/​client/​mod.rs Adds ceiling and expiry configuration.
crates/​node/​src/​handlers/​client/​outcome.rs Meters size-ceiling refusals.
crates/​node/​src/​handlers/​client/​voucher.rs Enforces capability expiry margins.
crates/​node/​src/​handlers/​client/​window.rs Refuses over-ceiling ranges before commit.
crates/​node/​src/​metrics.rs Adds rejection and expiry counters.
crates/​node/​src/​node_origin/​mod.rs Exposes the pull size ceiling.
crates/​node/​src/​node_origin/​pull_leg.rs Adjusts healed rejection scope.
crates/​node/​src/​payment_settlement.rs Adds deadline and expiry planning margins.
crates/​node/​src/​runtime/​mod.rs Passes the redeem interval to handlers.
crates/​node/​tests/​client_loopback.rs Tests healing and expiry boundaries.
crates/​node/​tests/​node_origin_pull.rs Tests over-ceiling range refusals.
monitoring/​dashboard-chain.json Charts expired redemption skips.
monitoring/​dashboard-delivery.json Charts and attributes size refusals.
monitoring/​grafana-dashboard.json Updates fleet-level refusal monitoring.

💡 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/driver.rs Resolved
Comment thread crates/client/src/scheduler.rs Resolved
Comment thread crates/client/src/source_set.rs Resolved
Comment thread crates/client/src/driver.rs Resolved
@github-code-quality

github-code-quality Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit 3718ea6 in the fix/cli-batch-2262-2... branch remains at 87%, unchanged from commit 6e1f8b4 in the main branch.

Show a line coverage summary of the most impacted files.
File main 6e1f8b4 fix/cli-batch-2262-2... 3718ea6 +/-
crates/client/src/fault.rs 97% 96% -1%
crates/cache/src/engine.rs 94% 94% 0%
crates/node/src...lient/window.rs 75% 75% 0%
crates/client/src/source.rs 94% 94% 0%
crates/node/src...t_settlement.rs 83% 84% +1%
crates/cli/src/...ommands/pool.rs 68% 69% +1%
crates/client/src/scheduler.rs 94% 95% +1%
crates/cli/src/...ds/chain_ctx.rs 89% 90% +1%
crates/client/src/ledger.rs 98% 99% +1%
crates/client/s...c/source_set.rs 95% 97% +2%

Updated October 01, 2026 16:50 UTC

… lane rejections

Review follow-ups on the batch:

- A heal reseeds on any reason whose bundle is ahead of the ledger, so a
  BytesRegression past the resume budget took the HealExhausted marker and
  classified as a source fault. Only UnderFold, AmountRegression and
  Underpaid are marked now; BytesRegression stays fatal for the command
  (ADR 005), and a spending-cap rejection still reaches the exhaustion check.
- A size-ceiling refusal from a partial holder shared the NotFound bar, so a
  later pull-through byte or a wider-coverage rediscovery lifted it and the
  holder was asked again for the over-ceiling range. It is its own bar now,
  kept for the blob.
- A worker reports when it last verified an uncovered byte, and the bar
  lifts only for a byte verified after the last refusal. An extra worker
  that ends late no longer clears a bar its sibling set.
- The voucher_cost doc comment is back on voucher_cost.

Refs #2257, #2262, #2256

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

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

The range gate still trusts an unverified size claim, and concurrent event timing can preserve an invalid pull-through bar.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 2 Low severity

Open (4)
Resolved since last review (4)

Comment thread crates/client/src/source_set.rs Resolved
Comment thread crates/client/src/ledger.rs Resolved
Comment thread crates/protocol/src/client.rs Resolved
… bars by event time

Review follow-ups on the batch:

- The pull-through end gate bounded the request's end by the upstream's
  unverified total_bytes, so an inflated claim could refuse an over-long
  request on a small blob: the #1895 refusal-on-claim attack. A gate on
  the requester's end alone would refuse node-to-node legs that run one
  chunk group past the requester's own ceiling. The node now gates only
  the request's start; a range that starts below the ceiling commits and
  the received-byte abort stops it, and its remainder meets the start
  gate. ADR 005 says so.
- A lane fault carries the time the worker saw it, and the source set
  keeps each partial holder's last uncovered refusal and last uncovered
  verified byte. A refusal older than a taken byte does not count, and a
  byte older than the last refusal does not lift the bar, so the order in
  which the loop takes worker ends cannot change the result.
- ADR 005's UnderFold row names the retired-root case beside the sibling
  echo, and the CapabilityExpired docs promise one redeem sweep before
  expiry, not a redemption: the chunk floor can still defer a small lane.
- Remove a stray public-api .snap.new committed by accident.

Refs #2256, #2262, #2257, #2242

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@thiras
thiras enabled auto-merge (squash) October 1, 2026 10:02
@alpergundogdu

Copy link
Copy Markdown
Contributor

Review: approve with nits

All four issues (#2262, #2256, #2257, #2242) are fixed with targeted tests. No correctness problems found in the paid-pull path, voucher accounting or expiry arithmetic. CI is green.

Findings

  1. Medium (cross-repo, sponsord): walletless pull fails near capability end of life. sponsord/crates/wrapper/src/flow.rs:19 reuses a saved capability while more than 300 s (EXPIRY_MARGIN_SECS) remain. A default node now refuses vouchers 420 s before expiry. A pull started with 301-420 s left gets CapabilityExpired, which is Fatal(Command), so the bundle pull aborts instead of the wrapper fetching a fresh capability.
    Fix: derive the sponsord margin from decdn_common::config::capability_expiry_margin_secs(DEFAULT_REDEEM_INTERVAL_SECS) plus slack.

  2. Medium: a pull-through bar almost never lifts (crates/client/src/source_set.rs:549, record_pull_through). Only a verified byte on an uncovered range lifts it, and a barred holder is never handed an uncovered range again. Load-shed (LoadShedMiss), ChainStale and signer-floor refusals also reach the client as NotFound, so a partial holder that sheds miss load 3 times is barred for the rest of the blob. If every other source is absent, the item ends NoSourceHasBlob even though the holder would serve once load drops.
    Fix: let the bar expire after a cooldown (e.g. health::COOL_CAP) so the holder gets one probe pick, or count only the coverage-gate refusal if the node can distinguish it. The CHANGELOG line "a verified byte on an uncovered pick lifts the bar" overstates the behavior either way.

  3. Low: decdn pool assign can hang on an unresponsive RPC. issuance_now (crates/cli/src/commands/pool.rs:955) calls head_timestamp over an HTTP provider with no timeout. An endpoint that accepts and never answers stalls assign before it falls back to the local clock.
    Fix: wrap it in tokio::time::timeout(Duration::from_secs(5), ...) and treat a timeout as the fallback case.

Nits

  • The PR body says the node also refuses "an end bounded by the blob that crosses it". window.rs, ADR 005 and the CHANGELOG check only the start. Edit the body.
  • crates/node/src/metrics.rs:3133 says the request is refused when its range "crosses" the ceiling; it is refused only when it starts at or past it. Reword.
  • crates/node/src/metrics.rs:1736: doc line of ~150 characters; re-wrap.
  • crates/client/src/lib.rs:735: the BlobTooLarge message says "reached byte" but the field is still received. Consider renaming to reached.

Ops item

The lon1/fra1 max_blob_size_mb = 8192 question is tracked internally: the fleet moves to a 16 GiB disk headroom so those nodes can drop the override and take the fleet's 16 GiB cap.

@alpergundogdu

Copy link
Copy Markdown
Contributor

Decisions on the review findings

  • Pull-through bar (finding 2): please let the bar expire after a cooldown (reuse health::COOL_CAP) so a barred holder gets one probe pick, and re-bars after 3 more refusals if it still can't pull through. Client-only, no wire change. Update the CHANGELOG line to match.
  • sponsord margin (finding 1): not blocking this PR; tracked as a sponsord follow-up issue.
  • pool assign timeout (finding 3) and the nits: please fix in this PR.
  • lon1/fra1 ops item: handled internally (fleet headroom to 16 GiB, overrides dropped).

sponsord follow-up: decdn/sponsord#10

…ign head read

Review follow-ups on the batch:

- A node answers NotFound for load shed and a stale chain view as well as
  for a range no candidate covers, so three transient refusals barred a
  partial holder for the rest of the blob. A NotFound bar now ends one
  minute (PULL_THROUGH_BAR, the longest cooldown) after the refusal that
  set it; the holder takes one uncovered range as a probe, and three more
  refusals bar it again. The loop wakes when a bar ends. A holder counts
  as unable to serve the work left only when it is barred again after its
  probe, so a sole partial holder still gets that probe before the item
  ends. A size-ceiling bar does not end.
- `decdn pool assign` waits at most 5 s for the chain head before it falls
  back to the local clock, so an RPC that accepts and never answers cannot
  stall it.
- `decdn_client::BlobTooLarge` names its position field `reached`, matching
  its message. Metric docs say a pull-through is refused when it starts at
  or past the ceiling, and a long doc line is re-wrapped.

Refs #2262, #2256, #2242

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

thiras commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in 8ba25db:

  • Finding 2 (pull-through bar): confirmed. LoadShedMiss and ChainStale reach the wire as NotFound (handlers/client/mod.rs:736-739).
    • A NotFound bar now ends PULL_THROUGH_BAR (= health::COOL_CAP) after the refusal that set it. The holder gets one uncovered probe, and three more refusals bar it again. The loop wakes when a bar ends.
    • One addition beyond the decision: a barred holder counts toward ending the item only once it is barred again after its probe. Without that, a sole partial holder would still end the item on its first bar and never get the probe.
    • The size-ceiling bar does not expire. The CHANGELOG line is updated.
    • Tests: a_not_found_bar_ends_after_its_time_and_the_count_restarts, plus the updated a_sole_barred_partial_holder_ends_only_the_item, which now expects 6 asks. Both fail with the expiry disabled.
  • Finding 3 (pool assign hang): issuance_now wraps the head read in a 5 s timeout and treats a timeout as the local-clock fallback. Test: issuance_now_falls_back_when_the_rpc_never_answers, which uses a listener that accepts and never answers.
  • Nits:
    • The PR body no longer claims an end gate. Since 8c45706 the node checks only the start, because the end would need the unverified total_bytes.
    • The metrics.rs refusal docs say "starts at or past", and the long line is re-wrapped.
    • BlobTooLarge.received is renamed reached. The public-API snapshot and the CHANGELOG are updated.
  • Finding 1 (sponsord): left to Derive the wrapper's capability reuse margin from the node's expiry margin sponsord#10. The PR body lists it under Deferred.

Workspace: 4385/4385 tests, clippy --all-features -D warnings, cargo doc -D warnings and the public-API snapshot all pass.

…57-2256-2242

# Conflicts:
#	adr/005-protocol.md
@thiras
thiras disabled auto-merge October 1, 2026 16:43
@thiras
thiras enabled auto-merge (squash) October 1, 2026 16:58
@thiras
thiras disabled auto-merge October 1, 2026 16:59
@thiras
thiras merged commit cb83e28 into main Oct 1, 2026
30 checks passed
@thiras
thiras deleted the fix/cli-batch-2262-2257-2256-2242 branch October 1, 2026 16:59
thiras added a commit that referenced this pull request Oct 5, 2026
…ale coverage and dedup slots (#2305)

* fix(incentive,cli): keep an adopted pool's redeemed spend on later runs (#2292)

A row adopted from chain has no lanes, so the pool's `totalRedeemed` is
its only record of what other lanes paid out. Only the adopting run saw
it: every later run reused the row as tracked, passed zero as the spend
elsewhere, and counted just the lanes recorded since. The proactive
refill then read the pool as fuller than it was, and the run's funding
baseline undercounted the same spend.

`BuyerPoolState` now carries `redeemed_elsewhere`, set from
`totalRedeemed` at adoption and persisted at the end of the buyer
record (schema v4). `pool_spend` and the lane's `LaneSpend` read it from
the row, so every run that reuses the row sees what the adopting run saw.

Closes #2292

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

* fix(client): skip sub-floor reactive top-ups and raise running lanes on a refill (#2296)

Right after a proactive refill restored a pool, a node whose chain
watcher had not seen it yet refused the next open as InsufficientDeposit.
The driver confirmed an exhaustion, and the pacer topped up the gap to
the working deposit: a few micro-USDC, each costing an approve and a
topUp transaction and one of the run's three reactive top-ups. Lanes
built before the refill also kept the deposit they were built with, so
one classed a gap the refill had paid for as unaffordable.

- The pacer sends a reactive top-up for a confirmed exhaustion the
  deposit can still afford only when it adds at least the low water
  (working / LOW_WATER_DIVISOR), the threshold the proactive refill
  uses. A voucher the deposit cannot pay still tops up any shortfall.
- An InsufficientDeposit refusal while the deposit already sits within
  that low water of the working target settle-waits on the existing
  budget before it confirms an exhaustion.
- A lane build raises the pool's deposit watch and every started lane's
  context to the deposit it read, never lowering one, in place of only
  seeding a zero watch.

Closes #2296

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

* fix(client): drop a partial holder's coverage block after repeated NotFound inside it (#2281)

A probed partial holder that refused a range its own coverage claimed was
never counted: the answer was a delivery fault only, so the holder cooled
for a few seconds and was asked for the same range again, for as long as
the item ran. On the testnet one node refused 108 ranges inside its
advertised coverage in one batch, each followed by a stalled remainder.

Such a refusal now counts against every discovery block the refused range
touches. The node refuses the whole range at its first chunk it does not
hold and does not say which chunk that is. A block refused
ABSENT_AFTER_NOT_FOUND times leaves the holder's coverage for the rest of
the blob, and a rediscovery that repeats the stale claim does not bring it
back. The acquire loop mirrors the narrowed coverage into its per-lane
view, so the block's ranges go to the other sources. Once the block is
outside the coverage, the pull-through bar from #2263 bounds any further
asks.

Closes #2281

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

* fix(cli): free a --jobs slot while a range-dedup entry waits for its donor (#2283)

A range-dedup entry held its --jobs permit after its complement landed,
while it only waited for the sibling fetch that registers its donor
chunks. A waiter moves no bytes, yet it kept a queued entry from
fetching. On an SDXL pull with --jobs 5, two or three such waiters held
the run to 2-3 downloading entries for minutes at a time.

Two caps both equalled --jobs: the gate semaphore and run_groups'
buffer_unordered width. Every group is now in flight at once and waits
in start order for a FetchSlot of the gate, the one cap, taken before
its file bar. The dedup reconcile gives the slot back just before it
waits for a donor registration, and every drive (complement, donor
re-fetch, deferred fallback, self-heal) takes one again first. No wait
happens while a permit is held, so the change cannot deadlock.

Closes #2283

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

* fix(incentive): move the buyer tables to _v6 for the schema-4 record

Record schema 4 appends `redeemed_elsewhere` (#2292). The reader matches
`schema_version` exactly, so under the `_v5` tables a row an older binary
wrote fails a point lookup, and `decdn fetch` fails with it. Under `_v6`
the old table reads as absent: the store starts empty, and a node or
client re-adopts its live pool from chain, now with its redeemed spend.

Records the four batch fixes in CHANGELOG.md.

Refs #2292

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

* fix(incentive,cli,node): count an adopted pool's redeemed spend as its lanes advance (#2292)

Keeping `totalRedeemed` as a floor under the tracked lanes' sum lost
spend once a tracked lane advanced. With 100 redeemed, 60 of it on lane
A, A advancing to 80 read as max(80, 100) = 100, while the pool had
spent 120.

`redeemed_elsewhere` is now the redeemed spend no tracked lane accounts
for. Seeding a lane from its on-chain watermark (`seed_lane`, and
`BuyerPoolStore::seed_progress` in one write) records the lane and takes
its amount out of that remainder, so `BuyerPoolState::pool_spend` is the
tracked lanes plus the remainder, and stays right as the lane advances.
`decdn fetch` seeds a lane it resumes from chain before it reads the
spend. The node adopts with `totalRedeemed`, seeds through
`seed_progress`, and its low-water refill reads `pool_spend`. Without
this, the `_v6` move would re-adopt every node's pool with no spend
counted at all.

Refs #2292

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

* fix(client): decay covered-NotFound block drops and count extra-stream refusals (#2281)

A covered NotFound is not proof of absence: load shed and a stale
chain view reach the client as the same wire NotFound. A dropped block
now returns after PULL_THROUGH_BAR, with its count restarted, and a
count whose last refusal is that old starts again, so sparse transient
refusals never add up. Rediscovery keeps a block out only until its
drop ends.

A NotFound for a covered range on an extra stream now counts too: the
scheduler passes every extra-stream refusal to `record_extra_refusal`,
which splits covered from uncovered itself.

Refs #2281

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

* fix(client): keep stale-view refusals and cap-refused extras from pricing out or dropping a source (#2296, #2281)

Review of #2305:

- A source that keeps refusing a deposit near the working target past
  its own settle budget faults as `StaleDepositView`, classified as a
  source fault, with one WARN. It used to fall through to a confirmed
  exhaustion that the pacer floor refuses, which read as PoolExhausted
  and barred the source until a deposit rise no top-up brings. The
  budget is separate from the post-top-up settle budget and re-arms on
  a landed leg; its waits log.
- An extra stream's covered NotFound is not counted again: a node's
  per-signer live cap, which extra streams hit, refuses as plain
  NotFound.
- Covered refusals count from the refused part of a range (after its
  landed bytes), once per cooldown, and a verified byte in a block
  clears its count. A probe that reports a holder as whole ends its
  block drops, so a drop's end cannot make it partial again.
- `raise_to_lane` recovers a poisoned context like its siblings.
- Tests for the stale-view fault, the burst and served-byte rules, a
  whole-holder merge, `Work::set_coverage` restore, a raise that never
  lowers, and `LaneLedgers::raise_all`.

Refs #2296
Refs #2281

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

* fix(cli): hold a dedup waiter's slot again once its donor wait ends (#2283)

Review of #2305: a waiter whose donors arrived without a fallback
drive finished with its slot still released, so its splice, whole-file
hash and materialize ran outside --jobs. The donor wait now gives the
slot back only across the wait (`RangeDriver::retake_slot`).

A slot taken again would otherwise queue behind every group still to
start. `JobGate` adds an admission queue for new groups' first permit,
so a retake waits behind at most the one admitted group.
`FetchSlot::ensure` keeps the first permit if two ever race.

Refs #2283

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

* fix(incentive,cli,node): build adopted rows through one constructor and retry a seed on a moved row (#2292)

Review of #2305:

- `BuyerPoolState::adopt` builds an adopted row with its
  `totalRedeemed`, and `hydrate` takes the stored `redeemed_elsewhere`,
  so no caller can drop it. The free setter is gone.
- The CLI lane seed fails the build when the row was forgotten or
  replaced, rather than pricing the lane or escrowing a refill against
  a row the store no longer holds, and resumes from the row when
  another run already moved past the watermark.
- Node tests: an adopted drained pool keeps its redeemed spend and its
  refill fires; a lane seeded on an adopted row counts its watermark
  once.
- Docs: the buyer record's suffix rule, `committed_amount` vs
  `pool_spend`, the lane mutators, LaneSpend, the node reseed and
  refill, and CHANGELOG for the review fixes.

Refs #2292

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

---------

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

3 participants