Repository navigation
fix(node,cache): reach the directory origin when DHT holders are partial-only - #2201
Merged
Merged
Conversation
…ial-only Since #2188 a DHT answer can name only partial holders. `discover` read the on-chain origin directory only when the DHT answer was empty, so the ranged assembly ran out of candidates for the blocks no partial held and the client got a truncated stream after `ok: true`. On the ranged pull leg, a probe round whose holders do not span the blob is followed by a round over the origin-directory candidates it did not probe, an origin past the `probe_fanout` cut among them. A probe-cache entry that does not span the blob counts as a miss there. A partial holder's probe now carries the blob size (`CacheEngine::coverage_sized`), so a set of partials that covers every block counts as spanning. Before signing `ok: true` the serve leg checks, against the signed size, that its candidates cover the part of the pull range it does not hold, and refuses with a signed miss when they do not. `AssembleOutcome::Unavailable` carries its cause, logged with a `warn!`. ADR 022 gains the partial-coverage fallback and the refusal-before-commit rule; ADRs 001 and 039, architecture.md and the observability appendix follow. Closes #2195 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The remaining documentation issue is a minor nit and does not block approval.
Review effort: Lite
Findings: None
What changed in this PR
Fixes ranged serve-misses by supplementing partial DHT results with origin candidates and refusing incomplete pulls before stream commitment.
Changes:
- Adds coverage-aware origin fallback and cache validation.
- Reports partial-holder sizes and adds pre-commit refusal checks.
- Updates diagnostics, tests, documentation, and changelog.
| File | Description |
|---|---|
crates/node/tests/probe_loopback.rs |
Verifies partial probe-size reporting. |
crates/node/tests/node_origin_pull.rs |
Adds discovery and refusal regression tests. |
crates/node/src/runtime/mod.rs |
Documents origin-directory wiring. |
crates/node/src/node_origin/ranged_pull.rs |
Adds failure causes and coverage checks. |
crates/node/src/node_origin/pull_leg.rs |
Validates cache coverage and logs failures. |
crates/node/src/node_origin/mod.rs |
Adds coverage tracking and origin supplementation. |
crates/node/src/metrics.rs |
Documents probe-round metrics. |
crates/node/src/handlers/probe.rs |
Reports partial-holder sizes. |
crates/node/src/handlers/client/window.rs |
Adds pre-commit coverage refusal. |
crates/node/src/dht/origin.rs |
Updates origin-directory documentation. |
crates/cache/src/engine.rs |
Adds sized coverage derivation; minor documentation clarification remains. |
CHANGELOG.md |
Records the fix. |
adr/architecture.md |
Updates architecture documentation. |
adr/appendix-observability.md |
Updates observability semantics. |
adr/039-multi-source-parallel-fetch.md |
Documents pull-leg behavior. |
adr/022-content-discovery.md |
Defines partial-coverage fallback and refusal. |
adr/001-network.md |
Updates network fallback documentation. |
💡 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 acc5d34 in the Show a line coverage summary of the most impacted files.
|
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.
What
A serve-miss whose DHT answer names only partial holders reaches the namespace's origin instead of truncating the client's stream.
Since #2188 a DHT answer can name only partial holders.
discoverread the on-chain origin directory only when the DHT answer was empty, so the ranged assembly ran out of candidates for the blocks no partial held.assembleendedUnavailableand the client got a short stream afterok: true(nbg1 → ash1 partial, bcl origin never tried; trace16caa1b033e23a288fbb817859e22f28).node_origin/mod.rs): on the ranged pull leg (ProbeGather::CoverageUnion), a probe round whose holders don't span the blob is followed by a round over the origin-directory candidates it did not probe. That includes an origin the DHT named but that fell past theprobe_fanoutcut. The buffered fill path (EarlyExit, namespace 0) is unchanged.pull_leg.rs): a probe-cache entry that doesn't span the blob counts as a miss on the ranged leg and runs a fresh lookup.CacheEngine::coverage_sized→handlers/probe.rs). Before, a partial's probe carriedtotal_bytes: None, so a set of partials that covered every block between them never counted as spanning. There is no wire change:ProbeResponseExt.total_bytesalready exists, and ADR 005 already asks nodes to include it when known.window.rsstep 6c): before signingok: true, the serve leg checks, against the signedtotal_bytes, that its candidates cover the part of the pull range it doesn't hold. If they don't, the client gets a signed miss it can fail over on, not a truncated stream.AssembleOutcome::Unavailable(UnavailableCause)covers four causes (every covering candidate faulted, no progress, uncovered range, reassign budget), with awarn!inrun_pull_leg. Newdebug!lines cover the supplement's outcome and rejected cache entries.architecture.md,appendix-observability.md(the cache-miss case and one latency sample per round) and the stale "only when the DHT is empty" comments are updated to match.Closes #2195
Reviewer notes
probe_and_rank/probe_roundinnode_origin/mod.rs, thenpull_range_uncoveredinhandlers/client/window.rs.discover. The DHT coverage hint has no block count, and only a probe reports the blob size.probe_fanout, so a supplemented miss probes at most 2×probe_fanoutpeers.decdn_probe_collection_latency_secondsrecords one sample per round, so a supplemented miss records two; this is documented in the metric doc and the appendix row.assembleapplies in its first round (ranged_pull::uncovered), against the signed size. It refuses like the step-6b error branch does. A store read fault fails open.serve_via_window_pull_throughgetsclippy::cognitive_complexity(26/25) next to its existingtoo_many_lines. The numbered steps are one ordered sequence before the signed commit.outbound_stream_ended(false)/serve_stream_node_fault, and the new detail goes to logs.Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets -- -D warningscargo nextest run -p decdn-node -p decdn-cache: 1927 passedRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemspre-commit run --all-filescontracts/changed: n/aCHANGELOG.mdentry addedNew tests, which stayed green over
--stress-count 20:node_origin_pull.rs, sixserve_miss_discovery_casescenarios: a partial-only DHT answer, a partial-only cache entry, a cache entry that covers every block (a hit, no probes), DHT holders that already cover every block (no second round), an origin past the probe cut, and no candidate able to cover the range (refused before commit). Each asserts the probe-round count, and the cache cases also assert hits and misses.UnavailableCauseper exit, including a new test for the every-candidate-faulted case;coverage_spans;coverage_sized;Retries noted: one earlier full-suite run needed a retry on
origin_range_pull::cold_out_of_bounds_range_is_refused_before_signing(it passed 30 of 30 under stress). That file doesn't useNodeOrigin, so the new check never runs there.🤖 Generated with Claude Code