Skip to content

Snapshot tests for TUI render

Status: Open — Phase 1, no confirmation needed

The TUI has no snapshot-style regression net for the largest composite panes. The render layer has grown significantly since the original analysis:

No insta or other snapshot testing library exists in the dependency tree. All render testing uses manual TestBackend + assert! assertions against buffer contents.

Three target functions (updated from original)

Section titled “Three target functions (updated from original)”
FunctionFileWhat to snapshot
render_sentinel_description_panesrc/console/manager/render/list.rsStatic ”+ New workspace” panel. Zero state. 80×10 terminal.
render_tab_stripsrc/console/manager/render/editor.rsTab bar with EditorTab active. 4 variants × 1 snapshot each. 80×3 terminal.
render_mounts_subpanelsrc/console/manager/render/list.rsMount list subpanel. 3 cases: empty, 1 mount, 3 mounts. 60×20 terminal.

Additional high-value targets identified in re-analysis:

FunctionFileWhat to snapshot
Global mounts editor renderingsrc/console/manager/render/global_mounts.rsPer-subtab renders. New 839L file with no snapshot coverage.
Per-tab editor body renderssrc/console/manager/render/editor.rsAt minimum: General, Mounts, Agents, Secrets tab body renders.
Workspace list renderssrc/console/manager/render/list.rsActive workspace detail panel with various mount configurations.

Use insta for snapshot storage + review workflow; ratatui::backend::TestBackend for the buffer (already used widely in existing tests — no extra dependency just for the backend).

LibraryStarsApproachFit
insta~4kString snapshots with cargo insta reviewBest — simple, no async, inline or file-based
ratatui::backend::TestBackendbuilt-inRaw buffer comparisonAlready available
trycmd~400CLI snapshot testingWrong layer — tests full CLI, not render functions
  1. Add insta to [dev-dependencies] in Cargo.toml.
  2. Write test modules using TestBackend + insta::assert_snapshot!(). Start with the 3 original targets, then add the new targets.
  3. Run cargo insta review to accept the initial snapshots.
  4. cargo nextest run already runs snapshot comparisons — no additional CI step needed.

These snapshot tests are the regression net for the Phase 2 file splits AND the Phase 1.5 DRY extractions. The TUI render layer has extreme boilerplate duplication (120 Style::default() chains, 18 Block::default() constructions, 192 Span constructions) — snapshot tests make it safe to extract shared helpers without silently changing TUI appearance.