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,144 @@
1
+ #!/usr/bin/env bash
2
+ # Direct unit test of gate-sdk/bin/run-gate-tests.sh's expect.txt semantics —
3
+ # every non-blank line of an expect file is a separate assertion, and a case
4
+ # fails when any one of them is absent. A fixture pair cannot cover this: the
5
+ # runner is a bin/ tool, never a gates.list member, so it owes no good/+bad/
6
+ # pair, and a pair here would sit outside check-gate-fixture-coverage's registry
7
+ # authority set and be audited by nothing.
8
+ #
9
+ # The self-invocation is bounded: each inner run is handed a scratch TESTS_DIR
10
+ # holding fixture dirs and no *.test.sh, so it runs pairs and returns. Do not
11
+ # let the scratch tree acquire one.
12
+ #
13
+ # Run by run-gate-tests.sh (any <tests-dir>/*.test.sh; must exit 0).
14
+ set -uo pipefail
15
+ source "$(dirname "${BASH_SOURCE[0]}")/../../gate-sdk/lib/test-hermetic.sh"
16
+
17
+ ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
18
+ RUN="$ROOT/gate-sdk/bin/run-gate-tests.sh"
19
+ [[ -x "$RUN" ]] || { echo "run-gate-tests.test: runner not found: $RUN"; exit 2; }
20
+
21
+ scratch="$(mktemp -d)"
22
+ trap 'rm -rf "$scratch"' EXIT
23
+
24
+ mkdir -p "$scratch/checks"
25
+ # The stub gate replays a case dir's own say/rc files, so each case dictates the
26
+ # output and exit status run_case sees.
27
+ { printf '#!/usr/bin/env bash\n'
28
+ printf 'cat ./say\n'
29
+ printf 'exit "$(cat ./rc)"\n'
30
+ } > "$scratch/checks/stub-gate.sh"
31
+ chmod +x "$scratch/checks/stub-gate.sh"
32
+
33
+ # mk_tree <name> <good-say> <good-expect> <bad-say> <bad-expect>; an empty
34
+ # good-expect ships no good/expect.txt (the optional side of the asymmetry).
35
+ # Each say gets the output-contract line its exit code owes (§Output contract,
36
+ # asserted at runtime by run_case) appended, so these rows keep testing the
37
+ # expect.txt conjunction rather than doubling as output-contract cases.
38
+ mk_tree() {
39
+ local name="$1" good_say="$2" good_expect="$3" bad_say="$4" bad_expect="$5"
40
+ local dir="$scratch/$name/stub-gate"
41
+ mkdir -p "$dir/good" "$dir/bad"
42
+ printf '%s\nSTUB-GATE: clean (stub)\n' "$good_say" > "$dir/good/say"
43
+ printf '0\n' > "$dir/good/rc"
44
+ [[ -n "$good_expect" ]] && printf '%s\n' "$good_expect" > "$dir/good/expect.txt"
45
+ printf '%s\n help: stub remedy\n' "$bad_say" > "$dir/bad/say"
46
+ printf '1\n' > "$dir/bad/rc"
47
+ printf '%s\n' "$bad_expect" > "$dir/bad/expect.txt"
48
+ echo "$scratch/$name"
49
+ }
50
+
51
+ run_tree() { bash "$RUN" "$1" "$scratch/checks" 2>&1; }
52
+
53
+ fails=0
54
+ assert_has() { grep -qF -- "$2" <<<"$3" || { echo "FAIL [$1]: expected present: $2"; fails=$((fails + 1)); }; }
55
+ assert_absent() { grep -qF -- "$2" <<<"$3" && { echo "FAIL [$1]: expected absent: $2"; fails=$((fails + 1)); }; return 0; }
56
+ assert_rc() { [[ "$2" -eq "$3" ]] || { echo "FAIL [$1]: expected exit $3, got $2"; fails=$((fails + 1)); }; }
57
+
58
+ # Row 1 — the unit: two expect lines, the gate prints only the first. Under the
59
+ # disjunction this passed; the second line must now be reported missing.
60
+ t="$(mk_tree first-only 'good ok' '' 'alpha fired' $'alpha fired\nbeta fired')"
61
+ out="$(run_tree "$t")"; rc=$?
62
+ assert_rc first-only "$rc" 1
63
+ assert_has first-only 'missing: beta fired' "$out"
64
+ assert_absent first-only 'missing: alpha fired' "$out"
65
+
66
+ # Row 3 — the symmetric half: only the second line prints. A fix that checked
67
+ # just the first line would pass row 1 and leave the defect live here.
68
+ t="$(mk_tree second-only 'good ok' '' 'beta fired' $'alpha fired\nbeta fired')"
69
+ out="$(run_tree "$t")"; rc=$?
70
+ assert_rc second-only "$rc" 1
71
+ assert_has second-only 'missing: alpha fired' "$out"
72
+ assert_absent second-only 'missing: beta fired' "$out"
73
+
74
+ # Row 2 — both lines print: the conjunction is satisfied, order irrelevant (the
75
+ # gate prints them in the reverse of the expect file's order).
76
+ t="$(mk_tree both 'good ok' '' $'beta fired\nalpha fired' $'alpha fired\nbeta fired')"
77
+ out="$(run_tree "$t")"; rc=$?
78
+ assert_rc both "$rc" 0
79
+ assert_has both 'GATE-TESTS: clean' "$out"
80
+
81
+ # Row 4 — the single-line case is untouched: the tightening must not regress the
82
+ # shape nearly every tracked expect file uses.
83
+ t="$(mk_tree single 'good ok' '' 'alpha fired' 'alpha fired')"
84
+ out="$(run_tree "$t")"; rc=$?
85
+ assert_rc single "$rc" 0
86
+ assert_has single 'GATE-TESTS: clean' "$out"
87
+
88
+ # Row 5 — a blank line between two real ones asserts nothing: it is a separator,
89
+ # and reporting it as a pin would name an empty missing line.
90
+ t="$(mk_tree blank 'good ok' '' $'alpha fired\nbeta fired' $'alpha fired\n\nbeta fired')"
91
+ out="$(run_tree "$t")"; rc=$?
92
+ assert_rc blank "$rc" 0
93
+ assert_has blank 'GATE-TESTS: clean' "$out"
94
+ assert_absent blank 'missing: ' "$out"
95
+
96
+ # Row 6 — good/expect.txt reads identically: optional to supply, conjunctive
97
+ # once supplied.
98
+ t="$(mk_tree good-side 'gamma ok' $'gamma ok\ndelta ok' 'alpha fired' 'alpha fired')"
99
+ out="$(run_tree "$t")"; rc=$?
100
+ assert_rc good-side "$rc" 1
101
+ assert_has good-side 'missing: delta ok' "$out"
102
+
103
+ # Every missing line is named in one run: an author fixing one pin per re-run is
104
+ # the same under-assertion defect at a smaller scale.
105
+ t="$(mk_tree all-missing 'good ok' '' 'alpha fired' $'alpha fired\nbeta fired\ngamma fired')"
106
+ out="$(run_tree "$t")"; rc=$?
107
+ assert_rc all-missing "$rc" 1
108
+ assert_has all-missing 'missing: beta fired' "$out"
109
+ assert_has all-missing 'missing: gamma fired' "$out"
110
+
111
+ # The output contract, asserted at runtime rather than by grepping a gate's
112
+ # source (§Output contract). A clean case that satisfies every expect line but
113
+ # emits no canonical clean line is still a failure — this is the assertion that
114
+ # survives a gate's source becoming a compiled subcommand there is nothing to
115
+ # grep.
116
+ mk_no_clean_line() {
117
+ local dir="$scratch/no-clean/stub-gate"
118
+ mkdir -p "$dir/good" "$dir/bad"
119
+ printf 'gamma ok\n' > "$dir/good/say"; printf '0\n' > "$dir/good/rc"
120
+ printf 'gamma ok\n' > "$dir/good/expect.txt"
121
+ printf 'alpha fired\n help: stub remedy\n' > "$dir/bad/say"; printf '1\n' > "$dir/bad/rc"
122
+ printf 'alpha fired\n' > "$dir/bad/expect.txt"
123
+ echo "$scratch/no-clean"
124
+ }
125
+ out="$(run_tree "$(mk_no_clean_line)")"; rc=$?
126
+ assert_rc no-clean "$rc" 1
127
+ assert_has no-clean "emitted no '<NAME>: clean" "$out"
128
+
129
+ # The symmetric half: a violating case with no help: remedy line.
130
+ mk_no_help_line() {
131
+ local dir="$scratch/no-help/stub-gate"
132
+ mkdir -p "$dir/good" "$dir/bad"
133
+ printf 'STUB-GATE: clean (stub)\n' > "$dir/good/say"; printf '0\n' > "$dir/good/rc"
134
+ printf 'alpha fired\n' > "$dir/bad/say"; printf '1\n' > "$dir/bad/rc"
135
+ printf 'alpha fired\n' > "$dir/bad/expect.txt"
136
+ echo "$scratch/no-help"
137
+ }
138
+ out="$(run_tree "$(mk_no_help_line)")"; rc=$?
139
+ assert_rc no-help "$rc" 1
140
+ assert_has no-help "no 'help:' remedy line" "$out"
141
+
142
+ [[ "$fails" -eq 0 ]] || { echo "run-gate-tests.test: $fails assertion(s) failed"; exit 1; }
143
+ echo "run-gate-tests.test: clean (expect.txt is a per-line conjunction, order-independent, blanks inert, all missing lines named; the output contract is asserted at runtime on both cases)"
144
+ exit 0
@@ -1,13 +1,48 @@
1
1
  # shellcheck shell=bash
