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
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env bash
2
+ # Behavioral test of check-reads-couples' .gate arm — the consumption path and the two
3
+ # refusals that survive it. The one good/bad pair cannot hold this arm: the pair models
4
+ # exit 0 and exit 1 against a shell source, while this arm needs a binary to answer
5
+ # `--reads` and its refusals are exit 2 by the fail-closed contract. With no .gate member
6
+ # registered anywhere in the tree the arm has no live instance, so without this file it
7
+ # would be an untested branch rather than the counted zero the clean line reports.
8
+ #
9
+ # Run by run-gate-tests.sh (any <tests-dir>/*.test.sh; must exit 0).
10
+ set -uo pipefail
11
+ source "$(dirname "${BASH_SOURCE[0]}")/../lib/test-hermetic.sh"
12
+
13
+ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
14
+ GATE="$ROOT/gate-sdk/checks/check-reads-couples.sh"
15
+ REAL_BIN="$ROOT/native/target/release/checkwright-gates"
16
+
17
+ fails=0
18
+ cases=0
19
+ tmp="$(mktemp -d)"
20
+ trap 'rm -rf "$tmp"' EXIT
21
+
22
+ MANIFEST='# graph: couples=corpus/*.md dir=one valve=none tier=precommit'
23
+
24
+ # Writes a stub binary that answers `--reads` with the given lines and refuses anything
25
+ # else — the shape the real binary has for a subcommand it carries.
26
+ make_stub() {
27
+ local path="$1" r; shift
28
+ {
29
+ echo '#!/usr/bin/env bash'
30
+ echo '[[ "${1:-}" == --reads ]] || exit 2'
31
+ for r in "$@"; do printf "echo '%s'\n" "$r"; done
32
+ echo 'exit 0'
33
+ } > "$path"
34
+ chmod +x "$path"
35
+ }
36
+
37
+ # $1=label $2=want-rc $3=want-substring $4=binary-path (case dir prepared by the caller)
38
+ run_case() {
39
+ local label="$1" want="$2" substr="$3" bin="$4" out rc
40
+ cases=$((cases + 1))
41
+ out="$( cd "$tmp/$label" && GATE_SDK_NATIVE_BIN="$bin" "$GATE" sandbox.gate 2>&1 )"; rc=$?
42
+ if [[ "$rc" -ne "$want" ]]; then
43
+ echo " FAIL [$label]: want exit $want, got $rc -- $out"; fails=$((fails + 1)); return
44
+ fi
45
+ if [[ -n "$substr" ]] && ! grep -qF -- "$substr" <<<"$out"; then
46
+ echo " FAIL [$label]: exit $rc OK but output lacks '$substr': $out"; fails=$((fails + 1))
47
+ fi
48
+ }
49
+
50
+ # Builds a case dir holding a descriptor, a tracked corpus, and a stub reporting $3...
51
+ make_case() {
52
+ local label="$1" descriptor="$2"; shift 2
53
+ local dir="$tmp/$label"
54
+ mkdir -p "$dir/corpus/sub"
55
+ printf '%s\n' "$descriptor" > "$dir/sandbox.gate"
56
+ : > "$dir/corpus/top.md"
57
+ : > "$dir/corpus/sub/deep.md"
58
+ make_stub "$dir/stub-bin" "$@"
59
+ ( cd "$dir" && git init -q . && git add -A ) >/dev/null 2>&1
60
+ }
61
+
62
+ # A — the reported root's tracked reads are covered. A couple naming both levels covers a
63
+ # recursive walk; this is the clean consumption path the refusal used to make unreachable.
64
+ make_case covered \
65
+ '# graph: couples=corpus/*.md,corpus/sub/*.md dir=one valve=none tier=precommit' corpus
66
+ run_case covered 0 '1 resolvable walk(s) covered' "$tmp/covered/stub-bin"
67
+
68
+ # B — the same reported root, a couple that stops one level short. Globs never cross '/',
69
+ # so the deeper tracked file is uncovered and the finding must name it.
70
+ make_case uncovered "$MANIFEST" corpus
71
+ run_case uncovered 1 "corpus/sub/deep.md" "$tmp/uncovered/stub-bin"
72
+
73
+ # C — a root the gate cannot bound statically. It is counted, never assumed empty: the
74
+ # clean line reports it in the same skip counter the shell arm's unresolvable roots use.
75
+ make_case unbounded "$MANIFEST" '?'
76
+ run_case unbounded 0 '1 undecidable walk(s) skipped-and-counted' "$tmp/unbounded/stub-bin"
77
+
78
+ # D — a descriptor claiming the removed opt-out. There is deliberately no descriptor-level
79
+ # exemption, so the uncovered read is still a finding: the line buys nothing.
80
+ make_case claimed_exemption \
81
+ "$MANIFEST
82
+ # reads-couples-exempt: the walks are covered elsewhere" corpus
83
+ run_case claimed_exemption 1 "corpus/sub/deep.md" "$tmp/claimed_exemption/stub-bin"
84
+
85
+ # E — surviving refusal one: a .gate member registered with no binary to ask. Exit 2, the
86
+ # same fail-closed shape check-gate-substrate-parity assertion B uses for this condition.
87
+ make_case no_binary "$MANIFEST" corpus
88
+ run_case no_binary 2 'absent' "$tmp/no_binary/nonexistent-bin"
89
+
90
+ # F — surviving refusal two: the binary is there but cannot answer for this member. A
91
+ # non-zero --reads must never read as "reads nothing".
92
+ make_case reads_fails "$MANIFEST" corpus
93
+ { echo '#!/usr/bin/env bash'; echo 'echo "no such gate subcommand" >&2'; echo 'exit 3'; } \
94
+ > "$tmp/reads_fails/broken-bin"
95
+ chmod +x "$tmp/reads_fails/broken-bin"
96
+ run_case reads_fails 2 'exited 3' "$tmp/reads_fails/broken-bin"
97
+
98
+ # G — the shell arm is unaffected: a .sh source with a covered walk still analyzes, so a
99
+ # refusal above cannot be passing for a parse failure.
100
+ mkdir -p "$tmp/shell/corpus"
101
+ : > "$tmp/shell/corpus/a.md"
102
+ printf '%s\n' \
103
+ "$MANIFEST" \
104
+ 'gate_find "corpus" -name '"'"'*.md'"'"' -type f' > "$tmp/shell/sandbox-gate.sh"
105
+ ( cd "$tmp/shell" && git init -q . && git add -A ) >/dev/null 2>&1
106
+ cases=$((cases + 1))
107
+ out="$( cd "$tmp/shell" && "$GATE" sandbox-gate.sh 2>&1 )"; rc=$?
108
+ if [[ "$rc" -ne 0 ]]; then
109
+ echo " FAIL [shell-arm]: want exit 0, got $rc -- $out"; fails=$((fails + 1))
110
+ elif ! grep -qF -- 'READS-COUPLES: clean' <<<"$out"; then
111
+ echo " FAIL [shell-arm]: exit 0 but not clean: $out"; fails=$((fails + 1))
112
+ fi
113
+
114
+ # H — the same consumption path against the *real* binary rather than a stub, so the
115
+ # reported grammar is the one the substrate actually emits. Skipped-and-named when the
116
+ # binary is absent: this file is hermetic and never builds, and a consumer tree has no
117
+ # crate to build from.
118
+ real_status="skipped (binary not built)"
119
+ if [[ -x "$REAL_BIN" ]]; then
120
+ mkdir -p "$tmp/real"
121
+ printf '%s\n' "$MANIFEST" > "$tmp/real/check-action-pinning.gate"
122
+ cases=$((cases + 1))
123
+ out="$( cd "$tmp/real" && GATE_SDK_NATIVE_BIN="$REAL_BIN" \
124
+ "$GATE" check-action-pinning.gate 2>&1 )"; rc=$?
125
+ real_status="run"
126
+ if [[ "$rc" -ne 0 ]]; then
127
+ echo " FAIL [real-binary]: want exit 0, got $rc -- $out"; fails=$((fails + 1))
128
+ elif ! grep -qF -- '1 undecidable walk(s) skipped-and-counted' <<<"$out"; then
129
+ echo " FAIL [real-binary]: exit 0 but the reported '?' was not counted: $out"
130
+ fails=$((fails + 1))
131
+ fi
132
+ fi
133
+
134
+ if [[ "$fails" -gt 0 ]]; then
135
+ echo "check-reads-couples.test.sh: $fails case(s) failed"
136
+ exit 1
137
+ fi
138
+ echo "check-reads-couples.test.sh: clean ($cases cases; real-binary case $real_status)"
139
+ exit 0
@@ -0,0 +1,4 @@
1
+ # Fixture registry — one plugin name per line, # comments (the gates.list
2
+ # grammar). The shipped set is alpha-kit/widgets/.
3
+ widget-one
4
+ widget-three
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ # Fixture artifact — never executed; only the basename is read.
3
+ exit 0
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ # Fixture artifact — never executed; only the basename is read.
3
+ exit 0
@@ -0,0 +1,4 @@
1
+ # Same anchoring as good/. alpha-kit's registry is one-sided in both
2
+ # directions at once: widget-two ships and is unregistered (assertion A),
3
+ # widget-three is registered and ships nothing (assertion B).
4
+ .
@@ -0,0 +1 @@
1
+ alpha-kit/templates/widgets.list does not register shipped artifact: widget-two
@@ -0,0 +1,5 @@
1
+ # shellcheck shell=bash
2
+ # Fixture config: make the sandbox kit the kit root, so gate_kit_roots
3
+ # resolves to this case dir (auto-sourced by lib/gate.sh at cwd) rather than
4
+ # the real repo. See gate-sdk/SPEC.md §Layout and configuration.
5
+ GATE_SDK_KIT_DIRS="alpha-kit"
@@ -0,0 +1,4 @@
1
+ # Fixture registry — one plugin name per line, # comments (the gates.list
2
+ # grammar). The shipped set is alpha-kit/widgets/.
3
+ widget-one
4
+ widget-two
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ # Fixture artifact — never executed; only the basename is read.
3
+ exit 0
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ # Fixture artifact — never executed; only the basename is read.
3
+ exit 0
@@ -0,0 +1,8 @@
1
+ # Anchor the sweep at this case dir: gate-sdk-config.sh (auto-sourced at cwd)
2
+ # names the synthetic kits via GATE_SDK_KIT_DIRS; their relative roots resolve
3
+ # against the positional root. alpha-kit is the in-population case — a .list
4
+ # template beside the directory whose artifacts it registers, in parity both
5
+ # ways. beta-kit carries the two structural exclusions: rules.list has no
6
+ # beta-kit/rules/ sibling (skipped-and-counted), and table.tsv is not a .list
7
+ # at all, so it never reaches the sibling test.
8
+ .
@@ -0,0 +1,5 @@
1
+ # Fixture template of consumer rule content: rows are the consumer's own
2
+ # vocabulary, not names of artifacts beta-kit ships — so there is no
3
+ # beta-kit/rules/ sibling and the template is out of population structurally.
4
+ some-rule-token
5
+ another-rule-token
@@ -0,0 +1,4 @@
1
+ # Fixture non-.list template: schema + placeholder rows the consumer fills.
2
+ # Excluded upstream of the sibling test by not being a .list at all.
3
+ key value
4
+ placeholder 0
@@ -0,0 +1 @@
1
+ clean (1 shipped registry template(s) in name-set parity with the sibling directory each registers; 1 .list template(s) with no such sibling skipped)
@@ -0,0 +1,5 @@
1
+ # shellcheck shell=bash
2
+ # Fixture config: make the sandbox kits the kit roots, so gate_kit_roots
3
+ # resolves to this case dir (auto-sourced by lib/gate.sh at cwd) rather than
4
+ # the real repo. See gate-sdk/SPEC.md §Layout and configuration.
5
+ GATE_SDK_KIT_DIRS="alpha-kit beta-kit"
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # Direct unit test of check-test-hermetic.sh assertion (B) via the --smoke mode.
2
+ # Direct unit test of check-test-hermetic assertion (B) via the --smoke mode.
3
3
  # The good/bad fixture pair stays on assertion (A) (the gate-tests bootstrap
