checkwright 0.23.0 → 0.25.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 (375) hide show
  1. package/README.md +175 -13
  2. package/lib/common/lock.sh +7 -0
  3. package/lib/common/recipe.sh +1 -1
  4. package/lib/diff.sh +2 -0
  5. package/lib/init.sh +40 -16
  6. package/lib/uninstall.sh +2 -0
  7. package/package.json +2 -2
  8. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  9. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  10. package/payload/canon-kit/README.md +2 -0
  11. package/payload/canon-kit/SPEC.md +454 -28
  12. package/payload/canon-kit/checks/check-amendment-queue.gate +3 -0
  13. package/payload/canon-kit/checks/check-amendment-update-target.gate +3 -0
  14. package/payload/canon-kit/checks/check-docs-link-convention.gate +3 -0
  15. package/payload/canon-kit/checks/check-knob-default-coupling.gate +3 -0
  16. package/payload/canon-kit/checks/check-prose-tells.gate +3 -0
  17. package/payload/canon-kit/checks/check-spec-embedded-source.gate +3 -0
  18. package/payload/canon-kit/checks/check-unmarked-claim.gate +3 -0
  19. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-orphan.md +6 -0
  20. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +7 -2
  21. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +8 -0
  22. package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/SPEC-thing.md +26 -0
  23. package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/expect.txt +8 -0
  24. package/payload/canon-kit/gate-tests/check-amendment-update-target/good/SPEC-widget.md +47 -0
  25. package/payload/canon-kit/gate-tests/check-amendment-update-target/good/expect.txt +1 -0
  26. package/payload/canon-kit/gate-tests/check-amendment-update-target.test.sh +82 -0
  27. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.sh +3 -0
  28. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +1 -0
  29. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
  30. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +4 -4
  31. package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +2 -2
  32. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/SPEC-wire.md +18 -0
  33. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/expect.txt +3 -1
  34. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/widget.proto +13 -0
  35. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC-wire.md +22 -0
  36. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC.md +17 -0
  37. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/widget.proto +13 -0
  38. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/SPEC.md +11 -0
  39. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/expect.txt +3 -0
  40. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.sh +6 -0
  41. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/SPEC.md +18 -0
  42. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/expect.txt +1 -0
  43. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.sh +6 -0
  44. package/payload/canon-kit/gate-tests/check-unmarked-claim.test.sh +85 -0
  45. package/payload/canon-kit/lib/spec.sh +16 -0
  46. package/payload/canon-kit/smoke/install.sh +3 -1
  47. package/payload/canon-kit/templates/SPEC-amendment.md +17 -2
  48. package/payload/context-kit/README.md +6 -4
  49. package/payload/context-kit/SPEC.md +256 -76
  50. package/payload/context-kit/bin/always-loaded.sh +5 -21
  51. package/payload/context-kit/bin/env-probe.sh +2 -17
  52. package/payload/context-kit/checks/check-brevity.gate +3 -0
  53. package/payload/context-kit/checks/check-footprint-fresh.gate +3 -0
  54. package/payload/context-kit/checks/check-memory-off.gate +3 -0
  55. package/payload/context-kit/checks/check-settings-paths.gate +3 -0
  56. package/payload/context-kit/checks/check-settings-pins.gate +3 -0
  57. package/payload/context-kit/gate-tests/check-brevity.test.sh +3 -2
  58. package/payload/context-kit/gate-tests/check-memory-off/bad/scripts/context-config.sh +4 -0
  59. package/payload/context-kit/gate-tests/check-memory-off/good/scripts/context-config.sh +4 -0
  60. package/payload/context-kit/gate-tests/check-memory-off.test.sh +18 -4
  61. package/payload/context-kit/gate-tests/check-settings-pins.test.sh +70 -0
  62. package/payload/context-kit/index-tests/expected/toolfloor.txt +5 -5
  63. package/payload/context-kit/index-tests/toolfloor-cases.sh +5 -5
  64. package/payload/context-kit/lib/context.sh +56 -0
  65. package/payload/context-kit/lib/toolfloor.sh +1 -1
  66. package/payload/context-kit/smoke/agents-md.sh +16 -4
  67. package/payload/context-kit/smoke/install.sh +3 -2
  68. package/payload/context-kit/templates/session-context.sh +5 -5
  69. package/payload/delegation-kit/README.md +11 -1
  70. package/payload/delegation-kit/SPEC.md +652 -11
  71. package/payload/delegation-kit/bin/wait-probe.sh +184 -0
  72. package/payload/delegation-kit/checks/check-agent-tier-explicit.gate +3 -0
  73. package/payload/delegation-kit/checks/check-gate-tamper.gate +3 -0
  74. package/payload/delegation-kit/checks/check-rule-citation.gate +3 -0
  75. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/added-exemptions +5 -0
  76. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/expect.txt +2 -0
  77. package/payload/delegation-kit/gate-tests/check-gate-tamper.test.sh +108 -0
  78. package/payload/delegation-kit/gate-tests/subagent-stop-liveness.test.sh +99 -0
  79. package/payload/delegation-kit/smoke/install.sh +21 -1
  80. package/payload/delegation-kit/templates/agent-execution.md +88 -4
  81. package/payload/delegation-kit/templates/subagent-stop-liveness.sh +56 -0
  82. package/payload/doctrine-kit/SPEC.md +1 -1
  83. package/payload/doctrine-kit/checks/check-doctrine-registration.gate +3 -0
  84. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +2 -3
  85. package/payload/doctrine-kit/smoke/install.sh +17 -4
  86. package/payload/drift-kit/README.md +2 -2
  87. package/payload/drift-kit/SPEC.md +71 -7
  88. package/payload/drift-kit/bin/stage-economics.sh +1 -1
  89. package/payload/drift-kit/lib/drift.sh +43 -0
  90. package/payload/drift-kit/smoke/install.sh +21 -14
  91. package/payload/evidence-kit/README.md +3 -1
  92. package/payload/evidence-kit/SPEC.md +160 -19
  93. package/payload/evidence-kit/checks/check-battery-roster.gate +3 -0
  94. package/payload/evidence-kit/checks/check-evidence-baseline.gate +3 -0
  95. package/payload/evidence-kit/checks/check-evidence-manifest.gate +3 -0
  96. package/payload/evidence-kit/checks/check-producer-liveness.sh +42 -2
  97. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +4 -3
  98. package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +8 -5
  99. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/WORKFLOW-STATE.txt +1 -1
  100. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/scripts/evidence-config.sh +9 -0
  101. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/WORKFLOW-STATE.txt +1 -1
  102. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/scripts/evidence-config.sh +9 -0
  103. package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +6 -4
  104. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +42 -1
  105. package/payload/evidence-kit/lib/evidence.sh +2 -0
  106. package/payload/evidence-kit/smoke/install.sh +1 -1
  107. package/payload/gate-sdk/README.md +17 -9
  108. package/payload/gate-sdk/SPEC.md +4680 -295
  109. package/payload/gate-sdk/bin/build-native.sh +66 -1
  110. package/payload/gate-sdk/bin/install-hooks.sh +14 -2
  111. package/payload/gate-sdk/bin/port-blockers.sh +37 -9
  112. package/payload/gate-sdk/bin/run-gate-tests.sh +1 -2
  113. package/payload/gate-sdk/bin/run-gates.sh +137 -13
  114. package/payload/gate-sdk/bin/upgrade-smoke.sh +21 -16
  115. package/payload/gate-sdk/checks/check-action-run-shell.sh +2 -1
  116. package/payload/gate-sdk/checks/check-commit-msg.gate +3 -0
  117. package/payload/gate-sdk/checks/check-commit-subject.gate +3 -0
  118. package/payload/gate-sdk/checks/check-core-files.gate +3 -0
  119. package/payload/gate-sdk/checks/check-crate-arms.sh +1 -0
  120. package/payload/gate-sdk/checks/check-enforcement-fresh.gate +3 -0
  121. package/payload/gate-sdk/checks/check-exec-bit.gate +3 -0
  122. package/payload/gate-sdk/checks/check-gate-assertions.gate +3 -0
  123. package/payload/gate-sdk/checks/check-gate-binary-fresh.gate +3 -0
  124. package/payload/gate-sdk/checks/check-gate-exemption-tasks.gate +3 -0
  125. package/payload/gate-sdk/checks/check-gate-fail-closed.gate +3 -0
  126. package/payload/gate-sdk/checks/check-gate-fixture-coverage.gate +3 -0
  127. package/payload/gate-sdk/checks/check-gate-output.gate +3 -0
  128. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +132 -15
  129. package/payload/gate-sdk/checks/check-graph.gate +3 -0
  130. package/payload/gate-sdk/checks/check-hook-exec-bit.gate +3 -0
  131. package/payload/gate-sdk/checks/check-identity.gate +3 -0
  132. package/payload/gate-sdk/checks/check-install-disposition.sh +1 -0
  133. package/payload/gate-sdk/checks/check-kit-enum.gate +3 -0
  134. package/payload/gate-sdk/checks/check-readme-roster.gate +3 -0
  135. package/payload/gate-sdk/checks/check-reads-couples.gate +3 -0
  136. package/payload/gate-sdk/checks/check-root-tiering.gate +3 -0
  137. package/payload/gate-sdk/checks/check-shellcheck.sh +1 -0
  138. package/payload/gate-sdk/checks/check-template-copy-parity.gate +3 -0
  139. package/payload/gate-sdk/checks/check-tree-terms.gate +3 -0
  140. package/payload/gate-sdk/checks/check-workflow-tiering.gate +3 -0
  141. package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +17 -12
  142. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +4 -5
  143. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/dump.txt +2 -1
  144. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/expect.txt +2 -1
  145. package/payload/gate-sdk/gate-tests/check-exec-bit/good/dump.txt +3 -0
  146. package/payload/gate-sdk/gate-tests/check-exec-bit/good/expect.txt +1 -1
  147. package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +3 -4
  148. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/expect.txt +5 -1
  149. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/SPEC.md +22 -0
  150. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-count.sh +11 -0
  151. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-extra.sh +14 -0
  152. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-zero.sh +7 -0
  153. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
  154. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +27 -0
  155. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-qux.sh +13 -0
  156. package/payload/gate-sdk/gate-tests/check-gate-assertions.test.sh +117 -0
  157. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +26 -4
  158. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/args +6 -1
  159. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +2 -0
  160. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/kitroot/checks/check-vendored-descriptor.gate +4 -0
  161. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/kitroot/checks/check-vendored.sh +14 -0
  162. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/scripts/check-descriptor.gate +4 -0
  163. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/scripts/check-held.sh +8 -0
  164. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/args +8 -1
  165. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +3 -0
  166. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/kitroot/checks/check-vendored-descriptor.gate +4 -0
  167. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/kitroot/checks/check-vendored.sh +14 -0
  168. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/scripts/check-descriptor.gate +4 -0
  169. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/scripts/check-held.sh +8 -0
  170. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks.test.sh +77 -0
  171. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +4 -5
  172. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +9 -0
  173. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kit-spec.md +6 -0
  174. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +1 -0
  175. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-bare.sh +4 -0
  176. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-both.sh +5 -0
  177. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-heldtwice.sh +5 -0
  178. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-nospec.sh +4 -0
  179. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +2 -0
  180. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-twice.sh +5 -0
  181. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-ungrounded.sh +5 -0
  182. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +6 -0
  183. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +2 -1
  184. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kit-spec.md +12 -0
  185. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +1 -0
  186. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-held.sh +5 -0
  187. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +1 -0
  188. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +49 -4
  189. package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +15 -5
  190. package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +12 -0
  191. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-example-gate.md +27 -5
  192. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-second-gate.md +12 -0
  193. package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +5 -4
  194. package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +14 -12
  195. package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +43 -17
  196. package/payload/gate-sdk/gate-tests/check-graph-tree.test.sh +190 -0
  197. package/payload/gate-sdk/gate-tests/check-identity/bad/gh-hosts.yml +9 -0
  198. package/payload/gate-sdk/gate-tests/check-identity/bad/identity.conf +4 -2
  199. package/payload/gate-sdk/gate-tests/check-identity/bad/scripts/gate-sdk-config.sh +10 -0
  200. package/payload/gate-sdk/gate-tests/check-identity/good/gh-hosts.yml +11 -0
  201. package/payload/gate-sdk/gate-tests/check-identity/good/identity.conf +5 -1
  202. package/payload/gate-sdk/gate-tests/check-identity/good/scripts/gate-sdk-config.sh +10 -0
  203. package/payload/gate-sdk/gate-tests/check-identity.test.sh +114 -0
  204. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/check-native-sample.gate +3 -0
  205. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/gates.list +4 -1
  206. package/payload/gate-sdk/gate-tests/check-kit-enum/good/check-native-sample.gate +3 -0
  207. package/payload/gate-sdk/gate-tests/check-kit-enum/good/expect.txt +1 -1
  208. package/payload/gate-sdk/gate-tests/check-kit-enum/good/gates.list +5 -2
  209. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/args +3 -1
  210. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/README.md +15 -0
  211. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/checks/check-delta-one.gate +2 -0
  212. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/checks/check-delta-two.sh +3 -0
  213. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/expect.txt +3 -1
  214. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +1 -1
  215. package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +3 -1
  216. package/payload/gate-sdk/gate-tests/check-readme-roster/good/delta-kit/README.md +13 -0
  217. package/payload/gate-sdk/gate-tests/check-readme-roster/good/delta-kit/checks/check-delta-one.gate +2 -0
  218. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/README.md +14 -0
  219. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/checks/check-eps-one.sh +3 -0
  220. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/checks/check-eps-two.gate +2 -0
  221. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +1 -1
  222. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +87 -89
  223. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/agent-budget-guard.sh +4 -0
  224. package/payload/gate-sdk/gate-tests/check-template-copy-parity.test.sh +56 -0
  225. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +5 -0
  226. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/multi.txt +4 -0
  227. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/second-leak.txt +2 -0
  228. package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
  229. package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +3 -0
  230. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/anchored.txt +4 -0
  231. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.list +2 -0
  232. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.local.list +3 -0
  233. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/worktrees/vendored-note.txt +3 -0
  234. package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +94 -0
  235. package/payload/gate-sdk/gate-tests/declaration-lib-parity.test.sh +211 -0
  236. package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +16 -15
  237. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +94 -1
  238. package/payload/gate-sdk/lib/gate.sh +232 -25
  239. package/payload/gate-sdk/smoke/install.sh +28 -1
  240. package/payload/guard-kit/README.md +4 -3
  241. package/payload/guard-kit/SPEC.md +578 -47
  242. package/payload/guard-kit/bin/compare-settings-allow.sh +36 -12
  243. package/payload/guard-kit/bin/run-guard-tests.sh +27 -4
  244. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +46 -1
  245. package/payload/guard-kit/gate-tests/git-mutation-under-producer.test.sh +105 -0
  246. package/payload/guard-kit/guard-tests/background-cases.tsv +14 -0
  247. package/payload/guard-kit/guard-tests/cases.tsv +67 -9
  248. package/payload/guard-kit/lib/guard.sh +361 -18
  249. package/payload/guard-kit/templates/bash-guard.sh +2 -0
  250. package/payload/guard-kit/templates/close-triage.md +10 -3
  251. package/payload/guard-kit/templates/guard-config.sh +3 -0
  252. package/payload/lifecycle-kit/README.md +3 -2
  253. package/payload/lifecycle-kit/SPEC.md +509 -77
  254. package/payload/lifecycle-kit/bin/enter-stage.sh +72 -33
  255. package/payload/lifecycle-kit/bin/file-gap.sh +2 -2
  256. package/payload/lifecycle-kit/checks/check-close-surfaces.gate +3 -0
  257. package/payload/lifecycle-kit/checks/check-stage-entry.gate +3 -0
  258. package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +4 -4
  259. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +1 -1
  260. package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/.workflow/WORKFLOW-STATE.txt +3 -3
  261. package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/.workflow/WORKFLOW-STATE.txt +3 -3
  262. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +22 -22
  263. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/.workflow/WORKFLOW-STATE.txt +2 -2
  264. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/.workflow/WORKFLOW-STATE.txt +2 -2
  265. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +120 -10
  266. package/payload/lifecycle-kit/gate-tests/gap-inbox-route.test.sh +123 -0
  267. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +11 -11
  268. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +16 -5
  269. package/payload/lifecycle-kit/lib/stages.sh +5 -0
  270. package/payload/lifecycle-kit/smoke/install.sh +29 -15
  271. package/payload/lifecycle-kit/templates/lead.md +32 -0
  272. package/payload/lifecycle-kit/templates/stages/align.md +20 -2
  273. package/payload/lifecycle-kit/templates/stages/build.md +3 -3
  274. package/payload/lifecycle-kit/templates/stages/close.md +20 -6
  275. package/payload/lifecycle-kit/templates/stages/scope.md +20 -1
  276. package/payload/lifecycle-kit/templates/stages/spec.md +1 -1
  277. package/payload/lifecycle-kit/templates/stages/validate.md +1 -1
  278. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +1 -1
  279. package/payload/queue-kit/README.md +10 -10
  280. package/payload/queue-kit/SPEC.md +379 -84
  281. package/payload/queue-kit/bin/queue-counts.sh +1 -1
  282. package/payload/queue-kit/checks/check-queue-entry-budget.gate +1 -1
  283. package/payload/queue-kit/checks/check-queue-prose-precondition.gate +3 -0
  284. package/payload/queue-kit/checks/check-roadmap-fresh.gate +3 -0
  285. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +15 -0
  286. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +2 -0
  287. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +7 -0
  288. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/expect.txt +4 -0
  289. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/expect.txt +1 -1
  290. package/payload/queue-kit/gate-tests/queue-counts.test.sh +1 -1
  291. package/payload/queue-kit/gate-tests/queue-index.test.sh +55 -119
  292. package/payload/queue-kit/gate-tests/roadmap.test.sh +22 -12
  293. package/payload/queue-kit/lib/queue.sh +0 -49
  294. package/payload/queue-kit/smoke/install.sh +1 -1
  295. package/payload/site-kit/SPEC.md +41 -2
  296. package/payload/site-kit/checks/check-docs-cname-parity.gate +3 -0
  297. package/payload/site-kit/checks/check-docs-render-fidelity.sh +1 -0
  298. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +5 -4
  299. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +6 -5
  300. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/checks/check-sample.gate +3 -0
  301. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/expect.txt +1 -1
  302. package/payload/site-kit/smoke/install.sh +1 -1
  303. package/payload/canon-kit/checks/check-amendment-queue.sh +0 -117
  304. package/payload/canon-kit/checks/check-docs-link-convention.sh +0 -79
  305. package/payload/canon-kit/checks/check-knob-default-coupling.sh +0 -240
  306. package/payload/canon-kit/checks/check-prose-tells.sh +0 -208
  307. package/payload/canon-kit/checks/check-spec-embedded-source.sh +0 -134
  308. package/payload/context-kit/bin/footprint.sh +0 -144
  309. package/payload/context-kit/checks/check-brevity.sh +0 -124
  310. package/payload/context-kit/checks/check-footprint-fresh.sh +0 -39
  311. package/payload/context-kit/checks/check-memory-off.sh +0 -113
  312. package/payload/context-kit/checks/check-settings-paths.sh +0 -94
  313. package/payload/context-kit/checks/check-settings-pins.sh +0 -111
  314. package/payload/context-kit/gate-tests/check-memory-off/bad/args +0 -1
  315. package/payload/context-kit/gate-tests/check-memory-off/good/args +0 -1
  316. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +0 -62
  317. package/payload/delegation-kit/checks/check-gate-tamper.sh +0 -140
  318. package/payload/delegation-kit/checks/check-rule-citation.sh +0 -77
  319. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +0 -246
  320. package/payload/drift-kit/bin/trajectory.sh +0 -242
  321. package/payload/evidence-kit/checks/check-battery-roster.sh +0 -87
  322. package/payload/evidence-kit/checks/check-evidence-baseline.sh +0 -104
  323. package/payload/evidence-kit/checks/check-evidence-manifest.sh +0 -105
  324. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/args +0 -3
  325. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/args +0 -3
  326. package/payload/gate-sdk/bin/enforcement-map.sh +0 -273
  327. package/payload/gate-sdk/checks/check-commit-msg.sh +0 -51
  328. package/payload/gate-sdk/checks/check-commit-subject.sh +0 -44
  329. package/payload/gate-sdk/checks/check-core-files.sh +0 -76
  330. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +0 -38
  331. package/payload/gate-sdk/checks/check-exec-bit.sh +0 -96
  332. package/payload/gate-sdk/checks/check-gate-assertions.sh +0 -148
  333. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +0 -107
  334. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +0 -106
  335. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +0 -85
  336. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +0 -93
  337. package/payload/gate-sdk/checks/check-gate-output.sh +0 -103
  338. package/payload/gate-sdk/checks/check-graph.sh +0 -632
  339. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +0 -46
  340. package/payload/gate-sdk/checks/check-identity.sh +0 -135
  341. package/payload/gate-sdk/checks/check-kit-enum.sh +0 -95
  342. package/payload/gate-sdk/checks/check-readme-roster.sh +0 -108
  343. package/payload/gate-sdk/checks/check-reads-couples.sh +0 -200
  344. package/payload/gate-sdk/checks/check-root-tiering.sh +0 -67
  345. package/payload/gate-sdk/checks/check-template-copy-parity.sh +0 -127
  346. package/payload/gate-sdk/checks/check-tree-terms.sh +0 -66
  347. package/payload/gate-sdk/checks/check-workflow-tiering.sh +0 -85
  348. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/args +0 -1
  349. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/args +0 -1
  350. package/payload/gate-sdk/gate-tests/check-identity/bad/args +0 -1
  351. package/payload/gate-sdk/gate-tests/check-identity/good/args +0 -1
  352. package/payload/lifecycle-kit/bin/close-surfaces.sh +0 -94
  353. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +0 -64
  354. package/payload/lifecycle-kit/checks/check-stage-entry.sh +0 -198
  355. package/payload/queue-kit/bin/queue-index.sh +0 -182
  356. package/payload/queue-kit/bin/roadmap.sh +0 -76
  357. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +0 -64
  358. package/payload/queue-kit/checks/check-roadmap-fresh.sh +0 -111
  359. package/payload/site-kit/checks/check-docs-cname-parity.sh +0 -81
  360. /package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/{gates → scripts}/check-sample.sh +0 -0
  361. /package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/{gates → scripts}/check-sample.sh +0 -0
  362. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{check-gamma.sh → scripts/check-gamma.sh} +0 -0
  363. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gate-tests → scripts/gate-tests}/check-alpha/bad/.keep +0 -0
  364. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gate-tests → scripts/gate-tests}/check-alpha/good/.keep +0 -0
  365. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gates.list → scripts/gates.list} +0 -0
  366. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{check-beta.sh → scripts/check-beta.sh} +0 -0
  367. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gate-tests → scripts/gate-tests}/check-alpha/bad/.keep +0 -0
  368. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gate-tests → scripts/gate-tests}/check-alpha/good/.keep +0 -0
  369. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gates.list → scripts/gates.list} +0 -0
  370. /package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/{site-config.sh → scripts/site-config.sh} +0 -0
  371. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree → docs}/CNAME +0 -0
  372. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree → docs}/index.md +0 -0
  373. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree/docs → docs}/posts/2026-01-01-legacy.md +0 -0
  374. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree/pkg → pkg}/gate-tests/fixture.md +0 -0
  375. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{site-config.sh → scripts/site-config.sh} +0 -0
