@attalabs/vinaya 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/README.md +1 -1
  2. package/aeg-root/contracts/principal-operator.md +18 -5
  3. package/aeg-root/roles/operator.md +69 -16
  4. package/aeg-root/roles/planner/reference.md +1 -1
  5. package/aeg-root/roles/tranche-archivist.md +1 -0
  6. package/aeg-root/skills/aeg-context-packets/SKILL.md +1 -1
  7. package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +1 -1
  8. package/dist/checks/bin/check-body-bare-digits.js +111 -15
  9. package/dist/checks/bin/check-branch-topology.js +83 -16
  10. package/dist/checks/bin/check-brief-shape.js +111 -15
  11. package/dist/checks/bin/check-changeset-coverage.js +342 -69
  12. package/dist/checks/bin/check-closes-n.js +83 -16
  13. package/dist/checks/bin/check-coherence.js +112 -16
  14. package/dist/checks/bin/check-dead-branch-push.js +82 -15
  15. package/dist/checks/bin/check-dispatch-readiness.js +112 -16
  16. package/dist/checks/bin/check-doc-coverage-push.js +342 -69
  17. package/dist/checks/bin/check-doc-coverage.js +342 -69
  18. package/dist/checks/bin/check-doctrine-no-procedures.js +111 -15
  19. package/dist/checks/bin/check-doctrine-portability.js +342 -69
  20. package/dist/checks/bin/check-evidence-fresh.js +343 -69
  21. package/dist/checks/bin/check-exec-bits.js +342 -69
  22. package/dist/checks/bin/check-first-push-dispatch.js +112 -16
  23. package/dist/checks/bin/check-issue-assignment.js +83 -16
  24. package/dist/checks/bin/check-issue-milestone-attach.js +82 -15
  25. package/dist/checks/bin/check-issue-objectives-numbering.js +82 -15
  26. package/dist/checks/bin/check-issue-parts-coverage.js +82 -15
  27. package/dist/checks/bin/check-issue-surface-globs.js +112 -16
  28. package/dist/checks/bin/check-issue-title-grammar.js +82 -15
  29. package/dist/checks/bin/check-issue-tranche-label.js +82 -15
  30. package/dist/checks/bin/check-main-branch-refusal.js +82 -15
  31. package/dist/checks/bin/check-no-disk-state.js +82 -15
  32. package/dist/checks/bin/check-pr-premise-reassert.js +111 -15
  33. package/dist/checks/bin/check-pr-report-density.js +82 -15
  34. package/dist/checks/bin/check-principal-test-plan-wait.js +82 -15
  35. package/dist/checks/bin/check-quoted-command.js +342 -69
  36. package/dist/checks/bin/check-reader-resolvable-prose.js +342 -69
  37. package/dist/checks/bin/check-registry-gates.js +82 -15
  38. package/dist/checks/bin/check-retired-vocabulary.js +342 -69
  39. package/dist/checks/bin/check-review-gate.js +179 -124
  40. package/dist/checks/bin/check-single-plan-pr.js +82 -15
  41. package/dist/checks/bin/check-surface-scope.js +83 -16
  42. package/dist/checks/bin/check-test-plan.js +82 -15
  43. package/dist/checks/bin/check-token-collection-wired.js +82 -15
  44. package/dist/checks/bin/check-token-report.js +82 -15
  45. package/dist/checks/bin/check-workspace-escape.js +342 -69
  46. package/dist/index.js +2495 -590
  47. package/dist/lib/pre-push-cache-test-run.js +317 -61
  48. package/dist/lib/pre-push-select-tests.js +91 -10
  49. package/package.json +1 -1
  50. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
  51. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
  52. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
  53. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
  54. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
  55. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
  56. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
  57. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
  58. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
  59. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
  60. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
  61. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +212 -0
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/outcomes.ts +135 -0
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +394 -0
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +1 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +1 -1
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +2 -2
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +514 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +110 -0
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +27 -0
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +123 -0
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +27 -0
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +240 -0
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +1 -1
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +1 -2
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +65 -22
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +238 -0
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +14 -1
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +1 -1
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +1 -1
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +1 -1
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +1 -1
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-no-procedures.ts +1 -1
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +5 -5
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +1 -1
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +1 -1
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +14 -3
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +379 -11
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +3 -4
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +1450 -33
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +1 -2
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +2 -2
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +119 -0
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +75 -0
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/redact.ts +87 -0
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +801 -0
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +373 -0
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +2 -2
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +1 -1
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +2 -3
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +2 -2
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +288 -0
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +3 -3
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +1 -1
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +30 -16
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +17 -1
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +1 -1
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +1 -1
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +267 -19
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +91 -24
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +6 -6
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +4 -4
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +239 -110
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +384 -0
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +184 -0
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +65 -18
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +76 -0
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +4 -4
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +40 -27
  120. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +2 -2
  121. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +38 -0
  122. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +488 -0
  123. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +7 -9
  124. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +5 -5
  125. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +4 -4
  126. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +314 -56
  127. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +2 -3
  128. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +3 -3
  129. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  131. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +2 -2
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +1 -1
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/{[externals]__1agj1ww._.js → [externals]__0cki-x_._.js} +2 -2
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +6 -6
  177. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +3 -0
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  180. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0r7e54g._.js → [root-of-the-server]__18paley._.js} +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1r47dr7._.js → _08onyya._.js} +3 -3
  184. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +1 -1
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +5 -5
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  193. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  198. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +1 -0
  199. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 1ce2dj27_cgbj.js} +4 -4
  200. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 22s44f5k3ecmj.js} +1 -1
  201. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/34hhdtbp20krb.js +1 -0
  202. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0hstap0._.js +0 -3
  204. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2t_rfsztmwu6y.js +0 -1
  205. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3ua4rm5f-a9k6.js +0 -1
  206. /package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
  207. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_buildManifest.js +0 -0
  208. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_clientMiddlewareManifest.js +0 -0
  209. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_ssgManifest.js +0 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Required pre-merge review gate (aeg-review-gate-v1 task 1, #474). Blocks a
2
+ * Required pre-merge review gate. Blocks a
3
3
  * PR from merging unless a clean code-reviewer `APPROVE` verdict
4
4
  * AND a clean security-review `PASS` verdict both exist on the PR — the same
5
5
  * `extractCodeReviewVerdict`/`extractSecurityReviewVerdict` detection
@@ -7,8 +7,8 @@
7
7
  * now gated pre-merge and blocking instead of post-merge and advisory-only.
8
8
  *
9
9
  * Verdict comments are ONLY counted when their author is on the same
10
- * `PRINCIPAL_ALLOWLIST` the waiver actor-check trusts (security finding,
11
- * PR #806): body-shape alone is never sufficient on a public repo. Unverified
10
+ * `PRINCIPAL_ALLOWLIST` the waiver actor-check trusts (a security finding):
11
+ * body-shape alone is never sufficient on a public repo. Unverified
12
12
  * comments are ignored, not fatal.
13
13
  *
14
14
  * A verified `vinaya/waiver:review` label (the exact actor-verification pattern,
@@ -17,7 +17,7 @@
17
17
  * one PR. Label presence alone is never sufficient — only an actor-verified
18
18
  * label waives the gate, mirroring exactly.
19
19
  *
20
- * Reviewed-commit binding (#73, a duplicate of #71 closes this one). A clean
20
+ * Reviewed-commit binding. A clean
21
21
  * verdict is no longer sufficient on its own — it must also cover the PR's
22
22
  * CURRENT head. Design record (the four questions this fix had to answer,
23
23
  * argued in full in the closing PR's body):
@@ -51,6 +51,23 @@
51
51
  * `vinaya/waiver:review` actor-verified label, applied by a principal, the
52
52
  * same mechanism that already exists for any other one-off skip.
53
53
  *
54
+ * Ruling-freshness binding. A
55
+ * verdict is also bound to the newest PRINCIPAL RULING on the PR at cast
56
+ * time, the same shape as the objectives-version binding above but with
57
+ * `0` (never `null`) standing in for "nothing to bind against yet" — a
58
+ * ruling's existence on a PR is never ambiguous the way an Issue's
59
+ * objectives-cutover status is, so there is no "skip this binding" input
60
+ * value here. `input.rulingOrdinal` is the caller-resolved newest ordinal
61
+ * (`isBoundToRulings`, below); a verdict cast against an older ordinal, or
62
+ * carrying no `Ruling ordinal:` line at all on a PR that now has one,
63
+ * reads as unbound — a ruling posted after approval turns a previously
64
+ * clean gate red until reviewers re-cast against it.
65
+ *
66
+ * This gate answers one question — are the required review verdicts present,
67
+ * clean, and bound to what is being merged — and nothing else. It reads no
68
+ * other check's result and no Test Plan tick-state; each of those is its own
69
+ * check, owned elsewhere.
70
+ *
54
71
  * Pure — no `fs`, no `fetch`, no `process.env`. The CLI shim
55
72
  * (`bin/verify-review-gate.ts`) resolves the PR's comments/labels/label-actor/
56
73
  * head sha via `gh` and calls `checkReviewGate`.
@@ -58,6 +75,13 @@
58
75
 
59
76
  import { isPrincipal, isWaiverLabelActorVerified, PRINCIPAL_ALLOWLIST, WAIVER_LABEL_REVIEW } from './waiver-label'
60
77
  import { extractCodeReviewVerdict, extractSecurityReviewVerdict } from './verdict-extraction'
78
+ import { DEFAULT_REVIEW_POLICY, evaluateCodeReview, evaluateSecurityReview, type ReviewPolicy } from './review-policy'
79
+ import {
80
+ compareManifest,
81
+ policyDigest as computePolicyDigest,
82
+ type EchoedManifest,
83
+ type ReviewInputManifest
84
+ } from './review-input-manifest'
61
85
 
62
86
  export type ReviewGateVerdict = 'pass' | 'fail'
63
87
 
@@ -73,13 +97,6 @@ export type ReviewGateComment = {
73
97
  author: string | null
74
98
  }
75
99
 
76
- export type MechanicalCheckStatus = {
77
- /** The check-run's display name, as GitHub reports it (`gh pr checks`' own `name` field). */
78
- name: string
79
- /** GitHub's own coalesced status vocabulary for this check-run — forwarded verbatim from `gh pr checks --json name,bucket`'s `bucket` field (e.g. "pass", "fail", "pending", "skipping", "cancel"). Not re-mapped to a smaller enum here — that would be a second copy of a vocabulary `gh` already owns. */
80
- bucket: string
81
- }
82
-
83
100
  export type ReviewGateInput = {
84
101
  /** Every comment on the PR, with its author. */
85
102
  comments: ReviewGateComment[]
@@ -91,22 +108,13 @@ export type ReviewGateInput = {
91
108
  * The PR's current head commit sha (`gh pr view --json headRefOid`),
92
109
  * resolved from GitHub — never from local git, an env var, or the PR's own
93
110
  * checkout, all three of which a `pull_request`-triggered workflow's
94
- * PR-editable YAML could steer (#73). REQUIRED, not optional: an omitted
111
+ * PR-editable YAML could steer. REQUIRED, not optional: an omitted
95
112
  * head would have to mean either skip-the-binding-check (fail-open, the
96
113
  * exact defect this field exists to close) or unconditional-fail, and a
97
114
  * required field makes that choice a compile error instead of a runtime
98
115
  * default. Every verdict must cover this value to count as clean.
99
116
  */
100
117
  headSha: string
101
- /**
102
- * Every check-run reported for the PR's current head, EXCLUDING this
103
- * repo's own review-gate check-run (the caller filters that out before
104
- * calling in — see check-review-gate.ts's own comment for why the
105
- * exclusion must not live here). An empty array means no mechanical
106
- * check-run has reported yet, which does NOT count as clean — there is
107
- * no proof to point to, not an implicit pass.
108
- */
109
- mechanicalChecks: MechanicalCheckStatus[]
110
118
  /**
111
119
  * Overrides `PRINCIPAL_ALLOWLIST` for this evaluation when provided — an
112
120
  * adopter repo's own `vinaya.config.json` `principals` field, resolved by
@@ -137,8 +145,8 @@ export type ReviewGateInput = {
137
145
  * A base that moved under an identical patch can carry a semantic conflict
138
146
  * the earlier review could not have seen, and this binding will still
139
147
  * hold. That is the same limit GitHub's own stale-review rule has, and CI
140
- * at the new head — which this gate already requires green — is the guard
141
- * for it.
148
+ * at the new head — a required check in its own right, never read from
149
+ * here — is the guard for it.
142
150
  *
143
151
  * `git patch-id --stable` ignores whitespace, so a push that changes only
144
152
  * whitespace produces the same patch identity and KEEPS the verdict. That
@@ -149,6 +157,68 @@ export type ReviewGateInput = {
149
157
  * the verdict; only the whitespace-only case survives unreviewed.
150
158
  */
151
159
  patchIdOf?: (sha: string) => string | null
160
+ /**
161
+ * The current `objectivesVersion` of the list the PR is judged against
162
+ * — the Issue's `objectivesOf`
163
+ * build, or the PR body's own `## Objectives` section below the cutover,
164
+ * resolved by the caller (never here; this stays pure). `null` means the
165
+ * objectives binding is SKIPPED entirely — a pre-cutover Issue, no Issue at
166
+ * all, or no objectives section resolvable — so the pre-cutover PR stock
167
+ * keeps passing exactly as it did before this field existed. A non-null
168
+ * value requires every clean verdict's own `extraction.objectivesVersion`
169
+ * to equal it; a mismatch (including a verdict with no version line at
170
+ * all) reads as unbound, the same fail-closed shape as a stale head.
171
+ */
172
+ objectivesVersion: string | null
173
+ /**
174
+ * The newest principal ruling ordinal on this PR — `0` when the PR carries no ruling at all, NEVER
175
+ * `null`: unlike `objectivesVersion`, there is no "skip this binding"
176
+ * case here — a PR either has rulings or it doesn't, and `0` says so.
177
+ * Resolved by the caller (never here; this stays pure) by counting
178
+ * principal-authored `<!-- aeg:principal:ruling:<pr>-<k> -->` comments.
179
+ * A verdict's own `extraction.rulingOrdinal` binds only when it equals
180
+ * this value exactly — `null` (pre-cutover stock, no `Ruling ordinal:`
181
+ * line at all) binds only when this value is `0`, the same "the PR truly
182
+ * had nothing to see" case `isBoundToObjectives`'s `null`-current-version
183
+ * skip covers for objectives, but expressed as equality rather than an
184
+ * unconditional skip, since a ruling's existence is never ambiguous.
185
+ */
186
+ rulingOrdinal: number
187
+ /**
188
+ * Which severities block is repository policy — resolved by the caller from the DEFAULT BRANCH's
189
+ * `vinaya.config.json` (`resolveReviewPolicy(loadTrustAnchorConfig())`),
190
+ * never from here (this stays pure) and never from the PR's own checkout,
191
+ * so a change cannot lower its own threshold. Defaults to
192
+ * `DEFAULT_REVIEW_POLICY` (`BLOCKER`/`HIGH`) when omitted — every existing
193
+ * caller that predates this field is unaffected, the same optional-with-
194
+ * fallback shape `principalAllowlist` already uses above.
195
+ */
196
+ policy?: ReviewPolicy
197
+ /**
198
+ * The frozen brief's own hash at evaluation time — resolved by the caller (never here; this stays
199
+ * pure) from the linked Issue's newest principal-authored frozen brief.
200
+ * Optional, defaulting to `null` (skip the binding) when omitted — every
201
+ * existing caller that predates this field is unaffected, the same
202
+ * optional-with-fallback shape `patchIdOf`/`policy` already use above.
203
+ * `null` (explicit, or via omission) means no frozen brief is resolvable
204
+ * for this PR — nothing to bind against, so every verdict passes this
205
+ * check unconditionally, the same "skip" meaning `objectivesVersion: null`
206
+ * already carries.
207
+ */
208
+ briefHash?: string | null
209
+ /**
210
+ * The base commit the PR's candidate is judged against at evaluation time
211
+ * (O1) — resolved by the caller (never
212
+ * here; this stays pure) from the PR's base branch tip, the same
213
+ * `origin/<baseRefName>` `patchIdOf` already diffs against. Optional,
214
+ * defaulting to `null` (skip the base binding) when omitted — every existing
215
+ * caller and every fixture that predates base identity is unaffected, the
216
+ * same optional-with-fallback shape `patchIdOf`/`policy`/`briefHash` already
217
+ * use. Bounded, not an always-checked equality: a base move under an exact
218
+ * head sha invalidates, while a proven patch-identity rebase tolerates it —
219
+ * see `compareManifest`'s own base rule.
220
+ */
221
+ baseSha?: string | null
152
222
  }
153
223
 
154
224
  /**
@@ -164,64 +234,31 @@ export function isReviewGateExemptBranch(_branch: string): boolean {
164
234
  return false
165
235
  }
166
236
 
167
- /**
168
- * True when `extraction.headSha` covers `headSha` — an exact match, or
169
- * `headSha` starting with `extraction.headSha` (the abbreviated-sha case:
170
- * a verdict may bind against a 7-char prefix, and `headSha` itself is always
171
- * the full 40-char form GitHub's API returns). `false` when the extraction
172
- * carries no `headSha` at all (no `Judged head:` line was found) — an
173
- * unbound verdict never counts as covering anything.
174
- */
175
- function isBoundToHead(extraction: { headSha: string | null }, headSha: string): boolean {
176
- if (!extraction.headSha) return false
177
- return headSha.toLowerCase().startsWith(extraction.headSha.toLowerCase())
178
- }
179
-
180
- /**
181
- * True when the judged head and the current head carry the SAME patch — the
182
- * verdict was cast on this exact set of changes, whatever sha now addresses
183
- * it. Composed BESIDE `isBoundToHead`, never in place of it: sha binding
184
- * still counts on its own, and this only widens what else counts.
185
- *
186
- * Fails closed on every uncertainty. `null` on either side is "git could not
187
- * answer", not "they match" — a force-push that makes the judged head
188
- * unreachable resolves to `null` and the verdict correctly stops counting.
189
- */
190
- function isBoundByPatchIdentity(
191
- extraction: { headSha: string | null },
192
- headSha: string,
193
- patchIdOf?: (sha: string) => string | null
194
- ): boolean {
195
- if (patchIdOf === undefined || !extraction.headSha) return false
196
- const judged = patchIdOf(extraction.headSha)
197
- const current = patchIdOf(headSha)
198
- if (judged === null || current === null) return false
199
- return judged === current
200
- }
201
-
202
- /** A verdict covers the current head when its sha binds it, or its patch identity does. */
203
- function isBoundToPatch(
204
- extraction: { headSha: string | null },
205
- headSha: string,
206
- patchIdOf?: (sha: string) => string | null
207
- ): boolean {
208
- return isBoundToHead(extraction, headSha) || isBoundByPatchIdentity(extraction, headSha, patchIdOf)
209
- }
210
-
211
237
  /**
212
238
  * `pass` when either (a) `vinaya/waiver:review` is present and actor-verified against
213
239
  * `PRINCIPAL_ALLOWLIST`, or (b) both verdicts are clean AND bound — code-reviewer
214
240
  * `APPROVE` (not `REQUEST_CHANGES`, not missing, not unclear) covering the PR's
215
241
  * current `headSha` — by that sha, or by an equal patch identity when
216
242
  * `patchIdOf` is supplied — and security-review `PASS` (not `FAIL`, not
217
- * missing, not unclear) covering it too — AND every reported mechanical check-run for that
218
- * same head is green, a `skipping`/`neutral` entry (a job whose own `if:`
219
- * was false for this event) filtered out first as absent rather than
220
- * counted either way (`mechanicalChecks`, after that filter, non-empty and
221
- * every remaining entry's `bucket` is `"pass"`). `fail` otherwise, naming
222
- * exactly which verdict(s) are not clean, not bound to the current head,
223
- * which mechanical check(s) are not green, or that none have reported at
224
- * all.
243
+ * missing, not unclear) covering it too, both also bound to the current
244
+ * objectives version and the current newest ruling ordinal. `fail`
245
+ * otherwise, naming exactly which verdict(s) are not clean or not bound to
246
+ * the current head.
247
+ *
248
+ * Reviews and nothing else. No other check's result, and no Test Plan
249
+ * tick-state, is an input here or may become one: every merge condition is
250
+ * its own independent check, so that all green means mergeable, and a gate
251
+ * that re-reported a sibling check's red answered a question it does not
252
+ * own. Adding such an input back is a deliberate regression a dedicated
253
+ * architecture test refuses.
254
+ *
255
+ * A verdict's own `VERDICT:` text is not, by itself, sufficient for "clean":
256
+ * the comment's own FINDINGS block
257
+ * is re-evaluated against `input.policy` (`evaluateCodeReview`/
258
+ * `evaluateSecurityReview`, `@attalabs/aeg-core`'s pure evaluator), and an
259
+ * `APPROVE`/`PASS` beside a finding at or above the threshold reads as not
260
+ * clean here regardless — a reviewer's own clean-sounding verdict never
261
+ * overrides the evaluator.
225
262
  */
226
263
  export function checkReviewGate(input: ReviewGateInput): ReviewGateResult {
227
264
  const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST
@@ -239,22 +276,7 @@ export function checkReviewGate(input: ReviewGateInput): ReviewGateResult {
239
276
  }
240
277
  }
241
278
 
242
- // A `skipping` (GitHub `conclusion: "skipped"` or `"neutral"`) check-run is
243
- // ABSENT, never a failure (Issue #402 O4): a job whose own `if:` is false
244
- // for this event still reports a check-run — `vinaya-review.yml`'s
245
- // `retrigger-on-ci-green` job reports `skipped` on every ordinary
246
- // `pull_request_target` run — and counting that as "not green" blocked
247
- // every PR (first seen on PR #401: "vinaya review gate (retrigger on CI
248
- // green) (skipping)"). Filtered out before both the emptiness check and
249
- // the clean-check, so a head reporting only skipped/neutral runs reads as
250
- // "nothing has reported yet", not as a false pass.
251
- const reportedMechanicalChecks = input.mechanicalChecks.filter(
252
- (c) => c.bucket !== 'skipping' && c.bucket !== 'neutral'
253
- )
254
- const mechanicalChecksClean =
255
- reportedMechanicalChecks.length > 0 && reportedMechanicalChecks.every((c) => c.bucket === 'pass')
256
-
257
- // Verdict-AUTHOR verification (security finding on PR #806): on a public
279
+ // Verdict-AUTHOR verification (a security finding): on a public
258
280
  // repo any GitHub account can post a `VERDICT: APPROVE`-shaped comment, and
259
281
  // most-recent-clear-hit-wins extraction would let a forged later APPROVE
260
282
  // override a real earlier REQUEST CHANGES. Only comments whose author is on
@@ -267,7 +289,7 @@ export function checkReviewGate(input: ReviewGateInput): ReviewGateResult {
267
289
  const verified = input.comments.filter((c) => isPrincipal(c.author, principalAllowlist))
268
290
  // Count only VERDICT-shaped ignored comments — deployment bots and ordinary
269
291
  // chat are also non-allowlisted, and counting them would imply forgery
270
- // where there is only noise (review finding, PR #806).
292
+ // where there is only noise (a review finding).
271
293
  const ignoredCount = input.comments.filter(
272
294
  (c) => !isPrincipal(c.author, principalAllowlist) && c.body.includes('VERDICT')
273
295
  ).length
@@ -275,42 +297,149 @@ export function checkReviewGate(input: ReviewGateInput): ReviewGateResult {
275
297
 
276
298
  const codeReview = extractCodeReviewVerdict(verifiedBodies)
277
299
  const security = extractSecurityReviewVerdict(verifiedBodies)
278
- const codeReviewClean = codeReview.value === 'APPROVE'
279
- const securityClean = security.value === 'PASS'
280
- const codeReviewBound = isBoundToPatch(codeReview, input.headSha, input.patchIdOf)
281
- const securityBound = isBoundToPatch(security, input.headSha, input.patchIdOf)
300
+ const policy = input.policy ?? DEFAULT_REVIEW_POLICY
301
+ // O3: a reviewer's own APPROVE/PASS never overrides the evaluator — clean
302
+ // requires BOTH a clean text value AND the evaluator finding nothing at or
303
+ // above policy in the comment's own FINDINGS block. A finding the text
304
+ // claims to be clean beside is read as not clean here, regardless of what
305
+ // the VERDICT: line says.
306
+ //
307
+ // `findingSeverities` is a bare regex extraction over a hand-typed
308
+ // principal comment (`verdict-extraction.ts`'s `FINDING_SEVERITY_LINE`),
309
+ // not validated output — `evaluateReviewFindings` throws on any token
310
+ // outside the role's own scale. Every other refusal in this function
311
+ // returns a named `fail` result; an uncaught throw here would crash the
312
+ // check-run instead, on nothing worse than a typo in a manually-posted
313
+ // comment. Caught and failed closed the same way.
314
+ let codeReviewPolicyEvaluation: ReturnType<typeof evaluateCodeReview>
315
+ let securityPolicyEvaluation: ReturnType<typeof evaluateSecurityReview>
316
+ try {
317
+ codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy)
318
+ securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy)
319
+ } catch (err) {
320
+ return {
321
+ verdict: 'fail',
322
+ reason: `a verdict comment carries a finding severity this repository's policy does not recognize: ${err instanceof Error ? err.message : String(err)}`,
323
+ waived: false
324
+ }
325
+ }
326
+ const codeReviewTextClean = codeReview.value === 'APPROVE'
327
+ const securityTextClean = security.value === 'PASS'
328
+ const codeReviewPolicyClean = codeReviewPolicyEvaluation.outcome === 'clean'
329
+ const securityPolicyClean = securityPolicyEvaluation.outcome === 'clean'
330
+ const codeReviewClean = codeReviewTextClean && codeReviewPolicyClean
331
+ const securityClean = securityTextClean && securityPolicyClean
332
+ // task 4: ONE comparison — the same `compareManifest` the
333
+ // loop's own publication self-check calls — behind every binding below,
334
+ // rather than four separate hand-rolled predicates. `current` is this
335
+ // evaluation's own manifest; each verdict's own echoed fields (read by
336
+ // `extractCodeReviewVerdict`/`extractSecurityReviewVerdict` above) are
337
+ // compared against it, never trusted as provenance on their own. Built
338
+ // directly (not via `buildReviewInputManifest`, which hashes a caller
339
+ // brief string) since the caller already resolved `briefHash` itself and
340
+ // this module stays pure — no hashing of forge content here.
341
+ const currentManifest: ReviewInputManifest = {
342
+ headSha: input.headSha,
343
+ baseSha: input.baseSha ?? null,
344
+ briefHash: input.briefHash ?? null,
345
+ objectivesVersion: input.objectivesVersion,
346
+ rulingOrdinal: input.rulingOrdinal,
347
+ policyDigest: computePolicyDigest(policy)
348
+ }
349
+ const codeReviewEchoed: EchoedManifest = {
350
+ headSha: codeReview.headSha,
351
+ baseSha: codeReview.baseSha,
352
+ briefHash: codeReview.briefHash,
353
+ objectivesVersion: codeReview.objectivesVersion,
354
+ rulingOrdinal: codeReview.rulingOrdinal,
355
+ policyDigest: codeReview.policyDigest
356
+ }
357
+ const securityEchoed: EchoedManifest = {
358
+ headSha: security.headSha,
359
+ baseSha: security.baseSha,
360
+ briefHash: security.briefHash,
361
+ objectivesVersion: security.objectivesVersion,
362
+ rulingOrdinal: security.rulingOrdinal,
363
+ policyDigest: security.policyDigest
364
+ }
365
+ const codeReviewBinding = compareManifest(codeReviewEchoed, currentManifest, input.patchIdOf)
366
+ const securityBinding = compareManifest(securityEchoed, currentManifest, input.patchIdOf)
367
+ const codeReviewBound = codeReviewBinding.head
368
+ const securityBound = securityBinding.head
369
+ const codeReviewObjectivesBound = codeReviewBinding.objectivesVersion
370
+ const securityObjectivesBound = securityBinding.objectivesVersion
371
+ const codeReviewRulingsBound = codeReviewBinding.rulingOrdinal
372
+ const securityRulingsBound = securityBinding.rulingOrdinal
282
373
 
283
- if (codeReviewClean && codeReviewBound && securityClean && securityBound && mechanicalChecksClean) {
374
+ if (codeReviewClean && codeReviewBinding.bound && securityClean && securityBinding.bound) {
284
375
  return {
285
376
  verdict: 'pass',
286
- reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}, and every reported mechanical check is green.`,
377
+ reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}.`,
287
378
  waived: false
288
379
  }
289
380
  }
290
381
 
291
382
  const problems: string[] = []
292
- if (!codeReviewClean) {
383
+ if (!codeReviewTextClean) {
293
384
  problems.push(`code-reviewer verdict is not a clean APPROVE (found: ${codeReview.value})`)
385
+ } else if (!codeReviewPolicyClean) {
386
+ problems.push(
387
+ `code-reviewer verdict says APPROVE but carries a finding (${codeReviewPolicyEvaluation.blockingFindings.map((f) => f.severity).join(', ')}) at or above this repository's code-review policy threshold (${policy.codeReviewThreshold}) — a reviewer's own APPROVE never overrides policy`
388
+ )
294
389
  } else if (!codeReviewBound) {
295
390
  problems.push(
296
391
  `the newest code-review verdict covers ${codeReview.headSha ?? 'no recorded commit'}, head is ${input.headSha}`
297
392
  )
393
+ } else if (!codeReviewBinding.base) {
394
+ problems.push(
395
+ `the newest code-review verdict was cast against base ${codeReview.baseSha ?? 'no recorded base'}, the PR's base is now ${currentManifest.baseSha ?? 'unresolved'} (a base-only change under an unchanged candidate — same patch text on a new base is not automatically equivalent)`
396
+ )
397
+ } else if (!codeReviewObjectivesBound) {
398
+ problems.push(
399
+ `the newest code-review verdict was cast against objectives version ${codeReview.objectivesVersion ?? 'none'}, the Issue's list is now ${input.objectivesVersion}`
400
+ )
401
+ } else if (!codeReviewRulingsBound) {
402
+ problems.push(
403
+ `the newest code-review verdict was cast against ruling ordinal ${codeReview.rulingOrdinal ?? 'none'}, a newer ruling (ruling ${input.rulingOrdinal}) is now posted on this PR`
404
+ )
405
+ } else if (!codeReviewBinding.briefHash) {
406
+ problems.push(
407
+ `the newest code-review verdict was cast against brief hash ${codeReview.briefHash ?? 'none'}, the frozen brief's current hash is ${currentManifest.briefHash ?? 'none'}`
408
+ )
409
+ } else if (!codeReviewBinding.policyDigest) {
410
+ problems.push(
411
+ `the newest code-review verdict was cast against review policy digest ${codeReview.policyDigest ?? 'none'}, this repository's current policy digest is ${currentManifest.policyDigest}`
412
+ )
298
413
  }
299
- if (!securityClean) {
414
+ if (!securityTextClean) {
300
415
  problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`)
416
+ } else if (!securityPolicyClean) {
417
+ problems.push(
418
+ `security-review verdict says PASS but carries a finding (${securityPolicyEvaluation.blockingFindings.map((f) => f.severity).join(', ')}) at or above this repository's security policy threshold (${policy.securityThreshold}) — a reviewer's own PASS never overrides policy`
419
+ )
301
420
  } else if (!securityBound) {
302
421
  problems.push(
303
422
  `the newest security-review verdict covers ${security.headSha ?? 'no recorded commit'}, head is ${input.headSha}`
304
423
  )
305
- }
306
- if (!mechanicalChecksClean) {
424
+ } else if (!securityBinding.base) {
425
+ problems.push(
426
+ `the newest security-review verdict was cast against base ${security.baseSha ?? 'no recorded base'}, the PR's base is now ${currentManifest.baseSha ?? 'unresolved'} (a base-only change under an unchanged candidate — same patch text on a new base is not automatically equivalent)`
427
+ )
428
+ } else if (!securityObjectivesBound) {
429
+ problems.push(
430
+ `the newest security-review verdict was cast against objectives version ${security.objectivesVersion ?? 'none'}, the Issue's list is now ${input.objectivesVersion}`
431
+ )
432
+ } else if (!securityRulingsBound) {
433
+ problems.push(
434
+ `the newest security-review verdict was cast against ruling ordinal ${security.rulingOrdinal ?? 'none'}, a newer ruling (ruling ${input.rulingOrdinal}) is now posted on this PR`
435
+ )
436
+ } else if (!securityBinding.briefHash) {
437
+ problems.push(
438
+ `the newest security-review verdict was cast against brief hash ${security.briefHash ?? 'none'}, the frozen brief's current hash is ${currentManifest.briefHash ?? 'none'}`
439
+ )
440
+ } else if (!securityBinding.policyDigest) {
307
441
  problems.push(
308
- reportedMechanicalChecks.length === 0
309
- ? 'no mechanical checks have reported for this head yet'
310
- : `mechanical check(s) not green: ${reportedMechanicalChecks
311
- .filter((c) => c.bucket !== 'pass')
312
- .map((c) => `${c.name} (${c.bucket})`)
313
- .join(', ')}`
442
+ `the newest security-review verdict was cast against review policy digest ${security.policyDigest ?? 'none'}, this repository's current policy digest is ${currentManifest.policyDigest}`
314
443
  )
315
444
  }
316
445
  const ignoredNote =
@@ -330,7 +459,7 @@ export function checkReviewGate(input: ReviewGateInput): ReviewGateResult {
330
459
  * whatever it takes to resolve `expectedAuthor` — resolving that value is a
331
460
  * network round-trip (`resolveReleaseActor(loadTrustAnchorConfig())`) that
332
461
  * must not run on every ordinary PR just because it is one of three
333
- * arguments to `isChangesetsReleasePr`. Found live (code review, PR #169):
462
+ * arguments to `isChangesetsReleasePr`. Found live in code review:
334
463
  * evaluating it inline as a function argument runs it unconditionally,
335
464
  * regardless of branch, since JS evaluates arguments eagerly.
336
465
  */
@@ -367,7 +496,7 @@ export const DEFAULT_RELEASE_ACTOR = 'github-actions[bot]'
367
496
  * an expression evaluated from the workflow file on the DEFAULT BRANCH, a
368
497
  * pull request cannot edit that file to substitute a different literal
369
498
  * (the same `pull_request_target` boundary `vinaya-review.yml` already
370
- * uses). Found live (round 5, PR #165): the identical exemption on a plain
499
+ * uses). Found live: the identical exemption on a plain
371
500
  * `pull_request` trigger let an attacker redirect `PR_NUMBER`/`BRANCH` to
372
501
  * any already-approved PR by the configured release actor — verified no
373
502
  * env-var or git-state signal inside that trigger type is a safe anchor,