Repository navigation
fix(node,cache,bao-range): keep a local store fault off the upstream's score - #2323
Merged
Merged
Conversation
…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]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One modified metric docstring still violates the repository’s present-tense documentation convention.
Review effort: Balanced
Findings: 1
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.
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit e6b12ee in the Show a line coverage summary of the most impacted files.
Updated |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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-lessio::Error(write batch failed), so the fault cannot be recognised by itsErrorKind.CacheError::Feed(new): the two admit failures the sender causes — a feed that ends early or fails to read, and a zerototal_bytesfor a non-empty hash.CacheError::Storenow always means this node's store.pull_verdict: aStoreorInternalanywhere in the chain (including boxed underRangedStoreError::Backendon a store query) rulesOurLocalFault. A truncated feed still scoresUnreachable.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 markedLocalPullFault; an out-of-bounds range is not.RangedStoreErrornames only its own layer inDisplay, so chain renders print each cause once. Plain-Displaysites now keep or render the chain (client lock-poisoned errors, streamer frontier read, serve encoder fault log); the encoder keeps the typed chain underEncodeError.PullMiss/miss_answerdocs no longer say "cannot pay" for every local fault;OriginPullErrordoc in present tense.Closes #2286
Test plan
a_store_that_cannot_write_is_a_local_fault_not_the_peers: realNodeAdmitStoreingest into a read-only cache dir →OurLocalFault(failed before the fix withUnreachable)a_truncated_wire_is_the_peers_fault: real truncated ingest →Unreachablepull_verdict,ends_the_assembly,store_query_fault, and theRangedStoreErrordisplay; cache admit tests assertFeedcargo fmt,cargo clippy --workspace --all-targets --all-features -D warnings,cargo doc -D warnings, decdn-client public-API testcargo nextest runfor bao-range, client, cache, node, cli: 3607 passedFollow-up (pre-existing, not changed here): the buffered path's
try_pullstill walks and pays every remaining candidate after a local fault.🤖 Generated with Claude Code