Repository navigation
Replace the live dashboard with a Textual TUI - #46
Merged
Merged
Conversation
`--ui live` is now a full-screen Textual app with tabs for the run, the survivors, every mutant, statistics and the log, driven by keyboard and mouse. Without Textual (the new `ui` extra) strain warns and prints plain output; the hand-drawn ANSI dashboard and key reader are gone. - Header: phase badge, score with its history, totals counting each mutant once, elapsed time, ETA and seconds per mutant. - Mutation map: one cell per mutant colored by result; hover names it, click shows it in the queue. - Run tab: syntax-highlighted diff, queue with per-mutant times that can be browsed while the run goes on, findings and the build log. - Survivors and Mutants tabs: list beside full details; Mutants filters by state. Stats tab: scores by file, operator and test, slowest mutants. - p pauses before the next mutant with sources unmutated; ctrl+c stops via the runner's KeyboardInterrupt path so sources are restored and reports written. Textual needs the main thread, so the runner runs on a worker thread and its console hooks update a thread-safe LiveState that the app redraws from. ui_snapshot.py can send mouse events and wait before sending keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a safety net fails but its configured level is warn or ignore, the run goes on: before, the TUI showed that only as a passing warning, and an ignored net only as "missing but ignored by configuration". Now: - The header shows a "! N safety nets off" badge, red when one of them errors by default; clicking it opens the report. - Stats starts with a Safety nets panel: for each relaxed net, its level and default, where it fails, why it matters and how to fix it, then the nets that hold. - While a net that hides bugs is off, each survivor's details carry a caution that it may survive only because of that. classify_failures and RelaxedSafetyNet in safety_nets.py split the check into the errors that stop the run and the relaxed nets the console hears about through the new safety_nets_checked hook. Plain output is unchanged. The README screenshot is regenerated from the final UI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_tabs_switch_with_numbers_tab_and_the_mouse failed on CI now and then because a view switch could undo itself, in two ways: - Switching left focus on a widget in the old view. When that view hid, Textual moved focus to a neighbour there, and focusing a widget makes its view the active one, so the TUI jumped back. - The startup activation message for the Run view could be handled after the first key press, and focusing the queue then switched back to Run. Views now switch through show_view, which focuses the new view's widget in the same step. The activation handler ignores a message for a view the user has already left, and focuses a view only when focus is outside it, as after a click on its tab. New tests check that focus follows each switch and that a late activation is ignored. Each fails reliably without its part of the fix. Other tests are tightened: the small-terminal test asserts the view after each key, a duplicate assertion is gone, and the queue test no longer focuses the queue itself. ui_snapshot.py learns shift+tab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 18, 2026
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.
--ui liveis now a full-screen Textual app with tabs for the run, the survivors, every mutant, statistics and the log, driven by keyboard and mouse. Textual is a new optionaluiextra. Without it,--ui livewarns and prints plain output. The hand-drawn ANSI dashboard (dashboard.py,keys.py) is gone, so there is only one TUI.What it shows
ffollows the run again andenteropens the mutant's details.ppauses before the next mutant, with sources unmutated.ctrl+cstops the run through the runner's existingKeyboardInterruptpath, so sources are restored and reports written.qleaves once the run has finished and prints the plain summary as before.?lists every key;ctrl+popens the command palette, which includes themes.How it works
Textual needs the main thread, so
Console.run(work)is new: the base class just callswork(), whileTuiConsoleruns the app on the main thread and the runner on a worker thread. The worker starts from the app'son_mount, so the runner never talks to an app that isn't running. The runner's console hooks update a thread-safeLiveState(strain/live_state.py, plain Python), and the app redraws from it every 100 ms, touching only what changed. SIGTERM andctrl+cset a stop flag, and the runner's next console hook raisesKeyboardInterrupt. If the user leaves the TUI mid-run, strain stops the run and waits for the sources to be restored before exiting.Other changes
tests/test_tui.py: Pilot tests drive keys and mouse clicks headlessly (tabs, filters, map clicks, pause, quit, stop), plusTuiConsolelifecycle tests (result, error, stop, transcript replay).tests/test_live_state.pycovers the state. The old dashboard and key tests are removed.requirements-ci.inandrequirements-ci.txtnow include Textual, so CI runs the TUI tests instead of skipping them. Existing pins are unchanged.tools/ui_snapshot.pycan send mouse events (click:COL:ROW,scrollup:…,scrolldown:…) and has--delayto wait before sending keys.--uihelp text are updated.Relaxed safety nets
When a safety net fails but
strain.tomlor--safety-netssets it towarnorignore, the run goes on. Until now, the TUI showed that only as a passing warning, and an ignored net only as "missing but ignored by configuration", with no reason given. Now:! N safety nets off. It's red when one of those nets errors by default, meaning a mutant that breaks the code can survive. Clicking it opens the report.classify_failuresandRelaxedSafetyNetinsafety_nets.pysplit the check into the errors that stop the run and the relaxed nets, which the console receives through a newsafety_nets_checkedhook. Plain output is unchanged.Stats tab with asan and stdlib_assertions set to warn, ubsan and auto_var_init set to ignore (120x36)
Survivor details with the caution row
Before and after
Before (old screenshot, 80x24):
After (120x36, Survivors tab, second survivor selected; this is the regenerated README screenshot,
docs/images/tui-120x36.png):Before: survivors view, 120x36 (
ui_snapshot.pytext)After: Run tab mid-run, 120x36
After: Survivors tab, 120x36
Testing
python -W error -m pytest: 254 passed, 9 skipped (the same skips asmain; none of the TUI tests skip).ruff format --check .,ruff check .andlizard --length 30 --warnings_only strain testsare clean.-ftrivial-auto-var-init, with[safety_nets]set in itsstrain.toml.tools/ui_snapshot.pyat 120x36 and 80x24. Clicking a row and a tab in a real pty selects the survivor and switches the view.Not tested: Windows and macOS terminals. Stopping takes effect at the next step boundary, so a long test run has to finish or time out first; a build is killed straight away.
🤖 Generated with Claude Code