Develop and improve the MassGen Textual TUI by running it in a browser via textual-serve and using Claude's browser tool for visual feedback.
Use this skill to improve the MassGen Textual UI while minimizing flaky reproduction and API cost.
events.jsonl deterministically.Prefer deterministic workflows before live model runs:
events.jsonl) with no API calls.--tui-real.massgen --display textual or --textual-serve only when needed.# Full frontend/TUI test suite
uv run pytest massgen/tests/frontend -q
# Timeline transcript goldens
uv run pytest massgen/tests/frontend/test_timeline_transcript_golden.py -q
UPDATE_GOLDENS=1 uv run pytest massgen/tests/frontend/test_timeline_transcript_golden.py -q
# Snapshot scaffold tests
uv run pytest massgen/tests/frontend/test_timeline_snapshot_scaffold.py -q
uv run pytest massgen/tests/frontend/test_timeline_snapshot_scaffold.py --snapshot-update -q
uv run pytest massgen/tests/frontend/test_timeline_snapshot_scaffold.py -q --snapshot-report snapshot_report.html
uv run python scripts/render_snapshot_svgs.py --real-tui-only
# Event replay (no API cost)
uv run python scripts/dump_timeline_from_events.py /path/to/events.jsonl [agent_id]
uv run python scripts/dump_timeline_from_events.py --tui /path/to/events.jsonl [agent_id]
uv run python scripts/dump_timeline_from_events.py --tui-real /path/to/events.jsonl [agent_id]
# Example synthetic fixture
uv run python scripts/dump_timeline_from_events.py --tui-real massgen/tests/frontend/fixtures/synthetic_tui_events.jsonl agent_a
Start with transcript replay to verify timeline semantics quickly:
uv run python scripts/dump_timeline_from_events.py /path/to/events.jsonl agent_a
Then inspect visually:
# Lightweight timeline-focused view
uv run python scripts/dump_timeline_from_events.py --tui /path/to/events.jsonl agent_a
# Full runtime TextualApp shell
uv run python scripts/dump_timeline_from_events.py --tui-real /path/to/events.jsonl agent_a
Optional speed control for real replay:
MASSGEN_TUI_REPLAY_SPEED=8 uv run python scripts/dump_timeline_from_events.py --tui-real /path/to/events.jsonl agent_a
Exit replay with q.
Pick the narrowest layer that captures the bug:
test_tool_batch_tracker.py, test_content_processor.py, helpers.test_timeline_transcript_golden.py + massgen/tests/frontend/golden/.test_timeline_snapshot_scaffold.py + massgen/tests/frontend/__snapshots__/.test_dump_timeline_from_events_script.py.When iterating specifically on final-answer visualization:
test_timeline_section_widget.py.uv run pytest massgen/tests/frontend/test_timeline_snapshot_scaffold.py --snapshot-update -quv run python scripts/dump_timeline_from_events.py --tui-real massgen/tests/frontend/fixtures/synthetic_tui_events.jsonl agent_auv run pytest massgen/tests/frontend -qIf snapshot tests mismatch:
snapshot_report.html.Show difference toggle interpretation:--snapshot-update.For visual/UI tasks, do not rely on test pass/fail alone. You must read screenshots directly before finalizing:
snapshot_report.html (current vs historical).Show difference OFF first to verify raw rendering; then optionally use ON for pixel-level drift..svg, render via browser engine:npx playwright screenshot "file:///ABS/PATH/to/snapshot.svg" /tmp/snapshot.pnguv run python scripts/render_snapshot_svgs.py [--real-tui-only]Use live runs only after deterministic checks pass:
# Native terminal TUI
uv run massgen --display textual
# Browser-hosted Textual
uv run massgen --textual-serve
scripts/dump_timeline_from_events.py: text replay, --tui, and --tui-real modes.massgen/frontend/displays/textual_terminal_display.py: TextualApp, shell layout, runtime event routing.massgen/frontend/displays/tui_event_pipeline.py: timeline event adapter and filtering logic.massgen/frontend/displays/timeline_event_recorder.py: deterministic text transcript recorder.massgen/tests/frontend/test_timeline_snapshot_scaffold.py: snapshot scaffold (widget + real shell states).massgen/tests/frontend/test_timeline_transcript_golden.py: transcript golden regressions.docs/modules/testing.md: canonical testing commands and parity notes.A TUI change is complete when:
uv run pytest massgen/tests/frontend -q passes.--tui-real replay confirms expected real-shell behavior for the target scenario.