Repository navigation
fix(node): drop the redundant serve-side blob-size ceiling - #1959
Conversation
The serve path refused to deliver a locally-held blob whose size exceeded `max_blob_size_bytes`. That gate was redundant and, where it fired, wrong: - A plain cache hit or a just-filled miss is already bounded by the cache engine's own admission cap (the same `max_blob_size_mb` config value), so the serve-side re-check could never fire on those paths. - It fired only on an own-origin range pull (own-origin is exempt from the #1895 received-byte ceiling, so its whole-blob total can exceed the cap) or after a reload lowered the cap below an already-stored blob. In both cases refusing to serve a blob the node already holds strands egress revenue for no benefit — the bytes are already on disk. Delete the gate and its now-orphaned surface: the `ServeRejectReason::BlobTooLarge` variant and its `StreamError` mapping, the `serve_stream_rejected_blob_too_large` counter, the vestigial `max_blob_size_bytes` field on `ClientHandlerDeps` / `ClientHandler`, and the serve-gate loopback test. The #1895 received-byte ceiling on the pull leg (`NodeOriginConfig`, `client-pull`) is unchanged — the real size bound still binds on BLAKE3-verified received bytes, and the cache engine still caps admission. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The functional changes are cohesive and low-risk, and remaining feedback is limited to minor in-test comment inaccuracies with straightforward fixes.
Pull request overview
This PR removes the redundant serve-side blob-size ceiling from the node’s serve_stream path and cleans up the now-dead surface area (reject reason, metric, deps fields, and tests). This aligns serving behavior with cache admission and the buyer-side received-byte ceiling (#1895), avoiding incorrect refusals for already-stored or own-origin blobs.
Changes:
- Delete the serve-side
max_blob_size_bytesgate inClientHandlerdispatch and remove the associatedServeRejectReason::BlobTooLargemapping. - Remove the orphaned
serve_stream_rejected_blob_too_largemetric and its recorder/test expectations. - Thread out the vestigial
max_blob_size_bytesdependency from runtime wiring and test helpers; update affected tests accordingly.
File summaries
| File | Description |
|---|---|
| crates/node/src/handlers/client/dispatch.rs | Removes the serve-side blob-size ceiling check during request dispatch. |
| crates/node/src/handlers/client/mod.rs | Drops ServeRejectReason::BlobTooLarge and removes max_blob_size_bytes from handler deps/struct. |
| crates/node/src/handlers/client/wire.rs | Removes metric emission for the deleted BlobTooLarge serve-side reject reason. |
| crates/node/src/metrics.rs | Removes the serve_stream_rejected_blob_too_large counter and updates metric tests accordingly. |
| crates/node/src/runtime/mod.rs | Stops wiring max_blob_size_bytes into the client handler deps. |
| crates/node/src/handlers/client/fill.rs | Updates explanatory comments that previously referenced the removed serve-side size gate. |
| crates/node/tests/support/mod.rs | Updates handler builder helpers to remove the max_blob_size_bytes parameter. |
| crates/node/tests/partial_serve.rs | Updates handler construction calls after removing the size-ceiling parameter. |
| crates/node/tests/origin_range_pull.rs | Updates handler construction calls after removing the size-ceiling parameter. |
| crates/node/tests/node_to_node_pull_through.rs | Updates server builder call signature after removing the size-ceiling parameter. |
| crates/node/tests/node_origin_pull.rs | Updates handler construction calls after removing the size-ceiling parameter. |
| crates/node/tests/client_loopback.rs | Removes the serve-side size-gate test and updates helper signatures/usages. |
| crates/node/tests/anvil_settlement_e2e.rs | Updates handler construction call after removing the size-ceiling parameter. |
Review details
Suppressed comments (1)
crates/node/tests/client_loopback.rs:5712
- This comment still refers to a "Server ceiling 0" argument, but the serve-side blob-size ceiling has been removed from the handler; there is no server-side ceiling to configure here.
// Server ceiling 0 (unlimited) — it honestly serves the whole 4 MiB blob.
- Files reviewed: 13/13 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.
…checks-dispatch-084d04 # Conflicts: # crates/node/src/handlers/client/mod.rs
The serve handler no longer takes a size-ceiling argument, so "Server ceiling 0 (unlimited)" no longer describes anything. State plainly that the server has no size ceiling and the ceiling under test is the buyer's received-byte cap. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Coverage reportTotal: 82.63% (was 82.63%, ● 0.00%) — 74469/90122 lines
History
|
What
Removes the serve-side blob-size gate in
dispatch.rs(the former check #13, "Blob size ceiling") that refused to deliver a locally-held blob whose size exceededmax_blob_size_bytes.Why it was redundant — and, where it fired, wrong
self.max_blob_size_byteson the serve handler wascfg.cache.max_blob_size_mb × MB— the same config value the cache engine uses to gate admission. Tracing the three waystotal_bytesreached the gate:max_blob_size_mbat ingest. Same threshold, so the serve-side re-check could never fire.max_blob_size_bytes()returns0), so its whole-blob total can exceed the cap. The gate fired here and refused a range serve of a large own-origin blob on the strength of the whole size — contradicting the Node-to-node size-claim gate lets a holder centralize traffic (refuse-on-claim → refuse-on-received-bytes) #1895 own-origin decision.In both firing cases, refusing to serve bytes already on disk strands egress revenue for no benefit. Lowering the cap should stop new admissions / drive eviction, not gate serving.
What's deleted
The gate plus its now-orphaned surface (an unused variant/field/counter trips
dead_codeunder CI's-D warnings, so these must go together):ServeRejectReason::BlobTooLargeand itsStreamErrormappingserve_stream_rejected_blob_too_largemetric countermax_blob_size_bytesfield onClientHandlerDeps/ClientHandler(threaded out of the handler and its test helpers)client_blob_too_large_is_refusedWhat's unchanged
The #1895 received-byte ceiling on the pull leg (
NodeOriginConfig,client-pull) is untouched — the real size bound still binds on BLAKE3-verified received bytes, the cache engine still caps admission, and the buyer-side cap tests still pass. The protocol wire variantStreamError::BlobTooLargestays (its requester-side durable-miss classification is retained).Verification
cargo build --tests -p decdn-node✓cargo clippy --all-targets --all-features -p decdn-node✓cargo fmt -- --check✓RUSTDOCFLAGS="-D warnings" cargo doc -p decdn-node --no-deps --document-private-items✓cargo nextest run -p decdn-node --lib→ 829/829 ✓cargo nextest run -p decdn-node --test client_loopback→ 115/115 ✓🤖 Generated with Claude Code