Skip to content

feat(wallet): offer to finish a send whose asset lock is held - #1423

Open
romchornyi wants to merge 1 commit into
feat/external-send-screensfrom
feat/external-send-lock-held
Open

romchornyi wants to merge 1 commit into
feat/external-send-screensfrom
feat/external-send-lock-held

Conversation

@romchornyi

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Closes #1422. A Core → Platform address or Core → Shielded send whose Platform step failed after the asset lock was broadcast and recorded was reported as "Send in progress. It will finish on its own", but nothing finished it: only Rebroadcast in the transaction details resumes such a lock.

Stacked on #1409 (base feat/external-send-screens).

What was done?

  • SendOutcome.lockHeld(HeldAssetLock) (funding type, txid, vout): set only when the coordinator recorded the lock it built and the second step did not complete. .inFlight keeps meaning "submitted, result unknown".
  • New SwiftUI SendLockHeldSheet + SendLockHeldViewModel: "Transfer not finished — Your Dash is held for this transfer. Finish it now, or later from the transaction details."
    • Finish runs the same resume as Rebroadcast (AssetLockRecoveryService.retry, which asks for the PIN): completed → "Sent" toast; already spent / waiting for sync → the same info toasts Rebroadcast shows; PIN cancelled → the sheet stays; other error → a generic message, Finish can run again.
    • Close (or swipe down) ends the flow; both are disabled while Finish runs.
    • One DWLogger line per Finish: funding type, outcome, error type.
  • 4 new strings, in English in every locale.

