Skip to content

chore(dev): skip the Stop hook when none of its inputs changed - #199

Merged
hermanngeorge15 merged 1 commit into
mainfrom
fix/stop-hook-skip-when-no-rust-changed
Oct 21, 2026
Merged

hermanngeorge15 merged 1 commit into
mainfrom
fix/stop-hook-skip-when-no-rust-changed

Conversation

@hermanngeorge15

Copy link
Copy Markdown
Contributor

.claude/hooks/on-stop.sh runs cargo test, cargo clippy -- -D warnings and cargo fmt --check after every turn, regardless of what the turn touched.

Why this mattered

Before #191, cargo test took 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, clippy or the tests actually read has changed:

*.rs  patterns/  tests/  Cargo.toml  Cargo.lock  build.rs  rust-toolchain.toml

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

case result
clean tree exits 0 in 0s
src/lib.rs touched runs the full gate
patterns/core/encoding.yaml touched runs the full gate
tests/corpus/... touched runs the full gate

Note

.gitignore has .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

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>
@hermanngeorge15
hermanngeorge15 merged commit edec71c into main Oct 21, 2026
1 check passed
@hermanngeorge15
hermanngeorge15 deleted the fix/stop-hook-skip-when-no-rust-changed branch October 21, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant