Skip to content

fix(governance-paths): recognize trusted-bots.yml and main.json as governance-sensitive - #1881

Merged
tvna merged 6 commits into
mainfrom
claude/governance-classifier-trusted-bots-dknenw
Sep 6, 2026
Merged

tvna merged 6 commits into
mainfrom
claude/governance-classifier-trusted-bots-dknenw

Conversation

@tvna

@tvna tvna commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Summary

Add .github/trusted-bots.yml and .github/rulesets/main.json to _GOVERNANCE_FILENAMES in gitapex_check_canonical_governance_paths.py so both are correctly classified as governance-sensitive files.

Facts

Assumptions

None (implementation follows issue #1875's own Acceptance Criteria Map, amended per the Step 8 finding above with owner approval -- see issue #1875's own "Scope amendment" section).

Risk / blast radius

Low. Adds two entries to the _GOVERNANCE_FILENAMES tuple plus regression tests; no other classification list or branch (_WORKFLOW_PREFIXES / _HOOK_SCRIPT_PREFIXES / _DEPENDENCY_MANIFEST_FILENAMES, etc.) is touched. This classifier is a deterministic pre-filter only; both .github/trusted-bots.yml and .github/rulesets/main.json already carry a CODEOWNERS entry requiring @tvna's review, so this gap was not itself an exploitable vulnerability before this fix -- only a completeness gap in one defense-in-depth layer.

Rollback

Revert these commits to restore _GOVERNANCE_FILENAMES to its prior state. No other protection (CODEOWNERS, etc.) is touched, so it remains in place after a revert.

Verification

Acceptance Criteria Map (carried over from issue #1875, amended per its own "Scope amendment" section; a draft, independently re-check each row against this PR's own diff rather than trusting it as-is):

Criterion Interpretation Planned ops Proof method Result
Classifier recognizes .github/trusted-bots.yml as governance Add .github/trusted-bots.yml as one entry in the _GOVERNANCE_FILENAMES tuple Add one line (with a rationale comment) to _GOVERNANCE_FILENAMES Add regression test; pytest passes in full Done. Committed at 36563c94. Manual CLI check confirms governance: .github/trusted-bots.yml
Classifier recognizes .github/rulesets/main.json as governance (Scope amendment) Add .github/rulesets/main.json as one entry in the _GOVERNANCE_FILENAMES tuple Add one line (with CODEOWNERS's own rationale as comment) to _GOVERNANCE_FILENAMES Add regression test; pytest passes in full Done. Committed at 1ebd9207. Manual CLI check confirms governance: .github/rulesets/main.json, and confirms no collision with .github/scripts/ (hook-script) classification
Existing governance-file classification logic stays intact No other classification list/logic is touched Limit the change to the tuple entries and their own regression tests All 13 existing tests plus new tests pass Done. Full repo suite and local-preflight (47 gates) also pass after every commit

Checklist

  • Tests pass locally
  • Docs updated if behavior changed
  • Issue number cited in every commit
  • If this PR adds/modifies a skills/*/SKILL.md, a docs/superpowers/specs/*.md design doc, a security-relevant skill, or a deterministic checker script (skills/*/scripts/*.py, evals/scripts/*.py, .github/scripts/*.py), a ## Skill audit evidence section discloses the required verdicts/waivers (see .github/scripts/gitapex_gate_skill_audit_disclosure.py)
  • If this PR adds a new Kept-edit-log entry to any evals/*/split.md, that entry discloses a Transfer check line (see .github/scripts/gitapex_gate_transfer_check_disclosure.py)
  • If this PR adds or increases a skills/*/SKILL.md's Stop-boundary bullets or named dispatch branches, evals/<skill>/tasks/*.yaml gained at least as many new fixtures (see .github/scripts/gitapex_gate_skill_branch_fixture_coverage.py)

Skill audit evidence

  • checker-script-adversarial-review: RAN -- an independent adversarial review (Step 8, review-persona dispatch) checked path-normalization edge cases, interaction with _HOOK_SCRIPT_PREFIXES, near-miss path evasion, and rationale accuracy against the real consuming gate and CODEOWNERS for skills/executing-a-branch-plan/scripts/gitapex_check_canonical_governance_paths.py. It found one real completeness gap (the .github/rulesets/main.json finding described above), which this PR now also addresses. A separate behavior-preserving refactor/simplify pass (branch-plan-task dispatch) found the added lines already consistent with the file's existing conventions and made no changes.
  • defeat-test-disclosure: RAN -- added tests confirming an extension/case near-miss variant of either new entry is NOT swept in as a false governance match, per the review's own finding above, and confirming .github/rulesets/main.json is not accidentally absorbed by the .github/scripts/-prefixed hook-script or .github/workflows/-prefixed workflow branches.

Independent review verdict

  • Verdict: CLEAN
  • Verified commit: 638982f

Outer layer: GitHub Copilot review was requested (request_copilot_review) shortly after the inner-layer fan-out below started. The repository owner directed this session to proceed without awaiting Copilot's response, so this layer is disclosed as requested-but-not-awaited, not as a clean pass. No confirmation that Anthropic's "Claude Code Review" GitHub App is installed on this repository.

Inner layer (reviewing-an-artifact, low effort, against commit 1ebd9207's diff -- trusted-bots.yml plus main.json additions and their tests):

  • Classification: dangerous/mixed (the diff edits a security-relevant classifier's own detection data), so the full 5-axis fan-out ran (no safe-side skip).
  • Correctness: no findings. The one stylistic redundancy noted (a same-shaped positive/negative assertion pair) was judged a pre-existing, deliberate convention in this file, not a defect.
  • Blast-radius: no findings. No other script or test in the repository hardcodes _GOVERNANCE_FILENAMES's prior contents or length; no caller behavior changes unexpectedly.
  • Reuse/simplification: 3 findings, CONFIRMED and fixed in commit 638982f0 -- merged two same-pattern tests into one, dropped a redundant not in assertion the positive assertion already implied, shortened a comment that restated CODEOWNERS almost verbatim.
  • Convention: 1 finding, CONFIRMED and fixed in commit 638982f0 -- a new comment block's line-wrap width (80-89 chars) deviated from this file's own ~75-78 char convention; resolved as part of the same merge that shortened the comment.
  • Security: no findings in this diff itself. Noted, out of this diff's scope, that .github/rulesets/main.json's existing required_approving_review_count: 0 setting is a pre-existing repository configuration choice this PR does not touch or introduce.
  • Re-verification after the fix commit (638982f0): target test file 16/16 passed, full repo suite and local-preflight (47 gates) green; the merged/shortened diff was read again directly and confirmed to still satisfy every finding above with no new issue introduced.
  • 0 confirmed findings outstanding as of 638982f0.

Merge gate: independent review

This PR is also subject to the independent-review-pending required
status check (see .github/workflows/independent-review-pending.yml /
.github/scripts/gitapex_gate_independent_review_pending.py). It stays
pending/failing until a ## Independent review verdict section naming
this PR's current head commit is recorded in this body --
drafting-a-pr-to-merge's own Step 8 records it once its independent
review completes. There is nothing for you to do here now: do not
pre-fill this section yourself, and do not remove this note.

Related Issue

Closes #1875

Execution log

  • PlanApproved{run_id: 2026-09-06-governance-classifier-trusted-bots}
  • StageDeviated{run_id: 2026-09-06-governance-classifier-trusted-bots, task_id: A, reason: "screening-a-low-trust-contribution check 4 (hook/script path modification) hard-flagged this task's own diff -- both changed files (gitapex_check_canonical_governance_paths.py, test_gitapex_check_canonical_governance_paths.py) live under skills/*/scripts/**, an unconditional-escalation category per that skill's own rules regardless of how benign the change reads. Content is purely additive and non-weakening (adds one _GOVERNANCE_FILENAMES entry + one regression test; strengthens rather than weakens the classifier), but executing-a-branch-plan Step 6/7 requires escalation on any screening flag with no retry.", action: escalate}
  • Repository owner confirmed intentionality (in-session approval) to proceed with commit and push despite the check-4 flag.
  • TaskCompleted{run_id: 2026-09-06-governance-classifier-trusted-bots, task_id: A, commit_sha: 36563c947fec282d96cb51980c5c506b7d7cd381}
  • Step 8 refactor/simplify pass (branch-plan-task): reviewed both files' new lines against sibling conventions (comment style, test assertion pairing, placement, naming); found no genuine simplification; made no edits. Full suite + local-preflight re-confirmed green.
  • Step 8 independent adversarial review (review-persona): CONFIRMED one completeness-gap finding -- .github/rulesets/main.json shares the same CODEOWNERS-documented risk class as trusted-bots.yml (issue feat(ci): exempt trusted bots from independent-review-pending's human-verdict requirement #1858's second trust anchor) but was left uncovered by this classifier. No other defect found (path-normalization, _HOOK_SCRIPT_PREFIXES interaction, and rationale-accuracy checks all cleared).
  • Repository owner approved widening this PR's scope to also add .github/rulesets/main.json (issue fix(governance-paths): recognize .github/trusted-bots.yml as governance-sensitive #1875's own "Scope amendment" section records this).
  • TaskCompleted{run_id: 2026-09-06-governance-classifier-trusted-bots, task_id: A2, commit_sha: 1ebd9207}: added .github/rulesets/main.json to _GOVERNANCE_FILENAMES plus regression test. Commit-message provenance scan clean.
  • origin/main drift check (issue Local pre-push mirror gap, root-caused: session-start.sh never installs the pre-push shim (consolidates #1336/#1361/#1362) #1387) ran before pushing 1ebd9207: branch was 4 commits behind origin/main (unrelated review-persona.md call-site fix, PR fix(review-persona): add merge-retrospective Step 4b to Sanctioned call sites #1880); merged cleanly (no conflict); re-ran the target test file before pushing.
  • CI's skill-audit-disclosure check flagged this PR's own ## Skill audit evidence section for two gaps: the checker-script-adversarial-review line's verdict token was not on its own recognized shape (a trailing period defeated the disclosure-line parser), and a required defeat-test-disclosure line was missing entirely. Fixed by adding two defeat tests (commit 6bd861b0) and rewriting this section in the parser's exact recognized shape.
  • TaskCompleted{run_id: 2026-09-06-governance-classifier-trusted-bots, task_id: A3, commit_sha: 6bd861b0}: added the two defeat tests above. origin/main drift check re-run before pushing: 0 commits behind. Target test file, full repo suite, and local-preflight all pass.
  • drafting-a-pr-to-merge Step 8 (inner layer, reviewing-an-artifact, low effort) ran against commit 1ebd9207's diff via a 5-axis fan-out (review-persona dispatch per axis). CONFIRMED 3 reuse/simplification findings and 1 convention finding (see Independent review verdict section above); 0 correctness/blast-radius/security findings.
  • TaskCompleted{run_id: 2026-09-06-governance-classifier-trusted-bots, task_id: A4, commit_sha: 638982f0}: fixed all 4 CONFIRMED findings (merged two tests, dropped a redundant assertion, shortened two comments). origin/main drift check re-run before pushing: 0 commits behind. Target test file (16/16), full repo suite, and local-preflight (47 gates) all pass. Outer-layer Copilot review requested; repository owner directed proceeding without awaiting its response.

Note: the task's first commit attempt carried a Claude-Session trailer, which gitapex_check_task_commit_provenance.py hard-flagged (CONTRIBUTING.md's PR-body trailer exception does not extend to commit messages). Amended locally to drop that trailer before pushing; every pushed commit scans clean.

The ruleset-scan CI failure on an earlier head (b20c9bc) was confirmed by the repository owner to be an unrelated infrastructure issue (an astral-sh/setup-uv manifest fetch failure), not caused by this PR's diff.

Refs #1875

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SRbLo6AZEM8C8PxnEHChdc
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 022627a5-f2fd-4c96-bbbc-877f7ebf1cc2


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.56%. Comparing base (e6722d9) to head (638982f).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1881   +/-   ##
=======================================
  Coverage   99.56%   99.56%           
=======================================
  Files         168      168           
  Lines       27975    27975           
  Branches     3390     3390           
=======================================
  Hits        27852    27852           
  Misses        123      123           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

tvna commented Sep 6, 2026

Copy link
Copy Markdown
Owner Author

Escalation: per-task screening hard flag (check 4)

executing-a-branch-plan Step 6's per-task screening dispatched this task's own diff (adding .github/trusted-bots.yml to _GOVERNANCE_FILENAMES in gitapex_check_canonical_governance_paths.py, plus a regression test) to screening-a-low-trust-contribution checks 2-8 via a review-persona subagent.

What was tried: the implementation was written and locally verified (pytest on the target test file: 14/14 passed; full repo suite: 8738/8738 passed; local-preflight: 47/47 gates passed; manual CLI check confirmed .github/trusted-bots.yml now classifies as governance). Before committing, the diff was screened per Step 6's mandatory per-task screening.

What the screening found: checks 2, 3, 5 (N/A -- no dependency manifest touched), 6, 7, 8 all cleared. Check 4 (hook/script changes) hard-flagged this diff, because both changed files live under skills/*/scripts/** -- one of this repository's own illustrative hook/script path categories, escalated unconditionally regardless of how the change reads. The reviewer noted the change is purely additive and strengthens (never weakens) the classifier, but per screening-a-low-trust-contribution's own Stop boundaries, a hard flag is never self-cleared on that basis.

Why this is escalated rather than fixed and committed: executing-a-branch-plan Step 7 states "a screening flag ... -> escalate ... these are not proof-method failures and get no retry at all," and Step 6 states "a flagged diff never proceeds to commit." This flag appears structurally unavoidable for this specific issue (#1875) -- the very target file this fix touches (the governance-path classifier itself) sits under the same skills/*/scripts/** prefix that check 4 treats as sensitive -- but the skill's own rules require a human decision before proceeding rather than this session silently treating that as a self-evident exception.

Current state: the diff is written and verified in the working tree, but not committed or pushed to this branch. Releasing the branch-plan-executing label now, per Step 7's ordering rule (comment first, then release).

Requesting: confirmation to proceed with committing and pushing this diff as-is (task scope matches the Branch Plan/ACM in issue #1875 and docs/gitapex/plans/2026-09-06-claude-governance-classifier-trusted-bots-dknenw.md), or a different instruction.


Generated by Claude Code

@tvna tvna removed the branch-plan-executing label Sep 6, 2026 — with Claude
@tvna
tvna deployed to ruleset-verify September 6, 2026 12:04 — with GitHub Actions Active
Refs #1875

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Step 8 adversarial review on PR #1881 found CODEOWNERS documents the
commit_author_email_pattern/committer_email_pattern rules in main.json
as the same risk class as trusted-bots.yml (issue #1858 second trust
anchor); owner approved widening this PR scope to cover it.

Refs #1875

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@tvna
tvna deployed to ruleset-verify September 6, 2026 12:47 — with GitHub Actions Active
@tvna tvna changed the title fix(governance-paths): recognize .github/trusted-bots.yml as governance-sensitive fix(governance-paths): recognize trusted-bots.yml and main.json as governance-sensitive Sep 6, 2026
@tvna
tvna marked this pull request as ready for review September 6, 2026 12:49
Confirm near-miss extension/case variants of trusted-bots.yml and
main.json stay no-match (documented exact-string scope, not a live
bypass -- neither the real gate nor CODEOWNERS covers them either),
and confirm main.json does not collide with the .github/ prefix used
by workflow/hook-script classification.

Refs #1875

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@tvna
tvna deployed to ruleset-verify September 6, 2026 12:54 — with GitHub Actions Active
Merge two same-pattern tests into one, drop a redundant no-match
assertion the positive assertion already implies, and shorten a
comment that restated CODEOWNERS almost verbatim into a pointer.

Refs #1875

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

fix(governance-paths): recognize .github/trusted-bots.yml as governance-sensitive

2 participants