@attalabs/vinaya 0.36.0 → 0.38.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 (292) hide show
  1. package/README.md +6 -6
  2. package/aeg-root/contracts/developer-reviewer.md +1 -1
  3. package/aeg-root/contracts/planner-operator.md +1 -1
  4. package/aeg-root/contracts/principal-operator.md +6 -6
  5. package/aeg-root/contracts/security-archivist.md +1 -1
  6. package/aeg-root/enforcement.md +14 -14
  7. package/aeg-root/process.md +3 -1
  8. package/aeg-root/roles/archivist.md +2 -2
  9. package/aeg-root/roles/developer/reference.md +36 -37
  10. package/aeg-root/roles/developer.md +9 -5
  11. package/aeg-root/roles/operator.md +18 -18
  12. package/aeg-root/roles/planner/reference.md +15 -4
  13. package/aeg-root/roles/principal.md +6 -1
  14. package/aeg-root/roles/reviewer.md +14 -6
  15. package/aeg-root/roles/security.md +22 -11
  16. package/aeg-root/roles/tranche-archivist.md +14 -2
  17. package/aeg-root/state-machine.md +12 -11
  18. package/aeg-root/templates/brief-template.md +8 -6
  19. package/aeg-root/templates/pr-report-template.md +1 -9
  20. package/aeg-root/tranche-model.md +10 -4
  21. package/dist/checks/bin/check-body-bare-digits.js +823 -595
  22. package/dist/checks/bin/check-branch-topology.js +796 -478
  23. package/dist/checks/bin/check-brief-shape.js +824 -596
  24. package/dist/checks/bin/check-changeset-coverage.js +1337 -747
  25. package/dist/checks/bin/check-closes-n.js +796 -478
  26. package/dist/checks/bin/check-coherence.js +914 -611
  27. package/dist/checks/bin/check-dead-branch-push.js +705 -462
  28. package/dist/checks/bin/check-dispatch-readiness.js +941 -624
  29. package/dist/checks/bin/check-doc-coverage-push.js +1332 -742
  30. package/dist/checks/bin/check-doc-coverage.js +1339 -742
  31. package/dist/checks/bin/check-doctrine-no-procedures.js +821 -593
  32. package/dist/checks/bin/check-doctrine-portability.js +1332 -742
  33. package/dist/checks/bin/check-evidence-fresh.js +1339 -918
  34. package/dist/checks/bin/check-exec-bits.js +1331 -741
  35. package/dist/checks/bin/check-first-push-dispatch.js +917 -614
  36. package/dist/checks/bin/check-issue-assignment.js +796 -478
  37. package/dist/checks/bin/check-issue-milestone-attach.js +705 -462
  38. package/dist/checks/bin/check-issue-objectives-numbering.js +821 -593
  39. package/dist/checks/bin/check-issue-parts-coverage.js +705 -462
  40. package/dist/checks/bin/check-issue-surface-globs.js +925 -613
  41. package/dist/checks/bin/check-issue-title-grammar.js +705 -462
  42. package/dist/checks/bin/check-issue-tranche-label.js +705 -462
  43. package/dist/checks/bin/check-main-branch-refusal.js +705 -462
  44. package/dist/checks/bin/check-no-disk-state.js +705 -462
  45. package/dist/checks/bin/check-pr-premise-reassert.js +821 -593
  46. package/dist/checks/bin/check-pr-report-density.js +705 -462
  47. package/dist/checks/bin/check-principal-test-plan-wait.js +705 -462
  48. package/dist/checks/bin/check-quoted-command.js +1816 -1228
  49. package/dist/checks/bin/check-reader-resolvable-prose.js +1835 -1235
  50. package/dist/checks/bin/check-registry-gates.js +993 -526
  51. package/dist/checks/bin/check-retired-vocabulary.js +1810 -1222
  52. package/dist/checks/bin/check-review-gate.js +832 -604
  53. package/dist/checks/bin/check-single-plan-pr.js +705 -462
  54. package/dist/checks/bin/check-surface-scope.js +796 -478
  55. package/dist/checks/bin/check-test-plan.js +705 -462
  56. package/dist/checks/bin/check-token-collection-wired.js +705 -462
  57. package/dist/checks/bin/check-workspace-escape.js +1332 -742
  58. package/dist/checks/bin/verify-dispatch.js +3849 -0
  59. package/dist/index.js +20876 -10091
  60. package/dist/lib/pre-push-cache-test-run.js +1045 -682
  61. package/dist/lib/pre-push-changed-files.js +16 -11
  62. package/dist/lib/pre-push-select-tests.js +785 -500
  63. package/package.json +2 -2
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +7 -6
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +71 -15
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +51 -12
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +1 -0
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +31 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +50 -2
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +443 -28
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +18 -5
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +6 -4
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +13 -13
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +46 -110
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +169 -11
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +3 -1
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +30 -0
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -2
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +0 -1
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +82 -8
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +754 -7
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +24 -6
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/custom.ts +157 -0
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +44 -6
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/executions.ts +493 -0
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/fact-sheets.ts +111 -0
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/generator.ts +155 -0
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/index.ts +12 -0
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +128 -0
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/catches.ts +63 -0
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/checks.ts +146 -0
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/common.ts +137 -0
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/completion.ts +137 -0
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/convergence.ts +420 -0
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/determinism.ts +65 -0
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/index.ts +69 -0
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/judgment.ts +132 -0
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/labels.ts +21 -0
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/time.ts +167 -0
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/usage.ts +139 -0
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +226 -15
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +7 -7
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/cache-contract.ts +207 -0
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/contracts.ts +105 -0
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/engine.ts +308 -0
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/index.ts +34 -0
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/measured.ts +20 -0
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/memory-cache.ts +78 -0
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/normalize.ts +156 -0
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/row.ts +103 -0
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +34 -6
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +70 -6
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +19 -14
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +201 -24
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +5 -2
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +46 -0
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +15 -28
  120. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
  122. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  123. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  124. package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
  125. package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/044u_vinaya-studio_web_src_app_studio_backlog__components_BacklogTable_tsx_0oha0bt._.js +3 -0
  174. 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
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1bh2awk._.js → [root-of-the-server]__038scsm._.js} +2 -2
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1widio3._.js → [root-of-the-server]__03__s45._.js} +2 -2
  177. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
  180. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0h9yhwx._.js +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wy7w66._.js → [root-of-the-server]__0jdjsxe._.js} +2 -2
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
  184. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13znegp._.js → [root-of-the-server]__134x-65._.js} +2 -2
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13eeix2._.js → [root-of-the-server]__1_l_l1u._.js} +2 -2
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1dky4g0._.js → [root-of-the-server]__1my83lt._.js} +2 -2
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__040smoa._.js → [root-of-the-server]__1qpc6at._.js} +2 -2
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
  193. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
  199. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  200. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  201. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  202. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  204. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
  205. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
  206. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
  207. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
  208. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
  209. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_17dho0f._.js +3 -0
  210. 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
  211. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
  212. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
  213. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
  214. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  215. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  216. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  217. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  218. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
  219. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
  220. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
  221. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1-acpmtfmrc35.js +1 -0
  222. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
  223. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
  224. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
  225. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
  226. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2o9l0b7eqbr57.js → 2f2y8xxok8zph.js} +1 -1
  227. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
  228. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
  229. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
  230. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
  231. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3lqjwjrcvq481.js → 2xevgia1h8g0y.js} +2 -2
  232. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
  233. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
  234. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
  235. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  236. package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
  237. package/dist/checks/bin/check-token-report.js +0 -6526
  238. 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/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/bin/verify-coherence.ts +0 -1089
  239. package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
  240. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
  241. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
  242. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
  243. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
  244. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
  245. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
  246. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
  247. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
  248. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
  249. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
  250. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
  251. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
  252. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
  253. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
  254. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
  255. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
  256. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
  257. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
  258. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
  259. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
  260. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
  261. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
  262. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
  263. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
  264. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
  265. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
  266. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
  267. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
  268. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
  269. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
  270. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
  271. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
  272. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
  273. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/00z3-ljjd1gj9.js +0 -1
  274. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
  275. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
  276. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
  277. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
  278. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
  279. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
  280. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
  281. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
  282. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
  283. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
  284. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
  285. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
  286. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
  287. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
  288. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
  289. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
  290. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_buildManifest.js +0 -0
  291. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_clientMiddlewareManifest.js +0 -0
  292. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_ssgManifest.js +0 -0
