Skip to content

fix: drop setup sheets queued before app lock - #1433

Merged
ovitrif merged 4 commits into
masterfrom
fix/scanner-lock-check-sheets
Nov 26, 2026
Merged

ovitrif merged 4 commits into
masterfrom
fix/scanner-lock-check-sheets

Conversation

@jvsena42

@jvsena42 jvsena42 commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Fixes #1425

This PR drops a setup or approval sheet that a scan queued just before the app locked, so it no longer opens after unlock.

Description

  • Fixes BTCPay setup, LNURL login and Pubky login sheets opening after unlock when a scan queued them just before the lock. These sheets replace the open scanner or Send sheet after a 0.7 s delay, and nothing checked the lock when the delay ended. Each route now passes AppViewModel.lockCheck() to the sheet at the point it asks for it, and the sheet opens only if the app has not locked since.
  • Fixes a deep link's LNURL lookup ignoring a lock that lands during the lookup: the sheet's own check is taken when the route runs, after the lock. Deep links now take the lock check before the lookup and pass it through, so the lookup is dropped. A dropped deep link is gone with no toast; the user taps the link again.
  • Adds an optional isCurrent check to SheetViewModel.showSheet, read when a deferred replacement is due; other callers keep the default and behave as before.

Out of Scope

Design

N/A — no UI changes.

Preview

LNURL login scanned, app locked inside the 0.7 s sheet delay, unlocked: no login sheet (Dropped sheet lnurlAuth).

1433-login-lock.mp4

BTCPay setup, same steps: no BTCPay sheet.

1433-btcpay-lock.mp4

Deep link to a slow LNURL-withdraw, locked during the lookup: nothing opens after unlock.

1433-deeplink-lock.mp4

Regression: LNURL login without a lock opens its sheet.

1433-login-no-lock.mp4

QA Notes

Setup

  • Device build with a PIN enabled (Settings → Security → PIN), on local regtest with E2E_BUILD and the bitkit-docker lnurl-server (LNURL row of the Capabilities table in journeys/README.md), and a Spending balance so LNURL withdraw and login are allowed (Lightning running).
  • The lock has to land inside the 0.7 s between the scanner closing and the new sheet opening. Lock the phone with the side button right after the scan registers; repeat a few times if the sheet opened before the lock.

Journeys

N/A — not drivable; see Manual Tests.

Manual Tests

  • 1. Main scanner → scan an LNURL-withdraw QR → lock the phone before the withdraw sheet opens → unlock Bitkit → no withdraw sheet opens — locking within the sheet replacement delay not in Capabilities
  • 2. Main scanner → scan an LNURL-auth (login) QR → lock before the login sheet opens → unlock → no login sheet opens — locking within the sheet replacement delay not in Capabilities
  • 3. Main scanner → scan a BTCPay (SamRock) setup QR → lock before the BTCPay sheet opens → unlock → no BTCPay sheet opens — locking within the sheet replacement delay not in Capabilities
  • 4. Main scanner → scan a Pubky sign-in or sign-up QR → lock before the approval sheet opens → unlock → no approval sheet opens — locking within the sheet replacement delay not in Capabilities
  • 5. regression: Main scanner → scan each QR from 1–4 without locking → its sheet opens as before — camera QR scanning not in Capabilities
  • 6. Deep link to a slow LNURL-auth or LNURL-withdraw (xcrun simctl openurl or a tapped link) → lock during the lookup → unlock → nothing opens and no toast shows — delayed LNURL response and locking during the lookup not in Capabilities

Automated Checks

  • added ScannerManagerTests.swift — BTCPay setup and Pubky sign-up scans from the main scanner open their sheet without a lock, and not when the app locks before the replacement delay ends; the test clears and restores the stored Pubky session and secret key
  • added ScannerManagerTests.swift — a deep link lookup interrupted by a lock is dropped: no send state and no sheet
  • added ScannerManagerTests.swift — a deep link lookup that fails after a lock is dropped without its error
  • added ScannerManagerTests.swift — a deep link lookup that fails without a lock still reports its error
  • added SheetViewModelTests.swift — a deferred sheet replacement opens only if its isCurrent check still holds when due, and clears the replacing state either way

