Repository navigation
feat(node): complete reactive origin pull-through — decouple local populate + node→node chained binding (#1116, #1117) - #1128
Conversation
…pulate + node→node chained binding (#1116, #1117) Follow-through on #1124. Two gaps remained after the direct-client fetch learned to send the ADR 005 client identity binding: #1116 — reactive local-origin populate was gated behind cache.node_to_node_pull_through_enabled, so a cache-only operator (flag off) got a silent NotFound for content in its own fs/http/s3 origin, and with the flag on a whole-blob request preferred the paid peer window path over the node's own local origin. - CacheEngine::populate_local: like populate but skips the Peer origin (via a local_only flag threaded through the shared pull_through chain walk); a peer-only chain is a fast NoOrigin. - ClientHandler gains local_populate + attach_local_populate + try_local_populate; the serve-miss path tries a local-origin fill FIRST (gated on the same pull_authorized proof of channel ownership) before any node→node path. - Runtime arms attach_local_populate whenever [cache.origin] is configured, independent of the node→node flag. No new config knob. #1117 — node_origin omitted the binding, so multi-hop node→node chained warming stopped at the first hop that already held the blob. - NodeOriginDeps gains bind_domain; the runtime threads in the same CapacityBond bind domain the serving side verifies against. - Both node_origin requester paths attach a binding signed over the node's own iroh NodeId with the channel buyer key, reusing #1124's sign_client_binding / with_client_binding. Both paths stay gated on pull_authorized, so no change frees egress. Tests: engine populate_local (skips peer / peer-only NoOrigin); loopback cache-only-operator serve + local-preferred-over-window; two-hop chained reactive pull proving the binding propagates across a node→node hop. Closes #1116. Closes #1117. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Warning Review limit reached
Next review available in: 25 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 (5)
WalkthroughAdds local-only cache population that skips peer origins, wires reactive local fills into client serving, and signs node-origin upstream requests with client bindings for chained reactive pulls. Runtime setup and integration tests cover local-origin precedence, authorization, and bound origin chaining. ChangesReactive pull-through
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ClientHandler
participant CacheEngine
participant FilesystemOrigin
Client->>ClientHandler: request blob
ClientHandler->>CacheEngine: populate_local(hash)
CacheEngine->>FilesystemOrigin: fetch(hash)
FilesystemOrigin-->>CacheEngine: blob
CacheEngine-->>ClientHandler: local fill result
ClientHandler-->>Client: serve blob
sequenceDiagram
participant NodeOrigin
participant UpstreamClient
participant ClientHandler
participant CacheEngine
participant FilesystemOrigin
NodeOrigin->>NodeOrigin: sign upstream client binding
NodeOrigin->>UpstreamClient: send bound request
UpstreamClient->>ClientHandler: request blob
ClientHandler->>CacheEngine: populate_local(hash)
CacheEngine->>FilesystemOrigin: fetch(hash)
FilesystemOrigin-->>CacheEngine: blob
CacheEngine-->>ClientHandler: filled blob
ClientHandler-->>UpstreamClient: serve blob
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 |
Gas snapshotNo gas changes vs base. |
Contracts coverageLine coverage: 88.71% (2452/2764 lines) |
There was a problem hiding this comment.
Code Review
This pull request implements reactive local-origin pull-through and chained node-to-node pulls. It introduces populate_local in the cache engine to allow nodes to reactively fill cache misses from their own configured local origins (such as fs, HTTP, or S3) while explicitly skipping paid peer-to-peer origins. Additionally, it wires up client identity bindings to node-to-node requests so that upstream nodes can verify channel ownership and securely chain reactive origin pulls. Comprehensive unit and integration tests have been added to verify these behaviors under various configurations. No review comments were provided, so there is no additional feedback to address.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
Completes the reactive origin pull-through follow-ups by (1) decoupling local-origin population from the node→node pull-through flag (so cache-only operators can still serve their configured origins) and (2) ensuring node→node pulls carry an ADR-005 client binding so multi-hop chained pull-through can be authorized upstream.
Changes:
- Add
CacheEngine::populate_localto fill only from non-Peerorigins (skip paid peer origin) and thread alocal_onlymode through the pull-through chain walk. - Add
ClientHandler::attach_local_populate+ local-first serve-miss logic to try local-origin fill (authorized) before node→node window/buffered paths. - Extend
NodeOriginDepswithbind_domainand bind node→node upstream requests usingsign_client_bindingto enable chained reactive pulls.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/cache/src/engine.rs | Adds populate_local/local_only mode so local-origin fills skip OriginKind::Peer during pull-through. |
| crates/cache/tests/pull_through.rs | Adds tests asserting populate_local skips peer origins and returns NoOrigin for peer-only chains. |
| crates/node/src/handlers/client.rs | Adds local_populate wiring and local-first reactive fill on serve miss (authorized) before node→node paths. |
| crates/node/src/runtime/mod.rs | Arms local-origin populate when [cache.origin] is configured, independent of node_to_node_pull_through_enabled. |
| crates/node/src/node_origin.rs | Threads bind_domain into deps and binds upstream node→node pulls to support chained reactive pull-through. |
| crates/client-pull/src/lib.rs | Updates sign_client_binding docs to reflect node→node usage. |
| crates/node/tests/client_loopback.rs | Adds integration tests for cache-only local-origin serving + local-origin preferred over (dead) window path. |
| crates/node/tests/node_origin_pull.rs | Adds a two-hop chained reactive pull test asserting upstream origin fetch occurs only with propagated binding. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage reportTotal: 80.23% (was 80.27%, ▼ 0.04%) — 45150/56275 lines
History
|
…eck (#1116) - Arm attach_local_populate with the per-attempt node_pull_timeout_sec, not outer_pull_deadline (which budgets MAX_PROVIDER_ATTEMPTS × for the sequential node→node fan-out); a single local origin-chain walk shouldn't block ~3× longer before falling through to the node→node paths. - try_local_populate now does a post-deadline cache.has race check (extracted to on_local_populate_timeout) and meters the timeout, so a concurrent fill that lands at the deadline is served — not reported as CacheMiss with node→node OFF — and operators get a timeout signal. No background warm is spawned (local-only). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…docs, test (#1116, #1117) Multi-agent review of PR #1128: - node_origin.rs: bind_upstream_ctx was inserted between pull_from_candidate's doc comment + #[allow(cognitive_complexity, too_many_lines)] and the function, so both bound to the wrong item (bind_upstream_ctx got pull_from_candidate's rustdoc; pull_from_candidate lost its doc and lint allow). Move bind_upstream_ctx above so the doc/attr sit on pull_from_candidate again. - client.rs on_local_populate_timeout: a store-lookup error at the deadline was metered as node_pull_through_error AND then also as node_pull_through_timeout with a misleading "timed out" log. Return after the error meter so a store fault isn't double-counted / mislabeled as a timeout. - metrics.rs: document that node_pull_through_{errors,timeouts} now cover BOTH reactive tiers (node→node #831 and local-origin populate #1116), so they aren't read as node→node-only health signals. - runtime/mod.rs: correct the deadline comment — outer_pull_deadline adds a fixed PULL_THROUGH_OUTER_SLACK on top of MAX_PROVIDER_ATTEMPTS×, so the overshoot is >3× (more at small budgets), not ~3×. - test: add local_populate_miss_is_clean_cache_miss — a blob absent from the local origin terminates as a clean delivery refusal after the origin is consulted once (node→node off), guarding the local-first miss path. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Closes #1116. Closes #1117.
Problem
Follow-through on #1124 (reactive origin pull-through), which taught a direct
decdn fetchto send the ADR 005 client identity binding but left two gaps:cache.node_to_node_pull_through_enabled. A cache-only operator (flag OFF) got a silentNotFoundfor content held in its own configured fs/http/s3 origin. And with the flag ON, a whole-blob request took the paid peer "window" path and never read the node's own local origin (local origin shadowed).node_origin) omitted the binding, so multi-hop node→node chained warming died at the first hop that already held the blob: an upstream node'spull_authorizedgate refused to chain a further reactive pull for an unbound request.Change
#1116 — decouple + prefer local origin
CacheEngine::populate_local(new): likepopulatebut skips thePeerorigin, so it fronts no upstream USDC. Implemented by threading alocal_onlyflag through the sharedpull_throughchain walk (a peer-only chain is a fastNoOrigin).ClientHandler: newlocal_populatedeadline +attach_local_populate+try_local_populate. The serve-miss path now tries a local-origin fill first (gated on the samepull_authorizedproof of channel ownership), before any node→node window/buffered path — so a locally-held whole blob is served from the local origin instead of a paid peer.attach_local_populatewhenever[cache.origin]is configured, independent ofnode_to_node_pull_through_enabled. The node→node window/governor/background/gate paths stay flag-gated. No new config knob.#1117 — node→node chained binding
NodeOriginDepsgains abind_domain; the runtime threads in the sameCapacityBondbind domain the serving side verifies against.node_origin's two requester paths (open_from_candidate,pull_from_candidate) attach an ADR 005 binding — signed over the node's OWN iroh NodeId with the channel's buyer key (ctx.client_signer) — reusing fix(cli): send the ADR 005 client identity binding on decdn fetch (#1115) #1124'ssign_client_binding/with_client_bindingverbatim. A signing failure drops the candidate rather than sending an unbound request.Scope / notes
pull_authorized(a funded, proven-owned channel), so no change frees any egress. An S3 origin's egress is fronted only for a channel-owning client, and the delivery is billed per-voucher — called out because with the flag ON, a whole-blob request now hits the operator's own S3 before a peer (intended: it's the operator's own authorized origin).CacheEngine::populate_local,ClientHandler::attach_local_populate,NodeOriginDeps.bind_domain) — public-api snapshot regenerated.Tests
crates/cache/tests/pull_through.rs:populate_localskips aPeerorigin and fills from local; a peer-only chain isNoOriginwhile fullpopulatestill pulls the peer.crates/node/tests/client_loopback.rs: cache-only operator serves its own origin with node→node off (bound →origin_fetches == 1, unbound → refused,origin_fetches == 0); local origin preferred over a (dead) peer window path.crates/node/tests/node_origin_pull.rs: two-hop chained reactive pull — B pulls from A, A holds the blob only in its fs origin and serves it only because B's binding authorizes the chained reactive pull (origin_fetches == 1).Verification
cargo build && cargo clippy --all-targets -- -D warnings && cargo fmt -- --checkclean.cargo nextest run -p decdn-cache -p decdn-nodegreen (incl. the existing node→node tests, which now send + verify a binding).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes