@attalabs/vinaya 0.32.0 → 0.34.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 (218) hide show
  1. package/README.md +1 -1
  2. package/aeg-root/contracts/principal-operator.md +18 -5
  3. package/aeg-root/enforcement.md +1 -1
  4. package/aeg-root/glossary.md +4 -0
  5. package/aeg-root/roles/developer.md +3 -0
  6. package/aeg-root/roles/operator.md +89 -16
  7. package/aeg-root/roles/planner/reference.md +3 -2
  8. package/aeg-root/roles/planner.md +3 -1
  9. package/aeg-root/roles/tranche-archivist.md +1 -0
  10. package/aeg-root/skills/aeg-context-packets/SKILL.md +1 -1
  11. package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +1 -1
  12. package/aeg-root/templates/brief-template.md +9 -7
  13. package/aeg-root/templates/pr-report-template.md +3 -1
  14. package/dist/checks/bin/check-body-bare-digits.js +213 -41
  15. package/dist/checks/bin/check-branch-topology.js +164 -41
  16. package/dist/checks/bin/check-brief-shape.js +219 -46
  17. package/dist/checks/bin/check-changeset-coverage.js +669 -152
  18. package/dist/checks/bin/check-closes-n.js +164 -41
  19. package/dist/checks/bin/check-coherence.js +220 -43
  20. package/dist/checks/bin/check-dead-branch-push.js +159 -40
  21. package/dist/checks/bin/check-dispatch-readiness.js +218 -42
  22. package/dist/checks/bin/check-doc-coverage-push.js +665 -148
  23. package/dist/checks/bin/check-doc-coverage.js +667 -150
  24. package/dist/checks/bin/check-doctrine-no-procedures.js +213 -41
  25. package/dist/checks/bin/check-doctrine-portability.js +666 -149
  26. package/dist/checks/bin/check-evidence-fresh.js +643 -125
  27. package/dist/checks/bin/check-exec-bits.js +663 -146
  28. package/dist/checks/bin/check-first-push-dispatch.js +218 -42
  29. package/dist/checks/bin/check-issue-assignment.js +164 -41
  30. package/dist/checks/bin/check-issue-milestone-attach.js +159 -40
  31. package/dist/checks/bin/check-issue-objectives-numbering.js +685 -41
  32. package/dist/checks/bin/check-issue-parts-coverage.js +159 -40
  33. package/dist/checks/bin/check-issue-surface-globs.js +258 -48
  34. package/dist/checks/bin/check-issue-title-grammar.js +159 -40
  35. package/dist/checks/bin/check-issue-tranche-label.js +159 -40
  36. package/dist/checks/bin/check-main-branch-refusal.js +159 -40
  37. package/dist/checks/bin/check-no-disk-state.js +159 -40
  38. package/dist/checks/bin/check-pr-premise-reassert.js +213 -41
  39. package/dist/checks/bin/check-pr-report-density.js +159 -40
  40. package/dist/checks/bin/check-principal-test-plan-wait.js +159 -40
  41. package/dist/checks/bin/check-quoted-command.js +586 -103
  42. package/dist/checks/bin/check-reader-resolvable-prose.js +637 -111
  43. package/dist/checks/bin/check-registry-gates.js +159 -40
  44. package/dist/checks/bin/check-retired-vocabulary.js +586 -103
  45. package/dist/checks/bin/check-review-gate.js +284 -152
  46. package/dist/checks/bin/check-single-plan-pr.js +159 -40
  47. package/dist/checks/bin/check-surface-scope.js +164 -41
  48. package/dist/checks/bin/check-test-plan.js +159 -40
  49. package/dist/checks/bin/check-token-collection-wired.js +159 -40
  50. package/dist/checks/bin/check-token-report.js +159 -40
  51. package/dist/checks/bin/check-workspace-escape.js +664 -147
  52. package/dist/index.js +3932 -1118
  53. package/dist/lib/pre-push-cache-test-run.js +507 -72
  54. package/dist/lib/pre-push-select-tests.js +136 -13
  55. package/package.json +1 -1
  56. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
  57. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
  58. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
  59. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
  60. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
  61. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +222 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/outcomes.ts +135 -0
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +394 -0
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +1 -2
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +1 -1
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +2 -2
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +514 -0
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +110 -0
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +30 -0
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +219 -0
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +97 -0
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +240 -0
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +1 -1
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +1 -2
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +65 -22
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +238 -0
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +14 -1
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +1 -1
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +1 -1
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +1 -1
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +1 -1
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-no-procedures.ts +1 -1
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +5 -5
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +1 -1
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +1 -1
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +14 -3
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +425 -11
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +3 -4
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +1450 -33
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +1 -2
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +2 -2
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +119 -0
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +75 -0
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/redact.ts +87 -0
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +801 -0
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +373 -0
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +2 -2
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +1 -1
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +2 -3
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +2 -2
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +288 -0
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +3 -3
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +1 -1
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +30 -16
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +17 -1
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +1 -1
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +1 -1
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +267 -19
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +91 -24
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +6 -6
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +4 -4
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +254 -110
  120. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +384 -0
  121. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +208 -0
  122. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +80 -28
  123. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +92 -0
  124. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +4 -4
  125. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +40 -27
  126. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +2 -2
  127. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +38 -0
  128. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +194 -0
  129. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +712 -0
  130. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +7 -9
  131. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +5 -5
  132. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +4 -4
  133. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +368 -56
  134. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +2 -3
  135. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +3 -3
  136. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  138. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +2 -2
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +1 -1
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  177. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  180. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/{[externals]__1agj1ww._.js → [externals]__0cki-x_._.js} +2 -2
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +6 -6
  184. 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
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +3 -0
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0r7e54g._.js → [root-of-the-server]__07uhu5z._.js} +1 -1
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1r47dr7._.js → _08onyya._.js} +3 -3
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  193. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +1 -1
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +5 -5
  199. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  200. 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
  201. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  202. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  204. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  205. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +1 -0
  206. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +1 -0
  207. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 0q9p7c6vn-x2w.js} +4 -4
  208. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 2174nz5he_oc4.js} +1 -1
  209. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3xnma0-359j17.js +1 -0
  210. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  211. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0hstap0._.js +0 -3
  212. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bm4nrrzwc7zi.css +0 -1
  213. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2t_rfsztmwu6y.js +0 -1
  214. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3ua4rm5f-a9k6.js +0 -1
  215. /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/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
  216. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_buildManifest.js +0 -0
  217. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_clientMiddlewareManifest.js +0 -0
  218. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_ssgManifest.js +0 -0