@@ -0,0 +1,156 @@
1
+ /**
2
+ * The one normaliser: a stored log line in, exactly one dataset row or
3
+ * exactly one quarantine record out (`apps/cli/specs/log-sync.md`).
4
+ * Validation, schema-version handling and redaction are
5
+ * `classifyStoredLine`'s; this module only maps its three outcomes, and
6
+ * applies the same `redact` to a quarantined line's raw text, which the
7
+ * classifier keeps verbatim. Pure —
8
+ * `node:crypto` is the one import outside this package.
9
+ */
10
+
11
+ import { createHash } from 'node:crypto'
12
+ import type { Provenance } from '../schema'
13
+ import { redact } from '../redact'
14
+ import { classifyStoredLine } from '../store'
15
+ import {
16
+ type DatasetRow,
17
+ type JsonObject,
18
+ LOW_TRUST_BELOW_VERSION,
19
+ type NormalizedLine,
20
+ type RowOrigin,
21
+ type RowTrust,
22
+ type UnknownableField
23
+ } from './row'
24
+
25
+ function sha256(text: string): string {
26
+ return createHash('sha256').update(text).digest('hex')
27
+ }
28
+
29
+ function asObject(value: unknown): JsonObject {
30
+ return value !== null && typeof value === 'object' ? (value as JsonObject) : {}
31
+ }
32
+
33
+ function has(obj: JsonObject, key: string): boolean {
34
+ return Object.hasOwn(obj, key)
35
+ }
36
+
37
+ function stringOrNull(value: unknown): string | null {
38
+ return typeof value === 'string' ? value : null
39
+ }
40
+
41
+ function integerOrNull(value: unknown): number | null {
42
+ return typeof value === 'number' && Number.isInteger(value) ? value : null
43
+ }
44
+
45
+ const VERSION_PATTERN = /^v?(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/
46
+
47
+ type ParsedVersion = { core: [number, number, number]; prerelease: boolean }
48
+
49
+ function parseVersion(text: string): ParsedVersion | null {
50
+ const match = VERSION_PATTERN.exec(text.trim())
51
+ if (match === null) return null
52
+ return { core: [Number(match[1]), Number(match[2]), Number(match[3])], prerelease: match[4] !== undefined }
53
+ }
54
+
55
+ /** `true` when `version` names no readable CLI version, or one below `LOW_TRUST_BELOW_VERSION` (a pre-release of the threshold itself counts as below it). */
56
+ export function isLowTrustVersion(version: string): boolean {
57
+ const parsed = parseVersion(version)
58
+ const floor = parseVersion(LOW_TRUST_BELOW_VERSION) as ParsedVersion
59
+ if (parsed === null) return true
60
+ for (let i = 0; i < 3; i++) {
61
+ const a = parsed.core[i] as number
62
+ const b = floor.core[i] as number
63
+ if (a !== b) return a < b
64
+ }
65
+ return parsed.prerelease
66
+ }
67
+
68
+ /**
69
+ * Normalises one stored line. `origin` records where it was read from and
70
+ * is carried on the result unchanged — it never feeds the identity or the
71
+ * content hash.
72
+ */
73
+ export function normalizeStoredLine(raw: string, origin: RowOrigin | null = null): NormalizedLine {
74
+ const classified = classifyStoredLine(raw, '')
75
+ if (classified.status !== 'ok') {
76
+ const raw = redact(classified.raw, '')
77
+ return {
78
+ type: 'quarantine',
79
+ record: {
80
+ status: classified.status,
81
+ identity: classified.identity,
82
+ schema: classified.status === 'unknown_version' ? classified.schema : null,
83
+ reason: classified.reason,
84
+ raw,
85
+ contentHash: sha256(raw),
86
+ origin
87
+ }
88
+ }
89
+ }
90
+
91
+ const stored = asObject(JSON.parse(classified.postLine))
92
+ const meta = asObject(stored.meta)
93
+ const subject = asObject(stored.subject)
94
+ const schema = classified.schema
95
+ const unknown: Partial<Record<UnknownableField, string>> = {}
96
+ const missing = (field: UnknownableField, headerField: string): null => {
97
+ unknown[field] = `a schema ${schema} header has no ${headerField}`
98
+ return null
99
+ }
100
+
101
+ const work = asObject(meta.work)
102
+ const flow = asObject(meta.flow)
103
+ const workRef = has(meta, 'work') ? stringOrNull(work.ref) : missing('workRef', 'work.ref')
104
+ const actor = has(meta, 'actor_id') ? stringOrNull(meta.actor_id) : missing('actor', 'actor_id')
105
+ const flowId = has(meta, 'flow') ? stringOrNull(flow.id) : missing('flowId', 'flow.id')
106
+ const flowVersion = has(meta, 'flow') ? stringOrNull(flow.version) : missing('flowVersion', 'flow.version')
107
+ const provenance = has(meta, 'provenance')
108
+ ? (stringOrNull(meta.provenance) as Provenance | null)
109
+ : missing('provenance', 'provenance')
110
+
111
+ const cliVersion = typeof meta.vinaya === 'string' ? meta.vinaya : ''
112
+ let trust: RowTrust | null
113
+ if (isLowTrustVersion(cliVersion)) trust = 'low'
114
+ else if (provenance !== null) trust = provenance
115
+ else {
116
+ trust = null
117
+ unknown.trust = `a schema ${schema} header declares no provenance`
118
+ }
119
+
120
+ const payload: Record<string, unknown> = {}
121
+ for (const [key, value] of Object.entries(stored)) {
122
+ if (key !== 'meta' && key !== 'subject' && key !== 'kind' && key !== 'event') payload[key] = value
123
+ }
124
+
125
+ const row: DatasetRow = {
126
+ identity: classified.identity,
127
+ schema,
128
+ kind: String(stored.kind),
129
+ event: String(stored.event),
130
+ time: String(meta.ts),
131
+ runId: classified.runId,
132
+ seq: classified.seq,
133
+ workRef,
134
+ actor,
135
+ cliVersion,
136
+ doctrine: String(meta.doctrine),
137
+ flowId,
138
+ flowVersion,
139
+ host: String(meta.host),
140
+ repo: stringOrNull(meta.repo),
141
+ provenance,
142
+ trust,
143
+ issue: integerOrNull(subject.issue),
144
+ pr: integerOrNull(subject.pr),
145
+ round: integerOrNull(subject.round),
146
+ commit: stringOrNull(subject.sha),
147
+ role: String(subject.role),
148
+ objectivesVersion: stringOrNull(subject.objectives_version),
149
+ header: { meta, subject },
150
+ payload,
151
+ contentHash: sha256(classified.postLine),
152
+ origin,
153
+ unknown
154
+ }
155
+ return { type: 'row', row }
156
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The normalised shape every reader of the Vinaya Log shares
3
+ * (`apps/cli/specs/log-sync.md`): one dataset row per stored line that
4
+ * validated, one quarantine record per line that did not. A row keeps the
5
+ * fields a question filters or groups by as columns and the rest of the
6
+ * event as JSON, so a family added later — a consumer's own declared event
7
+ * included — is stored and read back without a code change here.
8
+ *
9
+ * Nothing in this module names an event kind or an event name: `kind` and
10
+ * `event` are plain text, and the family body is an untyped JSON object.
11
+ */
12
+
13
+ import type { Provenance } from '../schema'
14
+
15
+ /** Where a line was read from: the source's stable id and the line's opaque position inside it. Provenance only — never part of a row's identity, since two sources can hold the same event. */
16
+ export type RowOrigin = {
17
+ source: string
18
+ position: string
19
+ }
20
+
21
+ /**
22
+ * How far a row's attribution can be trusted. `'low'` for a line written by
23
+ * a CLI older than `LOW_TRUST_BELOW_VERSION`, or naming no readable CLI
24
+ * version; otherwise the provenance the line's own header declares.
25
+ */
26
+ export type RowTrust = 'low' | Provenance
27
+
28
+ /** A JSON object as parsed from a stored line — a row's header or family body. */
29
+ export type JsonObject = { readonly [key: string]: unknown }
30
+
31
+ /** The row columns that can read as unknown: each one a field some schema version's header does not have. */
32
+ export type UnknownableField = 'workRef' | 'actor' | 'flowId' | 'flowVersion' | 'provenance' | 'trust'
33
+
34
+ /** One stored line that fully validated, normalised. */
35
+ export type DatasetRow = {
36
+ /** The line's stable identity: its `event_id`, or `<run_id>:<seq>` for a schema 1 line. */
37
+ identity: string
38
+ schema: number
39
+ kind: string
40
+ event: string
41
+ /** `meta.ts` as written. */
42
+ time: string
43
+ runId: string
44
+ seq: number
45
+ /** `meta.work.ref` — schema 3 onward; unknown before. */
46
+ workRef: string | null
47
+ /** `meta.actor_id` — schema 2 onward; unknown before. */
48
+ actor: string | null
49
+ /** `meta.vinaya`, the CLI version that wrote the line. */
50
+ cliVersion: string
51
+ doctrine: string
52
+ /** `meta.flow.id` / `meta.flow.version` — schema 3 onward; unknown before. */
53
+ flowId: string | null
54
+ flowVersion: string | null
55
+ host: string
56
+ repo: string | null
57
+ /** `meta.provenance` — schema 2 onward; unknown before. */
58
+ provenance: Provenance | null
59
+ /** `'low'` or the declared provenance; unknown when neither applies (a schema 1 line from a trusted CLI version). */
60
+ trust: RowTrust | null
61
+ issue: number | null
62
+ pr: number | null
63
+ round: number | null
64
+ /** `subject.sha`. */
65
+ commit: string | null
66
+ role: string
67
+ objectivesVersion: string | null
68
+ /** The line's `meta` and `subject` exactly as validated — every header field, including the ones with no column. */
69
+ header: { meta: JsonObject; subject: JsonObject }
70
+ /** Every field of the event outside `meta`, `subject`, `kind` and `event` — the family body, as JSON. */
71
+ payload: JsonObject
72
+ /** sha256 (hex) of the line as the read boundary serialises it after redaction. */
73
+ contentHash: string
74
+ origin: RowOrigin | null
75
+ /**
76
+ * Each column whose value the line's schema cannot state, with the reason.
77
+ * A column named here is `null` and means "not recorded", never "none" —
78
+ * a column absent from this map carries the line's own value, `null`
79
+ * included.
80
+ */
81
+ unknown: Readonly<Partial<Record<UnknownableField, string>>>
82
+ }
83
+
84
+ /** One stored line that did not validate: an unknown schema version, or a known one that failed validation. It produces no row. */
85
+ export type QuarantineRecord = {
86
+ status: 'unknown_version' | 'invalid'
87
+ /** The line's identity when one could be read from it, else `null`. */
88
+ identity: string | null
89
+ /** `meta.schema` when readable, else `null`. */
90
+ schema: number | null
91
+ reason: string
92
+ /** The line's text after redaction — a secret in a line that failed validation never reaches a cache. */
93
+ raw: string
94
+ /** sha256 (hex) of `raw` — what keys a quarantine record, since `identity` can be absent. */
95
+ contentHash: string
96
+ origin: RowOrigin | null
97
+ }
98
+
99
+ /** A stored line after normalisation: exactly one row or exactly one quarantine record. */
100
+ export type NormalizedLine = { type: 'row'; row: DatasetRow } | { type: 'quarantine'; record: QuarantineRecord }
101
+
102
+ /** A line written by a CLI version below this one is low-trust: attribution before it was not recorded reliably. */
103
+ export const LOW_TRUST_BELOW_VERSION = '0.33.0'
@@ -295,18 +295,34 @@ export function legacySlugPattern(legacySlugs: readonly string[]): RegExp | null
295
295
  * `PRODUCT_SLUG_SCOPE`) is checked only against `TRANCHE_SLUG_VN_PATTERN`,
296
296
  * and its finding is `blocking: true`; every other finding is `blocking: false`.
297
297
  */
298
+ /**
299
+ * The spec class's exemption. The array form lists paths skipped entirely; the
300
+ * object form maps each listed path to the most findings that file may carry —
301
+ * a file above its number fails, at or below it passes, and the number is
302
+ * lowered as the file is rewritten.
303
+ */
304
+ export type SpecGrandfather = readonly string[] | Readonly<Record<string, number>>
305
+
306
+ /** Every listed path in either form, in the order written. */
307
+ export function specGrandfatherPaths(specGrandfather: SpecGrandfather): string[] {
308
+ return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather)
309
+ }
310
+
298
311
  export function checkUnresolvableReferences(
299
312
  files: readonly ProseSourceFile[],
300
313
  readerFacingPrefix: string,
301
314
  readerFacingSuffix: string,
302
315
  legacySlugs: readonly string[] = [],
303
316
  shipsPrefix: string = SHIPS_PREFIX,
304
- specGrandfather: readonly string[] = [],
317
+ specGrandfather: SpecGrandfather = [],
305
318
  specPaths: readonly string[] = DEFAULT_SPEC_PATHS
306
319
  ): ProseFinding[] {
307
320
  const findings: ProseFinding[] = []
308
321
  const legacyPattern = legacySlugPattern(legacySlugs)
309
- const grandfathered = new Set(specGrandfather)
322
+ const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? (specGrandfather as readonly string[]) : [])
323
+ const limits = new Map<string, number>(
324
+ Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather as Readonly<Record<string, number>>)
325
+ )
310
326
  // `group` names the capture holding the actual cited text — the plain
