Skip to content

Follow-ups: optimize help + goldens, harden purge/installer non-TTY exit - #7

Merged
baroitrung merged 4 commits into
mainfrom
quaqua/mu-integ
Oct 28, 2026
Merged

baroitrung merged 4 commits into
mainfrom
quaqua/mu-integ

Conversation

@baroitrung

Copy link
Copy Markdown
Owner

Summary

Two approved follow-ups from the B3 triage, no behaviour change beyond them.

  1. mu optimize --help + goldens (ecb71dd) — the help advertised the original 3 steps while the binary runs 13. It now lists all 13 (apt, journal, caches, dns, packages, systemd, flatpak, sqlite, state, autostart, services, permissions, disk-health) with their real descriptions, and --skip documents the real id set. tests/golden/help-optimize.txt and tests/golden/optimize-dry-run.txt were regenerated from the binary (the old dry-run golden was a pre-cutover Go capture; the binary has always printed [dry-run] <dry_run_cmd>, which src/optimize.rs:1583 already pinned). Goldens were captured with an empty HOME because the sqlite step enumerates $HOME browser DBs — that yields the documented <db_path> placeholder, so the fixture is host-independent; two independent captures diffed identical.

  2. mu purge / mu installer non-interactive exit (eb75afc, plus failing-repro commit 7f763d4) — without --yes, a non-TTY run used to print "Non-interactive…" to stdout and exit 0 after a full scan. The gate now runs before scan-root resolution and scanning, writes the message to stderr, and exits 1 — the same contract mu uninstall already follows. A TTY cancel still exits 0 with "Cancelled. Nothing was deleted.", and --dry-run still exits 0.

Verification (re-run on the merged tip 4192683 by the Lead)

  • make test → 517 unit + 63 integration, 0 failed
  • make lint (cargo clippy --all-targets -- -D warnings) → clean
  • cargo fmt --check → clean
  • git diff --stat origin/main -- tests/golden → only the two approved optimize goldens
  • Live probes: mu purge --paths=<tmp> </dev/null → exit 1 + stderr message; same for mu installer; both --dry-run → exit 0; fixture files intact afterwards
  • mu optimize --help and mu optimize --dry-run (empty HOME) diff byte-identical against the new goldens

Notes

  • Test assertions that deliberately changed meaning are listed old→new in runs/sude-nonexit.md (both *_aborts_without_auto_yes tests moved from code == 0 to 1); no guard test was deleted.
  • Not in this PR: two deferred B3 items (Steam handoff wait, end-to-end --yes deletion test) and the walker-performance work.

No merge performed — leaving that to the owner.

from therealTINHTUTE with love ❤️❤️❤️

baroitrung and others added 4 commits October 28, 2026 08:38
`mu optimize` runs 13 steps (src/optimize.rs::all_steps) but --help still
described the original 3 and listed only 3 --skip values. Help now names
each step id with its implementation description in run order, and --skip
documents the full id set.

Both optimize goldens were re-captured from the built binary (stdout,
stderr, exit code; stdin </dev/null). The dry-run capture uses an empty
HOME so the sqlite step renders its static `<db_path>` placeholder instead
of freezing this host's Chrome database paths.
… without --yes

Citing principle-test-behavior-not-implementation: assert observable
process exit code (1) and stderr message when stdin is non-interactive
and --yes is omitted, plus exit code (0) for --dry-run on the same fixture.
…ore scanning

Citing principle-fix-root-causes: check stdin TTY status before running
scan roots or attempting deletions when neither --yes nor --dry-run is
present. Emit clear guidance to stderr and exit 1 matching uninstall.
Preserve exit 0 for TTY cancel, empty selection, and --dry-run.

Update test fixtures and add real run() test cases for purge and installer.
@baroitrung
baroitrung merged commit 986bba7 into main Oct 28, 2026
0 of 2 checks passed
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