@@ -1,7 +1,6 @@
1
1
  /**
2
- * Test Plan checkbox-state gate evaluator (aeg-governance-hardening
3
- * task 25, #365; narrowed to `[principal]` boxes only by task 12, #387 —
4
- * the `[agent]` half stopped being a checkbox at all: it is a fenced command
2
+ * Test Plan checkbox-state gate evaluator (later narrowed to `[principal]`
3
+ * boxes only — the `[agent]` half stopped being a checkbox at all: it is a fenced command
5
4
  * list `vinaya pr report` executes and writes into the `AEG:EVIDENCE` block,
6
5
  * which IS the evidence, so there is nothing left for this gate to grade on
7
6
  * that half). Pure — no `fs`, no `gh`/`git`. The CLI shim
@@ -13,17 +12,18 @@
13
12
  * This module owns the checkbox tick-state decision built on top of it:
14
13
  *
15
14
  * - No section found, task branch → `fail` (a task PR without a
16
- * Test Plan is malformed, not exempt — the exact #377 live-fire gap).
15
+ * Test Plan is malformed, not exempt — a real live-fire gap).
17
16
  * - No section found, non-task branch (or no BRANCH) → `pass` (advisory).
18
17
  * - `Test Plan: unit-tests-only` sentinel → `pass`.
19
18
  * - Any unticked `- [ ]` `[principal]` checkbox → `fail`, naming every
20
- * unticked line. A `[agent]`-tagged checkbox (a pre-#387 body, still
19
+ * unticked line. A `[agent]`-tagged checkbox (an older body, still
21
20
  * grandfathered by `brief-shape`'s own rollout) is never graded here —
22
21
  * see the module doc comment above.
23
22
  * - All `[principal]` boxes ticked (or none exist at all) → `pass`.
24
23
  */
25
24
 
26
25
  import { locateTestPlanSection } from './test-plan-section'
26
+ import { parseTaskBranchIdentity } from './task-branch-identity'
27
27
 
28
28
  export type TestPlanGateVerdict = 'pass' | 'fail'