4
4
  # scan), so the smoke credential-pin rule needs its own test: a
5
5
  # credential-managing smoke script whose own-kit bin call carries no *_CRED_FILE
@@ -12,7 +12,6 @@ set -uo pipefail
12
12
  source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
13
13
 
14
14
  DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # gate-sdk/
15
- GATE="$DIR/checks/check-test-hermetic.sh"
16
15
 
17
16
  fails=0
18
17
  tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
@@ -56,7 +55,7 @@ DEMO_KIT_CRED_FILE="$pp/creds.json" bash "$SMOKE_KIT_ROOT/bin/poller.sh"
56
55
  bash "$SMOKE_KIT_ROOT/bin/verdict.sh" "$snap"
57
56
  EOF
58
57
 
59
- run() { out="$("$GATE" --smoke "$1" 2>&1)"; rc=$?; }
58
+ run() { out="$(gate_run check-test-hermetic "$DIR/checks" --smoke "$1" 2>&1)"; rc=$?; }
60
59
 
61
60
  run "$tmp/good"
62
61
  [[ "$rc" -eq 0 ]] \
@@ -2,10 +2,10 @@
2
2
  # Direct unit test of gate-sdk/lib/declaration.sh — the two container arms and
3
3
  # the resolve/refuse trichotomy (gate-sdk/SPEC.md §lib/declaration.sh).
4
4
  #
5
- # Why a direct test: the record arm has no caller fixture to ride. Its only
6
- # caller is bin/upgrade-smoke.sh's untagged branch, and the smoke is a bin tool
7
- # whose contract forgoes a good/bad pair — so a corpus fixture would leave the
8
- # arm the standing pre-release assertion depends on entirely unexercised. The
5
+ # Why a direct test: bin/upgrade-smoke.sh's record-arm caller is a bin tool
6
+ # whose contract forgoes a good/bad pair, so this is that branch's runtime
7
+ # lock-in independent of scripts/check-tightened-gates-note-parity's own
8
+ # good/bad pair on the record arm (gate-sdk/SPEC.md §lib/declaration.sh). The
9
9
  # markdown arm's callers do carry fixtures; its status-2 and empty-section arms
10
10
  # are still checked here, being unreachable from a well-formed corpus.
11
11
  #
@@ -55,6 +55,30 @@ got="$(gate_find "$sandbox" -name '*.proto' | sed "s#^$sandbox/##" | sort | past
55
55
  [[ "$got" == 'a.proto,sub/b.proto' ]] \
56
56
  || { echo " FAIL: gate_find returned '$got' (want 'a.proto,sub/b.proto')"; fails=$((fails + 1)); }
57
57
 
