android: do not paint a connect refusal while the wallet is connecting #154

Merged
sirius merged 2 commits from onionwire/t_1b021834-onionwire-android-do-not-paint-a-wallet into main 2026-09-24 00:08:52 +00:00
Owner

The Android half of the wallet-startup stabilization (plan Task 5 + Task 6). The Rust half (card t_… for src/) stops storing an unreachable probe as last_error in the first place; this change is deliberate defense in depth at the display seam plus the missing reload.

What changed

  • Task 5 — do not paint a connect refusal while connecting. New displayLastError(state, raw) in WalletManagerScreen.kt, next to walletFailureText. It returns null for a lastError starting with wallet connect: / wallet write: while state is connecting (case/whitespace insensitive, mirroring the core's error_is_unreachable verbatim — a bare Connection refused is not matched). In every other state the same string is shown: past connecting it means the child accepted a connection and then died, which is exactly what the user needs to see.
  • WalletScreen.kt's WalletChildStatus.toInput() now wraps the field as lastError = displayLastError(state, lastError) instead of walletFailureText(lastError). That is the single seam both walletChildLine and the red failure card read, so there is no second filter. walletFailureText stays as it was and is still applied inside displayLastError, so -13 / No wallet file / raw JSON still become WALLET_NOT_OPEN_TEXT; only the transient connect refusal is suppressed.
  • Task 6 — reload when the child starts answering. New pure shouldReloadWalletReads(state) in WalletScreen.kt (syncing / ready only, trimmed + case-insensitive) plus LaunchedEffect(childInput?.state) { if (shouldReloadWalletReads(childInput?.state)) reload() }. The existing LaunchedEffect(Unit) { reload(); vm.refreshChainSource() } is untouched. Not reloaded while connecting: walletBalance() returns the string "err" rather than throwing, and that call is what pinned the headline to balance —.

Tests (JVM, locally — android-ci.yml does not run Kotlin unit tests)

cd android && ./gradlew :app:testDebugUnitTest --tests '*WalletManagerTest*' --tests '*WalletChildStatusTextTest*'

  • WalletManagerTest: 50 tests, 0 failures, 0 errors, 0 skipped
  • WalletChildStatusTextTest: 47 tests, 0 failures, 0 errors, 0 skipped
  • Whole :app:testDebugUnitTest: 213 tests, 0 failures, 0 errors, 0 skipped

New tests, all passing: connecting_connect_refusal_is_not_shown, a_connect_refusal_after_connecting_is_still_shown, display_last_error_still_rewrites_no_wallet_file, wallet_reads_reload_only_once_the_child_is_answering. The existing walletFailureText tests (the_daemons_no_wallet_file_never_reaches_the_screen, filtering_the_sdk_record_twice_changes_nothing, …) still pass unchanged.

Not done

No release, no tag, no dispatch of release.yml / android-release.yml. Mainnet Cuprate is still unvalidated and chain P2P stays clearnet. No emulator/device run of the wallet screen was performed — this host cannot exercise a real Cuprate launch, so the acceptance in the plan's Task 5/6 is covered by the pure-function tests only.

The Android half of the wallet-startup stabilization (plan Task 5 + Task 6). The Rust half (card t_… for `src/`) stops storing an unreachable probe as `last_error` in the first place; this change is deliberate defense in depth at the display seam plus the missing reload. ## What changed - **Task 5 — do not paint a connect refusal while connecting.** New `displayLastError(state, raw)` in `WalletManagerScreen.kt`, next to `walletFailureText`. It returns `null` for a `lastError` starting with `wallet connect:` / `wallet write:` while `state` is `connecting` (case/whitespace insensitive, mirroring the core's `error_is_unreachable` verbatim — a bare `Connection refused` is *not* matched). In every other state the same string is shown: past `connecting` it means the child accepted a connection and then died, which is exactly what the user needs to see. - `WalletScreen.kt`'s `WalletChildStatus.toInput()` now wraps the field as `lastError = displayLastError(state, lastError)` instead of `walletFailureText(lastError)`. That is the single seam both `walletChildLine` and the red failure card read, so there is no second filter. `walletFailureText` stays as it was and is still applied inside `displayLastError`, so `-13` / `No wallet file` / raw JSON still become `WALLET_NOT_OPEN_TEXT`; only the transient connect refusal is suppressed. - **Task 6 — reload when the child starts answering.** New pure `shouldReloadWalletReads(state)` in `WalletScreen.kt` (`syncing` / `ready` only, trimmed + case-insensitive) plus `LaunchedEffect(childInput?.state) { if (shouldReloadWalletReads(childInput?.state)) reload() }`. The existing `LaunchedEffect(Unit) { reload(); vm.refreshChainSource() }` is untouched. Not reloaded while `connecting`: `walletBalance()` returns the string `"err"` rather than throwing, and that call is what pinned the headline to `balance —`. ## Tests (JVM, locally — `android-ci.yml` does not run Kotlin unit tests) `cd android && ./gradlew :app:testDebugUnitTest --tests '*WalletManagerTest*' --tests '*WalletChildStatusTextTest*'` - `WalletManagerTest`: 50 tests, 0 failures, 0 errors, 0 skipped - `WalletChildStatusTextTest`: 47 tests, 0 failures, 0 errors, 0 skipped - Whole `:app:testDebugUnitTest`: 213 tests, 0 failures, 0 errors, 0 skipped New tests, all passing: `connecting_connect_refusal_is_not_shown`, `a_connect_refusal_after_connecting_is_still_shown`, `display_last_error_still_rewrites_no_wallet_file`, `wallet_reads_reload_only_once_the_child_is_answering`. The existing `walletFailureText` tests (`the_daemons_no_wallet_file_never_reaches_the_screen`, `filtering_the_sdk_record_twice_changes_nothing`, …) still pass unchanged. ## Not done No release, no tag, no dispatch of `release.yml` / `android-release.yml`. Mainnet Cuprate is still unvalidated and chain P2P stays clearnet. No emulator/device run of the wallet screen was performed — this host cannot exercise a real Cuprate launch, so the acceptance in the plan's Task 5/6 is covered by the pure-function tests only.
sirius merged commit 9322d885f8 into main 2026-09-24 00:08:52 +00:00
sirius deleted branch onionwire/t_1b021834-onionwire-android-do-not-paint-a-wallet 2026-09-24 00:08:53 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!154
No description provided.