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,64 @@
1
+ #!/usr/bin/env bash
2
+ # spec: gate-sdk/SPEC.md §check-core-files — a kit: manifest line derives one path per kit root, so a root missing that path reds without any manifest edit; a kit: token carrying a wildcard is refused fail-closed because this reader requires each expanded path to exist, which is a different invariant from the glob match a couples= field performs. This lives in the bespoke unit lane rather than the good/+bad/ pair because the fixture runner reads exit 2 as a harness error and runs each case with the fixture dir as cwd, so neither the refusal nor the expansion is expressible there.
3
+ set -uo pipefail
4
+ source "$(dirname "${BASH_SOURCE[0]}")/../lib/test-hermetic.sh"
5
+
6
+ ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
7
+ GATE="$ROOT/gate-sdk/checks/check-core-files.sh"
8
+ [[ -x "$GATE" ]] || { echo "check-core-files.test: gate not found: $GATE"; exit 2; }
9
+
10
+ sb="$(mktemp -d)"
11
+ trap 'rm -rf "$sb"' EXIT
12
+
13
+ git -C "$sb" init -q
14
+ git -C "$sb" config user.email t@example.invalid
15
+ git -C "$sb" config user.name t
16
+ mkdir -p "$sb/alpha-kit" "$sb/beta-kit"
17
+ printf 'a\n' > "$sb/alpha-kit/SPEC.md"
18
+ printf 'b\n' > "$sb/beta-kit/SPEC.md"
19
+ printf 'r\n' > "$sb/plain.txt"
20
+ git -C "$sb" add -A
21
+ git -C "$sb" commit -qm seed
22
+
23
+ fails=0
24
+ run() { ( cd "$sb" && GATE_SDK_KIT_DIRS="alpha-kit beta-kit" bash "$GATE" "$1" 2>&1 ); }
25
+
26
+ # A kit: line expands to one path per root; every expansion exists, so the gate is clean
27
+ # and its count proves the derivation ran (2 derived + 1 hand line).
28
+ printf 'kit:SPEC.md\nplain.txt\n' > "$sb/good.list"
29
+ out="$(run good.list)"; rc=$?
30
+ [[ "$rc" -eq 0 ]] || { echo "FAIL [expand-clean]: expected exit 0, got $rc: $out"; fails=$((fails + 1)); }
31
+ grep -qF '3 manifest path(s)' <<<"$out" || { echo "FAIL [expand-count]: expected 3 expanded paths: $out"; fails=$((fails + 1)); }
32
+
33
+ # A new root with no SPEC.md reds without any manifest edit — the property Delta 2 exists for.
34
+ mkdir -p "$sb/gamma-kit"
35
+ printf 'g\n' > "$sb/gamma-kit/other.md"
36
+ git -C "$sb" add -A
37
+ git -C "$sb" commit -qm gamma
38
+ out="$( cd "$sb" && GATE_SDK_KIT_DIRS="alpha-kit beta-kit gamma-kit" bash "$GATE" good.list 2>&1 )"; rc=$?
39
+ [[ "$rc" -eq 1 ]] || { echo "FAIL [new-root-reds]: expected exit 1, got $rc: $out"; fails=$((fails + 1)); }
40
+ grep -qF 'missing: gamma-kit/SPEC.md' <<<"$out" || { echo "FAIL [new-root-names]: $out"; fails=$((fails + 1)); }
41
+
42
+ # An untracked expansion reds on the tracked half of the invariant, not just existence.
43
+ printf 'u\n' > "$sb/gamma-kit/SPEC.md"
44
+ out="$( cd "$sb" && GATE_SDK_KIT_DIRS="alpha-kit beta-kit gamma-kit" bash "$GATE" good.list 2>&1 )"; rc=$?
45
+ [[ "$rc" -eq 1 ]] || { echo "FAIL [untracked-reds]: expected exit 1, got $rc: $out"; fails=$((fails + 1)); }
46
+ grep -qF 'untracked: gamma-kit/SPEC.md' <<<"$out" || { echo "FAIL [untracked-names]: $out"; fails=$((fails + 1)); }
47
+
48
+ # A wildcard is refused fail-closed: this reader cannot express "some file matches".
49
+ for tok in 'kit:checks/*.sh' 'kit:SPEC?.md' 'kit:[ab].md'; do
50
+ printf '%s\n' "$tok" > "$sb/wild.list"
51
+ out="$(run wild.list)"; rc=$?
52
+ [[ "$rc" -eq 2 ]] || { echo "FAIL [wildcard-refused $tok]: expected exit 2, got $rc: $out"; fails=$((fails + 1)); }
53
+ grep -qF 'carries a wildcard' <<<"$out" || { echo "FAIL [wildcard-message $tok]: $out"; fails=$((fails + 1)); }
54
+ done
55
+
56
+ # Backward compatibility: a manifest with no kit: line behaves exactly as before.
57
+ printf 'plain.txt\n' > "$sb/plainonly.list"
58
+ out="$(run plainonly.list)"; rc=$?
59
+ [[ "$rc" -eq 0 ]] || { echo "FAIL [no-token-unchanged]: expected exit 0, got $rc: $out"; fails=$((fails + 1)); }
60
+ grep -qF '1 manifest path(s)' <<<"$out" || { echo "FAIL [no-token-count]: $out"; fails=$((fails + 1)); }
61
+
62
+ [[ "$fails" -eq 0 ]] || { echo "check-core-files.test: $fails assertion(s) failed"; exit 1; }
63
+ echo "check-core-files.test: clean (kit: expands per root and reds on a root missing the path or leaving it untracked; a wildcard token is refused fail-closed; a token-free manifest is unchanged)"
64
+ exit 0
@@ -0,0 +1,2 @@
1
+ scripts
2
+ stamp.txt
@@ -0,0 +1,5 @@
1
+ the gate binary was not built from the source now in the tree
2
+ reports source stamp 7b30e5148d6ca2f09e1b84ff2d5c7a6033819e4c
3
+ stamp.txt hashes to 4f1c2a90bb7e5d3168ac04e2f5b7391dd0c6a812
4
+ 2 descriptor(s) dispatch to that binary: check-ported check-vendored
5
+ help: rebuild it
@@ -0,0 +1,2 @@
1
+ # graph: couples=docs/*.md dir=one valve=none tier=precommit
2
+ # spec: gate-sdk/SPEC.md §check-gate-binary-fresh — fixture descriptor in a kit resolve dir, so the red is reported against the whole dispatching set rather than one dir's
@@ -0,0 +1,2 @@
1
+ # graph: couples=docs/*.md dir=one valve=none tier=precommit
2
+ # spec: gate-sdk/SPEC.md §check-gate-binary-fresh — fixture descriptor
@@ -0,0 +1,2 @@
1
+ GATE_SDK_KIT_DIRS="kitroot"
2
+ GATE_SDK_NATIVE_BIN="./stub-bin"
@@ -0,0 +1,4 @@
1
+ # Hermetic fixture registry — both descriptors are registered members, so both
2
+ # dispatch and the stale binary is the violation this case asserts.
3
+ check-ported
4
+ check-vendored
@@ -0,0 +1 @@
1
+ 4f1c2a90bb7e5d3168ac04e2f5b7391dd0c6a812
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ # A binary built from a source state this fixture tree no longer carries: its baked
3
+ # stamp is not stamp.txt's. The near-miss this case must not collapse into is the
4
+ # zero-descriptor tree, which exits 0 — so a red here can only be the stamp mismatch.
5
+ [[ "${1:-}" == --source-stamp ]] && { echo 7b30e5148d6ca2f09e1b84ff2d5c7a6033819e4c; exit 0; }
6
+ exit 2
@@ -0,0 +1,2 @@
1
+ scripts
2
+ stamp.txt
@@ -0,0 +1,5 @@
1
+ GATE-BINARY-FRESH: clean
2
+ 2 .gate descriptor(s)
3
+ 2 dispatched to by a live member of scripts/gates.list
4
+ built from the source now in stamp.txt
5
+ stamp 4f1c2a90bb7e5d3168ac04e2f5b7391dd0c6a812
@@ -0,0 +1,2 @@
1
+ # graph: couples=docs/*.md dir=one valve=none tier=precommit
2
+ # spec: gate-sdk/SPEC.md §check-gate-binary-fresh — fixture descriptor in a kit resolve dir, so the derivation is proved over the dir union rather than the gates dir alone
@@ -0,0 +1,2 @@
1
+ # graph: couples=docs/*.md dir=one valve=none tier=precommit
2
+ # spec: gate-sdk/SPEC.md §check-gate-binary-fresh — fixture descriptor
@@ -0,0 +1,2 @@
1
+ GATE_SDK_KIT_DIRS="kitroot"
2
+ GATE_SDK_NATIVE_BIN="./stub-bin"
@@ -0,0 +1,4 @@
1
+ # Hermetic fixture registry — both descriptors are registered members, so both
2
+ # dispatch and the binary is load-bearing.
3
+ check-ported
4
+ check-vendored
@@ -0,0 +1 @@
1
+ 4f1c2a90bb7e5d3168ac04e2f5b7391dd0c6a812
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+ # A binary built from the source the fixture tree carries: its baked stamp is the
3
+ # one stamp.txt reports, so the gate must reach the comparison and find them equal.
4
+ [[ "${1:-}" == --source-stamp ]] && { echo 4f1c2a90bb7e5d3168ac04e2f5b7391dd0c6a812; exit 0; }
5
+ exit 2
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env bash
2
+ # Behavioral test of checks/check-gate-binary-fresh.sh over the configurations the
3
+ # good/+bad/ pair cannot hold: the pair is one invocation each and both are
4
+ # "descriptors present, binary readable". These are the load-bearing predicate's
5
+ # own boundary — a descriptor on disk is a declaration, a registered member
6
+ # resolving to one is a dispatch — plus the two no-dispatch configurations this
7
+ # repo's battery and the consumer smoke used to be the only oracles for.
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]}")/../../gate-sdk/lib/test-hermetic.sh"
12
+
13
+ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # gate-sdk/
14
+ GATE="$DIR/checks/check-gate-binary-fresh.sh"
15
+ SANDBOX="$(mktemp -d)"
16
+ trap 'rm -rf "$SANDBOX"' EXIT
17
+
18
+ fails=0
19
+ STAMP=4f1c2a90bb7e5d3168ac04e2f5b7391dd0c6a812
20
+
21
+ # One sandbox shape, re-pointed per case: a gates dir, a kit resolve dir, a stub
22
+ # binary whose baked stamp matches stamp.txt, and a registry the case rewrites.
23
+ mkdir -p "$SANDBOX/scripts" "$SANDBOX/kitroot/checks"
24
+ printf '%s\n' "$STAMP" > "$SANDBOX/stamp.txt"
25
+ cat > "$SANDBOX/stub-bin" <<EOF
26
+ #!/usr/bin/env bash
27
+ [[ "\${1:-}" == --source-stamp ]] && { echo $STAMP; exit 0; }
28
+ exit 2
29
+ EOF
30
+ chmod +x "$SANDBOX/stub-bin"
31
+ DESC='# graph: couples=docs/*.md dir=one valve=none tier=precommit
32
+ # spec: gate-sdk/SPEC.md §check-gate-binary-fresh — fixture descriptor'
33
+
34
+ run() { # run <bin> ; registry + descriptors are already in place
35
+ ( cd "$SANDBOX" && env GATE_SDK_KIT_DIRS=kitroot GATE_SDK_NATIVE_BIN="$1" \
36
+ GATE_SDK_NATIVE_CRATE=crate "$GATE" scripts stamp.txt 2>&1 )
37
+ }
38
+
39
+ expect() { # expect <label> <want-rc> <substring> <got-rc> <output>
40
+ if [[ "$4" -ne "$2" ]]; then
41
+ echo " FAIL [$1]: want exit $2, got $4 -- $5"; fails=$((fails + 1))
42
+ elif ! grep -qF -- "$3" <<<"$5"; then
43
+ echo " FAIL [$1]: exit $2 but output lacks '$3': $5"; fails=$((fails + 1))
44
+ fi
45
+ }
46
+
47
+ # --- zero descriptors: clean, and the report says zero of each ---
48
+ printf 'check-shell\n' > "$SANDBOX/scripts/gates.list"
49
+ printf '#!/usr/bin/env bash\n' > "$SANDBOX/scripts/check-shell.sh"
50
+ out="$(run ./stub-bin)"; rc=$?
51
+ expect zero-descriptors 0 '0 .gate descriptor(s)' "$rc" "$out"
52
+ expect zero-descriptors-dispatch 0 '0 dispatched to by a live member' "$rc" "$out"
53
+
54
+ # --- descriptors present, none dispatching: clean, and the two counts differ ---
55
+ # The configuration every vendored tree is in after the first cohort lands: the
56
+ # descriptors ship with the kit root, no consumer registry names them, and no
57
+ # binary exists. Reading a descriptor's presence as a dispatch reds all of them.
58
+ printf '%s\n' "$DESC" > "$SANDBOX/scripts/check-ported.gate"
59
+ printf '%s\n' "$DESC" > "$SANDBOX/kitroot/checks/check-vendored.gate"
60
+ out="$(run ./nonexistent-bin)"; rc=$?
61
+ expect present-none-dispatching 0 '2 .gate descriptor(s)' "$rc" "$out"
62
+ expect present-none-dispatching-count 0 '0 dispatched to by a live member' "$rc" "$out"
63
+
64
+ # --- the near miss: a registered member resolves to a descriptor, no binary ---
65
+ # Exit 2, never 0: this is the state the corrected predicate must still fail
66
+ # closed on, and the one way a too-loose predicate passes its own good/ case.
67
+ printf 'check-shell\ncheck-ported\n' > "$SANDBOX/scripts/gates.list"
68
+ out="$(run ./nonexistent-bin)"; rc=$?
69
+ expect registered-no-binary 2 'registered member(s) dispatch to it' "$rc" "$out"
70
+
71
+ # --- absent registry: cannot verify, so exit 2 rather than a clean report ---
72
+ rm -f "$SANDBOX/scripts/gates.list"
73
+ out="$(run ./stub-bin)"; rc=$?
74
+ expect absent-registry 2 'no gate registry at' "$rc" "$out"
75
+
76
+ if [[ "$fails" -gt 0 ]]; then
77
+ echo "check-gate-binary-fresh.test.sh: $fails case(s) failed"
78
+ exit 1
79
+ fi
80
+ echo "check-gate-binary-fresh.test.sh: clean (load-bearing predicate: zero descriptors, descriptors with none dispatching, a registered dispatch with no binary, and an absent registry — 6 assertions over 4 cases)"
81
+ exit 0
@@ -2,7 +2,9 @@
2
2
 
