Repository navigation
fix(cli,common): fetch bootstraps cold content from origins instead of bailing on empty holders (#1911) - #1912
Conversation
…f bailing on empty holders (#1911) `decdn fetch` auto-discovery bailed the moment no probed node held the blob in its cache store (`holders.is_empty()`), discarding a pool of reachable, bonded non-holders it could stream from. In a caching network that is a bootstrap paradox: every object is born origin-only with zero cache holders — the normal first-fetch state of all content — so a holders-only fetch could never trigger the first pull that populates any cache. A `has_blob:false` from the cache store is not proof of un-serveability: the node can still serve an authorized miss via pull-through from its own configured origin (or node-to-node). Client-side candidate selection now: - Keeps every reachable, verified, consistent non-holder as a pull-through serve target, not only when proxy warming is enabled. The bootstrap fallback is independent of the warming optimization, so `--proxy-warming false` cannot reintroduce the bug. - Falls back to the non-holders (nearest RTT first, already bounded by `select_candidates`/`SELECT_K`) as the failover order when no holder answers. The healthy holders-present path — holder ranking and proxy-warming leads — is untouched. - Errors only in the genuinely terminal case: neither a cache holder nor a reachable non-holder answered. The message no longer reads "nobody holds it" when the real cause is unreachable or misconfigured (unverifiable) candidates. Also reconciles the `--namespace` help text with actual serve behavior: an absent namespace disables routing to a namespace's authorized origin set, but the serving node's own configured origin stays a serve target either way (`namespace_id` is a routing hint, not a serve gate — ADR 002). Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The new terminal error helper’s documentation/branching can still misattribute mixed “unreachable vs. unverifiable vs. unusable” probe outcomes, and should be adjusted for accuracy before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes decdn fetch auto-discovery candidate selection so cold (origin-only) blobs can be fetched by falling back to reachable non-holder nodes as pull-through serve targets, instead of failing when no cache holder answers. It also updates the CLI --namespace help text in common to match actual serve behavior around namespace routing vs. local origin serving.
Changes:
- Keep reachable, verified non-holders as valid serve targets and use them as the failover order when no holders respond.
- Refine the “no serve target” terminal error path to only trigger when no holder and no reachable non-holder exists.
- Update
FetchArgs::namespacehelp text to clarify that omitting--namespacedisables routing to DAO-authorized origin sets but does not disable the serving node’s own configured origin.
File summaries
| File | Description |
|---|---|
| crates/common/src/cli/fetch.rs | Updates --namespace help text to reflect namespace routing semantics vs. local origin serving. |
| crates/cli/src/commands/fetch.rs | Changes probe ordering logic to fall back to reachable non-holders for cold-blob bootstrapping; adds unit tests for the new ordering behavior. |
Review details
Suppressed comments (1)
crates/cli/src/commands/fetch.rs:307
no_serve_target_errorcurrently treats anyunverifiable > 0as the primary terminal failure and returns a chain-config-focused message even when only some candidates answered (others timed out or returned unusable probe data). This can mislead operators; consider distinguishing: (1) all answers unverifiable, (2) all candidates unreachable, and (3) mixed/unusable answers with counts.
if unverifiable > 0 {
return anyhow::anyhow!(
"{unverifiable} of {probe_count} probed node(s) answered, but their probe \
signatures did not recover to the operator address each is registered \
under. That is usually local configuration rather than missing content: \
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…e-target error (#1911) The terminal error's doc and message treated the failure as only "unreachable" or "unverifiable", but the selection loop also drops a candidate that answered with a has_blob/coverage mismatch. When such a drop leaves no holder and no non-holder, the message now names both the unreachable and the answered-but- unusable counts instead of implying a silently unreachable set. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Coverage reportTotal: 82.70% (was 82.70%, ▼ 0.01%) — 74110/89618 lines
History
|
Closes #1911.
Problem
decdn fetchauto-discovery bailed the moment no probed node held the blob in its cache store (holders.is_empty()), even while holding a pool of reachable, bonded non-holders it could stream from. In a caching network this is a bootstrap paradox: every object is born origin-only with zero cache holders — the normal first-fetch state of all content — so a holders-only fetch can never trigger the first pull that populates any cache.The serve side already does the right thing (the issue's explicit-
--node-idrepro streams straight from the node's fs origin). The bug was entirely client-side candidate selection: the discarded non-holder entries each already carried the exact{node_id, eth_address}the working explicit path consumes.has_blobisengine.has()= cache store only; ahas_blob:falsenode can still serve an authorized miss via pull-through from its own configured origin (or node-to-node). Treating a falsehas_blobas "cannot serve me" was a false negative.Change
In
crates/cli/src/commands/fetch.rs(probe_and_order/failover_order):--proxy-warming falsecan't reintroduce the bug.select_candidates/SELECT_K, so an empty-holders fetch never sprays every registered node. The healthy holders-present path — holder ranking and proxy-warming leads — is untouched, so the tuned multi-source path is unchanged.Also reconciles the
--namespacehelp text (the issue's side-finding) with actual serve behavior: an absent namespace disables routing to a namespace's authorized origin set, but the serving node's own configured origin stays a serve target either way (namespace_idis a routing hint, not a serve gate — ADR 002).Net effect
A node that is an authorized origin for content serves it on demand from its durable on-disk copy via plain
decdn fetch— no publish → prefetch → pin cycle, no out-of-band warming.Tests
failover_order: empty-holders falls back to non-holders nearest-RTT-first (independent of proxy warming), and empty+empty yields an empty order (the terminal caseprobe_and_orderturns into an error).decdn-cli,decdn-common,decdn-client-pull(1130 tests). Workspace clippy--all-targets --all-features, theRUSTDOCFLAGS=-D warningsdoc gate, andcargo fmt --checkall clean.Note: this fix is purely client-side selection logic, covered precisely by the
failover_orderunit tests; the node-side origin serve it relies on is already proven by theorigin_stream_while_store/g_origin_01_publishe2e and the issue's explicit-node repro. A gatedanvil-e2etest that fetches an origin-only blob via auto-discovery (no--node-id) is a natural follow-up.🤖 Generated with Claude Code