Repository navigation
feat(node): default node-to-node pull-through on for a node with no origin backend - #2674
Merged
Merged
Conversation
…rigin backend `cache.node_to_node_pull_through_enabled` was off everywhere, so a node started from `decdn config init` or the README refused every miss it could not fill from its own backend, while the devops role already turned it on for a node with no origin. Absent, it now resolves by role, as `cache.relay_foreign_namespaces` does: on with no origin backend, off with one. An explicit value overrides either. The buyer leg shares a `BuyerWallet` handle with the admin server: whether pull-through is on, and the buyer wallet's USDC as last read. A node with pull-through on warns at each read of an empty wallet (bootstrap, then the hourly reclaim sweep), and `decdn node status` prints a `pull_through=` line that flags it. `StatusResponse` carries the new `pull_through` field. Closes #2603 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The documentation misleadingly presents the 10 USDC working deposit as a spending cap, even though automatic refills can spend more from a funded wallet.
1 open issue
What changed in this PR
This PR makes nodes without an origin backend buy cache misses from peers by default, aligning hand-installed nodes with fleet behavior. It also exposes pull-through status and buyer-wallet balances to operators.
Changes:
- Derive the pull-through default from origin configuration while preserving explicit overrides.
- Share wallet balance reads with admin status and warn when pull-through is enabled but the wallet is empty.
- Update CLI output, dashboard data types, tests, and operator documentation.
| File | Description |
|---|---|
| README.md | Explain role-derived defaults and wallet funding. |
| docs/runbook.md | Document status output and unfunded-wallet warnings. |
| crates/node/tests/anvil_settlement_e2e.rs | Supply the shared buyer-wallet handle. |
| crates/node/src/runtime/mod.rs | Wire the wallet into buyer and admin services. |
| crates/node/src/metrics.rs | Clarify when wallet balances matter. |
| crates/node/src/buyer_pool/tests.rs | Test balance recording and warning conditions. |
| crates/node/src/buyer_pool.rs | Record wallet balances and emit unfunded warnings. |
| crates/node/src/admin/tests.rs | Test pull-through status reporting. |
| crates/node/src/admin.rs | Include shared wallet state in status responses. |
| crates/common/src/config/types.rs | Document the new configuration default. |
| crates/common/src/config/tests.rs | Test role-derived defaults and explicit overrides. |
| crates/common/src/config/resolved.rs | Update resolved-setting documentation. |
| crates/common/src/config/mod.rs | Derive pull-through from origin presence. |
| crates/common/src/admin/tests.rs | Extend status serialization coverage. |
| crates/common/src/admin.rs | Define pull-through status fields. |
| crates/cli/src/commands/node/tests.rs | Test each pull-through display state. |
| crates/cli/src/commands/node.rs | Render pull-through and wallet status. |
| crates/cli/src/commands/dashboard/status/tests.rs | Extend dashboard fixture generation. |
| crates/cli/src/commands/config.rs | Update generated config and validation output. |
| crates/cli/dashboard/src/fixtures/dashboard-full.json | Add pull-through data to the full fixture. |
| crates/cli/dashboard/src/fixtures/dashboard-failing.json | Add pull-through data to the failure fixture. |
| crates/cli/dashboard/src/contract.test.ts | Validate the new status shape. |
| crates/cli/dashboard/src/api.ts | Mirror the Rust status fields in TypeScript. |
| CHANGELOG.md | Announce default and admin-status changes. |
| adr/appendix-observability.md | Document wallet warnings and status visibility. |
| adr/002-content-addressing.md | Describe the role-derived pull-through policy. |
Review effort: Balanced
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 8 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
…ending cap Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 28, 2026
thiras
added a commit
to decdn/devops
that referenced
this pull request
Oct 30, 2026
The daemon now derives cache.node_to_node_pull_through_enabled from the node's role (decdn/decdn#2674): on with no origin backend, off with one. The decdn_node role, the chart and `decdn-compose init node` each derived the same value themselves. They now leave the key unset, so the deployment paths and a hand-installed node cannot drift apart again. An explicit value still renders as given. Co-Authored-By: Claude Opus 5.5 <[email protected]>
thiras
added a commit
to decdn/devops
that referenced
this pull request
Oct 30, 2026
The daemon now derives cache.node_to_node_pull_through_enabled from the node's role (decdn/decdn#2674): on with no origin backend, off with one. The decdn_node role, the chart and `decdn-compose init node` each derived the same value themselves. They now leave the key unset, so the deployment paths and a hand-installed node cannot drift apart again. An explicit value still renders as given. Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
cache.node_to_node_pull_through_enabledwas off by default everywhere. A node started fromdecdn config initor the README refused every miss it could not fill from its own backend. The devops role already derives it on for a node with no origin, so a fleet node and a hand-installed node behaved differently on the same miss.Role-derived default. Absent, the knob resolves
origins.is_empty(), the same derivation ascache.relay_foreign_namespaces. It is on for a node with no origin backend, off for an origin node, and an explicit value overrides either. The validate summary,DEFAULT_CONFIG, theconfig initrole docs and the origin block's override lines say so. Validate printsdisabled (origin node)for the derived off.Unfunded wallet warning. A new
BuyerWallethandle carries the resolved flag and the buyer wallet's last USDC read.publish_buyer_wallet_usdcrecords each read into it, and on a node with pull-through on it warns when the wallet is empty. It reads at bootstrap and then on the hourly reclaim sweep, so the warning repeats once an hour. The miss path is unchanged: with no USDC theopenPoolalready reverts and the miss servesNotFound. The existingdecdn_buyer_wallet_usdcgauge stays the metric, and no duplicate counter is added.decdn node status.StatusResponsecarriespull_through: Option<PullThroughStatus { enabled, buyer_wallet_micro_usdc }>, filled from the sameBuyerWallethandle viaAdminState::with_buyer_wallet. The CLI prints one of:pull_through=offpull_through=on buyer_wallet_usdc=N.NNNNNNpull_through=on buyer_wallet_usdc=(not read yet)pull_through=on buyer_wallet_usdc=0.000000 (unfunded: …)The dashboard's
api.ts, contract test and pinned fixtures match.Docs: README, runbook, ADR 002 (the pull-through default beside the relay default),
appendix-observability.md(decdn_buyer_wallet_usdcrow) and the gauge's doc.Closes #2603
Breaking
cache.node_to_node_pull_through_enablednow buys its misses from peers. It spends USDC from its buyer wallet, bounded byblockchain.buyer_working_deposit_micro_usdc(10 USDC by default, already the default before this PR). Setfalseto keep the old behaviour. The fleet already runs with it on (devops role).StatusResponse.pull_throughis required. AdecdnCLI at this release readsadmin_v1_statusonly from a daemon at this release (pre-mainnet, no shim).Reviewer notes
crates/common/src/config/mod.rs,BuyerWalletandpublish_buyer_wallet_usdcincrates/node/src/buyer_pool.rs, andpull_through_lineincrates/cli/src/commands/node.rs.decdn setupprinting the working deposit and checking the buyer wallet's USDC, which needsPaymentPool.usdc()wired into setup's chain context. Follow-up issue.decdn_node_to_node_pull_through_enabled: "{{ not … }}") and passing the knob through only when set. That belongs in a decdn/devops PR once a decdn release carries this default.buyer_working_deposit_micro_usdcalready defaulted to 10 USDC and was never required, so that part of the issue needed no change.NodeFixturewrites the knob explicitly, so no e2e journey's behaviour changes.Verification
an_empty_buyer_wallet_warns_only_with_pull_through_on: warns only with pull-through on and a zero read, records each read, records nothing on a failed readstatus_reports_pull_through_from_the_buyer_walletpull_through_line_names_each_statewrite_statussummary assert the new fielddecdn config initwith no origin validates asnode_to_node_pull: enabled (…). With--origin file://…it validates asdisabled (origin node)and prints that both knobs derive to false.CARGO_BUILD_WARNINGS=deny cargo clippy --workspace --all-targets --all-featurescargo nextest run --workspace: 5978 passedCARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-itemsvitest run src/contract.test.ts(7 passed),tsc --noEmit, fixtures regenerated withUPDATE_STATUS_FIXTURES=1pre-commit runon the change.cargo denyreports only the existing warn-only advisories.adr/:make -C adr check-refsdecdn-commonis outside the snapshot.decdn-protocolanddecdn-clientare unchanged.🤖 Generated with Claude Code