Repository navigation
fix(client,cli): name a run's untracked escrows on every end of the command - #2516
Merged
Merged
Conversation
…mmand The hold on a run's untracked topUp or openPool lived in RunFunding, which is per pass and is dropped with a fetch or a bundle entry. No end of the command read it. A Ctrl-C during the late-build drain printed "run the same command again", and a bundle give-up could exit 75, so a re-run escrowed again. The hold now lives on the command's UnconfirmedEscrows handle (UnconfirmedEscrows::untracked, UntrackedEscrow with its tx). name_unconfirmed_escrows names it on every end that does not already name its tx, and so does the second-Ctrl-C exit. A BundlePuller pull that holds one ends Stopped on the escrow. Closes #2511 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review follow-up for #2511. - The handle holds every untracked escrow, one per tx, not only the first: an openPool that passed its check before another escrow went untracked can go untracked too, and a dropped bundle entry left it unnamed. - The CLI names the hold through name_held_escrows(result, &handle), so a call site cannot forget it. A stop (Interrupted, GaveUp) never counts as naming an untracked escrow by its text, and the stop line names a carried topUp beside the attached escrows. - The bundle end is a pure pull_end, tested for every end. A give-up, a pool replacement or "funding needed" never stands for the escrow, and a folded second replacement no longer asks for a rerun. - BundlePuller::unconfirmed_escrows exposes the handle; EscrowUntracked::tx reads the tx; UntrackedEscrow is non_exhaustive outside test-util. - Renames: PendingEscrows -> UnreconciledEscrows, UntrackedEscrowHeld -> RefusedAfterUntracked, HeldEscrows -> Shared. - Docs and the CHANGELOG no longer scope the hold to one run, and no longer claim the pool commands hold one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Re-review follow-up for #2511. - pull_end folds every untracked escrow into one error with the oldest as its root, and adds "the pull stopped" only when the pull stopped. A completed pull that held two escrows read as stopped on the first one. - Tests cover a "funding needed" and a pool-replaced stop whose text names the escrow, which still stop on it. - The fetch `# Errors` doc states which escrows are not repeated, and UntrackedEscrow is plainly non_exhaustive. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
Shared retention and exit handling are consistent, with focused regression coverage and no unresolved blocking findings.
No open issues 🎉
What changed in this PR
Keeps untracked escrows on the command-wide handle so dropped fetches, bundle entries, and interrupts still report transactions requiring reconciliation.
Changes:
- Retains every untracked escrow and refuses later funding on the same handle.
- Reports held escrows on CLI exits and prevents unsafe bundle retry outcomes.
- Adds regression tests and updates public API documentation.
| File | Description |
|---|---|
| crates/client/tests/snapshots/public_api__public_api.snap | Records new public escrow APIs. |
| crates/client/src/funding/adoption_tests.rs | Tests retention across funding runs. |
| crates/client/src/funding.rs | Moves escrow retention to the shared handle. |
| crates/client/src/fault.rs | Updates refusal-type classification. |
| crates/client/src/buyer_pool/tests.rs | Tests deduplication and shared retention. |
| crates/client/src/buyer_pool.rs | Stores untracked transactions and exposes their details. |
| crates/client/src/bundle/engine/tests.rs | Tests outcomes with held escrows. |
| crates/client/src/bundle/engine.rs | Incorporates held escrows into pull outcomes. |
| crates/client/src/bundle.rs | Exposes the handle and documents outcomes. |
| crates/cli/src/commands/pool.rs | Uses the shared reporting helper. |
| crates/cli/src/commands/interrupt/tests.rs | Tests escrow messages and exit behavior. |
| crates/cli/src/commands/interrupt.rs | Reports pending and untracked escrows. |
| crates/cli/src/commands/fetch.rs | Reports held escrows when fetching ends. |
| crates/cli/src/commands/bundle_pull.rs | Reports held escrows when bundle pulling ends. |
| CHANGELOG.md | Documents command-wide retention and reporting. |
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. |
7 of 9 tasks
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
When a run's
topUporopenPoolmined and its local record failed (EscrowUntracked), the run refused later escrows (#2514). But the hold lived on the per-passRunFunding, which is dropped with a fetch, a bundle entry, or a pass, and no end of the command read it. A Ctrl-C during the 30 s drain of late lane builds printed "interrupted; run the same command again to resume". The receipt read had already removed the tx fromUnconfirmedEscrows, so nothing named it, and a re-run read the uncredited row and escrowed again. A bundle pull whose entry with the escrow was dropped could give up with exit 75 the same way.UnconfirmedEscrowskeeps one entry per tx (UnconfirmedEscrows::untracked, a newUntrackedEscrow { tx, text }).RunFunding::note_untrackedwrites to it, andrefuse_after_untrackedreads from it. So the hold outlives a dropped fetch, a dropped bundle entry and a pass, and every later pass on the handle refuses to escrow. It holds every escrow, not only the first: anopenPoolthat passed its check before another escrow went untracked can go untracked too.decdn get(a blob or a bundle) callsname_held_escrows(result, &handle)on every exit, so a call site cannot forget the hold.interrupted: <escrow>and exits 130.exit_lines).Interrupted,GaveUp) never counts as naming it by text, becausemainprints only the stop's own line.BundlePuller: the end of the pull is a purepull_end. A pull that is not interrupted endsBundleEnd::Stoppedwhile the handle holds an untracked escrow. The escrows are folded oldest first, and the pull's own stop is kept as text. A give-up, a pool replacement or "funding needed" never counts as already naming the escrow, so none of them can invite a rerun. An interrupted pull staysInterrupted. Its caller names the hold fromBundlePuller::unconfirmed_escrows, which this PR adds.EscrowUntracked::tx()is new.UntrackedEscrowis#[non_exhaustive].UnconfirmedEscrows::hold_untracked_for_testis new, behindtest-util.PendingEscrows→UnreconciledEscrows(cli)UntrackedEscrowHeld→RefusedAfterUntracked(crate-private)HeldEscrows→Shared(private)Closes #2511
Reviewer notes
UnconfirmedEscrowsandhold_untrackedincrates/client/src/buyer_pool.rsname_unconfirmed_escrowsandin_flightincrates/cli/src/commands/interrupt.rspull_endandinvites_rerunincrates/client/src/bundle/engine.rsLaneBuildFaulthides its inner error from a downcast. Every producer prints the full0x…hash, andsanitize_err_chainleaves it intact.RunFunding,UnconfirmedEscrowsorBundlePuller.decdn pool openanddecdn pool top-upbuild noRunFunding, so they hold nothing. Their own error names the tx.run_groupsandfirst_open, is still open. fix(client): a fatal lane build drops the rest of its batch, and an escrow in it goes unnamed #2508 and fix(client): the build drain starts a refill after the fetch ended #2513 are unchanged.buyer_pool/tests.rs: the handle holds each tx once, and a clone shares the hold.funding/adoption_tests.rs: the hold outlives itsRunFundingand refuses a later pass.bundle/engine/tests.rs:pull_endfor every end, including several escrows, a stop that names the tx, and a second pool replacement.cli interrupt/tests.rs: built on a real handle through thetest-utilhook.in_flight, the hold in the CLI and eachinvites_rerunarm in turn. Each change fails its test.pull_end's call site inPullCtx::run, which is a single line, andInterrupt::watch'sprocess::exit. Its lines come fromexit_lines, which is tested.Verification
cargo fmt -- --checkCARGO_BUILD_WARNINGS=deny cargo clippy --workspace --all-targets --all-features(run as-- -D warnings)cargo nextest run --workspace: 5117 passed. One retry,origin_range_pull offset_past_the_blob_is_rejected_before_delivery, which this PR does not touch.CARGO_BUILD_WARNINGS=deny cargo doc --workspace --no-deps --document-private-itemscargo nextest run -p decdn-client --features public-api-test --test public_api)contracts/changed: n/aCHANGELOG.mdentry added (and the fix(client): a lane build that drains after an untracked escrow can send a second topUp #2506 entry's scope updated)🤖 Generated with Claude Code