58
+ # --- a live agent worktree is out of the walk -------------------------------
59
+ # The default carries the leaf basename `worktrees`, not the path `.claude/worktrees`:
60
+ # a basename matcher cannot match a slash, so the path spelling would silently
61
+ # restore the second-copy-of-the-repo the member exists to exclude.
62
+ mkdir -p "$sandbox/.claude/worktrees/agent-x" "$sandbox/.claude/commands"
63
+ : >"$sandbox/.claude/worktrees/agent-x/f.proto"; : >"$sandbox/.claude/commands/g.proto"
64
+ got="$(gate_find "$sandbox" -name '*.proto' | sed "s#^$sandbox/##" | sort | paste -sd, -)"
65
+ [[ "$got" == '.claude/commands/g.proto,a.proto,sub/b.proto' ]] \
66
+ || { echo " FAIL: worktree prune returned '$got' (want '.claude/commands/g.proto,a.proto,sub/b.proto')"; fails=$((fails + 1)); }
67
+
68
+ # --- GATE_SDK_PRUNE_EXTRA_DIRS appends to whichever set was resolved ---------
69
+ # Both branches, because the interaction with the replacing knob is the contract:
70
+ # an implementation appending only to the default passes the first case alone.
71
+ extra_probe() {
72
+ # shellcheck source=../lib/gate.sh
73
+ ( source "$DIR/lib/gate.sh"; printf '%s\n' "${GATE_PRUNE_DIRS[@]}" | paste -sd, - )
74
+ }
75
+ got="$(GATE_SDK_PRUNE_EXTRA_DIRS='vendor' extra_probe)"
76
+ [[ ",$got," == *",target,"* && ",$got," == *",vendor,"* ]] \
77
+ || { echo " FAIL: EXTRA_DIRS did not append to the default set (got '$got')"; fails=$((fails + 1)); }
78
+ got="$(GATE_SDK_PRUNE_DIRS='only' GATE_SDK_PRUNE_EXTRA_DIRS='vendor' extra_probe)"
79
+ [[ "$got" == 'only,vendor' ]] \
80
+ || { echo " FAIL: EXTRA_DIRS did not append to an explicit PRUNE_DIRS (got '$got', want 'only,vendor')"; fails=$((fails + 1)); }
81
+
58
82
  # --- registry + resolution (gate-sdk additions) -------------------------------
