From 7f880ede2c1654ce248cb5a91e90b453a03000ae Mon Sep 17 00:00:00 2001 From: agent Date: Tue, 15 Sep 2026 21:37:30 -0400 Subject: [PATCH] tui(history): add F6 h needle + PR frame dump for hostile memo - Add 'F6 h' to tests/tui_chrome.rs needle list (help_overlay_text already documents the history binding; test must assert it) - Add dump_history_pr_frames to tests/tui_frames.rs: empty, mixed verified/unverified list, detail view, and hostile memo (C0 + bidi) at 80x24 and 120x40 Signed-off-by: tui-design --- tests/tui_chrome.rs | 1 + tests/tui_frames.rs | 58 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/tests/tui_chrome.rs b/tests/tui_chrome.rs index fee8951..d801956 100644 --- a/tests/tui_chrome.rs +++ b/tests/tui_chrome.rs @@ -46,6 +46,7 @@ fn help_overlay_lists_core_bindings() { "F4", "F5", "F6", + "F6 h", "F6 s", "F6 n", "F6 r", diff --git a/tests/tui_frames.rs b/tests/tui_frames.rs index 73d3b7e..825cf5b 100644 --- a/tests/tui_frames.rs +++ b/tests/tui_frames.rs @@ -1250,3 +1250,61 @@ fn dump_history_ascii_frames() { /// Lock for env-var-touching tests (mirrors tui_spec.rs pattern). static ASCII_ENV: std::sync::Mutex<()> = std::sync::Mutex::new(()); + +/// Dump history frames at 80x24 and 120x40 for PR-body evidence: +/// empty, mixed verified/unverified list, detail view, and a hostile memo +/// (C0 control chars + bidi override) rendered as inert text. +#[test] +fn dump_history_pr_frames() { + unsafe { std::env::remove_var("ONIONWIRE_ASCII"); } + unsafe { std::env::remove_var("NO_COLOR"); }; + let now = 1700000300i64; + let hostile = "pay\x01now\u{202E}reverse"; + let payments = vec![ + Payment { + id: 1, + dir: "out".into(), + kind: "tip".into(), + amount_atomic: "1000000000".into(), + address: "4AdYaG7wVQ3nHvWoXbN9dQkXj1uYcR2mS8pT5LzE6fK7gB3aD".into(), + memo: "coffee".into(), + txid: Some("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789".into()), + verified: true, + created_at: 1699999000, + }, + Payment { + id: 2, + dir: "in".into(), + kind: "payment".into(), + amount_atomic: "50000000000".into(), + address: String::new(), + memo: String::new(), + txid: Some("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".into()), + verified: true, + created_at: 1700000100, + }, + Payment { + id: 3, + dir: "out".into(), + kind: "invoice".into(), + amount_atomic: "500000000".into(), + address: String::new(), + memo: hostile.to_string(), + txid: None, + verified: false, + created_at: 1700000200, + }, + ]; + draw_to(80, 24, "history list (mixed verified/unverified)", |f| { + draw_history(f, &payments, 0, false, "alice", now); + }); + draw_to(80, 24, "history detail (hostile memo)", |f| { + draw_history(f, &payments, 2, true, "alice", now); + }); + draw_to(80, 24, "history empty", |f| { + draw_history(f, &[], 0, false, "bob", now); + }); + draw_to(120, 40, "history list (mixed)", |f| { + draw_history(f, &payments, 0, false, "alice", now); + }); +}