Skip to content

fix(node): span the coverage union for the empty root on its first holder - #2529

Merged
thiras merged 2 commits into
mainfrom
fix/2526-empty-root-coverage-union
Oct 18, 2026
Merged

thiras merged 2 commits into
mainfrom
fix/2526-empty-root-coverage-union

Conversation

@thiras

@thiras thiras commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

What

CoverageUnionTracker::spans() requires a block target above zero, and the empty blob has zero discovery blocks, so under ProbeGather::CoverageUnion the union never spanned EMPTY_ROOT: the probe round drained to the fanout ceiling instead of stopping on its first holder, the origin-directory second round always ran, and a cached holder list never counted as a probe-cache hit. Latency, not failure: the holders still reached candidates.

The tracker now takes the requested hash (CoverageUnionTracker::new(hash_bytes), coverage_spans(hash_bytes, …)). For EMPTY_ROOT it spans once one holder is admitted. The rule keys on the hash, as ProbeResponseExt::consistent_with does, never on the unsigned total_bytes hint, so a holder that reports Some(0) for a real blob closes nothing.

Closes #2526

Reviewer notes

  • Read CoverageUnionTracker in crates/node/src/node_origin/mod.rs first; the three call sites (probe_and_rank, probe_round, spanning_cached_candidates) only thread the hash through.
  • One correction to the issue text: the buffered Origin::fetch path gathers with ProbeGather::EarlyExit, so the only CoverageUnion caller is open_pull_leg. The existing node_origin_discovers_the_empty_blob_by_probe test never touches the tracker, and since iroh-blobs reports the empty root complete on every backend, the serve-miss pull leg for EMPTY_ROOT is unreachable in the loopback harness too. The regression test is therefore the unit test the issue asks for (coverage_spans_for_the_empty_root_needs_one_admitted_holder), including the lying Some(0) hint on a real blob.
  • No ADR change: ADR 022 § Consistency rule already says the requester learns an empty-root holder from signed has_blob; the gather stop rule is implementation.

Verification

  • cargo fmt -- --check
  • CARGO_BUILD_WARNINGS=deny cargo clippy --workspace --all-targets --all-features
  • CARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-items
  • cargo nextest run -p decdn-node coverage_spans (new test red before the spans() change, green after), the empty-blob loopback tests, and the six node: a DHT answer with only partial holders skips the origin-directory fallback, so the ranged miss fails #2195 probe-round-count cases (a_dht_answer_of_partial_holders_only_pulls_in_the_directory_origin, a_partial_only_probe_cache_hit_falls_through_to_the_directory_origin, a_spanning_probe_cache_hit_serves_without_probing, spanning_dht_holders_skip_the_origin_supplement, a_directory_origin_past_the_probe_fanout_is_probed, no_covering_candidate_refuses_before_commit): all pass
  • pre-commit run --all-files
  • contracts/ changed: n/a
  • User-visible change: CHANGELOG.md entry added
  • Design change: n/a
  • PR title uses an allowed type and a lowercase subject

🤖 Generated with Claude Code

…lder (#2526)

`CoverageUnionTracker::spans()` requires a block target above zero, and the
empty blob has zero discovery blocks, so the union never spanned the empty
root: the `CoverageUnion` probe round drained to the fanout ceiling instead of
stopping on its first holder, the origin-directory round always ran, and a
cached holder list never counted as a probe-cache hit.

The tracker now takes the requested hash. For `EMPTY_ROOT` it spans once one
holder is admitted. The rule keys on the hash, as
`ProbeResponseExt::consistent_with` does, never on the unsigned `total_bytes`
hint, so a holder that reports `Some(0)` for a real blob closes nothing.

Closes #2526

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

🟢 Approval recommended

The narrow fix consistently updates coverage checks and includes focused regression tests, with no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes empty-blob coverage gathering so the first admitted holder spans EMPTY_ROOT, without changing non-empty blob behavior.

Changes:

  • Passes the requested hash through probe and cache coverage checks.
  • Adds regression tests for empty-root holders and misleading zero-size hints.
  • Documents the fix in the changelog.
File Description
crates/​node/​src/​node_origin/​tests.rs Tests empty-root handling and preserves non-empty coverage checks.
crates/​node/​src/​node_origin/​pull_leg.rs Passes the hash into cached coverage checks.
crates/​node/​src/​node_origin/​mod.rs Implements hash-based empty-root spanning.
CHANGELOG.md Records the coverage-gathering fix.

Review effort: Balanced

@github-code-quality

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

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main 261414e fix/2526-empty-root-... 83284e9 +/-
76% 76% 0%
View coverage of the 8 most impacted files.
File main 261414e fix/2526-empty-root-... 83284e9 +/-
crates/node/src/dht/publish.rs 80% 78% -2%
crates/cli/src/...ommands/node.rs 60% 59% -1%
crates/protocol/src/framing.rs 93% 92% -1%
crates/client/src/lib.rs 89% 89% 0%
crates/client/src/scheduler.rs 94% 94% 0%
crates/node/src...e_origin/mod.rs 88% 88% 0%
crates/cache/src/engine.rs 91% 91% 0%
crates/node/src...gin/pull_leg.rs 85% 85% 0%

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


Updated October 18, 2026 17:39 UTC

…nt both ways

Review follow-ups on #2529: the changelog names the origin-directory lookup,
not a round, as the step that always ran; the inline comment in the probe
round no longer restates the rule the tracker's own doc owns; the `holders`
field says where it is read; and the unit test asserts that an empty-root
holder reporting a non-zero size still spans the blob, so the hash-not-hint
rule is pinned from both sides.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@thiras
thiras merged commit 5e8f2a0 into main Oct 18, 2026
31 checks passed
@thiras
thiras deleted the fix/2526-empty-root-coverage-union branch October 18, 2026 18:11
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.

node-origin: the coverage-union probe round never spans for the empty root (zero-block target)

2 participants