Keep the gate runtime tracked under a global bin/ ignore, and say when a hook target is not - #166
Merged
Merged
Conversation
…n a hook target is not The `bin/` rule in the Visual Studio, .NET and Java gitignore templates, common in a developer's global excludes file, matched `.chock/bin/`: `git add -A` never tracked the runtime every agent hook runs, and a clone, a CI checkout or `git clean -x` left the agents' hook configs naming a file that was not there. Found on Windows by chock-catalog's agent test kit: Claude Code reported `SessionStart:startup hook error ... can't open file '.chock/bin/claude_code.py'`, and no gate judged anything from then on. - chock.scaffold.gitrules writes chock's .gitignore rules in one place: `.chock/log/` ignored as before, and `!.chock/bin/`, `!.chock/compiled/` (and `/**` under each) re-included -- a repository's own .gitignore outranks a global excludes file. `chock init` writes them, and `chock sync` adds them for adopters who initialised earlier. This repository's own .gitignore carries them now. - check_dangling_hook_targets reports a hook target git would ignore, naming the rule and where it lives, as well as a missing one, and covers the compiled gate a hook hands the runtime. It asks `check-ignore -q` whether a path is ignored: `-v` also names a matching `!` negation, and exits 0 for it. - docs: getting-started and adopting say what the rules are and why. tests/test_runtime_tracked_under_global_ignore.py runs under a global excludes file with `[Bb]in/`: the runtime and compiled gates are tracked after init and sync; without the rules the check names the global rule; sync restores the rules; a missing compiled gate is reported; a negated path is not; the rules are written once and an adopter's own are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
checks_repo.py went past the 300-line review budget with the ignore-aware reasons; the hook-target check is one activity and now reads as one file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
jothimani-rajendran
marked this pull request as ready for review
September 26, 2026 20:13
This was referenced Sep 26, 2026
Merged
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.
What
An adopter on Windows lost every agent hook. A global gitignore
bin/rule (from the Visual Studio, .NET and Java templates) matched.chock/bin/, sogit add -Askipped the gate runtime. After that, every clone, CI checkout andgit clean -xhad hook configs naming a file that didn't exist. Claude Code showedSessionStart hook error ... can't open file '.chock/bin/claude_code.py'. Python exits 2 when it can't open a script, so each hook either blocks the tool call or, on clients that ignore hook failures, never runs the gate.chock checksaid nothing about it.chock.scaffold.gitrules.ensure_git_ruleswrites chock's.gitignorerules. Bothinitandsync(recompile) call it..chock/log/ignored.!.chock/bin/,!.chock/bin/**,!.chock/compiled/and!.chock/compiled/**. A repository's own.gitignoreoutrankscore.excludesFile, so the negations win.initbefore this change get the rules on their nextchock sync. chock's own.gitignorenow carries the block.check_dangling_hook_targetsmoved tovalidation/checks_hook_targets.pyto keepchecks_repo.pywithin the 300-line budget..chock/compiled/*.jsontargets.source:line:patternand giving the fix.check-ignore -q.-valone also lists the!negations that re-include a path, and exits 0 for them.Unreleasedentries;docs/getting-started.mdanddocs/adopting.mdupdated.Definition of done
chock check→ 0 errors, 0 warnings, 0 infoschock check --only matrixpasses; matrix unchanged (no emitted surface changed)chock sync --repo . --checkcleanchock check --only verifycleanpytest -q: 1472 passed, 2 skipped. The new tests fail on the old code (6 of 7). One test is red in this sandbox and also red on unmodifiedmainhere:test_validate_hook_interpreter::test_a_stale_baked_interpreter_falls_back_instead_of_breaking. The systempython3has nojsonschema; this is environmental, and CI is the judge.tests/test_runtime_tracked_under_global_ignore.pyuses aGIT_CONFIG_GLOBALexcludes file with[Bb]in/. It checks four things:syncrestores the rules;pytest acceptance/ ...: 21 passed (initandsyncwrite.gitignore).gitignorecarries the new blockUnreleasedentry addedruff check .andruff format --check .cleanClaims
chock checksay when it isn't.Context: open-coder-ai/chock-catalog#108 works around this in its agent test kit (
kit.py doctor, force-adding the generated files).🤖 Generated with Claude Code
https://claude.ai/code/session_01CzNYfzP8ymU3r4JB9Sz8Ha
Generated by Claude Code