tui: a fresh install must not open on the Monero spend-authority warning #162

Merged
sirius merged 2 commits from onionwire/t_6aa61cf8-onionwire-tui-a-fresh-install-must-not-o into main 2026-09-27 03:34:52 +00:00
Owner

What changed

App::new now starts a fresh install (empty wallet catalogue) on Screen::Main
instead of WalletSetup::CreateWarn. Nothing has been created yet, so there is
no spend authority to warn about; the warning belongs to the moment a user
commits to creating a wallet, and every one of those entry points is untouched:

  • /wallet create (src/tui.rs:1579)
  • the F6 c key
  • the + create new wallet row on the wallet list

Each still routes into WalletSetup::CreateWarn, and SPEND_AUTHORITY_WARNING
(src/wallet.rs:487, locked by docs/payment-integration-plan.md:243) is unchanged.
The non-empty catalogue branch (a restart lands on the wallets it remembers) and
the Err(e) branch (store unreadable) are unchanged.

Tests (src/tui.rs mod wallet_store_tests)

  • a_fresh_install_starts_on_main_not_the_spend_warning (replaces
    an_install_with_no_wallet_starts_on_the_create_flow): asserts the screen is
    Screen::Main and that the first frame drawn through the real App::draw
    path at 80x24 does not carry the warning string (whitespace-collapsed, so a
    wrapped sentence still matches).
  • the_create_flow_is_still_reachable_and_still_warns: drives /wallet create
    on a fresh install, asserts the screen is CreateWarn and that the warning is
    in the rendered body.
  • an_install_with_wallets_starts_on_the_list_read_from_the_catalogue is
    unchanged and still passes (2 rows, catalogue fields).
  • a_wallet_recorded_after_startup_appears_the_next_time_the_list_opens had one
    line asserting the old start screen on a fresh install; it now asserts
    Screen::Main. Its subject (the list is read when the screen opens, never
    cached) is unchanged and the rest of the test is untouched.

First frame, fresh install, 80x24, through App::draw

onionwire  ... tor connecting  me:055746d6  onion:test.oni
+roster 0------++  chat------------------------------------------+
|no friends    ||no friends yet                                  |
|F3 adds one   ||F3 paste an invite to add one                   |
|              ||tor connecting - first publish takes a few mins |
+--------------++------------------------------------------------+
> message
... TOR connecting  me:055746d6... Enter send / commands F9 settings ? help

(Box-drawing glyphs shown as +/-; the real frame uses the unicode chrome.)

No this wallet file can spend anywhere on it.

