Repository navigation
chore(dev): skip the Stop hook when none of its inputs changed - #199
Merged
Merged
Conversation
The hook runs fmt, clippy and the full test suite after EVERY turn, regardless of what the turn touched. On a docs-only session that is pure cost: before #191 it was a guaranteed stall, because `cargo test` took longer than the hook's own 900s timeout (11m02s locally, 18.1 min on CI) and was killed without reporting anything. #191 cut that to 3m01s so the gate completes now, but three minutes of recompiling after editing a Markdown file still buys no information. Gate on whether anything fmt, clippy or the tests actually read has changed: *.rs, patterns/, tests/, Cargo.toml, Cargo.lock, build.rs and rust-toolchain.toml, in the working tree first and then in commits not yet on origin/main, so a feature branch stays gated after its work is committed. tests/ is watched because corpus files drive the recall numbers even when no pattern moves. Verified: clean tree exits 0 in 0s; touching src/lib.rs, patterns/core/*.yaml or a tests/corpus file each still runs the full gate. Co-Authored-By: Claude Opus 5 (1M context) <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.
.claude/hooks/on-stop.shrunscargo test,cargo clippy -- -D warningsandcargo fmt --checkafter every turn, regardless of what the turn touched.Why this mattered
Before #191,
cargo testtook longer than the hook's own 900s timeout — 11m02s locally, 18.1 min on CI — so the hook could never pass. A session that never touched Rust spent fifteen minutes stalling and was then killed without reporting anything. It was not a gate; it was a guaranteed timeout.#191 cut the suite to 3m01s locally, so the gate completes now. But three minutes of recompiling after a turn that edited a Markdown file still buys no information.
The change
Gate on whether anything
fmt,clippyor the tests actually read has changed:Checked in the working tree first, then in commits not yet on
origin/main, so a feature branch stays gated after its work is committed rather than going quiet the moment you commit.tests/is watched deliberately — corpus files drive the recall numbers even when no pattern moves, so a corpus-only edit must still run the gate.Verified
src/lib.rstouchedpatterns/core/encoding.yamltouchedtests/corpus/...touchedNote
.gitignorehas.claude/, but these hook files are already tracked, so they are still versioned. Worth knowing that new files under.claude/will not be picked up without-f.🤖 Generated with Claude Code