Skip to content

fix: keep confirm open until the swipe finishes - #1418

Merged
ovitrif merged 7 commits into
masterfrom
fix/lock-confirm-swipe
Nov 25, 2026
Merged

ovitrif merged 7 commits into
masterfrom
fix/lock-confirm-swipe

Conversation

@ovitrif

@ovitrif ovitrif commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1419

Twin: synonymdev/bitkit-android#2017
Refs: #1373

After the confirm swipe, a payment that needs the spending balance update quotes the update fee again before it moves anything, which takes a second or two. The confirm screen stayed fully interactive meanwhile: Back, swipe back, dragging the sheet down and tapping the amount or fee all worked, so a swipe the user made could be undone silently by leaving. This PR locks the confirm screen from the swipe until it moves on to the payment or returns to confirm (new fee, failure), on the update path and the normal path alike.

Description

  • Lock Send Confirm and LNURL Confirm while a swipe, an automatic payment or the payment it started runs: the swipe keeps its loading state, Back is hidden, swipe back and dragging the sheet down do nothing, and the amount, fee, source, tags and LNURL comment can't be edited.
  • The lock is scoped to the confirm screen on view: once the payment moves on (PIN, Pending, Success, Failure), that screen keeps its own rules, and returning to Confirm while the swipe still runs locks it again.
  • Swipe back and the send sheet count the confirm screens holding them, so a confirm leaving never frees one that took over; the subscription sheet embedding the send flow keeps its drag off too.
  • The per-visit guard from feat: update spending balance modal #1373 (ConfirmScreenVisit) stays as a safety net for a quote finishing after the user left.

Out of Scope

Design

N/A — no design available.

Preview

J1 at 2x: after "Yes, Send", a drag down while the swipe loads pulls the sheet partway and it snaps back to Confirm.

rec-j1c2x.mp4

QA Notes

Setup

Debug build (regtest) pointed at a local Spark regtest stack from synonymdev/bitkit-docker (docs/spark-regtest.md): E2E_BUILD with E2E_BACKEND=local, E2E_LOCAL_HOST=127.0.0.1, SPARK_LOCAL_CONFIG_B64 from the docs and SPARK_LOCAL_CHAIN_URL set to the stack's chain API. QuickPay off, a new wallet with savings, a ~32 000-sat channel to the stack's SSP Lightning node, about 30 000 sats on Spark, and a 50 000-sat invoice from another node on the stack.

Journeys

  • J1: updated update-spending-balance-payment.xml — dragging the sheet down leaves the confirm screen open while the swipe runs — lock passed on c0e048511; the 50 000 payment itself failed on Spark (see Gaps)

Manual Tests

N/A

Automated Checks

  • added SendConfirmationSwipeTests.swift — a running swipe holds Confirm until it moves on or returns, a swipe that stopped while the PIN covered Confirm leaves it free, a running payment holds a rebuilt Confirm
  • added SendConfirmationSwipeTests.swift — a confirm leaving keeps the next confirm's hold

Evidence

The unit suite passes at c0e0485; later commits change only the journey text and the changelog.

J1 on a regtest simulator (iPhone 17 Pro, 804×1748) against the local Spark stack, on c0e048511:

  • Wallet: savings, a 45 000-sat channel to the SSP node and Spark funds, so 50 000 needed both.
  • Confirm showed 50 000 with its details open, "Instant (± ₿ 202)" and "Update fee ₿ 2", with no "up to" and no Route row. The over-half-balance dialog showed; "Yes, Send".
  • While the swipe loaded, a drag down moved the sheet partway and it snapped back to Confirm; no Back button showed. The swipe then moved 42 602 sats to Spark and closed the emptied channel.
  • The same drag on a Confirm with no swipe running dismissed the sheet.
  • A 75 000-sat run reached "Bitcoin Sent ₿ 75 000", with "Move to Spark −29 602" and "Sent −75 302" in Activity and the channel closed.

