mind_commit_guard v1.1: token-level clause parsing#133
Merged
Conversation
The guard's first live hour produced two false positives on its own author: a gh-comment body whose prose contained the trigger words, and a semicolon inside a quoted -m message that stranded the -- pathspecs in the next raw regex clause. v1.1 splits clauses at token level (shlex punctuation_chars, quotes respected), so quoted strings can neither leak trigger words nor swallow the pathspec section; unparseable input fails open. Both live incidents are regression tests; bare/directory denials unchanged. Co-Authored-By: Claude Fable 5 <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.
Summary
The guard shipped in #132 fired twice in its first hour — both false positives on its own author (F5-class, exactly the cost the doc warns trains bypass-by-default): a
gh issue commentwhose quoted body prose contained the trigger words, and a;inside a quoted-mmessage that made the raw-regex clause splitter strand the--pathspecs. v1.1 replaces textual clause splitting with token-level parsing (shlexwithpunctuation_chars, quotes respected): quoted strings are single tokens that can neither leak trigger words nor swallow the pathspec section. Unparseable input (heredocs, unbalanced quotes) fails open. Both live incidents are regression tests; all denial behaviour unchanged (13 guard tests, suite 117).Shipped under the standing corrective-PR exception (Heart RED).
API Changes
None.
Test Plan
Generated by the PyAutoLabs agent workflow.