Repository navigation
The guardrails stopped at the config schema - #95
Merged
Merged
Conversation
The .claude/ hooks encode two of this repo's lockstep surfaces — config.go ↔ schema, and the conformance pin — and leave the rest to CI or to nothing. An added metric fails observability_pack_test.go with no warning at the edit; a chart change forgets which of Chart.yaml's two version lines does what; a minted error code drifts from README's Errors table, which is canonical and has no test behind it at all. Two guards, four reminders, and the settings to stop paying for the review agents: - pre-edit-guard.sh (new, PreToolUse Edit|Write) blocks writes to gateway/console/** and gateway/console_source.go. CONTRIBUTING says an edit there cannot merge and CI's console job makes that true; learning it from a red PR is a round trip for a rule that is knowable at the write. - bash-guard.sh asks before git reset --hard, checkout --/., restore, clean -f, and stash, naming how many uncommitted paths are at risk. SessionStart already warns that a dirty tree may be another session's in-flight work, and nothing stood between that warning and a reset taking it. It asks rather than blocks because bench-profiler stash-bisects on purpose. - post-edit.sh grows from three lockstep cases to seven: metrics.go and the observability pack it is checked against in both directions, the Helm chart (version is an immutable OCI tag, appVersion is what a default install actually deploys), and the console pin as a supply-chain change rather than a version bump. Each message names the test that will fail. - The same hook now diffs the -3104x codes minted under gateway/ against README's Errors table, and stays silent unless they actually diverge. - settings.json goes from 18 allowed commands to 49. The consequential one is read-only git: all four review agents work from the working diff, and git diff prompted on every call. - /preflight now matches CI's eight jobs. It was missing vuln, console-check, and a local image build — the last of which exists because a builder base skew shipped past two green merges and failed after the tag was pushed, with the binaries and chart already published. Two portability fixes fell out of testing the error-code check: grep here is ugrep, which reads --include as a filename, and bash mis-parses a nested case pattern's ) inside command substitution. Verified by exercising each hook against its decision matrix — 14 bash-guard commands, 9 post-edit paths, 4 pre-edit paths, and the error-code check both in sync (silent) and against a simulated -31046 mint. No Go changed.
This was referenced Aug 26, 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.
The
.claude/hooks encode two of this repo's lockstep surfaces —config.go↔ schema, and the conformance pin — and leave the rest to CI or to nothing. This closes the gap for five more, blocks two classes of edit that cannot merge or cannot be undone, and brings/preflightback in line with what CI actually runs.Found by auditing the toolkit against the repo surface it covers: 8 CI jobs, 20 make targets, 18 packages, the deploy tree, and the last 35 commits.
What was unguarded
metrics.go↔ dashboard + both alert filesobservability_pack_test.go, at test timeChart.yamlversionvsappVersionchartjob, after the tagCONSOLE_COMMIT)/console-sync, if invokedgateway/console/**consolejob, on a red PR-3104x↔ README's Errors tableThe error-code row is the one I'd call the real find: CLAUDE.md says "README 'Errors' is the canonical table — this list moves with it," and
grep 31040 gateway/*_test.gois empty. It is the only lockstep here held up by discipline alone.The part that needs review
bash-guard.shasks rather than blocks, and that is a judgement call.git reset --hard,checkout --/.,restore,clean -f, andstashnow surface a prompt naming how many uncommitted paths are at risk.session-start.shhas always warned that a dirty tree may be another session's in-flight work; nothing stood between that warning and a reset taking it. Butbench-profilerstash-bisects deliberately, so a block would break a documented workflow. If you would rather it block onreset --hardspecifically and only ask on the rest, say so.git checkout <path>still passes. Matching it would prompt on everygit checkout feat/branch, which is the more common command by a wide margin.git restoreis caught, and that is the form that discards without ambiguity.make console-checkis now pre-allowed and it re-vendors as a side effect (sync-console.sh, then diff). It needs network and leaves the tree modified if the pin has drifted. That is exactly what it is supposed to do, but it is the one allowlisted command that writes.Verification
Each hook exercised against its decision matrix, not just read:
bash-guard.sh— 14 commands.checkout -b,checkout main,stash pop,stash list,status,diffpass through untouched; the five destructive forms returnask; the pre-existing force-push,--no-verify, and tag guards still fire. (The force-push guard blocked one of my own test harnesses, which was a reassuring way to find it working.)pre-edit-guard.sh— 4 paths. Blocksgateway/console/assets/index.jsandconsole_source.go; allowsconsole.goandconsole_test.go.post-edit.sh— 9 paths, one per case plus two that must stay silent.-31046mint, and names both sets in the message.bash -nclean on all five hooks, all executable,settings.jsonvalid and all five registered.Two portability fixes fell out of that testing:
grephere is ugrep, which reads--includeas a filename (replaced with plain globs, which also stops it recursing into the vendored console tree), and bash mis-parses a nestedcasepattern's)inside command substitution.No Go changed, so
make checkis unaffected — but CI will confirm.Checklist
make checkpasses — no Go, no config, no deploy files touched.claude/README.mdand CLAUDE.md's tooling paragraph both describe the new hooks