59
83
  list="$sandbox/gates.list"
60
84
  printf '# comment\n\ncheck-one\ncheck-two\n' > "$list"
@@ -70,9 +94,135 @@ got="$(gate_resolve check-one "$sandbox/a" "$sandbox/b")"
70
94
  gate_resolve check-missing "$sandbox/a" "$sandbox/b" >/dev/null \
71
95
  && { echo " FAIL: gate_resolve found a nonexistent gate"; fails=$((fails + 1)); }
72
96
 
97
+ # --- declaration path vs invocation argv (the .gate dispatch seam) ------------
98
+ : >"$sandbox/b/check-ported.gate"
99
+ got="$(gate_resolve check-ported "$sandbox/a" "$sandbox/b")"
100
+ [[ "$got" == "$sandbox/b/check-ported.gate" ]] \
101
+ || { echo " FAIL: gate_resolve did not find a .gate declaration (got '$got')"; fails=$((fails + 1)); }
102
+
103
+ # .sh beats .gate within a dir — the shadowing property the registry contract rests on
104
+ : >"$sandbox/b/check-both.sh"; : >"$sandbox/b/check-both.gate"
105
+ got="$(gate_resolve check-both "$sandbox/a" "$sandbox/b")"
106
+ [[ "$got" == "$sandbox/b/check-both.sh" ]] \
107
+ || { echo " FAIL: gate_resolve let .gate win inside a dir (got '$got')"; fails=$((fails + 1)); }
108
+
109
+ # an earlier dir's .gate still beats a later dir's .sh — dir order is the outer loop
110
+ : >"$sandbox/a/check-order.gate"; : >"$sandbox/b/check-order.sh"
111
+ got="$(gate_resolve check-order "$sandbox/a" "$sandbox/b")"
112
+ [[ "$got" == "$sandbox/a/check-order.gate" ]] \
113
+ || { echo " FAIL: gate_resolve broke consumer-first dir order (got '$got')"; fails=$((fails + 1)); }
114
+
115
+ # gate_command: a shell gate yields its one-element argv
116
+ got="$(gate_command check-one "$sandbox/a" "$sandbox/b" | paste -sd' ' -)"
117
+ [[ "$got" == "$sandbox/b/check-one.sh" ]] \
118
+ || { echo " FAIL: gate_command shell argv was '$got'"; fails=$((fails + 1)); }
119
+
120
+ # gate_command: a .gate member yields <binary> <name> when the binary is executable
121
+ printf '#!/bin/sh\n' > "$sandbox/fakebin"; chmod +x "$sandbox/fakebin"
122
+ got="$(GATE_SDK_NATIVE_BIN="$sandbox/fakebin" gate_command check-ported "$sandbox/a" "$sandbox/b" | paste -sd' ' -)"
123
+ [[ "$got" == "$sandbox/fakebin check-ported" ]] \
124
+ || { echo " FAIL: gate_command native argv was '$got'"; fails=$((fails + 1)); }
125
+
126
+ # fail-closed: an absent binary is exit 2, never a skip and never a pass
127
+ ( GATE_SDK_NATIVE_BIN="$sandbox/nope" gate_command check-ported "$sandbox/a" "$sandbox/b" >/dev/null 2>&1 )
128
+ [[ "$?" -eq 2 ]] \
129
+ || { echo " FAIL: gate_command did not exit 2 on an absent native binary"; fails=$((fails + 1)); }
130
+
131
+ # fail-closed: present but non-executable is the same harness error
132
+ : >"$sandbox/notexec"; chmod -x "$sandbox/notexec"
133
+ ( GATE_SDK_NATIVE_BIN="$sandbox/notexec" gate_command check-ported "$sandbox/a" "$sandbox/b" >/dev/null 2>&1 )
134
+ [[ "$?" -eq 2 ]] \
135
+ || { echo " FAIL: gate_command did not exit 2 on a non-executable native binary"; fails=$((fails + 1)); }
136
+
137
+ # --- the array-knob config bridge ---------------------------------------------
138
+ # A stand-in binary reporting whatever knob the case declares, and a stand-in kit
139
+ # whose library defines those knobs: the bridge's own refusals are unreachable
140
+ # through the live members, whose one knob is well formed by construction.
141
+ cat > "$sandbox/knobbin" <<'FAKE'
142
+ #!/usr/bin/env bash
143
+ [[ "$1" == --knobs ]] && { [[ -n "${PROBE_KNOB:-}" ]] && printf '%s\n' "$PROBE_KNOB"; exit 0; }
144
+ exit 0
145
+ FAKE
146
+ chmod +x "$sandbox/knobbin"
147
+ mkdir -p "$sandbox/probe-kit/lib" "$sandbox/probe-kit/checks"
148
+ cat > "$sandbox/probe-kit/lib/probe.sh" <<'PROBE'
149
+ # shellcheck shell=bash
150
+ PROBE_KIT_SPACED=(alpha "two words")
151
+ PROBE_KIT_SCALAR=solo
152
+ PROBE_KIT_TABBED=($'has\ttab')
153
+ PROBE_KIT_NEWLINED=($'has\nnewline')
154
+ PROBE
155
+ knob_argv() {
156
+ PROBE_KNOB="$1" GATE_SDK_KIT_DIRS="$sandbox/probe-kit" \
157
+ GATE_SDK_NATIVE_BIN="$sandbox/knobbin" \
158
+ gate_command check-ported "$sandbox/a" "$sandbox/b" 2>&1
159
+ }
160
+
161
+ # whitespace inside an element survives, which is the whole reason the serialization
162
+ # is tab-joined rather than the space-separated scalar shape it sits beside
163
+ got="$(knob_argv PROBE_KIT_SPACED | paste -sd'|' -)"
164
+ want="env|GATE_SDK_KNOB_PROBE_KIT_SPACED=alpha"$'\t'"two words|$sandbox/knobbin|check-ported"
165
+ [[ "$got" == "$want" ]] \
166
+ || { echo " FAIL: bridged argv was '$got' (want '$want')"; fails=$((fails + 1)); }
167
+
168
+ # a scalar knob is a one-element array — the two cases share one grammar
169
+ got="$(knob_argv PROBE_KIT_SCALAR | paste -sd'|' -)"
170
+ [[ "$got" == "env|GATE_SDK_KNOB_PROBE_KIT_SCALAR=solo|$sandbox/knobbin|check-ported" ]] \
171
+ || { echo " FAIL: scalar knob argv was '$got'"; fails=$((fails + 1)); }
172
+
173
+ # a member declaring no knob emits the two-element argv exactly as before the bridge
174
+ got="$(PROBE_KNOB="" GATE_SDK_KIT_DIRS="$sandbox/probe-kit" GATE_SDK_NATIVE_BIN="$sandbox/knobbin" \
175
+ gate_command check-ported "$sandbox/a" "$sandbox/b" | paste -sd'|' -)"
176
+ [[ "$got" == "$sandbox/knobbin|check-ported" ]] \
177
+ || { echo " FAIL: knobless argv gained an env prefix: '$got'"; fails=$((fails + 1)); }
178
+
179
+ # a knob matching no kit's <KIT>_ prefix resolves to gate-sdk itself, the kit every
180
+ # .gate dispatch already runs inside — GATE_PRUNE_DIRS is exactly that case, and the
181
+ # expected value is read from this process rather than restated as a second literal
182
+ want_prune="$(IFS=$'\t'; printf '%s' "${GATE_PRUNE_DIRS[*]}")"
183
+ got="$(knob_argv GATE_PRUNE_DIRS | sed -n '2p')"
184
+ [[ "$got" == "GATE_SDK_KNOB_GATE_PRUNE_DIRS=$want_prune" ]] \
185
+ || { echo " FAIL: prefixless knob did not fall back to gate-sdk: '$got'"; fails=$((fails + 1)); }
186
+
187
+ # the three refusals, each exit 2 naming the knob
188
+ for probe in TABBED:tab NEWLINED:newline; do
189
+ knob="PROBE_KIT_${probe%%:*}"; what="${probe##*:}"
190
+ out="$(knob_argv "$knob")"; rc=$?
191
+ [[ "$rc" -eq 2 ]] \
192
+ || { echo " FAIL: a $what in a knob element exited $rc, want 2"; fails=$((fails + 1)); }
193
+ grep -qF -- "knob $knob" <<<"$out" \
194
+ || { echo " FAIL: the $what refusal did not name $knob: $out"; fails=$((fails + 1)); }
195
+ done
196
+ out="$(knob_argv PROBE_KIT_ABSENT)"; rc=$?
197
+ [[ "$rc" -eq 2 ]] \
198
+ || { echo " FAIL: a knob no kit library defines exited $rc, want 2"; fails=$((fails + 1)); }
199
+ grep -qF -- 'PROBE_KIT_ABSENT' <<<"$out" \
200
+ || { echo " FAIL: the undeclared-knob refusal did not name the knob: $out"; fails=$((fails + 1)); }
201
+
202
+ # --- the knob-owner lookup drains its producer --------------------------------
203
+ # The candidate roots are read to EOF *before* the match loop, so an early prefix
204
+ # hit never leaves the producer writing into a closed pipe. The oracle is SIGPIPE
205
+ # *ignored* — the disposition a CI runner inherits from its supervisor — under
206
+ # which the abandoned write fails EPIPE and bash reports it on stderr. Under the
207
+ # default disposition the producer dies silently and the identical defect shows
208
+ # nothing, which is precisely why a green local battery could not see it; the
209
+ # `trap '' PIPE` is what makes this deterministic rather than environmental.
210
+ many="$sandbox/probe-kit"
211
+ for ((_i = 0; _i < 200; _i++)); do many="$many $sandbox/pad-kit"; done
212
+ owner_probe() {
213
+ ( trap '' PIPE
214
+ GATE_SDK_KIT_DIRS="$many" _gate_knob_owning_kit PROBE_KIT_SPACED "$@" )
215
+ }
216
+ got="$(owner_probe 2>&1 1>/dev/null)"
217
+ [[ -z "$got" ]] \
218
+ || { echo " FAIL: _gate_knob_owning_kit abandoned its producer: $got"; fails=$((fails + 1)); }
219
+ got="$(owner_probe 2>/dev/null)"
220
+ [[ "$got" == "$sandbox/probe-kit" ]] \
221
+ || { echo " FAIL: knob owner was '$got' (want '$sandbox/probe-kit')"; fails=$((fails + 1)); }
222
+
73
223
  if [[ "$fails" -gt 0 ]]; then
