tui: F7 becomes the node-setup screen, and F6 goes back to being the wallet #169

Merged
sirius merged 2 commits from onionwire/f7-node-setup into main 2026-09-28 00:43:14 +00:00
Owner

What this is

F7 did not exist on main, while wallet.rs's not-configured error told users to
"open F7" and docs/TUI.md documented "There is no F7". The commit that built it
(a48d40b) was stranded: it was merged into a stacked branch (t_6aa61cf8) that never
reached main, and its Forgejo branch was deleted mid-session. This PR lands it and
finishes the job.

Why the node could not be set up from the TUI

Not a missing screen — three places had part of the story and none had the write path:

  • F6's inline 1/2/3 picker wrote only the in-process Cuprate choice.
  • The F9 menu showed child/sync state and named keys that edited it.
  • Node::set_local_monerod, set_remote_daemon and set_receive_only — the only way
    to point the app at a Monero node — had no TUI caller at all (Kotlin only).

What changed

F7 is the node-setup screen (WalletSetupConfig), recovered and extended:

  • datadir row, new and editable. Node::set_local_monerod_at(bin, datadir, prune) is
    the new entry point; set_local_monerod delegates with the derived
    $ONIONWIRE_HOME/chain/mainnet-* default so an existing install keeps its store. An
    empty datadir is refused, not silently defaulted: a store that moves unasked looks
    like a vanished chain and resyncs into a directory the user did not choose.
  • network row, new — it carries the Cuprate mainnet/testnet choice F6's 1/2/3
    used to own, so deleting those keys loses nothing. Mainnet reads unvalidated before
    it is picked.
  • A NODE section draws the live Node::wallet_child_status line (state, chain source,
    sync h/t once a daemon reports numbers, last error) plus the last save/test answer.
    The live row is the node's answer, never the draft above it; Ctrl-R re-reads it.
  • Ctrl-S saves and starts the child (the daemon, and monerod for a local source);
    Ctrl-X stops it. Both go through the same Node::start_wallet_child /
    stop_wallet_child the app's own lifecycle uses, so a start that lands on a wallet
    file with no stored passphrase still reaches the unlock prompt.

F6 is the wallet again. The chain picker and the s/x/p child keys are gone;
the footer reads c create i import r qr w wallets F7 node Esc back ? help.
App::set_cuprate_chain and the p probe handler are deleted rather than left dead.
The F9 menu's child/sync rows now name F7 ctrl-s/x and F7 ctrl-r — the old rows
named keys that no longer work, which is how a dead shortcut keeps looking live.

The node's own keys are named in the body, on the section they act on: at 80 columns the
footer has room for one group and the status line already spends half the width. That is
the same reason the login row names Ctrl-U.

Evidence

cargo clippy --locked --all-targets -- -D warnings — exit 0, no warnings.
cargo test --locked — 504 passed, 0 failed (this run predates two
formatting-only hunks; clippy and the tui targets were re-run after them, all green).

Six new cases in src/tui.rs's wallet_setup_config_tests drive the real key path and
the real node:

test proves
a_local_node_saves_the_datadir_the_user_typed the typed path reaches ChainSource::Local
an_empty_datadir_is_refused_and_the_source_is_not_written the refusal names the field and stores nothing
the_node_row_shows_the_live_state_on_open the live row is the node's answer, on open
ctrl_s_saves_then_reports_the_nodes_own_refusal Ctrl-S saves first, then reports the node's words
the_in_process_network_is_still_selectable the network pick reaches the store
f6_no_longer_owns_the_chain_picker_or_the_child_keys F6's dead keys write nothing

tests/tui_spec.rs's menu-key assertion moved to the F7 keys. rustfmt --edition 2024 --check src/tui.rs reports 24 hunks, the same count as at HEAD before this change —
the inherited churn is untouched.

Recovery note

The first commit on this branch is a -x cherry-pick of a48d40b, which applies
cleanly; the merge did duplicate two #[cfg(test)] helpers in src/tui.rs
(key, flattened — main and the F7 branch each added them), fixed in that same
commit with one helper of each kept.

Docs

README.md no longer says "There is no F7" (twice: the key table and the
troubleshooting row). docs/TUI.md gets a Node & wallet setup (F7) section and an
F6 section that is about the wallet. docs/WALLET.md moves the child's start/stop table
from F6 to F7 and documents the network row. docs/tui-wallet-ux-review.md is a
dated review snapshot and is left as written.

