Skip to content

fix(pr-convention-policy): read the bounded-scan window in the hook validator - #862

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/lockstep-negation-window
Oct 24, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/lockstep-negation-window

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: standards main is red on check-pr-convention-copies since melodic-software/claude-code-plugins#9476 changed the hook validator's negation scan (standards run https://github.com/melodic-software/standards/actions/runs/40036458752).

Summary

parseValidatorNegation reads the hook validator's word window from ((n > 5)) && first=$((n - 5)). claude-code-plugins#9476 replaced that forward pass with a backward scan bounded by ${#words[@]} < 5, so the parser found no window and check-pr-convention-copies failed every standards run, PRs included.

Fix

  • components/pr-convention-policy/lockstep-drift.mjs: the window matches either form; the "not only" exception and trigger case anchors are unchanged.
  • components/pr-convention-policy/fixtures/lockstep/pr-linkage-validator-bounded-scan.sh.txt: the validator as on claude-code-plugins main.
  • components/pr-convention-policy/lockstep-drift.test.mjs: the bounded-scan validator parses to the policy's negation data and passes checkCopies, which runs the behavioral layer on it.

Verification

  • npm run test:pr-convention-policy: 11/11 pass.
  • node --test components/pr-convention-policy/lockstep-drift.test.mjs: 93/93 pass.
  • npm run lint:pr-convention-copies against live claude-code-plugins main: "every copy matches policy.json".

Related

melodic-software/claude-code-plugins#9476

🤖 Generated with Claude Code

…alidator

claude-code-plugins #9476 made negation_trigger_to scan backward until it holds
five words (`${#words[@]} < 5`) instead of keeping `n - 5` onward, so
parseValidatorNegation no longer found the window and check-pr-convention-copies
went red on main. The parser now accepts either form; a bounded-scan validator
fixture is parsed and run through checkCopies, behavioral layer included.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 24, 2026 01:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T01:05:16.939868Z e03f3c8 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

claude-security-review reviewed e03f3c82d33841c879a92e7102ab9cd8b0fd502e: 0 finding(s), 0 as inline comments.

Security review: PR 862 @ e03f3c8

No security issues found.

critical-findings: 0

Scope: three files, all in components/pr-convention-policy/.

  • lockstep-drift.mjs: parseValidatorNegation now falls back to a second regex, i >= 0 && ${#words[@]} < N;, when the old first=$((n - N)) form isn't found. Both patterns are fixed-length with no nested quantifiers, so there is no ReDoS risk. The function only reads text and returns a number. It adds no execution, file, network or privilege path.
  • fixtures/lockstep/pr-linkage-validator-bounded-scan.sh.txt: a new fixture with a .txt extension. The drift checker only reads it as a string and runs regexes against it. lockstep-drift.mjs contains no spawn, exec or bash call, and nothing sources the file. It copies validator shell code that already exists elsewhere.
  • lockstep-drift.test.mjs: adds one test and one assertion that load the fixture. It adds no new trust surface.

The change widens which validator form the drift check accepts. The behavioral layer still checks the parsed window values against policy.json, so a validator that drifted would still be reported. No guard is removed.

  • manifest fields: not hit
  • trust-gate paths: not touched
  • hold: none
  • The instruction-exception register was not consulted, because the diff deletes no standing instruction.

@github-actions

Copy link
Copy Markdown

claude-review reviewed e03f3c82d33841c879a92e7102ab9cd8b0fd502e: 0 finding(s), 0 as inline comments.

No findings. I read the full diff and the PR context, and I read checkHookBehavior in lockstep-behavior.mjs.

  • Parser change: parseValidatorNegation in lockstep-drift.mjs now tries the old forward-pass pattern, then falls back to the bounded-scan loop i >= 0 && ${#words[@]} < N;. In the new fixture, line 148 reads for ((i = ${#toks[@]} - 1; i >= 0 && ${#words[@]} < 5; i--)); do, which matches. The "not only" exception and the trigger case patterns also match the fixture, as the PR says. Keeping the old pattern first means the existing forward-pass fixture still parses.
  • Behavioral coverage: The window regex only checks that a loop with that bound exists. checkHookBehavior is the check that confirms the verdict, and it sources the validator and runs the sample-body matrix. The new test passes the bounded-scan fixture through checkCopies, so that behavioral layer runs on it.
  • Closing issue: The PR has no closing issue (No related issue: with a reason), so there are no acceptance criteria to check. The body has the required sections.
  • Not run: The sandbox denied node --test here, so I did not run the tests. The 11/11, 93/93 and live-lint results in the PR body are author-claimed and unverified by me.
  • Hold classes: No cost or trust-gate files are touched.

@kyle-sexton
kyle-sexton merged commit cba6bcc into main Oct 24, 2026
24 checks passed
@kyle-sexton
kyle-sexton deleted the fix/lockstep-negation-window branch October 24, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant