Repository navigation
fix(gate): fail loudly on a gate key the reader cannot read - #1279
Merged
Merged
Conversation
A gate key written in valid TOML the line reader cannot read ([dev] + gate.proof_of_done = true, a quoted header, an inline table) read as unset, so a gate meant to be on stayed off with no message. The merge-command scanner moves into kit-config.sh as a shared key-scoped check; gate-policy.sh runs it on every layer and treats an unreadable form as ON with a stderr line naming the file and key. Proof: docs/verification/gate-key-shape.md.
Review of the gate key check: a TOML 1.1 inline table spanning lines could hide a key line, and a quoted header or escaped key in any unrelated table turned every gate on. The scanner now counts braces, accepts quoted headers and escaped keys whose path cannot reach the guarded table, and the gate message names the file line.
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
A gate key written in a valid TOML form the line reader cannot read was skipped without a word.
[dev]+gate.proof_of_done = truereads to anyone as "turn proof_of_done on", butgate-policy.shsaw it as unset and the gate stayed off. This is the adjacent gap found while fixing #1278.gate-policy.sh enablednow checks every layer the key can come from: projectkit.toml[dev.gate],.kit.toml[gate](or their--atbase copies), the operator file and the kit root. A layer that writes the key in an unreadable form turns the gate ON, with a stderr line naming the file and the offending line. An oddtruegets what it meant; an oddfalsecannot switch a gate off.How. The left-to-right TOML scanner from #1278 moves into
lib/config/kit-config.shas_kit_toml_shape <file> <section> <key> <str|bool> <table|key>, and_kit_mc_shapebecomes a one-line wrapper. Key scope guards only<section>.<key>, so[[gate.hard_path_exempt]]stays fine.Review led to two scanner changes that the merge check shares. It now counts
{and}, so a TOML 1.1 inline table spanning lines refuses. It also accepts a quoted header or an escaped key in an unrelated table ([repo.labels."good first issue"]).Demo
Proof
docs/verification/gate-key-shape.md: the differential, the red run, the green runs, the fuzz, the independent review, the negative controls, the cost and the rollback.
gateand indev.gate. The reader alone: 833 and 1,078. The merge corpora, including the 59,547-file key-form corpus, also show 0 disagreements after the scanner change.kit.toml/.kit.tomlfiles from the local workspace, the operator file and this repo pass the check for all 7 gate keys. They also give the same merge result as master.enabledcall in an adopted repo, and 25 to 35 ms in this repo, which has two long files. Well inside the 500 ms hook budget.Bookkeeping
no-board-row: follow-up fix from a security review, one function plus its tests
This changes
lib/gate/gate-policy.sh, a Core gates one-way-door path, soscripts/pr-merge.shneeds a second maintainer's recorded approval before it will merge.