Repository navigation
fix(cli,incentive,node): count resumed bundle bytes apart, tag buyer rows with the chain id, flag unmatched filters - #2244
Merged
Conversation
…ed bytes A bundle pull that resumes a `.partial` left by an interrupted run counted the prefix again as downloaded: the whole-blob path took the file length as paid, and the range-dedup path took the blob less its spliced bytes. The entry line's rate, the summary's `downloaded` and `--json` all overstated what the run moved. On the testnet a re-pull that resumed a 1.46 GB prefix reported 9.7 GB for about 8.3 GB moved. Each entry now reads its resume record before it drives anything. The ranged store marks only fetched bytes present, never spliced donor bytes, so the record's present set is exactly what earlier runs paid for. `decdn-client` exposes it as `ClientRangedStore::present_byte_ranges`. The whole-blob path pays for the blob less that prefix. The range-dedup path reports the prefix less the bytes it spliced, so a byte both resumed and spliced counts once, as spliced; that holds on every return of the reassembly, including a first drive that finalizes the blob and the self-heal re-drive. The resumed bytes travel beside the paid bytes to the entry line (`X downloaded at R, Y resumed, Z spliced from disk`), the summary (`resumed N from earlier partials`) and a new `resumed_bytes` field in `--json`. The docs drop the carve-out that said a resumed prefix counts again, and the bundles appendix now states that range-dedup savings and the resumed prefix are both outside `downloaded`. Closes #2236 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ount excluded entries Three gaps from one testnet pull left the operator guessing. An `--exclude 'metal/*'` matched nothing, because every pattern matches the whole path from the bundle root and the entry sat at `openai-gpt-oss-20b/metal/model.bin`, and the pull went ahead at 22.9 GiB instead of 13.8 GiB with no word. A 1.5 GB partial of that entry, left by an earlier interrupted pull, stayed in `.decdn-partial/` unseen. And the summary read `0 deduped` beside `range-dedup: spliced 12.7 GB`, while the excluded entry appeared in no count at all. The entry filter now tracks each pattern's hits over the whole manifest and prints one stderr warning per pattern that matched nothing, at every site that filters: a local `-i` manifest, a `--hash` manifest, and `--dry-run`. When the pattern's `**/` form would match an entry, the warning names it. At run end, staging files for blobs the run did not select (neither a kept entry nor the manifest blob) print one warning with their count and size; the pull keeps them, since they are the resume prefix of a later run that selects the entry again. The summary and `--json` gain `excluded`, the entries that the filter dropped or `--select` deselected, and rename `deduped` to `reused` so the count pairs with `reused_bytes` and no longer reads as covering range dedup. The rename breaks `--json` readers of `deduped`; the anvil e2e that asserted it reads `reused`. Closes #2190 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ymentPool address poolId = keccak256(owner, ownerPoolNonce) names neither the chain nor the contract, and a redeploy restarts the nonce. Buyer rows carried only the PaymentPool address as their deployment tag, but the same deployer nonce gives the same address on every chain. A node or client repointed at another chain with its data dir intact therefore treated a row from the other chain as its own: it resumed lane progress the live pool never redeemed against and reused a deposit figure the live pool may not hold. Move the seller store's Deployment (chain id + PaymentPool) into decdn-incentive (re-exported from channel_store) and make it the buyer row tag. BuyerPoolState carries a Deployment and is_on compares both halves. The record codec inserts chain_id (8 bytes, big-endian) before payment_pool under schema 3, and both buyer tables move to _v5, so rows written by an earlier binary are not read; node and client re-adopt the live pool from chain. Thread the deployment through every reader that checks the tag: node bootstrap (reconcile_owned_pool, adoption_applies, AdoptionCheck::Foreign, drop_foreign_row), the node pull path (reuse_or_report), and decdn fetch (cached_pool_token, pool_to_reuse, adopt_owned_pool, open_or_reuse_pool, build_delegated_pool_ctx). BuyerPoolService::bootstrap takes the Deployment in place of the PaymentPool address and the voucher domain. decdn_client::buyer_pool::open_pool takes the Deployment in place of the voucher EIP-712 domain, derives the domain from it, and refuses a deployment whose address is not the contract's. The foreign-row WARNs keep their text and payment_pool fields and add foreign_chain_id and configured_chain_id. admin_v1_pools and decdn pool list --json gain chain_id. Tests: same-address-other-chain siblings for the node foreign-row drop, standalone drop, adoption check and pull-path filter; a CLI pool_to_reuse test for address and chain mismatch; cached_pool_token covers both; the golden record and schema-skew tests move to schema 3. The decdn-client public API snapshot is regenerated. Closes #2198 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Resume retry accounting, foreign-row opening, and leftover-partial reporting contain correctness gaps.
Review effort: Balanced
Findings: 1
Open (5)
Foreign-chain rows incorrectly suppress deployment opening · New Leftover partial warning skipped when selection is empty · New Resume accounting understates bytes redownloaded after drift · New Partial cleanup warning overstates reclaimable sparse disk space · New Excluded hash detection includes entries from prior bundles · New
What changed in this PR
Separates resumed bundle bytes from new downloads, improves bundle-filter reporting, and scopes buyer pools to chain plus contract.
Changes:
- Adds resumed-byte, excluded-entry, and reused-file reporting.
- Warns about unmatched filters and leftover partials.
- Adds chain-aware buyer-pool persistence and APIs.
| File | Description |
|---|---|
docs/runbook.md |
Documents buyer deployment tags. |
crates/node/src/runtime/mod.rs |
Wires deployment into buyer bootstrap. |
crates/node/src/channel_store.rs |
Reuses shared Deployment. |
crates/node/src/buyer_channel.rs |
Applies deployment-aware buyer logic. |
crates/node/src/admin.rs |
Exposes buyer chain IDs. |
crates/incentive/src/lib.rs |
Exports Deployment. |
crates/incentive/src/deployment.rs |
Defines deployment encoding and domains. |
crates/incentive/src/buyer_pool.rs |
Tags buyer state by deployment. |
crates/incentive/src/buyer_pool_table.rs |
Introduces v5 storage schema. |
crates/incentive/src/buyer_pool_redb.rs |
Updates storage tests. |
crates/e2e/tests/pool_floor_ceiling_aggregate.rs |
Updates deployment fixtures. |
crates/e2e/tests/node_pull_pool_redeploy.rs |
Documents deployment-aware behavior. |
crates/e2e/tests/cli_fetch_topup.rs |
Uses deployment-based pool opening. |
crates/e2e/tests/cli_bundle_pull_range_dedup.rs |
Verifies renamed JSON field. |
crates/e2e/src/client.rs |
Centralizes fixture deployment construction. |
crates/common/src/admin.rs |
Adds chain ID to pool snapshots. |
crates/client/tests/snapshots/public_api__public_api.snap |
Updates public API snapshot. |
crates/client/src/ranged_store.rs |
Exposes present byte ranges. |
crates/client/src/buyer_pool.rs |
Derives voucher domains from deployments. |
crates/client/examples/common/mod.rs |
Updates example pool reuse. |
crates/cli/tests/pool_list.rs |
Tests chain-aware pool listing. |
crates/cli/tests/admin_rpc.rs |
Tests chain ID round-tripping. |
crates/cli/src/commands/pool.rs |
Emits chain IDs in JSON. |
crates/cli/src/commands/fetch.rs |
Validates deployment during reuse. |
crates/cli/src/commands/bundle_pull.rs |
Implements reporting and warning changes. |
CHANGELOG.md |
Records breaking and user-visible changes. |
adr/appendix-bundles.md |
Clarifies bundle byte accounting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit 9542d17 in the Show a line coverage summary of the most impacted files.
Updated |
… settlement e2e The anvil-e2e settlement test still passed the bare PaymentPool address and the voucher domain. It builds only under --features anvil-e2e, so the local clippy run missed it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The re-check under the open slot treated any row for the owner as the live pool. A foreign row that bootstrap could not drop already reads as no row on the pull path, so every pull spawned an open that stopped at the re-check and found no pool again. The re-check now counts only a row on this deployment. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…overs by disk use - A finalize whose hash fails drops every byte the store held and fetches the blob again, including a resumed prefix and spliced bytes. Downloader::refetched_targets reports that pass, and bundle pull then counts the whole blob as downloaded. - The leftover-partial scan also runs when the filter or --select empties the run, which is where every retained partial is unused. - It totals allocated space, not length: a range-dedup .partial is sized to the whole blob before its bytes land. - The warning says "did not use" rather than "did not select", since a partial another bundle left in the same output dir counts too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 5, 2026
thiras
added a commit
that referenced
this pull request
Oct 7, 2026
…ed manifest (#2360) `bundle pull --hash <H> --dry-run` never read the manifest, so an `--include`/`--exclude` pattern that matches no entry went unreported: the repro in #2327. The live-run warning already exists (#2244). The dry run now reads the manifest from the output root's `.decdn-bundles/` cache when an earlier pull stored it. The read is local, unpaid, and verified against the hash, so it happens even under `--overwrite`. It then prints the filtered plan and the unmatched-pattern warnings, as `-i --dry-run` does. With no cached manifest it prints the bundle and output root, with `count`/`entries` null under `--json`. A malformed `--hash` fails the dry run, as it fails a real pull, and a cached manifest that does not parse names its cache file. Closes #2327 Co-authored-by: Claude Opus 5.5 <[email protected]>
7 tasks done
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.


Summary
Batch of three CLI-labelled fixes, one commit each.
#2236 — a resumed
.partialprefix is not "downloaded"pull_entry_untimedreads the resume record's present spans (newClientRangedStore::present_byte_ranges) before any drive.paid = len − resumed.DedupOutcome.resumed_bytes= resumed spans minus spliced spans (spliced wins on overlap, sospliced_bytesis unchanged), set on every return including early finalize and self-heal.X downloaded at R, Y resumed, Z spliced from disk. The rate uses paid bytes only.PullReport.resumed_bytesplus aresumed N from earlier partialssummary line. The "counts again" carve-out is gone from the docs, and the drift inadr/appendix-bundles.mdis fixed.#2190 — bundle pull UX
**/hint when that form would match. This covers-i,--hashand--dry-run.PullReport.excludedcounts entries dropped by the glob filter and by--select.--json):dedupedis renamed toreused, which pairs withreused_bytes. The counts line is now(… fetched, … linked, … skipped, … reused, … excluded, … failed)..decdn-partial/that belong to entries this run did not select, with their size. Nothing is deleted.#2198 — buyer pool rows carry
(chainId, payment_pool)Deploymentmoves todecdn-incentive(still re-exported fromchannel_store).BuyerPoolStatenow carries it, andis_oncompares both halves._v5with record schema 3, andchain_idis written beforepayment_pool. Existing rows are not read, so node and client re-adopt the live pool from chain.decdn fetchreuse/adopt/delegated paths andopen_poolall take theDeployment. The voucher domain is derived from it, so there is one source.foreign_chain_id/configured_chain_id.pool list --jsonandadmin_v1_poolsgainchain_id.Not in scope, and still untagged as before: the
run_openre-check,reclaim_once, the delegated lane read infetch.rs, andpool top-up/close/reclaim.Test plan
cargo clippy --workspace --all-targets -D warnings,cargo doc -D warnings,cargo fmt --check, the public-api snapshot, and nextest for incentive/client/cli/node/commoncargo clippy -p decdn-e2e --all-targets --features anvil-e2e -D warningscli_bundle_pull_range_dedup8/8 on the combined branch;node_pull_pool_redeploy+cli_fetch_topup6/6-vand a missing--exclude, check theresumedsplit, the glob warning and the leftover-partial lineCloses #2236
Closes #2198
Closes #2190
🤖 Generated with Claude Code