29
29
  export type TestPlanGateResult = {
@@ -31,8 +31,6 @@ export type TestPlanGateResult = {
31
31
  messages: string[]
32
32
  }
33
33
 
34
- const TASK_BRANCH_PATTERN = /^task\/[^/]+\/[^/]+$/
35
-
36
34
  export function evaluateTestPlanGate(body: string, branch: string): TestPlanGateResult {
37
35
  if (!body) {
38
36
  return {
@@ -47,7 +45,7 @@ export function evaluateTestPlanGate(body: string, branch: string): TestPlanGate
47
45
  const located = locateTestPlanSection(body)
48
46
 
49
47
  if (!located.found) {
50
- if (TASK_BRANCH_PATTERN.test(branch)) {
48
+ if (parseTaskBranchIdentity(branch) !== null) {
51
49
  return {
52
50
  verdict: 'fail',
53
51
  messages: [
@@ -77,7 +75,7 @@ export function evaluateTestPlanGate(body: string, branch: string): TestPlanGate
77
75
  }
78
76
 
79
77
  // `[agent]` checkboxes are never graded here — see the module doc comment.
80
- // A pre-#387 body may still carry them (grandfathered by `brief-shape`'s
78
+ // An older body may still carry them (grandfathered by `brief-shape`'s
81
79
  // own rollout); this gate simply does not look at that tag at all any
82
80
  // more, ticked or not.
83
81
  const checkboxLines = section
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Test Plan section locator (aeg-governance-hardening task 25, #365). Pure —
2
+ * Test Plan section locator. Pure —
3
3
  * no `fs`, no `gh`/`git`. Extracted from `bin/verify-test-plan.ts`'s original
4
- * inline-only regex to fix the live-fire gap PR #377 exposed: its body used
4
+ * inline-only regex to fix a live-fire gap a real PR exposed: its body used
5
5
  * the `## 9. Test Plan` heading form, which the old inline-only regex never
6
6
  * matched, so `verify-test-plan` reported "no section" and advisory-PASSED a
7
7
  * PR that actually had an unticked `**[principal]**` box.
@@ -43,9 +43,9 @@ const NEXT_SECTION_RE = /\n(?:#{1,3}[ \t]|\*\*[A-Z][^*\n]*:\*\*)/
43
43
  * task 30), the pair IS the section: its whole content is returned verbatim,
44
44
  * with no heading/inline marker required inside it — requiring a second,
45
45
  * redundant in-region marker would reintroduce the unrecognized-heading
46
- * failure class (#377) the anchors exist to close. Identical-looking Test
47
- * Plan text elsewhere in the body (a pasted reference brief's own §9, the
48
- * PR #392 shape) is ignored. Bodies without the pair parse exactly as before.
46
+ * failure class the anchors exist to close. Identical-looking Test
47
+ * Plan text elsewhere in the body (a pasted reference brief's own §9)
48
+ * is ignored. Bodies without the pair parse exactly as before.
49
49
  */
50
50
  export function locateTestPlanSection(body: string): TestPlanSection {
51
51
  const region = anchoredRegion(body, 'TEST-PLAN')
@@ -30,8 +30,8 @@ export type Registry = Project[]
30
30
  // ---------- Tranche file (tranches/<name>.md) ----------
31
31
 
32
32
  /**
33
- * `Lifecycle`/`Task`/`Tranche` live in `@attalabs/aeg-types` (task
34
- * aeg-forge-state-v1 3a) — re-exported here since every existing call site
33
+ * `Lifecycle`/`Task`/`Tranche` live in `@attalabs/aeg-types` —
34
+ * re-exported here since every existing call site
35
35
  * across the repo imports them from `@attalabs/aeg-core`. Moved out so
36
36
  * `@attalabs/aeg-forge-state` can depend on these shapes without creating a
37
37
  * package cycle with `aeg-core` (which in turn depends on
@@ -42,7 +42,7 @@ export type { Lifecycle, Task, Tranche }
42
42
  // ---------- Forge facts ----------
43
43
 
44
44
  /**
45
- * `ForgeFacts` lives in `@attalabs/aeg-types` (aeg-core-purity fix, #521) —
45
+ * `ForgeFacts` lives in `@attalabs/aeg-types` (an aeg-core-purity fix) —
46
46
  * re-exported here for the same reason as `Lifecycle`/`Task`/`Tranche`:
47
47
  * every existing call site imports it from `@attalabs/aeg-core`, and it moved
48
48
  * out so the I/O-performing fetchers that produce it (now in
@@ -131,7 +131,7 @@ export type DerivedTranche = {
131
131
  * The tranche total is `sum(rows)`, derived at read time — never stored.
132
132
  *
133
133
  * The two capture sources surface here as `null` cells: a row written by a
134
- * claude.ai role (Planner / Brief Author / Reviewer / Security) before the
134
+ * claude.ai role (Planner / Reviewer / Security) before the
135
135
  * Principal has filled in its usage figure has `tokensIn`/`tokensOut`/`cost`
136
136
  * as `null`; a terminal-role row (Developer / Archivist with `/cost`) has
137
137
  * exact numbers.
@@ -1,19 +1,18 @@
1
1
  /**
2
- * Shared code-reviewer / security-review verdict extraction (aeg-review-gate-v1
3
- * task 1, #474). Originally private to `archive-task.ts`'s post-merge
2
+ * Shared code-reviewer / security-review verdict extraction. Originally private to `archive-task.ts`'s post-merge
4
3
  * provenance assembly (advisory-only, DANGLING on a missing/unclear verdict).
5
4
  * Extracted so the pre-merge `review-gate.ts` blocking check calls the
6
5
  * IDENTICAL regex/parsing logic — a future drift between two copies of the
7
- * same pattern would silently reopen the gap this task exists to close (one
8
- * implementation per fact, §11 constraint). Pure — no `fs`, no `fetch`.
6
+ * same pattern would silently reopen the gap this exists to close (one
7
+ * implementation per fact). Pure — no `fs`, no `fetch`.
9
8
  *
10
9
  * Picks the MOST RECENT comment carrying a clear value, not the first comment
11
- * merely matching the pattern (aeg-review-gate-v1 task 1 fix — the original
10
+ * merely matching the pattern (a real fix — the original
12
11
  * single-comment `.find()` broke on real multi-comment PRs: a REQUEST_CHANGES
13
12
  * verdict followed by fixes and a later clean APPROVE).
14
13
  *
15
14
  * Line-anchored `VERDICT:` marker only — NOT a bare word search anywhere in
16
- * the comment (aeg-review-gate-v1 task 1 follow-up, security-review FAIL
15
+ * the comment (a security-review FAIL
17
16
  * finding, confirmed by direct execution: the old bare `\b(PASS|FAIL)\b`
18
17
  * pattern matched the post-merge Archivist's own auto-generated DANGLING
19
18
  * placeholder text — "no security-review pass was run before merge —
@@ -25,33 +24,49 @@
25
24
  * code-reviewer.md`/`security-reviewer.md` require verbatim) — tightening
26
25
  * to it closes the gap without inventing a new convention.
27
26
  *
28
- * The VALUE is windowed to the comment's first THREE lines only
29
- * (review-convergence-v1 task 2, round 4, `#392`) — never a line anywhere
30
- * else in the body. Every shape this package's own callers render puts the
31
- * `VERDICT:`/`ESCALATE:` line first and `Judged head:` third; a
32
- * caller-supplied field (findings, conformance prose, a summary) never
33
- * renders before line 5. Restricting the read window closes a
34
- * caller-controlled-text injection route without narrowing what any real
35
- * render needs matched.
27
+ * AEG:CLAIM: packages/aeg-core/src/verdict-extraction.ts contains:function firstFiveLines(comment: string): string {
28
+ * The VALUE is windowed to the comment's first FIVE lines only
29
+ * (widened, when `Objectives version:` became a third head line) —
30
+ * never a line anywhere else in the body. Every shape this package's own
31
+ * callers render puts the `VERDICT:`/`ESCALATE:` line first and `Judged
32
+ * head:` third; `Objectives version:` fifth WHEN it renders at all (it is
33
+ * omitted pre-cutover — a `null` objectives version). The precise guarantee
34
+ * is narrower than "no caller content in the window": a caller-supplied
35
+ * VALUE can appear inside the window, appended after a fixed, renderer-owned
36
+ * label on the same line — code-review's `BRIEF CONFORMANCE: <value>` can
37
+ * land on line 5 itself (pre-cutover, no scope evidence). In every shape
38
+ * EXCEPT ONE, that label is what forecloses the value from ever reading as
39
+ * `VERDICT:`/`Judged head:`/`Objectives version:`, regardless of which line
40
+ * number it lands on. The one exception is `renderEscalationComment`'s
41
+ * `input.summary`: pre-cutover, it becomes line 5 outright, with no label
42
+ * ahead of it at all — a summary whose own first line happened to read
43
+ * `VERDICT: APPROVE` would extract as a real verdict through this exact
44
+ * window. Construction alone does not close that case; `review-post.ts`'s
45
+ * `checkRenderedComment` does, mechanically, by re-running these same
46
+ * extractors over the rendered text before any post and refusing an
47
+ * escalation that re-parses as either verdict. Restricting the read window
48
+ * to lines 1-5 closes a caller-controlled-text injection route without
49
+ * narrowing what any real render needs matched; it is this module's own
50
+ * contribution, not a claim that no render can still collide.
36
51
  *
37
- * The CANDIDATE SET stays whole-body (review-convergence-v1 task 2, round 5,
38
- * `#392`) — round 4 windowed where a verdict's value is read, not which
52
+ * AEG:CLAIM: packages/aeg-core/src/verdict-extraction.ts contains:function firstFiveLines(comment: string): string {
53
+ * The CANDIDATE SET stays whole-body — an earlier round windowed where a verdict's value is read, not which
39
54
  * comments count as a candidate at all. A comment whose only VERDICT-shaped
40
- * line sits outside its first three lines is still the most recent
55
+ * line sits outside its first five lines is still the most recent
41
56
  * candidate if it is the most recent comment; it reads as DANGLING rather
42
57
  * than being skipped, so it correctly shadows an earlier clean verdict
43
58
  * instead of silently letting the earlier one win.
44
59
  *
45
60
  * The anchor tolerates a leading markdown EMPHASIS run — one to three `*` or
46
61
  * `_`, immediately abutting the token — so `**VERDICT: APPROVE**` and
47
- * `_VERDICT: APPROVE_` match (PR #636: the reviewer subagent emitted the
62
+ * `_VERDICT: APPROVE_` match (a real incident: the reviewer subagent emitted the
48
63
  * bolded form and the gate read the PR as carrying no code-review verdict at
49
64
  * all). The spec still mandates the bare line; this only stops an agent's
50
65
  * markdown drift from silently DANGLING a real verdict.
51
66
  *
52
67
  * Emphasis ONLY — the following are deliberately NOT tolerated, because each
53
68
  * is a way for prose to *mention* a verdict rather than *cast* one, and this
54
- * gate blocks merges (#639 review, findings 1/3/5):
69
+ * gate blocks merges (several review findings):
55
70
  * `> VERDICT: APPROVE` blockquote — GitHub's quote-reply syntax. A
56
71
  * Developer quoting the reviewer's earlier text
57
72
  * would otherwise become the PR's own verdict, and
@@ -87,10 +102,10 @@
87
102
  * identical to no comment existing — which is also what the DANGLING
88
103
  * placeholder case above requires.
89
104
  *
90
- * Reviewed-commit binding (#73, a duplicate of #71 closes this one). The
105
+ * Reviewed-commit binding. The
91
106
  * winning comment (the one whose `VERDICT:` line matched) is also searched
92
- * for a `Judged head: <sha>` line — the exact phrase reviewers on
93
- * atta-labs/attalabs#664 were already hand-typing before this existed as a
107
+ * for a `Judged head: <sha>` line — the exact phrase reviewers were
108
+ * already hand-typing before this existed as a
94
109
  * mechanism, formalized rather than invented. Same anchor discipline as
95
110
  * `VERDICT:` itself: line-start, optional leading emphasis run, no
96
111
  * blockquote/list-item/heading/code-span tolerance — a sha mentioned in
@@ -100,58 +115,323 @@
100
115
  * the PR's actual head. Searched only within the SAME comment body that
101
116
  * produced the winning verdict — a sha mentioned in a different comment is
102
117
  * not this verdict's binding.
118
+ *
119
+ * Ruling-freshness binding. A
120
+ * fifth field, `rulingOrdinal`, is read from the SAME winning comment via
121
+ * `extractRulingOrdinal`/`firstSevenLines` — its OWN window, not
122
+ * `firstFiveLines` widened in place (see that function's doc comment for
123
+ * why: an out-of-surface `AEG:CLAIM` in `packages/sources` pins
124
+ * `firstFiveLines`'s exact signature). `null` means no `Ruling ordinal:`
125
+ * line at all — the pre-cutover stock — never confused with a rendered
126
+ * `0`, which means a post-cutover verdict cast when the PR carried no
127
+ * ruling yet.
103
128
  */
104
129
 
105
130
  const HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im
106
131
 
107
132
  /**
108
- * Round-4 ruling on `#392`: both markers are read from a comment's first
109
- * THREE lines only, never anywhere else in the body. Every shape this
110
- * package itself renders (`review-post.ts`'s `renderCodeReviewComment`/
111
- * `renderSecurityComment`/`renderEscalationComment`) puts `VERDICT:`/
112
- * `ESCALATE:` on line 1 and `Judged head:` on line 3 — every caller-supplied
113
- * field (findings, conformance prose, scope, a summary) renders strictly
114
- * after that, starting at line 5 at the earliest. Restricting the window to
115
- * lines 1–3 costs no real render anything: it is a strictly narrower read
116
- * than "anywhere in the body," and it closes the class of defect that
117
- * motivated this ruling — a caller-supplied field that smuggled a raw
118
- * newline followed by a `VERDICT:`- or `Judged head:`-shaped line could
119
- * previously inject a structural line from outside the command's own
120
- * three-line skeleton; that line can now never be read as one.
133
+ * The render grows a third head
134
+ * line — `Objectives version: <hash>` on line 5, blank line 6 — ONLY when a
135
+ * non-null version exists; pre-cutover PRs omit it, and line 5 is then free
136
+ * for the next fixed label instead (code-review's `BRIEF CONFORMANCE:`),
137
+ * whose value can be the earliest caller-supplied text `renderCodeReviewComment`
138
+ * itself ever puts on the wire. Same anchor discipline as `VERDICT:`/
139
+ * `Judged head:`: line-start, optional leading emphasis run, no
140
+ * blockquote/list-item/heading/code-span tolerance. The value is a sha256
141
+ * hex string (64 hex chars, `objectivesOf`'s built form), never the loop
142
+ * spec's superseded `number`.
143
+ */
144
+ const OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im
145
+
146
+ /**
147
+ * A fourth head line, `Ruling
148
+ * ordinal: <k>`, renders UNCONDITIONALLY on every post-cutover verdict —
149
+ * `0` when no principal ruling existed on the PR at cast time, never
150
+ * omitted the way `Objectives version:` is pre-cutover. Read from its OWN
151
+ * wider window (`firstSevenLines`, below), never from `firstFiveLines`:
152
+ * `packages/sources` carries an `AEG:CLAIM` binding on `firstFiveLines`'s
153
+ * exact signature that this task's declared Surface excludes, so that
154
+ * function's name, body, and 5-line reach stay byte-identical — widening
155
+ * it in place would silently break that out-of-surface claim. The value is
156
+ * a decimal ordinal (the marker's own `<pr>-<k>`, `k` monotone by
157
+ * construction in `vinaya pr rule`), never a hash.
158
+ */
159
+ const RULING_ORDINAL_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Ruling ordinal:\s*(\d+)(?!\d)/im
160
+
161
+ /**
162
+ * A fifth head line, `Brief hash:
163
+ * <sha256>`, renders UNCONDITIONALLY on every post-cutover verdict right
164
+ * after `Ruling ordinal:` — the frozen brief's own hash at dispatch time.
165
+ * `null` means no such line at all — legacy stock from before this task, or
166
+ * a rendered `(none)` placeholder when no frozen brief was resolvable for
167
+ * that task/PR at cast time (never confused with a real 64-hex-char hash).
168
+ * Read from its own wider window (`firstElevenLines`, below), same reasoning
169
+ * as `RULING_ORDINAL_PATTERN`'s own `firstSevenLines`.
170
+ */
171
+ const BRIEF_HASH_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Brief hash:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im
172
+
173
+ /**
174
+ * A sixth head line, `Policy
175
+ * digest: <sha256>`, renders UNCONDITIONALLY right after `Brief hash:` —
176
+ * the effective review policy's digest at cast time. `null` means no such
177
+ * line at all — legacy stock from before this task, or a stripped/malformed
178
+ * line. Unlike the other fields this package extracts, a `null` echo here
179
+ * is NEVER grandfathered (a MEDIUM security-review finding): a policy is always
180
+ * resolvable, so there is no genuine "nothing to bind against" case on the
181
+ * current side to key forgiveness on the way brief-hash/objectives/ruling
182
+ * each have — `review-input-manifest.ts`'s `isBoundToPolicy` requires an
183
+ * exact digest match unconditionally.
184
+ */
185
+ const POLICY_DIGEST_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Policy digest:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im
186
+
187
+ /**
188
+ * O1: a seventh head line, `Judged base:
189
+ * <sha>`, renders UNCONDITIONALLY on every verdict from this task forward,
190
+ * right after `Policy digest:` — the base commit the candidate was judged
191
+ * against (a base identity a prior task deliberately deferred). Appended
192
+ * LAST rather than beside `Judged head:` on purpose: inserting it earlier
193
+ * would shift `Objectives version:`/`Ruling ordinal:`/`Brief hash:`/`Policy
194
+ * digest:` down and out of the exact read windows those extractors already
195
+ * pin (`firstFiveLines`/`firstSevenLines`/`firstElevenLines`), silently
196
+ * breaking every one of them. A trailing line pushes nothing out. Same anchor
197
+ * discipline as `Judged head:` (line-start, optional emphasis run, no
198
+ * blockquote/list/heading/code-span). Accepts the abbreviated (7-char) and
199
+ * full (40-char) hex forms; `null` means no such line — pre-cutover stock, or
200
+ * the rendered `(none)` placeholder when no base was resolvable at cast time
201
+ * (never confused with a real hex sha).
202
+ */
203
+ const BASE_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged base:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im
204
+
205
+ /**
206
+ * AEG:CLAIM: packages/aeg-core/src/verdict-extraction.ts contains:function firstFiveLines(comment: string): string {
207
+ * AEG:CLAIM: apps/cli/src/commands/review-post.ts contains:export function renderEscalationComment(input: EscalationInput): string {
208
+ * AEG:CLAIM: apps/cli/src/commands/review-post.ts contains:export function checkRenderedComment(body: string, expectation: RenderExpectation): RenderCheckResult {
209
+ * A ruling, later widened:
210
+ * all three markers are read from a comment's first FIVE lines only, never
211
+ * anywhere else in the body. Every shape this package itself renders
212
+ * (`review-post.ts`'s `renderCodeReviewComment`/`renderSecurityComment`/
213
+ * `renderEscalationComment`) puts `VERDICT:`/`ESCALATE:` on line 1 and
214
+ * `Judged head:` on line 3; `Objectives version:` lands on line 5 only when
215
+ * non-null (pre-cutover PRs omit it). A caller-supplied field (findings,
216
+ * conformance prose, scope) in `renderCodeReviewComment`/`renderSecurityComment`
217
+ * never OPENS one of the first five lines — it can only ever appear appended
218
+ * after a fixed, renderer-owned label already on that line, and code-review's
219
+ * `BRIEF CONFORMANCE:` value can be that as early as line 5 itself
220
+ * (pre-cutover, no scope evidence), not a fixed "line 6" or "line 7" floor.
221
+ * `renderEscalationComment`'s `summary` is the one field this does NOT hold
222
+ * for: pre-cutover, it IS line 5, unprefixed — construction alone does not
223
+ * keep it out of the window, `checkRenderedComment`'s runtime self-check
224
+ * does (see this file's module comment). Restricting the window to lines
225
+ * 1–5 costs no real render anything: it is a strictly narrower read than
226
+ * "anywhere in the body," and it closes the class of defect that motivated
227
+ * this ruling — a caller-supplied field that smuggled a raw newline
228
+ * followed by a `VERDICT:`-, `Judged head:`-, or `Objectives
229
+ * version:`-shaped line could previously inject a structural line from
230
+ * outside the command's own skeleton; that line can now never be read as
231
+ * one.
121
232
  */
122
- function firstThreeLines(comment: string): string {
123
- return comment.split('\n').slice(0, 3).join('\n')
233
+ function firstFiveLines(comment: string): string {
234
+ return comment.split('\n').slice(0, 5).join('\n')
124
235
  }
125
236
 
126
237
  function extractHeadSha(comment: string): string | null {
127
- const m = firstThreeLines(comment).match(HEAD_SHA_PATTERN)
238
+ const m = firstFiveLines(comment).match(HEAD_SHA_PATTERN)
128
239
  return m ? (m[1] as string).toLowerCase() : null
129
240
  }
130
241
 
242
+ function extractObjectivesVersion(comment: string): string | null {
243
+ const m = firstFiveLines(comment).match(OBJECTIVES_VERSION_PATTERN)
244
+ return m ? (m[1] as string).toLowerCase() : null
245
+ }
246
+
247
+ /**
248
+ * Its own 7-line window, wider
249
+ * than `firstFiveLines` by exactly the two lines `Ruling ordinal:` and its
250
+ * preceding blank line add when `Objectives version:` also renders (worst
251
+ * case: line 7). `null` means no `Ruling ordinal:` line at all — the
252
+ * pre-cutover stock this task's Traps require staying bound whenever the
253
+ * PR itself carries no ruling (`review-gate.ts`'s `isBoundToRulings`), not
254
+ * `0` — `0` is only ever the RENDERED explicit value on a post-cutover
255
+ * verdict.
256
+ */
257
+ function firstSevenLines(comment: string): string {
258
+ return comment.split('\n').slice(0, 7).join('\n')
259
+ }
260
+
261
+ function extractRulingOrdinal(comment: string): number | null {
262
+ const m = firstSevenLines(comment).match(RULING_ORDINAL_PATTERN)
263
+ return m ? Number.parseInt(m[1] as string, 10) : null
264
+ }
265
+
131
266
  /**
267
+ * Its own 11-line window — worst
268
+ * case, `Objectives version:`/blank (lines 5-6), `Ruling ordinal:`/blank
269
+ * (7-8), `Brief hash:`/blank (9-10) all render ahead of `Policy digest:`,
270
+ * which then lands on line 11. `null` means no `Brief hash:`/`Policy
271
+ * digest:` line at all within that window.
272
+ */
273
+ function firstElevenLines(comment: string): string {
274
+ return comment.split('\n').slice(0, 11).join('\n')
275
+ }
276
+
277
+ function extractBriefHash(comment: string): string | null {
278
+ const m = firstElevenLines(comment).match(BRIEF_HASH_PATTERN)
279
+ return m ? (m[1] as string).toLowerCase() : null
280
+ }
281
+
282
+ function extractPolicyDigest(comment: string): string | null {
283
+ const m = firstElevenLines(comment).match(POLICY_DIGEST_PATTERN)
284
+ return m ? (m[1] as string).toLowerCase() : null
285
+ }
286
+
287
+ /**
288
+ * O1: its own 13-line window — worst
289
+ * case, `Objectives version:`/blank, `Ruling ordinal:`/blank, `Brief hash:`/
290
+ * blank, `Policy digest:`/blank all render ahead of `Judged base:`, which
291
+ * then lands on line 13. `null` means no `Judged base:` line within that
292
+ * window — pre-cutover stock, or a `(none)` placeholder.
293
+ */
294
+ function firstThirteenLines(comment: string): string {
295
+ return comment.split('\n').slice(0, 13).join('\n')
296
+ }
297
+
298
+ function extractBaseSha(comment: string): string | null {
299
+ const m = firstThirteenLines(comment).match(BASE_SHA_PATTERN)
300
+ return m ? (m[1] as string).toLowerCase() : null
301
+ }
302
+
303
+ /**
304
+ * The re-review-state grammar `roles/reviewer.md`/`roles/security.md` define
305
+ * for a finding's description head — `F<n> <class>[ <state>]:`, states exactly
306
+ * `open|fix-claimed|reproduced|resolved` — captured as the SINGLE definition
307
+ * of that grammar in this package. `review-status.ts` (the loop's finding
308
+ * comparison) and `review-post.ts` (verdict derivation, re-review reference
309
+ * matching) both read a finding's id and state through `parseFindingState`
310
+ * rather than each embedding their own copy of the state token list — this is
311
+ * the one regex; there is no third (Traps to avoid). The class token is
312
+ * `\S+` (single-word by construction), matched non-capturing between the id
313
+ * and the optional state so `F1 correctness resolved:` reads state `resolved`
314
+ * while `F1 correctness:` reads state `null`.
315
+ */
316
+ const FINDING_DESCRIPTION_STATE = /^F(\d+)(?:\s+\S+)?(?:\s+(open|fix-claimed|reproduced|resolved))?:/
317
+
318
+ /**
319
+ * Parses the `F<n> <class>[ <state>]:` head of a finding's DESCRIPTION (the
320
+ * text after the rendered line's ` — ` separator, or a raw findings-file
321
+ * description) into its id and re-review state. Both `null` when the
322
+ * description carries no `F<n>` head at all — a new, id-less finding, or a
323
+ * hand-typed line outside the grammar. A finding with an id but no state token
324
+ * reads `state: null` — which every consequential-finding rule treats as
325
+ * still-blocking, the fail-closed direction (O2).
326
+ */
327
+ export function parseFindingState(description: string): { id: string | null; state: string | null } {
328
+ const m = FINDING_DESCRIPTION_STATE.exec(description.trim())
329
+ if (!m) return { id: null, state: null }
330
+ return { id: `F${m[1]}`, state: m[2] ?? null }
331
+ }
332
+
333
+ /**
334
+ * O2/O3: the FINDINGS block's own
335
+ * severities, read from the WHOLE comment body — never `firstFiveLines`'s
336
+ * window, since `renderFindingsSection` (`review-post.ts`) always renders
337
+ * the findings list well past line five. This is what lets the merge gate
338
+ * (`checkReviewGate`) and the loop's publication self-check evaluate the
339
+ * SAME findings a reviewer's own `VERDICT:` line claims to summarize,
340
+ * against repository policy, rather than trusting that line alone — a
341
+ * reviewer's own `APPROVE` never overrides the evaluator.
342
+ *
343
+ * `renderFindingsSection`'s exact numbered-bracket form —
344
+ * `<n>. [SEVERITY] file:line — description` — is the only shape read here;
345
+ * "None." (the empty-findings render) matches nothing, correctly yielding
346
+ * `[]`. A hand-typed comment that never went through that renderer simply
347
+ * contributes no severities, the same fail-safe direction `extractVerdict`
348
+ * already takes for anything outside its own known shapes.
349
+ *
350
+ * Location is captured too — non-
351
+ * greedy up to the ` — ` separator, so a location containing its own space
352
+ * (`PR body`) is still captured whole rather than truncated at the first
353
+ * space — this is what lets `evaluateReviewFindings`'s prose cap apply to a
354
+ * re-parsed, hand-posted comment exactly as it does to a freshly-derived
355
+ * finding, so the gate and the loop never disagree about a body/comment/
356
+ * role-file finding either.
357
+ *
358
+ * The DESCRIPTION after the separator is captured too and run through
359
+ * `parseFindingState` for the finding's id and re-review state (O1/O2): this
360
+ * is what lets `checkReviewGate` and `publishRound` drop a `resolved` finding
361
+ * from the policy evaluation exactly as `deriveCodeReviewVerdict` already
362
+ * does, so a reviewer marking a blocker `resolved` clears it from the gate.
363
+ * The description is optional in the match (`— ` with nothing after still
364
+ * yields a severity) so a malformed finding line never silently drops its
365
+ * severity — a stateless finding still blocks, fail-closed.
366
+ */
367
+ const FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—(?:\s+(.*))?$/gm
368
+
369
+ function extractFindingSeverities(
370
+ comment: string
371
+ ): { severity: string; location: string; id: string | null; state: string | null }[] {
372
+ return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => {
373
+ const { id, state } = parseFindingState((m[3] as string | undefined) ?? '')
374
+ return {
375
+ severity: m[1] as string,
376
+ location: m[2] as string,
377
+ id,
378
+ state
379
+ }
380
+ })
381
+ }
382
+
383
+ /**
384
+ * AEG:CLAIM: packages/aeg-core/src/verdict-extraction.ts contains:function firstFiveLines(comment: string): string {
132
385
  * `headSha` is `null` in two distinct situations that both mean "cannot
133
386
  * confirm this verdict covers the current head": no verdict comment matched
134
387
  * at all (`danglingNote` is also set), or a verdict comment matched but
135
388
  * carried no `Judged head:` line (`danglingNote` is `null` — the verdict
136
389
  * itself is real, only the binding is missing). `review-gate.ts` treats both
137
- * as unbound; only their `danglingNote`/`value` differ.
390
+ * as unbound; only their `danglingNote`/`value` differ. `objectivesVersion`
391
+ * follows the same null-means-unbound rule: no version line in the winning comment's first five lines
392
+ * reads as `null`, identical in shape to a missing `Judged head:` line.
138
393
  */
139
- export type VerdictExtraction = { value: string; headSha: string | null; danglingNote: string | null }
394
+ export type VerdictExtraction = {
395
+ value: string
396
+ headSha: string | null
397
+ objectivesVersion: string | null
398
+ /** `null` on the pre-cutover stock (no `Ruling ordinal:` line at all) — never conflated with a rendered `0`. */
399
+ rulingOrdinal: number | null
400
+ /** `null` when no `Brief hash:` line was found — legacy stock, or no frozen brief resolvable at cast time. */
401
+ briefHash: string | null
402
+ /** `null` when no `Policy digest:` line was found — legacy stock only; every comment rendered from this task forward carries it unconditionally. */
403
+ policyDigest: string | null
404
+ /** `null` when no `Judged base:` line was found (O1) — legacy stock, or no base resolvable at cast time; every comment rendered from this task forward carries it unconditionally. */
405
+ baseSha: string | null
406
+ /**
407
+ * The winning comment's own FINDINGS block severities and locations,
408
+ * whole-body read (O2/O3; location added O5; id and re-review state added
409
+ * this task) — `[]` on a DANGLING extraction (`danglingNote` set) or a
410
+ * comment with no findings at all. `id`/`state` are `null` for a finding
411
+ * whose description carries no `F<n> <class>[ <state>]:` head (a hand-typed
412
+ * line, or a stateless finding); a `resolved` state is what the merge gate
413
+ * and the loop's publication self-check drop from the policy evaluation.
414
+ */
415
+ findingSeverities: { severity: string; location: string; id: string | null; state: string | null }[]
416
+ danglingNote: string | null
417
+ }
140
418
 
141
419
  /**
142
- * Round 5 (`#392`): the candidate set — which comments even ATTEMPTED a
143
- * verdict — is a whole-body test, the pre-round-4 pattern. Only the VALUE is
144
- * read from the first three lines (round 4, kept). Round 4's own change
145
- * built `clearHits` from the windowed text directly, which made a comment
146
- * whose marker sits below line 3 vanish from consideration entirely rather
147
- * than counting as present-but-unclear — "most recent clear hit wins" then
148
- * silently fell through to an OLDER comment, so a later blocking verdict
149
- * that happened to render past line 3 let an earlier clean pass win. Here,
150
- * the most recent CANDIDATE is picked first; only then is its value read
151
- * from its own first three lines. A candidate whose window carries no value
152
- * is DANGLING — never skipped in favour of an earlier one — so a later
153
- * unclear comment still shadows an earlier clean verdict, the fail-closed
154
- * direction every other branch of this function already takes.
420
+ * AEG:CLAIM: packages/aeg-core/src/verdict-extraction.ts contains:function firstFiveLines(comment: string): string {
421
+ * The candidate set — which comments even ATTEMPTED a
422
+ * verdict — is a whole-body test, an earlier pattern. Only the VALUE is
423
+ * read from the first five lines (widened by a later change). An earlier
424
+ * change built `clearHits` from the windowed text directly, which
425
+ * made a comment whose marker sits below the window vanish from
426
+ * consideration entirely rather than counting as present-but-unclear —
427
+ * "most recent clear hit wins" then silently fell through to an OLDER
428
+ * comment, so a later blocking verdict that happened to render past the
429
+ * window let an earlier clean pass win. Here, the most recent CANDIDATE is
430
+ * picked first; only then is its value read from its own first five lines.
431
+ * A candidate whose window carries no value is DANGLING — never skipped in
432
+ * favour of an earlier one — so a later unclear comment still shadows an
433
+ * earlier clean verdict, the fail-closed direction every other branch of
434
+ * this function already takes.
155
435
  */
156
436
  function extractVerdict(comments: string[], valuePattern: RegExp, missingLabel: string): VerdictExtraction {
157
437
  const candidates = comments.filter((c) => valuePattern.test(c))
@@ -159,27 +439,59 @@ function extractVerdict(comments: string[], valuePattern: RegExp, missingLabel:
159
439
  return {
160
440
  value: `no ${missingLabel} pass was run before merge — DANGLING, see below`,
161
441
  headSha: null,
442
+ objectivesVersion: null,
443
+ rulingOrdinal: null,
444
+ briefHash: null,
445
+ policyDigest: null,
446
+ baseSha: null,
447
+ findingSeverities: [],
162
448
  danglingNote: `no ${missingLabel} verdict comment found on this PR`
163
449
  }
164
450
  }
165
451
 
166
452
  const latest = candidates[candidates.length - 1] as string
167
- const m = firstThreeLines(latest).match(valuePattern)
453
+ const m = firstFiveLines(latest).match(valuePattern)
168
454
  if (!m) {
455
+ // AEG:CLAIM: packages/aeg-core/src/verdict-extraction.ts contains:function firstFiveLines(comment: string): string {
169
456
  return {
170
- value: `the most recent ${missingLabel} comment's VERDICT line is not within its first three lines — DANGLING, see below`,
457
+ value: `the most recent ${missingLabel} comment's VERDICT line is not within its first five lines — DANGLING, see below`,
171
458
  headSha: null,
172
- danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-three-line read window`
459
+ objectivesVersion: null,
460
+ rulingOrdinal: null,
461
+ briefHash: null,
462
+ policyDigest: null,
463
+ baseSha: null,
464
+ findingSeverities: [],
465
+ danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-five-line read window`
173
466
  }
174
467
  }
175
468
 
176
469
  return {
177
470
  value: (m[1] as string).toUpperCase().replace(/[_-]/g, ' '),
178
471
  headSha: extractHeadSha(latest),
472
+ objectivesVersion: extractObjectivesVersion(latest),
473
+ rulingOrdinal: extractRulingOrdinal(latest),
474
+ briefHash: extractBriefHash(latest),
475
+ policyDigest: extractPolicyDigest(latest),
476
+ baseSha: extractBaseSha(latest),
477
+ findingSeverities: extractFindingSeverities(latest),
179
478
  danglingNote: null
180
479
  }
181
480
  }
182
481
 
482
+ /**
483
+ * The line-anchored `VERDICT:` marker prefix both value patterns below open
484
+ * with — exported standalone, unchanged, character for character (a move,
485
+ * not a rewrite; neither pattern below is edited)
486
+ * so a second consumer can build the identical presence-only test without
487
+ * hand-copying a third literal of the same fact. The generated review-gate
488
+ * pre-check job (`apps/cli/src/lib/artifacts.ts`)
489
+ * is that consumer: it runs before any checkout, so it cannot import
490
+ * this module at workflow run time, and instead imports this source string
491
+ * at CLI-generation time to build its own jq `test()` regex.
492
+ */
493
+ export const VERDICT_MARKER_SOURCE = '^[ \\t]*(?:\\*{1,3}|_{1,3})?VERDICT:'
494
+
183
495
  /** `value` is `APPROVE`, `REQUEST CHANGES`, `LGTM`, or a DANGLING placeholder string. */
184
496
  export function extractCodeReviewVerdict(comments: string[]): VerdictExtraction {
185
497
  return extractVerdict(