3
3
  ## New Features
4
4
 
5
- - **some-other-task** — live, but nothing points at it.
5
+ - **some-other-task** — live, but nothing points at it. Its body bolds
6
+ **emphasis** the way real entry prose does, and a token scan reads that
7
+ emphasis as a live slug.
6
8
 
7
9
  ## Done
8
10
 
@@ -1 +1,3 @@
1
- does not resolve to a live task
1
+ # until: retired-task does not resolve to a live task
2
+ exemption element carries neither # until: <slug> nor # permanent: <reason>
3
+ # until: emphasis does not resolve to a live task
@@ -1,11 +1,13 @@
1
1
  #!/usr/bin/env bash
2
2
  # Fixture gate (scanned as text, never executed): one exemption's `# until:`
3
- # resolves only to Done, and another carries no disposition — must be REJECTED.
3
+ # resolves only to Done, one carries no disposition, and one points at a bold
4
+ # token in body prose that was never a task — all three must be REJECTED.
4
5
  set -uo pipefail
5
6
 
6
7
  # exception-list: surfaces excused from the sample scan
7
8
  EXEMPT=(
8
9
  "surface-a" # until: retired-task
9
10
  "surface-b"
11
+ "surface-c" # until: emphasis
10
12
  )
11
13
  echo "SAMPLE: clean (${#EXEMPT[@]} exemptions)"
