Repository navigation
ci: approval-policy file and check (P10) - #215
Open
jarvis-drakon wants to merge 1 commit into
Open
jarvis-drakon wants to merge 1 commit into
jarvis-drakon wants to merge 1 commit into
Conversation
Adds .github/approval-policy.yml and a dependency-free check that posts the commit status approval-policy on each PR head. The check and the policy are read from the default branch only. It is red unless every rule matched by the touched paths, labels or title is evidenced at the exact head (panel seats, Fable decision for rule files, migration gate, owner approval for owner-only paths) and CI is green. It fails closed on an unparseable policy or an unclassified path. Owner-approved design, 28 Nov 2026 (review-protocol P10).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
An approval policy for this repo as a reviewable file, plus a dependency-free check that enforces it.
Owner-approved design (28 Nov 2026): an approval file in each repo plus a matching GitHub branch rule.
.github/approval-policy.yml: rules keyed on the paths, labels and title a PR touches. The strictest rule wins..env, labelsowner-only/frozen/freeze/needs-michael, destructive migrations): only the owner's own GitHub APPROVE at the exact head clears it. The policy can never approve these..github/, CODEOWNERS, CLAUDE.md, AGENTS.md, REVIEW.md,.claude/,.codex/, git hooks, other CI config): full review plus aFABLE GREEN-LIGHTat the head (review-protocol P5).security/release; titlerelease…/GHSA-): the full panel. No other rule can relax it.MIGRATION GATEline at the head (tested downgrade, backward-compatible, backup id), per DECISIONS 2026-10-27 16:0xZ. A DROP, TRUNCATE or DELETE in the forward half is owner-only. A migration file whose patch the API omits is also treated as owner-only (fail closed)..github/scripts/approval_policy_check.py: Python 3 standard library only. It posts the commit statusapproval-policyon the PR head. The status is green only when every matched rule is evidenced at the exact head and CI is green. It fails closed on an unparseable policy, unknown keys, an unclassified path, a truncated file list, any API error, or evidence that changed while it was being evaluated. It evaluates twice and posts only when both runs agree..github/workflows/approval-policy.yml: runs onpull_request_target,issue_comment,workflow_run,check_suiteandworkflow_dispatch. All of these run default-branch code. The workflow fetches the check and the policy from the default branch and never checks out or runs PR code, so a PR cannot change the rules it is judged by. It uses no third-party actions. Permissions: read, plusstatuses: write..github/workflows/approval-policy-review-relay.yml: has no permissions. It turns formal review events into aworkflow_runtrigger, so a submitted or dismissed review re-runs the check without a PR-head workflow ever holding a write token..github/workflows/approval-policy-selftest.yml: runs the unit tests and validates this repo's policy when the check or the policy changes. It uses a read-only token.Evidence formats (P10 in
skills/fleet-doctrine/references/review-protocol.md):REVIEW head <sha> | <seat>: APPROVE …,FABLE GREEN-LIGHT head <sha> | decision: MERGE | ref: …,MIGRATION GATE head <sha> | downgrade: … | backward-compatible: yes | backup: …. A fleet account's formal APPROVE at the head, or itsAPPROVE at <sha>comment, fills one seat. Its CHANGES_REQUESTED blocks the PR until it is lifted. Only the logins listed intrustedcount.Notes
pull_request_targetruns the base branch's workflows, and the base has none yet. It is a P5 rule-file PR: its own review plus a Fable decision.Evidence
python3 -B -m unittest test_approval_policy_check, run underscripts/hermetic_test.sh(empty env, throwaway HOME):Ran 22 tests … OK. That covers 77 fixture cases plus parser and glob tests.parse_yaml_subset(text) == yaml.safe_load(text)is True for all 7 generated policies.--backtest, no status posted). Results are listed per repo below.Self-review (P1)
code-reviewat effort high was run on the branch before the first push. It found 8 issues (marked important) and 2 nits. All 10 were confirmed and fixed before this push:workflow_runcould overwrite a newer status (now evaluated twice and posted only when both agree; concurrency keyed on the PR).-- downcomment could hide a DROP.schema.tswas outside the migrations class.pending, andcheck_suitewas added as a trigger.noneandnot tested.Self-review: no findings rejected.
This repo
multi-clawd is public and has a default-branch ruleset, but adding
approval-policyas a required check there was not part of the approved change. Until then, lanes enforce it (P10).Backtest: recent merged PRs replayed against this policy (observe only; nothing posted)
Red rows show what the policy would have required. Most are rule-file PRs from before P5 (28 Nov), when no Fable line was needed, or PRs whose reviews were not posted on the PR.