Not covered: Core → Identity still reports .inFlight, because topUpIdentityWithFunding returns no outpoint to resume. No launch-time resume (waits for dashpay/platform#5824, the recipient recorded with the lock).

How Has This Been Tested?

  • ExternalSend unit tests: 653 green (642 before + 11 new: executor mapping, router destination, flow, Finish against a fake resume seam).
  • scripts/ci/check_test_target_membership.py and scripts/a11y_audit.py --check pass.
  • Maestro flow still to write (draft): a Debug fault switch stops the send after the lock; the sheet appears, Close ends the flow, Finish with PIN cancelled keeps the sheet, Finish completes with the "Sent" toast, a forced resume error shows the message.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • ADR (ADR-0001): to decide before review — this adds a fourth send outcome to the model of ADR-0040 (Proposed)
  • Nothing in this PR (files, commit messages, branch name, description, comments, attachments, linked issues) holds customer data, unfixed vulnerability detail, secrets, or step-by-step attack detail against keys, PIN or encryption; such content is left out and handled privately with the maintainers (ADR-0001, rule 2)

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 52824f3f-ae85-4576-9d98-25ff5a938818

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@romchornyi
romchornyi marked this pull request as ready for review November 14, 2026 01:48
@thepastaclaw

thepastaclaw commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🔍 Review in progress (commit 8e50d18) · live progress

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 1 + Phase 2

The lock-held outcome is wired coherently through the executor, router, flow, sheet, and existing recovery service. Static verification finds two blocking issues: the new ViewModel omits Combine despite using ObservableObject and Published, and the externally visible fourth outcome is not recorded in the ADR or feature documentation required by the repository rules. The production resumer is covered only through a fake in the new tests; the simulator test remains in progress, so no CI result is available yet.

🔴 2 blocking | 🟡 1 suggestion(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a cross-cutting behavioral change spanning send outcome handling, asset-lock recovery, SwiftUI flow state, localization, project configuration, and tests, but it does not directly alter the critical funds-movement implementation itself.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `DashWallet/Sources/UI/Payments/ExternalSend/Sending/SendLockHeldViewModel.swift`:
- [BLOCKING] DashWallet/Sources/UI/Payments/ExternalSend/Sending/SendLockHeldViewModel.swift:18: Import Combine for ObservableObject and Published
  This new source imports only Foundation but declares SendLockHeldViewModel as ObservableObject and uses @Published. Both symbols are provided by Combine, which Foundation does not re-export, so the app target cannot compile this file. Add the missing import before Foundation.
- [SUGGESTION] DashWallet/Sources/UI/Payments/ExternalSend/Sending/SendLockHeldViewModel.swift:28-31: Exercise the production lock-resume path
  The new ViewModel tests inject a fake HeldAssetLockResuming, so they do not verify that LiveHeldAssetLockResumer passes the captured outpoint into AssetLockRecoveryService.retry, that funding types 4 and 5 select the correct resume routes, or that the real recovery result and authorization behavior work with the persisted lock and recipient records. This is the new Finish action for a money-moving flow. Add a focused funded-wallet simulator or integration check covering Finish success, PIN cancellation, and recovery for the affected funding types.

In `DashWallet/Sources/UI/Payments/ExternalSend/Domain/SendOutcome.swift`:
- [BLOCKING] DashWallet/Sources/UI/Payments/ExternalSend/Domain/SendOutcome.swift:41-43: Record and document lockHeld as the fourth send outcome
  This change adds lockHeld as a fourth externally visible send outcome, but ADR-0040 still chooses exactly three outcomes and the external-send feature summary still describes only sent, not sent, and in progress. That is a cross-module payment-state contract change affecting the executor, router, flow, and UI. Under ADR-0001, the decision must be recorded in the same PR: revise the Proposed decision or add a superseding Proposed ADR, update docs/adr/README.md, and update the feature summary so it no longer claims that every post-source failure finishes on its own.
Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Track the Core-to-Identity held-lock recovery gap — The Core-to-Identity path still maps a post-lock failure from topUpIdentityWithFunding to inFlight, whose existing UI promises that the transfer will finish on its own. The new lock-held sheet cannot handle that route because the SDK call does not return an asset-lock outpoint; this is an adjacent pre-existing limitation rather than a regression in the changed routes, but the misleading state should not be left untracked.
    • Follow-up: Create or link a follow-up issue for Core-to-Identity held-lock recovery or an honest non-resuming result once the SDK exposes the required outpoint and recipient data.

// limitations under the License.
//

import Foundation

@thepastaclaw thepastaclaw Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Resolved at 5ce63dab; see the replies below.

🔴 Blocking: Import Combine for ObservableObject and Published

This new source imports only Foundation but declares SendLockHeldViewModel as ObservableObject and uses @published. Both symbols are provided by Combine, which Foundation does not re-export, so the app target cannot compile this file. Add the missing import before Foundation.

Suggested change
import Foundation
import Combine
import Foundation

source: gpt-6.1-sol (phase2-reviewer: general)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d868dff. The file now imports Combine, like the other External Send view models.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved (re-reviewed at 5ce63dab): SendLockHeldViewModel.swift now imports Combine before Foundation, providing the ObservableObject and Published declarations required by the app target.

Comment on lines +41 to +43
/// The money left the source into an asset lock that is recorded, and the Platform step did not finish: it stays
/// in the lock until the lock is resumed.
case lockHeld(HeldAssetLock)

@thepastaclaw thepastaclaw Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Resolved at 5ce63dab; see the replies below.

🔴 Blocking: Record and document lockHeld as the fourth send outcome

This change adds lockHeld as a fourth externally visible send outcome, but ADR-0040 still chooses exactly three outcomes and the external-send feature summary still describes only sent, not sent, and in progress. That is a cross-module payment-state contract change affecting the executor, router, flow, and UI. Under ADR-0001, the decision must be recorded in the same PR: revise the Proposed decision or add a superseding Proposed ADR, update docs/adr/README.md, and update the feature summary so it no longer claims that every post-source failure finishes on its own.

source: muse-spark-1.3-contributor (phase1-reviewer: general); gpt-6.1-sol (phase2-reviewer: general)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d868dff. ADR-0040 (still Proposed) now records the fourth outcome, lockHeld, and its Finish resume. The index row and the feature summary describe four outcomes and no longer say that every failure after the money left finishes on its own. The file name stays the same so existing links keep working.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved (re-reviewed at 5ce63dab): The original cross-module documentation omission is fixed: ADR-0040 now records lockHeld and its Finish behavior, the ADR index reflects the updated title, and the external-send feature summary describes all four outcomes. The remaining stale sentence is a narrower documentation inconsistency reported separately on this head.

Comment on lines +28 to +31
struct LiveHeldAssetLockResumer: HeldAssetLockResuming {
func resume(_ lock: HeldAssetLock) async throws -> AssetLockRecoveryService.Outcome {
try await AssetLockRecoveryService().retry(
fundingTypeRaw: lock.fundingTypeRaw, txidWire: lock.txidWire, vout: lock.vout)

@thepastaclaw thepastaclaw Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏭️ Deferred (maintainer decision; not blocking) at 5ce63dab; see the replies below.

🟡 Suggestion: Exercise the production lock-resume path

The new ViewModel tests inject a fake HeldAssetLockResuming, so they do not verify that LiveHeldAssetLockResumer passes the captured outpoint into AssetLockRecoveryService.retry, that funding types 4 and 5 select the correct resume routes, or that the real recovery result and authorization behavior work with the persisted lock and recipient records. This is the new Finish action for a money-moving flow. Add a focused funded-wallet simulator or integration check covering Finish success, PIN cancellation, and recovery for the affected funding types.

source: gpt-6.1-sol (phase2-reviewer: general)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partly fixed in d868dff: LiveHeldAssetLockResumer now takes its retry as a seam, and a test checks that it passes the held outpoint and funding type (4 and 5) to the retry. Deferred: Finish against a real build (success, PIN cancel, both funding types) will be a Maestro flow with a Debug fault switch after the lock, tracked in #1422.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deferred (re-reviewed at 5ce63dab): The new seam test verifies that LiveHeldAssetLockResumer forwards the held outpoint and funding types 4 and 5. The remaining funded-wallet Finish success and PIN-cancellation flow is a reasonable, tracked deferral to the Maestro work in #1422.

romchornyi added a commit that referenced this pull request Nov 15, 2026
…rt Combine

Review round 1 on #1423:
- ADR-0040 (Proposed) records the fourth outcome, lockHeld, and the index
  and feature summary no longer promise that every failure after the money
  left finishes on its own.
- SendLockHeldViewModel imports Combine.
- LiveHeldAssetLockResumer takes its retry as a seam; a test checks it
  passes the held outpoint and funding type (4 and 5) to the retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD-Published-From: bfd878ad49301f452978fc68c12b47292148716c
@romchornyi

Copy link
Copy Markdown
Contributor Author

On the out-of-scope note about Core → Identity: it is already tracked in #1422. That route still reports a held lock as in progress because the SDK call returns no outpoint. The outpoint will come from dashpay/platform#5928 (a held-lock delivery state), and after that the route moves to lockHeld.

@romchornyi
romchornyi force-pushed the feat/external-send-screens branch from 292b084 to b9cb7c9 Compare November 15, 2026 17:25
@romchornyi
romchornyi force-pushed the feat/external-send-lock-held branch from d868dff to 5ce63da Compare November 15, 2026 17:25

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

The exact head correctly implements the lockHeld outcome, carries the recorded lock through Finish, and documents the four-outcome external-send contract. Exact-head CI reports the simulator tests, accessibility audit, target-membership check, recovery check, workflow lint, and title validation passing; one internal contradiction remains in ADR-0040's decision paragraph.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a substantial but contained change to external-send outcome handling, recovery orchestration, SwiftUI flow, localization, and tests, but it does not itself alter consensus, cryptography, key handling, storage migrations, or the underlying funds-movement implementation.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `docs/adr/0040-report-three-send-outcomes-and-retry-only-when-nothing-left-the-source.md`:
- [SUGGESTION] docs/adr/0040-report-three-send-outcomes-and-retry-only-when-nothing-left-the-source.md:35: Update the ADR decision statement to include lockHeld
  The revised ADR records `lockHeld` in the paragraph below, but the main Decision statement still says that the executor reports one of three outcomes and that any doubt is reported as `inFlight`. This makes the architecture record internally contradictory: a recorded held lock is now intentionally distinct from an unknown submitted result and offers Finish rather than the in-progress behavior. Rewrite this sentence to describe the four outcomes and distinguish `lockHeld` from `inFlight`.

@@ -29,6 +34,12 @@ later adds a fourth outcome for Shielded → Identity.

**Chosen:** option 1, the executor reports one of three outcomes and only `notSent` offers Retry; any doubt is reported as `inFlight`. Balances update with a delay after SPV or Platform sync, so a balance check could miss a payment that already left; the three outcomes follow the SDK's own no-retry contract.

@thepastaclaw thepastaclaw Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Resolved at 75c8a203; see the replies below.

🟡 Suggestion: Update the ADR decision statement to include lockHeld

The revised ADR records lockHeld in the paragraph below, but the main Decision statement still says that the executor reports one of three outcomes and that any doubt is reported as inFlight. This makes the architecture record internally contradictory: a recorded held lock is now intentionally distinct from an unknown submitted result and offers Finish rather than the in-progress behavior. Rewrite this sentence to describe the four outcomes and distinguish lockHeld from inFlight.

source: gpt-6.1-sol (phase2-reviewer: general)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 75c8a20: the Decision statement now names the four outcomes and separates lockHeld (a recorded lock, Finish) from inFlight (submitted, outcome unknown).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved (re-reviewed at 75c8a203): The requested main Decision sentence now names all four outcomes and separates lockHeld from inFlight. A separate residual wording issue remains in the sentence's final “three outcomes” clause and is reported as a new documentation finding.

@romchornyi
romchornyi force-pushed the feat/external-send-screens branch from b9cb7c9 to d8c1480 Compare November 15, 2026 22:39
@romchornyi
romchornyi force-pushed the feat/external-send-lock-held branch from 5ce63da to 75c8a20 Compare November 15, 2026 22:39

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

The exact-head implementation correctly adds the held-lock outcome and Finish flow, and the reported CI checks for tests, target membership, accessibility, workflow lint, recovery, and title validation succeeded. Two documentation comments remain stale: ADR-0040 still refers to three outcomes in its final clause, and SendOutcome's contract comment does not describe the lockHeld/Finish case.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Follow-up candidates (optional) (1)

New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.

🟡 Suggestion: Update the SendOutcome contract comment for lockHeld
DashWallet/Sources/UI/Payments/ExternalSend/Domain/SendOutcome.swift:35-36

The type comment still describes only notSent and inFlight. The new lockHeld outcome is neither an in-progress unknown result nor a Retry case: it represents a recorded asset lock and offers Finish instead. Update the comment so callers and maintainers do not misclassify this payment state.

/// What happened to a send. Only `notSent` offers Retry and only `lockHeld` offers Finish; a submitted payment whose result is unknown is `inFlight` (ADR-0040).

source: muse-spark-1.3-contributor (phase1-reviewer: general)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a substantial, cross-cutting UI and send-flow change that alters recovery behavior for held asset locks and funds movement, but it does not itself change consensus, cryptography, key handling, or other critical-surface implementation criteria.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Code unchanged since the last final review (5ce63dab): 1 new suggestion(s) listed as follow-up candidates, not posted inline
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `docs/adr/0040-report-three-send-outcomes-and-retry-only-when-nothing-left-the-source.md`:
- [SUGGESTION] docs/adr/0040-report-three-send-outcomes-and-retry-only-when-nothing-left-the-source.md:35: Fix the stale “three outcomes” clause in the revised Decision
  The revised Decision statement now correctly names four outcomes and distinguishes lockHeld from inFlight, but the final clause still says “the three outcomes follow the SDK's own no-retry contract.” This leaves the ADR internally contradictory. Change that clause to refer to all four outcomes.

## Decision outcome

**Chosen:** option 1, the executor reports one of three outcomes and only `notSent` offers Retry; any doubt is reported as `inFlight`. Balances update with a delay after SPV or Platform sync, so a balance check could miss a payment that already left; the three outcomes follow the SDK's own no-retry contract.
**Chosen:** option 1, extended by the revision below to four outcomes: the executor reports `sent`, `notSent`, `inFlight` or `lockHeld`, and only `notSent` offers Retry. A doubt about a submitted payment is reported as `inFlight`; a recorded asset lock whose Platform step did not finish is `lockHeld`, which offers Finish instead. Balances update with a delay after SPV or Platform sync, so a balance check could miss a payment that already left; the three outcomes follow the SDK's own no-retry contract.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: Fix the stale “three outcomes” clause in the revised Decision

The revised Decision statement now correctly names four outcomes and distinguishes lockHeld from inFlight, but the final clause still says “the three outcomes follow the SDK's own no-retry contract.” This leaves the ADR internally contradictory. Change that clause to refer to all four outcomes.

source: muse-spark-1.3-contributor (phase1-reviewer: general)

@romchornyi
romchornyi force-pushed the feat/external-send-lock-held branch from 75c8a20 to dece9d2 Compare November 15, 2026 23:51
@romchornyi
romchornyi force-pushed the feat/external-send-screens branch 2 times, most recently from c26c74c to 9a03eec Compare November 16, 2026 00:16
@romchornyi
romchornyi force-pushed the feat/external-send-lock-held branch from dece9d2 to 462ca1a Compare November 16, 2026 00:16

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

The held-lock outcome is correctly modeled, routed through the existing authenticated recovery path, and covered by the reported passing unit, target-membership, and accessibility checks on the reviewed head. One documentation inconsistency remains in ADR-0040 and should be corrected for the decision record to match the four-outcome implementation.

🟡 1 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Still open from earlier rounds (1)

  • 🟡 Suggestion: Fix the stale “three outcomes” clause in the revised Decision — docs/adr/0040-report-three-send-outcomes-and-retry-only-when-nothing-left-the-source.md:35 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — This is a substantial but contained change to external-send flow, asset-lock recovery UI, routing, localization, and tests; although it resumes funds movement, the diff does not alter consensus, cryptography, signing, key handling, or coin selection.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `docs/adr/0040-report-three-send-outcomes-and-retry-only-when-nothing-left-the-source.md`:
- [SUGGESTION] docs/adr/0040-report-three-send-outcomes-and-retry-only-when-nothing-left-the-source.md:35: Fix the stale “three outcomes” clause in the revised Decision
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1423#discussion_r4580746639)

@romchornyi
romchornyi force-pushed the feat/external-send-screens branch from 9a03eec to fbc61e7 Compare November 16, 2026 11:52
@romchornyi
romchornyi force-pushed the feat/external-send-lock-held branch from 462ca1a to 998b237 Compare November 16, 2026 11:52
@romchornyi
romchornyi force-pushed the feat/external-send-screens branch from fbc61e7 to f2bed1b Compare November 16, 2026 12:19
@romchornyi
romchornyi force-pushed the feat/external-send-lock-held branch from 998b237 to ef21ed4 Compare November 16, 2026 12:19

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 1 + Phase 2

The implementation correctly adds the recorded-lock outcome and authenticated resume path, with the relevant routing, SwiftUI flow, target membership, and seam coverage present. Two documentation comments remain stale: ADR-0040 still refers to three outcomes, and the executor test contract still says three outcomes. The simulator test check is still in progress; no failed code check is present in the supplied CI snapshot.

🟡 2 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

1 finding(s) not shown inline (the lines are not part of this PR's diff)

🟡 Suggestion: Update the executor test contract comment to mention four outcomes
DashWalletTests/ExternalSend/ExternalSendExecutorTests.swift:25

This test suite now exercises .lockHeld, including executor mapping and held-lock routing, but its suite-level contract comment still says the executor has "one of three outcomes." Update the comment so it accurately describes the production contract covered by these tests.

/// the binding fee, broadcast only on `send`, one of four outcomes, one log line per outcome.

source: gpt-6.1-sol (phase2-reviewer: general)

Still open from earlier rounds (1)

  • 🟡 Suggestion: Fix the stale “three outcomes” clause in the revised Decision — docs/adr/0040-report-three-send-outcomes-and-retry-only-when-nothing-left-the-source.md:35 (thread)
Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The change is large and intricate and modifies funds-movement recovery in ExternalSendExecutor, ShieldedTransferCoordinator, and AssetLockRecoveryService integration, including when a previously broadcast asset lock is resumed.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `DashWalletTests/ExternalSend/ExternalSendExecutorTests.swift`:
- [SUGGESTION] DashWalletTests/ExternalSend/ExternalSendExecutorTests.swift:25: Update the executor test contract comment to mention four outcomes
  This test suite now exercises `.lockHeld`, including executor mapping and held-lock routing, but its suite-level contract comment still says the executor has "one of three outcomes." Update the comment so it accurately describes the production contract covered by these tests.

In `docs/adr/0040-report-three-send-outcomes-and-retry-only-when-nothing-left-the-source.md`:
- [SUGGESTION] docs/adr/0040-report-three-send-outcomes-and-retry-only-when-nothing-left-the-source.md:35: Fix the stale “three outcomes” clause in the revised Decision
  (carried; thread: https://github.com/dashpay/dashwallet-ios/pull/1423#discussion_r4580746639)

@romchornyi
romchornyi force-pushed the feat/external-send-lock-held branch from ef21ed4 to d4b9763 Compare November 16, 2026 14:07
@romchornyi
romchornyi force-pushed the feat/external-send-screens branch from f2bed1b to 95fb3a9 Compare November 16, 2026 14:07
@romchornyi
romchornyi force-pushed the feat/external-send-lock-held branch from d4b9763 to c505dca Compare November 16, 2026 15:04
@romchornyi
romchornyi force-pushed the feat/external-send-screens branch from 95fb3a9 to 5e20f78 Compare November 16, 2026 15:04
A Core to Platform or Core to Shielded send whose Platform step failed
after the asset lock was broadcast and recorded was reported as
inFlight, with the "It will finish on its own" Toast, but nothing
finished it: only Rebroadcast in the transaction details resumes the
lock.

The executor now reports such a send as lockHeld, carrying the lock's
outpoint and funding type. It opens its own sheet: "Your Dash is held
for this transfer. Finish it now, or later from the transaction
details." Finish runs the same resume as Rebroadcast
(AssetLockRecoveryService.retry, which asks for the PIN); Close leaves
the lock for the transaction details. inFlight keeps meaning submitted
with an unknown result. A Core to Identity send still reports inFlight:
its top-up call returns no outpoint to resume.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDD-Published-From: abcc8fadb9369590f2862c6e14f8926be8e593cf
@romchornyi
romchornyi force-pushed the feat/external-send-screens branch from 5e20f78 to e814f2a Compare November 16, 2026 15:08
@romchornyi
romchornyi force-pushed the feat/external-send-lock-held branch from c505dca to 8e50d18 Compare November 16, 2026 15:08

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants