Repository navigation
Conversation
Verified: just compile, just lint, just test
Verified: just compile, just lint, just test
Verified: none (journey text only)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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)
|
Added the changelog fragment in 2a014e3. |
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
|
Linked #2018 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
left a comment
There was a problem hiding this comment.
Static review at 2a014e33c. Per the repo's policy for unvouched Android branches it was not built here; CI's build-and-test, lint and detekt are green at this head, and the e2e and compose-ui jobs were still pending when I read it.
The lock itself holds up. isLocked gates the top bar's Back and the inputs' onEvent. BackHandler blocks system back, and the sheet's dismissEnabled blocks both drag and scrim. DisposableEffect clears it on every exit: Pending, Success, Error, PIN, or another sheet replacing the send. The PIN and biometrics hand-offs keep the lock through shouldConfirmPay, and the 300 ms pre-swipe delay is covered because the idle timer restarts once isSendSwipeRunning flips. Moving the generation check ahead of getOrElse in confirmSparkUpdateQuote is right, and the new view model test covers it.
One inline point, on the scope of isSendSwipeRunning.
Not covered by a test: the 1 s idle release (SWIPE_IDLE_RELEASE) that frees a swipe which stopped early. The new compose test sets isLocked = true directly, so nothing asserts that the screen unlocks again.
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed
Verified: just compile, just lint, just test
Verified: just compile, just lint, just test
Verified: just compile, just lint, just test
@talosmachina Covered in ef71c45: the lock rule moved into |
|
Checked ef71c45: that closes the gap. 9214a34 also settles my inline point on the scope of I read this from the diff only, I did not build it here. |
jvsena42
left a comment
There was a problem hiding this comment.
Code scan of 9214a34: no HIGH or MEDIUM. The fee approved at the swipe still bounds what pays (confirmSparkUpdateQuote returns to Confirm on a higher fee, and updateSpendingBalanceIfNeeded fails with UpdateFeeUnseen). Edits are gated in the swipe's own composition, and onConfirmPay still refuses a second submission.
Four inline comments: two lock-outs reproduced with failing tests, one stall to time on device, and a journey nit. All are new in this PR, since master has no lock.
tests (both fail at 9214a34; with both inline fixes AppViewModelSendFlowTest 768/768, SendConfirmUpdateFeeTest 5/5)
diff --git a/app/src/test/java/to/bitkit/ui/screens/wallets/send/SendConfirmUpdateFeeTest.kt b/app/src/test/java/to/bitkit/ui/screens/wallets/send/SendConfirmUpdateFeeTest.kt
index 32999e7d0..0b43f0072 100644
--- a/app/src/test/java/to/bitkit/ui/screens/wallets/send/SendConfirmUpdateFeeTest.kt
+++ b/app/src/test/java/to/bitkit/ui/screens/wallets/send/SendConfirmUpdateFeeTest.kt
@@ -27,6 +27,7 @@ import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
import kotlin.time.Duration
+import kotlin.time.Duration.Companion.seconds
@RunWith(RobolectricTestRunner::class)
class SendConfirmUpdateFeeTest {
@@ -115,6 +116,43 @@ class SendConfirmUpdateFeeTest {
assertFalse(isLocked)
}
+ @Config(sdk = [34])
+ @Test
+ fun `VERIFY a pending pay confirmation with nothing running stays locked`() {
+ var isLocked = false
+ composeRule.setContent {
+ isLocked = rememberConfirmLock(
+ isLoading = true,
+ isSwipeRunning = false,
+ uiState = SendUiState(shouldConfirmPay = true),
+ )
+ }
+ advanceBy(5.seconds)
+
+ assertTrue(isLocked, "unlocked after 5 s")
+ }
+
+ @Config(sdk = [34])
+ @Test
+ fun `VERIFY a new run after the idle release locks from its first composition`() {
+ var isSwipeRunning by mutableStateOf(false)
+ val composed = mutableListOf<Pair<Boolean, Boolean>>()
+ composeRule.setContent {
+ val locked = rememberConfirmLock(isLoading = true, isSwipeRunning = isSwipeRunning, uiState = SendUiState())
+ composed += isSwipeRunning to locked
+ }
+ advanceBy(SWIPE_IDLE_RELEASE * 2)
+ assertEquals(false to false, composed.last(), "idle release did not fire")
+ val released = composed.size
+
+ composeRule.runOnUiThread { isSwipeRunning = true }
+ advanceBy(SWIPE_IDLE_RELEASE / 4)
+
+ val afterFlip = composed.drop(released)
+ assertTrue(afterFlip.isNotEmpty())
+ assertTrue(afterFlip.all { (running, locked) -> !running || locked }, "compositions after flip: $afterFlip")
+ }
+
private fun advanceBy(duration: Duration) {
composeRule.waitForIdle()
composeRule.mainClock.advanceTimeBy(duration.inWholeMilliseconds)
diff --git a/app/src/test/java/to/bitkit/viewmodels/AppViewModelSendFlowTest.kt b/app/src/test/java/to/bitkit/viewmodels/AppViewModelSendFlowTest.kt
index 53d69f283..ed284cefa 100644
--- a/app/src/test/java/to/bitkit/viewmodels/AppViewModelSendFlowTest.kt
+++ b/app/src/test/java/to/bitkit/viewmodels/AppViewModelSendFlowTest.kt
@@ -21815,6 +21815,26 @@ class AppViewModelSendFlowTest : BaseUnitTest() {
assertFalse(sut.isSendSwipeRunning.value)
}
+ @Test
+ fun `VERIFY a hardware confirm while the fee refreshes clears the pay confirmation`() = test {
+ setSendState(
+ SendUiState(
+ address = "bcrt1qverifyhardware",
+ amount = 60_000uL,
+ isAmountInputValid = true,
+ payMethod = SendMethod.ONCHAIN,
+ hardwareWalletId = "hardware-wallet",
+ onchainFeeUi = OnchainFeeUi(sats = 150, isLoading = true),
+ shouldConfirmPay = true,
+ ),
+ )
+
+ sut.setSendEvent(SendEvent.PayConfirmed)
+ advanceUntilIdle()
+
+ assertFalse(sut.sendUiState.value.shouldConfirmPay, "shouldConfirmPay stays true after the early return")
+ }
+
@Test
fun `a scan while the node starts decides on QuickPay once the channels are usable`() = test {
val bolt11 = "lnbcrt1quickpaystarting"
Device gate: LaunchedEffect).
Reviewer model: claude-fable-5-2 (primary), claude-opus-5-5 (verifier, coordinator)
Reasoning effort: Not exposed
Clear the pay confirmation when a hardware fee is still loading, lock a new run from its first composition, bound the update re-quote at 60 s, and note system back as Android-only in the journey. Verified: AppViewModelSendFlowTest and SendConfirmUpdateFeeTest pass; just compile, test and lint running
Route the payment's own update quote through the same 60 s bound and log a timeout. The lock UI test now checks the lock's own edit guard against an unlocked control. Verified: AppViewModelSendFlowTest and SendConfirmUpdateFeeTest pass
The biometrics prompt frees the lock like the PIN does, and closing it locks Confirm from the first frame until the payment starts. Verified: SendConfirmUpdateFeeTest passes
pwltr
left a comment
There was a problem hiding this comment.
Reviewed 9214a34. The normal swipe holds confirmation through the first spending-balance re-quote, and a result from that first quote is discarded after the send changes.
Low: The prepared-fee exception in SendConfirmScreen.kt:266 leaves Confirm dismissible even after the user swipes to accept the higher fee. System Back during the loading delay can silently cancel the send through SendSheet.kt:544. Keep Back available while the user is deciding on the new fee, and apply the lock once they swipe again.
Low candidate: AppViewModel.kt:9563 can leave shouldConfirmPay set if a hardware fee refresh starts between the swipe and the confirmation event with PIN-for-payments off. The flag prevents the idle release at SendConfirmScreen.kt:262 even after the refresh completes. A flow-level trace is needed to establish a reachable refresh in that interval that leaves Confirm open.
Low candidate: After the idle release, SendConfirmScreen.kt:259–266 can render one unlocked composition when a swipe resumes, such as when the user accepts an amount warning after more than a second. Whether Back can dismiss the sheet during that interval still needs a timing trace.
Low candidate: The swipe lock has no app-level deadline while the spending-balance quote waits for Spark invoice creation or LDK fee estimation in MoveToSparkRepo.kt:204–235. A stalled call could leave the user unable to dismiss Confirm. The effective SDK deadline and recovery behavior still need to be established.
Pre-existing Low: The execution-time quote at AppViewModel.kt:8146 lacks the send ownership check used for the first quote. If a payment link replaces the send while it waits, a higher fee can appear on the replacement and reset Confirm (AppViewModel.kt:8148, AppViewModel.kt:8121). A quote failure can instead take the replacement to the payment error screen (AppViewModel.kt:8132).
Pre-existing Medium candidate: An ordinary on-chain swipe can resume from its fee check and set shouldConfirmPay on a different payment (AppViewModel.kt:6785–6791). This requires a payable Lightning link to replace the send during that check, with QuickPay and PIN-for-payments off. Confirmation can then submit the replacement without a new swipe. A controlled trace is needed to establish that the replacement can reach confirmation before the original fee check resumes.
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
jvsena42
left a comment
There was a problem hiding this comment.
Approving at 9214a3422: nothing above LOW after the code scan and the device gate. The four inline comments from the earlier review stand: two LOWs with failing tests and fixes, the stalled re-quote (now timed on device and kept LOW), and the journey nit.
Device gate (Gate_Throwaway emulator, local Spark stack from bitkit-docker's spark profile, devDebug arm64 PR build and base ddd0718a2 build):
- J1: pass. Confirm showed 48 955 with Instant ± ₿ 197 and Update fee ₿ 2. After "Yes, Send", a drag at +1.6 s and system Back at +2.3 s left Confirm open; Bitcoin Sent at +10.5 s. Activity shows Sent 49 152 and Move to Spark 29 600; the channel closed.
- M1, stalled re-quote: Confirm locked 60.5 s / 60.4 s with the SSP and proxy frozen, 18.7 s with the proxy only, then "Payment Failed". Base let Back leave at +11.7 s. Details on the inline thread.
- M2, PIN: cancel reset Confirm and Back left it, nothing paid. Success: drag at +1.4 s and Back at +1.9 s left Confirm open, paid once.
- M4, normal sends: Lightning 4 078 (drag dismissed the success sheet) and on-chain 20 000 (Back dismissed it): pass.
⚠️ M3, higher re-quote: not run. The move is one hop to the wallet's own peer, so the fee is always the 2-sat floor on this stack.⚠️ Pending-sheet dismiss and the LDK-sync stall of the fee estimate: not run.
Device gate: J1, M1, M2, M4 pass; LaunchedEffect).
Reviewer model: claude-fable-5-2 (primary, device runbook), claude-opus-5-5 (verifier, coordinator)
Reasoning effort: Not exposed (primary), medium (device runbook)
|
Out of scope for this PR, seen during the device gate at |
The prepared fee review stays leavable because it clears the swipe's loading; the swipe accepting it now locks Confirm like any other. Verified: SendConfirmUpdateFeeTest and AppViewModelSendFlowTest pass
The amount warning now keys the lock like biometrics, so closing it locks Confirm from the first frame. Tests cover the warning freeing the lock and a stalled update quote at payment time. Verified: SendConfirmUpdateFeeTest and AppViewModelSendFlowTest pass
pwltr
left a comment
There was a problem hiding this comment.
Reviewed 727505d.
Low candidate: Confirm can stay locked past 60 seconds on a payment that needs both LDK and Spark balances. Both re-quotes wait for an LDK routing estimate on a queue whose separate job keeps the caller waiting until the queued native work returns, even after the quote timeout expires. This applies to the preflight quote in AppViewModel.kt:8166 and the execution quote in AppViewModel.kt:8146, through ServiceQueue.kt:18 and LightningService.kt:1229. If LDK work stalls past the deadline, Back and sheet dismissal stay blocked. At the second quote, the stall also delays failure cleanup before any funds move or the invoice is sent. A stalled-queue test at either call site would establish the duration and recovery behavior.
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
A biometrics failure no longer clears loading before the PIN check, matching the direct PIN path, so Confirm stays locked when the PIN returns. Verified: just compile, test and lint running
Fixed in 47dc1a9: the review stays leavable because it clears the swipe's loading, and the swipe that accepts the new fee now locks Confirm. 649ec25 and a206cb0 also lock again from the first frame after the amount warning closes, and through a PIN fallback after biometrics fail.
Fixed in c30635f and 2b1c307, from the same points on the earlier review: the turned-down pay confirmation is cleared, a new run locks from its first composition, and both update quotes give up after 60 s with the payment error.
Out of scope: tracked in #2026, because both predate this PR and need a send-ownership check across the payment path. |
The LDK queue finishes its work after its caller is cancelled, so the 60 s bound now awaits the quote apart and stops waiting on time. The stalled-quote tests stall on work that ignores cancellation; both fail on the previous code. Verified: AppViewModelSendFlowTest passes; the two stalled-quote tests fail without the change
Fixed in 4eabbfa: both quotes are awaited apart from the LDK queue's work, so the swipe gives up at 60 s with the payment error even while that work keeps running. The two stalled-quote tests in |
A failure now resets the confirmation under the error screen, so Back, or a new invoice reusing that confirmation, no longer leaves the swipe spinning. Verified: SendErrorNavigationTest passes and fails without the change
An error over another screen leaves the confirmation's reset alone, so a PIN finished later keeps its payment locked. sendSession is volatile, since the swipe tracking reads it across threads. Verified: SendErrorNavigationTest passes
|
Added in 1dc1f0b and a452ade, a bug also on a452ade also makes |
Closes #2018
Twin: synonymdev/bitkit-ios#1418
Refs:
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, system back, dragging the sheet down and tapping the amount 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
AppViewModel.isSendSwipeRunningis true while the current send's swipe checks or the payment it confirmed still run, including the update quotes, which give up with the payment error after 60 s even while the LDK queue is stuck; closing or starting a send clears it. The screen frees itself once nothing runs for a swipe for a second, so a swipe that stops early never traps the user; the amount warning dialog, the biometrics prompt and the prepared fee review stay leavable while the user answers them, and closing one, or swiping to accept a new fee, locks it again. A pay confirmation the hardware fee check turns down is cleared, so it holds nothing.sendStateGeneration, bumped when the send sheet closes) now also drops the failure of an update quote for a send the user left, instead of showing its error on whatever is open next.master).Out of Scope
AppViewModel.showSheet: another sheet replacing an open send (a deeplink, a scan) doesn't bumpsendStateGeneration, so a re-quote in flight for that send can still go on. Bumping it there would also invalidate a new send prepared before its sheet transition; left as is.SendConfirmScreen: a swipe that stops early without a reset (for example coin selection failing) keeps its spinner, as onmaster; it no longer blocks leaving.AppViewModel: a link replacing a send while its swipe runs can take that swipe's quote result or pay confirmation; predates this PR, tracked in bug: a link replacing a send can take the old swipe's result #2026 (fix: keep confirm open until the swipe finishes #2017 (review)).master; tracked in bug: app crashes when the network drops during a payment #2027 (fix: keep confirm open until the swipe finishes #2017 (comment)).Design
N/A — no design available.
Preview
J1 at 2x: after "Yes, Send", system back and a drag down leave Confirm open while the swipe runs; the payment then completes.
rec-j1b2x.mp4
QA Notes
Setup
Dev build pointed at a local Spark regtest (spark-sdk regtest/local), QuickPay off, as in the journey's precondition: a wallet with an open channel to that stack's SSP Lightning node that can send about 30 000 sats and a Spark balance of about 30 000 sats, and a second wallet (or the stack's Lightning node) that can issue a 50 000-sat invoice.
Journeys
update-spending-balance-payment.xml— system back and dragging the sheet down leave the confirm screen open while the swipe runs — passed on9214a3422Manual Tests
N/A
Automated Checks
AppViewModelSendFlowTest.kt— the swipe keeps running while it quotes the update again, and stops once the new fee showsAppViewModelSendFlowTest.kt— a swipe of a closed send holds nothing, and its failing update quote shows no errorSendConfirmUpdateFeeTest.kt— the lock hides Back and blocks edits on its own, and an unlocked confirm takes editsSendConfirmUpdateFeeTest.kt— a swipe with nothing running for it frees the confirm after a secondAppViewModelSendFlowTest.kt— a hardware confirm while the fee refreshes clears the pay confirmationAppViewModelSendFlowTest.kt— a stalled update quote ends the swipe with the payment errorSendConfirmUpdateFeeTest.kt— a pending pay confirmation with nothing running stays lockedSendConfirmUpdateFeeTest.kt— a new run after the idle release locks from its first compositionSendConfirmUpdateFeeTest.kt— a closed biometrics prompt locks again from its first compositionSendConfirmUpdateFeeTest.kt— a swipe accepting a prepared fee locks the confirmSendConfirmUpdateFeeTest.kt— the amount warning frees the confirm while the user answers itAppViewModelSendFlowTest.kt— a stalled update quote at the payment ends it with the payment errorSendErrorNavigationTest.kt— Back from a failed swipe returns to a confirmation that takes a swipeEvidence
just compile,just lintandjust testpass at a452ade.J1 on a regtest emulator (Android 16, 896×1994 at 320 dpi) against the local Spark stack, on
9214a3422, built with the local backend and Spark settings:Gaps
None.
Models used
Claude Opus 5.5(reasoning:medium)Claude Opus 5.5(reasoning:medium)gemini-4-neon-high(reasoning:Not exposed)Metadata note: the review ran through Gemini Neon's CLI, whose record names the model but not a reasoning setting.