311
327
  // patterns have none (report the whole match), the boundary-checked
312
328
  // legacy-slug pattern reports its group 2 so the boundary chars around it
@@ -343,8 +359,9 @@ export function checkUnresolvableReferences(
343
359
  // is matched against every spec-class file, so it exempts a default path
344
360
  // (a root spec, a decision record) exactly as it exempts a
345
361
  // per-product one — one exemption for the class, not one per path
346
- // source.
347
- if (cls === 'spec' && grandfathered.has(file.path)) continue
362
+ // source. A path listed with a number is not skipped: its findings are
363
+ // counted below and reported only once they exceed that number.
364
+ if (cls === 'spec' && grandfatheredWhole.has(file.path)) continue
348
365
  const blocking = cls === 'product' || cls === 'spec'
349
366
  const scrubbed =
350
367
  cls === 'product' ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content)
@@ -352,6 +369,7 @@ export function checkUnresolvableReferences(
352
369
  // reference pattern set, never the narrower product-code list — plus the
353
370
  // task-number rule that applies to this class alone.
354
371
  const patternsToRun = cls === 'product' ? productPatterns : cls === 'spec' ? specPatterns : patterns
372
+ const fileFindings: ProseFinding[] = []
355
373
  for (const { pattern, what, group } of patternsToRun) {
356
374
  pattern.lastIndex = 0
357
375
  let match: RegExpExecArray | null = pattern.exec(scrubbed)
@@ -366,7 +384,7 @@ export function checkUnresolvableReferences(
366
384
  // one character that can never itself start the cited text, and an
367
385
  // empty boundary (start of file) resolves to offset zero.
368
386
  const citedIndex = match.index + match[0].indexOf(cited)
369
- findings.push({
387
+ fileFindings.push({
370
388
  file: file.path,
371
389
  line: lineAt(scrubbed, citedIndex),
372
390
  message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
@@ -375,6 +393,16 @@ export function checkUnresolvableReferences(
375
393
  match = pattern.exec(scrubbed)
376
394
  }
377
395
  }
396
+ const limit = cls === 'spec' ? limits.get(file.path) : undefined
397
+ if (limit !== undefined) {
398
+ if (fileFindings.length <= limit) continue
399
+ // Every finding of the over-limit file carries the count and the limit,
400
+ // so whichever ones a diff-scoped run prints still name both.
401
+ for (const f of fileFindings) {
402
+ f.message += `; ${file.path} carries ${fileFindings.length} such findings, over its proseGates.specGrandfather limit of ${limit}`
403
+ }
404
+ }
405
+ findings.push(...fileFindings)
378
406
  }
379
407
  return findings
380
408
  }
@@ -637,7 +665,7 @@ export function checkReaderResolvableProse(
637
665
  readerFacingSuffix: string,
638
666
  legacySlugs: readonly string[] = [],
639
667
  shipsPrefix: string = SHIPS_PREFIX,
640
- specGrandfather: readonly string[] = [],
668
+ specGrandfather: SpecGrandfather = [],
641
669
  specPaths: readonly string[] = DEFAULT_SPEC_PATHS
642
670
  ): ProseFinding[] {
643
671
  return [
@@ -22,6 +22,7 @@
22
22
  * (`'fail'` on any violation).
23
23
  */
24
24
 
25
+ import { extractCitedPaths } from './doctrine-portability'
25
26
  import { GATE_AUDIENCE, isShipped, NON_GATE_BINS } from './gate-audience'
26
27
  import type { GateRow } from './registry-parse'
27
28
 
@@ -39,14 +40,76 @@ export type RegistryCheckResult = {
39
40
  findings: RegistryFinding[]
40
41
  }
41
42
 
43
+ /** The hook directories a doctrine citation may name a script under. */
44
+ const HOOK_DIR_PREFIXES: readonly string[] = ['.claude/hooks/', '.vinaya/hooks/', '.husky/', '.git/hooks/']
45
+
46
+ /** A bare hook-script name — `check-*.sh` — cited with no directory. */
47
+ const BARE_HOOK_NAME = /^check-[A-Za-z0-9_.-]*\.sh$/
48
+
49
+ /** One doctrine file's path and text, read by the caller. */
50
+ export type HookScanFile = { path: string; content: string }
51
+
52
+ /** What G1's hook-reference half needs from its caller: the doctrine files to
53
+ * scan, and every hook path that counts as shipped (tracked in git, or emitted
54
+ * by `vinaya init`). */
55
+ export type HookReferenceInput = { docs: HookScanFile[]; shipped: ReadonlySet<string> }
56
+
57
+ function basename(path: string): string {
58
+ return path.slice(path.lastIndexOf('/') + 1)
59
+ }
60
+
61
+ function lineOf(content: string, index: number): number {
62
+ let line = 1
63
+ for (let i = 0; i < index; i++) if (content.charCodeAt(i) === 10) line++
64
+ return line
65
+ }
66
+
67
+ /**
68
+ * Every inline-code token in `docs` that names a hook script that is not in
69
+ * `shipped`: a full path under a hook directory (`.claude/hooks/`,
70
+ * `.vinaya/hooks/`, `.husky/`, `.git/hooks/`), or a bare `check-*.sh` name that
71
+ * matches the basename of no shipped path. A directory or glob token
72
+ * (`.husky/`, `.husky/*`) names no single script and is never a finding.
73
+ */
74
+ export function findUnshippedHookRefs(docs: HookScanFile[], shipped: ReadonlySet<string>): RegistryFinding[] {
75
+ const shippedNames = new Set([...shipped].map(basename))
76
+ const findings: RegistryFinding[] = []
77
+ const flag = (doc: HookScanFile, token: string, index: number): void => {
78
+ findings.push({
79
+ path: doc.path,
80
+ reason: `${doc.path}:${lineOf(doc.content, index)} names hook "${token}", which is neither tracked in git nor emitted by \`vinaya init\``
81
+ })
82
+ }
83
+ for (const doc of docs) {
84
+ for (const { cited, index } of extractCitedPaths(doc.content)) {
85
+ if (cited.endsWith('/') || !HOOK_DIR_PREFIXES.some((p) => cited.startsWith(p))) continue
86
+ if (!shipped.has(cited)) flag(doc, cited, index)
87
+ }
88
+ const spanPattern = /`([^`\n]+)`/g
89
+ let match: RegExpExecArray | null = spanPattern.exec(doc.content)
90
+ while (match !== null) {
91
+ const token = match[1] ?? ''
92
+ if (BARE_HOOK_NAME.test(token) && !shippedNames.has(token)) flag(doc, token, match.index)
93
+ match = spanPattern.exec(doc.content)
94
+ }
95
+ }
96
+ return findings
97
+ }
98
+
42
99
  /**
43
- * G1 — every row's non-empty `implementation` resolves on disk. Blocking as
44
- * of task 8 (re-graded from report-only: eleven permanent `info` findings on
45
- * every run had become indistinguishable from silence, which is how the gap
46
- * this tranche closes stayed invisible; the report-only window had already
47
- * cleared the backlog it existed to surface).
100
+ * G1 — every row's non-empty `implementation` resolves on disk, and — when the
101
+ * caller supplies `hookRefs` — every hook script the doctrine names is shipped
102
+ * (`findUnshippedHookRefs`). Blocking as of task 8 (re-graded from
103
+ * report-only: eleven permanent `info` findings on every run had become
104
+ * indistinguishable from silence, which is how the gap this tranche closes
105
+ * stayed invisible; the report-only window had already cleared the backlog it
106
+ * existed to surface).
48
107
  */
49
- export function checkG1(rows: GateRow[], existsFn: (path: string) => boolean): RegistryCheckResult {
108
+ export function checkG1(
109
+ rows: GateRow[],
110
+ existsFn: (path: string) => boolean,
111
+ hookRefs?: HookReferenceInput
112
+ ): RegistryCheckResult {
50
113
  const findings: RegistryFinding[] = []
51
114
  for (const row of rows) {
52
115
  if (row.implementation === '') continue
@@ -58,6 +121,7 @@ export function checkG1(rows: GateRow[], existsFn: (path: string) => boolean): R
58
121
  })
59
122
  }
60
123
  }
124
+ if (hookRefs) findings.push(...findUnshippedHookRefs(hookRefs.docs, hookRefs.shipped))
61
125
  return { check: 'G1', status: findings.length > 0 ? 'fail' : 'pass', findings }
62
126
  }
63
127
 
@@ -78,8 +78,12 @@ import { extractCodeReviewVerdict, extractSecurityReviewVerdict } from './verdic
78
78
  import {
79
79
  consequentialFindings,
80
80
  DEFAULT_REVIEW_POLICY,
81
+ DEFERRAL_REASON_TEXT,
82
+ type DeferredFinding,
81
83
  evaluateCodeReview,
82
84
  evaluateSecurityReview,
85
+ type FindingDeferralContext,
86
+ type PolicyFinding,
83
87
  type ReviewPolicy
84
88
  } from './review-policy'
85
89
  import {
@@ -225,6 +229,32 @@ export type ReviewGateInput = {
225
229
  * see `compareManifest`'s own base rule.
226
230
  */
227
231
  baseSha?: string | null
232
+ /**
233
+ * O2/O3: the round's deferral rules, the SAME `FindingDeferralContext`
234
+ * `classifyFinding` reads — resolved by the CALLER (this module stays pure,
235
+ * no `git`, no glob, no forge read). The CI adapter builds it from the
236
+ * previous round's head recovered off the loop's own published round markers
237
+ * (the changed-line diff) and the task's `## Surface`. Optional, and its
238
+ * absence is deliberately the fail-closed default the brief's own trap
239
+ * names: with no context every in-Surface finding blocks exactly as it did
240
+ * before this task — a gate that could not recover a previous round's head,
241
+ * or a caller predating this field, never guesses a deferral. A supplied
242
+ * context sets aside the findings the round could not act on and names each
243
+ * in the gate's own output (O4).
244
+ */
245
+ deferralContext?: FindingDeferralContext
246
+ }
247
+
248
+ /** O4: one deferred finding as the gate's output names it — its original severity, its `file:line`, and why it was set aside, worded through the shared `DEFERRAL_REASON_TEXT`. */
249
+ function renderGateDeferred(deferred: readonly DeferredFinding<PolicyFinding>[]): string {
250
+ if (deferred.length === 0) return ''
251
+ const items = deferred
252
+ .map((d) => {
253
+ const where = d.finding.location && d.finding.location.length > 0 ? d.finding.location : '(no location)'
254
+ return `${d.finding.severity} ${where} (${DEFERRAL_REASON_TEXT[d.reason]})`
255
+ })
256
+ .join('; ')
257
+ return ` ${deferred.length} finding(s) deferred, not blocking this round: ${items}.`
228
258
  }
229
259
 
230
260
  /**
@@ -329,8 +359,18 @@ export function checkReviewGate(input: ReviewGateInput): ReviewGateResult {
329
359
  let codeReviewPolicyEvaluation: ReturnType<typeof evaluateCodeReview>
330
360
  let securityPolicyEvaluation: ReturnType<typeof evaluateSecurityReview>
331
361
  try {
332
- codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy)
333
- securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy)
362
+ // O2/O3: the deferral context threads through unchanged when omitted — the
363
+ // evaluation is then the plain prose-capped threshold check it was.
364
+ codeReviewPolicyEvaluation = evaluateCodeReview(
365
+ consequentialFindings(codeReview.findingSeverities),
366
+ policy,
367
+ input.deferralContext
368
+ )
369
+ securityPolicyEvaluation = evaluateSecurityReview(
370
+ consequentialFindings(security.findingSeverities),
371
+ policy,
372
+ input.deferralContext
373
+ )
334
374
  } catch (err) {
335
375
  return {
336
376
  verdict: 'fail',
@@ -386,10 +426,18 @@ export function checkReviewGate(input: ReviewGateInput): ReviewGateResult {
386
426
  const codeReviewRulingsBound = codeReviewBinding.rulingOrdinal
387
427
  const securityRulingsBound = securityBinding.rulingOrdinal
388
428
 
429
+ // O4: every finding the deferral rules set aside this round, named in the
430
+ // gate's own output whether it passes or fails — the deferred blockers are
431
+ // exactly why an APPROVE beside them is still clean.
432
+ const deferredNote = renderGateDeferred([
433
+ ...codeReviewPolicyEvaluation.deferredFindings,
434
+ ...securityPolicyEvaluation.deferredFindings
435
+ ])
436
+
389
437
  if (codeReviewClean && codeReviewBinding.bound && securityClean && securityBinding.bound) {
390
438
  return {
391
439
  verdict: 'pass',
392
- reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}.`,
440
+ reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}.${deferredNote}`,
393
441
  waived: false
394
442
  }
395
443
  }
@@ -464,7 +512,7 @@ export function checkReviewGate(input: ReviewGateInput): ReviewGateResult {
464
512
 
465
513
  return {
466
514
  verdict: 'fail',
467
- reason: `${problems.join('; ')}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s).${ignoredNote}`,
515
+ reason: `${problems.join('; ')}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s).${ignoredNote}${deferredNote}`,
468
516
  waived: false
469
517
  }
470
518
  }
@@ -60,27 +60,32 @@ export function briefHash(brief: string): string {
60
60
  }
61
61
 
62
62
  /**
63
- * `sha256` of the effective review policy — one canonical field order
64
- * (`codeReviewThreshold`, `securityThreshold`, then `maxRounds`) so two
65
- * callers resolving the identical `ReviewPolicy` value always agree on its
66
- * digest regardless of how they built the object literal.
63
+ * `sha256` of the two review-policy settings that decide whether a verdict's
64
+ * findings block — `codeReviewThreshold` and `securityThreshold` — in one
65
+ * canonical field order so two callers resolving the identical `ReviewPolicy`
66
+ * value always agree on its digest regardless of how they built the object
67
+ * literal. This is what a verdict binds against: change either threshold and
68
+ * verdicts cast under the old one no longer cover the policy, so the gate
69
+ * demands a fresh round (O2).
67
70
  *
68
- * `maxRounds` — the incoming round-policy field (O1; Traps to avoid: "include the incoming round-policy field in the
69
- * relevant configuration identity") — is part of the digest so the policy
70
- * identity a verdict binds against is the COMPLETE effective policy, not just
71
- * its two severity thresholds. A run whose round cap changed under a verdict
72
- * is a policy change the gate must see, the same as a threshold change. The
73
- * one-time cost is the same fail-closed transition every other field in this
74
- * family already paid: a verdict cast before this field entered the digest
75
- * carries the old digest and needs one fresh review round.
71
+ * `maxRounds` and `maxTaskMinutes` are deliberately LEFT OUT of the digest
72
+ * (O1). They are the loop's own limits — the round cap and the wall-clock
73
+ * budget — and they bound only how long the loop runs, never whether a finding
74
+ * in an already-cast verdict blocks. Folding them in (as this digest once did)
75
+ * meant that merely changing a limit re-computed the digest and re-opened every
76
+ * approved pull request for a fresh review round with no code change — twice in
77
+ * two days, once for removing a `maxRounds` override and once for adding
78
+ * `maxTaskMinutes`. Because the two limits cannot change any verdict's block
79
+ * decision, the digest a verdict binds to covers the blocking thresholds only
80
+ * (a Principal decision). The fields still live on `ReviewPolicy` and the
81
+ * loop still reads them; they are simply not part of this identity.
76
82
  */
77
83
  export function policyDigest(policy: ReviewPolicy): string {
78
84
  return createHash('sha256')
79
85
  .update(
80
86
  JSON.stringify({
81
87
  codeReviewThreshold: policy.codeReviewThreshold,
82
- securityThreshold: policy.securityThreshold,
83
- maxRounds: policy.maxRounds
88
+ securityThreshold: policy.securityThreshold
84
89
  })
85
90
  )
86
91
  .digest('hex')