checkwright 0.20.0 → 0.22.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 (250) hide show
  1. package/README.md +385 -19
  2. package/lib/common/digest.sh +18 -0
  3. package/lib/common/lock.sh +11 -0
  4. package/lib/common/recipe.sh +8 -11
  5. package/lib/doctor.sh +49 -0
  6. package/lib/init.sh +152 -29
  7. package/package.json +2 -2
  8. package/payload/artifact/targets.list +30 -0
  9. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  10. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
  11. package/payload/canon-kit/README.md +1 -0
  12. package/payload/canon-kit/SPEC.md +281 -26
  13. package/payload/canon-kit/checks/check-comment-tier.sh +7 -2
  14. package/payload/canon-kit/checks/check-docs-link-convention.sh +11 -4
  15. package/payload/canon-kit/checks/check-md-refs.sh +22 -9
  16. package/payload/canon-kit/checks/check-payload-claim.sh +133 -0
  17. package/payload/canon-kit/checks/check-prose-enum.sh +1 -1
  18. package/payload/canon-kit/checks/check-spec-pointer.sh +15 -4
  19. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
  20. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +26 -3
  21. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -0
  22. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
  23. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/OUTSIDE.md +4 -0
  24. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
  25. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
  26. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +5 -3
  27. package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
  28. package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
  29. package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
  30. package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
  31. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
  32. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
  33. package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
  34. package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
  35. package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
  36. package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
  37. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
  38. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
  39. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +24 -1
  40. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
  41. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
  42. package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
  43. package/payload/canon-kit/lib/spec.sh +22 -12
  44. package/payload/canon-kit/smoke/install.sh +20 -1
  45. package/payload/canon-kit/templates/SPEC-amendment.md +5 -1
  46. package/payload/context-kit/SPEC.md +38 -7
  47. package/payload/context-kit/lib/toolfloor.sh +1 -1
  48. package/payload/context-kit/smoke/install.sh +3 -1
  49. package/payload/delegation-kit/README.md +2 -1
  50. package/payload/delegation-kit/SPEC.md +590 -48
  51. package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
  52. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +61 -0
  53. package/payload/delegation-kit/checks/check-gate-tamper.sh +1 -1
  54. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/agents/silent.md +7 -0
  55. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/args +1 -0
  56. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/bad/expect.txt +1 -0
  57. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/agents/explicit-cheap.md +7 -0
  58. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/agents/explicit-inherit.md +8 -0
  59. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/args +1 -0
  60. package/payload/delegation-kit/gate-tests/check-agent-tier-explicit/good/expect.txt +1 -0
  61. package/payload/delegation-kit/lib/delegation.sh +3 -0
  62. package/payload/delegation-kit/smoke/install.sh +3 -1
  63. package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
  64. package/payload/delegation-kit/templates/agent-execution.md +171 -15
  65. package/payload/delegation-kit/templates/delegation-config.sh +4 -0
  66. package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
  67. package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
  68. package/payload/doctrine-kit/DOCTRINE.md +27 -0
  69. package/payload/doctrine-kit/README.md +5 -0
  70. package/payload/doctrine-kit/SPEC.md +62 -3
  71. package/payload/doctrine-kit/bin/install-doctrine.sh +84 -4
  72. package/payload/doctrine-kit/smoke/install.sh +77 -1
  73. package/payload/drift-kit/README.md +3 -2
  74. package/payload/drift-kit/SPEC.md +253 -20
  75. package/payload/drift-kit/bin/stage-economics.sh +157 -3
  76. package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
  77. package/payload/drift-kit/smoke/install.sh +155 -1
  78. package/payload/drift-kit/templates/economics.md +9 -0
  79. package/payload/drift-kit/templates/kpis.list +6 -1
  80. package/payload/evidence-kit/README.md +20 -6
  81. package/payload/evidence-kit/SPEC.md +355 -17
  82. package/payload/evidence-kit/bin/run-validate.sh +51 -9
  83. package/payload/evidence-kit/checks/check-battery-roster.sh +86 -0
  84. package/payload/evidence-kit/checks/check-producer-liveness.sh +34 -0
  85. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
  86. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
  87. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
  88. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
  89. package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
  90. package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
  91. package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
  92. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
  93. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
  94. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
  95. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
  96. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
  97. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
  98. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
  99. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
  100. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
  101. package/payload/evidence-kit/lib/evidence.sh +18 -0
  102. package/payload/evidence-kit/smoke/install.sh +17 -3
  103. package/payload/gate-sdk/README.md +4 -1
  104. package/payload/gate-sdk/SPEC.md +1955 -79
  105. package/payload/gate-sdk/bin/gen-pre-commit.sh +13 -3
  106. package/payload/gate-sdk/bin/run-consumer-smoke.sh +121 -1
  107. package/payload/gate-sdk/bin/run-gate-tests.sh +40 -9
  108. package/payload/gate-sdk/bin/run-gates.sh +32 -3
  109. package/payload/gate-sdk/bin/upgrade-smoke.sh +3 -3
  110. package/payload/gate-sdk/checks/check-action-gh-repo.gate +2 -0
  111. package/payload/gate-sdk/checks/check-action-pinning.gate +2 -0
  112. package/payload/gate-sdk/checks/check-action-run-shell.sh +3 -1
  113. package/payload/gate-sdk/checks/check-core-files.sh +27 -4
  114. package/payload/gate-sdk/checks/check-exec-bit.sh +20 -1
  115. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +106 -0
  116. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +6 -7
  117. package/payload/gate-sdk/checks/check-gate-output.sh +9 -1
  118. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +302 -0
  119. package/payload/gate-sdk/checks/check-graph.sh +7 -8
  120. package/payload/gate-sdk/checks/check-readme-roster.sh +5 -0
  121. package/payload/gate-sdk/checks/check-reads-couples.sh +73 -22
  122. package/payload/gate-sdk/checks/check-template-registry-parity.sh +81 -0
  123. package/payload/gate-sdk/checks/check-tree-terms.sh +11 -7
  124. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
  125. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
  126. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
  127. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
  128. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
  129. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
  130. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
  131. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
  132. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
  133. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
  134. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
  135. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
  136. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
  137. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
  138. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
  139. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
  140. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
  141. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
  142. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
  143. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
  144. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
  145. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
  146. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
  147. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
  148. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
  149. package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
  150. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
  151. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
  152. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
  153. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
  154. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
  155. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
  156. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
  157. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
  158. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
  159. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
  160. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
  161. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
  162. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
  163. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
  164. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
  165. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
  166. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
  167. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
  168. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
  169. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
  170. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
  171. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
  172. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
  173. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
  174. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
  175. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
  176. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +123 -0
  177. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
  178. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
  179. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
  180. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
  181. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
  182. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
  183. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
  184. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
  185. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
  186. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
  187. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
  188. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
  189. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
  190. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
  191. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
  192. package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
  193. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +41 -1
  194. package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
  195. package/payload/gate-sdk/lib/consumer-smoke.sh +26 -1
  196. package/payload/gate-sdk/lib/gate.sh +104 -13
  197. package/payload/gate-sdk/lib/inject.sh +21 -1
  198. package/payload/gate-sdk/smoke/install.sh +19 -1
  199. package/payload/guard-kit/README.md +4 -3
  200. package/payload/guard-kit/SPEC.md +88 -10
  201. package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
  202. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
  203. package/payload/guard-kit/lib/guard.sh +1 -0
  204. package/payload/guard-kit/templates/close-triage.md +35 -7
  205. package/payload/guard-kit/templates/guard-config.sh +3 -0
  206. package/payload/lifecycle-kit/README.md +1 -0
  207. package/payload/lifecycle-kit/SPEC.md +589 -33
  208. package/payload/lifecycle-kit/bin/enter-stage.sh +13 -3
  209. package/payload/lifecycle-kit/bin/file-gap.sh +42 -1
  210. package/payload/lifecycle-kit/bin/file-survey.sh +50 -0
  211. package/payload/lifecycle-kit/checks/check-merge-attrs.sh +1 -1
  212. package/payload/lifecycle-kit/checks/check-skill-binding.sh +1 -1
  213. package/payload/lifecycle-kit/checks/check-survey-record.sh +102 -0
  214. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
  215. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
  216. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +1 -0
  217. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
  218. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
  219. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
  220. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
  221. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
  222. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
  223. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +84 -0
  224. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +94 -0
  225. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
  226. package/payload/lifecycle-kit/lib/stages.sh +8 -2
  227. package/payload/lifecycle-kit/smoke/install.sh +17 -1
  228. package/payload/lifecycle-kit/templates/consult.md +73 -0
  229. package/payload/lifecycle-kit/templates/lead.md +141 -10
  230. package/payload/lifecycle-kit/templates/stages/align.md +12 -0
  231. package/payload/lifecycle-kit/templates/stages/build.md +8 -0
  232. package/payload/lifecycle-kit/templates/stages/close.md +25 -4
  233. package/payload/lifecycle-kit/templates/stages/scope.md +34 -0
  234. package/payload/lifecycle-kit/templates/stages/spec.md +8 -0
  235. package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
  236. package/payload/queue-kit/README.md +4 -1
  237. package/payload/queue-kit/SPEC.md +230 -6
  238. package/payload/queue-kit/bin/queue-edges.sh +78 -0
  239. package/payload/queue-kit/checks/check-queue-entry-budget.sh +5 -3
  240. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
  241. package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
  242. package/payload/queue-kit/smoke/install.sh +4 -1
  243. package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
  244. package/payload/site-kit/SPEC.md +135 -29
  245. package/payload/site-kit/checks/check-docs-render-fidelity.sh +100 -27
  246. package/payload/site-kit/gate-tests/check-docs-render-fidelity-batch.test.sh +158 -0
  247. package/payload/site-kit/lib/site.sh +16 -2
  248. package/payload/site-kit/smoke/install.sh +9 -1
  249. package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
  250. package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