74
224
  echo "lib-gate.test: $fails assertion(s) failed"
75
225
  exit 1
76
226
  fi
77
- echo "lib-gate.test: ok (fail_closed branches; gate_path_pruned; GATE_GREP_EXCLUDES; gate_find prune; registry + resolution)"
227
+ echo "lib-gate.test: ok (fail_closed branches; gate_path_pruned; GATE_GREP_EXCLUDES; gate_find prune incl. the worktrees leaf; PRUNE_EXTRA_DIRS append over both branches; registry + resolution; .gate declaration/argv split + dispatch fail-closed; the knob bridge's serialization, scalar/knobless/prefixless arms and its three refusals; the knob-owner lookup draining its producer on an early match under SIGPIPE-ignored)"
78
228
  exit 0
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env bash
2
+ # spec: gate-sdk/SPEC.md §run-gates — end-to-end lock-in for the dispatch
3
+ # capture's stream separation: `gate_command`'s stdout *is* the invocation argv,
4
+ # its stderr is diagnostic text, and a diagnostic written by a *successful* call
5
+ # must never become argv[0] and be exec'd. Both arms run over a hermetic scratch
6
+ # registry and are deterministic by construction — a stand-in kit library that
7
+ # writes to stderr while still resolving its knob reproduces the shape without
8
+ # reproducing the SIGPIPE-disposition accident that first exposed it.
9
+ # Run by run-gate-tests.sh.
10
+ set -uo pipefail
11
+ source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
12
+
13
+ ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
14
+ RUN="$ROOT/gate-sdk/bin/run-gates.sh"
15
+ [[ -x "$RUN" ]] || { echo "run-dispatch-streams.test: runner not found: $RUN"; exit 2; }
16
+
17
+ scratch="$(mktemp -d)"
18
+ trap 'rm -rf "$scratch"' EXIT
19
+
20
+ fails=0
21
+ assert_has() { grep -qF -- "$2" <<<"$3" || { echo "FAIL [$1]: expected present: $2"; fails=$((fails + 1)); }; }
22
+ assert_absent() { grep -qF -- "$2" <<<"$3" && { echo "FAIL [$1]: expected absent: $2"; fails=$((fails + 1)); }; return 0; }
23
+
24
+ # A .gate member dispatching to a stand-in binary that answers --knobs, then
25
+ # reports the bridged value so the argv is observed end to end.
26
+ printf '# graph: couples=cfg dir=one valve=none tier=precommit trigger=*\n' \
27
+ > "$scratch/check-noisy.gate"
28
+ cat > "$scratch/bin" <<'BIN'
29
+ #!/usr/bin/env bash
30
+ [[ "${1:-}" == --knobs ]] && { printf 'PROBE_KIT_VALUE\n'; exit 0; }
31
+ printf 'check-noisy ran knob=[%s]\n' "${GATE_SDK_KNOB_PROBE_KIT_VALUE:-}"
32
+ exit 0
33
+ BIN
34
+ chmod +x "$scratch/bin"
35
+
36
+ # The stand-in kit whose library resolves the knob *and* writes to stderr while
37
+ # doing it: a gate_command that exits 0 with non-empty stderr, which is exactly
38
+ # the shape a merged capture turns into argv[0].
39
+ mkdir -p "$scratch/probe-kit/lib" "$scratch/probe-kit/checks"
40
+ cat > "$scratch/probe-kit/lib/probe.sh" <<'PROBE'
41
+ # shellcheck shell=bash
42
+ printf 'probe-kit: a diagnostic on stderr, exit status still 0\n' >&2
43
+ PROBE_KIT_VALUE=resolved
44
+ PROBE
45
+ printf 'check-noisy\n' > "$scratch/gates.list"
46
+
47
+ run_battery() {
48
+ GATE_SDK_GATES_DIR="$scratch" GATE_SDK_KIT_DIRS="$scratch/probe-kit" \
49
+ GATE_SDK_NATIVE_BIN="$1" GATE_SDK_TMP_DIR="$scratch/.tmp" \
50
+ GATE_SDK_VERBOSE=1 bash "$RUN" 2>&1
51
+ }
52
+
53
+ # Arm 1 — stderr on a successful dispatch: argv comes from stdout alone, so the
54
+ # gate runs with its bridged knob and the diagnostic is not executed.
55
+ out="$(run_battery "$scratch/bin")"; rc=$?
56
+ assert_has stdout-argv 'check-noisy ran knob=[resolved]' "$out"
57
+ assert_has stdout-argv 'All 1 gates passed.' "$out"
58
+ assert_absent stdout-argv 'exit 127' "$out"
59
+ assert_absent stdout-argv 'FAIL: check-noisy' "$out"
60
+ [[ "$rc" -eq 0 ]] || { echo "FAIL [stdout-argv]: expected exit 0, got $rc"; fails=$((fails + 1)); }
61
+
62
+ # Arm 2 — the stderr the split must not discard: an absent binary is
63
+ # gate_command's exit 2, whose diagnostic body is stderr. Deleting the capture
64
+ # rather than splitting it would silently empty this report.
65
+ out="$(run_battery "$scratch/absent-bin")"; rc=$?
66
+ assert_has dispatch-err 'dispatch harness error, exit 2' "$out"
67
+ assert_has dispatch-err 'absent or not executable' "$out"
68
+ assert_has dispatch-err 'build-native.sh' "$out"
69
+ [[ "$rc" -eq 1 ]] || { echo "FAIL [dispatch-err]: expected exit 1, got $rc"; fails=$((fails + 1)); }
70
+
71
+ [[ "$fails" -eq 0 ]] || { echo "run-dispatch-streams.test: $fails assertion(s) failed"; exit 1; }
72
+ echo "run-dispatch-streams.test: clean (argv taken from stdout alone with stderr present on a successful dispatch; the exit-2 diagnostic body still reaches the report)"
73
+ exit 0