2026-09-11 23:52:05 -04:00
//! Visual audit dumps of the current OnionWire TUI.
//!
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
//! The main screen is the **real** render path: `draw_main_chrome` takes a
//! `MainView` of plain data, so this test draws exactly what `App::draw_main`
//! draws (no stand-in layout constants, no stub widget). Screens that are still
//! private (`draw_paste`, `draw_rotate`, …) are labelled RECONSTRUCTED and copy
//! the layout constants and copy from `src/tui.rs`.
2026-09-11 23:52:05 -04:00
//!
//! Print frames:
//! cargo test --locked --test tui_frames -- --nocapture dump_audit_frames
//!
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
//! Widths are asserted in terminal **cells** via `onionwire::tui::cell_width`
//! (`Span::width`), never `chars().count()`.
2026-09-11 23:52:05 -04:00
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
use onionwire ::outbox ::{ OutboxEntry , OutboxStatus } ;
2026-09-11 23:52:05 -04:00
use onionwire ::qr ;
use onionwire ::tui ::{
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
ChatRowStyle , FriendRow , MainView , Pane , TorPhase , backup_screen_text , banner_for_width ,
tui: mark friends invite-stale after an F8 prekey rotation
F8 replaces the Noise static prekey and the ML-KEM key together and clears
every stored ratchet, but nothing recorded the cut: a friend on the roster
still held an invite with the old prekey, the next inbound frame could not be
decrypted, our own outbound re-bootstrapped an epoch they did not have, and the
send looked delivered. The only fix -- ask them to paste the new invite -- was
never said.
- `rotate_prekey` snapshots the roster into `$ONIONWIRE_HOME/invite-stale`
(derived local state; no store schema change, no wire field, no new crate).
`Node::invite_stale(pk)` / `invite_stale_friends()` answer the question, and
an install that never rotated has no file and nothing marked.
- `Node::send` and `Node::send_once` fail closed with `invite stale` for a
pre-rotation friend instead of silently re-bootstrapping past the cut.
- The roster gains its own `invite stale` word and colour token (violet; `stale`
keeps meaning "the last dial did not answer"), and the alert row above the
panes carries `invite stale -- F2 to share your new invite, they F3-paste it`,
recomputed every draw so F3-pasting an invite for that friend clears it.
- `add_friend_payload` removes the pubkey from the set, which is the test the
card asks for; docs/TUI.md documents the marker.
This makes the existing hard cut legible. It does not add in-band revocation or
a soft rotation; the threat model's hard-cut wording stays as it is.
2026-10-22 23:38:30 -04:00
cell_width , chat_no_friends_lines , chat_with_delivery , color_mode , compact_banner ,
draw_main_chrome , draw_share , draw_text_overlay , fingerprint_mismatch_banner ,
help_overlay_text , invite_stale_banner , main_footer_hints , onion_glyph , quit_screen_text ,
restore_screen_text , rotate_screen_text , roster_line , status_footer , tokens_for ,
who_overlay_text , wipe_screen_text , wordmark_banner , ProfileEditor , WipeKind ,
2026-09-11 23:52:05 -04:00
} ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
use onionwire ::{ FriendProfile , Message } ;
2026-09-11 23:52:05 -04:00
use ratatui ::Frame ;
use ratatui ::Terminal ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
use ratatui ::backend ::TestBackend ;
use ratatui ::buffer ::Buffer ;
use ratatui ::layout ::{ Constraint , Layout } ;
use ratatui ::widgets ::{ Block , Borders , Paragraph , Wrap } ;
2026-09-11 23:52:05 -04:00
const SIZES : [ ( u16 , u16 ) ; 3 ] = [ ( 80 , 24 ) , ( 120 , 40 ) , ( 200 , 60 ) ] ;
const FP : & str = " abcdef0123456789deadbeefcafebabe " ;
const ONION : & str = " abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion " ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
const LONG_BODY : & str = " this is a very long chat line that should wrap inside the chat pane instead of running off the right edge of an 80-column terminal and colliding with the roster border " ;
2026-09-11 23:52:05 -04:00
fn fp8 ( s : & str ) -> String {
s . chars ( ) . take ( 8 ) . collect ( )
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
fn dump_buffer ( label : & str , w : u16 , h : u16 , buf : & Buffer ) {
2026-09-11 23:52:05 -04:00
println! ( ) ;
println! ( " ===== {label} {w} x {h} ===== " ) ;
for y in 0 .. h {
let mut row = String ::new ( ) ;
for x in 0 .. w {
row . push_str ( buf [ ( x , y ) ] . symbol ( ) ) ;
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
let cells = cell_width ( & row ) ;
2026-09-11 23:52:05 -04:00
assert! (
cells < = w as usize ,
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
" {label} row {y} width {cells} cells > {w}: {row:?} "
2026-09-11 23:52:05 -04:00
) ;
println! ( " {row} " ) ;
}
}
fn draw_to ( w : u16 , h : u16 , label : & str , render : impl FnOnce ( & mut Frame ) ) {
let backend = TestBackend ::new ( w , h ) ;
let mut terminal = Terminal ::new ( backend ) . expect ( " terminal " ) ;
terminal . draw ( render ) . expect ( " draw " ) ;
dump_buffer ( label , w , h , terminal . backend ( ) . buffer ( ) ) ;
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
fn draw_frame ( w : u16 , h : u16 , render : impl FnOnce ( & mut Frame ) ) -> Buffer {
let backend = TestBackend ::new ( w , h ) ;
let mut terminal = Terminal ::new ( backend ) . expect ( " terminal " ) ;
terminal . draw ( render ) . expect ( " draw " ) ;
terminal . backend ( ) . buffer ( ) . clone ( )
2026-09-11 23:52:05 -04:00
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
fn screen_of ( buf : & Buffer , w : u16 , h : u16 ) -> String {
let mut screen = String ::new ( ) ;
for y in 0 .. h {
for x in 0 .. w {
screen . push_str ( buf [ ( x , y ) ] . symbol ( ) ) ;
2026-09-11 23:52:05 -04:00
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
screen . push ( '\n' ) ;
}
screen
}
2026-09-11 23:52:05 -04:00
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
// ---------------------------------------------------------------------------
// Real main-screen states
// ---------------------------------------------------------------------------
2026-09-11 23:52:05 -04:00
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
fn friend_rows ( ) -> Vec < FriendRow > {
vec! [
FriendRow {
label : " alice " . into ( ) ,
fingerprint : " aaaaaaaaaaaaaaaa " . into ( ) ,
stale : false ,
tui: mark friends invite-stale after an F8 prekey rotation
F8 replaces the Noise static prekey and the ML-KEM key together and clears
every stored ratchet, but nothing recorded the cut: a friend on the roster
still held an invite with the old prekey, the next inbound frame could not be
decrypted, our own outbound re-bootstrapped an epoch they did not have, and the
send looked delivered. The only fix -- ask them to paste the new invite -- was
never said.
- `rotate_prekey` snapshots the roster into `$ONIONWIRE_HOME/invite-stale`
(derived local state; no store schema change, no wire field, no new crate).
`Node::invite_stale(pk)` / `invite_stale_friends()` answer the question, and
an install that never rotated has no file and nothing marked.
- `Node::send` and `Node::send_once` fail closed with `invite stale` for a
pre-rotation friend instead of silently re-bootstrapping past the cut.
- The roster gains its own `invite stale` word and colour token (violet; `stale`
keeps meaning "the last dial did not answer"), and the alert row above the
panes carries `invite stale -- F2 to share your new invite, they F3-paste it`,
recomputed every draw so F3-pasting an invite for that friend clears it.
- `add_friend_payload` removes the pubkey from the set, which is the test the
card asks for; docs/TUI.md documents the marker.
This makes the existing hard cut legible. It does not add in-band revocation or
a soft rotation; the threat model's hard-cut wording stays as it is.
2026-10-22 23:38:30 -04:00
invite_stale : false ,
transport: ML-KEM-768 hybrid prelude and onionwire:v2 invites
Adds an ML-KEM-768 install key beside the ed25519 identity and x25519
prekey. A friend added from a v2 invite always gets a version-2 PQ
prelude before Noise msg 1, and both sides bind (ct, ss_kem) into the
Noise prologue (onionwire-v2 \0 ct \0 ss_kem). The row decides: a
kem_pk friend without a prelude is rejected with 'prelude required',
a prelude for a classical row with 'unexpected prelude'.
Invites are now onionwire:v2 with kem=<base64url pk>; decode still
accepts v1 (no kem) and yields a classical friend. F8 rotates the
KEM key with the prekey and hard-cuts stored ratchet state. The TUI
labels a legacy friend 'classical'.
Docs: PROTOCOL (keys, framing, prologues, no-downgrade, invite v2),
THREAT_MODEL (what PQ transport does and does not buy; epoch 0 stays
classical), README (invite size, F8, legacy caveat). SDK exposes pq on
InviteInfo/FriendInfo and gains a v2 decode round-trip test.
2026-10-20 11:15:46 -04:00
pq : true ,
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
} ,
FriendRow {
label : " bob-the-stale-peer " . into ( ) ,
fingerprint : " bbbbbbbbbbbbbbbb " . into ( ) ,
stale : true ,
tui: mark friends invite-stale after an F8 prekey rotation
F8 replaces the Noise static prekey and the ML-KEM key together and clears
every stored ratchet, but nothing recorded the cut: a friend on the roster
still held an invite with the old prekey, the next inbound frame could not be
decrypted, our own outbound re-bootstrapped an epoch they did not have, and the
send looked delivered. The only fix -- ask them to paste the new invite -- was
never said.
- `rotate_prekey` snapshots the roster into `$ONIONWIRE_HOME/invite-stale`
(derived local state; no store schema change, no wire field, no new crate).
`Node::invite_stale(pk)` / `invite_stale_friends()` answer the question, and
an install that never rotated has no file and nothing marked.
- `Node::send` and `Node::send_once` fail closed with `invite stale` for a
pre-rotation friend instead of silently re-bootstrapping past the cut.
- The roster gains its own `invite stale` word and colour token (violet; `stale`
keeps meaning "the last dial did not answer"), and the alert row above the
panes carries `invite stale -- F2 to share your new invite, they F3-paste it`,
recomputed every draw so F3-pasting an invite for that friend clears it.
- `add_friend_payload` removes the pubkey from the set, which is the test the
card asks for; docs/TUI.md documents the marker.
This makes the existing hard cut legible. It does not add in-band revocation or
a soft rotation; the threat model's hard-cut wording stays as it is.
2026-10-22 23:38:30 -04:00
invite_stale : false ,
transport: ML-KEM-768 hybrid prelude and onionwire:v2 invites
Adds an ML-KEM-768 install key beside the ed25519 identity and x25519
prekey. A friend added from a v2 invite always gets a version-2 PQ
prelude before Noise msg 1, and both sides bind (ct, ss_kem) into the
Noise prologue (onionwire-v2 \0 ct \0 ss_kem). The row decides: a
kem_pk friend without a prelude is rejected with 'prelude required',
a prelude for a classical row with 'unexpected prelude'.
Invites are now onionwire:v2 with kem=<base64url pk>; decode still
accepts v1 (no kem) and yields a classical friend. F8 rotates the
KEM key with the prekey and hard-cuts stored ratchet state. The TUI
labels a legacy friend 'classical'.
Docs: PROTOCOL (keys, framing, prologues, no-downgrade, invite v2),
THREAT_MODEL (what PQ transport does and does not buy; epoch 0 stays
classical), README (invite size, F8, legacy caveat). SDK exposes pq on
InviteInfo/FriendInfo and gains a v2 decode round-trip test.
2026-10-20 11:15:46 -04:00
pq : true ,
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
} ,
]
}
2026-09-11 23:52:05 -04:00
transport: ML-KEM-768 hybrid prelude and onionwire:v2 invites
Adds an ML-KEM-768 install key beside the ed25519 identity and x25519
prekey. A friend added from a v2 invite always gets a version-2 PQ
prelude before Noise msg 1, and both sides bind (ct, ss_kem) into the
Noise prologue (onionwire-v2 \0 ct \0 ss_kem). The row decides: a
kem_pk friend without a prelude is rejected with 'prelude required',
a prelude for a classical row with 'unexpected prelude'.
Invites are now onionwire:v2 with kem=<base64url pk>; decode still
accepts v1 (no kem) and yields a classical friend. F8 rotates the
KEM key with the prekey and hard-cuts stored ratchet state. The TUI
labels a legacy friend 'classical'.
Docs: PROTOCOL (keys, framing, prologues, no-downgrade, invite v2),
THREAT_MODEL (what PQ transport does and does not buy; epoch 0 stays
classical), README (invite size, F8, legacy caveat). SDK exposes pq on
InviteInfo/FriendInfo and gains a v2 decode round-trip test.
2026-10-20 11:15:46 -04:00
#[ test ]
fn a_legacy_friend_row_says_classical_in_the_roster ( ) {
let pq = FriendRow {
label : " alice " . into ( ) ,
fingerprint : " aaaaaaaaaaaaaaaa " . into ( ) ,
stale : false ,
tui: mark friends invite-stale after an F8 prekey rotation
F8 replaces the Noise static prekey and the ML-KEM key together and clears
every stored ratchet, but nothing recorded the cut: a friend on the roster
still held an invite with the old prekey, the next inbound frame could not be
decrypted, our own outbound re-bootstrapped an epoch they did not have, and the
send looked delivered. The only fix -- ask them to paste the new invite -- was
never said.
- `rotate_prekey` snapshots the roster into `$ONIONWIRE_HOME/invite-stale`
(derived local state; no store schema change, no wire field, no new crate).
`Node::invite_stale(pk)` / `invite_stale_friends()` answer the question, and
an install that never rotated has no file and nothing marked.
- `Node::send` and `Node::send_once` fail closed with `invite stale` for a
pre-rotation friend instead of silently re-bootstrapping past the cut.
- The roster gains its own `invite stale` word and colour token (violet; `stale`
keeps meaning "the last dial did not answer"), and the alert row above the
panes carries `invite stale -- F2 to share your new invite, they F3-paste it`,
recomputed every draw so F3-pasting an invite for that friend clears it.
- `add_friend_payload` removes the pubkey from the set, which is the test the
card asks for; docs/TUI.md documents the marker.
This makes the existing hard cut legible. It does not add in-band revocation or
a soft rotation; the threat model's hard-cut wording stays as it is.
2026-10-22 23:38:30 -04:00
invite_stale : false ,
transport: ML-KEM-768 hybrid prelude and onionwire:v2 invites
Adds an ML-KEM-768 install key beside the ed25519 identity and x25519
prekey. A friend added from a v2 invite always gets a version-2 PQ
prelude before Noise msg 1, and both sides bind (ct, ss_kem) into the
Noise prologue (onionwire-v2 \0 ct \0 ss_kem). The row decides: a
kem_pk friend without a prelude is rejected with 'prelude required',
a prelude for a classical row with 'unexpected prelude'.
Invites are now onionwire:v2 with kem=<base64url pk>; decode still
accepts v1 (no kem) and yields a classical friend. F8 rotates the
KEM key with the prekey and hard-cuts stored ratchet state. The TUI
labels a legacy friend 'classical'.
Docs: PROTOCOL (keys, framing, prologues, no-downgrade, invite v2),
THREAT_MODEL (what PQ transport does and does not buy; epoch 0 stays
classical), README (invite size, F8, legacy caveat). SDK exposes pq on
InviteInfo/FriendInfo and gains a v2 decode round-trip test.
2026-10-20 11:15:46 -04:00
pq : true ,
} ;
let legacy = FriendRow {
pq : false ,
.. pq . clone ( )
} ;
let pq_text : String = roster_line ( & pq , 40 ) . spans . iter ( ) . map ( | s | s . content . clone ( ) ) . collect ( ) ;
let legacy_text : String = roster_line ( & legacy , 40 )
. spans
. iter ( )
. map ( | s | s . content . clone ( ) )
. collect ( ) ;
assert! ( pq_text . contains ( " alice " ) , " {pq_text} " ) ;
assert! (
! pq_text . contains ( " classical " ) ,
" a v2 friend must not be labelled classical: {pq_text} "
) ;
assert! (
legacy_text . contains ( " classical " ) ,
" a v1 friend must be visibly labelled as lacking PQ protection: {legacy_text} "
) ;
}
tui: mark friends invite-stale after an F8 prekey rotation
F8 replaces the Noise static prekey and the ML-KEM key together and clears
every stored ratchet, but nothing recorded the cut: a friend on the roster
still held an invite with the old prekey, the next inbound frame could not be
decrypted, our own outbound re-bootstrapped an epoch they did not have, and the
send looked delivered. The only fix -- ask them to paste the new invite -- was
never said.
- `rotate_prekey` snapshots the roster into `$ONIONWIRE_HOME/invite-stale`
(derived local state; no store schema change, no wire field, no new crate).
`Node::invite_stale(pk)` / `invite_stale_friends()` answer the question, and
an install that never rotated has no file and nothing marked.
- `Node::send` and `Node::send_once` fail closed with `invite stale` for a
pre-rotation friend instead of silently re-bootstrapping past the cut.
- The roster gains its own `invite stale` word and colour token (violet; `stale`
keeps meaning "the last dial did not answer"), and the alert row above the
panes carries `invite stale -- F2 to share your new invite, they F3-paste it`,
recomputed every draw so F3-pasting an invite for that friend clears it.
- `add_friend_payload` removes the pubkey from the set, which is the test the
card asks for; docs/TUI.md documents the marker.
This makes the existing hard cut legible. It does not add in-band revocation or
a soft rotation; the threat model's hard-cut wording stays as it is.
2026-10-22 23:38:30 -04:00
/// F8 invalidates every friend's stored copy of our invite. That is a different
/// fact from "the last dial did not answer": the roster needs its own word, its
/// own colour token, and it must not borrow `stale` for it.
#[ test ]
fn an_invite_stale_friend_is_marked_apart_from_a_dial_stale_one ( ) {
let row = FriendRow {
label : " alice " . into ( ) ,
fingerprint : " aaaaaaaaaaaaaaaa " . into ( ) ,
stale : false ,
invite_stale : false ,
pq : true ,
} ;
let invite = FriendRow {
invite_stale : true ,
.. row . clone ( )
} ;
let dial = FriendRow {
stale : true ,
.. row . clone ( )
} ;
let text = | r : & FriendRow | -> String {
roster_line ( r , 40 )
. spans
. iter ( )
. map ( | s | s . content . clone ( ) )
. collect ( )
} ;
let invite_text = text ( & invite ) ;
assert! (
invite_text . contains ( " invite stale " ) ,
" a pre-rotation friend must say so in words: {invite_text:?} "
) ;
let dial_text = text ( & dial ) ;
assert! (
! dial_text . contains ( " invite stale " ) ,
" a failed dial keeps the old marker and only that: {dial_text:?} "
) ;
assert! ( dial_text . contains ( " stale " ) , " {dial_text:?} " ) ;
let invite_style = roster_line ( & invite , 40 ) . spans [ 0 ] . style ;
let tokens = tokens_for ( color_mode ( ) ) ;
assert_eq! (
invite_style , tokens . invite_stale ,
" invite staleness owns a colour token, not the dial-stale one "
) ;
assert_ne! ( tokens . invite_stale , tokens . stale ) ;
}
/// The hint has to render in the same place as the fingerprint mismatch banner
/// (the fail-closed alert row above the panes) and fit 80 columns.
#[ test ]
fn the_invite_stale_hint_renders_above_the_panes_at_80_columns ( ) {
let hint = invite_stale_banner ( ) ;
assert! (
cell_width ( hint ) < = 80 ,
" the hint must fit 80 columns: {hint:?} is {} " ,
cell_width ( hint )
) ;
assert! ( hint . contains ( " invite stale " ) , " {hint:?} " ) ;
assert! (
hint . contains ( " F2 " ) & & hint . contains ( " F3 " ) ,
" the hint must point at sharing and re-pasting an invite: {hint:?} "
) ;
let friends = vec! [
FriendRow {
label : " alice " . into ( ) ,
fingerprint : " aaaaaaaaaaaaaaaa " . into ( ) ,
stale : false ,
invite_stale : true ,
pq : true ,
} ,
FriendRow {
label : " bob " . into ( ) ,
fingerprint : " bbbbbbbbbbbbbbbb " . into ( ) ,
stale : false ,
invite_stale : false ,
pq : true ,
} ,
] ;
let chat = vec! [ " hi " . to_string ( ) ] ;
let draw = | w : u16 , h : u16 | {
draw_frame ( w , h , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Ready ) ,
friends : & friends ,
selected : 1 ,
focus : Pane ::Chat ,
chat_lines : & chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : Some ( hint ) ,
note : None ,
} ,
)
} )
} ;
// 80x24 is the audit size every rendered row must survive.
let narrow = draw ( 80 , 24 ) ;
let narrow_screen = screen_of ( & narrow , 80 , 24 ) ;
for line in narrow_screen . lines ( ) . filter ( | l | l . contains ( " invite " ) ) {
println! ( " 80-col line ( {} cells): {line:?} " , cell_width ( line ) ) ;
}
assert! (
narrow_screen . lines ( ) . nth ( 1 ) . unwrap_or_default ( ) . contains ( " invite stale " ) ,
" the hint belongs in the alert row: {narrow_screen} "
) ;
let wide = draw ( 120 , 40 ) ;
let wide_screen = screen_of ( & wide , 120 , 40 ) ;
assert! (
wide_screen . contains ( " alice invite stale " ) ,
" the row itself must carry the marker: {wide_screen} "
) ;
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
fn out_msg ( id : i64 , body : & str ) -> Message {
Message {
id ,
dir : " out " . into ( ) ,
plaintext : body . as_bytes ( ) . to_vec ( ) ,
2026-09-11 23:52:05 -04:00
}
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
fn in_msg ( id : i64 , body : & str ) -> Message {
Message {
id ,
dir : " in " . into ( ) ,
plaintext : body . as_bytes ( ) . to_vec ( ) ,
}
2026-09-11 23:52:05 -04:00
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
fn queued_row ( message_id : i64 , body : & str , attempts : u32 , next_in : i64 , now : i64 ) -> OutboxEntry {
OutboxEntry {
id : 1 ,
friend_pk : vec ! [ 9 u8 ; 32 ] ,
message_id ,
body : body . as_bytes ( ) . to_vec ( ) ,
payload : None ,
attempts ,
next_attempt_at : now + next_in ,
created_at : now ,
status : OutboxStatus ::Queued ,
last_error : None ,
}
2026-09-11 23:52:05 -04:00
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
/// Transcript rows through the real helper: markers included.
fn chat_ok ( ) -> Vec < String > {
let msgs = [ out_msg ( 1 , " ping " ) , in_msg ( 2 , " pong " ) , in_msg ( 3 , LONG_BODY ) ] ;
chat_with_delivery ( & msgs , & [ ] , 1000 ) . 0
2026-09-11 23:52:05 -04:00
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
/// Transcript with one row still held by the outbox, so the footer carries the
/// reachability note instead of a bare `sent`.
fn chat_queued ( ) -> ( Vec < String > , String ) {
let now = 1000 ;
let msgs = [ out_msg ( 1 , " ping " ) , in_msg ( 2 , " pong " ) , out_msg ( 3 , " are you there? " ) ] ;
let pending = [ queued_row ( 3 , " are you there? " , 1 , 45 , now ) ] ;
let ( lines , summary ) = chat_with_delivery ( & msgs , & pending , now ) ;
( lines , summary . note ( ) . unwrap_or_default ( ) )
}
fn empty_chat ( phase : TorPhase ) -> Vec < String > {
chat_no_friends_lines ( Some ( phase ) )
2026-09-11 23:52:05 -04:00
}
#[ test ]
fn dump_audit_frames ( ) {
transport: ML-KEM-768 hybrid prelude and onionwire:v2 invites
Adds an ML-KEM-768 install key beside the ed25519 identity and x25519
prekey. A friend added from a v2 invite always gets a version-2 PQ
prelude before Noise msg 1, and both sides bind (ct, ss_kem) into the
Noise prologue (onionwire-v2 \0 ct \0 ss_kem). The row decides: a
kem_pk friend without a prelude is rejected with 'prelude required',
a prelude for a classical row with 'unexpected prelude'.
Invites are now onionwire:v2 with kem=<base64url pk>; decode still
accepts v1 (no kem) and yields a classical friend. F8 rotates the
KEM key with the prekey and hard-cuts stored ratchet state. The TUI
labels a legacy friend 'classical'.
Docs: PROTOCOL (keys, framing, prologues, no-downgrade, invite v2),
THREAT_MODEL (what PQ transport does and does not buy; epoch 0 stays
classical), README (invite size, F8, legacy caveat). SDK exposes pq on
InviteInfo/FriendInfo and gains a v2 decode round-trip test.
2026-10-20 11:15:46 -04:00
let invite = qr ::encode ( & [ 7 u8 ; 32 ] , ONION , & [ 1 u8 ; 32 ] , & [ 9 u8 ; 1184 ] ) . expect ( " encode " ) ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
let friends = friend_rows ( ) ;
let chat = chat_ok ( ) ;
let ( queued_chat , queued_note ) = chat_queued ( ) ;
2026-09-11 23:52:05 -04:00
let editor = ProfileEditor ::new ( " lance " , " tor messenger " , " " ) ;
let profile_body = {
let labels = [ " name " , " bio " , " xmr " ] ;
let values = [ editor . display_name ( ) , editor . bio ( ) , editor . xmr_addr ( ) ] ;
let mut body = String ::from (
" Your profile (friend-visible) \n Enter saves Esc cancels Tab next field \n " ,
) ;
for ( i , ( label , value ) ) in labels . iter ( ) . zip ( values ) . enumerate ( ) {
let mark = if editor . field ( ) = = i { " > " } else { " " } ;
body . push_str ( & format! ( " \n {mark} {label} : {value} " ) ) ;
}
body
} ;
let who = who_overlay_text (
FP ,
ONION ,
Some ( & FriendProfile {
display_name : " alice " . into ( ) ,
bio : " hi " . into ( ) ,
xmr_addr : String ::new ( ) ,
updated_at : 0 ,
} ) ,
) ;
println! ( " invite payload length (chars) = {} " , invite . chars ( ) . count ( ) ) ;
println! ( " wordmark: \n {} " , wordmark_banner ( ) ) ;
println! ( " compact: {} " , compact_banner ( ) ) ;
println! ( " onion_glyph: \n {} " , onion_glyph ( ) ) ;
println! (
" fingerprint_mismatch_banner: {} " ,
fingerprint_mismatch_banner ( )
) ;
for ( w , h ) in SIZES {
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
draw_to ( w , h , " chrome banner+footer (real helpers) " , | f | {
2026-09-11 23:52:05 -04:00
let banner = banner_for_width ( f . area ( ) . width ) ;
let banner_h = banner . lines ( ) . count ( ) as u16 ;
let chunks = Layout ::vertical ( [
Constraint ::Length ( banner_h ) ,
Constraint ::Min ( 3 ) ,
Constraint ::Length ( 1 ) ,
] )
. split ( f . area ( ) ) ;
f . render_widget ( Paragraph ::new ( banner ) , chunks [ 0 ] ) ;
let footer = status_footer ( f . area ( ) . width , FP , ONION , None , main_footer_hints ( ) ) ;
f . render_widget ( Paragraph ::new ( footer ) , chunks [ 2 ] ) ;
} ) ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
draw_to ( w , h , " main: chat + stale roster, focus chat, tor ready " , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Ready ) ,
friends : & friends ,
selected : 0 ,
focus : Pane ::Chat ,
chat_lines : & chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : None ,
} ,
2026-09-11 23:52:05 -04:00
) ;
} ) ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
draw_to ( w , h , " main: focus roster, tor connecting " , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Connecting ) ,
friends : & friends ,
selected : 1 ,
focus : Pane ::Roster ,
chat_lines : & chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " bob-the-stale-peer " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : None ,
} ,
) ;
2026-09-11 23:52:05 -04:00
} ) ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
draw_to ( w , h , " main: focus composer, promoted identity " , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Degraded ) ,
friends : & friends ,
selected : 0 ,
focus : Pane ::Composer ,
chat_lines : & chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " hello from composer " ,
alert : None ,
note : None ,
} ,
) ;
2026-09-11 23:52:05 -04:00
} ) ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
draw_to ( w , h , " main: EMPTY roster, tor connecting " , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Connecting ) ,
friends : & [ ] ,
selected : 0 ,
focus : Pane ::Roster ,
chat_lines : & empty_chat ( TorPhase ::Connecting ) ,
chat_style : ChatRowStyle ::State ,
chat_name : None ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : None ,
} ,
) ;
2026-09-11 23:52:05 -04:00
} ) ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
draw_to ( w , h , " main: EMPTY roster, tor off (disconnected) " , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : " " ,
phase : Some ( TorPhase ::Off ) ,
friends : & [ ] ,
selected : 0 ,
focus : Pane ::Roster ,
chat_lines : & empty_chat ( TorPhase ::Off ) ,
chat_style : ChatRowStyle ::State ,
chat_name : None ,
chat_scroll : 0 ,
composer : " " ,
alert : Some ( " fingerprint mismatch " ) ,
note : None ,
} ,
) ;
} ) ;
draw_to ( w , h , " main: ERROR alert + fail-closed note " , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Degraded ) ,
friends : & friends ,
selected : 0 ,
focus : Pane ::Composer ,
chat_lines : & chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : Some ( " send failed: peer onion down " ) ,
note : Some ( " send failed: peer onion down " ) ,
} ,
) ;
} ) ;
draw_to ( w , h , " main: outbox queued (peer unreachable) " , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Ready ) ,
friends : & friends ,
selected : 0 ,
focus : Pane ::Roster ,
chat_lines : & queued_chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : Some ( & queued_note ) ,
} ,
) ;
2026-09-11 23:52:05 -04:00
} ) ;
draw_to ( w , h , " draw_share (real) " , | f | draw_share ( f , & invite ) ) ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
draw_to ( w , h , " main + ? help overlay (real draw_text_overlay) " , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Ready ) ,
friends : & friends ,
selected : 0 ,
focus : Pane ::Chat ,
chat_lines : & chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : None ,
} ,
) ;
draw_text_overlay ( f , " ? help " , help_overlay_text ( ) ) ;
2026-09-11 23:52:05 -04:00
} ) ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
draw_to ( w , h , " main + /who overlay (real draw_text_overlay) " , | f | {
draw_text_overlay ( f , " /who " , & who ) ;
2026-09-11 23:52:05 -04:00
} ) ;
draw_to ( w , h , " RECONSTRUCTED profile " , | f | {
draw_overlay_screen ( f , " (o) profile " , & profile_body ) ;
} ) ;
draw_to ( w , h , " RECONSTRUCTED paste " , | f | {
draw_overlay_screen (
f ,
" (o) paste invite " ,
& format! ( " paste onionwire:v1 payload, Enter to submit \n \n {invite} " ) ,
) ;
} ) ;
draw_to ( w , h , " RECONSTRUCTED paste error " , | f | {
draw_overlay_screen ( f , " (o) paste invite " , " bad invite \n \n not-a-payload " ) ;
} ) ;
draw_to ( w , h , " RECONSTRUCTED approve " , | f | {
draw_overlay_screen (
f ,
" (o) approve " ,
& format! (
" Unknown key. Add this friend? \n \n fp {}… \n onion {ONION} \n \n y accept n / Esc reject " ,
fp8 ( FP )
) ,
) ;
} ) ;
draw_to ( w , h , " RECONSTRUCTED rotate " , | f | {
draw_overlay_screen (
f ,
" (o) rotate locator " ,
& format! ( " {} \n \n ROT " , rotate_screen_text ( ) ) ,
) ;
} ) ;
draw_to ( w , h , " RECONSTRUCTED wipe " , | f | {
draw_overlay_screen (
f ,
" (o) wipe " ,
& format! ( " {} \n \n WI " , wipe_screen_text ( WipeKind ::Messages ) ) ,
) ;
} ) ;
draw_to ( w , h , " RECONSTRUCTED quit " , | f | {
draw_overlay_screen ( f , " (o) quit " , & format! ( " {} \n \n QUI " , quit_screen_text ( ) ) ) ;
} ) ;
draw_to ( w , h , " RECONSTRUCTED backup " , | f | {
draw_overlay_screen (
f ,
" (o) backup " ,
& format! ( " {} \n \n BACK " , backup_screen_text ( ) ) ,
) ;
} ) ;
draw_to ( w , h , " RECONSTRUCTED restore " , | f | {
draw_overlay_screen ( f , " (o) restore " , & format! ( " {} \n \n " , restore_screen_text ( ) ) ) ;
} ) ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
}
}
fn draw_overlay_screen ( f : & mut Frame , title : & str , body : & str ) {
f . render_widget (
Paragraph ::new ( body )
. wrap ( Wrap { trim : false } )
. block ( Block ::default ( ) . borders ( Borders ::ALL ) . title ( title ) ) ,
f . area ( ) ,
) ;
}
/// Every real main-screen state must fit every supported size in cells.
#[ test ]
fn main_chrome_fits_80x24_120x40_and_200x60 ( ) {
let friends = friend_rows ( ) ;
let chat = chat_ok ( ) ;
let ( queued_chat , queued_note ) = chat_queued ( ) ;
let empty_connecting = empty_chat ( TorPhase ::Connecting ) ;
let states : Vec < ( & str , MainView < '_ > , Option < & str > ) > = vec! [ (
" chat+stale " ,
MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Ready ) ,
friends : & friends ,
selected : 0 ,
focus : Pane ::Chat ,
chat_lines : & chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : None ,
} ,
None ,
) ,
(
" empty+connecting " ,
MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Connecting ) ,
friends : & [ ] ,
selected : 0 ,
focus : Pane ::Roster ,
chat_lines : & empty_connecting ,
chat_style : ChatRowStyle ::State ,
chat_name : None ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : None ,
} ,
None ,
) ,
(
" error+alert " ,
MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Degraded ) ,
friends : & friends ,
selected : 0 ,
focus : Pane ::Composer ,
chat_lines : & chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : Some ( " send failed: peer onion down " ) ,
note : Some ( " send failed: peer onion down " ) ,
} ,
None ,
) ,
(
" queued outbox " ,
MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Ready ) ,
friends : & friends ,
selected : 0 ,
focus : Pane ::Roster ,
chat_lines : & queued_chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : Some ( & queued_note ) ,
} ,
None ,
) ,
] ;
for ( name , view , _ ) in states {
for ( w , h ) in SIZES {
let buf = draw_frame ( w , h , | f | draw_main_chrome ( f , & view ) ) ;
let screen = screen_of ( & buf , w , h ) ;
for ( y , row ) in screen . lines ( ) . enumerate ( ) {
assert! (
cell_width ( row ) < = w as usize ,
" {name} at {w}x{h}: row {y} is {} cells: {row:?} " ,
cell_width ( row )
) ;
}
}
}
}
/// The frame dump must show the phase, and the phase must not be colour-only.
#[ test ]
fn main_frame_states_are_legible_without_colour ( ) {
let friends = friend_rows ( ) ;
let chat = chat_ok ( ) ;
for ( phase , word ) in [
( TorPhase ::Connecting , " connecting " ) ,
( TorPhase ::Ready , " ready " ) ,
( TorPhase ::Degraded , " degraded " ) ,
( TorPhase ::Off , " off " ) ,
] {
let buf = draw_frame ( 80 , 24 , | f | {
draw_main_chrome (
2026-09-11 23:52:05 -04:00
f ,
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( phase ) ,
friends : & friends ,
selected : 0 ,
focus : Pane ::Chat ,
chat_lines : & chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : None ,
} ,
)
2026-09-11 23:52:05 -04:00
} ) ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
let screen = screen_of ( & buf , 80 , 24 ) ;
let header = screen . lines ( ) . next ( ) . unwrap_or_default ( ) . to_string ( ) ;
let footer = screen . lines ( ) . last ( ) . unwrap_or_default ( ) . to_string ( ) ;
assert! ( header . contains ( word ) , " header lacks {word:?}: {header:?} " ) ;
assert! ( footer . contains ( word ) , " footer lacks {word:?}: {footer:?} " ) ;
assert! ( header . contains ( " onionwire " ) , " {header:?} " ) ;
assert! ( footer . contains ( " TOR " ) , " {footer:?} " ) ;
}
}
/// Focus must be visible with the colour stripped: a marker on the focused
/// pane, not just a coloured border.
#[ test ]
fn focus_is_a_marker_not_only_colour ( ) {
let friends = friend_rows ( ) ;
let chat = chat_ok ( ) ;
let marker_of = | focus : Pane , w : u16 | -> String {
let buf = draw_frame ( w , 24 , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Ready ) ,
friends : & friends ,
selected : 0 ,
focus ,
chat_lines : & chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : None ,
} ,
)
2026-09-11 23:52:05 -04:00
} ) ;
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
screen_of ( & buf , w , 24 )
} ;
for w in [ 80 u16 , 120 ] {
let roster_focus = marker_of ( Pane ::Roster , w ) ;
let chat_focus = marker_of ( Pane ::Chat , w ) ;
assert! (
roster_focus . contains ( " > alice " ) ,
" roster focus has no row marker at {w}: {roster_focus} "
) ;
assert! (
chat_focus . contains ( " > chat " ) ,
" chat focus has no title marker at {w} "
) ;
assert! (
! roster_focus . contains ( " > chat " ) ,
" chat title keeps the focus marker while roster is focused "
) ;
assert_eq! (
roster_focus . lines ( ) . count ( ) ,
24 ,
" frame height changed with focus "
) ;
2026-09-11 23:52:05 -04:00
}
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
/// The empty roster is a state, not a blank box.
#[ test ]
fn empty_roster_and_empty_chat_are_designed_states ( ) {
let buf = draw_frame ( 80 , 24 , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Connecting ) ,
friends : & [ ] ,
selected : 0 ,
focus : Pane ::Roster ,
chat_lines : & empty_chat ( TorPhase ::Connecting ) ,
chat_style : ChatRowStyle ::State ,
chat_name : None ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : None ,
} ,
)
} ) ;
let screen = screen_of ( & buf , 80 , 24 ) ;
assert! ( screen . contains ( " no friends " ) , " {screen} " ) ;
assert! ( screen . contains ( " F3 adds one " ) , " {screen} " ) ;
assert! ( screen . contains ( " F3 paste an invite " ) , " {screen} " ) ;
assert! (
screen . contains ( " tor connecting " ) ,
" connecting state is not on screen: \n {screen} "
) ;
}
2026-09-11 23:52:05 -04:00
#[ test ]
fn public_copy_fits_80_by_chars_count ( ) {
for ( name , text ) in [
( " wordmark " , wordmark_banner ( ) ) ,
( " help " , help_overlay_text ( ) ) ,
( " rotate " , rotate_screen_text ( ) ) ,
( " quit " , quit_screen_text ( ) ) ,
( " wipe " , wipe_screen_text ( WipeKind ::Messages ) ) ,
( " wipe-all " , wipe_screen_text ( WipeKind ::All ) ) ,
( " backup " , backup_screen_text ( ) ) ,
( " restore " , restore_screen_text ( ) ) ,
] {
for line in text . lines ( ) {
assert! (
line . chars ( ) . count ( ) < = 80 ,
" {name} line exceeds 80 by chars().count(): {line:?} "
) ;
}
}
assert! ( compact_banner ( ) . chars ( ) . count ( ) < = 40 ) ;
assert! ( ! onion_glyph ( ) . is_empty ( ) ) ;
assert_eq! ( fingerprint_mismatch_banner ( ) , " fingerprint mismatch " ) ;
}
#[ test ]
fn footer_drops_full_onion_at_80_keeps_it_at_120 ( ) {
let at_80 = status_footer ( 80 , FP , ONION , None , main_footer_hints ( ) ) ;
let at_120 = status_footer ( 120 , FP , ONION , None , main_footer_hints ( ) ) ;
let at_200 = status_footer ( 200 , FP , ONION , None , main_footer_hints ( ) ) ;
assert! ( at_80 . chars ( ) . count ( ) < = 80 , " {at_80:?} " ) ;
assert! ( at_120 . chars ( ) . count ( ) < = 120 , " {at_120:?} " ) ;
assert! ( at_200 . chars ( ) . count ( ) < = 200 , " {at_200:?} " ) ;
assert! (
! at_80 . contains ( ONION ) ,
" 80-col footer should truncate onion: {at_80} "
) ;
assert! (
at_120 . contains ( ONION ) ,
" 120-col footer should keep full onion: {at_120} "
) ;
assert! ( at_80 . contains ( " ? help " ) & & at_120 . contains ( " ? help " ) ) ;
}
2026-09-12 00:22:04 -04:00
/// Spec: never drop `send failed`. Keep `TOR` / `me:` / `? help` at 80 and 120.
2026-09-11 23:52:05 -04:00
#[ test ]
fn status_footer_drops_send_failed_when_crowded ( ) {
let note = " send failed: peer onion down " ;
2026-09-12 00:22:04 -04:00
for ( w , line ) in [
(
80 u16 ,
status_footer ( 80 , FP , ONION , Some ( note ) , main_footer_hints ( ) ) ,
) ,
(
120 ,
status_footer ( 120 , FP , ONION , Some ( note ) , main_footer_hints ( ) ) ,
) ,
(
200 ,
status_footer ( 200 , FP , ONION , Some ( note ) , main_footer_hints ( ) ) ,
) ,
] {
assert! (
line . chars ( ) . count ( ) < = w as usize ,
" {w} footer wider than frame: {} {line:?} " ,
line . chars ( ) . count ( )
) ;
assert! (
line . contains ( " send failed " ) ,
" {w} dropped fail-closed note: {line:?} "
) ;
assert! ( line . contains ( " TOR " ) , " {w} missing TOR: {line:?} " ) ;
assert! ( line . contains ( " me: " ) , " {w} missing me:: {line:?} " ) ;
assert! ( line . contains ( " ? help " ) , " {w} missing ? help: {line:?} " ) ;
}
2026-09-11 23:52:05 -04:00
}
#[ test ]
fn share_invite_wraps_at_three_sizes ( ) {
transport: ML-KEM-768 hybrid prelude and onionwire:v2 invites
Adds an ML-KEM-768 install key beside the ed25519 identity and x25519
prekey. A friend added from a v2 invite always gets a version-2 PQ
prelude before Noise msg 1, and both sides bind (ct, ss_kem) into the
Noise prologue (onionwire-v2 \0 ct \0 ss_kem). The row decides: a
kem_pk friend without a prelude is rejected with 'prelude required',
a prelude for a classical row with 'unexpected prelude'.
Invites are now onionwire:v2 with kem=<base64url pk>; decode still
accepts v1 (no kem) and yields a classical friend. F8 rotates the
KEM key with the prekey and hard-cuts stored ratchet state. The TUI
labels a legacy friend 'classical'.
Docs: PROTOCOL (keys, framing, prologues, no-downgrade, invite v2),
THREAT_MODEL (what PQ transport does and does not buy; epoch 0 stays
classical), README (invite size, F8, legacy caveat). SDK exposes pq on
InviteInfo/FriendInfo and gains a v2 decode round-trip test.
2026-10-20 11:15:46 -04:00
let invite = qr ::encode ( & [ 7 u8 ; 32 ] , ONION , & [ 1 u8 ; 32 ] , & [ 9 u8 ; 1184 ] ) . expect ( " encode " ) ;
2026-09-11 23:52:05 -04:00
for ( w , h ) in SIZES {
let backend = TestBackend ::new ( w , h ) ;
let mut terminal = Terminal ::new ( backend ) . expect ( " terminal " ) ;
terminal . draw ( | f | draw_share ( f , & invite ) ) . expect ( " draw " ) ;
let buf = terminal . backend ( ) . buffer ( ) ;
let mut screen = String ::new ( ) ;
for y in 0 .. h {
for x in 0 .. w {
screen . push_str ( buf [ ( x , y ) ] . symbol ( ) ) ;
}
screen . push ( '\n' ) ;
}
transport: ML-KEM-768 hybrid prelude and onionwire:v2 invites
Adds an ML-KEM-768 install key beside the ed25519 identity and x25519
prekey. A friend added from a v2 invite always gets a version-2 PQ
prelude before Noise msg 1, and both sides bind (ct, ss_kem) into the
Noise prologue (onionwire-v2 \0 ct \0 ss_kem). The row decides: a
kem_pk friend without a prelude is rejected with 'prelude required',
a prelude for a classical row with 'unexpected prelude'.
Invites are now onionwire:v2 with kem=<base64url pk>; decode still
accepts v1 (no kem) and yields a classical friend. F8 rotates the
KEM key with the prekey and hard-cuts stored ratchet state. The TUI
labels a legacy friend 'classical'.
Docs: PROTOCOL (keys, framing, prologues, no-downgrade, invite v2),
THREAT_MODEL (what PQ transport does and does not buy; epoch 0 stays
classical), README (invite size, F8, legacy caveat). SDK exposes pq on
InviteInfo/FriendInfo and gains a v2 decode round-trip test.
2026-10-20 11:15:46 -04:00
assert! ( screen . contains ( " onionwire:v2: " ) , " {w}x{h} \n {screen} " ) ;
2026-09-11 23:52:05 -04:00
assert! ( screen . contains ( " (o) invite " ) , " {w}x{h} \n {screen} " ) ;
}
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
/// The help overlay is cleared underneath and never wider than the frame.
#[ test ]
fn help_overlay_keeps_a_margin_and_shows_the_tail ( ) {
for ( w , h ) in SIZES {
let buf = draw_frame ( w , h , | f | {
f . render_widget ( Paragraph ::new ( " underlying frame junk " ) , f . area ( ) ) ;
draw_text_overlay ( f , " ? help " , help_overlay_text ( ) ) ;
} ) ;
let screen = screen_of ( & buf , w , h ) ;
assert! (
! screen . contains ( " underlying frame junk " ) ,
" {w}x{h} overlay punched through: \n {screen} "
) ;
assert! (
screen . contains ( " Esc closes this overlay " ) ,
" {w}x{h} help tail clipped "
) ;
// A one-cell margin on each side: no border glyph in column 0.
for line in screen . lines ( ) {
let first = line . chars ( ) . next ( ) . unwrap_or ( ' ' ) ;
assert! (
first ! = '┌' & & first ! = '│' ,
" {w}x{h} overlay is full-bleed: {line:?} "
) ;
}
}
}
2026-09-11 23:52:05 -04:00
/// Documented defect in `tests/tui_chrome.rs`: `chars().count()` is not cells.
/// Do not add `unicode-width` on this card.
#[ test ]
fn chars_count_is_not_terminal_cells ( ) {
let cjk = " 你好 " ;
assert_eq! ( cjk . chars ( ) . count ( ) , 2 , " CJK under-counts vs 4 wide cells " ) ;
let combining = " e \u{0301} " ;
assert_eq! (
combining . chars ( ) . count ( ) ,
2 ,
" combining mark over-counts vs 1 cell "
) ;
let emoji = " 🧅 " ;
assert_eq! ( emoji . chars ( ) . count ( ) , 1 , " emoji under-counts vs 2 cells " ) ;
let ellipsis = " … " ;
assert_eq! ( ellipsis . chars ( ) . count ( ) , 1 ) ;
}
tui: clean-look chrome redesign (one accent, honest tor phase, real frames)
Applies the bitchat-tui clean-look principles to the OnionWire main screen.
- Hierarchy: header, roster + one primary chat pane, one status line, one
footer hint line. The header gives up the accent (the accent is reserved
for focus), so it stops competing with the panes.
- Tor phase is a first-class state: Node::tor_state() -> TorPhase (glyph +
word, header and footer) so connecting / ready / degraded / off are never
colour-only and never implied. No new data field.
- Footer changes with the focused pane (pane_footer_hints) and the phase; the
main footer drops the redundant onion (the header already prints it) and
uses those cells for hints. status_footer keeps its signature and strings.
- Empty roster / empty chat / connecting / degraded / off are designed states
with their own copy, not blank panes.
- draw_main_chrome + MainView: the real main render path is public and
Node-free, so tests/tui_frames.rs dumps the actual chrome at 80x24, 120x40
and 200x60 (12 tests, 5 states, real Message/OutboxEntry rows) instead of a
reconstructed stand-in.
- Widths in cells everywhere touched: status_footer*, alert_line,
main_header_line*, draw_text_overlay, roster_row_text. The roster spends its
budget name-first, so a 22-cell pane reads `bob-the-sta… stale` instead of
`… bbbbbbbb… stale`.
- draw_text_overlay is centered with a one-cell side margin and clears
underneath; never full-bleed.
Also fixes a pre-existing race in tests/tui_spec.rs (the ellipsis-form
assertion did not tolerate ONIONWIRE_ASCII being set by a parallel test).
Co-Authored-By: Hermes <[email protected] >
2026-09-18 23:13:12 -04:00
/// Sanity: the real main renderer is the one under test here.
#[ test ]
fn main_chrome_draws_the_same_frame_as_the_app_layout ( ) {
let friends = friend_rows ( ) ;
let chat = chat_ok ( ) ;
let buf = draw_frame ( 80 , 24 , | f | {
draw_main_chrome (
f ,
& MainView {
me_fp : FP ,
me_onion : ONION ,
phase : Some ( TorPhase ::Ready ) ,
friends : & friends ,
selected : 0 ,
focus : Pane ::Chat ,
chat_lines : & chat ,
chat_style : ChatRowStyle ::Text ,
chat_name : Some ( " alice " ) ,
chat_scroll : 0 ,
composer : " " ,
alert : None ,
note : None ,
} ,
)
} ) ;
let screen = screen_of ( & buf , 80 , 24 ) ;
assert! ( screen . contains ( " roster 2 1 stale " ) , " {screen} " ) ;
assert! ( screen . contains ( " > chat alice " ) , " {screen} " ) ;
assert! ( screen . contains ( " message " ) , " composer placeholder: {screen} " ) ;
}