2
2
  # spec: gate-sdk/SPEC.md §Consumer smoke — the shared scratch-consumer builder both smoke harnesses vendor through (run-consumer-smoke.sh and context-kit/smoke/agents-md.sh)
3
3
 
4
- # spec: gate-sdk/SPEC.md §Consumer smoke — csmoke_vendor_and_install: from the kit roots (gate-sdk first) sets SCRATCH + CSMOKE_INSTALLED; returns 2 on an environment failure; the caller owns cleanup and every post-baseline assertion
5
- csmoke_vendor_and_install() {
6
- local roots=("$@") r kit
4
+ # spec: gate-sdk/SPEC.md §Consumer smoke — csmoke_gate_descriptors: the one derivation of whether a kit set needs the binary at all, so a caller that must produce one before it can name a source tree asks the same question the placement asks
5
+ csmoke_gate_descriptors() { # $@ = vendorable kit roots -> the number of .gate descriptors under them
6
+ local n=0 r
7
+ shopt -s nullglob
8
+ for r in "$@"; do
9
+ for _ in "$r"/checks/*.gate; do n=$((n + 1)); done
10
+ done
11
+ shopt -u nullglob
12
+ printf '%s\n' "$n"
13
+ }
14
+
15
+ # spec: gate-sdk/SPEC.md §Consumer smoke — csmoke_place_binary: the vendored kit roots' descriptor set decides whether the scratch consumer needs the gate binary, and the caller names the checkout whose artifact it receives — a library resolving that from its own location hands every caller the invoking tree's binary, which is the pairing defect that made upgrade-smoke run one ref's shell against another's binary. Derived, so a kit set with no ported gate asks for nothing.
16
+ csmoke_place_binary() { # $1 = the checkout whose native/ was built, $2.. = vendorable kit roots
17
+ local host="$1" bin descriptors
18
+ shift
19
+ bin="$(gate_native_bin)"
20
+ descriptors="$(csmoke_gate_descriptors "$@")"
21
+ [[ "$descriptors" -gt 0 ]] || return 0
22
+
23
+ [[ -n "$host" ]] || {
24
+ echo "csmoke: $descriptors vendored .gate descriptor(s) need the gate binary and the caller named no checkout to take one from" >&2
25
+ return 2
26
+ }
27
+ [[ -x "$host/$bin" ]] || {
28
+ echo "csmoke: $descriptors vendored .gate descriptor(s) need the gate binary, but $host/$bin is absent or not executable" >&2
29
+ echo " help: build it — bash gate-sdk/bin/build-native.sh — then re-run." >&2
30
+ return 2
31
+ }
32
+ mkdir -p "$SCRATCH/${bin%/*}" || return 2
33
+ cp "$host/$bin" "$SCRATCH/$bin" || return 2
34
+ }
35
+
36
+ # spec: gate-sdk/SPEC.md §Consumer smoke — csmoke_vendor_and_install: from the binary's source checkout and the kit roots (gate-sdk first) sets SCRATCH + CSMOKE_INSTALLED; returns 2 on an environment failure; the caller owns cleanup and every post-baseline assertion
37
+ csmoke_vendor_and_install() { # $1 = the checkout whose native/ was built, $2.. = kit roots
38
+ local host="$1" roots r kit
39
+ shift
40
+ roots=("$@")
7
41
  SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/consumer-smoke.XXXXXX")" || return 2
8
42
 
9
43
  git -C "$SCRATCH" init -q
10
- printf '.tmp/\n' > "$SCRATCH/.gitignore"
44
+ # spec: gate-sdk/SPEC.md §Consumer smoke — the placed binary is ignored rather than tracked: the violation phase restores with `git clean -fd`, which spares ignored paths, so an artifact the tree needs across restores may not be untracked-and-visible
45
+ printf '.tmp/\n%s\n' "$(gate_native_bin)" > "$SCRATCH/.gitignore"
11
46
  git -C "$SCRATCH" add -A
12
47
  git -C "$SCRATCH" -c user.email=smoke@example.invalid -c user.name=smoke \
13
48
  commit -q --allow-empty -m "seed"
@@ -16,6 +51,8 @@ csmoke_vendor_and_install() {
16
51
  cp -R "$r" "$SCRATCH/$(basename "$r")"
17
52
  done
18
53
 
54
+ csmoke_place_binary "$host" "${roots[@]}" || return 2
55
+
19
56
  CSMOKE_INSTALLED=0
20
57
  for r in "${roots[@]}"; do
21
58
  kit="$(basename "$r")"
@@ -32,8 +32,17 @@ fail_closed() {
32
32
  if [[ -n "${GATE_SDK_PRUNE_DIRS:-}" ]]; then
33
33
  read -r -a GATE_PRUNE_DIRS <<<"$GATE_SDK_PRUNE_DIRS"
34
34
  else
35
- GATE_PRUNE_DIRS=(target .git node_modules .tmp gate-tests)
35
+ GATE_PRUNE_DIRS=(target .git node_modules .tmp gate-tests worktrees)
36
36
  fi
37
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — GATE_SDK_PRUNE_EXTRA_DIRS appends to the resolved set whichever branch produced it, so a consumer adds one directory without copying the default
38
+ for _gpx in ${GATE_SDK_PRUNE_EXTRA_DIRS:-}; do GATE_PRUNE_DIRS+=("$_gpx"); done
39
+ unset _gpx
40
+
41
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — check-kit-registration's two document knobs, resolved here rather than inline in the check so the config bridge can carry them: a knob the owning kit's library does not define is the bridge's third refusal, so a compiled member declaring either would fail-close on every invocation. Resolved under their own consumer names (the queue-kit shape) rather than renamed the way GATE_PRUNE_DIRS is: that rename exists because a whitespace scalar feeds an array and one name would mean two grammars, and these are scalars in and scalars out.
42
+ [[ -v GATE_SDK_REGISTRY_DOC ]] || GATE_SDK_REGISTRY_DOC="README.md"
43
+ [[ -v GATE_SDK_RUNNER_DOC ]] || GATE_SDK_RUNNER_DOC="README.md"
44
+ # spec: gate-sdk/SPEC.md §The workflow directory — the same resolution for the workflow directory, and for the same reason: the governed-comment corpus takes its tracked tier, so a compiled member reading that corpus declares this knob and the bridge can only carry a value some kit library defines
45
+ [[ -v GATE_SDK_WORKFLOW_DIR ]] || GATE_SDK_WORKFLOW_DIR=".workflow"
37
46
 
38
47
  gate_find() {
39
48
  local prune=() d
@@ -47,6 +56,12 @@ GATE_GREP_EXCLUDES=()
47
56
  for _gpd in "${GATE_PRUNE_DIRS[@]}"; do GATE_GREP_EXCLUDES+=(--exclude-dir="$_gpd"); done
48
57
  unset _gpd
49
58
 
59
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — the programs the payload is entitled to assume present, so a command-position word in this set is not a criterion-7 requirement; git is on it because §The port-candidate criteria already rules it the one sanctioned exception, "because it is the floor"
60
+ declare -p GATE_SDK_PROGRAM_FLOOR &>/dev/null \
61
+ || GATE_SDK_PROGRAM_FLOOR=(awk basename bash cat cd chmod cmp comm cp cut date diff dirname
62
+ env find git grep head ln ls mkdir mktemp mv printf pwd realpath rm sed sh sort tail tee
63
+ touch tr uniq wc xargs)
64
+
50
65
  gate_path_pruned() {
51
66
  local p="$1" d
52
67
  for d in "${GATE_PRUNE_DIRS[@]}"; do
@@ -67,6 +82,7 @@ gates_list_members() {
67
82
  grep -Ev '^[[:space:]]*(#|$)' "$1" || true
68
83
  }
69
84
 
85
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — resolve a gate name to its *declaration* path: the file whose text carries the `# graph:` manifest and the `# spec:`/`# assertion` directives. Dirs are tried consumer-first and `.sh` beats `.gate` within a dir, so a consumer shadowing a ported gate with its own shell script still wins. A dir carrying both spellings for one name is ambiguous dispatch, caught by check-gate-substrate-parity assertion A rather than silently ordered here.
70
86
  gate_resolve() {
71
87
  local g="$1" d
72
88
  shift
@@ -75,17 +91,166 @@ gate_resolve() {
75
91
  printf '%s\n' "$d/$g.sh"
76
92
  return 0
77
93
  fi
94
+ if [[ -f "$d/$g.gate" ]]; then
95
+ printf '%s\n' "$d/$g.gate"
96
+ return 0
97
+ fi
78
98
  done
79
99
  return 1
80
100
  }
81
101
 
82
- gate_kit_roots() {
83
- local d kit
84
- if [[ -n "${GATE_SDK_KIT_DIRS:-}" ]]; then
85
- for d in $GATE_SDK_KIT_DIRS; do printf '%s\n' "$d"; done
86
- return 0
87
- fi
88
- local sdk parent
102
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — the owning kit of a bridged knob, derived from the knob's own `<KIT>_` prefix rather than from a maintained knob→kit roster: each gate_kit_roots member's basename, hyphens to underscores and upper-cased, is tried as a prefix. A knob matching no other kit's prefix is gate-sdk's own — the one kit every `.gate` dispatch already runs inside — never a parse error and never a third kit guessed at.
103
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — the configured set is consulted first, then the shipped one: GATE_SDK_KIT_DIRS narrows which kits a battery *scans*, and reading it as the set of kits that *exist* would leave a narrowed run unable to attribute another kit's knob and fail-close on every member that declares one
104
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — the candidates are read to EOF *before* the match loop, never streamed through a `while read` the first prefix hit returns out of: this runs under a stdout capture, so a producer left writing into a closed pipe reports the write error on stderr wherever SIGPIPE is ignored, which §run-gates' capture is what makes dispatch-fatal
105
+ _gate_knob_owning_kit() {
106
+ local knob="$1" kit base prefix
107
+ local -a kits=()
108
+ mapfile -t kits < <(gate_kit_roots; [[ -n "${GATE_SDK_KIT_DIRS:-}" ]] && _gate_kit_roots_derived)
109
+ for kit in ${kits[@]+"${kits[@]}"}; do
110
+ kit="${kit%/}"
111
+ [[ -n "$kit" ]] || continue
112
+ base="${kit##*/}"
113
+ prefix="${base^^}"; prefix="${prefix//-/_}_"
114
+ [[ "$knob" == "$prefix"* ]] && { printf '%s\n' "$kit"; return 0; }
115
+ done
116
+ gate_sdk_root
117
+ }
118
+
119
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — resolve one declared knob to its tab-joined value by sourcing the owning kit's lib/*.sh in a subshell, so a kit library's globals cannot leak into the dispatcher or across members. Emits the joined value on stdout; returns non-zero having named the knob on stderr for each of the three refusals (undeclared knob, tab in an element, newline in an element).
120
+ _gate_knob_value() {
121
+ local knob="$1" gate="$2" kit
122
+ kit="$(_gate_knob_owning_kit "$knob")"
123
+ (
124
+ shopt -s nullglob
125
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — the knob under resolution, published to the
126
+ # kit library being sourced, so a library whose knob costs a subprocess resolves
127
+ # that one rather than all of them on every source
128
+ export GATE_SDK_RESOLVING_KNOB="$knob"
129
+ local _gkv_f
130
+ for _gkv_f in "$kit"/lib/*.sh; do
131
+ # shellcheck disable=SC1090 # the owning kit's library, resolved by prefix
132
+ source "$_gkv_f"
133
+ done
134
+ if ! declare -p "$knob" >/dev/null 2>&1; then
135
+ printf 'gate_command: %s declares knob %s, but %s/lib defines no such knob — ' "$gate" "$knob" "$kit" >&2
136
+ printf 'the config bridge could not resolve it; treating as failure (not clean)\n' >&2
137
+ exit 2
138
+ fi
139
+ local -n _gkv_val="$knob"
140
+ local _gkv_e
141
+ for _gkv_e in "${_gkv_val[@]+"${_gkv_val[@]}"}"; do
142
+ case "$_gkv_e" in
143
+ *$'\n'*)
144
+ printf 'gate_command: knob %s has an element containing a newline: %s — ' "$knob" "$_gkv_e" >&2
145
+ printf 'the argv protocol is one element per line; treating as failure (not clean)\n' >&2
146
+ exit 2 ;;
147
+ *$'\t'*)
148
+ printf 'gate_command: knob %s has an element containing a tab: %s — ' "$knob" "$_gkv_e" >&2
149
+ printf 'tab separates the serialized elements; treating as failure (not clean)\n' >&2
150
+ exit 2 ;;
151
+ esac
152
+ done
153
+ local IFS=$'\t'
154
+ printf '%s' "${_gkv_val[*]+"${_gkv_val[*]}"}"
155
+ )
156
+ }
157
+
158
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — resolve a gate name to its *invocation argv*, the execution counterpart of gate_resolve's declaration path: one element `<dir>/<name>.sh` for a shell gate, two elements `<binary> <name>` for a `.gate`-dispatched one — prefixed, when that member declares knobs, by `env` and one `GATE_SDK_KNOB_<NAME>=<tab-joined>` element per knob. Emits one argv element per line, so a caller looking for the dispatch executable takes the first element that is neither `env` nor an assignment. An absent or non-executable binary when a member dispatches to it is a harness error — exit 2, never a skip and never a pass (§Fail-closed contract): a skip would let the battery silently stop running a gate whenever a build is missing. A binary that cannot report its knobs, and each of the three knob-resolution refusals, exit 2 by the same contract.
159
+ gate_command() {
160
+ local g="$1" d bin
161
+ shift
162
+ for d in "$@"; do
163
+ if [[ -f "$d/$g.sh" ]]; then
164
+ printf '%s\n' "$d/$g.sh"
165
+ return 0
166
+ fi
167
+ if [[ -f "$d/$g.gate" ]]; then
168
+ bin="$(gate_native_bin)"
169
+ if [[ ! -x "$bin" ]]; then
170
+ printf 'gate_command: %s dispatches to the native binary, but %s is ' "$g" "$bin" >&2
171
+ printf 'absent or not executable — the gate could not run; treating as ' >&2
172
+ printf 'failure (not clean). Build it: bash gate-sdk/bin/build-native.sh\n' >&2
173
+ exit 2
174
+ fi
175
+ local knob_names knob_status knob value
176
+ knob_names="$("$bin" --knobs "$g" 2>&1)"; knob_status=$?
177
+ if [[ "$knob_status" -ne 0 ]]; then
178
+ printf 'gate_command: %s --knobs %s exited %s — the config bridge could not ' "$bin" "$g" "$knob_status" >&2
179
+ printf 'report what %s reads; treating as failure (not clean)\n%s\n' "$g" "$knob_names" >&2
180
+ exit 2
181
+ fi
182
+ local -a env_elems=()
183
+ while IFS= read -r knob; do
184
+ [[ -n "$knob" ]] || continue
185
+ value="$(_gate_knob_value "$knob" "$g")" || exit 2
186
+ env_elems+=("GATE_SDK_KNOB_$knob=$value")
187
+ done <<<"$knob_names"
188
+ if [[ ${#env_elems[@]} -gt 0 ]]; then
189
+ printf 'env\n'
190
+ printf '%s\n' "${env_elems[@]}"
191
+ fi
192
+ printf '%s\n%s\n' "$bin" "$g"
193
+ return 0
194
+ fi
195
+ done
196
+ return 1
197
+ }
198
+
199
+ # spec: gate-sdk/SPEC.md §Layout and configuration — the one home of GATE_SDK_NATIVE_BIN's default, so a knob default gains readers without gaining spellings
200
+ gate_native_bin() {
201
+ printf '%s\n' "${GATE_SDK_NATIVE_BIN:-native/target/release/checkwright-gates}"
202
+ }
203
+
204
+ # spec: gate-sdk/SPEC.md §Layout and configuration — the one home of GATE_SDK_NATIVE_CRATE's default, trailing slash stripped, so its three shell readers share a spelling rather than each carrying one
205
+ gate_native_crate() {
206
+ local crate="${GATE_SDK_NATIVE_CRATE:-native}"
207
+ printf '%s\n' "${crate%/}"
208
+ }
209
+
210
+ # spec: gate-sdk/SPEC.md §check-gate-output — the implementation module a .gate-dispatched member's rule lives in, derived from the gate name by the crate's own convention (drop the `check-` prefix, `-`→`_`) rather than held in a second registry that could drift from it
211
+ gate_native_module() {
212
+ local g="${1#check-}"
213
+ printf '%s/src/gates/%s.rs\n' "$(gate_native_crate)" "${g//-/_}"
214
+ }
215
+
216
+ # spec: gate-sdk/SPEC.md §Layout and configuration — GATE_SDK_NATIVE_TARGETS_FILE, defaulted off GATE_SDK_NATIVE_CRATE so the crate's location keeps one owner
217
+ gate_native_targets_file() {
218
+ local crate
219
+ crate="$(gate_native_crate)"
220
+ printf '%s\n' "${GATE_SDK_NATIVE_TARGETS_FILE:-$crate/targets.list}"
221
+ }
222
+
223
+ # spec: gate-sdk/SPEC.md §check-gate-binary-fresh — the tree side of the source stamp: the same three git invocations native/build.rs bakes into the binary, so the comparison stays one algorithm rather than two implementations of one. Returns 1 emitting nothing when git cannot answer, so a caller fails closed rather than comparing against an empty string.
224
+ gate_native_source_stamp() {
225
+ local crate listing hashed stamp i
226
+ local -a paths=() hashes=()
227
+ crate="$(gate_native_crate)"
228
+ listing="$(git -C "$crate" ls-files 2>/dev/null)" || return 1
229
+ [[ -n "$listing" ]] || return 1
230
+ mapfile -t paths <<<"$listing"
231
+ hashed="$(git -C "$crate" hash-object -- "${paths[@]}" 2>/dev/null)" || return 1
232
+ mapfile -t hashes <<<"$hashed"
233
+ [[ ${#hashes[@]} -eq ${#paths[@]} ]] || return 1
234
+ local manifest=""
235
+ for ((i = 0; i < ${#paths[@]}; i++)); do
236
+ manifest+="${hashes[i]} ${paths[i]}"$'\n'
237
+ done
238
+ stamp="$(printf '%s' "$manifest" | git -C "$crate" hash-object --stdin 2>/dev/null)" || return 1
239
+ [[ -n "$stamp" ]] || return 1
240
+ printf '%s\n' "$stamp"
241
+ }
242
+
243
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — the target roster's single reader; an absent roster returns 1 and emits nothing, so a caller tells "no roster declared" from "a roster declaring nothing" rather than reading both as no targets
244
+ gate_native_targets() {
245
+ local f
246
+ f="$(gate_native_targets_file)"
247
+ [[ -f "$f" ]] || return 1
248
+ gates_list_members "$f"
249
+ }
250
+
251
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — the shipped kit set, by the checks/-or-smoke/ predicate alone: what a tree *contains*, before GATE_SDK_KIT_DIRS narrows what a battery scans
252
+ _gate_kit_roots_derived() {
253
+ local d kit sdk parent
89
254
  sdk="$(gate_sdk_root)"
90
255
  printf '%s\n' "$sdk"
91
256
  parent="${sdk%/*}"
@@ -98,6 +263,30 @@ gate_kit_roots() {
98
263
  return 0
99
264
  }
100
265
 
266
+ gate_kit_roots() {
267
+ local d
268
+ if [[ -n "${GATE_SDK_KIT_DIRS:-}" ]]; then
269
+ for d in $GATE_SDK_KIT_DIRS; do printf '%s\n' "$d"; done
270
+ return 0
271
+ fi
272
+ _gate_kit_roots_derived
273
+ }
274
+
275
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — the resolved kit-root set as a bridgeable variable, the shape GATE_PRUNE_DIRS already has: GATE_SDK_KIT_DIRS is an override a consumer sets in the environment, so `declare -p` cannot find it and the config bridge cannot carry it. Resolving it here gives the value one computation serving both substrates, which is criterion 6's discharge-by-construction rather than a Rust twin of the predicate.
276
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — spelled relative to the *current directory*, because a bridged value is baked verbatim into the generated pre-commit hook: an absolute root would commit one machine's checkout path to a tracked file. Resolving each root against the invoking directory keeps the path-prefix comparison exact on the binary side while nothing environment-specific crosses.
277
+ GATE_KIT_ROOTS_HERE=()
278
+ while IFS= read -r _gkr; do
279
+ [[ -n "$_gkr" ]] || continue
280
+ if [[ "$_gkr" == "$PWD"/* ]]; then
281
+ GATE_KIT_ROOTS_HERE+=("${_gkr#"$PWD"/}")
282
+ elif [[ "$_gkr" == /* ]]; then
283
+ GATE_KIT_ROOTS_HERE+=("$(realpath --relative-to="$PWD" "$_gkr" 2>/dev/null || printf '%s' "$_gkr")")
284
+ else
285
+ GATE_KIT_ROOTS_HERE+=("$_gkr")
286
+ fi
287
+ done < <(gate_kit_roots)
288
+ unset _gkr
289
+
101
290
  gate_check_dirs() {
102
291
  gate_sdk_gates_dir
103
292
  local k
@@ -129,7 +318,12 @@ _gate_kit_roots_rel_ensure_cache() {
129
318
  anchor="${GATE_SDK_ROOT:-$(gate_sdk_root)}"; anchor="${anchor%/*}"
130
319
  _gate_kit_roots_rel_cache=()
131
320
  while IFS= read -r root; do
132
- if [[ "$root" == /* ]]; then
321
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — a root already under the anchor is the
322
+ # common case and its relative form is the string remainder, so the realpath fork
323
+ # is paid only for the exotic root that is not
324
+ if [[ "$root" == "$anchor"/* ]]; then
325
+ root="${root#"$anchor"/}"
326
+ elif [[ "$root" == /* ]]; then
133
327
  root="$(realpath --relative-to="$anchor" "$root" 2>/dev/null || printf '%s' "$root")"
134
328
  fi
135
329
  _gate_kit_roots_rel_cache+=("$root")
@@ -143,6 +337,11 @@ gate_kit_roots_rel() {
143
337
  printf '%s\n' "${_gate_kit_roots_rel_cache[@]}"
144
338
  }
145
339
 
340
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — the anchored spelling as a bridgeable variable, GATE_KIT_ROOTS' counterpart: a binary-side member needing repo-relative roots (a pathspec, a knob-prefix owner) reads this rather than re-deriving the anchor rule, which an override makes underivable from the absolute set alone
341
+ _gate_kit_roots_rel_ensure_cache
342
+ # shellcheck disable=SC2034 # read across the dispatch seam, never in this shell: the config bridge resolves it by name for a member that declares it
343
+ GATE_KIT_ROOTS_REL=("${_gate_kit_roots_rel_cache[@]}")
344
+
146
345
  # spec: gate-sdk/SPEC.md §check-graph — expand each kit:<glob> token in a comma-joined couples/trigger field to <kit-root>/<glob> for every gate_kit_roots_rel member; non-kit tokens pass through verbatim. Assigns into the caller's <outvar> by nameref rather than printing, so a per-manifest-line loop calls this directly (no `$(...)` fork) and the whole loop shares one _gate_kit_roots_rel_ensure_cache fill instead of paying it — and forking — once per line. gate_expand_couples below is the same expansion for a caller that still wants the stdout form.
147
346
  gate_expand_couples_var() {
148
347
  local -n _gate_expand_couples_out="$1"
@@ -1,5 +1,5 @@
1
1
  # shellcheck shell=bash
2
- # spec: gate-sdk/SPEC.md §lib/inject.sh — the marker-bounded insert/replace shared by every kit's agent-file injector; block-content generation stays with the caller
2
+ # spec: gate-sdk/SPEC.md §lib/inject.sh — the marker-bounded placement and retrieval shared by every kit's agent-file injector; block-content generation and any preservation rule over the retrieved content stay with the caller
3
3
 
4
4
  # spec: gate-sdk/SPEC.md §lib/inject.sh — inject_marker_block <file> <begin> <end>; inner block content on stdin. Replaces the span between an existing marker pair (inclusive) or appends a fresh block when absent; a begin marker without its end is malformed (exit 2); the file must exist (exit 2). Echoes the action taken (appended|replaced).
5
5
  inject_marker_block() {
@@ -33,3 +33,48 @@ inject_marker_block() {
33
33
  printf '%s\n' "$action"
34
34
  )
35
35
  }
36
+
37
+ # spec: gate-sdk/SPEC.md §lib/inject.sh — read_marker_block <file> <begin> <end>; prints the existing block's inner content (markers exclusive) on stdout, nothing (exit 0) when the marker pair is absent; a begin marker without its end is malformed (exit 2), as is a missing file. What a caller preserves out of that content is the caller's rule, never this module's.
38
+ read_marker_block() {
39
+ (
40
+ set -euo pipefail
41
+ file="$1"; begin="$2"; end="$3"
42
+ [[ -f "$file" ]] \
43
+ || { echo "read_marker_block: target file not found: $file" >&2; exit 2; }
44
+
45
+ grep -qF -- "$begin" "$file" || exit 0
46
+ grep -qF -- "$end" "$file" \
47
+ || { echo "read_marker_block: begin marker present but end marker missing in $file — refusing to guess the block bounds" >&2; exit 2; }
48
+
49
+ awk -v b="$begin" -v e="$end" '
50
+ $0 == e { inblock = 0; next }
51
+ inblock { print }
52
+ $0 == b { inblock = 1 }
53
+ ' "$file"
54
+ )
55
+ }
56
+
57
+ # spec: gate-sdk/SPEC.md §lib/inject.sh — remove_marker_block <file> <begin> <end>; deletes the marker pair and everything between it (inclusive), leaving the rest of the file byte-identical. A no-op exiting 0, printing nothing, when no begin marker is present; a begin marker without its end is malformed (exit 2), as is a missing file — the same rule its siblings take, so all three helpers agree on what a malformed target is. Echoes 'removed' when it removed a block.
58
+ remove_marker_block() {
59
+ (
60
+ set -euo pipefail
61
+ file="$1"; begin="$2"; end="$3"
62
+ [[ -f "$file" ]] \
63
+ || { echo "remove_marker_block: target file not found: $file" >&2; exit 2; }
64
+
65
+ grep -qF -- "$begin" "$file" || exit 0
66
+ grep -qF -- "$end" "$file" \
67
+ || { echo "remove_marker_block: begin marker present but end marker missing in $file — refusing to guess the block bounds" >&2; exit 2; }
68
+
69
+ tmp="$(mktemp)"
70
+ trap 'rm -f "$tmp"' EXIT
71
+ awk -v b="$begin" -v e="$end" '
72
+ $0 == b { skip = 1; next }
73
+ $0 == e { skip = 0; next }
74
+ !skip { print }
75
+ ' "$file" >"$tmp"
76
+
77
+ cp "$tmp" "$file"
78
+ printf '%s\n' "removed"
79
+ )
80
+ }
@@ -8,4 +8,30 @@ for _th_kit in "$_th_root"/gate-sdk "$_th_root"/*-kit; do
8
8
  _th_var="$(printf '%s' "${_th_kit##*/}" | tr '[:lower:]-' '[:upper:]_')_CONFIG_FILE"
9
9
  export "${_th_var}=${_th_empty}"
10
10
  done
11
+ GATE_SDK_TEST_LIB_DIR="$(cd "${BASH_SOURCE[0]%/*}" && pwd)"
12
+ # spec: gate-sdk/SPEC.md §run-gate-tests — the binary pinned absolute, because a bespoke test
13
+ # runs its gate from a sandbox cwd where the knob's repo-relative default resolves to nothing
14
+ export GATE_SDK_NATIVE_BIN="${GATE_SDK_NATIVE_BIN:-${_th_root}/native/target/release/checkwright-gates}"
11
15
  unset _th_root _th_empty _th_kit _th_var
16
+
17
+ # spec: gate-sdk/SPEC.md §run-gate-tests — invoke a gate through its declared dispatch rather
18
+ # than by script path, so a bespoke test names a gate and never a substrate: gate_command
19
+ # resolves a `.sh` path or the binary plus its bridged knobs, under the caller's cwd and env.
20
+ gate_env() { # $1.. = NAME=VALUE — a case's environment, applied in the caller's subshell
21
+ local _ge_kv
22
+ for _ge_kv in "$@"; do export "${_ge_kv?}"; done
23
+ return 0
24
+ }
25
+
26
+ gate_run() { # $1=gate-name $2=checks-dir (absolute) $3.. = gate args
27
+ local _gr_gate="$1" _gr_dir="$2"
28
+ shift 2
29
+ local -a _gr_argv=()
30
+ # shellcheck source=./gate.sh
31
+ source "$GATE_SDK_TEST_LIB_DIR/gate.sh"
32
+ mapfile -t _gr_argv < <(gate_command "$_gr_gate" "$_gr_dir")
33
+ # spec: gate-sdk/SPEC.md §Fail-closed contract — an argv the bridge refused to build is
34
+ # exit 2, the same verdict the dispatcher gives it, never a skipped assertion
35
+ [[ ${#_gr_argv[@]} -gt 0 ]] || return 2
36
+ "${_gr_argv[@]}" "$@"
37
+ }
@@ -15,16 +15,36 @@ check-gate-fail-closed
15
15
  check-gate-fixture-coverage
16
16
  check-gate-exemption-tasks
17
17
  check-gate-assertions
18
+ check-gate-substrate-parity
19
+ check-crate-arms
20
+ check-install-disposition
18
21
  check-graph
19
22
  check-commit-msg
20
23
  check-tree-terms
24
+ check-assertion-strength
25
+ check-commit-subject
26
+ check-core-files
27
+ check-exec-bit
28
+ check-hook-exec-bit
29
+ check-identity
30
+ check-kit-enum
31
+ check-readme-roster
32
+ check-reads-couples
33
+ check-smoke-entry-guard
34
+ check-template-copy-parity
35
+ check-template-registry-parity
36
+ check-test-hermetic
37
+ check-workflow-tiering
21
38
  EOF
22
39
 
40
+ # smoke-unregistered: check-root-tiering — its subject is the consumer-curated root manifest GATE_SDK_ROOT_ALLOWLIST (default scripts/root-allowlist.list), which no kit install can author: the vendored root set is per-adoption and gate-sdk installs first, before that set exists
41
+ # spec: gate-sdk/SPEC.md §Consumer smoke — check-gate-binary-fresh is deliberately NOT registered here and deliberately carries no declaration: its subject is the crate the binary was built from, GATE_SDK_NATIVE_CRATE is kept outside every kit root by design, so the probe derives the exemption every run and a written reason would be the inversion the accounting refuses
42
+
23
43
  # spec: gate-sdk/SPEC.md §Consumer smoke — ship the tracked default pattern list; the local companion is absent, exercising the fresh-clone path
24
44
  cp "$SDK/templates/msg-patterns.list" scripts/msg-patterns.list
25
45
 
26
46
  bash "$SDK/bin/gen-pre-commit.sh" --write >/dev/null
27
- bash "$SDK/checks/check-graph.sh" --emit > .workflow/CHECK-GRAPH.html
47
+ bash "$SDK/checks/check-graph.sh" --emit > scripts/CHECK-GRAPH.html
28
48
 
29
49
  # spec: gate-sdk/SPEC.md §run-gates — quiet green, loud red: green is one summary line, red prints verbatim, GATE_SDK_VERBOSE restores the banner roll
30
50
  q="$PWD/.tmp/quiet-smoke"
@@ -82,3 +102,43 @@ grep -q 'pre-commit: check-shellcheck failed' <<<"$out" || { echo "smoke(hook):
82
102
  grep -q 'unused_var' <<<"$out" || { echo "smoke(hook): red hook output not verbatim" >&2; exit 1; }
83
103
  git reset -q -- scripts/smoke-hook-probe.sh
84
104
  rm scripts/smoke-hook-probe.sh
105
+
106
+ # spec: gate-sdk/SPEC.md §port-blockers — the tokenizer rules, exercised behaviourally because
107
+ # the tool is a bin/ tool and owed no fixture pair: a scan that truncates at a here-string, or
108
+ # steals a case-pattern close inside a substitution, reports the trailing requirement as absent
109
+ pb="$(mktemp -d)"
110
+ printf '%s\n' 'check-smoke-tokenizer' > "$pb/gates.list"
111
+ cat > "$pb/check-smoke-tokenizer.sh" <<'EOF'
112
+ #!/usr/bin/env bash
113
+ # graph: couples=scripts/gates.list dir=one valve=none tier=precommit
114
+ set -uo pipefail
115
+ if [[ -n "$(pb_alpha_prog)" ]]; then
116
+ pb_bravo_prog
117
+ fi
118
+ v="$( case "$1" in a) pb_charlie_prog ;; *) pb_delta_prog ;; esac )"
119
+ read -r w <<<"$v"
120
+ for f in ./*.sh; do pb_tail_prog "$f" "$w"; done
121
+ fail_closed 0 SMOKE-TOKENIZER probe
122
+ EOF
123
+ pb_run() { GATE_SDK_GATES_DIR="$pb" bash "$SDK/bin/port-blockers.sh" "$@"; }
124
+
125
+ out="$(pb_run)" || { echo "smoke(port-blockers): default arm exited non-zero" >&2; exit 1; }
126
+ for prog in pb_bravo_prog pb_charlie_prog pb_delta_prog pb_tail_prog; do
127
+ grep -q " $prog " <<<"$out" || {
128
+ echo "smoke(port-blockers): scan lost $prog — the tokenizer truncated: $out" >&2; exit 1; }
129
+ done
130
+ if grep -q 'pb_alpha_prog' <<<"$out"; then
131
+ echo "smoke(port-blockers): reported a word inside [[ ]], which is not command position: $out" >&2; exit 1
132
+ fi
133
+
134
+ out="$(pb_run --group)" || { echo "smoke(port-blockers): --group exited non-zero" >&2; exit 1; }
135
+ grep -q '1 group(s) formed, 0 undecidable' <<<"$out" || {
136
+ echo "smoke(port-blockers): --group did not key a fully-scannable member: $out" >&2; exit 1; }
137
+ grep -q 'libs=fail_closed globs=\*.sh' <<<"$out" || {
138
+ echo "smoke(port-blockers): --group key lost a factor: $out" >&2; exit 1; }
139
+
140
+ if pb_run --nope >/dev/null 2>&1; then
141
+ echo "smoke(port-blockers): an unrecognized argument was not refused" >&2; exit 1
142
+ fi
143
+ pb_run --help >/dev/null || { echo "smoke(port-blockers): --help did not exit 0" >&2; exit 1; }
144
+ rm -rf "$pb"