@@ -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"
@@ -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
  #
@@ -70,9 +70,49 @@ got="$(gate_resolve check-one "$sandbox/a" "$sandbox/b")"
70
70
  gate_resolve check-missing "$sandbox/a" "$sandbox/b" >/dev/null \
71
71
  && { echo " FAIL: gate_resolve found a nonexistent gate"; fails=$((fails + 1)); }
72
72
 
73
+ # --- declaration path vs invocation argv (the .gate dispatch seam) ------------
74
+ : >"$sandbox/b/check-ported.gate"
75
+ got="$(gate_resolve check-ported "$sandbox/a" "$sandbox/b")"
76
+ [[ "$got" == "$sandbox/b/check-ported.gate" ]] \
77
+ || { echo " FAIL: gate_resolve did not find a .gate declaration (got '$got')"; fails=$((fails + 1)); }
78
+
79
+ # .sh beats .gate within a dir — the shadowing property the registry contract rests on
80
+ : >"$sandbox/b/check-both.sh"; : >"$sandbox/b/check-both.gate"
81
+ got="$(gate_resolve check-both "$sandbox/a" "$sandbox/b")"
82
+ [[ "$got" == "$sandbox/b/check-both.sh" ]] \
83
+ || { echo " FAIL: gate_resolve let .gate win inside a dir (got '$got')"; fails=$((fails + 1)); }
84
+
85
+ # an earlier dir's .gate still beats a later dir's .sh — dir order is the outer loop
86
+ : >"$sandbox/a/check-order.gate"; : >"$sandbox/b/check-order.sh"
87
+ got="$(gate_resolve check-order "$sandbox/a" "$sandbox/b")"
88
+ [[ "$got" == "$sandbox/a/check-order.gate" ]] \
89
+ || { echo " FAIL: gate_resolve broke consumer-first dir order (got '$got')"; fails=$((fails + 1)); }
90
+
91
+ # gate_command: a shell gate yields its one-element argv
92
+ got="$(gate_command check-one "$sandbox/a" "$sandbox/b" | paste -sd' ' -)"
93
+ [[ "$got" == "$sandbox/b/check-one.sh" ]] \
94
+ || { echo " FAIL: gate_command shell argv was '$got'"; fails=$((fails + 1)); }
95
+
96
+ # gate_command: a .gate member yields <binary> <name> when the binary is executable
97
+ printf '#!/bin/sh\n' > "$sandbox/fakebin"; chmod +x "$sandbox/fakebin"
98
+ got="$(GATE_SDK_NATIVE_BIN="$sandbox/fakebin" gate_command check-ported "$sandbox/a" "$sandbox/b" | paste -sd' ' -)"
99
+ [[ "$got" == "$sandbox/fakebin check-ported" ]] \
100
+ || { echo " FAIL: gate_command native argv was '$got'"; fails=$((fails + 1)); }
101
+
102
+ # fail-closed: an absent binary is exit 2, never a skip and never a pass
103
+ ( GATE_SDK_NATIVE_BIN="$sandbox/nope" gate_command check-ported "$sandbox/a" "$sandbox/b" >/dev/null 2>&1 )
104
+ [[ "$?" -eq 2 ]] \
105
+ || { echo " FAIL: gate_command did not exit 2 on an absent native binary"; fails=$((fails + 1)); }
106
+
107
+ # fail-closed: present but non-executable is the same harness error
108
+ : >"$sandbox/notexec"; chmod -x "$sandbox/notexec"
109
+ ( GATE_SDK_NATIVE_BIN="$sandbox/notexec" gate_command check-ported "$sandbox/a" "$sandbox/b" >/dev/null 2>&1 )
110
+ [[ "$?" -eq 2 ]] \
111
+ || { echo " FAIL: gate_command did not exit 2 on a non-executable native binary"; fails=$((fails + 1)); }
112
+
73
113
  if [[ "$fails" -gt 0 ]]; then
