Skip to content

fix: exit lnurl screens whose payment data is gone - #1101

Merged
piotr-iohk merged 2 commits into
fix/lnurl-flow-state-1087from
fix/lnurl-missing-data-exit
Oct 22, 2026
Merged

piotr-iohk merged 2 commits into
fix/lnurl-flow-state-1087from
fix/lnurl-missing-data-exit

Conversation

@ovitrif

@ovitrif ovitrif commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Dependency: #1099

This PR closes the remaining gap in #1087 on top of #1099. When LNURL payment data is really gone, Send now leaves the LNURL screen instead of showing a dead amount screen or a blank confirmation. Reported by @ben-kaufman. @piotr-iohk, this targets your branch; merge it there if it looks right.

Description

  • SendSheet: when the current presentation shows lnurlPayAmount or lnurlPayConfirm with no lnurlPayData, it closes the sheet when the root is an LNURL route (a home-scanner LNURL, including after continuing to confirmation). Otherwise it pops back to the screen before the LNURL route. The issue asks that an unavailable flow exit safely and notes that a nil guard alone is not enough. With fix: preserve active LNURL payment state #1099 alone, the amount screen stays with a max of 0 and the confirmation renders nothing.
  • The exit skips a scan still being handled (AppViewModel.isHandlingScannedData, since handleScannedData resets send state before it sets the new data; the handling id is published, so the check re-runs once handling ends), a payment being submitted, and a presentation that is no longer current.
  • SendSheetLifecycleTests: a new test removes the data from a live confirmation and expects the sheet to close. The embedded test now sets the LNURL data before mounting embedded Send, as SubscriptionSheet does: it routes to .lnurlPayConfirm only once the data exists.

Out of Scope

Design

N/A — no UI changes.

Preview

N/A

QA Notes

Setup

Same as #1099.

Journeys

N/A — the exit fires only when the data is lost while an LNURL screen is shown, which no journey can trigger on demand. #1099's J1 still applies to the normal flow.

Manual Tests

N/A

Automated Checks

  • added SendSheetLifecycleTests.swift — a confirmation or amount screen whose LNURL data disappears closes its sheet.
  • updated SendSheetLifecycleTests.swift — embedded Send is mounted after its LNURL data is set, as in production.

Evidence

On fc2fad49 (unit-workflow selection) and a58030b1 (focused tests), iPhone 17 simulator, iOS 27:

Gaps

  • lnurl.e2e.ts was not run locally on this branch. CI's E2E runs on the PR.

Models used

  • Planning/scoping: claude-opus-5-5 (reasoning: low)
  • Implementation: claude-opus-5-5 (reasoning: low)
  • Review: Not performed

@ovitrif ovitrif added this to the 3.1.0 milestone Oct 22, 2026
@ovitrif ovitrif self-assigned this Oct 22, 2026
@ovitrif
ovitrif requested review from a team, ben-kaufman and pwltr and removed request for a team October 22, 2026 10:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T10:38:35.810698Z fc2fad4 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.

@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: fc2fad4926

ℹ️ 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".

Comment thread Bitkit/ViewModels/AppViewModel.swift
@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change is limited to Send's LNURL payment screens.

Fix the exit from an LNURL amount root before merging.

Findings

  1. P1 Unavailable amount screen stays open ▶

Summary

Adds an automatic exit when an LNURL amount or confirmation screen loses its payment data.

  • Send exits an LNURL screen when its payment data disappears.

Reviews (1) · Last reviewed commit: "fix: exit lnurl screens whose payment da..." · Reviewed by Greptile

Comment thread Bitkit/Views/Wallets/Send/SendSheet.swift Outdated
@ovitrif

ovitrif commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed a58030b1, addressing both bot threads:

  • An LNURL-rooted Send (a home-scanner LNURL) now closes when its data is gone, even after continuing from the amount screen to confirmation. Before, only the pushed confirmation was popped, which left a dead amount screen (Greptile thread).
  • AppViewModel.scannedDataHandlingId is now @Published, so the end of scan handling re-runs the missing-data check. This covers a failed scan that cleared the old data (Codex thread).
  • Added testMissingLnurlDataClosesAmountRootedPresentation.

SendSheetLifecycleTests, LnurlPayConfirmTests, SheetViewModelTests and ScannerManagerTests pass in 3 iterations on an iPhone 17 simulator (iOS 27).

@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. Sends an LNURL screen whose payment data is gone back to the screen before the LNURL route, or closes the sheet when an LNURL route is the root, skipping scans still being handled and payments being submitted. Reviewed a58030b1, full tier, stacked on #1099 (fix/lnurl-flow-state-1087), delta reviewed against that base.

What I checked, and 6 candidates I ruled out

Read in full: SendSheet.swift (body modifiers, cleanup, setUpSend, failure/retry routes, exitMissingLnurlPayment), LnurlPayAmount.swift, the LnurlPayConfirm.swift submit path, AppViewModel.handleScannedData / resetSendState, and the LNURL routing in PaymentNavigationHelper.swift and SubscriptionsView.swift.
Callers traced: every resetSendState() call site that can run while Send is up, and every producer of .lnurlPayAmount / .lnurlPayConfirm.
CI: SwiftFormat green; Run Tests still pending at review time. iOS does not build here, so this review is reasoned from the code and from CI.

Ruled out

  • Variable-amount flow left on a dead amount screen: at fc2fad49, a home-scanner variable LNURL (root .lnurlPayAmount, path [.lnurlPayConfirm]) losing its data popped to the root, which still has no data, and onChange does not fire again for true to true. a58030b1 checks currentRoot first and closes, and testMissingLnurlDataClosesAmountRootedPresentation covers it.
  • Exit during a rescan: handleScannedData clears send state before it sets the new data, but isHandlingScannedData holds the exit off, and since scannedDataHandlingId is now @Published the condition is re-evaluated when handling ends.
  • Exit while paying: LnurlPayConfirm sets isSubmittingPayment for the whole submit, so the data cannot disappear mid-payment and close the sheet.
  • Exit over a failure, pending or success screen: those routes are pushed on top (or replace the root in embedded Send), so navigationPath.last is not an LNURL route and nothing fires.
  • Embedded initial-subscription retry: retryEmbeddedInitialSubscriptionPayment resets send state across an await before the scan, but it runs from the failure route, which is not an LNURL route.
  • Stale sheet closing a newer one: the handler checks isCurrentPresentation, and the exit goes through hideSheetIfActive.

Cold reader: the run on the fc2fad49 candidate timed out with no verdict. The author's a58030b1 fixed that candidate anyway.

Merge confidence: 4/5, no findings, but Run Tests was still pending and the iOS change was not built here.

Reviewer model: claude-opus-5-5
Reasoning effort: Unknown (this session's run metadata does not expose the effort setting)

@piotr-iohk
piotr-iohk merged commit 550c402 into fix/lnurl-flow-state-1087 Oct 22, 2026
10 of 11 checks passed
@piotr-iohk
piotr-iohk deleted the fix/lnurl-missing-data-exit branch October 22, 2026 10:59
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.

3 participants