Gaps

  • J1 at 50 000: after the move, Spark failed the payment with "Failed to select leaves" (the same failure seen on the Android twin's first try), so "Payment Failed" showed and the funds stayed in Spark. That failure comes from the combined payment, not from this change.
  • J1 opens Confirm from a lightning: link, so Confirm is the sheet's root with no Back or swipe back to try; Back hiding and swipe back on a pushed Confirm (reached from Amount) were not device-tested.
  • The "Are You Sure?" dialog's "Yes, Send" has no DialogConfirm accessibility id on iOS, which the journey names.

Models used

  • Planning/scoping: Claude Opus 5.5 (reasoning: medium)
  • Implementation: Claude Opus 5.5 (reasoning: medium)
  • Review: gemini-4-neon-high (reasoning: Not exposed)
  • Review rounds: 5

Metadata note: the review ran through Gemini Neon's CLI, whose record names the model but not a reasoning setting.

A swipe on Confirm, such as one that first updates the spending
balance, now holds the screen until it moves on or returns to
Confirm: no Back, no swipe back, no sheet drag and no edits.
The per-visit guard stays as a safety net.

Verified: none (unit suite runs next)
The confirm's swipe-back hold gets its own flag, so the PIN and
Pending screens keep their own setting. A payment still running
holds a rebuilt Confirm, and the subscription sheet embedding the
send flow keeps its drag off too.

Verified: none (unit suite runs next)
Confirm applies its hold directly on appear and disappear, since a
screen covered by the PIN may see no change in between.

Verified: none (unit suite runs next)
A confirm leaving no longer clears a hold the next confirm already
took, such as an LNURL confirm paying on its own.

Verified: none (unit suite runs next)
The lock is an observable object that reports each change at once,
not on the next redraw, which a screen covered by the PIN may skip.
Swipe back and the sheet count their holders, so one confirm
leaving never frees another, and automatic payments hold too.

Verified: none (unit suite runs next)
A confirm opened from a lightning: link is the sheet's root, with no Back or swipe back to try, so the journey drags the sheet only.

Verified: J1 on a regtest simulator at c0e0485 (journey text only)
@ovitrif ovitrif added this to the 3.2.0 milestone Nov 24, 2026
@ovitrif ovitrif self-assigned this Nov 24, 2026
@ovitrif
ovitrif requested review from jvsena42 and pwltr November 24, 2026 23:11
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T23:13:22.061034Z 4fa8a72 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Verified: none (changelog only)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fa8a721ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Keeps Send Confirm and LNURL Confirm locked while a swipe or its payment runs.

  • Send Confirm and LNURL Confirm stay locked while their payment runs.

Acknowledged scope: ovitrif explicitly deferred blocking assistive-technology access to controls in SendConfirmationView; this review does not report that known limitation.

Checks were based on source inspection. No simulator tests or visual captures were run; this Linux environment cannot run the iOS UI.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Confirm appears] --> B{Swipe or payment running?}
  B -->|Yes| C[Hold Back, sheet drag, and edits]
  B -->|No| D[Confirm stays editable]
  C --> E{What happens next?}
  E -->|Confirm leaves view| F[Release this screen's hold]
  E -->|Work ends on Confirm| D
  F -->|Return to Confirm| B
Loading

Reviews (1) · Last reviewed commit: "test: drag only on a confirm opened from..." · Reviewed by Greptile

@ovitrif ovitrif removed this from the 3.2.0 milestone Nov 24, 2026
@ovitrif

ovitrif commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

Linked #1419 as the 3.2.0 tracking issue for this PR and moved the milestone from this PR to that issue, since the release milestone tracks issues.

@talosmachina talosmachina 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.

No findings. Locks Send Confirm and LNURL Confirm (Back, swipe back, sheet drag, inputs) from the swipe until the payment moves on or returns to Confirm, with per-flow and global hold counters so a leaving confirm never frees the next one. Reviewed 535e5cf, full tier, static: iOS does not build on this reviewer's Linux host, so nothing was built or run here.

What I checked, and 6 candidates I ruled out

Read: ConfirmSwipeLock and confirmSwipeLock(_:), the swipe and automatic-payment entry points in SendConfirmationView.swift and LnurlPayConfirm.swift, submitPayment through performPayment / performSwapRoutedPayment / performServiceRoutedPayment, requestPinCheck / resolvePinCheck in SendSheet.swift, SubscriptionSheet's routes, MoveToSparkManager.updateQuote / updateSpendingBalanceIfNeeded, SwipeButton.
CI at review time: SwiftFormat, validate, build-local green; Run Tests, Run Integration Tests and e2e-tests-local still pending.

Ruled out

  • Hold leaked when the PIN covers Confirm: onDisappear drops visibility, and onAppear re-reads isSubmittingPayment and re-locks while runs > 0, so a missed onChange while covered cannot leave a stale hold.
  • Rebuilt Confirm appearing before the old one disappears: each lock reports only on its own isHolding edge, so the counters balance in either order (testALeavingConfirmKeepsTheNextConfirmsHold).
  • Warnings alert or biometric prompt blocked by allowsHitTesting(false): the alerts hang off confirmationContent outside the locked VStack and present separately; biometrics is system UI.
  • Subscription sheet stuck undismissable: isSendConfirmLocked only goes stale if SubscriptionSheet.route leaves .payment while the embedded flow holds, and no path writes route from inside the payment flow.
  • Automatic payment that falls back to manual confirmation staying locked: showManualConfirmation returns out of submitPayment, so the defer ends the run.
  • User trapped on Confirm by a hung quote: the lock has no timeout, so a Spark or LDK call that never returns would keep Back and the drag off; ruled out narrowly, since those calls fail rather than hang on a lost connection and the payment legs after them are bounded (sparkBalanceWait 60 s, sendWithTimeout to Pending).

Not exercised here: the embedded subscription sheet's drag and Back / swipe back on a pushed Confirm, which the PR's Gaps also lists as not device-tested.

Merge confidence: 4/5, no findings, but the unit and integration runs were still pending and the hung-quote candidate was ruled out narrowly.

Reviewer model: claude-opus-5-5
Reasoning effort: Unknown (the review session cannot read its own run settings)

@pwltr pwltr 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.

Reviewed 535e5cf.

Low: Send Confirm and LNURL Confirm can stay locked on the swipe spinner for roughly three minutes during a Spending balance update. If the channel move settles near its two-minute deadline and Spark is slow to show the balance, the app can wait roughly another minute before it reaches the recipient payment’s Pending path. During that wait the user can no longer dismiss Confirm to check Activity. Showing progress for the balance move would explain the wait while preserving the swipe. See SendConfirmationView.swift:2043, LnurlPayConfirm.swift:416, and MoveToSparkManager.swift:678-709.

Review details

Quick review
Model: Claude Opus 5.5
Reasoning effort: high

General review
Model: GPT-6.2 Sol
Reasoning effort: high

Combined review
Model: GPT-6.2 Sol
Reasoning effort: high

@ovitrif

ovitrif commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Low: Send Confirm and LNURL Confirm can stay locked on the swipe spinner for roughly three minutes during a Spending balance update.

@pwltr out of scope: tracked in #1421, because the wait is bounded by the move's deadlines and ends in the payment's Pending path, and showing the move's progress is new UI that fits better in its own change than on this approved fix.

@ovitrif

ovitrif commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Merging: approved on 535e5cf, CI green and every thread resolved; the progress follow-up is tracked in #1421.

@ovitrif
ovitrif merged commit 78ecf99 into master Nov 25, 2026
27 of 29 checks passed
@ovitrif
ovitrif deleted the fix/lock-confirm-swipe branch November 25, 2026 10:05
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.

bug: leaving confirm undoes a finished swipe

3 participants