Repository navigation
fix(client,cli)!: replacement reporting, drained-build lock waits, pool escrow tests (#2519, #2520, #2521) - #2524
Merged
Merged
Conversation
A blob `decdn get` read its pool replacement only from the pass error, so a late lane build's escrow folded over a `PoolReplaced` hid it, and no reclaim note named the closed pool. A second-pass replacement named only the first closed pool, for a blob or a bundle. `next_pass` now also reads `RecoveryGate::replaced` (pub, doc-hidden) and runs the rest again only on a `PoolReplaced` stop. `BundleOutcome::replaced` is a `Vec`, and the pull adds the gate's replacement after the second pass. Every closed pool gets one reclaim note. A blob fetch starts clear of a replacement the payer's gate carries from an earlier fetch, as a bundle pull does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… no lock (#2520) A `topUp` that lost its nonce was re-sent after its backoff even when the fetch ended meanwhile. A drained build also waited for `open_lock` and the run's `top_up_serial` before it checked `ended`, so a sibling holding either through its receipt wait kept it for the whole `BUILD_DRAIN`. `lock_unless_ended` races each lock against `ended`. `send_top_up` checks `ended` before every send and ends its backoff with the fetch, through a crate-private `top_up_unless_ended`; the public `top_up` keeps its signature. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… record write (#2521) Pull the escrow-and-record leg of `pool open` and `pool top-up` into `open_and_record` and `top_up_and_credit`, generic over the provider and taking a `&dyn BuyerPoolStore`, and drive each against `ScriptedRpc::mined` with a store that notes whether the handle names the tx during `record` / `add_deposit`. A change that calls `recorded()` before the write now fails both tests. `test_rpc::mined_receipt` lifts the client tests' receipt fixture so both crates share it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No blocking issues were identified in the targeted fixes, API updates, or regression coverage.
No open issues 🎉
What changed in this PR
Improves payment-recovery reporting and cancellation in deCDN’s client and CLI, with regression coverage for escrow tracking.
Changes:
- Reports every pool replacement, including second-pass replacements.
- Cancels drained lane builds during lock waits and top-up retry backoff.
- Tests that CLI escrow transactions remain tracked through local record writes.
| File | Description |
|---|---|
| crates/incentive/src/test_rpc.rs | Shares the mined-receipt fixture. |
| crates/client/tests/snapshots/public_api__public_api.snap | Records the replacement-list API change. |
| crates/client/src/source_set.rs | Documents build cancellation behavior. |
| crates/client/src/recovery.rs | Exposes replacement state for reporting. |
| crates/client/src/lanes.rs | Makes open-lock waits cancellable. |
| crates/client/src/funding/adoption_tests.rs | Tests cancellation during lock waits. |
| crates/client/src/funding.rs | Adds cancellation-aware funding locks. |
| crates/client/src/buyer_pool/tests.rs | Tests cancellation of top-up retries. |
| crates/client/src/buyer_pool.rs | Stops top-up retries after fetch completion. |
| crates/client/src/bundle/engine/tests.rs | Tests reporting multiple replacements. |
| crates/client/src/bundle/engine.rs | Collects replacements from both passes. |
| crates/client/src/bundle.rs | Returns replacements as a vector. |
| crates/cli/src/commands/pool/tests.rs | Tests escrow tracking during writes. |
| crates/cli/src/commands/pool.rs | Extracts escrow-and-record helpers. |
| crates/cli/src/commands/fetch/tests.rs | Tests replacement reporting and rerun limits. |
| crates/cli/src/commands/fetch.rs | Reports replacements and shares reclaim notes. |
| crates/cli/src/commands/bundle_pull.rs | Prints each replacement’s reclaim note. |
| CHANGELOG.md | Documents fixes and the breaking API change. |
Review effort: Balanced
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
…ups (#2519, #2520, #2521) #2519: the recovery gate keeps the list of every replacement its steps make (`RecoveryGate::replacements`, `BundlePuller::replacements`), which no pass or fetch clears. `decdn get` prints one reclaim note per closed pool from it as the command ends, however it ends: a Ctrl-C during a blob get, and a bundle get whose manifest fetch replaced the pool, named the closed pool nowhere. `BundleOutcome::replaced` is the pull's slice of the list. A replaced manifest fetch now says the new pool is current and the pull must run again, rather than that the remaining work runs again. A fetch starts clear of a carried replacement through `RecoveryGate::leave_carried`, shared by the blob and bundle paths. The comment no longer claims a gateway payer can carry one: it funds nothing. #2520: docs that still said a build inside its call runs to its receipt name the lock-wait and re-send refusals; a refill refused because its fetch ended logs that it was not sent. Tests cover the open-lock site in `build_multi_lane`, a lock wait that starts on a live token, and that the collision backoff ends with the fetch. #2521: tests cover the record-failure path of `pool open` and `pool top-up`: the escrow is held untracked on the handle. 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.
Follow-ups from the review of the #2508/#2513/#2515/#2517 batch (#2523). There is one commit per issue, then one commit of review follow-ups.
#2519: name every pool a replacement closed, on every exit
RecoveryGatekeeps a list of every replacement its steps make:RecoveryGate::replacementsandBundlePuller::replacements. No pass or fetch clears it.decdn getprints one reclaim note per closed pool from that list as the command ends, whatever the exit. That covers:get;getwhose manifest fetch replaced the pool.BundleOutcome::replacedis now aVec<PoolReplaced>, the pull's slice of the gate's list. Breaking for library users; the snapshot is regenerated.RecoveryGate::leave_carried. The blob and bundle paths share it.#2520: a drained lane build sends no topUp re-send and waits on no lock
lock_unless_endedracesopen_lock(inbuild_multi_lane) andtop_up_serial(inescrow_top_up) againstended. A drained build queued behind a sibling's receipt wait now ends at once withFetchEnded, instead of atBUILD_DRAIN.send_top_upchecksendedbefore every send and ends its nonce-collision backoff when the fetch ends. The token goes through a crate-privatetop_up_unless_ended. The publictop_upkeeps its signature, so node, CLI and e2e callers are untouched.#2521: pool open / pool top-up keep the escrow named during the record write
open_and_record/top_up_and_credit. The chain reads, theInterruptselect and the output stay where they were.ScriptedRpc::minedwith aWatchingStore, which notes whether the handle names the tx at each write. They cover:test_rpc::mined_receiptlifts the client tests' receipt fixture so both crates share it.Verification
cargo nextest run --workspace: 5175 passed.cargo clippy --workspace --all-targets --all-features -- -D warnings,CARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-items, the public-api snapshot andcargo fmt --check: all clean.Mutation-checked every new test. Each fails with its fix reverted:
open_lockas a plain waita_build_queued_on_the_open_lock_ends_with_its_fetchtop_up_serialas a plain waita_refill_queued_on_the_top_up_lock_ends_with_its_fetcha_lock_wait_ends_with_the_fetcha_collided_top_up_sends_no_re_send_after_the_fetch_endsrecorded()before the write, or a plain error on a failed recordpooltestsa_replaced_manifest_fetch_names_the_new_poolThe reclaim notes go to stderr from the CLI, so no unit test reads them. The gate tests pin the list they are printed from.
Closes #2519
Closes #2520
Closes #2521
🤖 Generated with Claude Code