EMRY-021: TUI 4-pane dashboard (ratatui) #63

Merged
vxfemboy merged 2 commits from emry-021-tui-app into main 2026-06-25 11:25:25 +00:00
vxfemboy commented 2026-06-25 04:45:08 +00:00 (Migrated from github.com)

Closes EMRY-021 (#16). Branched off main.

What

  • ui.rsUiState: a pure reducer over the event stream (per-metric history, phase, progress, capped alerts, selection, pause). render() draws the 4 panes (header+progress / metric cards / braille chart / alert strip) in the warm palette into any ratatui Backend.
  • app.rsrun: channel-driven loop (drain bus + input, ~15 Hz cap, pause freezes the display); map_key binds q/Esc/14/p; run_terminal is the thin real-terminal shell.
  • examples/tui_demo.rs — streams a synthetic engine run to the dashboard.

Verification

  • ./scripts/pre-commit-rust.sh green: clippy -D warnings, 27 tui tests, total 96.5% lines.
  • Rendering is verified headlessly via TestBackend: a test renders a populated state and asserts the buffer contains the project name, metric label, and alert text. The render loop, state reducer, and key mapping are all covered; only the real-terminal shell (raw mode + blocking key read) is uncovered (that's the part that needs a TTY).
  • The live animated curve (cargo run -p emry-tui --example tui_demo)
    image

MSRV note

ratatui 0.29's newest transitive deps (instability/darling) require rustc 1.88; I pinned them down (instability 0.3.7 / darling 0.20.11) so the project stays on its pinned 1.87. (Committed in Cargo.lock.)

Review-driven fixes

  1. unbounded() input channel → bounded(64) + try_send (honors the project's no-unbounded-channel invariant).
  2. Removed the UntilQuit finish-and-drained auto-exit — closes a drain/is_empty TOCTOU and is better UX (dashboard stays up post-run).
  3. Vec::remove(0) O(n) on 4096-cap history → VecDeque O(1) FIFO.
  4. Pause now actually skips draw (display freezes).
  5. Metric label refreshed each sample (no stale fallback labels).

Scope

EMA/throughput/ETA derived series in the dashboard → EMRY-022. emry demo/tui CLI wiring → EMRY-025.

Closes EMRY-021 (#16). Branched off `main`. ## What - `ui.rs` — `UiState`: a pure reducer over the event stream (per-metric history, phase, progress, capped alerts, selection, pause). `render()` draws the 4 panes (header+progress / metric cards / braille chart / alert strip) in the warm palette into **any** ratatui `Backend`. - `app.rs` — `run`: channel-driven loop (drain bus + input, ~15 Hz cap, pause freezes the display); `map_key` binds `q`/`Esc`/`1`–`4`/`p`; `run_terminal` is the thin real-terminal shell. - `examples/tui_demo.rs` — streams a synthetic engine run to the dashboard. ## Verification - `./scripts/pre-commit-rust.sh` green: clippy `-D warnings`, 27 tui tests, total **96.5%** lines. - **Rendering is verified headlessly** via `TestBackend`: a test renders a populated state and asserts the buffer contains the project name, metric label, and alert text. The render loop, state reducer, and key mapping are all covered; only the real-terminal shell (raw mode + blocking key read) is uncovered (that's the part that needs a TTY). - The **live animated curve** (`cargo run -p emry-tui --example tui_demo`) <img width="1155" height="717" alt="image" src="https://github.com/user-attachments/assets/15af8df5-5b6d-4174-8e48-5f1a43c00eb1" /> ## MSRV note ratatui 0.29's newest transitive deps (`instability`/`darling`) require rustc 1.88; I pinned them down (instability 0.3.7 / darling 0.20.11) so the project stays on its pinned **1.87**. (Committed in Cargo.lock.) ## Review-driven fixes 1. `unbounded()` input channel → `bounded(64)` + `try_send` (honors the project's no-unbounded-channel invariant). 2. Removed the `UntilQuit` finish-and-drained auto-exit — closes a drain/`is_empty` TOCTOU and is better UX (dashboard stays up post-run). 3. `Vec::remove(0)` O(n) on 4096-cap history → `VecDeque` O(1) FIFO. 4. Pause now actually skips `draw` (display freezes). 5. Metric label refreshed each sample (no stale fallback labels). ## Scope EMA/throughput/ETA derived series in the dashboard → EMRY-022. `emry demo`/`tui` CLI wiring → EMRY-025.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
femboy/emry!63
No description provided.