Repository navigation
feat!: origins publish all three objects; delete the whole-blob origin fallback - #2922
Conversation
…n fallback Step 1 of #2913 (rule 5). An origin publishes {H}, {H}.obao4 and {H}.sizeproof, and all three are required. One memoised {H}.sizeproof read gives the node presence and a proven size before the first voucher (CacheEngine::origin_presence). A missing or broken object is an origin fault: the node refuses the stream with a StreamError before any ChunkData. Deleted: the data-object and outboard HEAD probes, origin_outboard_published and its memo, origin_range_serviceable and the degrade memo, the buffered local populate tier (local_populate), the fs/http/s3 whole-blob fetch and streamed import, CacheEngine::get, decompression (cache.origin.decompress) and cache.origin_retry.buffered_max_bytes, and the dead decdn_cache_hits_total / decdn_cache_bytes_returned_total counters. decdn node top and decdn dashboard read the serve-path counters instead. Breaking: config keys cache.origin.decompress and cache.origin_retry.buffered_max_bytes are rejected; node top JSON keys changed; origins without {H}.obao4 / {H}.sizeproof no longer serve. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
yigitdot
left a comment
There was a problem hiding this comment.
Review: head de40683
Important
1. An HTTP 403 on {H}.sizeproof reads as Absent, not Fault
crates/cache/src/origin/http.rs:352:missing_or_faultreturnsOk(())on a 403. Sofetch_size_proofreturnsOk(None), and the hash is Absent.- At the base, a 403 on the HEAD of the data object was Permanent, which is a Fault. S3 still faults on
AccessDenied, so the adapters disagree. - Scenario: credentials are revoked, and the origin answers 403 for every key. The origin-only gate then signs
ForeignNamespaceDeclined. The negative TTL memoises Absent. The rescan and the DHT publish drop the content of the operator, and no probe-failure metric counts it. - These docs still say a permission decline is an
Err:engine.rs:1915-1918,engine.rs:2337-2340,origin/mod.rs:158. - Suggested fix: make a 403 on
.sizeproofPermanent. The outboard and data reads can keep 403-as-missing.
2. The payer is charged before the node reads the origin, and a range fault never reaches the presence memo
- Step (4b)
origin_range_usablerefused the stream before the legs started. This PR deletes it. - At head,
serve_leg.rsrunsacquire_credit_for_leg(which commits the first proof) before the firstnext_frame_chunks. The node finds a missing{H}.obao4or{H}only after that. The stream then ends withInternalErroranddelivered == 0, so the payer pays for credit and gets no bytes. - The fault does not reach the presence memo.
Presentstays memoised under the positive TTL, and the DHT keeps announcing the hash. Each new open repeats ok, pay, refuse. node_pull_through_errordoes not bump on this path.- Options: read the outboard before the node commits credit. Or, on a fault before ChunkData, memoise a Fault and do not count the credit.
3. Retry and the circuit breaker do not cover fs/http/s3 origins
run_with_retry_classifiedand the breakers run only inpull_through(engine.rs:5313). It callsOrigin::fetch, and that defaults toNotFoundfor fs/http/s3.- So one S3 503 or one connection reset refuses a paid stream. One 503 on
.sizeproofmemoises a Fault for the full fault TTL. - The
cache.origin_retryandcache.circuit_breakerdocs (common/src/config/types.rs:395-455) still describe per-origin retry for operator origins. - Either wrap the size-proof, outboard and range reads in the retry and breaker, or document that they cover only peer origins.
4. Tests deleted for behaviour that still exists
- Redirect (SSRF) refusal (302, 301, 307, and a redirect to an internal address).
Policy::none()athttp.rs:129has no test now. - HTTP headers timeout and chunk-idle timeout (
http.rs:322,http.rs:482). - There is no node test for a missing data object (a 404 on
{H}).BrokenObjectcovers only the outboard. - There is no test for a fault after the first ChunkData (the
delivered > 0branch,serve_leg.rs:286). - No test checks that
cache.origin.decompressorcache.origin_retry.buffered_max_bytesis rejected.deny_unknown_fieldsrejects them, but no test asserts it.
5. ADR text
- ADR 038:45 still describes the deleted fallback (an import that materializes a missing
{H}.obao4, "both origin routes"). It contradicts lines 85 and 105 of the same ADR. - ADR 005:99 says a missing or broken object gives a
StreamError. The next sentence says a missing{H}.sizeproofgivesNotFound. Restrict the first sentence to{H}and{H}.obao4.
Suggestions
engine.rs:2129: a blob with no.sizeproofleaves the announce set and nothing reports it. Enumeration proves{H}exists, so this is a broken publish. At least warn and count it.CacheEngine::origin_fetch_outboard_bytesandoutboard_with_origin(engine.rs:3762-3784) have only test callers now. Thetokio-utiliofeature (Cargo.toml:219-223) has no user.- Stale "HEAD/HeadObject" wording:
common/src/config/resolved.rs:294,306common/src/config/types.rs:484-507config-types/src/defaults.rs:18,42cli/src/commands/config.rs:1086,1089engine.rs:3022,3027,3776,4980
appendix-observability.md:94,139names a range probe andpull_through_range. Neither exists now.- ADR 037:80: drop "exactly as for whole-blob pulls".
dispatch.rs:822cites ADR 005 § Bounded byte ranges. The rule is in § Pull-through.dispatch.rs:818-824: this fault branch (Present, butsize_proofgives None) logs nothing.e2e/tests/cli_fetch_multi_source.rs:17,109says the holders are pre-warmed. Now they serve cold from their own origin.NodeFixture::warmopens one pool per hash. Therefuse_fill_faultdoc should also listClientPaymentFault, which passes through too.- STE: ADR 037:76, ADR 037:79 and ADR 038:86 each hold two ideas per sentence.
dispatch.rs:650is 102 columns.
Good
- The deletion is clean: no deleted identifier is left in the tree.
- The presence memo is sound. It has a TTL for each state, a bound, and single-flight.
refuses()runs before the memo. - The node verifies every size proof before it trusts it, and all three backends cap the object size.
size_proof_tests.rsis thorough. - The metric consumers (node top, dashboard, doctor, status) agree.
… 403 sizeproof is a fault Review follow-up on #2922. - An HTTP 403 on {H}.sizeproof is a permanent fault, not an absence, so a refused origin no longer reads as "not held". The outboard and data reads keep reading a 403 as a missing object. - Every size-proof, outboard and range-window read runs under the origin's circuit breaker and cache.origin_retry (ReadGuard). An exhausted transient fault stays transient. - A ranged read that faults after a Present answer memoises a Fault, so the next open refuses at open instead of taking a voucher and refusing. The own-origin serve counts the refusal in node_pull_through_errors. - A rescan counts and warns on listed objects with no {H}.sizeproof. - origin_fetch_outboard_bytes is test-util only; tokio-util drops the io feature. - Tests: HTTP redirect (SSRF) refusal and header/idle timeouts, 403 on the size proof, ReadGuard, range-fault memo, missing data object and a fault after the first ChunkData at the node, removed config keys rejected. - ADR 005/037/038, observability appendix, runbook and config docs match.
There was a problem hiding this comment.
🟡 Changes recommended
Read deadline expiry fails to record breaker failures, allowing repeated stalled reads, and the self dev-dependency re-enables S3, defeating the store-only feature-isolation check.
2 open issues
What changed in this PR
Implements step 1 of #2913 by requiring three origin objects per blob and removing whole-blob origin fallback. The changes align node serving, test fixtures, configuration, and monitoring with range-based origin delivery.
Changes:
- Use memoised size proofs for origin presence and stream origin data through verified ranges.
- Remove origin decompression and buffered-fetch configuration; update fixtures to publish complete origins or explicitly warm caches.
- Switch CLI and dashboard reporting to serve-path cache hits and wire bytes served.
| File | Description |
|---|---|
| docs/runbook.md | Explain size-proof rescan failures and recovery. |
| crates/node/tests/support/mod.rs | Seed complete origins and provide cache helpers. |
| crates/node/tests/partial_serve.rs | Remove obsolete origin-probe mocks. |
| crates/node/tests/dht_bootstrap.rs | Adapt fixtures to size-proof discovery. |
| crates/node/src/runtime/tests.rs | Remove decompression configuration from tests. |
| crates/node/src/runtime/reload.rs | Remove obsolete decompression references. |
| crates/node/src/runtime/mod.rs | Remove local-populate and decompression wiring. |
| crates/node/src/node_origin/pull_leg/local_pull_leg_tests.rs | Adapt local-pull fixtures and assertions. |
| crates/node/src/node_origin/mod.rs | Simplify origin-fetch outcome matching. |
| crates/node/src/node_origin/backend_source/tests.rs | Adapt backend-source fixtures. |
| crates/node/src/node_origin/backend_source.rs | Propagate range-origin faults directly. |
| crates/node/src/metrics/tests.rs | Update metric registration and accounting tests. |
| crates/node/src/metrics.rs | Document current serve and origin metrics. |
| crates/node/src/handlers/client/window.rs | Remove serviceability probes and meter fill refusals. |
| crates/node/src/handlers/client/serve_leg.rs | Refuse fill faults before the first chunk. |
| crates/node/src/handlers/client/mod.rs | Remove local-populate dependency fields. |
| crates/node/src/handlers/client/fill.rs | Delete buffered local-origin fill helpers. |
| crates/node/src/dht/publish.rs | Use size-proof origin presence for publishing. |
| crates/node/src/admin/tests.rs | Seed eviction fixtures directly. |
| crates/node/Cargo.toml | Enable cache helpers for tests. |
| crates/e2e/tests/origin_stream_while_store.rs | Replace fallback expectations with origin faults. |
| crates/e2e/tests/g_node_04_blacklist_compliance.rs | Warm stores before compliance scenarios. |
| crates/e2e/tests/cli_fetch_multi_source.rs | Clarify origin-backed source fixtures in comments. |
| crates/e2e/tests/cli_bundle_pull_range_dedup.rs | Warm stores before cache-hit assertions. |
| crates/e2e/src/node.rs | Publish complete origins and add paid warming. |
| crates/e2e/src/client.rs | Update first-frame timeout documentation. |
| crates/config-types/src/retry/tests.rs | Remove buffered-budget assertions. |
| crates/config-types/src/retry.rs | Remove buffered-fetch configuration. |
| crates/config-types/src/lib.rs | Remove decompression and buffer-default exports. |
| crates/config-types/src/defaults.rs | Describe size-proof probe defaults. |
| crates/config-types/src/decompress/tests.rs | Delete decompression-policy tests. |
| crates/config-types/src/decompress.rs | Delete decompression-policy type. |
| crates/config-types/README.md | Update configuration vocabulary. |
| crates/common/src/lib.rs | Remove decompression from crate documentation. |
| crates/common/src/config/types.rs | Remove obsolete fields and document origin requirements. |
| crates/common/src/config/resolved.rs | Remove resolved decompression settings. |
| crates/common/src/config/mod.rs | Remove obsolete configuration resolution and validation. |
| crates/common/src/cli/node.rs | Update node top metric descriptions. |
| crates/common/src/admin.rs | Update configuration-type documentation. |
| crates/cli/tests/origin_import.rs | Verify imports through range reads. |
| crates/cli/src/commands/node_top/snapshot_tests.rs | Test serve metrics and partial-hit aggregation. |
| crates/cli/src/commands/node_top/render_tests.rs | Update displayed metric expectations. |
| crates/cli/src/commands/node_top/parse_tests.rs | Update metric parsing fixtures. |
| crates/cli/src/commands/node_top/json_tests.rs | Test renamed JSON fields. |
| crates/cli/src/commands/node_top/e2e_tests.rs | Exercise serve metrics through real scraping. |
| crates/cli/src/commands/node_top.rs | Report serve-path hits and wire egress. |
| crates/cli/src/commands/doctor/live/tests.rs | Update metric prefix-collision fixture. |
| crates/cli/src/commands/doctor/live.rs | Refresh parser documentation. |
| crates/cli/src/commands/dashboard/status/tests.rs | Update dashboard metric fixtures. |
| crates/cli/src/commands/dashboard/status.rs | Clarify hit-rate documentation. |
| crates/cli/src/commands/dashboard/sources.rs | Calculate hit rate from serve counters. |
| crates/cli/src/commands/config.rs | Remove obsolete template settings. |
| crates/cli/dashboard/src/fixtures/dashboard-full.json | Rename dashboard metric fields. |
| crates/cli/dashboard/src/fixtures/dashboard-failing.json | Rename failure-fixture metric fields. |
| crates/cli/dashboard/src/contract.test.ts | Check updated dashboard metric keys. |
| crates/cli/dashboard/src/components/NodeHealth.tsx | Explain serve-based dashboard values. |
| crates/cli/dashboard/src/components/NodeHealth.test.ts | Update component metric fixtures. |
| crates/cli/dashboard/src/api.ts | Align metric types with backend output. |
| crates/cache/tests/util/mod.rs | Provide direct store-seeding helpers. |
| crates/cache/tests/present_ranges.rs | Use directly seeded cache fixtures. |
| crates/cache/tests/origin_runtime_keepalive.rs | Exercise range, outboard, and size-proof reads. |
| crates/cache/tests/held_corruption.rs | Replace whole-fetch fixtures with direct seeding. |
| crates/cache/tests/admit_bao.rs | Read admitted blobs through test helpers. |
| crates/cache/src/retry/tests.rs | Add read-guard retry and breaker tests. |
| crates/cache/src/outboard_cache.rs | Remove serviceability-probe documentation. |
| crates/cache/src/origin/tests.rs | Delete obsolete fetch-collection tests. |
| crates/cache/src/origin/s3/tests.rs | Remove streamed-body error tests. |
| crates/cache/src/origin/decompress/tests.rs | Delete decoder-policy tests. |
| crates/cache/src/origin/decompress.rs | Delete origin decompression implementation. |
| crates/cache/src/origin_range/tests.rs | Supply read guards in cursor tests. |
| crates/cache/src/origin_range.rs | Guard range reads and expose terminal fault hooks. |
| crates/cache/src/origin_probe.rs | Describe size-proof-based presence memoisation. |
| crates/cache/src/metrics.rs | Remove unused counters and clarify accounting. |
| crates/cache/src/lib.rs | Update cache entry points and exports. |
| crates/cache/src/error/tests.rs | Remove decompression-error tests. |
| crates/cache/src/error.rs | Remove decoder errors and update fault descriptions. |
| crates/cache/Cargo.toml | Remove compression dependencies and add test helpers. |
| CLAUDE.md | Update configuration vocabulary documentation. |
| Cargo.toml | Remove compression dependency and unused streaming feature. |
| Cargo.lock | Reflect dependency removals and test dependency changes. |
| adr/architecture.md | Describe unpaid size-proof reads. |
| adr/appendix-binaries.md | Remove decompression-type reference. |
| adr/038-bao-verified-range-streaming.md | Require origin sidecars and remove fallback descriptions. |
| adr/005-protocol.md | Specify size-proof discovery and origin fault handling. |
Review effort: Balanced
…only test build store-only Review follow-up on #2922. - ReadGuard::run takes the read deadline. A read still running at the deadline is cut off, recorded as an unavailable origin, and answers ReadFailure::Deadline, so an origin that stalls trips its breaker as one that errors does. The outboard and range-window budgets (guarded_origin_read) and the presence walk hand their deadline to the guard instead of wrapping it, so the overall read budget is unchanged. - The decdn-cache self dev-dependency sets default-features = false, so cargo clippy -p decdn-cache --no-default-features --all-targets checks the store-only build instead of turning s3 back on.
# Conflicts: # crates/cache/src/engine.rs
…et; meter range faults in the cache Second review pass on #2922. - The {H}.sizeproof presence read runs once under the origin's breaker, with no retry: the presence memo is its retry, and a fast fault leaves the walk its time for the next origin. - ReadGuard takes a Deadline that says whether an overrun is the origin's fault. The presence walk charges only the first origin; a later origin gets only the time the earlier ones left. A deadline already past reads nothing. A Deadline carries the last error, and the walk keeps an earlier origin's cause. - decdn_cache_origin_range_faults_total counts the ranged reads that fault after a present size proof. The window.rs bump of node_pull_through_errors is gone, so store and process faults no longer read as origin faults. - Tests: a stuck outboard read trips the breaker and counts a timeout and a range fault; a window that fails once is retried; a later origin cut off by the walk ceiling is not charged; deadline and last-error cases on ReadGuard; a pinned-only hash is not counted as unpublished; a 403 on range data reads as missing. Range tests use a zero-backoff retry. - Docs: fault definitions, origin_probe_timeout_ms, the retry and breaker scope, metric docs, ADR 005/037, the observability appendix and the runbook match the code.
|
Second review pass, fixed in e35741f:
Local: fmt, clippy (workspace and store-only), doc gate, 6074 tests pass. |
…913-7f1bc3 # Conflicts: # crates/node/src/handlers/client/dispatch.rs
#2922 made the own-origin fill a ranged drive leg, so the engine cap on the whole-blob fetch no longer bounded it: own origin enforced no max_blob_size at all. The previous commit declined any own-origin blob over the cap, which would make a blob larger than its origin node's cap unservable network-wide while relays with the same cap serve its ranges. max_blob_size now bounds the bytes of one blob the node holds for both sources: - BackendSource reports the engine cap, so drive meters the own-origin leg and ends with BlobTooLarge before a leg past the cap. - The local leg records that stop as FillError::held_bytes_cap, not a local fault, so the serve leg stops with a mid-stream Declined. - serve_via_backend_origin runs the peer path's pre-commit held-bytes gate (held_cap_reached), in place of the catalog-size gate. - stop_at_held_cap falls back to the engine cap on an origin-only node. ADR 005 states one bytes-held rule for both sources; ADR 039 and the observability rows follow. Closes #2934