@@ -1 +1,2 @@
1
1
  GATE-EXEMPTION-TASKS: clean
2
+ 1 live task slug(s)
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env bash
2
+ # no-fixture: a fixture-less member, so the static source-grep is its only output-contract oracle
2
3
  # Fixture gate (scanned as text): passes silently with no machine-keyable success
3
4
  # line — a reader cannot tell "passed" from "did nothing".
4
5
  exit 0
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env bash
2
+ # no-fixture: a fixture-less member, so the static source-grep is its only output-contract oracle
2
3
  # Fixture gate (scanned as text): emits a conforming machine-keyable success line
3
4
  # and a help: remedy on its failure path.
4
5
  if false; then
@@ -1 +1,2 @@
1
1
  GATE-OUTPUT: clean
2
+ 1 source-grepped as no-fixture members
@@ -0,0 +1,2 @@
1
+ scripts
2
+ conservation.md
@@ -0,0 +1,7 @@
1
+ ## Meta-gate conservation for the binary substrate
2
+
3
+ | Meta-gate | Disposition |
4
+ |---|---|
5
+ | `check-unrelated` | Retained. |
6
+
7
+ ## Next section
@@ -0,0 +1,12 @@
1
+ ambiguous dispatch
2
+ descriptor names no subcommand
3
+ subcommand nothing declares
4
+ no reference-only disposition
5
+ no recorded disposition: check-alpha
6
+ manifest-class annotation in implementation source
7
+ implementation sibling in the vendoring set: kitroot/check-orphan.rs
8
+ crate root inside the vendoring set: kitroot/native
9
+ malformed target triple: 'notatriple'
10
+ matrix declaration not roster-derived: publish.yml
11
+ digest recomputed: job 'build'
12
+ digest computed by a consumer: job 'release'
@@ -0,0 +1,2 @@
1
+ // graph: couples=docs/*.md dir=one valve=none tier=precommit
2
+ fn main() {}
@@ -0,0 +1,3 @@
1
+ // shares its stem with check-orphan.gate: a ported gate's implementation source
2
+ // sitting inside the vendoring set, which assertion E refuses
3
+ fn main() {}
@@ -0,0 +1,15 @@
1
+ # Hermetic fixture: a publish workflow spelling its platform set by hand and
2
+ # computing one digest twice, plus a pure-consumer job re-deriving another.
3
+ jobs:
4
+ build:
5
+ strategy:
6
+ matrix:
7
+ target: x86_64-unknown-linux-gnu
8
+ steps:
9
+ - run: sha256sum "$binary" > "$binary.sha256"
10
+ - run: sha256sum "$binary" > "$binary.sha256"
11
+ - uses: actions/upload-artifact@0000000000000000000000000000000000000000
12
+ release:
13
+ steps:
14
+ - uses: actions/download-artifact@0000000000000000000000000000000000000000
15
+ - run: sha256sum "$tarball" > "$tarball.sha256"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ # graph: couples=scripts/*.sh dir=one valve=none tier=precommit
3
+ echo "ALPHA: clean (stub)"
@@ -0,0 +1 @@
1
+ # graph: couples=docs/*.md dir=one valve=none tier=precommit
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ # graph: couples=docs/*.md dir=one valve=none tier=precommit
3
+ echo "DUP: clean (stub)"
@@ -0,0 +1 @@
1
+ # graph: couples=docs/*.md dir=one valve=none tier=precommit
@@ -0,0 +1,6 @@
1
+ GATE_SDK_KIT_DIRS="kitroot"
2
+ GATE_SDK_NATIVE_BIN="./stub-bin"
3
+ GATE_SDK_NATIVE_SRC="impl"
4
+ GATE_SDK_NATIVE_CRATE="kitroot/native"
5
+ GATE_SDK_NATIVE_TARGETS_FILE="targets.list"
6
+ GATE_SDK_NATIVE_PUBLISH_WORKFLOW="publish.yml"
@@ -0,0 +1,3 @@
1
+ check-alpha
2
+ check-dup
3
+ check-orphan
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ [[ "${1:-}" == --list ]] && { echo check-ported; exit 0; }
3
+ exit 2
@@ -0,0 +1,3 @@
1
+ # hermetic fixture roster — one well-formed target and one that is not a triple
2
+ x86_64-unknown-linux-gnu
3
+ notatriple
@@ -0,0 +1,2 @@
1
+ scripts
2
+ conservation.md
@@ -0,0 +1,8 @@
1
+ ## Meta-gate conservation for the binary substrate
2
+
3
+ | Meta-gate | Disposition |
4
+ |---|---|
5
+ | `check-alpha` | Retained, corpus extended. |
6
+ | `check-reference` | Reference-only — carried by the binary with no descriptor. |
7
+
8
+ ## Next section
@@ -0,0 +1,7 @@
1
+ GATE-SUBSTRATE-PARITY: clean
2
+ 1 descriptor(s) in parity with the 2-subcommand roster, 1 reference-only
3
+ 1 substrate-sensitive member(s) all dispositioned
4
+ 1 implementation source(s) free of manifest-class annotation
5
+ 1 kit root(s) scanned for an implementation sibling, crate root crate outside every kit root
6
+ target roster read at targets.list with 1 well-formed target(s)
7
+ publish workflow read at publish.yml, 1 matrix declaration(s) roster-derived across 2 job(s) with one producer per digest
@@ -0,0 +1,2 @@
1
+ // spec: some/SPEC.md §x — a locality-class annotation, which belongs here
2
+ fn main() {}
@@ -0,0 +1,3 @@
1
+ // a stem no descriptor claims: assertion E scans this kit root and discriminates
2
+ // by name rather than by extension, so the case proves the scan runs
3
+ fn main() {}
@@ -0,0 +1,15 @@
1
+ # Hermetic fixture: a publish workflow whose matrix is roster-derived and whose
2
+ # digests have one producer each. Not a runnable workflow — only the shape
3
+ # assertion F reads.
4
+ jobs:
5
+ build:
6
+ strategy:
7
+ matrix:
8
+ include: ${{ fromJSON(needs.roster.outputs.legs) }}
9
+ steps:
10
+ - run: sha256sum "$binary" > "$binary.sha256"
11
+ - uses: actions/upload-artifact@0000000000000000000000000000000000000000
12
+ release:
13
+ steps:
14
+ - uses: actions/download-artifact@0000000000000000000000000000000000000000
15
+ - run: sha256sum -c "$binary.sha256"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ # graph: couples=scripts/*.sh dir=one valve=none tier=precommit
3
+ echo "ALPHA: clean (stub)"
@@ -0,0 +1,2 @@
1
+ # graph: couples=docs/*.md dir=one valve=none tier=precommit
2
+ # spec: gate-sdk/SPEC.md §check-gate-substrate-parity — fixture descriptor
@@ -0,0 +1,6 @@
1
+ GATE_SDK_KIT_DIRS="kitroot"
2
+ GATE_SDK_NATIVE_BIN="./stub-bin"
3
+ GATE_SDK_NATIVE_SRC="impl"
4
+ GATE_SDK_NATIVE_CRATE="crate"
5
+ GATE_SDK_NATIVE_TARGETS_FILE="targets.list"
6
+ GATE_SDK_NATIVE_PUBLISH_WORKFLOW="publish.yml"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+ [[ "${1:-}" == --list ]] && { echo check-ported; echo check-reference; exit 0; }
3
+ exit 2
@@ -0,0 +1,2 @@
1
+ # hermetic fixture roster — one well-formed target triple
2
+ x86_64-unknown-linux-gnu
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env bash
2
+ # Behavioral test of checks/check-gate-substrate-parity.sh over the descriptor
3
+ # configurations the good/+bad/ pair cannot hold — it is one invocation each, both
4
+ # "descriptors and a binary". Two of these were previously assigned to live trees
5
+ # (this repo's battery, the consumer smoke) and are held here instead, so they stay
6
+ # reachable whatever those trees happen to be; the third is the corrected
7
+ # load-bearing predicate's own subject.
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]}")/../../gate-sdk/lib/test-hermetic.sh"
12
+
13
+ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # gate-sdk/
14
+ GATE="$DIR/checks/check-gate-substrate-parity.sh"
15
+ SANDBOX="$(mktemp -d)"
16
+ trap 'rm -rf "$SANDBOX"' EXIT
17
+
18
+ fails=0
19
+ mkdir -p "$SANDBOX/scripts" "$SANDBOX/kitroot/checks"
20
+ printf '#!/usr/bin/env bash\n# graph: couples=docs/*.md dir=one valve=none tier=precommit\necho "ALPHA: clean (stub)"\n' \
21
+ > "$SANDBOX/scripts/check-alpha.sh"
22
+ cat > "$SANDBOX/conservation.md" <<'EOF'
23
+ ## Meta-gate conservation for the binary substrate
24
+
25
+ | Subcommand | Disposition |
26
+ |---|---|
27
+ | `check-reference` | Reference-only — carried by the binary with no descriptor. |
28
+
29
+ ## Next section
30
+ EOF
31
+ cat > "$SANDBOX/stub-bin" <<'EOF'
32
+ #!/usr/bin/env bash
33
+ [[ "${1:-}" == --list ]] && { echo check-reference; exit 0; }
34
+ exit 2
35
+ EOF
36
+ # A binary carrying the fixture's descriptors too, for the cases where one dispatches.
37
+ cat > "$SANDBOX/stub-bin-full" <<'EOF'
38
+ #!/usr/bin/env bash
39
+ [[ "${1:-}" == --list ]] && { echo check-ported; echo check-vendored; echo check-reference; exit 0; }
40
+ exit 2
41
+ EOF
42
+ chmod +x "$SANDBOX/stub-bin" "$SANDBOX/stub-bin-full"
43
+ DESC='# graph: couples=docs/*.md dir=one valve=none tier=precommit
44
+ # spec: gate-sdk/SPEC.md §check-gate-substrate-parity — fixture descriptor'
45
+
46
+ run() { # run <bin>
47
+ ( cd "$SANDBOX" && env GATE_SDK_KIT_DIRS=kitroot GATE_SDK_NATIVE_BIN="$1" \
48
+ GATE_SDK_NATIVE_CRATE=crate GATE_SDK_NATIVE_SRC=impl \
49
+ "$GATE" scripts conservation.md 2>&1 )
50
+ }
51
+
52
+ expect() { # expect <label> <want-rc> <substring> <got-rc> <output>
53
+ if [[ "$4" -ne "$2" ]]; then
54
+ echo " FAIL [$1]: want exit $2, got $4 -- $5"; fails=$((fails + 1))
55
+ elif ! grep -qF -- "$3" <<<"$5"; then
56
+ echo " FAIL [$1]: exit $2 but output lacks '$3': $5"; fails=$((fails + 1))
57
+ fi
58
+ }
59
+
60
+ # --- no descriptors, binary present: the roster half is the only live half ---
61
+ # The post-revert tree. Assertion B still compares both directions, so the
62
+ # reference-only allowance is what keeps the binary's subcommand from reading as
63
+ # a stranded implementation — the half a descriptor-count guard would blank out.
64
+ printf 'check-alpha\n' > "$SANDBOX/scripts/gates.list"
65
+ out="$(run ./stub-bin)"; rc=$?
66
+ expect no-desc-binary 0 '0 descriptor(s) in parity with the 1-subcommand roster, 1 reference-only' "$rc" "$out"
67
+
68
+ # --- no descriptors, no binary: clean, and it says why the roster went unread ---
69
+ out="$(run ./nonexistent-bin)"; rc=$?
70
+ expect no-desc-no-binary 0 'no binary at ./nonexistent-bin so no subcommand roster to compare' "$rc" "$out"
71
+
72
+ # --- descriptors present, none dispatching, no binary, no target roster ---
73
+ # Every vendored tree after the first cohort lands. Two arms ride the corrected
74
+ # predicate and both must stay quiet here: assertion B's fail-closed arm, and
75
+ # assertion F's missing-roster arm (a consumer receives kit roots, never the crate,
76
+ # so its roster is absent by construction).
77
+ printf '%s\n' "$DESC" > "$SANDBOX/kitroot/checks/check-vendored.gate"
78
+ printf '%s\n' "$DESC" > "$SANDBOX/scripts/check-ported.gate"
79
+ out="$(run ./nonexistent-bin)"; rc=$?
80
+ expect desc-none-dispatching 0 '1 member(s) with one declaration each, 0 of them dispatching to the binary' "$rc" "$out"
81
+ if grep -qF 'no target roster' <<<"$out"; then
82
+ echo " FAIL [desc-none-dispatching-roster]: assertion F red on a declaration nothing dispatches to: $out"
83
+ fails=$((fails + 1))
84
+ fi
85
+
86
+ # --- the near miss: a registered member resolves to a descriptor, no binary ---
87
+ # Exit 2, never 0 — the one way a too-loose predicate passes its own good/ case.
88
+ printf 'check-alpha\ncheck-ported\n' > "$SANDBOX/scripts/gates.list"
89
+ out="$(run ./nonexistent-bin)"; rc=$?
90
+ expect registered-no-binary 2 'registered member(s) dispatch to it' "$rc" "$out"
91
+
92
+ # --- a consumer that received a binary: dispatching, no roster, no crate source ---
93
+ # The vendored-tree shape the consumer smoke is in. Assertion F's missing-roster arm
94
+ # must stay quiet: declaring platform support is the publishing tree's act, and a
95
+ # consumer receives kit roots and an artifact but never the crate.
96
+ out="$(run ./stub-bin-full)"; rc=$?
97
+ expect consumer-with-binary 0 '2 descriptor(s) in parity with the 3-subcommand roster, 1 reference-only' "$rc" "$out"
98
+ if grep -qF 'no target roster' <<<"$out"; then
99
+ echo " FAIL [consumer-with-binary-roster]: assertion F red in a tree that builds nothing: $out"
100
+ fails=$((fails + 1))
101
+ fi
102
+
103
+ # --- the counterpart: a publishing tree dispatching with no roster still reds ---
104
+ # Same configuration but the crate's source is tracked here, which is what makes the
105
+ # tree the one that asserts platform support. Source, not directory presence: build
106
+ # output under the crate root must not read as a publisher.
107
+ PUB="$SANDBOX/pub"
108
+ mkdir -p "$PUB/crate"
109
+ cp -R "$SANDBOX/scripts" "$SANDBOX/kitroot" "$SANDBOX/conservation.md" "$SANDBOX/stub-bin-full" "$PUB/"
110
+ git -C "$PUB" init -q
111
+ printf 'fn main() {}\n' > "$PUB/crate/main.src"
112
+ git -C "$PUB" add crate/main.src
113
+ out="$( cd "$PUB" && env GATE_SDK_KIT_DIRS=kitroot GATE_SDK_NATIVE_BIN=./stub-bin-full \
114
+ GATE_SDK_NATIVE_CRATE=crate GATE_SDK_NATIVE_SRC=impl \
115
+ "$GATE" scripts conservation.md 2>&1 )"; rc=$?
116
+ expect publishing-tree-no-roster 1 'no target roster' "$rc" "$out"
117
+
118
+ if [[ "$fails" -gt 0 ]]; then
119
+ echo "check-gate-substrate-parity.test.sh: $fails case(s) failed"
120
+ exit 1
121
+ fi
122
+ echo "check-gate-substrate-parity.test.sh: clean (descriptor configurations: none with a binary, none without, present-but-none-dispatching with neither binary nor roster, a registered dispatch with no binary, a consumer dispatching to a placed binary with no crate, and the publishing counterpart that still reds — 8 assertions over 6 cases)"
123
+ exit 0