74
114
  echo "lib-gate.test: $fails assertion(s) failed"
75
115
  exit 1
76
116
  fi
77
- echo "lib-gate.test: ok (fail_closed branches; gate_path_pruned; GATE_GREP_EXCLUDES; gate_find prune; registry + resolution)"
117
+ echo "lib-gate.test: ok (fail_closed branches; gate_path_pruned; GATE_GREP_EXCLUDES; gate_find prune; registry + resolution; .gate declaration/argv split + dispatch fail-closed)"
78
118
  exit 0
@@ -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,36 @@
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_place_binary: the vendored kit roots' descriptor set decides whether the scratch consumer needs the gate binary, and the invoking repo's already-built artifact is what it receives. Derived, so a kit set with no ported gate asks for nothing.
5
+ csmoke_place_binary() {
6
+ local host bin descriptors=0 r
7
+ host="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
8
+ bin="$(gate_native_bin)"
9
+
10
+ shopt -s nullglob
11
+ for r in "$@"; do
12
+ for _ in "$r"/checks/*.gate; do descriptors=$((descriptors + 1)); done
13
+ done
14
+ shopt -u nullglob
15
+ [[ "$descriptors" -gt 0 ]] || return 0
16
+
17
+ [[ -x "$host/$bin" ]] || {
18
+ echo "csmoke: $descriptors vendored .gate descriptor(s) need the gate binary, but $host/$bin is absent or not executable" >&2
19
+ echo " help: build it — cargo build --release --manifest-path native/Cargo.toml — then re-run." >&2
20
+ return 2
21
+ }
22
+ mkdir -p "$SCRATCH/${bin%/*}" || return 2
23
+ cp "$host/$bin" "$SCRATCH/$bin" || return 2
24
+ }
25
+
4
26
  # 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
27
  csmoke_vendor_and_install() {
6
28
  local roots=("$@") r kit
7
29
  SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/consumer-smoke.XXXXXX")" || return 2
8
30
 
9
31
  git -C "$SCRATCH" init -q
10
- printf '.tmp/\n' > "$SCRATCH/.gitignore"
32
+ # 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
33
+ printf '.tmp/\n%s\n' "$(gate_native_bin)" > "$SCRATCH/.gitignore"
11
34
  git -C "$SCRATCH" add -A
12
35
  git -C "$SCRATCH" -c user.email=smoke@example.invalid -c user.name=smoke \
13
36
  commit -q --allow-empty -m "seed"
@@ -16,6 +39,8 @@ csmoke_vendor_and_install() {
16
39
  cp -R "$r" "$SCRATCH/$(basename "$r")"
17
40
  done
18
41
 
42
+ csmoke_place_binary "${roots[@]}" || return 2
43
+
19
44
  CSMOKE_INSTALLED=0
20
45
  for r in "${roots[@]}"; do
21
46
  kit="$(basename "$r")"