Evidence

  • At 9927815, iPhone 17e simulator (iOS 26.5): 87 targeted tests passed (ScannerManagerTests, SheetViewModelTests, ShopPaymentRequestTests, PubkyAuthURLSchemeTests). The new lock-failure test fails against the previous AppViewModel.swift. SwiftFormat lint clean. Full suite not rerun this round. The device run below is from f5bcf5b; the change since only affects a deep link lookup that fails after a lock.
  • Device run at f5bcf5b, iPhone 17 simulator (iOS 26.5), Debug build on staging regtest, local LNURL server answering after 10 s, PIN set. The QR codes were pasted (the simulator has no camera); the main scanner's paste and camera share handleScan. All six manual cases passed:
    • 1 (withdraw): lock 0.22 s after the route asked for its sheet; no Showing sheet lnurlWithdraw, no sheet after unlock. Withdraw goes through the payment-sheet path from feat: nfc and bluetooth nearby payments #1302, as listed in Out of Scope.
    • 2 (login): lock 0.08 s after; Dropped sheet lnurlAuth at unlock, no sheet.
    • 3 (BTCPay): lock 0.15 s after; Dropped sheet btcpayConnection, no sheet.
    • 4 (Pubky sign-up): lock 0.08 s after; Dropped sheet pubkyAuthApproval, no sheet.
    • 5 (regression, no lock): withdraw, login, BTCPay and Pubky sheets opened 0.72–0.73 s after the scanner closed; no Dropped lines.
    • 6 (deep link): LNURL-withdraw deep link, locked 4.6 s into the 10 s lookup; no sheet and no toast after unlock. LNURL login has no lookup (it is decoded locally), so withdraw was used.
    • Deep links without a lock still open: withdraw sheet right after the lookup, login sheet at once.
    • No crashes, stray toasts, stuck spinners or repeated requests in the logs.
  • At f5bcf5b, iPhone 17e simulator (iOS 26.5): the BitkitTests unit suite with the CI skips ran 4411 tests, 0 failures. With the lock check not passed into the deep link lookup, the new deep link test fails.
  • At b8fe678, iPhone 17e simulator (iOS 26.5): ScannerManagerTests and SheetViewModelTests 58/58 passed; the BitkitTests unit suite with the CI skips ran 4410 tests, 0 failures. SwiftFormat lint clean on changed files.
  • With AppViewModel.swift reverted to master, the new scanner test fails for both routes (the sheet opens after the lock).

Gaps

  • Manual cases were run on a simulator with pasted QR codes, not on a physical iPhone with the camera.
  • BitkitUITests were not run on this branch. On master (7fdf32e), on the same simulator, HomeHeaderUITests.testHeaderRowTapsOpenHeaderButtonsAndBalanceStillToggles, UsdtWalletUITests.testReceiveAndInvalidPaymentStaySeparateFromBitcoin, UsdtWalletUITests.testUnknownBalanceAndManualEntryUseConsistentAmountsInCommaRegion fail waiting for the wallet home after onboarding; they fail the same way on fix: tie the scan lock to the scanner visit #1432's branch.
  • The MainNavView call to handleDeepLinkData has no test that fails if it is reverted (same view-wiring gap as fix: tie the scan lock to the scanner visit #1432's SendOptionsView); manual case 6 covers it.
  • LNURL login is not unit tested: the route requires a running Lightning node. It uses the same helper as the tested BTCPay and Pubky routes. LNURL withdraw has no new test; see Out of Scope.

Models used

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

Metadata note: the task brief came from a parent session whose model was not recorded here; this session's reasoning setting is not exposed in its run metadata.

🤖 Generated with Claude Code

A scan whose route opens a setup or approval sheet (BTCPay setup, LNURL
login, Pubky login) replaces the open scanner or Send sheet after the
replacement delay. If the app locked in that delay, the sheet opened after
unlock. These routes now pass the app lock check to the sheet, which opens
only if the app has not locked since the route asked for it.

Fixes #1425

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42 jvsena42 self-assigned this Nov 25, 2026
jvsena42 and others added 2 commits November 25, 2026 11:33
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A deep link's LNURL lookup ran without a lock check, so a lock during the
lookup let its sheet open after the unlock (the sheet's own check is taken
when the route runs, after the lock). The lock check is now taken before the
lookup and passed through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42
jvsena42 marked this pull request as ready for review November 25, 2026 16:32
@jvsena42
jvsena42 requested review from a team, ovitrif and piotr-iohk and removed request for a team November 25, 2026 16:32
@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect lock-aware scan sheets and deep-link routing in Bitkit.

The PR appears safe to merge, with non-blocking fixes for stale error toasts and test isolation.

Findings

  1. P2 Discarded links still show errors ▶
  2. P2 Saved identity breaks the test ▶

Summary

This PR drops setup and sign-in sheets queued before a PIN lock.

  • Scanned setup and sign-in sheets stay closed if Bitkit locks while they wait.
  • Deep links stop when a lock interrupts their data lookup.

Two non-blocking improvements remain: suppress failed lookups after a lock, and isolate the setup test's saved identity.

Acknowledged scope: jvsena42 explicitly deferred clipboard lookup checks and deep-link payment-sheet replacement checks to #1434, scanner-visit checks to #1432, and left LNURL-withdraw and immediate channel/node routes unchanged because their existing paths differ.

Reviews (1) · Last reviewed commit: "fix: drop a deep link lookup that outlas..." · Reviewed by Greptile

Comment thread Bitkit/ViewModels/AppViewModel.swift Resolved
Comment thread BitkitTests/ScannerManagerTests.swift Resolved

@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. Drops the BTCPay setup, LNURL login and Pubky approval sheets that a scan queued just before a PIN lock, by checking lockCheck() when the 0.7 s sheet replacement comes due, and drops a deep link whose LNURL lookup outlasts a lock. Reviewed f5bcf5b87, 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 in full: SheetViewModel.showSheet / hideSheetBeforePerforming / beginReplacement, AppViewModel lockCheck, noteAppLocked, handleScannedData, ensureScannedDataHandlingOwnership, the BTCPay, LNURL auth and Pubky approval handlers, retainDeepLink / routePendingDeepLinkIfReady, MainNavView.handleDeepLink, the lock site in AppScene (scene to background with PIN on).
Call sites traced: every handleScannedData caller (MainNavView clipboard and deep link, AppScene incoming request, Send sheet, manual entry, contacts, subscriptions, shop, PaymentNavigationHelper); every showSheet for .btcpayConnection, .lnurlAuth, .pubkyAuthApproval now goes through showScannedRouteSheet.
CI: lint is red, but the job is a SwiftFormat segfault (exit 139, no lint output), and the same head passed lint in run 45645420352. Run Tests was still pending at review time.

Ruled out

  • Lock during the decode reaching the new check: LNURL auth decodes, then ensureScannedDataHandlingOwnership runs isCurrentScan before the handler, and the BTCPay and Pubky handlers have no await before showScannedRouteSheet, so the check is taken with no lock window before it.
  • A dropped Pubky approval stranding a deep link held behind it: replacingSheetID is cleared before the new isCurrent guard, so isPubkyAuthApprovalShownOrPending flips false and MainNavView's onChange promotes deepLinkAfterPubkyAuth; the new SheetViewModel test asserts the cleared state on both branches.
  • A deep link retained while locked being dropped after unlock: handleDeepLinkData takes the check when the route runs, which is after the unlock that released it, so only a later lock drops it.
  • Silent drop of a deep link on lock: CancellationError returns without a toast in handleDeepLink; the body states that as the intended behaviour.
  • Immediate path skipping the check: with no sheet open the sheet is shown synchronously, so there is no window for a lock.
  • Other showSheet callers: the isCurrent default is { true }, so received-tx and the rest behave as before.

Not covered by a test, as the PR notes: the MainNavView switch to handleDeepLinkData.

Merge confidence: 4/5, lint is red on a tool crash rather than the change and Run Tests had not finished; the MainNavView wiring has no test.

Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (this reviewer's run metadata does not expose a reasoning setting)

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QA review

Scope: full PR diff against its merge base, at f5bcf5b8.

No new actionable code findings.

No actionable code findings introduced by this PR. Source analysis only: nothing was built or run in this review because iOS does not build on this Linux host.

  • Deferred sheet gate: SheetViewModel.showSheet checks isCurrent() only after it clears isReplacingSheet and replacingSheetID. A dropped Pubky approval therefore still releases isPubkyAuthApprovalShownOrPending, and a deep link held behind it is promoted once MainNavView remounts after unlock. Other callers keep the { true } default.
  • Scanned routes: BTCPay setup, LNURL login and both Pubky approval paths now go through showScannedRouteSheet. That guards every handleScannedData caller reaching them, not only the main scanner.
  • Deep links: handleDeepLinkData captures the lock generation before the lookup. MainNavView is unmounted behind the PIN screen and noteAppLocked runs only on backgrounding, so links retained while locked route after unlock with a current check and are not dropped. Cancellation is caught silently in handleDeepLink.

Existing concerns (not counted as PR defects)

  • Greptile: discarded links still show errors (open, no reply). Verified at this head: if the deep-link lookup throws a non-cancellation error after a lock, MainNavView.handleDeepLink's generic catch still shows the decoding-error toast, because the lock check lives inside handleDeepLinkData. The scanner path suppresses this with guard isCurrent() at ScannerManager.swift:172. The base toasted in the same case, so this is pre-existing rather than introduced. It is narrower than the PR description's "dropped deep link is gone with no toast".
  • Greptile: saved identity breaks the test (open). The new test asserts no stored Pubky identity as a precondition, the same pattern as ShopPaymentRequestTests and PubkyProfileManagerTests. A leftover key fails it loudly rather than letting it pass falsely. Not promoted.
  • The clipboard lookup and the deep-link payment-sheet replacement are still unguarded. The author tracks this in #1434.

Android comparison
Source only, scoped to this flow, at bitkit-android 2d3b1a45 (default-branch HEAD at review time). showSheet re-checks canPresent after its transition delay, and scans record lockGeneration at start (scanCrossedLock), so the intent is comparable. Visual and runtime equivalence was not established.

Validation

  • I inspected the new unit tests (SheetViewModel gate; BTCPay and Pubky scans with and without a lock; deep-link lookup resumed after a lock) but did not run them. The author reports 4411 unit tests passing at f5bcf5b.
  • The MainNavView wiring and LNURL login have no failing-if-reverted test, as the author acknowledges.
  • SwiftFormat at this head: one run passed; a later run crashed with a segfault (exit 139) before producing lint output.

Recommended before device testing: wait for Run Tests, Run Integration Tests and build-local at f5bcf5b, which were still in progress at review time, and re-run SwiftFormat to clear the crashed job.

Device testing: not performed in this review.

Suggested additional test cases

  • iOS, PIN enabled, Paykit UI enabled, no Pubky identity. With the scanner open, open a Pubky sign-up deep link and then a second payment deep link, and lock inside the 0.7 s replacement window. Expected after unlock: no approval sheet, and the held second link routes normally rather than staying stuck.
  • iOS, PIN enabled, local LNURL server set to fail (e.g. HTTP 500) after about 10 s. Open an LNURL-withdraw deep link, lock during the lookup, then unlock. Observe whether a decoding-error toast appears, and confirm with the author whether that matches the intended "no toast" behaviour for dropped deep links.

Reviewer model: claude-opus-5-5
Reasoning effort: high

A deep link lookup that failed after the app locked still surfaced its error,
so a stale toast showed after the unlock. The wrapper now turns any error
after a lock into a cancellation. The setup-sheet test also clears and
restores the Pubky session and secret key, which count as a stored identity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42
jvsena42 requested review from a team and piotr-iohk and removed request for a team November 25, 2026 17:16

@ovi-reviewer ovi-reviewer 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.

Verdict: ⚠️ Not verified — validation incomplete at f5bcf5b; the PR moved during the run.

The PR moved to 9927815 after this run; these results are for f5bcf5b.

Findings: No new findings. The failed-lookup error path at Bitkit/ViewModels/AppViewModel.swift:1312 is already covered by Greptile's finding; code inspection confirms it at f5bcf5b, with no additional device evidence.

QA for f5bcf5b:

Unit suite including scanner and sheet lock checks ⏭️ Incomplete: two scanner checks passed, but the suite did not finish.

The app and test targets built. XCTest passed testDeepLinkLookupFromBeforeALockIsDropped and testSetupSheetQueuedBeforeALockDoesNotOpenAfterIt. The run then stalled in the existing SendSheetLifecycleTests.testScannerReplacementPreservesLnurlConfirmation; testReplacementSheetOpensOnlyWhileItsRouteIsCurrent was not reached. The iOS 26.5 retry did not launch the test host. Simulator recovery was still incomplete when the head moved.

A failed lookup after lock ends silently ⏭️ Not driven: simulator recovery was incomplete when the head moved.

Additional failure-response variant of manual case 6, requested in the QA review. The controlled endpoint was prepared, but no runtime result is claimed.

A held payment link resumes after a dropped Pubky approval ⏭️ Not driven: simulator recovery was incomplete when the head moved.

The QA review requested this additional case; it remains unverified.

Not re-driven: manual cases 1–6, relying on the author's same-head evidence using pasted QR codes. No physical-camera coverage was added.

Changed Swift files pass SwiftFormat 0.64.6 on macOS. The Linux CI formatter run crashed with a segmentation fault before reporting a violation.

Full six-file diff reviewed. Own runtime coverage is limited to the partial unit run; setup-sheet and successful lookup device behavior relies on the author's report. No Android twin is linked.


Reviewed by gpt-6.1-sol-high

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QA review

Scope: changes since f5bcf5b8, including affected code paths and prior findings, at 99278154. Baseline: previous QA review. The deferred sheet gate in SheetViewModel, the showScannedRouteSheet routing for BTCPay setup, LNURL login and Pubky approval, the MainNavView deep-link wiring and the changelog fragment are unchanged since the baseline, so their coverage is inherited.

No new actionable code findings.

No new actionable code findings in the follow-up. Source analysis only: nothing was built or run in this review.

  • Deep-link lookup error after a lock: handleDeepLinkData now catches errors from handleScannedData. When the lock check captured before the lookup no longer holds, it throws CancellationError instead. MainNavView.handleDeepLink already returns silently on CancellationError, so a lookup that fails after the app locked no longer shows the decoding-error toast after unlock. Errors from lookups that did not cross a lock are still rethrown to the existing toast path. handleDeepLinkData is only called from MainNavView.handleDeepLink. The two new tests cover both branches: a lookup resumed with an error after noteAppLocked() ends in CancellationError with no sheet open, and a failing lookup without a lock keeps its original error.
  • Setup-sheet test isolation: the test now saves, clears and restores .paykitSession and .pubkySecretKey before it asserts that no Pubky identity is stored. That clears the identity precondition the sign-up route depends on.

Prior concerns reconciled

  • Greptile: discarded links still show errors: the thread is marked resolved, and the fix is confirmed in source at this head as described above. The baseline listed this as an existing concern; it no longer applies.
  • Greptile: saved identity breaks the test: the thread is marked resolved, and the fix is confirmed in source at this head.
  • The clipboard lookup and the deep-link payment-sheet replacement are still unguarded. The author tracks this separately in #1434, and this delta does not touch it.

Validation and limitations

  • I read the new and changed unit tests but did not run them. At review time, Run Tests, Run Integration Tests and e2e-tests-local were pending for this head and SwiftFormat passed.
  • I did not re-compare Android for this delta. The baseline's source comparison covered the lock-gating intent for this flow.

Recommended before device testing: wait for Run Tests and Run Integration Tests to finish at 9927815.

Device testing: not performed in this review.

Suggested additional test cases

  • iOS, PIN enabled, a local LNURL server set to fail (for example HTTP 500) after about 10 s. Open an LNURL-withdraw deep link, lock the app during the lookup, then unlock. Expected: no decoding-error toast and no sheet. Repeat without locking: the decoding-error toast appears.

Reviewer model: claude-opus-5-5
Reasoning effort: high

@ovi-reviewer ovi-reviewer 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.

Verdict: ✅ Approve

Findings: No new findings. Verified the fixes for the stale lookup error and setup-test identity state.

QA for 9927815:

iPhone 17 Pro simulator, iOS 27.0, Debug regtest. The error-response cases use the unmodified head; the held-link case uses the timing hook below.

A failed lookup without locking shows its error ✅ The failed LNURL lookup showed “Decoding Error.”

The controlled endpoint confirmed receipt and release of the failing response. No payment sheet opened.

failed-unlocked.2x.mp4

A failed lookup after locking ends silently ✅ Releasing the failure after PIN unlock left Home open without an error or sheet.

The lookup began before backgrounding. Response timing was checked in the endpoint log.

failed-locked.2x.mp4

A held payment link resumes after a dropped Pubky approval ✅ After unlocking, the held Bitcoin request produced its normal “Insufficient Savings” response.

On 9927815 plus the timing hook, a pasted Pubky sign-up queued its approval and a Bitcoin deep link arrived while it was pending. The app log confirmed the approval was dropped after the PIN lock; after unlock, the held request showed “Insufficient Savings” on the empty wallet.

held-payment.2x.mp4

Temporary timing hook

Not pushed: holds only the deferred Pubky callback until an explicit file release after the app reports background, preserving the existing cleanup and lock check. Queue release was verified with controlled timing; the original 0.7-second window relies on the author's earlier device evidence.

diff --git a/Bitkit/ViewModels/SheetViewModel.swift b/Bitkit/ViewModels/SheetViewModel.swift
index 183de5042..7cf816363 100644
--- a/Bitkit/ViewModels/SheetViewModel.swift
+++ b/Bitkit/ViewModels/SheetViewModel.swift
@@ -97,23 +97,25 @@ class SheetViewModel: ObservableObject {
 
             DispatchQueue.main.asyncAfter(deadline: .now() + Self.replacementDelaySeconds) { [weak self] in
                 guard let self else { return }
-                isReplacingSheet = false
-                if replacingSheetID == id {
-                    replacingSheetID = nil
+                qaHoldPubkyReplacement(id) { // test hook
+                self.isReplacingSheet = false
+                if self.replacingSheetID == id {
+                    self.replacingSheetID = nil
                 }
-                guard pendingReplacements.remove(replacement) != nil else { return }
+                guard self.pendingReplacements.remove(replacement) != nil else { return }
                 guard isCurrent() else {
                     Logger.debug("Dropped sheet \(id.rawValue): its route is no longer current", context: "SheetViewModel")
                     return
                 }
                 Logger.debug("Showing sheet \(id.rawValue) after delay", context: "SheetViewModel")
-                activeSheetConfiguration = SheetConfiguration(id: id, data: data)
-                playHaptics(for: id)
+                self.activeSheetConfiguration = SheetConfiguration(id: id, data: data)
+                self.playHaptics(for: id)
 
                 // Notify timed sheet manager
                 Task { @MainActor in
                     TimedSheetManager.shared.onSheetShown()
                 }
+                } // test hook
             }
         } else {
             isReplacingSheet = false
@@ -129,6 +131,19 @@ class SheetViewModel: ObservableObject {
         }
     }
 
+    private func qaHoldPubkyReplacement(_ id: SheetID, perform: @escaping () -> Void) { // test hook
+        #if DEBUG // test hook
+        if id == .pubkyAuthApproval, ProcessInfo.processInfo.environment["QA_HOLD_PUBKY"] == "1", // test hook
+           !FileManager.default.fileExists(atPath: Env.appStorageUrl.appendingPathComponent("qa-release-approval").path) { // test hook
+            DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { [weak self] in // test hook
+                self?.qaHoldPubkyReplacement(id, perform: perform) // test hook
+            } // test hook
+            return // test hook
+        } // test hook
+        #endif // test hook
+        perform() // test hook
+    } // test hook
+
     func hideSheet(reason: String? = nil, file: String = #file, function: String = #function, line: Int = #line) {
         if let config = activeSheetConfiguration {
             if !isReplacingSheet {

Not re-driven:

  • Manual cases 1–5 and the successful-response variant of case 6: the author's passing device report at f5bcf5b covers those unchanged paths.
  • Focused checks at 9927815: the author's report covers the added error branches and setup-test isolation.
  • Physical-camera coverage: the device reports use pasted QR contents on a simulator.

Reviewed the two-file delta f5bcf5b..9927815 plus prior findings. Device checks cover the remaining cases requested in the QA review; the test-key restoration was checked in source and relies on the author's focused test report.

Android twin: none linked; cross-platform behavior was not re-tested.


Reviewed by gpt-6.1-sol-high

@ovitrif ovitrif left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

utAck

@ovitrif

ovitrif commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

@jvsena42 Merged, as it was approved and green.

@ovitrif
ovitrif merged commit edce3cd into master Nov 26, 2026
22 of 23 checks passed
@ovitrif
ovitrif deleted the fix/scanner-lock-check-sheets branch November 26, 2026 11:47
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.

Scanner: a setup sheet queued before the app locks opens after unlock

4 participants