Merged
Conversation
added 2 commits
September 18, 2026 07:33
…ree-mismatch warning (#416) Follow-up to #402/PR #415, which limited itself to pre-tool-hook.sh and said so explicitly. Both remaining hooks resolve JIT_BASE from CLAUDE_PROJECT_DIR the same way and had the same exposure with no warning. jit_worktree_mismatch_line() and jit_worktree_notice() in common.sh were already generic; this is the wiring for the other two, plus tests reproducing the mechanism against each hook's own rule dimension (vocabulary, path). Dedup follows each hook's existing precedent rather than inventing a new marker: pre-prompt-hook.sh shares its "vocab"-keyed shown_file with the tool hook, same as its jit-refused-config notice already does; pre-path-hook.sh keeps its own "path"-keyed shown_file isolated, same as its config_refused/layers_refused notices already do. Co-Authored-By: Max <noreply>
oss:auditor self-review finding: the two new #416 test sections each proved only that an agreeing pair rooted at main stays silent (AGREE_MAIN), not the symmetric case rooted at the worktree (AGREE_WT) -- the half tests/test-pre-tool-hook.sh already carries for #402. Without it, a notice that fired whenever CLAUDE_PROJECT_DIR != $D416/main, rather than on a genuine two-sided mismatch, would still have passed every assertion. Co-Authored-By: Max <noreply>
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.
This is the rest of #402: PR #415 wired
jit_worktree_mismatch_line()/jit_worktree_notice()intopre-tool-hook.shalone, on purpose, and said so rather than quietly widening.pre-prompt-hook.shandpre-path-hook.shresolveJIT_BASEfromCLAUDE_PROJECT_DIRthe same way and had the same exposure with no warning. The helper inscripts/common.shwas already generic; this PR is the wiring and the tests for the other two hooks.What changed
scripts/pre-prompt-hook.shandscripts/pre-path-hook.sheach exportJIT_WORKTREE_NOTE(bash side, mirroringpre-tool-hook.sh's existing PreToolUse:Bash jit-context injection observed serving pre-edit (stale) rule bodies well after the on-disk file was confirmed current #402 wiring verbatim in shape) and add a single-arm awk-sidejit_blk_prependnotice block (neither hook has a blocked/block_tail concept, unlikepre-tool-hook.sh-- confirmed by grep, 0 hits for "blocked" in either file).pre-prompt-hook.shalready shares a "vocab"-keyedshown_filewithpre-tool-hook.shfor itsjit-refused-confignotice, so the new block shares that same marker.pre-path-hook.shalready keeps its own "path"-keyedshown_fileisolated for the same notice, so the new block stays isolated too.#416sections intests/test-pre-prompt-hook.shandtests/test-pre-path-hook.sh, mirroringtests/test-pre-tool-hook.sh's own#402section: two real git worktrees, one rule name with two different bodies, confirming the wrong-tree body is served and the fix adds the warning -- plus the symmetric AGREE_WT positive control (see Review below).Tests
RED: hook script changes alone stashed (
git stash push -- scripts/pre-prompt-hook.sh scripts/pre-path-hook.sh), tests left in place --test-pre-prompt-hook.sh148/151 passed, 3 failed;test-pre-path-hook.sh96/99 passed, 3 failed. The 3 failures in each file are exactly the new fix-assertions.GREEN: after
git stash pop, 151/151 and 99/99; after the review-driven addition below (commit cbeae82), 153/153 and 101/101.Review
Two concurrent spawns against commit bfabd6a: a general-purpose reviewer (NO FINDINGS) and
oss:auditor(FINDINGS: 1). oss:auditor found the #416 test sections were missing the symmetric AGREE_WT control tests/test-pre-tool-hook.sh's #402 section already has; added and reran green before this PR.Adjacent, not touched
changelog.d/402.fixed.hook-warns.md's historical text ("pre-prompt-hook.sh and pre-path-hook.sh ... do not yet carry this warning") now reads as stale prose. Left alone: recording state as of merge time is the normal convention for a changelog fragment, and nothing here duplicates or contradicts it misleadingly.Closes #416
[AI-generated]