fix(review): verdict trust: only the engine blocks, policy from the base branch, allowForceTier
Issue for this PR
Closes #
Stacked on #1721, which is stacked on #1720 and #1719; merge in that order.
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
The README and the docs promise "only the deterministic engine blocks". In the code, any three non-AI warnings, or one regex-catalog critical (join-no-on, create-or-replace, pii_into_mart, ā¦), produced REQUEST_CHANGES. Separately, .altimate/review.yml was read from the PR's own checkout. So a PR could set mode: comment, drop a blockOn category, exclude its own paths, or narrow reviewers, and pass under its own relaxed rules.
- Who can block: findings now carry
origin: engine | catalog | ai, derived fromevidence.tool. Unknown tools count ascatalog, so a new detector can't block until someone classifies it. Onlyenginefindings count toward REQUEST_CHANGES. A pattern rule a team trusts can be allowed to block viarubric.blockingRules: [<rule id>].originis stamped inbuildEnvelopeand covered by the signature. - Policy source:
.altimate/review.ymlis read at the merge-base commit (git show <base>:<path>). The PR's version is parsed only to list what it changes; those settings show in the comment and inpolicy.changedInPrand apply once merged. The envelope signspolicy.sourceandpolicy.hash. Callers without git (pre-supplied files and content) still read the working tree. --force-tier:allowForceTier: falsein the base policy rejects the flag. Forced runs were already recorded astier_forcedinreview_run.
Behavior changes:
- Pattern-rule criticals and warning counts no longer block by default.
- A PR's edits to
review.ymlno longer apply to that PR. - The tests that asserted the old behavior are updated: the two
pii_into_martregex-twin tests now expect COMMENT, and the verdict unit tests use engine evidence.
Not covered here: CLI flags in the workflow file (--mode, --severity) still override the policy. On pull_request events GitHub runs the workflow from the PR, so a PR could edit those flags too. Branch protection on .github/ (CODEOWNERS) is the usual control there.
How did you verify your code works?
- New
test/altimate/review-verdict-trust.test.ts(11 tests):- origin classification, including unknown tools
- 1 catalog critical + 3 catalog warnings ā COMMENT
blockingRulesopt-in, and engine criticals and warning patterns still blocking- origin covered by the signature (tamper fails verification)
- policy hash and change listing
- on real git repos with
GITHUB_BASE_REF: a PR relaxingmode/exclude/aistill judged in gate mode with the change shown; a PR addingreview.ymlnot applied; an unchanged policy applied with no note;allowForceTier: falserejecting--force-tier
- 1,883 tests across the review files and release gates pass.
bun typecheckis clean.
Cost side effects
None. One extra local git show per run.
Screenshots / recordings
N/A (CLI).
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
- I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"
š¤ Generated with Claude Code
Summary by cubic
Makes the review verdict deterministic and tamper-proof: only the deterministic engine can block, and a PR can no longer relax the policy it is reviewed under.
Old behavior: any three non-AI warnings, or one regex-catalog critical, produced REQUEST_CHANGES, and .altimate/review.yml was read from the PR's own checkout. Now pattern-rule criticals and warning counts only comment unless rubric.blockingRules opts a catalog rule in, and the policy comes from the merge-base commit so a PR's edits are listed but only take effect after merge. allowForceTier: false in the base policy rejects --force-tier.
Behavior changes
- Findings carry an
origin(engine|catalog|ai) derived fromevidence.tool, stamped in the envelope and covered by the signature; unknown tools count ascatalog, so a new detector can't block until classified. - Only
enginefindings count toward REQUEST_CHANGES; the AI lane never blocks. - A PR's changes to
review.ymlshow in the comment andpolicy.changedInPr, apply after merge, and the applied policy's source and hash are signed into the envelope. Non-git callers still read the working tree. - CLI flags in the workflow file still override the policy on
pull_requestevents.