checkwright 0.21.0 → 0.23.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 (489) hide show
  1. package/README.md +1013 -50
  2. package/lib/common/digest.sh +18 -0
  3. package/lib/common/lock.sh +40 -0
  4. package/lib/common/profile.sh +33 -0
  5. package/lib/common/recipe.sh +56 -43
  6. package/lib/diff.sh +64 -0
  7. package/lib/doctor.sh +81 -7
  8. package/lib/init.sh +167 -52
  9. package/lib/uninstall.sh +212 -0
  10. package/lib/update.sh +34 -0
  11. package/package.json +2 -2
  12. package/payload/artifact/targets.list +30 -0
  13. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  14. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
  15. package/payload/canon-kit/README.md +2 -0
  16. package/payload/canon-kit/SPEC.md +666 -59
  17. package/payload/canon-kit/checks/check-amendment-queue.sh +1 -0
  18. package/payload/canon-kit/checks/check-comment-tier.gate +3 -0
  19. package/payload/canon-kit/checks/check-deprecation-task.gate +3 -0
  20. package/payload/canon-kit/checks/check-docs-cmd.gate +3 -0
  21. package/payload/canon-kit/checks/check-docs-link-convention.sh +12 -4
  22. package/payload/canon-kit/checks/check-install-claim.gate +3 -0
  23. package/payload/canon-kit/checks/check-knob-citation.gate +3 -0
  24. package/payload/canon-kit/checks/check-knob-default-coupling.sh +1 -0
  25. package/payload/canon-kit/checks/check-manifest-count.gate +3 -0
  26. package/payload/canon-kit/checks/check-manifest-temporal.gate +3 -0
  27. package/payload/canon-kit/checks/check-md-refs.gate +3 -0
  28. package/payload/canon-kit/checks/check-measured-claim.gate +3 -0
  29. package/payload/canon-kit/checks/check-payload-claim.gate +3 -0
  30. package/payload/canon-kit/checks/check-prose-enum.gate +3 -0
  31. package/payload/canon-kit/checks/check-prose-tells.sh +1 -0
  32. package/payload/canon-kit/checks/check-spec-derivable-section.gate +3 -0
  33. package/payload/canon-kit/checks/check-spec-dod-singleton.gate +3 -0
  34. package/payload/canon-kit/checks/check-spec-embedded-source.sh +1 -0
  35. package/payload/canon-kit/checks/check-spec-fence-balance.gate +3 -0
  36. package/payload/canon-kit/checks/check-spec-pointer.gate +3 -0
  37. package/payload/canon-kit/checks/check-surface-duplication.sh +1 -0
  38. package/payload/canon-kit/checks/check-todo-task-liveness.gate +3 -0
  39. package/payload/canon-kit/checks/check-tracking-claim.gate +3 -0
  40. package/payload/canon-kit/gate-tests/check-comment-tier/bad/.workflow/fixture-state.txt +4 -0
  41. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.gate +4 -0
  42. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.rs +5 -0
  43. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +4 -0
  44. package/payload/canon-kit/gate-tests/check-comment-tier/bad/templates/bad-tmpl.sh +4 -0
  45. package/payload/canon-kit/gate-tests/check-comment-tier/good/.workflow/fixture-state.txt +3 -0
  46. package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -1
  47. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.gate +4 -0
  48. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.rs +5 -0
  49. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
  50. package/payload/canon-kit/gate-tests/check-comment-tier/good/templates/good-tmpl.sh +5 -0
  51. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +29 -5
  52. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/.workflow/fixture-state.txt +3 -0
  53. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.gate +2 -0
  54. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.rs +4 -0
  55. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/expect.txt +3 -0
  56. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +6 -5
  57. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/templates/tmpl.sh +5 -0
  58. package/payload/canon-kit/gate-tests/check-deprecation-task/good/.workflow/fixture-state.txt +3 -0
  59. package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -1
  60. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.gate +2 -0
  61. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.rs +4 -0
  62. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +6 -5
  63. package/payload/canon-kit/gate-tests/check-deprecation-task/good/templates/tmpl.sh +5 -0
  64. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +4 -3
  65. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -0
  66. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
  67. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/OUTSIDE.md +4 -0
  68. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
  69. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
  70. package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +2 -2
  71. package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +4 -0
  72. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +32 -8
  73. package/payload/canon-kit/gate-tests/check-md-refs.test.sh +61 -9
  74. package/payload/canon-kit/gate-tests/check-measured-claim/bad/SPEC.md +12 -0
  75. package/payload/canon-kit/gate-tests/check-measured-claim/bad/expect.txt +3 -0
  76. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.sh +6 -0
  77. package/payload/canon-kit/gate-tests/check-measured-claim/good/SPEC.md +23 -0
  78. package/payload/canon-kit/gate-tests/check-measured-claim/good/expect.txt +1 -0
  79. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.sh +6 -0
  80. package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +90 -0
  81. package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
  82. package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
  83. package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
  84. package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
  85. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
  86. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
  87. package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
  88. package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
  89. package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
  90. package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
  91. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
  92. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
  93. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +27 -4
  94. package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +21 -7
  95. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/.workflow/fixture-state.txt +2 -0
  96. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.gate +2 -0
  97. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.rs +4 -0
  98. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +4 -0
  99. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/templates/tmpl.sh +5 -0
  100. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
  101. package/payload/canon-kit/gate-tests/check-spec-pointer/good/.workflow/fixture-state.txt +2 -0
  102. package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -1
  103. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.gate +2 -0
  104. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.rs +4 -0
  105. package/payload/canon-kit/gate-tests/check-spec-pointer/good/templates/tmpl.sh +5 -0
  106. package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
  107. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/.workflow/fixture-state.txt +3 -0
  108. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.gate +2 -0
  109. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.rs +4 -0
  110. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/expect.txt +3 -0
  111. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/templates/tmpl.sh +5 -0
  112. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/.workflow/fixture-state.txt +3 -0
  113. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/expect.txt +1 -1
  114. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.gate +2 -0
  115. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.rs +4 -0
  116. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/templates/tmpl.sh +5 -0
  117. package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +1 -2
  118. package/payload/canon-kit/lib/spec.sh +109 -70
  119. package/payload/canon-kit/smoke/install.sh +21 -1
  120. package/payload/canon-kit/templates/SPEC-amendment.md +9 -2
  121. package/payload/context-kit/README.md +4 -1
  122. package/payload/context-kit/SPEC.md +166 -9
  123. package/payload/context-kit/bin/env-probe.sh +19 -6
  124. package/payload/context-kit/checks/check-brevity.sh +1 -0
  125. package/payload/context-kit/checks/check-footprint-fresh.sh +1 -0
  126. package/payload/context-kit/checks/check-memory-off.sh +1 -0
  127. package/payload/context-kit/checks/check-settings-paths.sh +94 -0
  128. package/payload/context-kit/checks/check-settings-pins.sh +1 -0
  129. package/payload/context-kit/gate-tests/check-settings-paths/bad/args +1 -0
  130. package/payload/context-kit/gate-tests/check-settings-paths/bad/expect.txt +3 -0
  131. package/payload/context-kit/gate-tests/check-settings-paths/bad/settings.json +12 -0
  132. package/payload/context-kit/gate-tests/check-settings-paths/bad/tools/real-tool.sh +4 -0
  133. package/payload/context-kit/gate-tests/check-settings-paths/good/args +1 -0
  134. package/payload/context-kit/gate-tests/check-settings-paths/good/expect.txt +1 -0
  135. package/payload/context-kit/gate-tests/check-settings-paths/good/settings.json +16 -0
  136. package/payload/context-kit/gate-tests/check-settings-paths/good/tools/real-tool.sh +4 -0
  137. package/payload/context-kit/index-tests/expected/toolfloor.txt +9 -0
  138. package/payload/context-kit/index-tests/toolfloor-cases.sh +20 -0
  139. package/payload/context-kit/lib/toolfloor.sh +15 -4
  140. package/payload/context-kit/smoke/agents-md.sh +12 -1
  141. package/payload/context-kit/smoke/install.sh +4 -1
  142. package/payload/delegation-kit/README.md +3 -3
  143. package/payload/delegation-kit/SPEC.md +499 -26
  144. package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
  145. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +1 -0
  146. package/payload/delegation-kit/checks/check-gate-tamper.sh +2 -1
  147. package/payload/delegation-kit/checks/check-rule-citation.sh +1 -0
  148. package/payload/delegation-kit/lib/delegation.sh +1 -0
  149. package/payload/delegation-kit/smoke/install.sh +2 -1
  150. package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
  151. package/payload/delegation-kit/templates/agent-execution.md +127 -12
  152. package/payload/delegation-kit/templates/delegation-config.sh +4 -0
  153. package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
  154. package/payload/delegation-kit/templates/statusline-usage.sh +23 -1
  155. package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
  156. package/payload/doctrine-kit/DOCTRINE.md +112 -11
  157. package/payload/doctrine-kit/README.md +12 -3
  158. package/payload/doctrine-kit/SPEC.md +163 -11
  159. package/payload/doctrine-kit/bin/install-doctrine.sh +167 -17
  160. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +41 -11
  161. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/DOCTRINE.md +3 -0
  162. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/DOCTRINE.md +3 -0
  163. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +82 -2
  164. package/payload/doctrine-kit/smoke/install.sh +167 -1
  165. package/payload/drift-kit/README.md +3 -2
  166. package/payload/drift-kit/SPEC.md +264 -22
  167. package/payload/drift-kit/bin/kfric.sh +21 -2
  168. package/payload/drift-kit/bin/stage-economics.sh +157 -3
  169. package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
  170. package/payload/drift-kit/smoke/install.sh +183 -1
  171. package/payload/drift-kit/templates/economics.md +9 -0
  172. package/payload/drift-kit/templates/kpis.list +6 -1
  173. package/payload/evidence-kit/README.md +20 -6
  174. package/payload/evidence-kit/SPEC.md +355 -17
  175. package/payload/evidence-kit/bin/run-validate.sh +51 -9
  176. package/payload/evidence-kit/checks/check-battery-roster.sh +87 -0
  177. package/payload/evidence-kit/checks/check-evidence-baseline.sh +1 -0
  178. package/payload/evidence-kit/checks/check-evidence-manifest.sh +1 -0
  179. package/payload/evidence-kit/checks/check-producer-liveness.sh +35 -0
  180. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
  181. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
  182. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
  183. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
  184. package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
  185. package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
  186. package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
  187. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
  188. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
  189. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
  190. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
  191. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
  192. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
  193. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
  194. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
  195. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
  196. package/payload/evidence-kit/lib/evidence.sh +18 -0
  197. package/payload/evidence-kit/smoke/install.sh +17 -3
  198. package/payload/gate-sdk/README.md +17 -1
  199. package/payload/gate-sdk/SPEC.md +4427 -92
  200. package/payload/gate-sdk/bin/build-native.sh +38 -0
  201. package/payload/gate-sdk/bin/enforcement-map.sh +2 -1
  202. package/payload/gate-sdk/bin/gen-pre-commit.sh +32 -2
  203. package/payload/gate-sdk/bin/port-blockers.sh +445 -0
  204. package/payload/gate-sdk/bin/run-consumer-smoke.sh +129 -2
  205. package/payload/gate-sdk/bin/run-gate-tests.sh +61 -9
  206. package/payload/gate-sdk/bin/run-gates.sh +37 -2
  207. package/payload/gate-sdk/bin/upgrade-smoke.sh +55 -7
  208. package/payload/gate-sdk/checks/check-action-gh-repo.gate +3 -0
  209. package/payload/gate-sdk/checks/check-action-pinning.gate +3 -0
  210. package/payload/gate-sdk/checks/check-action-run-shell.sh +4 -1
  211. package/payload/gate-sdk/checks/check-assertion-strength.gate +3 -0
  212. package/payload/gate-sdk/checks/check-commit-msg.sh +1 -0
  213. package/payload/gate-sdk/checks/check-commit-subject.sh +1 -0
  214. package/payload/gate-sdk/checks/check-core-files.sh +28 -4
  215. package/payload/gate-sdk/checks/check-crate-arms.sh +61 -0
  216. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +1 -0
  217. package/payload/gate-sdk/checks/check-exec-bit.sh +21 -1
  218. package/payload/gate-sdk/checks/check-gate-assertions.sh +31 -6
  219. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +107 -0
  220. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +7 -7
  221. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +1 -0
  222. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +1 -0
  223. package/payload/gate-sdk/checks/check-gate-output.sh +41 -3
  224. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +333 -0
  225. package/payload/gate-sdk/checks/check-graph.sh +5 -5
  226. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +1 -0
  227. package/payload/gate-sdk/checks/check-identity.sh +1 -0
  228. package/payload/gate-sdk/checks/check-install-disposition.sh +92 -0
  229. package/payload/gate-sdk/checks/check-kit-enum.sh +1 -0
  230. package/payload/gate-sdk/checks/check-kit-registration.gate +3 -0
  231. package/payload/gate-sdk/checks/check-readme-roster.sh +6 -0
  232. package/payload/gate-sdk/checks/check-reads-couples.sh +71 -21
  233. package/payload/gate-sdk/checks/check-root-tiering.sh +1 -0
  234. package/payload/gate-sdk/checks/check-shellcheck.sh +1 -0
  235. package/payload/gate-sdk/checks/check-smoke-entry-guard.gate +3 -0
  236. package/payload/gate-sdk/checks/check-template-copy-parity.sh +1 -0
  237. package/payload/gate-sdk/checks/check-template-registry-parity.gate +3 -0
  238. package/payload/gate-sdk/checks/check-test-hermetic.gate +3 -0
  239. package/payload/gate-sdk/checks/check-tree-terms.sh +1 -0
  240. package/payload/gate-sdk/checks/check-workflow-tiering.sh +2 -1
  241. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
  242. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
  243. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/Cargo.toml +7 -0
  244. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/src/lib.rs +12 -0
  245. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/expect.txt +5 -0
  246. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.sh +2 -0
  247. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/Cargo.toml +7 -0
  248. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/src/lib.rs +11 -0
  249. package/payload/gate-sdk/gate-tests/check-crate-arms/good/expect.txt +2 -0
  250. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.sh +2 -0
  251. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
  252. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
  253. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
  254. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
  255. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
  256. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
  257. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
  258. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
  259. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
  260. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
  261. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
  262. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
  263. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
  264. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
  265. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
  266. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
  267. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
  268. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
  269. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
  270. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
  271. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
  272. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
  273. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-native-sample.gate +3 -0
  274. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
  275. package/payload/gate-sdk/gate-tests/check-gate-output/bad/expect.txt +3 -0
  276. package/payload/gate-sdk/gate-tests/check-gate-output/bad/gates.list +1 -0
  277. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/Cargo.toml +4 -0
  278. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/src/gates/native_sample.rs +7 -0
  279. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-native-sample.gate +3 -0
  280. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
  281. package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
  282. package/payload/gate-sdk/gate-tests/check-gate-output/good/gates.list +1 -0
  283. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/Cargo.toml +4 -0
  284. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/src/gates/native_sample.rs +11 -0
  285. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +111 -0
  286. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
  287. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
  288. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
  289. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
  290. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
  291. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
  292. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
  293. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
  294. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
  295. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
  296. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
  297. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
  298. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
  299. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
  300. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
  301. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
  302. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
  303. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
  304. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
  305. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
  306. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
  307. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
  308. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
  309. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
  310. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
  311. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
  312. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +184 -0
  313. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-alpha.sh +6 -0
  314. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-delta.sh +5 -0
  315. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-epsilon.sh +6 -0
  316. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/smoke/install.sh +7 -0
  317. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/args +6 -0
  318. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/expect.txt +1 -0
  319. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/installer/lib/common/recipe.sh +9 -0
  320. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/scripts/gate-sdk-config.sh +5 -0
  321. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-alpha.sh +6 -0
  322. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-beta.gate +3 -0
  323. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-gamma.sh +6 -0
  324. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/smoke/install.sh +8 -0
  325. package/payload/gate-sdk/gate-tests/check-install-disposition/good/args +6 -0
  326. package/payload/gate-sdk/gate-tests/check-install-disposition/good/expect.txt +1 -0
  327. package/payload/gate-sdk/gate-tests/check-install-disposition/good/installer/lib/common/recipe.sh +10 -0
  328. package/payload/gate-sdk/gate-tests/check-install-disposition/good/scripts/gate-sdk-config.sh +5 -0
  329. package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +6 -5
  330. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
  331. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
  332. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
  333. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
  334. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
  335. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
  336. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
  337. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
  338. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
  339. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
  340. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
  341. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
  342. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
  343. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
  344. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
  345. package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +2 -3
  346. package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
  347. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +151 -1
  348. package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +73 -0
  349. package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
  350. package/payload/gate-sdk/lib/consumer-smoke.sh +41 -4
  351. package/payload/gate-sdk/lib/gate.sh +208 -9
  352. package/payload/gate-sdk/lib/inject.sh +46 -1
  353. package/payload/gate-sdk/lib/test-hermetic.sh +26 -0
  354. package/payload/gate-sdk/smoke/install.sh +61 -1
  355. package/payload/guard-kit/README.md +18 -14
  356. package/payload/guard-kit/SPEC.md +366 -72
  357. package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
  358. package/payload/guard-kit/bin/run-guard-tests.sh +1 -0
  359. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
  360. package/payload/guard-kit/gate-tests/guard-read-path.test.sh +52 -0
  361. package/payload/guard-kit/guard-tests/cases.tsv +49 -7
  362. package/payload/guard-kit/lib/guard.sh +277 -54
  363. package/payload/guard-kit/templates/close-triage.md +38 -10
  364. package/payload/guard-kit/templates/guard-config.sh +3 -0
  365. package/payload/guard-kit/templates/settings-hooks.json +7 -1
  366. package/payload/lifecycle-kit/README.md +12 -1
  367. package/payload/lifecycle-kit/SPEC.md +991 -41
  368. package/payload/lifecycle-kit/bin/cite-survey.sh +81 -0
  369. package/payload/lifecycle-kit/bin/enter-stage.sh +139 -13
  370. package/payload/lifecycle-kit/bin/file-gap.sh +60 -2
  371. package/payload/lifecycle-kit/bin/file-survey.sh +69 -0
  372. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +1 -0
  373. package/payload/lifecycle-kit/checks/check-gap-inbox-neutrality.gate +3 -0
  374. package/payload/lifecycle-kit/checks/check-lesson-disposition.gate +3 -0
  375. package/payload/lifecycle-kit/checks/check-lifecycle-registration.gate +3 -0
  376. package/payload/lifecycle-kit/checks/check-merge-attrs.gate +3 -0
  377. package/payload/lifecycle-kit/checks/check-scratch-citation.gate +3 -0
  378. package/payload/lifecycle-kit/checks/check-shim-restatement.gate +3 -0
  379. package/payload/lifecycle-kit/checks/check-skill-binding.gate +3 -0
  380. package/payload/lifecycle-kit/checks/check-stage-entry.sh +1 -0
  381. package/payload/lifecycle-kit/checks/check-stage-evidence.gate +3 -0
  382. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.gate +3 -0
  383. package/payload/lifecycle-kit/checks/check-survey-record.gate +3 -0
  384. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +1 -2
  385. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/args +2 -0
  386. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/expect.txt +3 -0
  387. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/gap-inbox.md +5 -0
  388. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/args +2 -0
  389. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/expect.txt +1 -0
  390. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/gap-inbox.md +4 -0
  391. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +2 -3
  392. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +2 -3
  393. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
  394. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
  395. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +3 -3
  396. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/expect.txt +1 -0
  397. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.sh +4 -0
  398. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/surfaces/queue.md +13 -0
  399. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/expect.txt +1 -0
  400. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.sh +4 -0
  401. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/surfaces/queue.md +31 -0
  402. package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +2 -3
  403. package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +2 -3
  404. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +2 -3
  405. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +9 -5
  406. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
  407. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
  408. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
  409. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
  410. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
  411. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
  412. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +83 -0
  413. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +122 -0
  414. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +142 -0
  415. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
  416. package/payload/lifecycle-kit/gate-tests/workflow-state-guard.test.sh +100 -0
  417. package/payload/lifecycle-kit/lib/stages.sh +12 -2
  418. package/payload/lifecycle-kit/smoke/install.sh +83 -4
  419. package/payload/lifecycle-kit/templates/consult.md +73 -0
  420. package/payload/lifecycle-kit/templates/lead.md +139 -7
  421. package/payload/lifecycle-kit/templates/stages/align.md +12 -0
  422. package/payload/lifecycle-kit/templates/stages/build.md +8 -0
  423. package/payload/lifecycle-kit/templates/stages/close.md +45 -5
  424. package/payload/lifecycle-kit/templates/stages/scope.md +42 -3
  425. package/payload/lifecycle-kit/templates/stages/spec.md +13 -1
  426. package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
  427. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +29 -0
  428. package/payload/queue-kit/README.md +6 -1
  429. package/payload/queue-kit/SPEC.md +350 -6
  430. package/payload/queue-kit/bin/queue-counts.sh +35 -0
  431. package/payload/queue-kit/bin/queue-edges.sh +78 -0
  432. package/payload/queue-kit/checks/check-queue-entry-budget.gate +3 -0
  433. package/payload/queue-kit/checks/check-queue-hygiene.gate +3 -0
  434. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +1 -0
  435. package/payload/queue-kit/checks/check-queue-sections.gate +3 -0
  436. package/payload/queue-kit/checks/check-queue-slug-liveness.gate +3 -0
  437. package/payload/queue-kit/checks/check-queue-wrap.gate +3 -0
  438. package/payload/queue-kit/checks/check-roadmap-fresh.sh +1 -0
  439. package/payload/queue-kit/checks/check-tag-lead-line.gate +3 -0
  440. package/payload/queue-kit/checks/check-task-conservation.gate +4 -0
  441. package/payload/queue-kit/checks/check-task-names.gate +3 -0
  442. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
  443. package/payload/queue-kit/gate-tests/queue-counts.test.sh +116 -0
  444. package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
  445. package/payload/queue-kit/gate-tests/queue-lib-parity.test.sh +215 -0
  446. package/payload/queue-kit/lib/queue.sh +4 -19
  447. package/payload/queue-kit/smoke/install.sh +4 -1
  448. package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
  449. package/payload/site-kit/SPEC.md +64 -27
  450. package/payload/site-kit/checks/check-docs-cname-parity.sh +1 -0
  451. package/payload/site-kit/checks/check-docs-render-fidelity.sh +1 -0
  452. package/payload/site-kit/smoke/install.sh +9 -1
  453. package/profiles.list +36 -8
  454. package/payload/canon-kit/checks/check-comment-tier.sh +0 -211
  455. package/payload/canon-kit/checks/check-deprecation-task.sh +0 -90
  456. package/payload/canon-kit/checks/check-docs-cmd.sh +0 -153
  457. package/payload/canon-kit/checks/check-install-claim.sh +0 -146
  458. package/payload/canon-kit/checks/check-knob-citation.sh +0 -117
  459. package/payload/canon-kit/checks/check-manifest-count.sh +0 -46
  460. package/payload/canon-kit/checks/check-manifest-temporal.sh +0 -83
  461. package/payload/canon-kit/checks/check-md-refs.sh +0 -128
  462. package/payload/canon-kit/checks/check-prose-enum.sh +0 -115
  463. package/payload/canon-kit/checks/check-spec-derivable-section.sh +0 -69
  464. package/payload/canon-kit/checks/check-spec-dod-singleton.sh +0 -45
  465. package/payload/canon-kit/checks/check-spec-fence-balance.sh +0 -42
  466. package/payload/canon-kit/checks/check-spec-pointer.sh +0 -180
  467. package/payload/canon-kit/checks/check-todo-task-liveness.sh +0 -80
  468. package/payload/canon-kit/checks/check-tracking-claim.sh +0 -136
  469. package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
  470. package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
  471. package/payload/gate-sdk/checks/check-assertion-strength.sh +0 -134
  472. package/payload/gate-sdk/checks/check-kit-registration.sh +0 -68
  473. package/payload/gate-sdk/checks/check-smoke-entry-guard.sh +0 -53
  474. package/payload/gate-sdk/checks/check-test-hermetic.sh +0 -119
  475. package/payload/lifecycle-kit/checks/check-lesson-disposition.sh +0 -98
  476. package/payload/lifecycle-kit/checks/check-lifecycle-registration.sh +0 -54
  477. package/payload/lifecycle-kit/checks/check-merge-attrs.sh +0 -69
  478. package/payload/lifecycle-kit/checks/check-shim-restatement.sh +0 -97
  479. package/payload/lifecycle-kit/checks/check-skill-binding.sh +0 -59
  480. package/payload/lifecycle-kit/checks/check-stage-evidence.sh +0 -81
  481. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.sh +0 -47
  482. package/payload/queue-kit/checks/check-queue-entry-budget.sh +0 -104
  483. package/payload/queue-kit/checks/check-queue-hygiene.sh +0 -81
  484. package/payload/queue-kit/checks/check-queue-sections.sh +0 -44
  485. package/payload/queue-kit/checks/check-queue-slug-liveness.sh +0 -63
  486. package/payload/queue-kit/checks/check-queue-wrap.sh +0 -56
  487. package/payload/queue-kit/checks/check-tag-lead-line.sh +0 -70
  488. package/payload/queue-kit/checks/check-task-conservation.sh +0 -50
  489. package/payload/queue-kit/checks/check-task-names.sh +0 -128
@@ -30,6 +30,7 @@ unset _ds_cfg
30
30
  : "${DRIFT_KIT_PRICE_TABLE:=${GATE_SDK_GATES_DIR:-scripts}/price-table.tsv}"
31
31
  : "${DRIFT_KIT_STATE_FILE:=${GATE_SDK_WORKFLOW_DIR:-.workflow}/WORKFLOW-STATE.txt}"
32
32
  : "${DRIFT_KIT_SUPERVISION_LABEL:=supervision}"
33
+ : "${DRIFT_KIT_FANOUT_SUFFIX:=+fanout}"
33
34
 
34
35
  sessions_dir() {
35
36
  if [[ -n "${DRIFT_KIT_SESSIONS_DIR:-}" ]]; then
@@ -165,9 +166,15 @@ printf 'stage-economics: %s\n' "$today"
165
166
  # one (iteration, stage). The stamp pass keys on the session, not the stamp, so a session bearing
166
167
  # two stamps resolves to its last one and the yielded stamps take no row instead of a duplicate.
167
168
  declare -A STAMP_SEEN=() SESS_CHOICE=() SESS_YIELDED=() ATTRIBUTED=() DISPATCH=() LEAD_SEEN=()
169
+ # spec: drift-kit/SPEC.md §The stage-economics meter — the fan-out row: an anchor is a transcript that
170
+ # already holds a row, and it carries the apportionment its own row was split by, so a lead's fan-out
171
+ # and its supervision row can never disagree about which iteration the lead belonged to.
172
+ declare -A ANCHOR_LABEL=() ANCHOR_ITERS=() ANCHOR_COUNTS=() ANCHOR_WHO=()
168
173
  SESS_ORDER=()
169
174
  LEAD_ORDER=()
175
+ ANCHOR_ORDER=()
170
176
  label_collision=0
177
+ suffix_collision=0
171
178
  stamps=0
172
179
  while read -r iter stage session8 _date _rest; do
173
180
  [[ -z "$iter" || "$iter" == \#* || "$iter" == "---" ]] && continue
@@ -176,6 +183,7 @@ while read -r iter stage session8 _date _rest; do
176
183
  STAMP_SEEN["$iter/$stage/$session8"]=1
177
184
  stamps=$((stamps + 1))
178
185
  [[ "$stage" == "$DRIFT_KIT_SUPERVISION_LABEL" ]] && label_collision=1
186
+ [[ -n "$DRIFT_KIT_FANOUT_SUFFIX" && "$stage" == *"$DRIFT_KIT_FANOUT_SUFFIX" ]] && suffix_collision=1
179
187
  if [[ -n "${SESS_CHOICE[$session8]:-}" ]]; then
180
188
  SESS_YIELDED[$session8]="${SESS_YIELDED[$session8]:-}${SESS_CHOICE[$session8]}; "
181
189
  else
@@ -202,6 +210,16 @@ for session8 in ${SESS_ORDER[@]+"${SESS_ORDER[@]}"}; do
202
210
  continue
203
211
  fi
204
212
  ATTRIBUTED[$transcript]=1
213
+ # spec: drift-kit/SPEC.md §The stage-economics meter — a stage anchors on the stamp resolving, not on a
214
+ # row being emitted: a stamped stage whose transcript carries no usage is still a real, placeable
215
+ # (iteration, stage) for its subtree, where a supervision role that emitted nothing is not a role at all.
216
+ if [[ -z "${ANCHOR_LABEL[$transcript]:-}" ]]; then
217
+ ANCHOR_LABEL[$transcript]="$stage"
218
+ ANCHOR_ITERS[$transcript]="$iter"
219
+ ANCHOR_COUNTS[$transcript]="1"
220
+ ANCHOR_WHO[$transcript]="$session8"
221
+ ANCHOR_ORDER+=("$transcript")
222
+ fi
205
223
  # spec: drift-kit/SPEC.md §The stage-economics meter — a nested-tier transcript names its supervising lead in
206
224
  # its own path, which is what makes the supervision row derivable with no stamp and no lifecycle change.
207
225
  if [[ "$transcript" == */subagents/*.jsonl ]]; then
@@ -278,13 +296,147 @@ if [[ "$degraded" -eq 0 && ${#LEAD_ORDER[@]} -gt 0 ]]; then
278
296
  done
279
297
  done <<< "$usage"
280
298
  ATTRIBUTED[$lead_path]=1
299
+ ANCHOR_LABEL[$lead_path]="$DRIFT_KIT_SUPERVISION_LABEL"
300
+ ANCHOR_ITERS[$lead_path]="${iters[*]}"
301
+ ANCHOR_COUNTS[$lead_path]="${counts[*]}"
302
+ ANCHOR_WHO[$lead_path]="$(normalize8 "$lead")"
303
+ ANCHOR_ORDER+=("$lead_path")
281
304
  done
282
305
  fi
283
306
  fi
284
307
 
308
+ # spec: drift-kit/SPEC.md §The stage-economics meter — the fan-out row: the path cannot carry the parent
309
+ # edge, so it comes from the harness's sibling meta record and the walk stops at the nearest anchor.
310
+ fanout_unresolved=0
311
+ fanout_rows=0
312
+ fanout_no_meta=0
313
+ if [[ "$degraded" -eq 0 && "${#ANCHOR_ORDER[@]}" -gt 0 ]]; then
314
+ if [[ "$suffix_collision" -eq 1 ]]; then
315
+ printf ' a stamp names a stage ending in "%s", colliding with DRIFT_KIT_FANOUT_SUFFIX — no fan-out rows emitted this run\n' \
316
+ "$DRIFT_KIT_FANOUT_SUFFIX"
317
+ else
318
+ _fo_dir="$(sessions_dir)"
319
+ declare -A META_PARENT=() META_HAVE=() FANOUT=()
320
+ FANOUT_ORDER=()
321
+ nested=0
322
+ shopt -s nullglob
323
+ for _fo_sub in "$_fo_dir"/*/subagents; do
324
+ _fo_metas=("$_fo_sub"/*.meta.json)
325
+ _fo_scripts=("$_fo_sub"/*.jsonl)
326
+ nested=$((nested + ${#_fo_scripts[@]}))
327
+ [[ "${#_fo_metas[@]}" -gt 0 ]] || continue
328
+ while IFS=$'\t' read -r _fo_mf _fo_pid; do
329
+ [[ -n "$_fo_mf" ]] || continue
330
+ _fo_t="${_fo_mf%.meta.json}.jsonl"
331
+ META_HAVE[$_fo_t]=1
332
+ if [[ -z "$_fo_pid" ]]; then
333
+ META_PARENT[$_fo_t]="${_fo_sub%/subagents}.jsonl"
334
+ elif [[ -f "$_fo_sub/agent-$_fo_pid.jsonl" ]]; then
335
+ META_PARENT[$_fo_t]="$_fo_sub/agent-$_fo_pid.jsonl"
336
+ elif [[ -f "$_fo_sub/$_fo_pid.jsonl" ]]; then
337
+ META_PARENT[$_fo_t]="$_fo_sub/$_fo_pid.jsonl"
338
+ else
339
+ META_PARENT[$_fo_t]="" # named an agent with no transcript: counted, never guessed
340
+ fi
341
+ done < <(jq -r '[input_filename, (.parentAgentId // "")] | @tsv' "${_fo_metas[@]}" 2>/dev/null)
342
+ done
343
+ shopt -u nullglob
344
+
345
+ if [[ "$nested" -gt 0 && "${#META_HAVE[@]}" -eq 0 ]]; then
346
+ fanout_no_meta=1
347
+ else
348
+ walk_anchor() { # $1=transcript -> WALK_ANCHOR = nearest anchor path, empty if none
349
+ local cur="$1" hops=0
350
+ local -A seen=()
351
+ WALK_ANCHOR=""
352
+ while :; do
353
+ if [[ -n "${ANCHOR_LABEL[$cur]:-}" ]]; then WALK_ANCHOR="$cur"; return 0; fi
354
+ hops=$((hops + 1))
355
+ [[ "$hops" -le "$nested" ]] || return 1
356
+ [[ -z "${seen[$cur]:-}" ]] || return 1
357
+ seen[$cur]=1
358
+ [[ -n "${META_HAVE[$cur]:-}" ]] || return 1
359
+ [[ -n "${META_PARENT[$cur]}" ]] || return 1
360
+ cur="${META_PARENT[$cur]}"
361
+ done
362
+ }
363
+
364
+ shopt -s nullglob
365
+ for f in "$_fo_dir"/*/subagents/*.jsonl; do
366
+ [[ -z "${ANCHOR_LABEL[$f]:-}" && -z "${ATTRIBUTED[$f]:-}" ]] || continue
367
+ if ! walk_anchor "$f"; then
368
+ fanout_unresolved=$((fanout_unresolved + 1))
369
+ continue
370
+ fi
371
+ ATTRIBUTED[$f]=1
372
+ usage="$(usage_by_model "$f")"
373
+ [[ -n "$usage" ]] || continue
374
+ while IFS=$'\t' read -r model in out cr cw; do
375
+ [[ -n "$model" ]] || continue
376
+ _fo_key="$WALK_ANCHOR|$model"
377
+ if [[ -z "${FANOUT[$_fo_key]:-}" ]]; then
378
+ FANOUT[$_fo_key]="$in $out $cr $cw"
379
+ FANOUT_ORDER+=("$_fo_key")
380
+ else
381
+ read -r a_in a_out a_cr a_cw <<< "${FANOUT[$_fo_key]}"
382
+ FANOUT[$_fo_key]="$((a_in + in)) $((a_out + out)) $((a_cr + cr)) $((a_cw + cw))"
383
+ fi
384
+ done <<< "$usage"
385
+ done
386
+ shopt -u nullglob
387
+
388
+ # spec: drift-kit/SPEC.md §The stage-economics meter — several anchors, one row: apportion
389
+ # first and fold second, since the split is the anchor's property and the row is not.
390
+ declare -A FOROW=() FOWHO=() FOCNT=()
391
+ FOROW_ORDER=()
392
+ for _fo_key in ${FANOUT_ORDER[@]+"${FANOUT_ORDER[@]}"}; do
393
+ anchor="${_fo_key%|*}"; model="${_fo_key##*|}"
394
+ read -r in out cr cw <<< "${FANOUT[$_fo_key]}"
395
+ read -r -a iters <<< "${ANCHOR_ITERS[$anchor]}"
396
+ read -r -a counts <<< "${ANCHOR_COUNTS[$anchor]}"
397
+ p_in=(); p_out=(); p_cr=(); p_cw=()
398
+ while IFS= read -r v; do p_in+=("$v"); done < <(split_tokens "$in" "${counts[@]}")
399
+ while IFS= read -r v; do p_out+=("$v"); done < <(split_tokens "$out" "${counts[@]}")
400
+ while IFS= read -r v; do p_cr+=("$v"); done < <(split_tokens "$cr" "${counts[@]}")
401
+ while IFS= read -r v; do p_cw+=("$v"); done < <(split_tokens "$cw" "${counts[@]}")
402
+ for i in "${!iters[@]}"; do
403
+ _fo_rk="${iters[$i]}|${ANCHOR_LABEL[$anchor]}|$model"
404
+ if [[ -z "${FOROW[$_fo_rk]:-}" ]]; then
405
+ FOROW[$_fo_rk]="${p_in[$i]} ${p_out[$i]} ${p_cr[$i]} ${p_cw[$i]}"
406
+ FOWHO[$_fo_rk]="${ANCHOR_WHO[$anchor]}"
407
+ FOCNT[$_fo_rk]=1
408
+ FOROW_ORDER+=("$_fo_rk")
409
+ else
410
+ read -r a_in a_out a_cr a_cw <<< "${FOROW[$_fo_rk]}"
411
+ FOROW[$_fo_rk]="$((a_in + p_in[i])) $((a_out + p_out[i])) $((a_cr + p_cr[i])) $((a_cw + p_cw[i]))"
412
+ FOCNT[$_fo_rk]=$(( FOCNT[$_fo_rk] + 1 ))
413
+ fi
414
+ done
415
+ done
416
+
417
+ for _fo_rk in ${FOROW_ORDER[@]+"${FOROW_ORDER[@]}"}; do
418
+ _fo_iter="${_fo_rk%%|*}"; _fo_rest="${_fo_rk#*|}"
419
+ _fo_label="${_fo_rest%|*}"; model="${_fo_rest##*|}"
420
+ read -r in out cr cw <<< "${FOROW[$_fo_rk]}"
421
+ who="${FOWHO[$_fo_rk]}"
422
+ [[ "${FOCNT[$_fo_rk]}" -eq 1 ]] || who="${FOCNT[$_fo_rk]} anchors"
423
+ emit_row "$_fo_iter" "$_fo_label$DRIFT_KIT_FANOUT_SUFFIX" "$who" \
424
+ "$model" "$in" "$out" "$cr" "$cw"
425
+ fanout_rows=$((fanout_rows + 1))
426
+ done
427
+ fi
428
+ fi
429
+ fi
430
+
431
+ [[ "$fanout_no_meta" -eq 0 ]] || \
432
+ printf ' no dispatch-attribution records beside the transcripts — no fan-out rows this run; every other row is unchanged (degraded, not failed)\n'
433
+ [[ "$fanout_unresolved" -eq 0 ]] || \
434
+ printf ' %d dispatched transcript(s) resolved no anchor (absent or dangling attribution record, or an over-long chain) — each stays in the unstamped bound below, never guessed\n' \
435
+ "$fanout_unresolved"
436
+
285
437
  # spec: drift-kit/SPEC.md §The stage-economics meter — the under-count bound: the unmatched counter reports stamps
286
438
  # with no transcript and is structurally blind to the inverse, so the inverse is counted too. A bound,
287
- # never an attribution — a transcript carries no iteration and no stage, so nothing could place it.
439
+ # never an attribution — what remains is a transcript that resolved no anchor, so nothing could place it.
288
440
  unstamped=0
289
441
  if [[ "$degraded" -eq 0 ]]; then
290
442
  _se_dir="$(sessions_dir)"
@@ -301,11 +453,13 @@ fi
301
453
  [[ "$unmatched" -eq 0 ]] || \
302
454
  printf ' %d stamp(s) had no matching transcript (skipped — session transcripts age out of the sessions dir)\n' "$unmatched"
303
455
  [[ "$unstamped" -eq 0 ]] || \
304
- printf ' %d transcript(s) in the sessions dir match no stamp and bill to no row — an upper bound on the unstamped-continuation under-count, not an attribution\n' "$unstamped"
456
+ printf ' %d transcript(s) in the sessions dir match no stamp and resolved no anchor, so they bill to no row — an upper bound on the unstamped-continuation under-count, not an attribution\n' "$unstamped"
305
457
 
306
458
  if [[ "$incomplete" -eq 1 ]]; then
307
459
  printf ' total pricing incomplete — one or more model cost cells degraded to n/a (unpriced model or absent table)\n'
308
460
  fi
309
- printf ' (cr=cache-read is the headline burn lever; one transcript bills to exactly one (iteration, stage) — a session bearing several stamps is attributed to its last and the yielded stamps are named above, never billed twice)\n'
461
+ printf ' (cr=cache-read is the headline burn lever; one transcript bills to exactly one row key — an (iteration, stage-or-role) pair or that pair'"'"'s fan-out value — so a session bearing several stamps is attributed to its last and the yielded stamps are named above, never billed twice)\n'
462
+ [[ "$fanout_rows" -eq 0 ]] || \
463
+ printf ' a per-stage figure above excludes its own fan-out: the subtree is the adjacent "%s" row, an aggregate over every dispatch shape (a fork and a typed dispatch fold into one total)\n' "$DRIFT_KIT_FANOUT_SUFFIX"
310
464
  printf ' logged: %s (%d row(s))\n' "$DRIFT_KIT_STAGE_ECONOMICS_LOG" "$rows"
311
465
  exit 0
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env bash
2
+ # spec: drift-kit/SPEC.md §Bundled KPIs — kpi-incident-recurrence: re-filings recorded by the queue's `recurrence:` declarations, and the highest-count slug (queue-kit/SPEC.md §The tag algebra owns the grammar; the second implementation is accepted residual — drift-kit cannot source queue-kit's lib without a cross-kit cycle)
3
+ set -uo pipefail
4
+
5
+ QUEUE="${DRIFT_KIT_QUEUE_FILE:-TASK-QUEUE.md}"
6
+
7
+ if [[ ! -f "$QUEUE" ]]; then
8
+ [[ "${1:-}" == "--trend" ]] && exit 0
9
+ printf 'lag\tincident recurrence\tn/a (no queue file)\n'
10
+ exit 0
11
+ fi
12
+
13
+ # spec: drift-kit/SPEC.md §Bundled KPIs — the declaration is self-slug-bearing and lives on a line of its own, so one anchored scan reads it with no entry-boundary parsing
14
+ read -r total top_slug top_count <<<"$(
15
+ awk '
16
+ $1 == "recurrence:" && NF >= 3 {
17
+ n = 0
18
+ for (i = 3; i <= NF; i++)
19
+ if ($i ~ /^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/) n++
20
+ if (n == 0) next
21
+ total += n
22
+ if (n > top) { top = n; slug = $2 }
23
+ }
24
+ END { printf "%d %s %d\n", total + 0, (slug == "" ? "-" : slug), top + 0 }
25
+ ' "$QUEUE" 2>/dev/null
26
+ )"
27
+
28
+ [[ "$total" =~ ^[0-9]+$ ]] || total=0
29
+
30
+ if [[ "$total" -eq 0 ]]; then
31
+ [[ "${1:-}" == "--trend" ]] && exit 0
32
+ printf 'lag\tincident recurrence\tn/a (no recurrence declaration in the queue)\n'
33
+ exit 0
34
+ fi
35
+
36
+ if [[ "${1:-}" == "--trend" ]]; then
37
+ printf 'recur %d\n' "$total"
38
+ exit 0
39
+ fi
40
+ printf 'lag\tincident recurrence\t%d re-filing(s) recorded; highest %s at %d (captured filings only — a lower bound)\n' \
41
+ "$total" "$top_slug" "$top_count"
42
+ exit 0
@@ -46,13 +46,38 @@ grep -q '^--- Lag' <<<"$out" || fail "missing Lag section header"
46
46
  grep -q 'Read trend across sessions' <<<"$out" || fail "missing footer"
47
47
 
48
48
  total_rows="$(awk '/^--- Lead/{f=1} /^Read trend/{f=0} f && /^ [^ ]/{c++} END{print c+0}' <<<"$out")"
49
- [[ "$total_rows" -eq "$registered" ]] || fail "expected one row per registered KPI ($registered), got $total_rows"
49
+ [[ "$total_rows" -ge "$registered" ]] || fail "expected at least one row per registered KPI ($registered), got $total_rows"
50
50
 
51
51
  grep -q 'kpi-does-not-exist.*n/a' <<<"$out" || fail "missing plugin did not yield a visible n/a row"
52
52
 
53
53
  awk '/^--- Lag/{f=1;next} /^Read trend/{f=0} f' <<<"$out" | grep -q 'knowledge friction.*n/a' \
54
54
  || fail "kpi-knowledge-friction did not render an n/a row under the Lag section (log absent in the throwaway consumer)"
55
55
 
56
+ # spec: drift-kit/SPEC.md §Testing — the per-plugin contribution probe: the report masks a silent
57
+ # plugin with its own 'n/a (plugin failed)' row, so the floor above cannot see one; a name
58
+ # resolving to no plugin is skipped.
59
+ plugin() {
60
+ DRIFT_KIT_KPIS_FILE="$work/kpis.list" \
61
+ DRIFT_KIT_QUEUE_FILE="$work/TASK-QUEUE.md" \
62
+ DRIFT_KIT_TMP_DIR="$work" \
63
+ DRIFT_KIT_TIMINGS_FILE="$work/no-such-timings.txt" \
64
+ bash "$1"
65
+ }
66
+
67
+ probed=0
68
+ while IFS= read -r kname; do
69
+ [[ -n "$kname" ]] || continue
70
+ kpath="$SMOKE_KIT_ROOT/kpis/$kname.sh"
71
+ [[ -f "$kpath" ]] || continue
72
+ set +e
73
+ pout="$(plugin "$kpath")"; prc=$?
74
+ set -e
75
+ [[ "$prc" -eq 0 ]] || fail "$kname exited $prc standalone — the report would mask it as 'n/a (plugin failed)'"
76
+ [[ -n "$pout" ]] || fail "$kname emitted no row standalone — the report would mask it as 'n/a (plugin failed)', so the row-count floor cannot see it"
77
+ probed=$((probed + 1))
78
+ done < <(grep -Ev '^[[:space:]]*(#|$)' "$work/kpis.list")
79
+ [[ "$probed" -gt 0 ]] || fail "no registered name resolved to a bundled plugin — the per-plugin probe asserted nothing"
80
+
56
81
  set +e
57
82
  trend="$(report --trend)"; trc=$?
58
83
  set -e
@@ -202,6 +227,38 @@ ptmiss="$(ptkpi "$work/no-such-price-table.tsv")"
202
227
  [[ "$(grep -c '^lead' <<<"$ptmiss")" -eq 1 ]] || fail "with no table the KPI emits one row, not an expiry row for a table that is not there: $ptmiss"
203
228
  grep -q 'n/a (no price table)' <<<"$ptmiss" || fail "absent price table must degrade fail-visibly: $ptmiss"
204
229
 
230
+ # spec: drift-kit/SPEC.md §Testing — kpi-incident-recurrence over purpose-built queues:
231
+ # the sum across declarations, the highest-count slug, the trend fragment, and the two
232
+ # degradations. Fixture-stable, like kpi-price-table-age: it reads a file the fixture writes.
233
+ irkpi() { DRIFT_KIT_QUEUE_FILE="$1" bash "$SMOKE_KIT_ROOT/kpis/kpi-incident-recurrence.sh" "${2:-}"; }
234
+
235
+ ir_q="$work/recurrence-queue.md"
236
+ cat > "$ir_q" <<'EOF'
237
+ # TASK-QUEUE.md
238
+ ## Iteration: smoke
239
+ ## Deferred
240
+ - **thrice** [design-pending] — a finding re-filed three times.
241
+ recurrence: thrice 2026-08-01 2026-08-02 2026-08-04
242
+ - **once** [design-pending] — a finding re-filed once.
243
+ recurrence: once 2026-08-04
244
+ ## Done
245
+ EOF
246
+ set +e
247
+ irout="$(irkpi "$ir_q")"; irrc=$?
248
+ set -e
249
+ [[ "$irrc" -eq 0 ]] || fail "kpi-incident-recurrence exited $irrc (advisory plugins always exit 0)"
250
+ [[ "$(grep -c '^lag' <<<"$irout")" -eq 1 ]] || fail "kpi-incident-recurrence must emit exactly one lag row: $irout"
251
+ grep -q '4 re-filing(s) recorded' <<<"$irout" || fail "the count must sum dates across every declaration, not count declarations: $irout"
252
+ grep -q 'highest thrice at 3' <<<"$irout" || fail "the highest-count slug row is missing or wrong: $irout"
253
+ [[ "$(irkpi "$ir_q" --trend)" == 'recur 4' ]] || fail "kpi-incident-recurrence --trend not 'recur 4': $(irkpi "$ir_q" --trend)"
254
+
255
+ irnone="$(irkpi "$work/TASK-QUEUE.md")"
256
+ grep -q 'n/a (no recurrence declaration in the queue)' <<<"$irnone" \
257
+ || fail "a queue with no declaration must degrade fail-visibly rather than reporting 0: $irnone"
258
+ [[ -z "$(irkpi "$work/TASK-QUEUE.md" --trend)" ]] || fail "--trend must emit nothing when no declaration exists"
259
+ grep -q 'n/a (no queue file)' <<<"$(irkpi "$work/no-such-queue.md")" \
260
+ || fail "an absent queue file must degrade fail-visibly"
261
+
205
262
  # spec: drift-kit/SPEC.md §Testing — the stage-economics join over a synthetic fixture set:
206
263
  # a WORKFLOW-STATE stamp file, a transcript whose basename normalizes to the stamped
207
264
  # session8, and a placeholder price table. Known tokens in, known trend line out.
@@ -345,4 +402,129 @@ EOF
345
402
  || fail "a stamp naming the label did not raise the collision notice"
346
403
  [[ "$(grep -c ' supiter supervision ' "$suplog")" -eq 0 ]] \
347
404
  || fail "the collision did not suppress the supervision row"
405
+
406
+ # spec: drift-kit/SPEC.md §Testing — the fan-out fixture: a three-level tree flat in one subagents dir,
407
+ # whose grandchild is what makes the walk testable. Its own dir/state/log, same reason as above.
408
+ fodir="$work/fo-sessions"; mkdir -p "$fodir/folead0001dead/subagents"
409
+ fosub="$fodir/folead0001dead/subagents"
410
+ cat > "$fodir/folead0001dead.jsonl" <<'EOF'
411
+ {"type":"assistant","message":{"id":"L1","model":"test-model","usage":{"input_tokens":2,"output_tokens":3,"cache_read_input_tokens":4,"cache_creation_input_tokens":5}}}
412
+ EOF
413
+ cat > "$fosub/agent-fostage1feed.jsonl" <<'EOF'
414
+ {"type":"assistant","message":{"id":"S1","model":"test-model","usage":{"input_tokens":10,"output_tokens":20,"cache_read_input_tokens":30,"cache_creation_input_tokens":40}}}
415
+ EOF
416
+ cat > "$fosub/agent-fochild2feed.jsonl" <<'EOF'
417
+ {"type":"assistant","message":{"id":"C1","model":"test-model","usage":{"input_tokens":1,"output_tokens":2,"cache_read_input_tokens":3,"cache_creation_input_tokens":4}}}
418
+ EOF
419
+ cat > "$fosub/agent-fogrand3feed.jsonl" <<'EOF'
420
+ {"type":"assistant","message":{"id":"G1","model":"test-model","usage":{"input_tokens":100,"output_tokens":200,"cache_read_input_tokens":300,"cache_creation_input_tokens":400}}}
421
+ EOF
422
+ # spec: drift-kit/SPEC.md §Testing — the fixture's second same-stage session: no usage of its own, so
423
+ # it anchors without emitting a row and its child must fold rather than replace the first anchor's.
424
+ printf '{"type":"user","message":{"role":"user","content":"no usage here"}}\n' > "$fosub/agent-fostage4feed.jsonl"
425
+ cat > "$fosub/agent-fochild5feed.jsonl" <<'EOF'
426
+ {"type":"assistant","message":{"id":"C5","model":"test-model","usage":{"input_tokens":1000,"output_tokens":2000,"cache_read_input_tokens":3000,"cache_creation_input_tokens":4000}}}
427
+ EOF
428
+ printf '{"agentType":"stage-session","spawnDepth":1}\n' > "$fosub/agent-fostage1feed.meta.json"
429
+ printf '{"agentType":"Explore","parentAgentId":"fostage1feed","spawnDepth":2}\n' > "$fosub/agent-fochild2feed.meta.json"
430
+ printf '{"agentType":"fork","isFork":true,"parentAgentId":"fochild2feed","spawnDepth":3}\n' > "$fosub/agent-fogrand3feed.meta.json"
431
+ printf '{"agentType":"stage-session","spawnDepth":1}\n' > "$fosub/agent-fostage4feed.meta.json"
432
+ printf '{"agentType":"Explore","parentAgentId":"fostage4feed","spawnDepth":2}\n' > "$fosub/agent-fochild5feed.meta.json"
433
+ printf 'foiter build fostage1 2025-01-01\nfoiter build fostage4 2025-01-01\n' > "$work/fo-state.txt"
434
+ folog="$work/fo-log.txt"
435
+ fan() { # $1 = fan-out suffix
436
+ DRIFT_KIT_STATE_FILE="$work/fo-state.txt" \
437
+ DRIFT_KIT_SESSIONS_DIR="$fodir" \
438
+ DRIFT_KIT_PRICE_TABLE="$work/se-prices.tsv" \
439
+ DRIFT_KIT_STAGE_ECONOMICS_LOG="$folog" \
440
+ DRIFT_KIT_FANOUT_SUFFIX="$1" \
441
+ bash "$SMOKE_KIT_ROOT/bin/stage-economics.sh" 2>&1
442
+ }
443
+ set +e
444
+ foout="$(fan '+fanout')"; forc=$?
445
+ set -e
446
+ [[ "$forc" -eq 0 ]] || fail "stage-economics over the fan-out fixture exited $forc"
447
+ [[ "$(grep -c ' foiter build+fanout test-model ' "$folog")" -eq 1 ]] \
448
+ || fail "the three-level fixture did not yield exactly one fan-out row: $foout"
449
+ grep -qE ' foiter build\+fanout test-model in=1101 out=2202 cr=3303 cw=4404 cost=33030\.[0-9]+$' "$folog" \
450
+ || fail "the fan-out row is not the sum over the whole subtree — a walk that stopped at depth 2, or two anchors racing under the dedup key instead of folding: $(cat "$folog")"
451
+ grep -q ' foiter build+fanout 2 anchors ' <<<"$foout" \
452
+ || fail "two anchors sharing one (iteration, stage) did not fold into one row: $foout"
453
+ grep -qE ' foiter build test-model in=10 out=20 cr=30 cw=40 cost=300\.[0-9]+$' "$folog" \
454
+ || fail "the stage row lost its own usage to the subtree (the fold this row exists to refuse): $(cat "$folog")"
455
+ grep -q 'resolved no anchor' <<<"$foout" \
456
+ && fail "an intact meta layer must resolve every dispatched transcript: $foout"
457
+ grep -q 'match no stamp and resolved no anchor' <<<"$foout" \
458
+ && fail "the unstamped bound still counts transcripts the fan-out pass attributed: $foout"
459
+
460
+ : > "$folog"
461
+ fan '-subtree' >/dev/null
462
+ grep -q ' foiter build-subtree test-model ' "$folog" \
463
+ || fail "DRIFT_KIT_FANOUT_SUFFIX did not name the row (the suffix is not a literal)"
464
+
465
+ : > "$folog"
466
+ printf 'foiter build fostage1 2025-01-01\nfoiter build fostage4 2025-01-01\nfoiter build+fanout nostage1 2025-01-01\n' > "$work/fo-state.txt"
467
+ focol="$(fan '+fanout')"
468
+ grep -q 'colliding with DRIFT_KIT_FANOUT_SUFFIX' <<<"$focol" \
469
+ || fail "a stamp whose stage ends in the suffix did not raise the collision notice"
470
+ [[ "$(grep -c 'build+fanout test-model' "$folog")" -eq 0 ]] \
471
+ || fail "the collision did not suppress the fan-out row"
472
+ printf 'foiter build fostage1 2025-01-01\nfoiter build fostage4 2025-01-01\n' > "$work/fo-state.txt"
473
+
474
+ # spec: drift-kit/SPEC.md §Testing — the fan-out fixture's two degradation assertions, neither of
475
+ # which may be dropped for brevity: they are what make the coupling's bound testable, not asserted.
476
+ : > "$folog"; fan '+fanout' >/dev/null
477
+ grep -v 'build+fanout' "$folog" | sort > "$work/fo-intact.txt"
478
+ rm -f "$fosub/agent-fogrand3feed.meta.json"
479
+ : > "$folog"
480
+ fodeg="$(fan '+fanout')"
481
+ grep -q '1 dispatched transcript(s) resolved no anchor' <<<"$fodeg" \
482
+ || fail "a missing meta record must raise the counted unresolved notice: $fodeg"
483
+ grep -q '1 transcript(s) in the sessions dir match no stamp and resolved no anchor' <<<"$fodeg" \
484
+ || fail "an unresolved transcript must fall back into the unstamped bound: $fodeg"
485
+ grep -qE ' foiter build\+fanout test-model in=1001 out=2002 cr=3003 cw=4004 ' "$folog" \
486
+ || fail "the degraded run must still price every resolvable transcript, never guess the unresolved one: $(cat "$folog")"
487
+ grep -v 'build+fanout' "$folog" | sort > "$work/fo-degraded.txt"
488
+ diff -q "$work/fo-intact.txt" "$work/fo-degraded.txt" >/dev/null \
489
+ || fail "a degraded fan-out pass changed a row it does not own: $(diff "$work/fo-intact.txt" "$work/fo-degraded.txt")"
490
+
491
+ # spec: drift-kit/SPEC.md §Testing — the second arm: the whole meta layer gone.
492
+ rm -f "$fosub"/*.meta.json
493
+ : > "$folog"
494
+ fonone="$(fan '+fanout')"
495
+ grep -q 'no dispatch-attribution records beside the transcripts' <<<"$fonone" \
496
+ || fail "an absent meta layer must emit its single notice: $fonone"
497
+ [[ "$(grep -c 'build+fanout' "$folog")" -eq 0 ]] \
498
+ || fail "an absent meta layer must emit no fan-out row at all"
499
+ sort "$folog" > "$work/fo-nometa.txt"
500
+ diff -q "$work/fo-intact.txt" "$work/fo-nometa.txt" >/dev/null \
501
+ || fail "losing the meta layer changed a row it does not own: $(diff "$work/fo-intact.txt" "$work/fo-nometa.txt")"
348
502
  fi
503
+
504
+ # spec: gate-sdk/SPEC.md §The bin/-tool contract — kfric.sh's two positionals are free text, so it
505
+ # validates their shape: help on stdout at exit 0, an unrecognized leading '-' refused on stderr at
506
+ # exit 2 in either slot, and the knowledge log byte-unchanged after both.
507
+ kflog="$work/kfric-argv.log"
508
+ printf '2026-01-01 a real fact ← a real surface\n' > "$kflog"
509
+ cp "$kflog" "$work/kfric-argv.before"
510
+ kf() { DRIFT_KIT_KNOWLEDGE_LOG="$kflog" bash "$SMOKE_KIT_ROOT/bin/kfric.sh" "$@"; }
511
+
512
+ for f in --help -h; do
513
+ kfout="$(kf "$f" 2>/dev/null)" || fail "kfric.sh $f should exit 0"
514
+ grep -q '^usage: ' <<<"$kfout" || fail "kfric.sh $f wrote no usage to stdout: $kfout"
515
+ done
516
+
517
+ for a in "--list" "second"; do
518
+ kfrc=0
519
+ if [[ "$a" == "--list" ]]; then kf --list a >/dev/null 2>&1 || kfrc=$?
520
+ else kf "$a" --list >/dev/null 2>&1 || kfrc=$?; fi
521
+ [[ "$kfrc" -eq 2 ]] || fail "kfric.sh refused a flag with exit $kfrc, want 2 (slot: $a)"
522
+ done
523
+ kfso="$(kf a --list 2>/dev/null)" || true
524
+ [[ -z "$kfso" ]] || fail "kfric.sh wrote usage to stdout on a refusal: $kfso"
525
+ cmp -s "$work/kfric-argv.before" "$kflog" \
526
+ || fail "kfric.sh wrote the knowledge log on a help or refusal path"
527
+
528
+ kf -- "--list is captured at exit 0" "a surface" >/dev/null
529
+ grep -q -- '--list is captured at exit 0 ← a surface$' "$kflog" \
530
+ || fail "kfric.sh -- did not file a fact beginning with a dash"
@@ -31,6 +31,15 @@ Compose the narrative from those two surfaces:
31
31
  bullets — never folded into them — and say plainly that per-stage figures
32
32
  exclude it. If the run's caveat named an apportionment key (one lead spanning
33
33
  several iterations), repeat the key so the reader can discount the row.
34
+ - **Fan-out.** A stage that dispatched agents pays for their whole subtree, and
35
+ that subtree bills to its own suffixed row rather than into the stage's own
36
+ (drift-kit/SPEC.md §The stage-economics meter, the fan-out row). Report it as a
37
+ named line item beside that stage's figure — never folded into it — and say
38
+ plainly that a per-stage figure excludes its own fan-out. Where the run's notice
39
+ named an apportionment key or a count of transcripts that resolved no anchor,
40
+ repeat it so the reader can discount the row. Read the row as an **aggregate**:
41
+ it carries no dispatch-type dimension, so a fork's spend and a typed dispatch's
42
+ spend are one total in it — do not report it as the cost of forking.
34
43
  - **Overhead share.** From the overhead meter, state what fraction of the
35
44
  closing session was governance versus task work — the methodology's own cost.
36
45
  - **Posture verdict.** Weigh *<posture: the model posture this iteration ran —
@@ -15,8 +15,13 @@ kpi-settings-local
15
15
  kpi-gate-runtime
16
16
  kpi-overhead
17
17
  kpi-price-table-age
18
+ kpi-queue-net-delta
18
19
 
19
20
  # Lag — weighted low; undercounts by construction. kpi-knowledge-friction reads
20
21
  # drift-kit's knowledge-friction loop (its capture convention + close triage); it
21
- # shows n/a until the log exists. A consumer with a structured lag source adds its own.
22
+ # shows n/a until the log exists. kpi-incident-recurrence reads the queue's
23
+ # recurrence: declarations (queue-kit's grammar, stamped by close's gap-inbox
24
+ # drain); it shows n/a until one exists.
25
+ # A consumer with a structured lag source adds its own.
22
26
  kpi-knowledge-friction
27
+ kpi-incident-recurrence
@@ -7,11 +7,13 @@ contract (`# contract: evidence-manifest v1`) an external verifier can consume,
7
7
  so the kit is adoptable with or without an iteration lifecycle.
8
8
 
9
9
  The gates: `check-evidence-baseline` (baseline grammar, blocking-slug liveness,
10
- scenario coverage) and `check-evidence-manifest` (manifest grammar and, where
11
- lifecycle drives the tree, close-entry green block + validate-stamp coupling).
12
- The `bin/` tools that drive it: `run-validate.sh` (the codified spine that runs
13
- the suites and records evidence) and `diff-baseline.sh` (the situational runtime
14
- diff). See [SPEC.md](SPEC.md) for the full contracts.
10
+ scenario coverage), `check-evidence-manifest` (manifest grammar and, where
11
+ lifecycle drives the tree, close-entry green block + validate-stamp coupling),
12
+ `check-battery-roster` (the runner doc's battery block against the suite roster)
13
+ and `check-producer-liveness` (no stage entry while the producer is still
14
+ running). The `bin/` tools that drive it: `run-validate.sh` (the codified spine
15
+ that runs the suites and records evidence) and `diff-baseline.sh` (the
16
+ situational runtime diff). See [SPEC.md](SPEC.md) for the full contracts.
15
17
 
16
18
  ## Install
17
19
 
@@ -23,6 +25,8 @@ Vendor the kit beside [gate-sdk](../gate-sdk/) (required), then:
23
25
  ```
24
26
  check-evidence-baseline
25
27
  check-evidence-manifest
28
+ check-battery-roster
29
+ check-producer-liveness # entry hook only — never gates.list, see step 6
26
30
  ```
27
31
  <!-- gate-roster:end -->
28
32
 
@@ -46,12 +50,22 @@ Vendor the kit beside [gate-sdk](../gate-sdk/) (required), then:
46
50
  `libtest` for per-test result logs, or your own log-parsing command).
47
51
 
48
52
  4. Record evidence at validate — run `bash evidence-kit/bin/run-validate.sh`; it
49
- runs each suite, diffs the baseline, and appends one evidence line per suite.
53
+ runs each suite, diffs the baseline, and records one evidence line per suite —
54
+ written to the manifest in a single fold once the whole roster has run, so a
55
+ suite needing a clean worktree may sit anywhere in it.
50
56
 
51
57
  5. Optional lifecycle integration — set `LIFECYCLE_KIT_BOUNDARY_TRUNCATE` to the
52
58
  evidence manifest so a new iteration starts from the contract header, and the
53
59
  manifest gate's close-entry and stamp-coupling assertions arm automatically.
54
60
 
61
+ 6. Wire `check-producer-liveness` on `LIFECYCLE_KIT_ENTRY_PREFLIGHT` rather than
62
+ in `gates.list`, its command naming the lock file
63
+ (`<stage>=evidence-kit/checks/check-producer-liveness.sh <lock-file>`),
64
+ at whichever stage entries must not begin while `run-validate`
65
+ is still running. It asks whether a producer is in flight, not whether the
66
+ tree is consistent, so a battery that `run-validate` itself invokes would red
67
+ every run against that run's own lock. See SPEC.md §check-producer-liveness.
68
+
55
69
  ## Test
56
70
 
57
71
  ```bash