fix(gate): gate-hygiene trio — dedupe Stop hook, fix blanked-gate preflight, cheap test_affected default (#129) - #155
Merged
Conversation
…r, test_affected default (issue #129) Three related gate-hygiene defects: - SKILL.md/templates/CLAUDE.md now spell out the single-owner rule for the Stop/PostToolUse/PreToolUse hooks: once /orchestrator:setup wires them into a consumer's own .claude/settings.json (post-#128 vendoring), the orchestrator plugin must be disabled for everyday sessions or every gate double-fires each turn; the hand-off checklist now makes dropping enabledPlugins/ extraKnownMarketplaces an explicit step. - gate.sh's pnpm-lock freshness preflight now runs after the empty-gate skip, so a deliberately blanked gate ("" = not configured) stays a true no-op instead of failing the Stop hook when node_modules is momentarily stale. - SKILL.md's test_affected interview guidance and the gates.json template now steer towards a cheap changed-scope filter instead of defaulting straight to the full test suite, which is unaffordable as a per-turn Stop hook. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…reflight (#129) gate.sh was the most-invoked harness script with no dedicated *.test.sh fixture. Add gate.test.sh (mirrors the sibling offline/mock-root pattern) covering: (1) a blanked/unconfigured gate key skips cleanly even with a stale/absent node_modules/.pnpm/lock.yaml — the #129 regression, verified to fail against the pre-fix preflight-before-skip ordering; (2) a configured gate + stale lock aborts with the exact stderr message and never runs the command; (3) a configured gate + fresh lock (or no pnpm-lock.yaml) actually runs the command. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Collaborator
Author
|
fix(gate): gate-hygiene trio — dedupe Stop hook, fix blanked-gate preflight, cheap test_affected default (#129) (not yet reviewed) |
robercano
approved these changes
Jul 17, 2026
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.
Fixes three related gate-hygiene defects in the
harness(.claude) module. Closes #129.1. Consumer repos no longer double-fire the Stop-hook gate
The plugin's
hooks/hooks.jsonand a consumer's vendored.claude/settings.jsoncan both register the same Stop (gate.sh test_affected), PostToolUse (lint) and PreToolUse (guard-git-add) hooks, so a plugin-enabled consumer that also merged those hooks into settings.json paid every gate twice per turn.settings.jsonis the intended steady-state owner (post-#128 scaffold vendors the runtime harness), so the setup skill now states an explicit single-owner rule and adds a hand-off checklist item to disable the plugin (dropenabledPlugins/extraKnownMarketplaces) once settings.json owns the hooks; theCLAUDE.mdtemplate carries a matching caveat. reCode's own.claude/settings.jsonhooks are untouched — reCode is not plugin-installed on itself, so that registration is its only/correct one.2. Blanked gates no longer fail on an out-of-sync node_modules
In
gate.sh, thepnpm-lock.yamlfreshness preflight ran BEFORE the "empty gate => skip" branch, so a deliberately blanked gate ("test_affected": "", the documented "not configured" marker) could stillexit 1whenevernode_moduleswas momentarily behind the lockfile. The preflight now runs only after$cmdis resolved non-empty (i.e. only for gates that actually execute); the freshness logic, stderr message and exit code for configured gates are unchanged.3.
test_affectedscaffold default steers cheap, not full-suiteThe setup skill previously advised defaulting
test_affectedto the fulltestcommand, making the after-every-turn Stop hook unaffordable. Step-3 guidance now steers toward a changed-scope filter (full command only as a confirmed-fast fallback, else empty), and the templategates.jsoncarries a hint pointing at the per-stack table indocs/GETTING_STARTED.md.Tests
Added
.claude/scripts/gate.test.sh— an offline, auto-discovered regression fixture (13 checks) proving a blanked gate skips (exit 0) even with a stale/absentnode_modules/.pnpm/lock.yaml, a configured gate still aborts (exit 1) with the exact message on a lock mismatch, and a configured gate runs on a fresh/absent lock. Verified to fail against the pre-fix ordering.Gates
build,lint,test(checks.sh + smoke-fanout + all*.test.sh, incl. the new fixture) all green viaGATES_FILE=.claude/self/gates.json.Review
correctness (opus) APPROVE; tests (sonnet) APPROVE on re-review after the regression fixture was added.
🤖 Generated with Claude Code