## What this is `F7` did not exist on `main`, while `wallet.rs`'s not-configured error told users to "open F7" and `docs/TUI.md` documented "There is **no `F7`**". The commit that built it (`a48d40b`) was stranded: it was merged into a *stacked* branch (`t_6aa61cf8`) that never reached `main`, and its Forgejo branch was deleted mid-session. This PR lands it and finishes the job. ## Why the node could not be set up from the TUI Not a missing screen — three places had part of the story and none had the write path: - `F6`'s inline `1`/`2`/`3` picker wrote **only** the in-process Cuprate choice. - The `F9` menu *showed* child/sync state and named keys that edited it. - `Node::set_local_monerod`, `set_remote_daemon` and `set_receive_only` — the only way to point the app at a Monero node — had **no TUI caller at all** (Kotlin only). ## What changed **`F7` is the node-setup screen** (`WalletSetupConfig`), recovered and extended: - `datadir` row, new and editable. `Node::set_local_monerod_at(bin, datadir, prune)` is the new entry point; `set_local_monerod` delegates with the derived `$ONIONWIRE_HOME/chain/mainnet-*` default so an existing install keeps its store. An empty datadir is **refused**, not silently defaulted: a store that moves unasked looks like a vanished chain and resyncs into a directory the user did not choose. - `network` row, new — it carries the Cuprate mainnet/testnet choice `F6`'s `1`/`2`/`3` used to own, so deleting those keys loses nothing. Mainnet reads `unvalidated` before it is picked. - A `NODE` section draws the live `Node::wallet_child_status` line (state, chain source, `sync h/t` once a daemon reports numbers, last error) plus the last save/test answer. The live row is the node's answer, never the draft above it; `Ctrl-R` re-reads it. - `Ctrl-S` saves and starts the child (the daemon, and `monerod` for a local source); `Ctrl-X` stops it. Both go through the same `Node::start_wallet_child` / `stop_wallet_child` the app's own lifecycle uses, so a start that lands on a wallet file with no stored passphrase still reaches the unlock prompt. **`F6` is the wallet again.** The chain picker and the `s`/`x`/`p` child keys are gone; the footer reads `c create i import r qr w wallets F7 node Esc back ? help`. `App::set_cuprate_chain` and the `p` probe handler are **deleted** rather than left dead. The `F9` menu's `child`/`sync` rows now name `F7 ctrl-s/x` and `F7 ctrl-r` — the old rows named keys that no longer work, which is how a dead shortcut keeps looking live. The node's own keys are named in the body, on the section they act on: at 80 columns the footer has room for one group and the status line already spends half the width. That is the same reason the login row names `Ctrl-U`. ## Evidence `cargo clippy --locked --all-targets -- -D warnings` — exit 0, no warnings. `cargo test --locked` — **504 passed, 0 failed** (this run predates two formatting-only hunks; clippy and the tui targets were re-run after them, all green). Six new cases in `src/tui.rs`'s `wallet_setup_config_tests` drive the real key path and the real node: | test | proves | |---|---| | `a_local_node_saves_the_datadir_the_user_typed` | the typed path reaches `ChainSource::Local` | | `an_empty_datadir_is_refused_and_the_source_is_not_written` | the refusal names the field and stores nothing | | `the_node_row_shows_the_live_state_on_open` | the live row is the node's answer, on open | | `ctrl_s_saves_then_reports_the_nodes_own_refusal` | `Ctrl-S` saves first, then reports the node's words | | `the_in_process_network_is_still_selectable` | the network pick reaches the store | | `f6_no_longer_owns_the_chain_picker_or_the_child_keys` | F6's dead keys write nothing | `tests/tui_spec.rs`'s menu-key assertion moved to the F7 keys. `rustfmt --edition 2024 --check src/tui.rs` reports 24 hunks, the same count as at `HEAD` before this change — the inherited churn is untouched. ## Recovery note The first commit on this branch is a `-x` cherry-pick of `a48d40b`, which applies cleanly; the merge did duplicate two `#[cfg(test)]` helpers in `src/tui.rs` (`key`, `flattened` — `main` and the F7 branch each added them), fixed in that same commit with one helper of each kept. ## Docs `README.md` no longer says "There is **no `F7`**" (twice: the key table and the troubleshooting row). `docs/TUI.md` gets a `Node & wallet setup (F7)` section and an F6 section that is about the wallet. `docs/WALLET.md` moves the child's start/stop table from `F6` to `F7` and documents the `network` row. `docs/tui-wallet-ux-review.md` is a dated review snapshot and is left as written.
`wallet::NOT_CONFIGURED_MSG` has always said "open F7 to set it up" and there
was no F7. This is that screen.

