Skip to content

feat(agent-docs-audit): delta-only high-confidence CI gate#3301

Merged
caio-pizzol merged 2 commits into
mainfrom
caio/agent-docs-pr-gate
May 14, 2026
Merged

feat(agent-docs-audit): delta-only high-confidence CI gate#3301
caio-pizzol merged 2 commits into
mainfrom
caio/agent-docs-pr-gate

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Adds a delta-only CI gate to the agent-docs audit. The workflow now fails only when a PR introduces new high-confidence findings vs base; existing baseline debt and heuristic classes stay warning-only.

  • Blocking classes (parse/filesystem-level, near-zero false positives): broken @imports, broken symlink targets, linked-inverted and unexpected-duplicate pairs.
  • Non-blocking, still surfaced in the sticky comment: broken path refs (backtick regex, false-positive prone), budget warnings, unresolved pnpm commands.
  • Gate scans origin/$BASE_REF in a tmp worktree, set-diffs high-confidence finding identities vs PR head, scopes to files/dirs the PR actually changed.
  • The comment prepends a "Blocking" header sourced from the gate's JSON output so reviewers see why CI is red without opening logs.

#3300 (test PR with an intentional broken @import) stays open as the first live test. Once this lands, the next run there should turn red for the right reason.

Fails the workflow when a PR introduces new high-confidence findings vs
base, while leaving existing baseline debt and heuristic classes warning-
only.

High-confidence classes that block CI:
- broken @imports
- broken symlink targets
- linked-inverted pairs
- unexpected-duplicate pairs

Heuristic/advisory classes (still warning-only via the comment):
- broken path refs (backtick regex, known false-positive prone)
- budget warnings
- unresolved pnpm commands

Mechanics: a separate gate script worktree-scans origin/$BASE_REF and
diffs high-confidence finding identities against the PR head, scoped to
files (or pair-dirs) the PR actually changed. Result is written to
/tmp/agent-docs-gate.json; the comment script reads it and prepends a
'Blocking' header so reviewers see why CI is red without opening logs.
@caio-pizzol caio-pizzol requested a review from a team as a code owner May 14, 2026 15:16
Copy link
Copy Markdown

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

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: c7e928e53a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +152 to +155
const scoped = newFindings.filter((f) => {
if (f.type === 'pair') return dirSet.has(f.dir);
return changedSet.has(f.relPath);
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Block broken imports caused by changed targets

When a PR deletes or renames an imported agent-doc target such as .claude/rules/foo.md without editing the importing AGENTS.md, highConfidenceFindings() correctly reports a new broken import on the importer, but this filter drops it because changedSet only contains the changed/deleted target path. Since .claude/rules/** changes trigger this workflow, those PRs can introduce a new broken @import and still pass the new gate; the import case needs to also scope against changed import targets, not only f.relPath.

Useful? React with 👍 / 👎.

@@ -0,0 +1,172 @@
#!/usr/bin/env node
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add the gate script to PR path filters

This new script is invoked by agent-docs-audit.yml, but the workflow's pull_request.paths list still matches the audit, L1, and PR-comment scripts only, not .github/scripts/agent-docs-pr-gate.mjs. As a result, a PR that changes only the blocking gate logic will not run this audit workflow at all, so regressions in the new CI gate can be merged without the workflow validating them.

Useful? React with 👍 / 👎.

Adds a fifth high-confidence blocking class: when a PR transitions a dir
from a paired classification (linked, linked-inverted,
unexpected-duplicate, intentional-different) to 'single', the gate fails.
Legitimate-single dirs are unaffected since this check is delta-only.

Also fixes a gap where the comment script took the 'resolved' path when
the PR deleted an agent-doc file, hiding the gate's Blocking banner. The
banner now renders in both the findings and clean paths whenever the gate
result file marks blocking=true.
@caio-pizzol caio-pizzol merged commit d4d2eb1 into main May 14, 2026
12 checks passed
@caio-pizzol caio-pizzol deleted the caio/agent-docs-pr-gate branch May 14, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant