feat: implement the v1 review-policy check #3
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.52) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #3"
general
weight: 0.35
saubyk
Update, 206490f — second round addressed. A
closedevent no longer reports the closed PR's verdict on a shared head (only open PRs on the head are evaluated; nothing is written when none remain), and fail-closed reporting now coversworkflow_runandworkflow_dispatch— the dismissed-approval-plus-5xx path overwrites a stale PASS. Testing: 268 of 268; 5 more mutants killed.Update, 544ac08 — @saubyk's review addressed. All threads replied to individually.
editedandclosed.matches file names with\n,\r, U+2028/U+2029; leading/,./and trailing/patterns are rejected.botsaccounts never count.humans: 0withoutbot: trueis rejected; expert relief is clamped to the tier's own bar.permissionfield is preferred overrole_name(org custom roles).constructor) are not experts. YAML treats tab before#as a comment.Testing: 263 of 263 (was 234); 11 targeted mutants killed over the changed logic. The live-repository caveat for the
merge_grouppath and the environment's deployment-branch policy is now documented under "Setting up the App key" and "Open questions" — unresolved, as flagged in review.---
Implements v1 of the review-policy check (#1).
Stacks on #2. This branch is rebased onto
design-readmeat 5f48364, so until #2 merges the diff also shows the design commits. Review the last five commits. The last two are new in this version.Changes since the last version
This version matches the revised design in 5f48364, which addresses @saubyk's review of #2.
bot approved <sha>, not the head.carry: low_onlyis a new tier option, used by MEDIUM. A human approval on an older commit carries only if all of these hold, checked through the compare API: the head descends from the approved commit, fewer than 300 files changed (the API's limit), and no changed file is floored, never-auto-approve, or the policy file. Otherwise the approval doesn't count.freshandcarrycan't be set together. Human approvals still need write access.github-actions[bot]never count, even if configured as the App login. The App login defaults to<slug>[bot]for the App named byapp_id, and theapp_logininput can override it.app_idandprivate_keyinputs (src/app.mjs). The action signs an RS256 JWT withnode:crypto, mints an installation token limited to the repo withchecks: write,contents: read, andpull-requests: read, and uses that token for every call. It creates or updates its ownreview-policycheck run and revokes the token at the end. Without these inputs it falls back toGITHUB_TOKENand logs::warning::, and the check summary and step summary both open with a warning that the check can be spoofed. Ifapp_idis set but the key is empty, the run fails rather than falling back. The README documents the default-branch-onlyreview-policyenvironment.refs/heads/gh-readonly-queue/<base>/pr-<N>-<sha>. The PR is evaluated on its own head, and the result is reported onmerge_group.head_sha. The run fails closed, writing a failing check on the group head and exiting 1, when the ref doesn't parse or doesn't matchbase_ref. A PR that targets a different base also fails.workflow_runrelay andworkflow_dispatchpaths are unchanged. The README's "Using it in a repository" section is the design's text. The optionalapp_loginandtokeninputs are documented under the App key setup.dist/is rebuilt and still has zero runtime deps, importing onlynode:crypto,node:fs, andnode:url.Test expectations changed (design changes only)
LOW (not fresh): a bot approval on an older commit carriesnow expects fail*. It is renamedLOW: a bot approval on an older commit does not count.MEDIUM (not fresh): an approval on an older commit carriesnow passes only with a low-risk comparison. It is renamed forcarry: low_onlyand gets blocking siblings.README example validates and normalizes: every normalized tier now hascarry(null, or'low_only'for medium).applied by the classifier countsis nowapplied by the review-policy App counts. The fixtures' default labeler moved fromgithub-actions[bot]toreview-policy[bot], and the e2e env setsINPUT_APP_LOGIN.actorsToCheckalso skipsgithub-actions[bot]and the App login.gatherInputs looks up permissions only for relevant actorsnow passes{ appLogin }.lightninglabs-gateway[bot]is nowll-review-bot, a machine user as in the design. The YAML test was updated to match.Testing
node --test test/.test.mjspasses 234 of 234 on Node 24.21 (previously 167). New coverage:github-actions[bot]labels rejected and App-login labels acceptedMutation check: all 16 mutants were killed. They covered bot head freshness,
github-actions[bot]label rejection, the CRITICAL human floor, the expert minimum, merge_group PR-number parsing (two variants), the base_ref cross-check, the group-head report, unparsable-ref reporting, four carry guards, the human write-access check, JWT lifetime, and the spoof warning.Not deployed anywhere yet. The App, the
workflow_run/workflow_dispatchpaths, and the merge_group path are covered only by fake-API tests.