Repository navigation
feat: spark transfer to savings and force transfer design - #1960
Conversation
Verified: just compile, just test, just lint (all pass)
Verified: just format, just compile, just test, just lint (all pass)
Verified: just compile, SparkExitViewModelTest, detekt (pass)
Verified: none (changelog 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. |
[Critical impact] The PR changes a user-facing path that moves Spark funds into Savings. The PR appears safe to merge, with non-blocking fixes needed for completed-screen formatting and retrying a failed externally funded start. FindingsSummaryUpdates Spark force transfer screens and adds automatic start after an external fee payment. Spark-only transfers to savings now skip the availability screen.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Transfer to savings] --> B{Only Spark funds?}
B -->|Yes| D[Review transfer]
B -->|No| C[Network fee and availability]
C --> D
E[Force transfer overview] --> F[Emergency fees]
F --> G{Who pays?}
G -->|Savings| H[Swipe to confirm]
G -->|Another wallet| I[Pay to confirm]
I -->|Fees arrive| J[Start force transfer]
H --> J
J --> K[Progress]
K --> L[Wallet overview]
Reviews (1) · Last reviewed commit: "fix: widen force transfer confirm table ..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3663ad1b8e
ℹ️ 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".
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
Verified: just format, compile, test, lint
Verified: just format, compile, test, lint
talosmachina
left a comment
There was a problem hiding this comment.
1 finding (1 P1). Ports the v64 design of the Spark force transfer (renamed from emergency exit), adds the Pay to confirm screen for external fee funding, and skips Network Fee & Availability when only Spark moves. Reviewed 09a5d85, full tier.
What I checked, and 6 candidates I ruled out
Read in full: SparkExitViewModel.kt, SparkExitFundingScreen.kt, SparkExitPayScreen.kt, SparkExitProgressScreen.kt, SparkExitComponents.kt, the sparkExit and transfer graphs in ContentView.kt
Traced: isSparkOnly and navigateToTransferSavings from all three entries, beginSavingsTransfer, refreshFundingAddress, SparkExitRepo.start, the leftover sweep bookkeeping in SparkExitDriver.kt
Strings: every locale's spark_exit__ keys still exist in English with matching placeholders (script over all values-*)
Build: not built, by policy for an unrequested bitkit-android review; reasoned from the code. CI was still running when this was posted (lint, build-and-test, compose-ui pending).
Ruled out
- Pay screen auto-start firing twice:
hasAutoStartedis saveable andstart()now returns early whileisStarting; the repo'spaymentMutex.tryLockis a second guard. - Spark-only skip with a running node whose channels are pending:
filterOpenkeeps onlyisChannelReady, so a pending channel has nothing to close and the skip is right; the stopped-node case is excluded and tested. - Skipping Availability leaves the selection stale: the skip calls
beginSavingsTransfer()exactly as Availability's continue does. - Continue on the fees screen before the address read:
isLoadingFeesdisables the button until the read and the savings price settle. - Returned fees double counted:
sweptLeftoverholds earlier confirmed sweeps and is cleared intoleftoverSweep = nullwhen a late payment is added, so a confirmed current sweep is not in both. - Removed
fundedSteps/ piggybank still referenced: no remaining reference in main, tests or journeys.
Merge confidence: 3/5, the P1 on every completed force transfer.
Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed
Verified: just format, compile, test, lint
Verified: just format, compile, test, lint
Verified: none (journey text only)
|
Pushed ee6c817: the move to Spark journey's last step now expects Spark via Breez under OPEN CONNECTIONS (no channel left there), matching the Spark connection design; same wording as the iOS twin. |
Verified: just compile, just lint
Verified: just compile, just test, just lint
|
Pushed d003628:
|
Verified: just format, just compile, just test, just lint
|
Pushed ff738a6: Transfer overview shows only its three rows, and Progress only the title, intro, four steps and button (no status line, transaction ids, Spark remainder or battery note), as the v64 frames. Fresh screenshots follow. |
Verified: just compile, just lint
|
Pushed cda0b44: the completed force transfer's button reads "Wallet Overview", as the frame. |
The force transfer done screen counts the fee funding the main sweep returns as unused fees, not spending balance. Pay to confirm starts on its own only for a payment that arrives while it is open; funds already there wait for Continue. Verified: just format, compile, test, lint
|
Pushed bf3ae64:
|
Verified: just format, compile, test, lint
Cancel and back wait for a start to end, one start runs at a time and a tap spends the visit's start; App Status reads Emergency fees needed. Verified: just format, compile, test, lint
|
Pushed d00bc51:
The description's Preview is now a Figma and app table for each screen, with fresh recordings; the completed screen and Pay to confirm with the funds already there come from |
Verified: just format, compile, test, lint
|
Pushed 49cd43b: while a force transfer starts from Pay to confirm, which can wait minutes for Spark, its Continue button stays and shows a loading spinner, so the locked screen shows progress. |
Verified: just format, compile, test, lint
|
Pushed 4134b9a, matching the v64 frames:
The description's media for these screens follows with a fresh capture. |
Verified: just format, compile, test, lint
|
Pushed e6f8b0e: the completed screen hides only leftover sweeps that confirmed, and only when the returned note counts them as unused fees. A sweep that is still unconfirmed or was refused keeps its note, so its amount no longer drops out of both notes. |
jvsena42
left a comment
There was a problem hiding this comment.
Code scan at e6f8b0e: one MEDIUM and one LOW, both inline.
What I checked:
- Fund safety.
SparkExitRepo.ktis untouched. Savings paysmin(fresh, confirmed quote)with the approved fee.start()returns early whileisStarting, and also holdspaymentMutex.tryLock. Pay starts withfundFromSavings=false, so the external path never spends savings. The fee bump logic is unchanged. - Total debit. Please confirm shows the funding plus the savings payment's own fee as one row (
savingsTotalSats). That's more than the frame's figure, and it's the true debit. - States. Progress keeps needs-funding, savings-refused retry, fee low or rose, pay a higher fee, cancel, rejection, lost or left-behind leaves, and leftover notes. A second exit is still refused while one runs (
startLocked). - Journeys and tags. Removed testTags have no consumers left in the app, journeys or bitkit-e2e-tests.
spark-emergency-exit.xmlandapp-status-emergency-exit.xmlmatch the head. The screens map has rows for all seven exit screens. - Figma. Confirm (52050:403921), Pay to confirm (52050:404135), Progress (52050:404411) and Completed (52050:404632) match in layout, copy, the yellow accent, the four steps with the explorer button, the Cancel-only Pay screen and the Done buttons.
Out of scope, pre-existing: after process death on Pay, the graph-scoped VM is gone and Pay shows ₿ 0 with no address until the user backs out to Quote. Master's Funding screen has the same gap.
perf: not beyond master. Pay polls Esplora every 15 s while composed, background included (4 chain.utxos calls per minute).
Pay to confirm restarts its watch on each resume: a cancelled predictive back swipe composes Funding underneath, which stopped it, so a payment from another wallet never started the force transfer. Verified: just format, compile, test, lint; SparkExitPredictiveBackTest fails without the fix
jvsena42
left a comment
There was a problem hiding this comment.
Approving at 8e36808: nothing above LOW from the code scan or the device gate. 8e36808 fixes the MEDIUM, and I confirmed it on a device. You kept the funding copy because it is the frame's text, so that LOW is resolved.
Device gate: 8e36808 — Pixel_9 emulator (Android 17, gesture navigation), local Spark stack (bitkit-docker spark profile).
- journeys:
transfer/spark-emergency-exit.xml12/12 andsettings/app-status-emergency-exit.xml5/5. The quote waited about 2 min on "Waiting for Spark to finish moving your balance", then showed ₿ 196 608 to exit, ₿ 4 572 network and ₿ 192 036 received, with ₿ 8 602 in fees deducted from Savings. Going back from Please confirm starts nothing. - Pay from savings: the swipe starts the exit and Progress shows.
- Cancelled back swipe, the MEDIUM's path: a wallet with only Spark (199 865), fees ₿ 10 109 "To be paid with other wallet", then Pay to confirm. I started a back swipe from the edge with the predictive preview showing, then cancelled it. Pay to confirm stayed with the same address. I paid the address with
./spark sendand mined 1 block, and the exit started on its own: the notification prompt appeared, thenBroadcast Spark exit 'FAN_OUT' … 'accepted', and Progress shows the fees step checked. - Figma: Confirm (52050:403921), Pay to confirm (52050:404135) and Progress (52050:404411) match on the device. Completed (52050:404632) wasn't reachable, because it needs the exit timelock to mature.
- l10n: de and pt-BR on the progress screen, no truncation.
- perf: not relevant beyond master.
transfer/move-to-spark.xml, which needs a channel to move and wasn't set up in time. Its change here is only the wording of the Lightning Connections check, and this PR doesn't touch the move code. Also not run: l10n on the other exit screens.
Skipped — covered by CI at 8e36808: unit tests, compose UI tests, detekt, lint, e2e.
|
Merging: approved at 8e36808, required checks pass and every review thread is resolved. |
Twin: synonymdev/bitkit-ios#1361, synonymdev/bitkit-ios#1362
Refs: #1840
Description
Out of Scope
feat: spark connection and app status design.SparkExitFeeBumpScreen.kt): no v64 frame; only its headline accent changed.Design
Figma page
Bitkit - Progress v64.Figma notes
Aldert's notes above the v64 frames for these flows; base link
https://www.figma.com/design/ltqvnKiejWj0JQiqtDf2JJ/Bitkit-Wallet?node-id=<id>.Transfer to Savings (51990-155785)
Force transfer to Savings (52050-399437)
Transfer to Savings Balance (Close LN Channel) (51990-154055): channel close states, unchanged by v64
Changelog v64
Preview
Recordings at 2x
j1-4134.mp4
j2-4134.mp4
case1-spark-only-transfer-to-savings2x.mp4
c2-4134.mp4
c4-4134.mp4
QA Notes
Setup
ESPLORA_URL=http://10.0.2.2:3999, withpython3 scripts/spark-regtest-esplora.py --port 3999running on the emulator's host. Without it, Spark and savings sit on different chains: savings cannot pay the emergency fees, and Spark cannot move to savings.SparkDepositAddress).Journeys
spark-emergency-exit.xml— force transfer up to the swipe, with emergency fees paid from savings — passed on4134b9aa5app-status-emergency-exit.xml— App Status row opens the force transfer progress (needs a started force transfer on a throwaway wallet) — passed on4134b9aa5Manual Tests
aea14d8794134b9aa54134b9aa5Retired: 3 (Pay to confirm waited for Continue when the fees were already at the address); the v64 frame has no Continue, so 4 replaces it.
Automated Checks
ContentViewTest.kt— Spark-only detection and that Transfer to Savings skips Availability only thenSparkExitViewModelTest.kt— who pays the emergency fees, the funding address read on entry, and when Pay to confirm starts on its ownSavingsConfirmScreenTest.kt— removes the piggybank size checkSavingsProgressScreenTest.kt— new Spark failure copySparkExitFundingTest.kt— drops the funded-steps count the UI no longer shows; splits returned fee funding from the spending balance, across replaced generations tooEvidence
On regtest emulators (Android 16, 896×1994 at 320 dpi) with the local Spark stack, dev builds of
cda0b44a1(manual test 1 and the screens not listed below) and4134b9aa5(J1, J2, manual tests 2 and 4, Pay to confirm, the completed screen and the Transfer to Savings intro):4134b9aa5,e6f8b0ecaonly keeps the note for a leftover sweep that has not confirmed on the completed screen; the run above confirmed its sweep.Gaps
SparkExitFundingTest.ktcovers a sweep that does.Models used
Claude Opus 5.5(reasoning:medium)Claude Opus 5.5(reasoning:medium),Claude Sonnet 5.5(reasoning:high)Claude Sonnet 5.5(reasoning:high),Claude Opus 5.5(reasoning:medium)