Repository navigation
fix(crush): skip crush.hooks override keys that name no Crush event - #3909
Merged
Merged
Conversation
Crush refuses to load the whole config when a hooks key names an unknown
event ("hook <key>: unknown event"). An override key that is neither a
canonical event nor one of Crush's 13 events (for example the Claude Code
spelling `Stop`) was written verbatim and broke the config. Such keys are
now skipped with a warning; `PermissionResult` and other real Crush events
still round-trip verbatim.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…ush-unknown-hook-keys # Conflicts: # src/generated/docs-content.ts
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.
Closes #3672
Summary
This is the last open item on #3672. Earlier work already landed the hook event mapping (#3708), dropping matchers on non-tool events, and the permissions command lists (#3818).
Crush validates the
hooksblock when it loads the config. If a key names an unknown event, it refuses to load the whole config withhook <key>: unknown event(seeinternal/config/[email protected]). The event list is unchanged in the latest stable release, v0.102.0. Until now, acrush.hooksoverride key that was neither a canonical event nor a Crush event was written verbatim. One example is the Claude Code spellingStop, where Crush's event isTurnEnd. The generatedcrush.jsonthen broke Crush.canonicalToCrushHooksnow checks an override key that resolves to no canonical event against all 13 Crush events, compared case-insensitively and ignoring underscores, the way Crush folds them. If it names no Crush event, it is skipped with a warning.PermissionResult(and spellings likepermission_result) is a real Crush event without a canonical counterpart, so it is still written verbatim and still round-trips.docs/reference/file-formats.mdand regeneratedsrc/generated/docs-content.ts.Tests
src/features/hooks/crush-hooks.test.ts: an overrideStopis skipped with one warning, whilepermission_resultand the sharedstop→TurnEndare still emitted.pnpm run checkandpnpm run cicheck:contentpass. In the fullpnpm test, only the two load-sensitive budget tests (src/utils/glob.test.ts,src/features/permissions/shell-command-categories.test.ts) timed out at load average ~37. Both pass when run on their own.🤖 Generated with Claude Code
https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4