Step 1 of #2913 ("Make the outboard required at origins", rule 5).
What changes
An origin publishes
{H},{H}.obao4and{H}.sizeproof. All three are required, anddecdn origin importwrites all three.Before the first voucher, the node reads one object per hash,
{H}.sizeproof, and memoises it. The object states the size and proves it.CacheEngine::origin_presencegivesPresent(size)/Absent/Fault. Dispatch, the origin-only policy gate, DHT publish and the origin rescan all use it.A miss whose origin is
Presentalways takes the own-origin two-leg serve (serve_via_backend_origin). A missing or broken outboard or data object, or an origin that ignoresRange, is an origin fault. The node refuses the stream with aStreamError(InternalError) before anyChunkData(serve_leg::refuse_fill_fault).Deleted:
HEADprobes of the data object and the outboard;origin_outboard_publishedand its memo;origin_range_serviceableand the post-admission degrade memo;local_populate/try_local_populate);fetchand the streamed import;CacheEngine::get;buffered_max_bytes.The buffered node-to-node pull (
populate+ the Peer origin) stays; later steps of Simplify the stream open to five rules (follow-up to #2912) #2913 remove it.decdn_cache_hits_totalanddecdn_cache_bytes_returned_totalhad no remaining caller, so they are deleted.decdn node topanddecdn dashboardreaddecdn_serve_cache_{hit,partial_hit,miss}_totalanddecdn_bytes_served_totalinstead. Partial hits count as hits.Tests:
decdn-e2eno longer enables the cache crate'stest-util. Its node fixture writes all three origin objects. A journey that needs a warm store callsNodeFixture::warm, which does a paid fetch through the daemon.ADR 005, 037 (the "Fallback is always correct" bullet is gone) and 038,
architecture.md,appendix-observability.md, the runbook andCLAUDE.mdare updated.Breaking
cache.origin.decompressandcache.origin_retry.buffered_max_bytesare rejected.{H}.obao4and{H}.sizeproofno longer serves. Re-rundecdn origin import.decdn node top --jsonkeys changed:serve_cache_hits_total,serve_cache_misses_total,serve_cache_hit_rate,bytes_served_total.Verification
cargo fmt --check,cargo clippy --workspace --all-targets --all-features -D warnings, and thecargo docgate with warnings denied: clean.cargo nextest run --workspace: 6041 passed (1 flaky on retry:a_pull_larger_than_the_working_deposit_tops_up_once_and_completes).cargo nextest run -p decdn-e2e --features anvil-e2e: 134 of 141 passed on the full run. The 7 failures were journeys that assumed a pre-warmed store. They now warm throughNodeFixture::warm, and those binaries pass 16/16 on re-run.Open follow-up
node_origin/mod.rstreats an assigned origin's discoveryNotFoundas a cold pull-through target. An origin node that holds the blob now answersok:truefrom its size proof, so that path now runs only when the origin node's size-proof read faults. Left as is for a later #2913 step.🤖 Generated with Claude Code