fix(install): prune once per event — second hook on a shared event was silently dropped - #1
Open
Tespera wants to merge 1 commit into
Open
fix(install): prune once per event — second hook on a shared event was silently dropped#1Tespera wants to merge 1 commit into
Tespera wants to merge 1 commit into
Conversation
…ling groups on a shared event With two hooks registered on the same event (e.g. two PostToolUse/Bash entries), processing the second spec re-pruned the event list and silently dropped the group just added for the first. Latent with a single spec per event; bites as soon as a second one exists. Co-Authored-By: Claude Fable 5 <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.
The bug
install.shprunes fable-mode's old entries inside the per-spec append loop:prune()drops any group referencing one of our script names. So when two specs share an event, processing the second spec re-prunes the event list and silently removes the group just added for the first. Today every spec has a unique event, so the bug is latent — but the moment a second hook is registered on the same event (e.g. anotherPostToolUse/Bashguard), the earlier one vanishes fromsettings.jsonwith no error, and--uninstall/re-install idempotency masks it.I hit this for real while prototyping an additional PostToolUse hook: the fail-streak registration silently disappeared after install.
The fix
Prune once per event before the append loop, then append all specs. Behavior for the current 4-hook setup is byte-identical (verified:
tests/test_install.pyall green, fresh/idempotent/merge/re-point/uninstall paths unchanged); the installer just stops eating its own registrations when specs ever share an event.No behavior change for users; this is groundwork that makes the installer safe to extend.
🤖 Generated with Claude Code