Skip to content

Property-based TUI tests, crash/overflow fixes, and nightly bombadil fuzz#2935

Open
domenkozar wants to merge 4 commits into
mainfrom
tui-property-tests
Open

Property-based TUI tests, crash/overflow fixes, and nightly bombadil fuzz#2935
domenkozar wants to merge 4 commits into
mainfrom
tui-property-tests

Conversation

@domenkozar

Copy link
Copy Markdown
Member

Summary

Adds extensive automated coverage for devenv-tui and fixes the real bugs it surfaced.

Three layers, by design: snapshots pin exact output (existing), property tests are the fast deterministic gate, and bombadil is the slow end-to-end PTY layer.

Bug fixes (found by the property tests)

  • Crash on multi-byte names/paths: shorten_store_path_aggressive sliced strings at raw byte offsets, panicking the whole TUI on non-ASCII activity names or store paths when shortened for narrow terminals. Now truncates by character.
  • Progress-bar underflow: the bar underflowed when a download or task reported progress beyond its expected total. Filled width is now clamped.
  • Hint-bar overflow: the quit prompt (terminals < ~82 cols) and the bottom navigation bar (standard ~80 cols, with a process selected) rendered past the right edge. Both now use compact text that fits.

Tests

  • devenv-tui/tests/tui_proptest.rs (gated behind test-all, deterministic): drives random streams of every activity event type with adversarial unicode/control payloads, interleaved with random UI commands and resizes down to degenerate sizes. Asserts the TUI never panics, select_activity stays in the selectable set, the log counter never undercounts, and rendering fits the terminal width on standard widths.
  • These run on every PR via the existing cargo nextest run --features devenv/test-all step (the feature propagates to devenv-tui/test-all).

End-to-end fuzzing

  • Long-lived mode for tui-replay (--hold keeps the TUI alive for input, --loop replays repeatedly) so a terminal fuzzer always has a live program.
  • A grounded bombadil terminal spec under devenv-tui/bombadil/ (action generator over devenv's real keybindings + resize/scroll, plus overflow/panic-text/exit/unicode properties).
  • .github/workflows/tui-fuzz.yml: nightly (and manually dispatchable) job that builds tui-replay, runs a time-limited bombadil fuzz with --exit-on-violation, and uploads the reproducer trace on a violation. Runs nightly rather than per-PR because it is slow and the trace grows fast.

Known follow-ups (documented, not fixed here)

  • The bottom nav bar can still overflow by a few columns in the verbose tier (>= 100 cols) and on very narrow terminals (< ~73 cols) when a process is selected. A full fix needs progressive disclosure of hints; tracked in the #[ignore]d rendered_lines_fit_usable_width test.
  • The nightly fuzz downloads the experimental bombadil binary at run time; vendoring it via a flake input would make it fully reproducible.

🤖 Generated with Claude Code

domenkozar and others added 3 commits June 15, 2026 15:48
Three user-facing TUI robustness fixes, all surfaced by the new property tests:

shorten_store_path_aggressive sliced paths at raw byte offsets, panicking the
whole TUI on any multi-byte activity name or store path (non-ASCII package
names, evaluation paths) when shortened for narrow terminals. It now truncates
by character.

The progress bar underflowed when a download or task reported progress beyond
its expected total; the filled width is now clamped.

The quit confirmation prompt and the bottom navigation hint bar overflowed the
right edge on narrow and standard-width terminals; both now use compact text
that fits the available width.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a deterministic property-test suite (tests/tui_proptest.rs, gated behind
test-all) that drives random streams of every activity event type, with
adversarial unicode/control payloads, interleaved with random UI commands and
resizes down to degenerate sizes. It asserts the TUI never panics, that
select_activity stays within the selectable set, that the log counter never
undercounts, and that rendering fits the terminal width on standard widths.
This suite found the crash and overflow bugs fixed in the previous commit.

Also adds an end-to-end layer for fuzzing the real binary through a PTY: a
long-lived mode for tui-replay (--hold keeps the TUI alive for input, --loop
replays the trace repeatedly) and a grounded bombadil terminal specification
under bombadil/, with usage docs. The bombadil layer is manual only and not
wired into CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a scheduled (and manually dispatchable) workflow that fuzzes the real TUI
binary through a PTY with bombadil, pinned to v0.6.0. It builds tui-replay with
deterministic-tui, runs a time-limited fuzz against the long-lived replay
harness with --exit-on-violation, and uploads the reproducer trace as an
artifact when a property is violated.

The in-process property tests already run on every PR via the existing
cargo nextest --features devenv/test-all step, so this end-to-end layer runs
nightly rather than per-PR (it is slow and the trace grows fast).

Also drops the quit keys (Ctrl+C / q) and CONTROL_ALL from the spec's action
generator: they made the harness exit mid-run, ending the session early and
tripping exitSuccess. The run is now bounded by --time-limit and exits cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

🔍 Suggested Reviewers

Based on git blame analysis of the changed lines, the following contributors have significant experience with the modified code:

  • @sandydoo - 76.9% of changed lines (10 lines)

Please consider reviewing this PR as you have authored significant portions of the code being modified. Your expertise would be valuable! 🙏

This comment was automatically generated by git-blame-auto-reviewer

Last updated: 2026-06-15T22:29:41.696Z

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploying devenv with  Cloudflare Pages  Cloudflare Pages

Latest commit: d2af7a5
Status: ✅  Deploy successful!
Preview URL: https://bcb6d0fc.devenv.pages.dev
Branch Preview URL: https://tui-property-tests.devenv.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant