Repository navigation
refactor(node): remove client-less background cache-warm (#1610) - #1611
Conversation
The detached background warm re-pulled a blob from offset 0 after a serve-miss whose foreground pull missed its deadline or could not open — after the client had already been refused. The paid variant is an economic attack surface: unpaid egress forces paid ingress, so a requester can force the foreground miss, pay nothing, and leave the node paying an upstream from zero for a blob nobody wants; repeated, it drains payment-channel deposits. The unpaid variant is the same shape against backend egress. Removing both establishes the invariant: a node ingests only while a live client is waiting on the bytes; it never initiates a from-zero pull speculatively. The foreground client-waiting fills (serve-miss tee, buffered populate under the pull-through deadline) are unchanged; advertising is independent (HEAD/stat metadata index), so what the node serves does not change. Deletes: maybe_spawn_background_fill, spawn_local_warm, the BackgroundFill subsystem + its MiB permit pool, MAX_BACKGROUND_FILL_MB, the node_pull_through_background_* metrics, and the pull_through_bg_shutdown wiring. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (1)
WalkthroughThe pull path removes detached background cache warming, its runtime lifecycle, and its metrics. Foreground timeout and fault paths now return directly. Documentation and tests describe the updated deadline and cancellation behavior. ChangesBackground cache-fill removal
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ClientHandler
participant Origin
Client->>ClientHandler: Request pull
ClientHandler->>Origin: Start foreground pull
Origin-->>ClientHandler: Return timeout or fault
ClientHandler-->>Client: Return error without background fill
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Coverage reportTotal: 80.31% (was 80.29%, ▲ +0.02%) — 57032/71016 lines
History
|
There was a problem hiding this comment.
🟢 Ready to approve
The background-warm removal appears complete (no remaining symbol references) with only a minor test-helper naming nit to consider.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR removes the node’s detached, client-less background cache-warm paths (both paid peer pulls and unpaid local-origin warms) to enforce the invariant that ingestion only happens while a live client is waiting on bytes, eliminating an economic/cost-amplification attack surface.
Changes:
- Deleted the background-fill subsystem, its shutdown wiring, and its metrics/counters.
- Simplified the serve-miss paths to return a clean miss on deadline expiry without spawning any detached follow-up work.
- Updated rationale/comments and adjusted tests to match the new “nothing continues after refusal” behavior.
File summaries
| File | Description |
|---|---|
| crates/node/tests/node_origin_pull.rs | Updates test commentary about cancellation/drop paths after removing detached warms. |
| crates/node/tests/client_loopback.rs | Clarifies that only foreground deadlines can fill the store; no background warm can mask failures. |
| crates/node/src/selection.rs | Updates outer-deadline rationale docs to reflect that no background acquisition continues. |
| crates/node/src/runtime/mod.rs | Removes background-fill wiring, shutdown token, and associated runtime construction logic. |
| crates/node/src/node_origin/mod.rs | Updates documentation about what external events drop in-flight pulls now that warm/shutdown hooks are gone. |
| crates/node/src/metrics.rs | Removes background-fill metrics fields and recorder hooks. |
| crates/node/src/handlers/client/window.rs | Stops spawning background fills on miss/timeout in the serve path. |
| crates/node/src/handlers/client/mod.rs | Deletes the BackgroundFill types/helpers and prunes related tests; keeps handler tests with a simplified helper. |
| crates/node/src/handlers/client/fill.rs | Removes maybe_spawn_background_fill and local-origin warm spawning; updates timeout semantics to “clean miss”. |
| crates/node/src/chain_events/resumable_watcher.rs | Removes references to WarmOutcome precedent in panic-guard docs. |
| crates/common/src/cli/fetch.rs | Removes mention of mirroring node’s background hard cap in CLI timeout documentation. |
| crates/client-pull/src/lib.rs | Updates commentary that previously referenced background warm behavior. |
| crates/client-pull/src/ledger.rs | Updates commentary describing which external drops can end a pull. |
Review details
- Files reviewed: 13/13 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
The warm/background-fill tests it was named for were removed in this PR; the fixture is now a generic minimal ClientHandler builder. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Closes #1610.
What
Removes the detached background cache-warm — both variants (paid node→node and unpaid own-backend). Net −965 lines.
Why
The background warm re-pulled a blob from offset 0 after a serve-miss whose foreground pull missed its deadline or couldn't open — after the client had already been refused. The paid variant is an economic attack surface: unpaid egress forces paid ingress. A requester forces the foreground miss, pays nothing, and leaves the node paying an upstream from zero for a blob nobody wants; repeated, it drains payment-channel deposits. The unpaid variant is the same shape against backend (S3/R2) egress.
This is not a scale-deferral cut — the economics are wrong at any node count.
The invariant this establishes
Kept (unchanged)
The foreground, client-waiting fills: the serve-miss tee (
open_progressive_pull), bufferedpopulate/populate_localbounded by the pull-through deadline, and thenode_pull_through_timeout/node_pull_through_errormetrics. Advertising is independent — the node announces assigned content from the HEAD/stat metadata index, not from warmed bytes — so what the node serves does not change.Removed
maybe_spawn_background_fill,spawn_local_warm, theBackgroundFillsubsystem + its MiB semaphore permit pool (MAX_BACKGROUND_FILL_MB,warm_budget_mb),BACKGROUND_FILL_HARD_CAP, theWarmOutcome/WarmVerdictaccounting, the 7node_pull_through_background_*metrics, thepull_through_bg_shutdownwiring, and 9 inline unit tests. The permit pool gated only background warms, so the foreground path needed no retuning.Doc sweep
The background warm was load-bearing in a lot of rationale prose across
node,common, andclient-pull(deadline/drop-path reasoning). All of it — comments that named the deleted symbols or asserted "on expiry the transfer continues in a detached warm" — was rewritten to the post-removal reality (clean miss, nothing continues). Zero references to any deleted symbol remain.Verification
All clean.
Context
This unblocks the node leg of the
PeerSourceunification (unify the paid-pull loop across the node + both CLI legs) — with the client-less warm gone, a refactoredPeerSourcenever has to support a paid pull with no consumer.🤖 Generated with Claude Code
Summary by CodeRabbit
Behavior Changes
Metrics
Documentation