elegance: install.sh has no source-file precheck — partial install + lying --dry-run on a missing/renamed theme#19
Merged
Antawari merged 1 commit intoJun 14, 2026
Conversation
… honest --dry-run install.sh copied five sources with `run cp -f "$HERE/themes/<file>" <target>` and no existence guard. With one source missing (a renamed or not-yet-built theme), under `set -e` the dark theme copied first, then cp aborted the script exit 1 — leaving a half-installed theme set in ~/.config/cosmic with no cleanup and no clear message. Worse, `./install.sh --dry-run` printed all five "would: cp" lines and exited 0 for the same missing source, falsely reporting success because run() only echoes in dry mode. Add a precheck that asserts all five sources exist before any copy and fails fast with one typed message naming each missing file — running in BOTH normal and dry-run modes. Sources are named once and shared with the copy block so the precheck and the copies can never drift (DRY). New TDD suite tests/test_install_precheck.sh pins both closed paths (RED before, GREEN after) plus happy-path regression guards in both modes; wired into the checks workflow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DO NOT MERGE — fleet quality burn unit. Review/merge is the user's call.
The claim this satisfies
install.shrancp -f "$HERE/themes/<file>" <target>for five sources with no existence guard.Reproducer (partial install): delete
themes/candyfactory-parlor-light.ron, run./install.sh. Underset -ethe dark theme copies first, thencperrorscannot stat … No such file or directoryand the script aborts exit 1 — leaving a half-installed theme set in~/.config/cosmicwith no cleanup and no typed message.Reproducer (--dry-run lies):
./install.sh --dry-runfor the same missing source printed all fivewould: cplines and exited 0, falsely reporting success — becauserun()only echoes in dry mode and never touches the filesystem, so the missing source is never noticed.Both reproducers confirmed RED on the unmodified installer before the fix (1 partial file written; dry-run exit 0).
The fix
A precheck that asserts all five sources exist (and fails fast with one clear typed message before any copy) closes both paths. It runs in both normal and dry-run modes, so
--dry-runcan no longer lie. Sources are named once and shared with the copy block, so the precheck and the copies can never drift (DRY). The--uninstall,--help, and happy-path install behaviours are unchanged.TDD
tests/test_install_precheck.sh(new, dependency-free bash) was written RED-first and pins:--dry-runover a missing source exits non-zero and prints nowould: cppreview (dry-run no longer lies)--dry-runstill previews and exits 0Wired into
.github/workflows/checks.yml. Complements the existingtests/test_install.sh(happy-path integration) — no overlap, no existing test weakened.Gate (local, mirrors CI)
shellcheck install.sh tests/*.sh— cleantest_accent_palettes.sh14/14 ·test_theme_rons.sh13/13 ·test_install_precheck.sh5/5 ·test_install.sh7/7 — 39/39 green🤖 Generated with Claude Code