@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,137 @@
1
+ /**
2
+ * Question 1 — does a cheaper model finish? (`apps/cli/specs/log-sync.md`,
3
+ * "The questions".) For each model, the units of work it was part of and how
4
+ * they ended. The answer is descriptive: it counts what the loop recorded and
5
+ * never says one model caused a better outcome.
6
+ */
7
+
8
+ import { known, unknownBecause } from '../sync'
9
+ import type { Dataset, DatasetRow, Measured } from '../sync'
10
+ import type { Coverage, UnknownFigure } from './common'
11
+ import { buildCoverage, compareText, groupBy, numberField, rowsOfKinds, textField, trustedRows } from './common'
12
+
13
+ /** How many units of work reached green in a given number of rounds. */
14
+ export type RoundsToGreen = { rounds: number; units: number }
15
+
16
+ export type ModelCompletion = {
17
+ model: string
18
+ /** Units of work in which a dispatch or role attempt names this model. A unit that used two models counts under both. */
19
+ started: number
20
+ /** Of those, units whose loop recorded the green stop condition. */
21
+ green: number
22
+ /** Of those, units whose loop paused at least once. A unit can be both paused and green. */
23
+ paused: number
24
+ /** Of those, units whose loop recorded the escalated stop condition. */
25
+ escalated: number
26
+ /** The round each green unit went green in, counted, ascending by rounds. */
27
+ roundsToGreen: RoundsToGreen[]
28
+ /** The loop's own time to green for each green unit that recorded one, ascending. Unknown when no green unit did. */
29
+ timeToGreenMs: Measured<number[]>
30
+ }
31
+
32
+ export type CompletionAnswer = {
33
+ /** Ascending by model name. */
34
+ models: ModelCompletion[]
35
+ coverage: Coverage
36
+ }
37
+
38
+ const COMPLETION_KINDS = ['dispatch', 'role_attempt', 'dev_review_loop']
39
+
40
+ type UnitFacts = {
41
+ models: Set<string>
42
+ greenRound: number | null
43
+ green: boolean
44
+ paused: boolean
45
+ escalated: boolean
46
+ timeToGreenMs: number | null
47
+ }
48
+
49
+ function factsOf(rows: readonly DatasetRow[]): UnitFacts {
50
+ const facts: UnitFacts = {
51
+ models: new Set(),
52
+ green: false,
53
+ greenRound: null,
54
+ paused: false,
55
+ escalated: false,
56
+ timeToGreenMs: null
57
+ }
58
+ for (const row of rows) {
59
+ if (row.kind === 'dispatch' || row.kind === 'role_attempt') {
60
+ const model = textField(row, 'model')
61
+ if (model !== null) facts.models.add(model)
62
+ } else if (row.kind === 'dev_review_loop') {
63
+ if (row.event === 'stop_condition_met') {
64
+ const condition = textField(row, 'condition')
65
+ if (condition === 'green') {
66
+ facts.green = true
67
+ facts.greenRound = numberField(row, 'round')
68
+ }
69
+ if (condition === 'escalated') facts.escalated = true
70
+ } else if (row.event === 'paused') {
71
+ facts.paused = true
72
+ } else if (row.event === 'journal_finalized') {
73
+ // The last journal stands: a loop resumed after a pause finalizes again.
74
+ facts.timeToGreenMs = numberField(row, 'time_to_green_ms')
75
+ }
76
+ }
77
+ }
78
+ return facts
79
+ }
80
+
81
+ /** Question 1: completion, rounds to green and time to green, by model. */
82
+ export function completionByModel(dataset: Dataset): CompletionAnswer {
83
+ const { rows, lowTrust } = trustedRows(dataset)
84
+ const used = rowsOfKinds(rows, COMPLETION_KINDS)
85
+ const unknowns: UnknownFigure[] = []
86
+
87
+ const perModel = new Map<string, { started: number; units: UnitFacts[] }>()
88
+ for (const [unit, unitRows] of groupBy(used.withUnit, (row) => row.workRef)) {
89
+ const facts = factsOf(unitRows)
90
+ if (facts.models.size === 0) {
91
+ unknowns.push({ figure: `unit ${unit}`, reason: 'no dispatch or role attempt of this unit names a model' })
92
+ continue
93
+ }
94
+ for (const model of facts.models) {
95
+ const entry = perModel.get(model) ?? { started: 0, units: [] }
96
+ entry.started++
97
+ entry.units.push(facts)
98
+ perModel.set(model, entry)
99
+ }
100
+ }
101
+
102
+ const models: ModelCompletion[] = [...perModel.keys()].sort(compareText).map((model) => {
103
+ const { started, units } = perModel.get(model) as { started: number; units: UnitFacts[] }
104
+ const greens = units.filter((u) => u.green)
105
+ const rounds = new Map<number, number>()
106
+ for (const u of greens) if (u.greenRound !== null) rounds.set(u.greenRound, (rounds.get(u.greenRound) ?? 0) + 1)
107
+ const samples = greens.flatMap((u) => (u.timeToGreenMs === null ? [] : [u.timeToGreenMs])).sort((a, b) => a - b)
108
+
109
+ let timeToGreenMs: Measured<number[]>
110
+ if (greens.length === 0) {
111
+ timeToGreenMs = unknownBecause('no unit of work finished green')
112
+ } else if (samples.length === 0) {
113
+ timeToGreenMs = unknownBecause('no green unit recorded a time to green')
114
+ } else {
115
+ timeToGreenMs = known(samples)
116
+ if (samples.length < greens.length) {
117
+ unknowns.push({
118
+ figure: `${model}.timeToGreenMs`,
119
+ reason: `${greens.length - samples.length} of ${greens.length} green units recorded no time to green`
120
+ })
121
+ }
122
+ }
123
+ if (!timeToGreenMs.known) unknowns.push({ figure: `${model}.timeToGreenMs`, reason: timeToGreenMs.reason })
124
+
125
+ return {
126
+ model,
127
+ started,
128
+ green: greens.length,
129
+ paused: units.filter((u) => u.paused).length,
130
+ escalated: units.filter((u) => u.escalated).length,
131
+ roundsToGreen: [...rounds.entries()].sort((a, b) => a[0] - b[0]).map(([r, n]) => ({ rounds: r, units: n })),
132
+ timeToGreenMs
133
+ }
134
+ })
135
+
136
+ return { models, coverage: buildCoverage(dataset, lowTrust, used, unknowns) }
137
+ }
@@ -0,0 +1,420 @@
1
+ /**
2
+ * Questions 8, 9 and 10, and the confidence comparison
3
+ * (`apps/cli/specs/log-sync.md`, "The questions") — four queries about how,
4
+ * and under what conditions, a unit of work converges. Each reads the
5
+ * review loop's own records rather than inventing a signal the Log never
6
+ * states.
7
+ *
8
+ * - `recurringFindings` (q8) reads a finding's recurrence from the loop's
9
+ * own `findings_compared` comparison between rounds, never from a
10
+ * finding's identifier alone — an identifier is stable only inside one
11
+ * round's report (`schema.ts`, the finding schema).
12
+ * - `outcomesByInstructionVersion` (q9) groups by the doctrine a line's own
13
+ * header names, reporting outcomes beside it — never a cause.
14
+ * - `changeSizeBands` (q10) bands the converging round's own files changed,
15
+ * reporting a band under the sample floor as insufficient rather than as
16
+ * a figure.
17
+ * - `confidenceVsOutcome` (the confidence comparison) reads the developer's
18
+ * stated confidence from the second round on, beside whether that round's
19
+ * reviewers approved — round one is never asked and never appears.
20
+ *
21
+ * None of the four scores a choice as having caused an outcome; each
22
+ * reports what the loop recorded.
23
+ */
24
+
25
+ import { known, unknownBecause } from '../sync'
26
+ import type { Dataset, DatasetRow, Measured } from '../sync'
27
+ import type { RoundsToGreen } from './completion'
28
+ import {
29
+ booleanField,
30
+ buildCoverage,
31
+ compareText,
32
+ groupBy,
33
+ numberField,
34
+ objectArrayField,
35
+ objectField,
36
+ rowsOfKinds,
37
+ stringArrayField,
38
+ textField,
39
+ textOf,
40
+ trustedRows
41
+ } from './common'
42
+ import type { Coverage, UnknownFigure } from './common'
43
+
44
+ const LOOP_KINDS = ['dev_review_loop']
45
+ const LOOP_AND_DISPATCH_KINDS = ['dev_review_loop', 'dispatch']
46
+
47
+ // ---------------------------------------------------------------------------
48
+ // Question 8 — which findings recur?
49
+
50
+ export type RecurringFinding = {
51
+ unit: string
52
+ round: number
53
+ id: string
54
+ /** The severity `verdicts_read` recorded for this finding at this round. Unknown when that round's `verdicts_read` names no such finding. */
55
+ severity: Measured<string>
56
+ /** The `policy_treatment` recorded alongside it, the same way. A finding carries only a severity and a treatment — any other class reads unknown rather than being invented. */
57
+ treatment: Measured<string>
58
+ }
59
+
60
+ export type RecurringFindingsAnswer = {
61
+ /** Ascending by unit, then round, then id. */
62
+ findings: RecurringFinding[]
63
+ coverage: Coverage
64
+ }
65
+
66
+ /** The findings `verdicts_read` recorded for this unit's rows at `round`, or `[]` when no such line exists. */
67
+ function findingsReadAt(unitRows: readonly DatasetRow[], round: number) {
68
+ const row = unitRows.find((r) => r.event === 'verdicts_read' && numberField(r, 'round') === round)
69
+ return row === undefined ? [] : objectArrayField(row, 'findings')
70
+ }
71
+
72
+ /** Question 8: the finding identities the loop's own round comparison named recurring, with the severity and treatment that round's verdicts read for them. */
73
+ export function recurringFindings(dataset: Dataset): RecurringFindingsAnswer {
74
+ const { rows, lowTrust } = trustedRows(dataset)
75
+ const used = rowsOfKinds(rows, LOOP_KINDS)
76
+ const unknowns: UnknownFigure[] = []
77
+
78
+ const findings: RecurringFinding[] = []
79
+ for (const [unit, unitRows] of groupBy(used.withUnit, (row) => row.workRef)) {
80
+ for (const comparison of unitRows.filter((row) => row.event === 'findings_compared')) {
81
+ const round = numberField(comparison, 'round')
82
+ if (round === null) continue
83
+ const recurring = stringArrayField(comparison, 'recurring')
84
+ if (recurring.length === 0) continue
85
+ const readFindings = findingsReadAt(unitRows, round)
86
+ for (const id of recurring) {
87
+ const entry = readFindings.find((f) => textOf(f, 'id') === id)
88
+ let severity: Measured<string>
89
+ let treatment: Measured<string>
90
+ if (entry === undefined) {
91
+ const reason = `round ${round}'s verdicts_read of unit ${unit} names no finding ${id}`
92
+ severity = unknownBecause(reason)
93
+ treatment = unknownBecause(reason)
94
+ } else {
95
+ const severityValue = textOf(entry, 'severity')
96
+ const treatmentValue = textOf(entry, 'policy_treatment')
97
+ severity =
98
+ severityValue === null
99
+ ? unknownBecause(`finding ${id} at round ${round} of unit ${unit} states no severity`)
100
+ : known(severityValue)
101
+ treatment =
102
+ treatmentValue === null
103
+ ? unknownBecause(`finding ${id} at round ${round} of unit ${unit} states no policy treatment`)
104
+ : known(treatmentValue)
105
+ }
106
+ if (!severity.known) unknowns.push({ figure: `${unit}.${round}.${id}.severity`, reason: severity.reason })
107
+ if (!treatment.known) unknowns.push({ figure: `${unit}.${round}.${id}.treatment`, reason: treatment.reason })
108
+ findings.push({ unit, round, id, severity, treatment })
109
+ }
110
+ }
111
+ }
112
+ findings.sort((a, b) => compareText(a.unit, b.unit) || a.round - b.round || compareText(a.id, b.id))
113
+
114
+ return { findings, coverage: buildCoverage(dataset, lowTrust, used, unknowns) }
115
+ }
116
+
117
+ // ---------------------------------------------------------------------------
118
+ // Question 9 — is the instruction version the problem?
119
+
120
+ export type VersionOutcome = {
121
+ /** The doctrine a unit's own lines name. */
122
+ version: string
123
+ /** The way-of-working versions (`flowVersion`) at least one of this version's units names, ascending; `[]` when none named one. */
124
+ flowVersions: string[]
125
+ /** The units of work behind this figure. */
126
+ units: number
127
+ /** Of those, units whose loop recorded the escalated stop condition. */
128
+ escalated: number
129
+ /** The round each green unit went green in, counted, ascending by rounds. */
130
+ roundsToGreen: RoundsToGreen[]
131
+ /** Objectives a recorded verdict marked unmet, summed across this version's units; unknown when none of them ever recorded a verdict at all. */
132
+ unmetObjectives: Measured<number>
133
+ }
134
+
135
+ export type OutcomesByVersionAnswer = {
136
+ /** Ascending by version. */
137
+ versions: VersionOutcome[]
138
+ coverage: Coverage
139
+ }
140
+
141
+ type VersionUnitFacts = {
142
+ versions: Set<string>
143
+ flowVersions: Set<string>
144
+ greenRound: number | null
145
+ escalated: boolean
146
+ /** One entry per recorded verdict, each the `met` flags its objectives stated. */
147
+ verdictObjectives: boolean[][]
148
+ }
149
+
150
+ function versionFactsOf(rows: readonly DatasetRow[]): VersionUnitFacts {
151
+ const facts: VersionUnitFacts = {
152
+ versions: new Set(),
153
+ flowVersions: new Set(),
154
+ greenRound: null,
155
+ escalated: false,
156
+ verdictObjectives: []
157
+ }
158
+ for (const row of rows) {
159
+ facts.versions.add(row.doctrine)
160
+ if (row.flowVersion !== null) facts.flowVersions.add(row.flowVersion)
161
+ if (row.kind === 'dev_review_loop' && row.event === 'stop_condition_met') {
162
+ const condition = textField(row, 'condition')
163
+ if (condition === 'green') facts.greenRound = numberField(row, 'round')
164
+ if (condition === 'escalated') facts.escalated = true
165
+ } else if (row.kind === 'dispatch' && row.event === 'outcome_received') {
166
+ const outcome = objectField(row, 'outcome')
167
+ if (outcome !== null && outcome.type === 'verdict') {
168
+ const objectives = Array.isArray(outcome.objectives) ? outcome.objectives : []
169
+ facts.verdictObjectives.push(
170
+ objectives
171
+ .filter(
172
+ (o): o is { met: boolean } =>
173
+ typeof o === 'object' && o !== null && typeof (o as { met?: unknown }).met === 'boolean'
174
+ )
175
+ .map((o) => o.met)
176
+ )
177
+ }
178
+ }
179
+ }
180
+ return facts
181
+ }
182
+
183
+ /** Question 9: outcomes, by the instruction version a unit's own lines name. */
184
+ export function outcomesByInstructionVersion(dataset: Dataset): OutcomesByVersionAnswer {
185
+ const { rows, lowTrust } = trustedRows(dataset)
186
+ const used = rowsOfKinds(rows, LOOP_AND_DISPATCH_KINDS)
187
+ const unknowns: UnknownFigure[] = []
188
+
189
+ const perVersion = new Map<string, VersionUnitFacts[]>()
190
+ for (const [, unitRows] of groupBy(used.withUnit, (row) => row.workRef)) {
191
+ const facts = versionFactsOf(unitRows)
192
+ for (const version of facts.versions) {
193
+ const group = perVersion.get(version) ?? []
194
+ group.push(facts)
195
+ perVersion.set(version, group)
196
+ }
197
+ }
198
+
199
+ const versions: VersionOutcome[] = [...perVersion.keys()].sort(compareText).map((version) => {
200
+ const group = perVersion.get(version) as VersionUnitFacts[]
201
+ const flowVersions = new Set<string>()
202
+ for (const facts of group) for (const flowVersion of facts.flowVersions) flowVersions.add(flowVersion)
203
+
204
+ const greens = group.filter((f) => f.greenRound !== null)
205
+ const rounds = new Map<number, number>()
206
+ for (const f of greens) rounds.set(f.greenRound as number, (rounds.get(f.greenRound as number) ?? 0) + 1)
207
+
208
+ const verdicts = group.flatMap((f) => f.verdictObjectives)
209
+ let unmetObjectives: Measured<number>
210
+ if (verdicts.length === 0) {
211
+ const reason = `no verdict was recorded for version ${version}'s units`
212
+ unmetObjectives = unknownBecause(reason)
213
+ unknowns.push({ figure: `${version}.unmetObjectives`, reason })
214
+ } else {
215
+ unmetObjectives = known(verdicts.reduce((sum, objectives) => sum + objectives.filter((met) => !met).length, 0))
216
+ }
217
+
218
+ return {
219
+ version,
220
+ flowVersions: [...flowVersions].sort(compareText),
221
+ units: group.length,
222
+ escalated: group.filter((f) => f.escalated).length,
223
+ roundsToGreen: [...rounds.entries()].sort((a, b) => a[0] - b[0]).map(([r, n]) => ({ rounds: r, units: n })),
224
+ unmetObjectives
225
+ }
226
+ })
227
+
228
+ return { versions, coverage: buildCoverage(dataset, lowTrust, used, unknowns) }
229
+ }
230
+
231
+ // ---------------------------------------------------------------------------
232
+ // Question 10 — what change size converges?
233
+
234
+ /** The fixed size bands (Decisions, reversible): files changed at most 3, 4 to 10, or 11 or more. */
235
+ export type ChangeSizeBand = 'at most 3' | '4 to 10' | '11 or more'
236
+
237
+ const CHANGE_SIZE_BANDS: readonly ChangeSizeBand[] = ['at most 3', '4 to 10', '11 or more']
238
+ /** Five units is the floor for a figure (Decisions, reversible). */
239
+ const SIZE_BAND_FLOOR = 5
240
+
241
+ function bandOf(filesChanged: number): ChangeSizeBand {
242
+ if (filesChanged <= 3) return 'at most 3'
243
+ if (filesChanged <= 10) return '4 to 10'
244
+ return '11 or more'
245
+ }
246
+
247
+ export type SizeBandOutcome =
248
+ | { band: ChangeSizeBand; units: number; sample: 'insufficient' }
249
+ | {
250
+ band: ChangeSizeBand
251
+ units: number
252
+ sample: 'sufficient'
253
+ /** The converging round's own insertions, ascending, one per unit in the band. */
254
+ insertions: number[]
255
+ /** The converging round's own deletions, the same way. */
256
+ deletions: number[]
257
+ roundsToGreen: RoundsToGreen[]
258
+ timeToGreenMs: Measured<number[]>
259
+ }
260
+
261
+ export type ChangeSizeAnswer = {
262
+ /** All three bands, fixed, ascending — `'insufficient'` where the sample is too thin for a figure, never silently dropped. */
263
+ bands: SizeBandOutcome[]
264
+ coverage: Coverage
265
+ }
266
+
267
+ type GreenUnit = {
268
+ round: number
269
+ filesChanged: number
270
+ insertions: number
271
+ deletions: number
272
+ timeToGreenMs: number | null
273
+ }
274
+
275
+ /** This unit's converging round — the `round_ended` line whose own round is the one `stop_condition_met` named green — or `null` when the unit never went green or that round's size was never stated. */
276
+ function greenUnitOf(unitRows: readonly DatasetRow[]): GreenUnit | null {
277
+ const stop = unitRows.find((r) => r.event === 'stop_condition_met' && textField(r, 'condition') === 'green')
278
+ if (stop === undefined) return null
279
+ const round = numberField(stop, 'round')
280
+ if (round === null) return null
281
+ const roundEnded = unitRows.find(
282
+ (r) => r.event === 'round_ended' && numberField(r, 'round') === round && textField(r, 'outcome') === 'green'
283
+ )
284
+ if (roundEnded === undefined) return null
285
+ const filesChanged = numberField(roundEnded, 'files_changed')
286
+ const insertions = numberField(roundEnded, 'insertions')
287
+ const deletions = numberField(roundEnded, 'deletions')
288
+ if (filesChanged === null || insertions === null || deletions === null) return null
289
+ const finalized = unitRows.find((r) => r.event === 'journal_finalized')
290
+ const timeToGreenMs = finalized === undefined ? null : numberField(finalized, 'time_to_green_ms')
291
+ return { round, filesChanged, insertions, deletions, timeToGreenMs }
292
+ }
293
+
294
+ /** Question 10: the converging round's own change size, banded, against the rounds and time it took to get there. */
295
+ export function changeSizeBands(dataset: Dataset): ChangeSizeAnswer {
296
+ const { rows, lowTrust } = trustedRows(dataset)
297
+ const used = rowsOfKinds(rows, LOOP_KINDS)
298
+ const unknowns: UnknownFigure[] = []
299
+
300
+ const greenUnits: GreenUnit[] = []
301
+ for (const [, unitRows] of groupBy(used.withUnit, (row) => row.workRef)) {
302
+ const greenUnit = greenUnitOf(unitRows)
303
+ if (greenUnit !== null) greenUnits.push(greenUnit)
304
+ }
305
+
306
+ const bands: SizeBandOutcome[] = CHANGE_SIZE_BANDS.map((band) => {
307
+ const members = greenUnits.filter((u) => bandOf(u.filesChanged) === band)
308
+ if (members.length < SIZE_BAND_FLOOR) {
309
+ if (members.length > 0)
310
+ unknowns.push({
311
+ figure: band,
312
+ reason: `only ${members.length} unit(s) converged in this band, fewer than the ${SIZE_BAND_FLOOR}-unit floor for a figure`
313
+ })
314
+ return { band, units: members.length, sample: 'insufficient' as const }
315
+ }
316
+
317
+ const rounds = new Map<number, number>()
318
+ for (const m of members) rounds.set(m.round, (rounds.get(m.round) ?? 0) + 1)
319
+ const times = members.flatMap((m) => (m.timeToGreenMs === null ? [] : [m.timeToGreenMs])).sort((a, b) => a - b)
320
+
321
+ let timeToGreenMs: Measured<number[]>
322
+ if (times.length === 0) {
323
+ timeToGreenMs = unknownBecause('no unit in this band recorded a time to green')
324
+ } else {
325
+ timeToGreenMs = known(times)
326
+ if (times.length < members.length)
327
+ unknowns.push({
328
+ figure: `${band}.timeToGreenMs`,
329
+ reason: `${members.length - times.length} of ${members.length} units in this band recorded no time to green`
330
+ })
331
+ }
332
+ if (!timeToGreenMs.known) unknowns.push({ figure: `${band}.timeToGreenMs`, reason: timeToGreenMs.reason })
333
+
334
+ return {
335
+ band,
336
+ units: members.length,
337
+ sample: 'sufficient' as const,
338
+ insertions: members.map((m) => m.insertions).sort((a, b) => a - b),
339
+ deletions: members.map((m) => m.deletions).sort((a, b) => a - b),
340
+ roundsToGreen: [...rounds.entries()].sort((a, b) => a[0] - b[0]).map(([r, n]) => ({ rounds: r, units: n })),
341
+ timeToGreenMs
342
+ }
343
+ })
344
+
345
+ return { bands, coverage: buildCoverage(dataset, lowTrust, used, unknowns) }
346
+ }
347
+
348
+ // ---------------------------------------------------------------------------
349
+ // The confidence comparison — does stated confidence predict review outcome?
350
+
351
+ const MIN_CONFIDENCE_ROUND = 2
352
+ const CONFIDENCE_UNAVAILABLE_REASON = "the developer's confidence was recorded unavailable"
353
+ const NO_CONFIDENCE_REASON = 'no confidence was stated this round'
354
+
355
+ export type ConfidenceOutcome = {
356
+ unit: string
357
+ round: number
358
+ /** The confidence as first stated this round. Unknown when missing or explicitly recorded unavailable. */
359
+ confidenceValue: Measured<number>
360
+ /** Whether the confidence rule's one extra developer turn was spent before this statement. Unknown the same way. */
361
+ extraTurnSpent: Measured<boolean>
362
+ /** Whether this round's reviewers approved. Unknown when this round recorded no verdicts at all. */
363
+ approved: Measured<boolean>
364
+ }
365
+
366
+ export type ConfidenceAnswer = {
367
+ /** Ascending by unit, then round. Round 1 is never asked, so it never appears. */
368
+ rounds: ConfidenceOutcome[]
369
+ coverage: Coverage
370
+ }
371
+
372
+ function confidenceOf(row: DatasetRow): { value: Measured<number>; extraTurnSpent: Measured<boolean> } {
373
+ const value = numberField(row, 'confidence_value')
374
+ const unavailable = booleanField(row, 'confidence_unavailable') === true
375
+ const extraTurnSpent = booleanField(row, 'extra_turn_spent')
376
+ return {
377
+ value:
378
+ value !== null
379
+ ? known(value)
380
+ : unknownBecause(unavailable ? CONFIDENCE_UNAVAILABLE_REASON : NO_CONFIDENCE_REASON),
381
+ extraTurnSpent: extraTurnSpent !== null ? known(extraTurnSpent) : unknownBecause(NO_CONFIDENCE_REASON)
382
+ }
383
+ }
384
+
385
+ /** The confidence comparison: stated confidence against review outcome, by round, from the second round on. */
386
+ export function confidenceVsOutcome(dataset: Dataset): ConfidenceAnswer {
387
+ const { rows, lowTrust } = trustedRows(dataset)
388
+ const used = rowsOfKinds(rows, LOOP_KINDS)
389
+ const unknowns: UnknownFigure[] = []
390
+
391
+ const rounds: ConfidenceOutcome[] = []
392
+ for (const [unit, unitRows] of groupBy(used.withUnit, (row) => row.workRef)) {
393
+ const gateReads = unitRows.filter(
394
+ (row) => row.event === 'gate_result_read' && (numberField(row, 'round') ?? 0) >= MIN_CONFIDENCE_ROUND
395
+ )
396
+ for (const gateRead of gateReads) {
397
+ const round = numberField(gateRead, 'round') as number
398
+ const { value, extraTurnSpent } = confidenceOf(gateRead)
399
+ const verdictsRead = unitRows.find((row) => row.event === 'verdicts_read' && numberField(row, 'round') === round)
400
+ const approved: Measured<boolean> =
401
+ verdictsRead === undefined
402
+ ? unknownBecause(`no verdicts_read recorded for round ${round} of unit ${unit}`)
403
+ : (() => {
404
+ const allApprove = booleanField(verdictsRead, 'all_approve')
405
+ return allApprove === null
406
+ ? unknownBecause(`round ${round}'s verdicts_read of unit ${unit} states no all_approve`)
407
+ : known(allApprove)
408
+ })()
409
+
410
+ if (!value.known) unknowns.push({ figure: `${unit}.${round}.confidenceValue`, reason: value.reason })
411
+ if (!extraTurnSpent.known)
412
+ unknowns.push({ figure: `${unit}.${round}.extraTurnSpent`, reason: extraTurnSpent.reason })
413
+ if (!approved.known) unknowns.push({ figure: `${unit}.${round}.approved`, reason: approved.reason })
414
+ rounds.push({ unit, round, confidenceValue: value, extraTurnSpent, approved })
415
+ }
416
+ }
417
+ rounds.sort((a, b) => compareText(a.unit, b.unit) || a.round - b.round)
418
+
419
+ return { rounds, coverage: buildCoverage(dataset, lowTrust, used, unknowns) }
420
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Question 7 — are checks deterministic? (`apps/cli/specs/log-sync.md`,
3
+ * "The questions".) As far as this data can ever say: a run records a
4
+ * passing check only in its `summary` line, never a `checked` line
5
+ * (`apps/cli/specs/log-sync.md`, the `gate` schema's own comment), so a pass
6
+ * and a fail of the same input can never be seen together and determinism
7
+ * cannot be established from the Log alone — this query reports that as
8
+ * unknown, with the reason, rather than guessing from the failures alone.
9
+ * What it can state: every failing check, by its check version, input
10
+ * fingerprint and commit. A fingerprint hashes a check's environment and
11
+ * changed files, not file contents, so the same fingerprint failing at two
12
+ * different commits is never, by itself, evidence of non-determinism. A
13
+ * failure with no commit recorded is unknown, never treated as deterministic
14
+ * or not.
15
+ */
16
+
17
+ import { unknownBecause } from '../sync'
18
+ import type { Dataset, Measured } from '../sync'
19
+ import type { Coverage, UnknownFigure } from './common'
20
+ import { buildCoverage, compareText, rowsOfKinds, textField, trustedRows } from './common'
21
+
22
+ const DETERMINISM_KINDS = ['gate']
23
+
24
+ const NO_COMMIT_REASON = 'no commit recorded for this event'
25
+ const DETERMINISM_REASON =
26
+ 'a passing check is recorded only in a run summary, so a pass and a fail of the same input cannot be seen together'
27
+
28
+ export type FailureRecord = {
29
+ check: string
30
+ checkVersion: string | null
31
+ inputFingerprint: string | null
32
+ commit: Measured<string>
33
+ }
34
+
35
+ export type DeterminismAnswer = {
36
+ /** Every check failure the dataset recorded, ascending by check, then time. */
37
+ failures: FailureRecord[]
38
+ /** Always unknown: the Log never holds a pass and a fail of the same input together. */
39
+ determinism: Measured<never>
40
+ coverage: Coverage
41
+ }
42
+
43
+ /** Question 7: the failing checks, by check version, input fingerprint and commit — determinism itself stays unknown. */
44
+ export function determinism(dataset: Dataset): DeterminismAnswer {
45
+ const { rows, lowTrust } = trustedRows(dataset)
46
+ const used = rowsOfKinds(rows, DETERMINISM_KINDS)
47
+ const unknowns: UnknownFigure[] = []
48
+
49
+ const failures: FailureRecord[] = used.withUnit
50
+ .filter((row) => row.event === 'checked' && textField(row, 'outcome') === 'fail')
51
+ .sort(
52
+ (a, b) => compareText(textField(a, 'check') ?? '', textField(b, 'check') ?? '') || compareText(a.time, b.time)
53
+ )
54
+ .map((row) => ({
55
+ check: textField(row, 'check') ?? '',
56
+ checkVersion: textField(row, 'check_version'),
57
+ inputFingerprint: textField(row, 'input_fingerprint'),
58
+ commit: row.commit === null ? unknownBecause(NO_COMMIT_REASON) : { known: true, value: row.commit }
59
+ }))
60
+
61
+ const determinismFigure: Measured<never> = unknownBecause(DETERMINISM_REASON)
62
+ unknowns.push({ figure: 'determinism', reason: DETERMINISM_REASON })
63
+
64
+ return { failures, determinism: determinismFigure, coverage: buildCoverage(dataset, lowTrust, used, unknowns) }
65
+ }