Repository navigation
ci: run the rules-index check on every pull request - #15965
Conversation
The AGENTS.md "Conventions that load on demand" table is generated from .claude/rules/ and the nested instruction files, but only an opt-in local git hook checked it. A new rules-index hygiene step in lint-repo runs `render-index.sh check --file AGENTS.md`, and its outcome is a row in the aggregate hygiene result. On drift, `render-index.sh check` now prints one ADD, CHANGE or REMOVE line per differing row, keyed by surface path, then a FIX line with the write command. The pre-commit hook prints the same row lines. What counts as drift is unchanged. AGENTS.md points at the check below the generated table. Closes #15933 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VcupojPZLwoMUhW1ApGhJc
Codex Review Summary: ✅ CompletedThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49c4a2e29d
ℹ️ 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-security-review reviewed Security review: PR #15965 at
|
|
claude-review reviewed Code review: PR #15965 at
|
…t scripts pr-require-checks.yml now runs plugins/instruction-placement/scripts/ render-index.sh, so test_merge_holds_sync.py requires that directory in CARRY_REFUSES: a push touching a script a hold path runs must stop an approval carrying. Add it to both copies of the list (babysit_merge_policy.py and merge-holds.mjs). Refs: #15933 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VcupojPZLwoMUhW1ApGhJc
`check` renders from --root, but the FIX line it printed had only --file, so running it from another directory rendered that directory's rules into the target. The FIX line now carries --root, and a test runs it from an unrelated directory and checks the target comes back in sync. Refs: #15933 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VcupojPZLwoMUhW1ApGhJc
Closes #15933
Summary
A pull request that adds, removes or renames a file under
.claude/rules/(or a nestedAGENTS.md/CLAUDE.md) without regenerating the "Conventions that load on demand" table inAGENTS.mdnow fails CI. The check already existed as the instruction-placement plugin's opt-in pre-commit hook; nothing ran it in CI, and the table drifted twice.Dogfooding step: this repository's own
lint-repojob now runs the instruction-placement plugin'srender-index.sh checkon every pull request, as therules-indexhygiene gate.Fix
.github/workflows/pr-require-checks.yml: new ungated steprules_index(bash plugins/instruction-placement/scripts/render-index.sh check --file AGENTS.md), run throughscripts/run-hygiene-gate.sh rules-index, with arules-index=row in the "Aggregate hygiene results"CHECK_RESULTSlist. Ungated because a rules-only change is docs-only, the exact edit that leaves the table stale.scripts/check-affected-gates.txt:rules-indexlisted as a CI-only whole-repo scanner.render-index.sh checkfailure message now names the fix: afterDRIFTEDit prints oneADD,CHANGEorREMOVEline per differing row (keyed by the surface path, with the row's text), aNOTEline when every row matches and only the surrounding text differs, then aFIXline with thewritecommand, naming both--fileand--rootso it rewrites the same tree from any directory (a review finding on this PR). What counts as drift is unchanged.git-hooks/index-check.shprints the same row lines under its own regenerate command (not check'sFIXline, which names the pre-commit scratch tree).AGENTS.md: one line below the generated table says CI'srules-indexcheck fails a PR that leaves it stale. It sits outside the generated block, so the renderer's preamble, which every consuming repository gets, is unchanged.CARRY_REFUSES(babysit_merge_policy.pyand.github/scripts/pr-merge/merge-holds.mjs, the same list) addsplugins/instruction-placement/scripts/**: the workflow now runs a script from there, andtest_merge_holds_sync.pyrequires every script a hold path runs to stop an approval carrying. Found by the first CI run on this PR.Verification
Current main:
render-index.sh check --file AGENTS.mdprintsIN-SYNC(exit 0), before and after rebasing onto the latest main.Demo from the issue, on a throwaway checkout with
.claude/rules/demo-rule.mdadded and staged and no row: exit 1 withrender-index.test.sh: 141 cases, 0 failures (new: ADD row and FIX line, the FIX command run from an unrelated directory restores sync, CHANGE and REMOVE rows, NOTE when only the preamble drifts).index-check.test.sh: 24 passed (new: the hook names the row and omitsFIX).check-affected-gates.test.sh6/6;check-lane-coverage.sh --check: all 84 gate steps fed to the aggregator;aggregate-hygiene-results.sh --self-testpassed;actionlintandshellcheckon the changed files clean.test_merge_holds_sync.py21 OK, the babysit risk and floor-path tests OK,merge-holds.test.mjs71/71, ruff clean.Left out: the full
.githubsuite (CI runs it).Related
🤖 Generated with Claude Code