Skip to content

fix(install): report guarded hooks whose files are missing - #335

Closed
bfs2021 wants to merge 1 commit into
The-AIOS:mainfrom
bfs2021:fix/report-missing-guarded-hooks
Closed

bfs2021 wants to merge 1 commit into
The-AIOS:mainfrom
bfs2021:fix/report-missing-guarded-hooks

Conversation

@bfs2021

@bfs2021 bfs2021 commented Nov 18, 2026

Copy link
Copy Markdown

Fixes #334.

What and why

A guarded hook ([ ! -f FILE ] || CMD) whose file is gone is a silent no-op by design: the guard exists so a missing file never blocks every prompt with exit 2. But that traded a loud block for silence. After an update renames or removes a hook, or an operator's ~/aios moves, the installer reported "Done" with no hint that hooks had stopped firing.

install-settings.py now checks each guarded hook command it sees, including the status line, and prints in both the dry run and --apply:

  ! missing  <event>  <path>  this hook is being skipped; its file does not exist

/aios:update reads the installer output aloud, so the missing file becomes visible to the operator. The first path inside the guard bracket is used (not the command path after ||), and ~, $HOME, ${HOME} and quotes are resolved. No behaviour changes — the hook is still skipped, now it is reported.

How it was tested

  • Added a fixture test to tests/install-settings.test.sh: a settings file with a dangling guarded hook and status line produces ! missing for both in the dry run; a present guarded hook produces no such line.

  • Red-green verified: the baseline script produced no ! missing lines on the same fixture; the patched script produces all three.

  • bash tests/install-settings.test.sh: 54 passed, 0 failed.

  • tests/changelog-entry-shape.test.sh 18/18, tests/changelog-read-scope.test.sh 13/13, tests/ci-failure-explainer.test.sh 18/18.

  • CHANGELOG entry added under a new 2026-11-18 heading with an empty hash: line, per CONTRIBUTING.

  • make test equivalent for the touched area (shell suite: 54/54)

  • User-facing changes noted under a new CHANGELOG heading

  • Commits are signed off (git commit -s) — noted; see below

The commit is authored as bfs2021 <101915083+bfs2021@users.noreply.github.com> and pushed from bfs2021:fix/report-missing-guarded-hooks. DCO sign-off can be added on request via an amended commit if the project requires it.

AI-assisted development and review used for this change.

@chuycepeda

Copy link
Copy Markdown
Member

Thank you for this. It's a clean fix: you read the guard's first bracket instead of the command after ||, red-green tested it, and gave a clear CHANGELOG note.

We'd already started the same fix in #336 when this arrived, and that one also covers a few cases this doesn't: hooks the installer is about to repoint (~ move) aren't reported as missing, /aios:update relays the lines on every run rather than only when the installer changes, and paths or event keys with control characters are never printed. So we're closing this in favour of #336 rather than merging two versions of one change. You'll be credited as co-author on #336 and in its CHANGELOG line.

The duplicate is on us: we took the issue in a comment but never set the in-progress label you'd check first. That's fixed in our process now. We hope you'll send the next one.

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.

install-settings.py: report a guarded hook whose file is missing

2 participants