Skip to content

fix(node,cache,bao-range): keep a local store fault off the upstream's score - #2323

Merged
thiras merged 2 commits into
mainfrom
fix/2286-local-store-fault-verdict
Oct 5, 2026
Merged

thiras merged 2 commits into
mainfrom
fix/2286-local-store-fault-verdict

Conversation

@thiras

@thiras thiras commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Summary

A pull that failed on this node's own cache store was ruled Unreachable, so a full or read-only disk scored the honest holder it was pulling from. iroh-blobs reports a failed data-file write as a kind-less io::Error (write batch failed), so the fault cannot be recognised by its ErrorKind.

  • CacheError::Feed (new): the two admit failures the sender causes — a feed that ends early or fails to read, and a zero total_bytes for a non-empty hash. CacheError::Store now always means this node's store.
  • pull_verdict: a Store or Internal anywhere in the chain (including boxed under RangedStoreError::Backend on a store query) rules OurLocalFault. A truncated feed still scores Unreachable.
  • ends_the_assembly: ends the pull on a local store fault instead of paying the next holder into the same store.
  • drive: a failed store query (RangedStoreError::Backend) is marked LocalPullFault; an out-of-bounds range is not.
  • RangedStoreError names only its own layer in Display, so chain renders print each cause once. Plain-Display sites now keep or render the chain (client lock-poisoned errors, streamer frontier read, serve encoder fault log); the encoder keeps the typed chain under EncodeError.
  • Local-fault log, metric and PullMiss/miss_answer docs no longer say "cannot pay" for every local fault; OriginPullError doc in present tense.

Closes #2286

Test plan

  • a_store_that_cannot_write_is_a_local_fault_not_the_peers: real NodeAdmitStore ingest into a read-only cache dir → OurLocalFault (failed before the fix with Unreachable)
  • a_truncated_wire_is_the_peers_fault: real truncated ingest → Unreachable
  • Unit tests for pull_verdict, ends_the_assembly, store_query_fault, and the RangedStoreError display; cache admit tests assert Feed
  • Each new guard mutation-checked (disabling it fails its test)
  • cargo fmt, cargo clippy --workspace --all-targets --all-features -D warnings, cargo doc -D warnings, decdn-client public-API test
  • cargo nextest run for bao-range, client, cache, node, cli: 3607 passed

Follow-up (pre-existing, not changed here): the buffered path's try_pull still walks and pays every remaining candidate after a local fault.

🤖 Generated with Claude Code

…s score

`pull_verdict` ruled a pull that failed on this node's own cache store
`Unreachable`, so a full or read-only disk scored the honest holder it
was pulling from. iroh-blobs reports a failed data-file write as a
kind-less `io::Error`, so the fault cannot be told by its `ErrorKind`.

`CacheError::Store` now always means this node's store. The two admit
failures the sender causes — a feed that ends early or fails to read,
and a zero `total_bytes` for a non-empty hash — move to a new
`CacheError::Feed`. `pull_verdict` rules a `Store` or `Internal`
anywhere in the chain `OurLocalFault`, and `ends_the_assembly` ends the
pull on one instead of paying the next holder into the same store.
`drive` marks a failed store query `LocalPullFault`.

`RangedStoreError` names only its own layer in `Display`, so chain
renders print each cause once. The sites that flattened it with plain
`Display` (the client's lock-poisoned errors, the streamer's frontier
read, the serve encoder's fault log) now keep or render the chain, and
the encoder keeps the typed chain under its `EncodeError`.

The local-fault log, metric and miss docs no longer say "cannot pay"
for every local fault, and the `OriginPullError` doc is in present
tense.

Closes #2286

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 17:56
@thiras thiras self-assigned this Oct 5, 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

One modified metric docstring still violates the repository’s present-tense documentation convention.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Corrects pull-fault attribution so local cache/store failures do not penalize upstream providers.

Changes:

  • Separates sender feed failures from local store failures.
  • Classifies local store faults consistently and preserves error chains.
  • Adds regression tests and updates diagnostics.
File Description
crates/​node/​src/​node_origin/​pull_leg.rs Stops assembly after local store faults.
crates/​node/​src/​node_origin/​mod.rs Exonerates upstreams for local cache faults.
crates/​node/​src/​node_origin/​admit_store.rs Tests store and truncated-feed attribution.
crates/​node/​src/​metrics.rs Updates local-fault metric documentation.
crates/​node/​src/​handlers/​client/​serve_encoder.rs Preserves encoder error chains.
crates/​client/​src/​streamer.rs Renders complete ranged-store errors.
crates/​client/​src/​ranged_store.rs Preserves lock-poison error types.
crates/​client/​src/​driver.rs Marks backend query failures as local faults.
crates/​cache/​src/​error.rs Adds CacheError::Feed.
crates/​cache/​src/​engine.rs Separates feed failures from store failures.
crates/​bao-range/​src/​ranged_store.rs Prevents duplicate causes in chain rendering.

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

Comment thread crates/node/src/metrics.rs Resolved
@github-code-quality

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

Copy link
Copy Markdown

Code Coverage Overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

The overall line coverage in commit e6b12ee in the fix/2286-local-store... branch remains at 88%, unchanged from commit 5f5605d in the main branch.

Show a line coverage summary of the most impacted files.
File main 5f5605d fix/2286-local-store... e6b12ee +/-
crates/node/src...nt/serve_leg.rs 93% 91% -2%
crates/incentiv...eth_identity.rs 99% 98% -1%
crates/client/src/streamer.rs 91% 91% 0%
crates/node/src...e_origin/mod.rs 91% 91% 0%
crates/cache/src/engine.rs 94% 94% 0%
crates/node/src...s/client/mod.rs 95% 95% 0%
crates/node/src...erve_encoder.rs 93% 93% 0%
crates/node/src...gin/pull_leg.rs 91% 91% 0%
crates/node/src.../admit_store.rs 94% 96% +2%
crates/bao-rang...ranged_store.rs 92% 95% +3%

Updated October 05, 2026 18:14 UTC

@thiras
thiras merged commit 65a468d into main Oct 5, 2026
30 checks passed
@thiras
thiras deleted the fix/2286-local-store-fault-verdict branch October 5, 2026 22:57
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.

fix(node,cache,bao-range): local store faults scored as upstream Unreachable; RangedStoreError repeats its cause; OriginPullError doc in changelog voice

2 participants