Finding filed, not fixed (out of this card's Allowed scope)

draw_text_overlay sizes the popup from the body's logical line count and then
scrolls to wrapped - inner_h, so on the create screen the 184-character warning
is always partially scrolled off: at 80x24 the frame shows only its last word
(trust.) above Type SPEND to confirm; at 100x40 it shows only the final
sentence. The whole warning only fits when it wraps to one visual row. That is a
separate rendering defect against the same locked "unavoidable at wallet
creation" decision - filed as its own card rather than changed here, because this
card's Allowed scope is the start-screen match. The second create-flow assertion
is written against that reality: the standard frame must carry warning copy, the
full sentence is asserted on a 200x60 frame.

Pre-existing flake observed (not mine, not touched)

tests/tui_spec.rs::alert_line_prefixes_when_no_color fails intermittently
(1 run in 12 of the tui_spec binary alone, and once in a full cargo test before
the green rerun below) because it flips the process-global NO_COLOR env var
while other tests in the same binary set/remove it. Unrelated to this diff
(nothing here touches colour mode or env); filed separately.

Evidence

$ export TMPDIR=/home/lancelot/.hermes/tmp/onionwire-tui
$ cargo test --locked          -> exit 0, 35 suites, 473 passed, 0 failed
$ cargo clippy --locked --all-targets -- -D warnings  -> exit 0

rustfmt --edition 2024 --check src/tui.rs reports the same 16 inherited hunks as
HEAD:src/tui.rs; this diff adds none. Base verified
a1f5c878d39e30916257ad041eef71676eb8508c.

## What changed `App::new` now starts a fresh install (empty wallet catalogue) on `Screen::Main` instead of `WalletSetup::CreateWarn`. Nothing has been created yet, so there is no spend authority to warn about; the warning belongs to the moment a user commits to creating a wallet, and every one of those entry points is untouched: - `/wallet create` (src/tui.rs:1579) - the F6 `c` key - the `+ create new wallet` row on the wallet list Each still routes into `WalletSetup::CreateWarn`, and `SPEND_AUTHORITY_WARNING` (src/wallet.rs:487, locked by docs/payment-integration-plan.md:243) is unchanged. The non-empty catalogue branch (a restart lands on the wallets it remembers) and the `Err(e)` branch (store unreadable) are unchanged. ## Tests (src/tui.rs `mod wallet_store_tests`) - `a_fresh_install_starts_on_main_not_the_spend_warning` (replaces `an_install_with_no_wallet_starts_on_the_create_flow`): asserts the screen is `Screen::Main` **and** that the first frame drawn through the real `App::draw` path at 80x24 does not carry the warning string (whitespace-collapsed, so a wrapped sentence still matches). - `the_create_flow_is_still_reachable_and_still_warns`: drives `/wallet create` on a fresh install, asserts the screen is `CreateWarn` and that the warning is in the rendered body. - `an_install_with_wallets_starts_on_the_list_read_from_the_catalogue` is unchanged and still passes (2 rows, catalogue fields). - `a_wallet_recorded_after_startup_appears_the_next_time_the_list_opens` had one line asserting the *old* start screen on a fresh install; it now asserts `Screen::Main`. Its subject (the list is read when the screen opens, never cached) is unchanged and the rest of the test is untouched. ## First frame, fresh install, 80x24, through App::draw ``` onionwire ... tor connecting me:055746d6 onion:test.oni +roster 0------++ chat------------------------------------------+ |no friends ||no friends yet | |F3 adds one ||F3 paste an invite to add one | | ||tor connecting - first publish takes a few mins | +--------------++------------------------------------------------+ > message ... TOR connecting me:055746d6... Enter send / commands F9 settings ? help ``` (Box-drawing glyphs shown as `+`/`-`; the real frame uses the unicode chrome.) No `this wallet file can spend` anywhere on it. ## Finding filed, not fixed (out of this card's Allowed scope) `draw_text_overlay` sizes the popup from the body's *logical* line count and then scrolls to `wrapped - inner_h`, so on the create screen the 184-character warning is always partially scrolled off: at 80x24 the frame shows only its last word (`trust.`) above `Type SPEND to confirm`; at 100x40 it shows only the final sentence. The whole warning only fits when it wraps to one visual row. That is a separate rendering defect against the same locked "unavoidable at wallet creation" decision - filed as its own card rather than changed here, because this card's Allowed scope is the start-screen match. The second create-flow assertion is written against that reality: the standard frame must carry warning copy, the full sentence is asserted on a 200x60 frame. ## Pre-existing flake observed (not mine, not touched) `tests/tui_spec.rs::alert_line_prefixes_when_no_color` fails intermittently (1 run in 12 of the tui_spec binary alone, and once in a full `cargo test` before the green rerun below) because it flips the process-global `NO_COLOR` env var while other tests in the same binary set/remove it. Unrelated to this diff (nothing here touches colour mode or env); filed separately. ## Evidence ``` $ export TMPDIR=/home/lancelot/.hermes/tmp/onionwire-tui $ cargo test --locked -> exit 0, 35 suites, 473 passed, 0 failed $ cargo clippy --locked --all-targets -- -D warnings -> exit 0 ``` `rustfmt --edition 2024 --check src/tui.rs` reports the same 16 inherited hunks as `HEAD:src/tui.rs`; this diff adds none. Base verified `a1f5c878d39e30916257ad041eef71676eb8508c`.
tui: a fresh install opens on the main view, not the spend-authority warning
All checks were successful
android-ci / android (pull_request) Successful in 10m37s
ci / test (pull_request) Successful in 6m20s
ci / sdk (pull_request) Successful in 1m20s
ci / fuzz (pull_request) Successful in 5m13s
cc1201d876
Merge branch 'main' into onionwire/t_6aa61cf8-onionwire-tui-a-fresh-install-must-not-o
Some checks failed
android-ci / android (pull_request) Successful in 11m8s
ci / test (pull_request) Failing after 39s
ci / sdk (pull_request) Successful in 1m34s
ci / fuzz (pull_request) Successful in 5m0s
fa58930678
sirius merged commit b78e0fcb55 into main 2026-09-27 03:34:52 +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!162
No description provided.