feat(send): improve Lightning send failure recovery - #1140
Conversation
6a53759 to
873d26e
Compare
873d26e to
776366e
Compare
Greptile SummaryThe PR replaces toast-only Lightning send failures with a recoverable failure screen, localized failure reasons, support-report prefilling, and routing-cache resets for routing-related retries.
Confidence Score: 4/5The PR should not merge until pending QuickPay failures can retry without crashing from cleared payment state. The new Pending branch clears the only QuickPay request state, while the corresponding failure route explicitly returns to a destination that requires that state to be non-null. Files Needing Attention: app/src/main/java/to/bitkit/ui/screens/wallets/send/SendQuickPayScreen.kt, app/src/main/java/to/bitkit/ui/sheets/SendSheet.kt
|
| Filename | Overview |
|---|---|
| app/src/main/java/to/bitkit/ui/screens/wallets/send/SendQuickPayScreen.kt | Moves QuickPay cleanup to terminal results, but clearing state on Pending breaks the newly added pending-failure retry route. |
| app/src/main/java/to/bitkit/ui/sheets/SendSheet.kt | Adds typed failure navigation, support reporting, and routing-aware retry behavior; its QuickPay retry destination still requires state that the Pending path clears. |
| app/src/main/java/to/bitkit/repositories/LightningRepo.kt | Adds graph/scorer cache reset and bounded routing-data refresh orchestration without an independently established defect. |
| app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt | Routes active Lightning failures into the send sheet and preserves typed failure details and payment requests. |
| app/src/main/java/to/bitkit/viewmodels/WalletViewModel.kt | Serializes routing-reset retries with a mutex and exposes retry progress to the UI. |
| app/src/main/java/to/bitkit/ext/PaymentFailureReasonExt.kt | Maps LDK failure reasons to localized user copy and sanitized compact support metadata. |
Sequence Diagram
sequenceDiagram
participant User
participant QuickPay as QuickPay Screen
participant AppVM as AppViewModel
participant Pending as Pending Screen
participant Error as Failure Screen
QuickPay->>AppVM: resetQuickPay()
QuickPay->>Pending: "navigate with retryRoute=QuickPay"
Pending-->>Error: payment failure
User->>Error: Try Again
Error->>QuickPay: clear stack and navigate
QuickPay->>AppVM: read quickPayData
AppVM-->>QuickPay: null
QuickPay--xQuickPay: requireNotNull crashes
Reviews (1): Last reviewed commit: "feat(send): improve Lightning send failu..." | Re-trigger Greptile
ovitrif
left a comment
There was a problem hiding this comment.
Three defects remain because the earlier review findings are unresolved:
- Dismissing the send sheet during Try Again fails to restart Lightning because stop is NonCancellable and the reset job is cancelled.
- Writing QuickPay invoice state into sendUiState routes a failed QuickPay retry to Confirm.
- Report-issue prefill overwrites edits because it is reapplied on composition restart.
|
Addressed all comments, waiting for CI to pass. |
jvsena42
left a comment
There was a problem hiding this comment.
Test-coverage note on compactFailureType(): the assertions only exercise iOS-shaped strings, so the shape Android actually produces is untested — and it currently resolves to Unknown. Details inline.
899fd09 to
d4f450f
Compare
|
I believe all comments have been addressed. |
Description
Ports the iOS Lightning send-failure retry/support behavior to Android.
Optional(...),NodeError, orDuplicatePayment.routeNotFoundandretriesExhausted.SendPendingScreenand fail later.WalletViewModelso overlapping retry flows cannot surface stale timeout errors.Closes #829
Preview
Normal payment:
Screen.Recording.2026-08-11.at.17.59.27.mov
QuickPay:
Screen.Recording.2026-08-12.at.14.55.13.mov
QA Notes
Tested on mainnet emulator:
ROUTE_NOT_FOUNDsurfaces user-facing payment failure copy.RETRIES_EXHAUSTEDfailures surface the localized retries-exhausted copy instead of generic failure copy.Automated checks:
compileDevDebugKotlinPaymentFailureReasonExtTest.ktAppViewModelSendFlowTest.ktdetekt