EMRY-021: TUI 4-pane dashboard (ratatui) - #63
Merged
Merged
Conversation
UiState: pure reducer over the event stream (per-metric history, phase, progress, capped alerts, selection, pause). render() draws the 4 panes (header / metric cards / braille chart / alert strip) in the warm palette into any ratatui Backend, so it's tested via TestBackend. app::run is the channel- driven loop (drain bus + input, ~15Hz cap); run_terminal is the thin real- terminal shell; map_key binds q/Esc, 1-4, p. examples/tui_demo.rs streams a synthetic run to the dashboard. Pinned instability 0.3.7 / darling 0.20.11 so ratatui 0.29 builds on the project's rustc 1.87 (newer transitive versions require 1.88).
… history - read_keys uses a bounded(64) channel + try_send (dropping keys under flood), honoring the no-unbounded-channel project invariant. - run no longer auto-exits UntilQuit on finish (removes a drain/is_empty TOCTOU and keeps the dashboard up after a run so final values stay readable; exit on Quit only). - Pausing now skips terminal.draw so the display actually freezes (state still updates underneath). - MetricView.history is a VecDeque: O(1) FIFO instead of Vec::remove(0) O(n) shift on the 4096-cap history; converted to a slice at render time. - Refresh the metric label each sample so seeded labels aren't stale.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ratatuiBackend.app.rs—run: channel-driven loop (drain bus + input, ~15 Hz cap, pause freezes the display);map_keybindsq/Esc/1–4/p;run_terminalis the thin real-terminal shell.examples/tui_demo.rs— streams a synthetic engine run to the dashboard.Verification
./scripts/pre-commit-rust.shgreen: clippy-D warnings, 27 tui tests, total 96.5% lines.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).cargo run -p emry-tui --example tui_demo)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
unbounded()input channel →bounded(64)+try_send(honors the project's no-unbounded-channel invariant).UntilQuitfinish-and-drained auto-exit — closes a drain/is_emptyTOCTOU and is better UX (dashboard stays up post-run).Vec::remove(0)O(n) on 4096-cap history →VecDequeO(1) FIFO.draw(display freezes).Scope
EMA/throughput/ETA derived series in the dashboard → EMRY-022.
emry demo/tuiCLI wiring → EMRY-025.