- `FunctionKey::Setup` on `F7`, live on Main, the settings menu and peer
  payments, same invariant `F9` follows.
- `Screen::WalletSetupConfig` carries `WalletSetupConfigState`: a snapshot of
  plain data taken when the screen opens, never a handle onto `Node`.
- Rows: the wallet RPC endpoint and its login (never rendered back — the row
  says `hidden · set`, `Debug` redacts it), the view-only toggle, and a chain
  picker over all four `ChainSource` cases with their own fields.
- `Node::set_remote_daemon` / `set_local_monerod` / `set_receive_only`, so the
  TUI can reach what only the Android API could, plus `F6`'s in-process source.
- An untouched chain row is not written, so an F7 save cannot silently undo the
  in-process choice; picking a remote daemon says who is trusted in the same
  frame, one line, lowercase.
- `Ctrl-T` tests the endpoint and shows the sanitized `PingResult::line()`.
  Saving never dials. A rejected form writes nothing — the node validates.
- Docs that claimed there is no F7 (`docs/TUI.md`, `docs/WALLET.md`) now
  describe the screen; the settings menu's `endpoint` row names the key.

(cherry picked from commit a48d40bc4e)
tui: F7 becomes the node-setup screen, and F6 goes back to being the wallet
All checks were successful
ci / test (pull_request) Successful in 7m20s
ci / sdk (pull_request) Successful in 1m45s
android-ci / android (pull_request) Successful in 13m36s
ci / fuzz (pull_request) Successful in 5m29s
5cdfbacf10
The chain source was reachable from three places and configured from none of
them properly: `F6`'s inline `1`/`2`/`3` picker wrote only the in-process
choice, the `F9` menu showed the state and named keys that edited it, and
`Node::set_local_monerod` / `set_remote_daemon` / `set_receive_only` — the only
way to point the app at a Monero node — had **no TUI caller at all** (Kotlin
only). `wallet::NOT_CONFIGURED_MSG` told users to "open F7" and there was no F7.

F7 (`WalletSetupConfig`) is now the one screen that sets up the node:

- The `datadir` row is new and editable. `Node::set_local_monerod_at` takes the
  path; `set_local_monerod` delegates with the derived default, so an existing
  install keeps the store it already has. An empty datadir is refused rather
  than silently replaced — a store that moved unasked looks like a vanished
  chain and resyncs somewhere the user did not choose.
- The `network` row is new: it carries the Cuprate mainnet/testnet choice that
  `F6`'s `1`/`2`/`3` used to own, so deleting those keys loses nothing. Mainnet
  reads `unvalidated` before it is picked.
- A `NODE` section shows the live `Node::wallet_child_status` line (state, chain
  source, `sync h/t`, last error) and the last save/test answer. It is the
  node's answer, never the draft above it, and `Ctrl-R` re-reads it.
- `Ctrl-S` saves and starts the child (the daemon, and `monerod` for a local
  source); `Ctrl-X` stops it. Both go through the same `Node::start_wallet_child`
  / `stop_wallet_child` the app's own lifecycle uses, so a start that lands on a
  wallet with no stored passphrase still reaches the unlock prompt.

F6 loses the chain picker and the `s`/`x`/`p` child keys — it is the wallet
again (receive, balance, transfers, create/import) — and its footer points at
`F7 node`. The `F9` menu's `child`/`sync` rows now name `F7 ctrl-s/x` and
`F7 ctrl-r` instead of keys that no longer exist on F6. `set_cuprate_chain` and
the `p` probe handler are deleted rather than left dead.

The node's own keys are named in the body, on the section they act on: at 80
columns the footer has room for one group and the status line already spends
half the width, which is the same reason the login row names `Ctrl-U`.

Tests: six new cases in `src/tui.rs`'s `wallet_setup_config_tests` drive the real
key path and the real node — the typed datadir reaching `ChainSource::Local`, an
empty one being refused with nothing written, the live row on open, `Ctrl-S`
saving then reporting the node's own refusal, the in-process network pick
reaching the store, and F6 no longer owning keys it does not handle.
`tests/tui_spec.rs`'s menu-key check now asserts the F7 keys; the F6 keys it
asserted before no longer work.
sirius merged commit 02f8e4d914 into main 2026-09-28 00:43:14 +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!169
No description provided.