Skip to content

Show live progress while the TUI scans and deletes - #5

Merged
UnbreakableMJ merged 1 commit into
mainfrom
feature/tui-live-progress
Jun 22, 2026
Merged

Show live progress while the TUI scans and deletes#5
UnbreakableMJ merged 1 commit into
mainfrom
feature/tui-live-progress

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

Summary

The TUI froze during its two long operations — the delete loop and the scan both ran synchronously on the UI thread, so event_loop never redrew. With large roots now reachable (/spacecraft-software, /), scanning could freeze the screen for seconds with no feedback.

This moves both operations onto a background worker thread (std::thread + mpsc — no new dependencies) feeding a live progress overlay:

  • Deleting — spinner + [done/total] + "freed X of Y" + a determinate Gauge. esc cancels after the current item (cooperative AtomicBool), then it auto-rescans.
  • Scanning (startup, post-delete, post-picker) — spinner naming the current category. esc quits (the read-only scan thread is safely abandoned). Scan errors are now non-fatal — shown in the overlay instead of crashing the TUI.
  • The event loop pumps the channel each tick and animates at ~12 fps (ACTIVE_TICK 80 ms) only while a job runs; idle stays at 250 ms, so no extra CPU at rest.
  • Safety unchanged: deletions stay bounded by the same roots and safety::check_deletable. The worker only moves Send data (Candidate/Deleter/Outcome).

Docs

  • Texinfo "Interactive TUI" gains a Progress section (builds zero-warning).
  • AGENTS.md and SKILL.md note the overlay.

Testing

  • cargo fmt --check · cargo clippy --workspace --all-targets -- -D warnings · cargo test --workspace (45 pass — new progress_ratio unit test) · reuse lint compliant · makeinfo zero-warning.
  • Reinstalled to ~/.cargo/bin/vacuum.
  • Caveat: the live overlay/threading needs a TTY and is not unit-tested — coverage lives in the pure progress_ratio helper. Worth a manual smoke-test: vacuum tui /spacecraft-software (scan spinner cycles categories); select large items → entery (gauge fills); esc mid-delete cancels cleanly.

Out of scope / follow-ups

  • Interrupting a single in-flight remove_dir_all/jwalk (cancel is between items / between cleaners only).
  • Parallelizing deletion across items (kept sequential for predictable safety ordering and simple progress accounting).

🤖 Generated with Claude Code

The TUI froze during its two long operations because both ran on the UI
thread: the delete loop and the scan were synchronous blocking calls, so
event_loop never redrew. With large roots now reachable (e.g.
/spacecraft-software, /), scanning could freeze the screen for seconds with no
feedback.

Move both operations onto a background worker thread (std::thread + mpsc;
no new deps) feeding a progress overlay. Deleting shows a spinner, [done/total],
'freed X of Y', and a determinate Gauge; scanning shows a spinner naming the
current category. The event loop pumps the channel each tick and animates at
~12fps (ACTIVE_TICK 80ms) only while a job runs — idle stays at 250ms. Esc
cancels a deletion after the current item (cooperative AtomicBool) and quits
during a scan (read-only thread safely abandoned); a finished delete auto-
rescans. Scan errors are now surfaced in the overlay instead of aborting the
TUI. Deletions remain bounded by the same roots + safety::check_deletable.

Docs: Texinfo 'Interactive TUI' gains a Progress section; AGENTS.md and
SKILL.md note the overlay. Adds a progress_ratio unit test (45 total). The live
overlay needs a TTY and is not unit-tested; the pure ratio logic is.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@UnbreakableMJ
UnbreakableMJ merged commit 09c9e8a into main Jun 22, 2026
2 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the feature/tui-live-progress branch June 22, 2026 20:55
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