Repository navigation
fix(pr-convention-policy): stop pinning the lockstep parser to declaration flags - #520
Conversation
Mechanical only, no behavior change: the live check still fails with exactly the error it failed with before this commit, and the 13 existing tests still pass. These two files had never been Biome-formatted, because the CI Biome job scopes itself to a path list that does not include this component while the lefthook lane globs every staged JS/TS file. Touching either file for any reason therefore drags in the accumulated formatting diff, which would bury a one-line change. Landing it on its own so the fix that follows stays reviewable. The three console calls are the CLI entrypoint's interface, not stray debugging, so they get per-call suppressions with that justification rather than a component-wide rule disable that would blind noConsole everywhere else here. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ation flags `main` has been red since ci-workflows 3e32b0a landed on 2026-09-02T06:48Z, 44 minutes after this repo's last CI run, so no run had seen it until now. That commit made `CLOSING_KEYWORD` global, `/gi;`, so every occurrence on a line can be classified. The parser matched a literal `/i;`, so it stopped finding the declaration and reported `gate reusable: CLOSING_KEYWORD / NO_ISSUE_MARKER regex declarations not found`: a parse failure wearing a drift error's clothes, on a gate that had not drifted at all. Flags on the declaration were never part of the contract. Only the pattern body is extracted, and both probes are constructed with "i" regardless, so pinning the flag set asserted an incidental detail of how the reusable happened to be written. Accept any valid flag set; real drift is still caught functionally by probing the extracted body against every policy keyword and marker. Confirmed against the live sources that nothing else had drifted: with this fix the check reports "all copies and caller pins match policy.json" and exits 0. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @kyle-sexton's task in 2m 41s —— View job Code review complete ✅
Scope: Verified independently (not just restating the author's claims):
Not independently executed: I did not run Findings: None that clear the high-signal bar (no correctness bugs, no missed edge cases in the regex logic, no security surface). The three near-identical |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4344d9a509
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count. |
…oded i Review caught a real hole in the previous commit. Accepting any flag set while rebuilding both probes with a hardcoded "i" meant a gate that DROPPED `i` would still be probed case-insensitively and pass. Both declared bodies are lowercase and depend on `i` to accept the documented `Closes #12`, so that gate would have become case-sensitive in production while this check reported it healthy, which is precisely the enforcement drift the check exists to catch. Capture the flags and build each probe from them. `g` and `y` are stripped, because they make `.test()` advance lastIndex and assertPatternsEnforce probes each pattern once per policy keyword, so a retained `g` would make every probe after the first read a moved cursor rather than the pattern. Neither flag changes what the pattern matches, so dropping just those two is safe; every behavior-affecting flag now survives into the probe. Two tests added: a gate declared `/g;` without `i` is reported as enforcement drift naming the rejected `Closes` keyword, and a `/gi;` gate probes true for every policy keyword in sequence rather than only the first. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…from comments The comment-hygiene lane reads a closing keyword followed by `#<digits>` as a tracker reference, and two of the new comments spelled one out as the example of what the lowercase pattern bodies need the `i` flag to accept. The scanner is right that the form does not belong in a comment; the point survives fine as "the documented capitalised keyword forms". Comment text only. No behavior change: 16 tests still pass and the live check still reports all copies and caller pins matching. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
No linked issue: found while driving #519, whose CI was red for a reason unrelated to its diff.
Summary
mainis red onpr-convention-lockstep, and has been since 2026-09-02, on a gate that has not actually drifted. The check stopped being able to read the reusable and reported that as drift. This restores it.Fix
parseGatePatternsmatched the gate's regex declarations with a literal/i;terminator. melodic-software/ci-workflows commit3e32b0amadeCLOSING_KEYWORDglobal,/gi;, so every occurrence on a line can be classified. The match then failed and the check raisedgate reusable: CLOSING_KEYWORD / NO_ISSUE_MARKER regex declarations not found, which reads as drift but is a parse failure.Declaration flags were never part of the contract this check enforces. Only the pattern body is extracted, and both probes are rebuilt with
"i"regardless, so pinning the flag set asserted an incidental detail of how the reusable happened to be written on the day the parser was authored. The matcher now accepts any valid flag set. Drift detection is unchanged and still functional: the extracted body is probed against every policy keyword and marker, so a keyword surviving only in a comment still fails.Why
mainwent red without anyone touching it: this repo's last CI run onmainwas 2026-09-02T06:04Z and the ci-workflows commit landed at 06:48Z, 44 minutes later. No run had observed it until #519 opened.Verification
main's own tree before changing anything:node components/pr-convention-policy/lockstep-drift.mjsagainst live sources fails with the exact CI message.pr-convention lockstep: all copies and caller pins match policy.jsonand exits 0. That is the load-bearing check that no real drift was hiding behind the parse failure, so this is not a detector being loosened to hide a problem.npm run test:pr-convention-lockstep: 14 tests, 14 pass.declaration flags are not part of the contracttest.gi-declared gate still yields probes that matchCloses #12andNo linked issue, the rebuilt probe is not global, and the extracted body is identical whichever flags were declared.Two commits, deliberately.
e11eb1cis mechanical Biome formatting plus three per-callnoConsolesuppressions for the CLI entrypoint; it landed on its own because these files had never been Biome-formatted. The CI Biome job scopes itself to a path list that excludes this component while the lefthook lane globs every staged JS/TS file, so any edit here drags the accumulated formatting diff in.4344d9ais the actual fix. Reviewing the second commit alone is sufficient, and the first is verified behavior-neutral: after it, the live check still failed with exactly the original error and the 13 pre-existing tests still passed.Related
components/claude-permissionsand is otherwise green.3e32b0a, the upstream change that exposed the brittleness. It is correct and needs no revert.🤖 Generated with Claude Code