Skip to content

fix(node): drop the redundant serve-side blob-size ceiling - #1959

Merged
alpergundogdu merged 3 commits into
mainfrom
claude/blob-range-checks-dispatch-084d04
Sep 9, 2026
Merged

alpergundogdu merged 3 commits into
mainfrom
claude/blob-range-checks-dispatch-084d04

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

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 exceeded max_blob_size_bytes.

Why it was redundant — and, where it fired, wrong

self.max_blob_size_bytes on the serve handler was cfg.cache.max_blob_size_mb × MB — the same config value the cache engine uses to gate admission. Tracing the three ways total_bytes reached the gate:

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_code under CI's -D warnings, so these must go together):

  • ServeRejectReason::BlobTooLarge and its StreamError mapping
  • the serve_stream_rejected_blob_too_large metric counter
  • the vestigial max_blob_size_bytes field on ClientHandlerDeps / ClientHandler (threaded out of the handler and its test helpers)
  • the serve-gate loopback test client_blob_too_large_is_refused

What'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 variant StreamError::BlobTooLarge stays (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

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]>
Copilot AI lite review requested due to automatic review settings September 9, 2026 10:50

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 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_bytes gate in ClientHandler dispatch and remove the associated ServeRejectReason::BlobTooLarge mapping.
  • Remove the orphaned serve_stream_rejected_blob_too_large metric and its recorder/test expectations.
  • Thread out the vestigial max_blob_size_bytes dependency 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.

Comment thread crates/node/tests/client_loopback.rs Resolved
alpergundogdu and others added 2 commits September 9, 2026 11:56
…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]>
@alpergundogdu
alpergundogdu merged commit 4c22a4f into main Sep 9, 2026
24 checks passed
@alpergundogdu
alpergundogdu deleted the claude/blob-range-checks-dispatch-084d04 branch September 9, 2026 11:05
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Coverage report

Total: 82.63% (was 82.63%, ● 0.00%) — 74469/90122 lines

File Coverage Lines Δ
crates/node/src/handlers/client/dispatch.rs 82.43% 474/575 ▼ 0.30%
crates/node/src/handlers/client/fill.rs 68.70% 90/131 ● 0.00%
crates/node/src/handlers/client/mod.rs 94.49% 1937/2050 ▲ +0.08%
crates/node/src/handlers/client/wire.rs 92.52% 396/428 ▼ 0.02%
crates/node/src/metrics.rs 94.64% 882/932 ▼ 0.01%
crates/node/src/runtime/mod.rs 47.93% 1169/2439 ▲ +0.08%
History
Commit Total Δ vs base
20f8c50 (HEAD) 82.63% ● 0.00%

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.

2 participants