Skip to content

fix(code-review-rules): require exactly one org-wide criteria pointer - #719

Merged
kyle-sexton merged 3 commits into
mainfrom
feature/nice-thompson-05u2ui-669
Oct 6, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
feature/nice-thompson-05u2ui-669

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: partial fix for #669 (duplicate-pointer item); the issue stays open for the remaining items.

Summary

A stale second - Org-wide criteria: line beside the correct one passed components/code-review-rules/code-review-rules.sh, because the target test only asked whether any pointer line linked the expected target. This makes the checker require exactly one org-wide criteria pointer line.

Fix

  • code-review-rules.sh counts every line in the ## Code Review Rules section that opens with - Org-wide criteria:, linked or not. More than one fails with <n> org-wide criteria pointer lines, expected one. The single line must link REVIEW.md when the repository has a root REVIEW.md, and the canonical URL when it does not (targets unchanged).
  • code-review-rules.test.sh adds three failing fixtures (correct + stale, correct twice, correct + an unlinked line) and a fleet case that names the duplicate.
  • The component README states the exactly-one rule.

Verification

  • The new assertions failed before the fix (the duplicate fixtures exited 0 with OK:). After it, bash components/code-review-rules/code-review-rules.test.sh passes 39/39.
  • bash components/code-review-rules/code-review-rules.sh file passes on this repository's AGENTS.md.
  • shellcheck clean on both scripts; markdownlint-cli2 0 issues; lefthook pre-commit hooks pass.
  • Checked without changes: every needs entry of ci-status in pr-require-checks.yml appears in its results: list, and the mcp-launcher tests run in the test-cloud-environment lane (the code-review-rules: four follow-ups from the #656 rollout #669 mcp-launcher item was resolved by the ci(pr-require-checks): group the gate lanes into one job per ecosystem #699 regroup).

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01G3BsUv4VeQ81gAPhk73xvs


Generated by Claude Code

A stale second "- Org-wide criteria:" line beside the correct one passed
the check, because the target test only asked whether any pointer line
linked the expected target. The checker now counts every line in the
section that opens with "- Org-wide criteria:", linked or not, fails with
"<n> org-wide criteria pointer lines, expected one" when there is not
exactly one, and validates that single line's target.

Adds duplicate-pointer fixtures (correct plus stale, the correct line
twice, and correct plus an unlinked line) and a fleet case, and states the
exactly-one rule in the component README.

Part of #669.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01G3BsUv4VeQ81gAPhk73xvs
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 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-06T03:06:15.666588Z 4c49adf PR opened
ℹ️ 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.

@claude

claude Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 2m 38s —— View job


Code review complete

  • Gather context (PR body, diff, repo instructions)
  • Run /review:code-review per custom instructions
  • Post inline findings (none met the high-signal bar)
  • Final summary

Scope: all three changed files — components/code-review-rules/README.md, code-review-rules.sh, code-review-rules.test.sh — reviewed against the /review:code-review criteria (correctness + maintainability; this repo has no separate security lane for this component, and nothing here is security-relevant).

Findings: none blocking.

Traced the new duplicate-detection logic in code-review-rules.sh against each new test fixture (duplicate-stale, duplicate-same, duplicate-unlinked, plus the pre-existing wrong-target/no-pointer cases):

  • The pointer_label match (broader than the old pointer_prefix) correctly catches a stale/duplicate/unlinked second - Org-wide criteria: line while still falling through to "the inherited REVIEW.md pointer line is missing" when no such line exists at all (label mismatch, e.g. - Local rule:), matching the no-pointer fixture.
  • The anchored [[ "$pointers" == "${pointer_prefix}${expected})"* ]] check (replacing grep -qF) is only reached once count -eq 1 is established, so it's safe that it's now a single-line, start-anchored match rather than a substring search — no false pass/fail path found.
  • One minor, non-blocking behavior nuance: a single label-only line that isn't correctly formatted (e.g. just - Org-wide criteria: see the standards repository., with no correct pointer elsewhere) now reports "the REVIEW.md pointer must link …" instead of the old "pointer line is missing." Both are still failures (exit 1), so there's no false-pass risk — just a wording difference, and it isn't covered by a dedicated fixture. Not blocking.
  • README's updated "## Check" section accurately describes the new exactly-one-pointer rule.

Not independently verified: I don't have shell-execution permission in this environment, so I read the logic rather than running code-review-rules.test.sh, shellcheck, or markdownlint myself. The PR body's test/lint-pass claims are author-reported and unverified by me.

@claude

claude Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 1m 42s —— View job


Security review — no issues found

  • Gather context (PR diff, changed files)
  • Apply skip gate
  • Review code-review-rules.sh for logic/injection issues
  • Review code-review-rules.test.sh fixtures
  • Review README changes
  • Check for instruction-surface deletions
  • Post final findings

Scope reviewed: all three changed files — README.md, code-review-rules.sh, code-review-rules.test.sh.

This PR tightens an internal CI compliance checker (a bash script that validates a repo's AGENTS.md carries exactly one ## Code Review Rules org-wide criteria pointer). It's a correctness fix, not a weakening:

  • The diff narrows the previously-passing cases (requires exactly one pointer line instead of "at least one correct" pointer), so this is the opposite of an instruction-surface deletion — no standing guardrail was removed or softened.
  • No new untrusted input path is introduced. The repository content the script reads (AGENTS.md/REVIEW.md, fetched via gh api in fleet mode) is still only ever passed into awk via -v variable assignment or compared with quoted bash string equality ([[ "$pointers" == "..."* ]]) — never interpolated into executable code (no eval, no unquoted expansion into a command). That data-flow pattern is unchanged from before this PR.
  • The new [[ "$pointers" == "${pointer_prefix}${expected})"* ]] glob comparison replaces a grep -qF fixed-string check; the quoted left-hand operand and quoted prefix/expected substrings mean no part of the pattern is attacker-influenced or glob-metacharacter-bearing, so this is a faithful, non-exploitable like-for-like swap.
  • Test and README changes are fixtures/prose only, with no security surface.

No CRITICAL / IMPORTANT / SUGGESTION findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4c49adf586

ℹ️ 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".

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

claude-security-review has reviewed this pull request through 779e935; a later push is reviewed from there.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

claude-review has reviewed this pull request through 779e935; a later push is reviewed from there.

The pointer collector matched only lines that open with the label at
column one, so a stale `- Org-wide criteria:` bullet with leading spaces,
still a Markdown list item, was ignored and correct plus indented-stale
passed. Lines now count at any indentation, and the single counted
pointer must be unindented, since the inherited block is copied verbatim;
an indented one fails with its own message rather than a misleading
target error.

Adds fixtures for correct plus indented-stale and for an indented sole
pointer.

Part of #669.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01G3BsUv4VeQ81gAPhk73xvs
@claude

claude Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Code review in progress

  • Gather context (PR body, incremental diff, repo instructions)
  • Run /review:code-review for the incremental diff since 4c49adf
  • Post inline findings (if any)
  • Final summary

Scope: incremental diff only (commit 4c49adf → 889de01), covering the fix for Codex's "indented org-wide pointer bullets" finding, across README.md, code-review-rules.sh, code-review-rules.test.sh.

@claude

claude Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 1m 0s —— View job


Security review — no issues found

  • Gather context (PR body, incremental diff, repo instructions)
  • Invoke /review:security-review (incremental scope since 4c49adf)
  • Review the diff in .claude-lane/incremental.diff
  • Apply skip gate / instruction-surface lens
  • Post final findings

Scope reviewed (incremental, since 4c49adf): the full diff in .claude-lane/incremental.diff across all three changed files — README.md, code-review-rules.sh, code-review-rules.test.sh. This increment addresses the Codex P2 comment on the prior commit (indented stale pointer bullets escaping the exactly-one check).

This is an internal CI compliance checker (validates a repo's AGENTS.md carries exactly one unindented org-wide criteria pointer). The increment is a tightening, not a weakening:

  • code-review-rules.sh#L103-L106: the awk match now strips leading whitespace (sub(/^[[:space:]]+/, "", s)) before comparing against pointer_label, so an indented duplicate/stale pointer line is now counted toward the "more than one" failure — closing exactly the gap the prior reviewer flagged. The variable is still passed via awk -v, never interpolated into executable code; no injection surface.
  • code-review-rules.sh#L116-L120: a new explicit check rejects a single pointer line that is itself indented ("must not be indented"). Before this increment, an indented lone pointer would have failed anyway via "the inherited REVIEW.md pointer line is missing" (the old unindented-only match wouldn't have found it) — so the exit code and fail-closed behavior are unchanged; only the diagnostic message is more precise now.
  • Net effect: strictly more stale/duplicate/indented pointer configurations now fail the check; no previously-failing input is made to pass. I checked for the inverse (an input that passed before and now wrongly passes, or a correct single unindented pointer wrongly rejected) and found neither — the happy-path synced fixture logic is untouched.
  • README and test changes are prose/fixtures only, consistent with the new behavior; no security surface.

Instruction-surface lens: this script enforces (doesn't itself constitute) the AGENTS.md org-wide-criteria pointer rule; the increment strengthens enforcement rather than deleting, narrowing, or softening any rule, so the protected-class register does not apply here.

No CRITICAL / IMPORTANT / SUGGESTION findings.

@claude

claude Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 1m 26s —— View job


Code review complete

  • Gather context (PR body, incremental diff, repo instructions)
  • Run /review:code-review for the incremental diff since 4c49adf
  • Post inline findings (none met the high-signal bar)
  • Final summary

Scope: incremental diff only (commit 4c49adf → 779e935), covering the fix for Codex's "indented org-wide pointer bullets" finding, across README.md, code-review-rules.sh, code-review-rules.test.sh.

Findings: none blocking.

Traced the updated collector and the new indentation guard in code-review-rules.sh against the new fixtures:

  • The collector now matches pointer_label against a whitespace-stripped copy (s) of each line but still prints (and stores into pointers) the original, unstripped $0. That's the right split: duplicate-detection (count -ne 1) now catches an indented stale pointer beside the correct one, while the later [[ "$pointers" == [[:space:]]* ]] check still sees the real leading whitespace on the single surviving line to flag a lone indented pointer. Traced both new fixtures — duplicate-indented (count reaches 2, returns before the indentation check is ever reached) and pointer-indented (count is 1, falls through to the indentation check) — against their expected messages and both line up.
  • The indentation check sits after the count -ne 1 return and before the target-match comparison, so an indented pointer can't slip past as a false "wrong target" message instead, and a duplicate still reports as a duplicate first (unchanged precedence from before this PR, just now indentation-aware).
  • code-review-rules.sh line 122-123 is a pure reformat (|| moved to end of the prior line), no behavior change.
  • README's "## Check" section update (L89-L92) accurately describes both the any-indentation duplicate rule and the new unindented-single-pointer requirement.
  • Test fixtures (duplicate-indented, pointer-indented) correctly build the intended section shapes via the existing section/printf helpers, and their assert_contains checks match the exact new error strings the script emits.

This directly resolves the Codex P2 finding (indented second pointer bypassing the exactly-one check) without reopening the target-match or duplicate-detection paths it added in the prior commit.

Not independently verified: no shell-execution permission in this environment, so this is a logic trace rather than an actual run of code-review-rules.test.sh, shellcheck, or markdownlint.

@kyle-sexton
kyle-sexton merged commit 990ede9 into main Oct 6, 2026
22 checks passed
@kyle-sexton
kyle-sexton deleted the feature/nice-thompson-05u2ui-669 branch October 6, 2026 03:11
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