@@ -0,0 +1,184 @@
1
+ #!/usr/bin/env bash
2
+ # spec: delegation-kit/SPEC.md §bin/wait-probe — the instrument, its trial grammar, its closed cause list and its honest limit
3
+ # usage: wait-probe.sh <subcommand> [args] ('-h' or '--help' prints the subcommand roster; exit 2 on misuse)
4
+ set -euo pipefail
5
+
6
+ SCRATCH="${GATE_SDK_TMP_DIR:-.tmp}"
7
+ WORK="$SCRATCH/wait-probe"
8
+ EVIDENCE="${GATE_SDK_WORKFLOW_DIR:-.workflow}/wait-primitive-evidence.txt"
9
+ SWEEP_MS=(10000 100000 200000)
10
+
11
+ usage() {
12
+ cat <<'EOF'
13
+ usage: wait-probe.sh <subcommand> [args]
14
+
15
+ produce <key> <duration_ms> stand a producer up: sleep <duration_ms>, then write the marker.
16
+ Records its pid at launch in <scratch>/<key>.run.
17
+ waiter <key> <form> the wait body itself: until <marker>; do sleep 1; done.
18
+ Identical across every form; whoever arms it names the form.
19
+ arm-local <key> arm `waiter` as a detached shell child (the harness-uninvolved control).
20
+ record <key> <form> <ms> append one trial line for an armed-and-finished waiter.
21
+ report classify the recorded trials and print the verdict.
22
+ sweep the self-contained local run: produce + arm-local + record over the
23
+ declared duration sweep. This is the reproducer a second machine runs.
24
+
25
+ Scratch resolves through GATE_SDK_TMP_DIR; the evidence file through GATE_SDK_WORKFLOW_DIR.
26
+ EOF
27
+ }
28
+
29
+ now_ms() {
30
+ local t
31
+ t="$(date +%s%3N)"
32
+ case "$t" in
33
+ *[!0-9]*) t="$(date +%s)000" ;;
34
+ esac
35
+ printf '%s\n' "$t"
36
+ }
37
+
38
+ # spec: delegation-kit/SPEC.md §bin/wait-probe — the producer's own pid is recorded at launch and never logged in a trial line
39
+ cmd_produce() {
40
+ local key="$1" ms="$2" pid
41
+ mkdir -p "$WORK"
42
+ rm -f "$WORK/$key.marker" "$WORK/$key.t0" "$SCRATCH/$key.run"
43
+ now_ms > "$WORK/$key.t0"
44
+ nohup bash -c 'sleep "$(( $2 / 1000 ))"; date +%s%3N > "$1"' _ "$WORK/$key.marker" "$ms" \
45
+ >/dev/null 2>&1 &
46
+ pid=$!
47
+ printf 'pid=%s run=%s\n' "$pid" "$key" > "$SCRATCH/$key.run"
48
+ printf 'wait-probe: producer %s pid=%s duration_ms=%s marker=%s\n' "$key" "$pid" "$ms" "$WORK/$key.marker"
49
+ }
50
+
51
+ # spec: delegation-kit/SPEC.md §bin/wait-probe — one wait body for every form, so no form's result rests on a differently-shaped trial
52
+ cmd_waiter() {
53
+ local key="$1" form="$2" pred="${3:-marker}"
54
+ local marker="$WORK/$key.marker" hb="$WORK/$key.$form.hb"
55
+ local t0 ppid_rec alive
56
+ WAITER_ST="$WORK/$key.$form.st"
57
+ t0="$(cat "$WORK/$key.t0")"
58
+ ppid_rec="$(sed -n 's/^pid=\([0-9]*\) .*/\1/p' "$SCRATCH/$key.run")"
59
+ printf '%s\n' "$pred" > "$WORK/$key.$form.pred"
60
+ : > "$hb"
61
+ rm -f "$WAITER_ST"
62
+ trap 'printf "%s\n" "$?" > "$WAITER_ST"' EXIT
63
+ trap 'exit 143' TERM
64
+ trap 'exit 130' INT
65
+ trap 'exit 129' HUP
66
+ if [ "$pred" = liveness ]; then
67
+ until kill -0 "$ppid_rec" 2>/dev/null; do
68
+ waiter_beat "$t0" "$ppid_rec" "$hb"
69
+ sleep 1
70
+ done
71
+ else
72
+ until [ -f "$marker" ]; do
73
+ waiter_beat "$t0" "$ppid_rec" "$hb"
74
+ sleep 1
75
+ done
76
+ fi
77
+ waiter_beat "$t0" "$ppid_rec" "$hb"
78
+ printf 'wait-probe: condition true for %s (%s/%s)\n' "$key" "$form" "$pred"
79
+ }
80
+
81
+ waiter_beat() {
82
+ local t0="$1" ppid_rec="$2" hb="$3" alive=0
83
+ kill -0 "$ppid_rec" 2>/dev/null && alive=1
84
+ printf '%s %s\n' "$(( $(now_ms) - t0 ))" "$alive" > "$hb"
85
+ }
86
+
87
+ cmd_arm_local() {
88
+ local key="$1" pred="${2:-marker}" pid
89
+ nohup bash "$0" waiter "$key" local "$pred" > "$WORK/$key.local.out" 2>&1 &
90
+ pid=$!
91
+ printf 'pid=%s run=%s-local\n' "$pid" "$key" > "$SCRATCH/$key-local.run"
92
+ printf 'wait-probe: local waiter for %s pid=%s\n' "$key" "$pid"
93
+ }
94
+
95
+ cmd_record() {
96
+ local key="$1" form="$2" ms="$3"
97
+ local t0 marker="$WORK/$key.marker" hb="$WORK/$key.$form.hb" st="$WORK/$key.$form.st"
98
+ local marker_at="-" waiter_at="-" waiter_exit="killed" alive="-" class pred="marker"
99
+ [ -s "$WORK/$key.$form.pred" ] && pred="$(cat "$WORK/$key.$form.pred")"
100
+ t0="$(cat "$WORK/$key.t0")"
101
+ [ -f "$marker" ] && marker_at="$(( $(cat "$marker") - t0 ))"
102
+ if [ -s "$hb" ]; then
103
+ waiter_at="$(cut -d' ' -f1 < "$hb")"
104
+ alive="$(cut -d' ' -f2 < "$hb")"
105
+ fi
106
+ [ -s "$st" ] && waiter_exit="$(cat "$st")"
107
+ class="$(classify "$marker_at" "$waiter_at" "$waiter_exit" "$alive")"
108
+ mkdir -p "$(dirname "$EVIDENCE")"
109
+ printf 'form=%s predicate=%s producer_ms=%s waiter_exit=%s marker_at_ms=%s waiter_at_ms=%s producer_alive_at_exit=%s class=%s\n' \
110
+ "$form" "$pred" "$ms" "$waiter_exit" "$marker_at" "$waiter_at" "$alive" "$class" >> "$EVIDENCE"
111
+ tail -n 1 "$EVIDENCE"
112
+ }
113
+
114
+ # spec: delegation-kit/SPEC.md §bin/wait-probe — the closed cause list, 'unexplained' included, and (ii) is cross-trial so it is named by `report` and never by a line
115
+ classify() {
116
+ local marker_at="$1" waiter_at="$2" waiter_exit="$3" alive="$4"
117
+ if [ "$marker_at" != "-" ] && [ "$waiter_at" != "-" ] && [ "$waiter_at" -ge "$marker_at" ]; then
118
+ printf 'ok\n'; return
119
+ fi
120
+ if [ "$waiter_exit" = "0" ] && [ "$marker_at" = "-" ]; then
121
+ printf 'predicate\n'; return # (iii) clean zero, condition never expressible
122
+ fi
123
+ if [ "$alive" = "1" ] && [ "$waiter_exit" != "0" ]; then
124
+ printf 'reaped\n'; return # (i) died with the producer verifiably alive
125
+ fi
126
+ printf 'unexplained\n' # (iv)
127
+ }
128
+
129
+ # spec: delegation-kit/SPEC.md §bin/wait-probe — cause (ii)'s tell is a threshold across the sweep, so the report is the only reader that can see it
130
+ cmd_report() {
131
+ [ -s "$EVIDENCE" ] || { echo "wait-probe: no trials recorded in $EVIDENCE" >&2; return 1; }
132
+ printf '=== trials ===\n'
133
+ cat "$EVIDENCE"
134
+ printf '\n=== verdict ===\n'
135
+ awk '
136
+ { split($0, f, " "); for (i in f) { split(f[i], kv, "="); v[kv[1]] = kv[2] }
137
+ fo = v["form"]; pr = v["predicate"]; ms = v["producer_ms"] + 0; cls = v["class"]
138
+ cell = fo "/" pr
139
+ n[cell]++; forms[fo]; preds[pr]
140
+ if (cls == "ok") { okc[cell]++; if (ms > okmax[cell]) okmax[cell] = ms; okform[fo]++; okpred[pr]++ }
141
+ else { bad[cell]++; if (badmin[cell] == 0 || ms < badmin[cell]) badmin[cell] = ms
142
+ badform[fo]++; badpred[pr]++; badcls[cls]++ } }
143
+ END {
144
+ for (c in n) printf "%-18s %d trial(s), %d ok, %d early; longest clean wait=%dms\n",
145
+ c ":", n[c], okc[c], bad[c], okmax[c]
146
+ for (c in n) if (bad[c] && okc[c] && badmin[c] > okmax[c])
147
+ printf " ceiling tell HOLDS for %s: every early exit outlasts every clean wait (threshold between %dms and %dms) -> cause (ii)\n", c, okmax[c], badmin[c]
148
+ for (p in badpred) { np++; lastp = p }
149
+ for (fo in badform) nff++
150
+ for (fo in okform) nof++
151
+ if (np == 1 && nff > 1)
152
+ printf "\nEvery early exit carries predicate=%s, across %d of the %d forms measured, and no form is early on any other predicate.\nThe early exits are predicate-shaped, not form-shaped: the wait form is exonerated and the condition is the cause (iii).\n", lastp, nff, nof
153
+ else if (np == 0) printf "\nNo early exit recorded.\n"
154
+ else printf "\nEarly exits span %d predicate(s) and %d form(s) -- read the class column; no single-cause reading is licensed.\n", np, nff }
155
+ ' "$EVIDENCE"
156
+ }
157
+
158
+ cmd_sweep() {
159
+ local ms key
160
+ mkdir -p "$WORK"
161
+ for ms in "${SWEEP_MS[@]}"; do
162
+ key="sweep$ms"
163
+ cmd_produce "$key" "$ms"
164
+ cmd_arm_local "$key"
165
+ done
166
+ for ms in "${SWEEP_MS[@]}"; do
167
+ key="sweep$ms"
168
+ while kill -0 "$(sed -n 's/^pid=\([0-9]*\) .*/\1/p' "$SCRATCH/$key-local.run")" 2>/dev/null; do sleep 1; done
169
+ cmd_record "$key" local "$ms"
170
+ rm -f "$SCRATCH/$key.run" "$SCRATCH/$key-local.run"
171
+ done
172
+ cmd_report
173
+ }
174
+
175
+ case "${1:-}" in
176
+ produce) shift; [ $# -eq 2 ] || { usage >&2; exit 2; }; cmd_produce "$@" ;;
177
+ waiter) shift; [ $# -ge 2 ] && [ $# -le 3 ] || { usage >&2; exit 2; }; cmd_waiter "$@" ;;
178
+ arm-local) shift; [ $# -ge 1 ] && [ $# -le 2 ] || { usage >&2; exit 2; }; cmd_arm_local "$@" ;;
179
+ record) shift; [ $# -eq 3 ] || { usage >&2; exit 2; }; cmd_record "$@" ;;
180
+ report) shift; [ $# -eq 0 ] || { usage >&2; exit 2; }; cmd_report ;;
181
+ sweep) shift; [ $# -eq 0 ] || { usage >&2; exit 2; }; cmd_sweep ;;
182
+ -h|--help) usage ;;
183
+ *) usage >&2; exit 2 ;;
184
+ esac
@@ -0,0 +1,3 @@
1
+ # graph: couples=.claude/agents/*.md dir=one valve=none tier=precommit
2
+ # install: on-surface
3
+ # spec: delegation-kit/SPEC.md §check-agent-tier-explicit — every agent definition under the scanned directory declares a `model:` field in its frontmatter (an explicit `inherit` passes; only omission reds)
@@ -0,0 +1,3 @@
1
+ # graph: couples=kit:*.sh,native/src/gates/gate_tamper.rs dir=one valve=none tier=precommit
2
+ # install: zero-config
3
+ # spec: delegation-kit/SPEC.md §Verify after every agent commit — a gate-weakening commit is blocked by shape (A gate edits stay meta-isolated; B a new path-exemption can't excuse a co-staged file)
@@ -0,0 +1,3 @@
1
+ # graph: couples=delegation-kit/SPEC.md,delegation-kit/templates/agent-execution.md dir=one valve=none tier=precommit
2
+ # install: on-surface
3
+ # spec: delegation-kit/SPEC.md §One template, a resident pointer — every `the template's **<name>** rule` citation in SPEC §The delegation model resolves to a template bullet's bold lead-in (forward direction only)
@@ -0,0 +1,5 @@
1
+ # the second tamper shape, in the same commit as the first: a newly added path exemption that
2
+ # excuses a file staged beside it. `plain-token` is not path-shaped, so assertion B passes it
3
+ # over — the discrimination the one-violation case could not show.
4
+ call-service/src/*.rs
5
+ plain-token
@@ -1 +1,3 @@
1
1
  gate edit not isolated
2
+ self-serving exemption
3
+ call-service/src/*.rs -> call-service/src/lib.rs
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env bash
2
+ # Behavioral test of check-gate-tamper's LIVE arm — the one the good/bad pair cannot reach.
3
+ # The pair injects both lists through --fixture, so the function that reads a staged gate
4
+ # file's bytes out of the object store (`git show :<path>` against `git show HEAD:<path>`) is
5
+ # exercised by no fixture case at all, and assertion B's added-exemption derivation with it.
6
+ #
7
+ # Each case builds a throwaway git repo, stages a commit shape, and runs the gate inside it, so
8
+ # the corpus is a real index rather than an injected list.
9
+ #
10
+ # Run by run-gate-tests.sh (any <tests-dir>/*.test.sh; must exit 0).
11
+ set -uo pipefail
12
+ source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
13
+
14
+ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # delegation-kit/
15
+ CHECKS="$DIR/checks"
16
+
17
+ fails=0
18
+ tmp="$(mktemp -d)"
19
+ trap 'rm -rf "$tmp"' EXIT
20
+
21
+ # new_repo <name> — a git repo whose HEAD carries one gate file with one exemption element
22
+ new_repo() {
23
+ local d="$tmp/$1"
24
+ mkdir -p "$d/scripts" "$d/product"
25
+ git -C "$d" init -q
26
+ git -C "$d" config user.email tamper@example.invalid
27
+ git -C "$d" config user.name tamper
28
+ printf '#!/usr/bin/env bash\n# exception-list: the gate this repo already had\nEXEMPT=(\n "product/*.txt"\n)\n' \
29
+ >"$d/scripts/check-sample.sh"
30
+ printf 'seed\n' >"$d/README.md"
31
+ git -C "$d" add -A
32
+ git -C "$d" commit -q -m seed
33
+ printf '%s\n' "$d"
34
+ }
35
+
36
+ # case_run <name> <want> <expect> — the repo's index is already staged by the caller
37
+ case_run() {
38
+ local d="$1" name="$2" want="$3" expect="$4" out rc
39
+ out="$( cd "$d" && gate_run check-gate-tamper "$CHECKS" 2>&1 )"; rc=$?
40
+ if [[ "$rc" -ne "$want" ]]; then
41
+ echo " FAIL: $name expected exit $want, got $rc: $out"; fails=$((fails + 1)); return
42
+ fi
43
+ if ! grep -qF -- "$expect" <<<"$out"; then
44
+ echo " FAIL: $name exit OK but output lacks '$expect': $out"; fails=$((fails + 1))
45
+ fi
46
+ }
47
+
48
+ # A — a gate file staged with meta-layer paths only is clean, and the exemption its HEAD
49
+ # version already carries is not "added" even though a co-staged file would match it.
50
+ d="$(new_repo head-resident)"
51
+ printf 'x\n' >"$d/product/thing.txt"
52
+ printf 'note\n' >"$d/scripts/note.md"
53
+ git -C "$d" add scripts/note.md
54
+ case_run "$d" head-resident-exemption-is-not-added 0 "GATE-TAMPER: clean"
55
+
56
+ # B — the same repo, now staging the product file the HEAD-resident exemption matches: the
57
+ # exemption is still not new, so assertion B stays silent and only assertion A speaks.
58
+ d="$(new_repo a-not-b)"
59
+ printf 'x\n' >"$d/product/thing.txt"
60
+ printf '# edited\n' >>"$d/scripts/check-sample.sh"
61
+ git -C "$d" add product/thing.txt scripts/check-sample.sh
62
+ out="$( cd "$d" && gate_run check-gate-tamper "$CHECKS" 2>&1 )"
63
+ if ! grep -qF "gate edit not isolated" <<<"$out"; then
64
+ echo " FAIL: a-not-b did not report the isolation violation: $out"; fails=$((fails + 1))
65
+ fi
66
+ if grep -qF "self-serving exemption" <<<"$out"; then
67
+ echo " FAIL: a-not-b reported a HEAD-resident exemption as newly added: $out"; fails=$((fails + 1))
68
+ fi
69
+
70
+ # C — the byte reader proper: a *new* element appended to the staged blob of a gate file,
71
+ # matching a file staged in the same commit. Only `git show :<path>` sees it.
72
+ d="$(new_repo self-serving)"
73
+ printf '#!/usr/bin/env bash\n# exception-list: the gate this repo already had\nEXEMPT=(\n "product/*.txt"\n "product/*.md"\n)\n' \
74
+ >"$d/scripts/check-sample.sh"
75
+ printf 'y\n' >"$d/product/excused.md"
76
+ git -C "$d" add scripts/check-sample.sh product/excused.md
77
+ case_run "$d" a-newly-added-exemption-excusing-a-co-staged-file 1 "product/*.md -> product/excused.md"
78
+
79
+ # D — the same added element with nothing co-staged that it matches: assertion B is silent, so
80
+ # the derivation is not simply reporting every element it can parse.
81
+ d="$(new_repo added-but-unmatched)"
82
+ printf '#!/usr/bin/env bash\n# exception-list: the gate this repo already had\nEXEMPT=(\n "product/*.txt"\n "nowhere/*.md"\n)\n' \
83
+ >"$d/scripts/check-sample.sh"
84
+ git -C "$d" add scripts/check-sample.sh
85
+ out="$( cd "$d" && gate_run check-gate-tamper "$CHECKS" 2>&1 )"
86
+ if grep -qF "self-serving exemption" <<<"$out"; then
87
+ echo " FAIL: added-but-unmatched fired on an exemption matching nothing staged: $out"
88
+ fails=$((fails + 1))
89
+ fi
90
+
91
+ # E — an index with no gate file staged: assertion A never opens, so a non-meta path is fine.
92
+ d="$(new_repo no-gate-file)"
93
+ printf 'z\n' >"$d/product/thing.txt"
94
+ git -C "$d" add product/thing.txt
95
+ case_run "$d" a-commit-touching-no-gate-file 0 "1 staged path(s)"
96
+
97
+ # F — a staged *deletion* of a gate file: the staged blob does not exist, and the reader must
98
+ # treat that as no exemptions rather than as a failure to read.
99
+ d="$(new_repo staged-deletion)"
100
+ git -C "$d" rm -q scripts/check-sample.sh
101
+ case_run "$d" a-staged-gate-file-deletion 0 "GATE-TAMPER: clean"
102
+
103
+ if [[ "$fails" -gt 0 ]]; then
104
+ echo "check-gate-tamper.test: $fails assertion(s) failed"
105
+ exit 1
106
+ fi
107
+ echo "check-gate-tamper.test: ok (live arm: HEAD-resident exemptions excluded, a newly added one excusing a co-staged file rejected, an unmatched one silent, a gate-file deletion read as empty)"
108
+ exit 0
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env bash
2
+ # Behavioral test of templates/subagent-stop-liveness.sh — the SubagentStop probe.
3
+ # The two properties nothing else can assert: the exit is 0 on every path including the
4
+ # failure ones, and stdout stays empty (a byte on stdout would be hook JSON, which is the
5
+ # blocking variant by accident). The reader is driven by stub scripts, one per exit class,
6
+ # so every verdict arm is reached without a real producer.
7
+ #
8
+ # Run by run-gate-tests.sh (any <tests-dir>/*.test.sh; must exit 0).
9
+ set -uo pipefail
10
+ source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
11
+
12
+ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # delegation-kit/
13
+ HOOK="$DIR/templates/subagent-stop-liveness.sh"
14
+
15
+ fails=0
16
+ tmp="$(mktemp -d)"
17
+ trap 'rm -rf "$tmp"' EXIT
18
+
19
+ PAYLOAD='{"session_id":"s-1","transcript_path":"/x/y.jsonl","hook_event_name":"SubagentStop","stop_hook_active":false}'
20
+
21
+ stub() { # $1=name $2=exit-code
22
+ printf '#!/usr/bin/env bash\nexit %s\n' "$2" >"$tmp/$1"
23
+ printf '%s\n' "$tmp/$1"
24
+ }
25
+
26
+ # fire <name> <log> <reader> <run-dir> <payload> — runs the probe, asserting exit 0 and silent stdout
27
+ fire() {
28
+ local name="$1" log="$2" reader="$3" rundir="$4" payload="$5" out rc
29
+ out="$( printf '%s' "$payload" | DELEGATION_KIT_STOP_LOG="$log" \
30
+ DELEGATION_KIT_LIVENESS_CMD="$reader" GATE_SDK_TMP_DIR="$rundir" bash "$HOOK" 2>/dev/null )"
31
+ rc=$?
32
+ [[ "$rc" -eq 0 ]] || { echo " FAIL: $name exited $rc, not 0"; fails=$((fails + 1)); }
33
+ [[ -z "$out" ]] || { echo " FAIL: $name wrote '$out' to stdout; the probe emits no hook JSON"; fails=$((fails + 1)); }
34
+ }
35
+
36
+ want() { # $1=name $2=line $3.. = substrings the line must carry
37
+ local name="$1" line="$2"; shift 2
38
+ local s
39
+ for s in "$@"; do
40
+ grep -qF -- "$s" <<<"$line" || { echo " FAIL: $name line lacks '$s': $line"; fails=$((fails + 1)); }
41
+ done
42
+ }
43
+
44
+ runs="$tmp/runs"; mkdir -p "$runs"
45
+
46
+ # A — no reader at all (the knob emptied): the probe still logs, and says so rather than
47
+ # reporting a clean tree it never asked about.
48
+ log="$tmp/a.log"
49
+ fire no-reader "$log" "" "$runs" "$PAYLOAD"
50
+ want no-reader "$(cat "$log")" "event=SubagentStop" "session=s-1" "live=no" "verdict=unavailable" "records=0" "keys=session_id,transcript_path,hook_event_name,stop_hook_active"
51
+
52
+ # B/C/D — one firing per reader exit class, each with one record on disk so `records` is
53
+ # non-zero and a `live=no` is informative rather than vacuous.
54
+ printf 'pid=1 run=k\n' >"$runs/k.run"
55
+ for case_spec in "green 0 live=no" "red 1 live=yes" "corrupt 2 live=no"; do
56
+ read -r verdict code liveness <<<"$case_spec"
57
+ log="$tmp/$verdict.log"
58
+ fire "reader-$verdict" "$log" "$(stub "reader-$verdict" "$code")" "$runs" "$PAYLOAD"
59
+ want "reader-$verdict" "$(cat "$log")" "verdict=$verdict" "$liveness" "records=1"
60
+ done
61
+
62
+ # E — a reader that cannot be run at all (an unresolvable path) is the vendoring prerequisite
63
+ # failing, and it degrades to `unavailable` rather than to a wedged turn.
64
+ log="$tmp/e.log"
65
+ fire absent-reader "$log" "$tmp/nowhere/check.sh" "$runs" "$PAYLOAD"
66
+ want absent-reader "$(cat "$log")" "verdict=unavailable" "live=no"
67
+
68
+ # F — an unwritable log: the line cannot be recorded anywhere, so it is dropped silently and
69
+ # the turn still ends. This is the path where "record the failure where it can be" has
70
+ # nowhere left to record it.
71
+ printf 'not a directory\n' >"$tmp/blocker"
72
+ fire unwritable-log "$tmp/blocker/probe.log" "" "$runs" "$PAYLOAD"
73
+
74
+ # G — a payload whose values carry whitespace must not split the space-delimited line: the
75
+ # field count is the assertion, because a split is invisible in a substring match.
76
+ log="$tmp/g.log"
77
+ fire spacey-payload "$log" "" "$runs" '{"session_id":"a b\tc","hook_event_name":"Subagent Stop"}'
78
+ nf="$(awk '{print NF}' "$log")"
79
+ [[ "$nf" == "7" ]] || { echo " FAIL: spacey-payload produced $nf fields, want 7: $(cat "$log")"; fails=$((fails + 1)); }
80
+
81
+ # H — an empty payload (no stdin at all): the payload-derived fields degrade to '-' and the
82
+ # liveness half of the line is still bought.
83
+ log="$tmp/h.log"
84
+ fire empty-payload "$log" "$(stub reader-h 1)" "$runs" ""
85
+ want empty-payload "$(cat "$log")" "event=-" "session=-" "keys=-" "live=yes"
86
+
87
+ # I — one firing appends exactly one line, so the log is a firing count as well as a record.
88
+ log="$tmp/i.log"
89
+ fire append-1 "$log" "" "$runs" "$PAYLOAD"
90
+ fire append-2 "$log" "" "$runs" "$PAYLOAD"
91
+ lines="$(grep -c . "$log")"
92
+ [[ "$lines" == "2" ]] || { echo " FAIL: two firings wrote $lines line(s), want 2"; fails=$((fails + 1)); }
93
+
94
+ if [[ "$fails" -gt 0 ]]; then
95
+ echo "subagent-stop-liveness.test: $fails assertion(s) failed"
96
+ exit 1
97
+ fi
98
+ echo "subagent-stop-liveness.test: ok (exit 0 and silent stdout on every path; verdict green/red/corrupt/unavailable mapped; whitespace in a payload cannot split the line; one firing, one line)"
99
+ exit 0
@@ -59,5 +59,25 @@ cmp -s "$pp/usage.before" "$pp/usage.txt" || {
59
59
  echo "delegation-kit/smoke: poller fetch failure touched the snapshot" >&2; exit 1; }
60
60
  rm -rf "$pp"
61
61
 
62
+ # spec: delegation-kit/SPEC.md §The turn-end liveness probe (template) — the probe is exercised in place with a crafted payload: it must exit 0 and append exactly one grammar-conformant line, whatever the reader's verdict
63
+ sp="$PWD/.tmp/stop-probe-smoke"
64
+ rm -rf "$sp"; mkdir -p "$sp"
65
+ printf 'pid=1 run=smoke\n' > "$sp/smoke.run"
66
+ printf '{"session_id":"smoke","hook_event_name":"SubagentStop"}' | \
67
+ DELEGATION_KIT_STOP_LOG="$sp/probe.log" \
68
+ DELEGATION_KIT_LIVENESS_CMD="" \
69
+ GATE_SDK_TMP_DIR="$sp" \
70
+ bash "$SMOKE_KIT_ROOT/templates/subagent-stop-liveness.sh" || {
71
+ echo "delegation-kit/smoke: the SubagentStop probe did not exit 0" >&2; exit 1; }
72
+ probe_line="$(cat "$sp/probe.log")"
73
+ case "$probe_line" in
74
+ *"event=SubagentStop"*"session=smoke"*"live=no"*"verdict=unavailable"*"records=1"*"keys="*) ;;
75
+ *) echo "delegation-kit/smoke: probe line off grammar: $probe_line" >&2; exit 1 ;;
76
+ esac
77
+ if [[ "$(grep -c . "$sp/probe.log")" -ne 1 ]]; then
78
+ echo "delegation-kit/smoke: the probe wrote more than one line for one firing" >&2; exit 1
79
+ fi
80
+ rm -rf "$sp"
81
+
62
82
  bash "$SDK/bin/gen-pre-commit.sh" --write >/dev/null
63
- bash "$SDK/checks/check-graph.sh" --emit > scripts/CHECK-GRAPH.html
83
+ bash "$SDK/bin/run-gates.sh" --emit graph > scripts/CHECK-GRAPH.html
@@ -41,10 +41,78 @@ drift: do not delete it on sight, and when either rule changes here, propagate.
41
41
  ending the turn to wait for the completion notification — that is the one act
42
42
  that revokes the channel, which is how a *careful* reader reaches this
43
43
  failure. Wait **in-turn on a condition** instead: loop on the work's own
44
- artifact (evidence file, lock, exit marker) with the harness's waiting
45
- primitive. Never-poll governs waiting on an `Agent`'s completion notification,
46
- a channel a supervisor has; condition-waiting is the only one a dispatched
47
- role has.
44
+ artifact (evidence file, lock, exit marker). Never-poll governs waiting on an
45
+ `Agent`'s completion notification, a channel a supervisor has;
46
+ condition-waiting is the only one a dispatched role has.
47
+ **Which primitive — the one whose wait ends when the condition goes true, not
48
+ when a duration expires.** The harness offers two forms with different
49
+ reactivity, and the difference is exactly the wall-clock property this rule
50
+ exists to buy. **Background a command that *exits* on the condition** — a
51
+ `run_in_background` shell command wrapping `until <cond>; do sleep N; done` —
52
+ and it fires one notification the moment the condition holds, then ends: that
53
+ is the sanctioned form, and it holds that place on measurement rather than on
54
+ preference (delegation-kit/SPEC.md §bin/wait-probe). The harness's
55
+ **event-stream form**, armed with a command and a deadline, emits one event per
56
+ occurrence and stays armed to its deadline after the event fires **when the
57
+ command it was armed with is unbounded** — a `tail -f`, a `while true` — so
58
+ pointed at a single completion by way of such a command it converts a wait that
59
+ should end in seconds into one that ends at the timeout. Armed with a command
60
+ that *exits*, that watch ends too: it is the second choice for a single
61
+ completion, not a broken one, and it is named here because a reader told only
62
+ about the first form reaches for this one the next time the shape looks close.
63
+ Never a bare foreground `sleep`, which ends on neither.
64
+ **Get the loop's polarity right — the two rules in this bullet compose into a
65
+ trap, and it is the one that has actually fired.** `until` ends when its
66
+ condition becomes **true**, so `until` takes a *done* predicate:
67
+ `until [ -f <marker> ]; do sleep N; done`. Liveness is a *still-running*
68
+ predicate, so it takes `while`: `while kill -0 "$pid" 2>/dev/null; do sleep N;
69
+ done`. Composing "wrap `until <cond>`" with "loop on the recorded PID's
70
+ liveness" literally gives `until kill -0 "$pid"`, whose condition is true while
71
+ the producer is **alive** — so it exits at once. **The tell** is a waiter that
72
+ exited **zero**, in milliseconds, with its producer still running and its
73
+ condition never met. Four attested instances read as evidence against this
74
+ primitive until they were measured and found to be this instead; neither keyword
75
+ costs anything at the guard, which reads the loop's span and not its keyword.
76
+ **What you wait *on* splits two ways, and the split is what makes the artifact
77
+ reachable.** An **`Agent` dispatch** is awaited by its **completion
78
+ notification** — that record is the harness's, not the session's — so never go
79
+ looking for it on disk. A **shell child** has no notification channel of its
80
+ own, so it is awaited on an artifact *the session placed*, and that artifact is
81
+ named: **record the child's PID at launch**, one line in the form
82
+ `pid=<n> run=<key>`, in a file named **`<key>.run`** — the same `<key>`, so the
83
+ name carries no field the line does not — written where the **Resume journal —
84
+ agent writes, scratch reset sweeps** bullet below sends a journal, repo-local
85
+ gitignored scratch in the main checkout, on that bullet's stated survivability
86
+ grounds — widened here from the journal to any artifact a session waits on.
87
+ That record *is* the wait target: loop on its PID's liveness —
88
+ `while kill -0 "$pid" 2>/dev/null; do sleep N; done`, on the polarity rule above
89
+ — and the loop ends when the PID stops answering. Write it at the launch, not after, and leave it
90
+ behind — a completion marker answers *is it done* to a live observer, and the
91
+ case this rule exists for is the one where the observer is gone, where a
92
+ liveness record still answers *is it still running* to whoever arrives next.
93
+ Whoever that is reads it with `check-producer-liveness <record>` — or, because
94
+ the `.run` suffix makes the set a glob rather than a path someone must be told,
95
+ `check-producer-liveness <scratch-dir>` over all of them at once — unchanged
96
+ and already wired (evidence-kit/SPEC.md §check-producer-liveness), which is why
97
+ the record is in that gate's grammar rather than a shape of your own.
98
+ **Delete the record when its producer is done, and never before.** While one
99
+ names a live PID, a guard blocks every `git` command that writes the index, the
100
+ worktree or a ref (guard-kit/SPEC.md §The generic ruleset, rule 14) — a commit
101
+ taken under a live producer dirties the tree it is measuring and costs that
102
+ run's whole verdict. Deleting a record whose producer has exited is not a way
103
+ around the block: it is a statement of fact that has become false being
104
+ retracted.
105
+ **And never by pattern-matching the process table.** `pgrep -f '<pattern>'`
106
+ matches the waiter's own argv — the harness's wrapper argv matches too — so
107
+ `until ! pgrep -f '<script>'; do …; done` can never go false and never exits,
108
+ reddening nothing while it burns the whole foreground cap. Where liveness *is*
109
+ the condition, match a **recorded PID** (`while kill -0 "$pid" 2>/dev/null`) and never a pattern —
110
+ one rule, whoever started the producer, your own backgrounded child included: a
111
+ PID is an identity, a pattern is a guess about a process table that includes the
112
+ guesser. The
113
+ bracket-trick repair (`pgrep -f '[r]un-smoke.sh'`) is **not** the sanctioned
114
+ form, and its grounds for being refused are
115
+ delegation-kit/SPEC.md §The delegation model's.
48
116
  - **Serialize on shared files; ≤`DELEGATION_KIT_FAN_WIDTH`-wide otherwise.**
49
117
  Agents that edit a shared file (see the roster below) run one at a time —
50
118
  dispatch, await notification, verify, dispatch the next. Independent
@@ -197,6 +265,22 @@ drift: do not delete it on sight, and when either rule changes here, propagate.
197
265
  part that binds you: **a dispatcher handing out work that will need a mid-run
198
266
  channel grants a durable path with it**, and reads that path itself.
199
267
 
268
+ - **A finished child is addressed by the task-id its completion notification
269
+ carried, never by its name.** Resuming a returned agent to correct or extend
270
+ its work is the cheap alternative to a cold re-dispatch, and it is the one
271
+ that keeps the child's own reasoning instead of paying to rebuild it. The name
272
+ is not a durable address for that: measured here, a name live at dispatch
273
+ resolved to *no agent of that name is reachable* once the dispatching session
274
+ had been compacted, with the agent listing reporting none reachable at all,
275
+ while the task-id from the notification resumed the same child from its
276
+ transcript. Which of the two voids the name — the compaction, or the child
277
+ merely having finished — is untested; the task-id survived both, and the
278
+ notification states outright that it is the handle the child may notify under
279
+ again, so it is the address to hold. It is also the address to **write down**:
280
+ the notification lives in the context that dies, so a dispatcher who may want
281
+ that child later records the task-id under the durability rule below rather
282
+ than trusting the scroll to still be there.
283
+
200
284
  - **Findings you will act on are durable before you act on them.** A child's
201
285
  return value lives only in your context, and your context dies with your
202
286
  session. Before you *act* on a dispatched agent's findings — edit against
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env bash
2
+ # spec: delegation-kit/SPEC.md §The turn-end liveness probe (template) — a SubagentStop probe that logs one line per firing, emits no hook JSON, and exits 0 unconditionally
3
+ set -uo pipefail
4
+
5
+ LOG="${DELEGATION_KIT_STOP_LOG:-${GATE_SDK_WORKFLOW_DIR:-.workflow}/subagent-stop-liveness.log}"
6
+ # spec: delegation-kit/SPEC.md §The turn-end liveness probe (template) — the unset-form default, so an explicitly empty knob is the supported way to run with no reader at all
7
+ LIVENESS_CMD="${DELEGATION_KIT_LIVENESS_CMD-evidence-kit/checks/check-producer-liveness.sh}"
8
+ RUN_DIR="${GATE_SDK_TMP_DIR:-.tmp}"
9
+
10
+ # spec: delegation-kit/SPEC.md §The turn-end liveness probe (template) — every value is one whitespace-free token, so a payload string can never split the space-delimited line
11
+ sanitize() {
12
+ local v="${1//[[:space:]]/_}"
13
+ printf '%s' "${v:--}"
14
+ }
15
+
16
+ payload="$(cat 2>/dev/null)"
17
+
18
+ event='-'
19
+ session='-'
20
+ keys='-'
21
+ if [[ -n "$payload" ]] && command -v jq >/dev/null 2>&1; then
22
+ event="$(sanitize "$(printf '%s' "$payload" | jq -r '.hook_event_name // "-"' 2>/dev/null)")"
23
+ session="$(sanitize "$(printf '%s' "$payload" | jq -r '.session_id // "-"' 2>/dev/null)")"
24
+ keys="$(sanitize "$(printf '%s' "$payload" | jq -r 'keys_unsorted | join(",")' 2>/dev/null)")"
25
+ fi
26
+
27
+ shopt -s nullglob
28
+ records=("$RUN_DIR"/*.run)
29
+ shopt -u nullglob
30
+
31
+ verdict=unavailable
32
+ live=no
33
+ if [[ -n "$LIVENESS_CMD" && -r "$LIVENESS_CMD" ]]; then
34
+ # spec: delegation-kit/SPEC.md §The turn-end liveness probe (template) — the bounded call: a reader that hung would refuse the turn end by accident, which is the blocking variant this one is not
35
+ if command -v timeout >/dev/null 2>&1; then
36
+ timeout 10 bash "$LIVENESS_CMD" "$RUN_DIR" >/dev/null 2>&1
37
+ else
38
+ bash "$LIVENESS_CMD" "$RUN_DIR" >/dev/null 2>&1
39
+ fi
40
+ case "$?" in
41
+ 0) verdict=green ;;
42
+ 1) verdict=red; live=yes ;;
43
+ 2) verdict=corrupt ;;
44
+ *) verdict=unavailable ;;
45
+ esac
46
+ fi
47
+
48
+ ts="$(date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null)"
49
+ printf -v line '%s event=%s session=%s live=%s verdict=%s records=%s keys=%s' \
50
+ "${ts:--}" "$event" "$session" "$live" "$verdict" "${#records[@]}" "$keys"
51
+
52
+ logdir="${LOG%/*}"
53
+ [[ "$logdir" == "$LOG" || -d "$logdir" ]] || mkdir -p "$logdir" 2>/dev/null
54
+ { printf '%s\n' "$line" >> "$LOG"; } 2>/dev/null
55
+
56
+ exit 0
@@ -294,7 +294,7 @@ a sibling `*.test.sh` drives the extra-line, declared-trim, link-absent,
294
294
  craft-untagged, craft-malformed, and four fail-closed cases the one-pair harness
295
295
  cannot hold (fixture-pair); and registration in this repo's `gates.list` where
296
296
  its own always-loaded file is the scan target (self-lint). Positional form
297
- `check-doctrine-registration.sh [agent-file [doctrine-file]]` lets the fixtures
297
+ `check-doctrine-registration [agent-file [doctrine-file]]` lets the fixtures
298
298
  point at a synthetic agent and doctrine file.
299
299
 
300
300
  ## stage-rules
@@ -0,0 +1,3 @@
1
+ # graph: couples=CLAUDE.md,doctrine-kit/DOCTRINE.md dir=one valve=none tier=precommit
2
+ # install: zero-config
3
+ # spec: doctrine-kit/SPEC.md §check-doctrine-registration — the always-loaded agent file links the doctrine file and holds its methodology-rule digest in per-rule lockstep with DOCTRINE.md, fail-closed when a scanned file or section is missing