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
@@ -30,6 +30,16 @@ resolve_rel() {
30
30
  gate_resolve "$1" "${REL_DIRS[@]}"
31
31
  }
32
32
 
33
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — the hook is a persisted consumer of the
34
+ # invocation argv, so it emits `<binary> <name>` for a ported member; the knob's
35
+ # relative default is what keeps the tracked hook byte-identical across clones
36
+ command_rel() {
37
+ local -a argv=()
38
+ mapfile -t argv < <(gate_command "$1" "${REL_DIRS[@]}") || return 1
39
+ [[ ${#argv[@]} -gt 0 ]] || return 1
40
+ printf '%s' "${argv[*]}"
41
+ }
42
+
33
43
  declare -A MANUAL=()
34
44
  read_manual() {
35
45
  local line name="" buf=""
@@ -69,10 +79,10 @@ emit_block() {
69
79
  local gate="$1" couples trigger mode gen relpath
70
80
  couples="$(manifest_field "$gate" couples)"
71
81
  trigger="$(manifest_field "$gate" trigger)"; trigger="${trigger:-$couples}"
72
- trigger="$(gate_expand_couples "$trigger")"
82
+ gate_expand_couples_var trigger "$trigger"
73
83
  mode="$(manifest_field "$gate" mode)"
74
84
  gen="$(manifest_field "$gate" gen)"
75
- relpath="$(resolve_rel "$gate")" || relpath="$GATES_DIR/$gate.sh"
85
+ relpath="$(command_rel "$gate")" || relpath="$GATES_DIR/$gate.sh"
76
86
 
77
87
  printf '\n'
78
88
  if [[ "$gen" == manual ]]; then
@@ -238,7 +248,7 @@ HEAD
238
248
  local c relpath
239
249
  while IFS= read -r c; do
240
250
  [[ -n "$c" ]] || continue
241
- relpath="$(resolve_rel "$c")" || relpath="$GATES_DIR/$c.sh"
251
+ relpath="$(command_rel "$c")" || relpath="$GATES_DIR/$c.sh"
242
252
  printf '\nrun_gate %s %s "$msg_file"\n' "$c" "$relpath"
243
253
  done < <(commit_msg_gates)
244
254
 
@@ -70,6 +70,126 @@ fi
70
70
  # spec: gate-sdk/SPEC.md §Consumer smoke — hard reset (not checkout) so a violation that staged its shape is unstaged too
71
71
  restore() { ( cd "$SCRATCH" && git reset -q --hard && git clean -qfd ); }
72
72
 
73
+ # spec: gate-sdk/SPEC.md §Consumer smoke — the registration accounting: one pass over the union of the vendored kits' checks/ against the scratch registry, between the green-battery assertion and the violation phase
74
+ # spec: gate-sdk/SPEC.md §Consumer smoke — the registration accounting: thecorroborating probe's tree: the invoking repo that ships the kits, where a kit's own surfaces exist
75
+ HOST_TREE="${SDK%/*}"
76
+ # spec: gate-sdk/SPEC.md §Consumer smoke — the scratch consumer is zero-config, so its registry sits at gate-sdk's default gates dir, where that kit's own smoke/install.sh writes it
77
+ scratch_list="$SCRATCH/scripts/gates.list"
78
+ [[ -f "$scratch_list" ]] || {
79
+ echo "run-consumer-smoke: no gate registry at $scratch_list after install" >&2
80
+ exit 2
81
+ }
82
+
83
+ declare -A acct_registered=() acct_kit=() acct_root=()
84
+ declare -A acct_reason=() acct_declkit=() acct_selfset=()
85
+
86
+ while IFS= read -r g; do
87
+ [[ -n "$g" ]] && acct_registered["$g"]=1
88
+ done < <(gates_list_members "$scratch_list")
89
+
90
+ # spec: gate-sdk/SPEC.md §Consumer smoke — the registration accounting reads *declaration paths*, both spellings: a gate whose implementation ported to a compiled subcommand still ships, still earns or forfeits a scratch-battery slot, and must not leave this pass's universe by changing substrate
91
+ shopt -s nullglob
92
+ for r in "${roots[@]}"; do
93
+ kit="$(basename "$r")"
94
+ acct_root["$kit"]="$r"
95
+ for f in "$SCRATCH/$kit"/checks/check-*.sh "$SCRATCH/$kit"/checks/check-*.gate; do
96
+ g="$(basename "$f")"; g="${g%.*}"
97
+ acct_kit["$g"]="$kit"
98
+ done
99
+ done
100
+ shopt -u nullglob
101
+
102
+ for r in "${roots[@]}"; do
103
+ kit="$(basename "$r")"
104
+ while IFS= read -r line; do
105
+ line="${line#*smoke-unregistered:}"
106
+ read -r dg reason <<<"$line"
107
+ reason="${reason#—}"; reason="${reason#--}"; reason="${reason#-}"; reason="${reason# }"
108
+ if [[ -z "$dg" || -z "$reason" ]]; then
109
+ echo "CONSUMER-SMOKE: FAIL — $kit/smoke/install.sh has a '# smoke-unregistered:' line missing its gate name or its reason"
110
+ echo " help: the shape is '# smoke-unregistered: <gate-name> — <reason>'; both fields are read (gate-sdk/SPEC.md §Consumer smoke)."
111
+ exit 1
112
+ fi
113
+ acct_reason["$dg"]="$reason"
114
+ acct_declkit["$dg"]="$kit"
115
+ done < <(grep -E '^[[:space:]]*#[[:space:]]*smoke-unregistered:' "$SCRATCH/$kit/smoke/install.sh" || true)
116
+ done
117
+
118
+ mapfile -t acct_unreg < <(
119
+ for g in "${!acct_kit[@]}"; do
120
+ [[ -n "${acct_registered[$g]:-}" ]] || printf '%s\n' "$g"
121
+ done | sort
122
+ )
123
+
124
+ acct_self=0
125
+ acct_hand=0
126
+ acct_bad=()
127
+ acct_stale=()
128
+
129
+ # spec: gate-sdk/SPEC.md §Consumer smoke — the registration accounting probes through gate_command's substrate-blind dispatch, so a ported gate is probed as the gate it is rather than skipped for want of a .sh; an unresolvable dispatch is the exit-2 the contract already means by "could not run"
130
+ acct_probe() { # acct_probe <tree> <checks-dir> <gate>
131
+ local argv=()
132
+ mapfile -t argv < <( cd "$1" && gate_command "$3" "$2" 2>/dev/null )
133
+ [[ ${#argv[@]} -gt 0 ]] || return 2
134
+ ( cd "$1" && "${argv[@]}" ) >/dev/null 2>&1
135
+ }
136
+
137
+ acct_start_ns=$(date +%s%N)
138
+ for g in "${acct_unreg[@]}"; do
139
+ [[ -n "$g" ]] || continue
140
+ kit="${acct_kit[$g]}"
141
+ acct_probe "$SCRATCH" "$SCRATCH/$kit/checks" "$g"
142
+ rc_s=$?
143
+ rc_h=""
144
+ if [[ "$rc_s" -eq 2 ]]; then
145
+ # spec: gate-sdk/SPEC.md §Consumer smoke — the registration accounting: exit 2 is usage/environment failure generally, so the permanent exemption is granted only when the same gate does NOT exit 2 where its surface exists
146
+ acct_probe "$HOST_TREE" "${acct_root[$kit]}/checks" "$g"
147
+ rc_h=$?
148
+ if [[ "$rc_h" -ne 2 ]]; then
149
+ acct_selfset["$g"]=1
150
+ acct_self=$((acct_self + 1))
151
+ continue
152
+ fi
153
+ fi
154
+ # spec: gate-sdk/SPEC.md §Consumer smoke — the registration accounting: a declaration is honoured only from the kit that ships the gate, so a foreign-kit line leaves the omission unaccounted as well as stale
155
+ if [[ -n "${acct_reason[$g]:-}" && "${acct_declkit[$g]}" == "$kit" ]]; then
156
+ acct_hand=$((acct_hand + 1))
157
+ continue
158
+ fi
159
+ acct_bad+=("$kit ships $g — scratch exit $rc_s${rc_h:+, invoking-repo exit $rc_h}")
160
+ done
161
+ acct_ms=$(( ($(date +%s%N) - acct_start_ns) / 1000000 ))
162
+
163
+ if [[ ${#acct_reason[@]} -gt 0 ]]; then
164
+ for g in "${!acct_reason[@]}"; do
165
+ dk="${acct_declkit[$g]}"
166
+ if [[ -n "${acct_registered[$g]:-}" ]]; then
167
+ acct_stale+=("$dk declares $g unregistered, but it is registered")
168
+ elif [[ "${acct_kit[$g]:-}" != "$dk" ]]; then
169
+ acct_stale+=("$dk declares $g, which that kit does not ship")
170
+ elif [[ -n "${acct_selfset[$g]:-}" ]]; then
171
+ acct_stale+=("$dk declares $g, which the probe already exempts — probe first, reasons second")
172
+ fi
173
+ done
174
+ fi
175
+
176
+ # spec: gate-sdk/SPEC.md §Consumer smoke — a probe may leave scratch artifacts; the violation phase starts from the committed baseline
177
+ restore
178
+
179
+ # spec: gate-sdk/SPEC.md §Consumer smoke — the registration accounting: the measured cost is reported on every run, red or green, and never cached across runs
180
+ echo "CONSUMER-SMOKE: accounting — ${#acct_unreg[@]} unregistered gate(s) probed in ${acct_ms}ms ($acct_self self-declared, $acct_hand hand-declared, ${#acct_bad[@]} unaccounted)"
181
+
182
+ if [[ ${#acct_bad[@]} -gt 0 || ${#acct_stale[@]} -gt 0 ]]; then
183
+ echo "CONSUMER-SMOKE: FAIL — the registration accounting is not satisfied"
184
+ for l in "${acct_bad[@]:-}"; do [[ -n "$l" ]] && echo " unaccounted: $l"; done
185
+ for l in "${acct_stale[@]:-}"; do [[ -n "$l" ]] && echo " stale declaration: $l"; done
186
+ echo ""
187
+ echo " help: register the gate in that kit's smoke/install.sh, or declare the omission"
188
+ echo " beside its registration block with '# smoke-unregistered: <gate-name> — <reason>'"
189
+ echo " (gate-sdk/SPEC.md §Consumer smoke)."
190
+ exit 1
191
+ fi
192
+
73
193
  fired=0
74
194
  for r in "${roots[@]}"; do
75
195
  kit="$(basename "$r")"
@@ -108,5 +228,5 @@ if [[ "$rc" -ne 0 ]] || ! grep -qE 'All [0-9]+ gates passed' <<<"$out"; then
108
228
  exit 1
109
229
  fi
110
230
 
111
- echo "CONSUMER-SMOKE: clean ($installed kits installed, $fired violations fired)"
231
+ echo "CONSUMER-SMOKE: clean ($installed kits installed, $fired violations fired, ${#acct_registered[@]} gates registered, $acct_self self-declared, $acct_hand hand-declared)"
112
232
  exit 0
@@ -25,17 +25,25 @@ pairs=0
25
25
  logic_fail=0
26
26
  harness_fail=0
27
27
 
28
+ # spec: gate-sdk/SPEC.md §run-gate-tests — the case runs whatever the member dispatches to: gate_command yields the shell script's one-element argv or the binary's two-element `<binary> <name>`, so the fixture pair is the parity oracle across both substrates rather than a shell-only one. argv[0] is absolutized here because the case runs after a `cd` into its own dir and the binary knob's default is deliberately a repo-relative path (§lib/gate.sh).
28
29
  run_case() {
29
30
  local gate="$1" casedir="$2" want="$3" expect="$4"
30
- local gate_path
31
- if ! gate_path="$(gate_resolve "$gate" "${GATE_DIRS[@]+"${GATE_DIRS[@]}"}")"; then
32
- echo " HARNESS: $gate.sh resolves in none of: ${GATE_DIRS[*]}"
31
+ local -a argv=()
32
+ if ! mapfile -t argv < <(gate_command "$gate" "${GATE_DIRS[@]+"${GATE_DIRS[@]}"}"); then
33
+ echo " HARNESS: $gate resolves in none of: ${GATE_DIRS[*]}"
33
34
  return 2
34
35
  fi
35
- if [[ ! -x "$gate_path" ]]; then
36
- echo " HARNESS: $gate_path is not executable"
36
+ if [[ ${#argv[@]} -eq 0 ]]; then
37
+ echo " HARNESS: $gate resolves in none of: ${GATE_DIRS[*]}"
37
38
  return 2
38
39
  fi
40
+ if [[ ! -x "${argv[0]}" ]]; then
41
+ echo " HARNESS: ${argv[0]} is not executable"
42
+ return 2
43
+ fi
44
+ if [[ "${argv[0]}" != /* ]]; then
45
+ argv[0]="$(cd "$(dirname "${argv[0]}")" && pwd)/$(basename "${argv[0]}")"
46
+ fi
39
47
 
40
48
  local -a args=()
41
49
  if [[ -f "$casedir/args" ]]; then
@@ -44,7 +52,7 @@ run_case() {
44
52
  fi
45
53
 
46
54
  local out rc
47
- out="$( cd "$casedir" && "$gate_path" "${args[@]+"${args[@]}"}" 2>&1 )"
55
+ out="$( cd "$casedir" && "${argv[@]}" "${args[@]+"${args[@]}"}" 2>&1 )"
48
56
  rc=$?
49
57
 
50
58
  if [[ "$rc" -eq 2 ]]; then
@@ -57,12 +65,35 @@ run_case() {
57
65
  printf ' %s\n' "$out"
58
66
  return 1
59
67
  fi
60
- if [[ -n "$expect" ]] && ! grep -qF -- "$expect" <<<"$out"; then
61
- echo " FAIL: $gate $(basename "$casedir") exit $rc OK but output lacks expected substring:"
62
- echo " want: $expect"
68
+ # Every non-blank expect line is its own assertion: grep -F would read a
69
+ # multi-line pattern as alternatives and pass on any one of them.
70
+ local -a missing=()
71
+ local want_line
72
+ while IFS= read -r want_line; do
73
+ [[ -z "${want_line//[[:space:]]/}" ]] && continue
74
+ grep -qF -- "$want_line" <<<"$out" || missing+=("$want_line")
75
+ done <<<"$expect"
76
+ if [[ "${#missing[@]}" -gt 0 ]]; then
77
+ echo " FAIL: $gate $(basename "$casedir") exit $rc OK but output lacks expected line(s):"
78
+ printf ' missing: %s\n' "${missing[@]}"
63
79
  printf ' %s\n' "$out"
64
80
  return 1
65
81
  fi
82
+
83
+ # spec: gate-sdk/SPEC.md §Output contract — asserted at runtime, both cases
84
+ if [[ "$want" -eq 0 ]]; then
85
+ if ! grep -qE '^[A-Z][A-Z0-9-]*: clean \(.*\)$' <<<"$out"; then
86
+ echo " FAIL: $gate $(basename "$casedir") exited 0 but emitted no '<NAME>: clean (…)' line"
87
+ printf ' %s\n' "$out"
88
+ return 1
89
+ fi
90
+ else
91
+ if ! grep -qE '(^|[[:space:]])help:' <<<"$out"; then
92
+ echo " FAIL: $gate $(basename "$casedir") reported a violation with no 'help:' remedy line"
93
+ printf ' %s\n' "$out"
94
+ return 1
95
+ fi
96
+ fi
66
97
  return 0
67
98
  }
68
99
 
@@ -60,7 +60,7 @@ select_for() {
60
60
  }
61
61
  couples="$(gate_manifest_field "$src" couples)"
62
62
  trigger="$(gate_manifest_field "$src" trigger)"; trigger="${trigger:-$couples}"
63
- trigger="$(gate_expand_couples "$trigger")"
63
+ gate_expand_couples_var trigger "$trigger"
64
64
  mode="$(gate_manifest_field "$src" mode)"
65
65
  IFS=',' read -ra globs <<<"$trigger"
66
66
  if [[ "$trigger" == '*' ]]; then
@@ -115,12 +115,23 @@ for i in "${!RUN_MEMBERS[@]}"; do
115
115
  fi
116
116
  start_ns=$(date +%s%N)
117
117
  out=""; ok=1
118
- if gate_path="$(gate_resolve "$c" "${RESOLVE_DIRS[@]}")"; then
119
- if out="$("$gate_path" "${args[@]}" 2>&1)"; then
118
+ # spec: gate-sdk/SPEC.md §lib/gate.sh — execute the invocation argv, keeping
119
+ # gate_command's exit 2 (dispatch harness error) distinct from its exit 1
120
+ # (nothing declares this member)
121
+ argv_out="$(gate_command "$c" "${RESOLVE_DIRS[@]}" 2>&1)"; cstatus=$?
122
+ argv=()
123
+ [[ -n "$argv_out" && "$cstatus" -eq 0 ]] && mapfile -t argv <<<"$argv_out"
124
+ if [[ "$cstatus" -eq 0 && ${#argv[@]} -gt 0 ]]; then
125
+ if out="$("${argv[@]}" "${args[@]}" 2>&1)"; then
120
126
  tail=" PASS: $c"
121
127
  else
122
128
  rc=$?; ok=0; tail=" FAIL: $c (exit $rc)"; failed+=("$c")
123
129
  fi
130
+ elif [[ "$cstatus" -eq 2 ]]; then
131
+ ok=0
132
+ out="$argv_out"
133
+ tail=" FAIL: $c (dispatch harness error, exit 2)"
134
+ failed+=("$c")
124
135
  else
125
136
  ok=0
126
137
  out="$c listed in $LIST but resolves in none of: ${RESOLVE_DIRS[*]}"
@@ -139,6 +150,24 @@ done
139
150
  printf 'TOTAL %d\n' "$total_ms" >> "$TIMINGS"
140
151
 
141
152
  printf '\n===== gates summary =====\n'
153
+ # spec: gate-sdk/SPEC.md §run-gates — a declared omission is what keeps `All N gates passed.` honest as the roster-collapse tripwire: an omitted member shrinks N legitimately, so it is reported on its own line beside the summary. Separate is load-bearing rather than tidy — the consumer smokes match the green phrase against this output, so the line must not carry it
154
+ report_omissions() {
155
+ local reason count
156
+ while read -r count reason; do
157
+ [[ -n "$reason" ]] || continue
158
+ case "$reason" in
159
+ substrate-unavailable)
160
+ printf '%d gate(s) omitted (%s): no prebuilt gate binary is published for this platform.\n' \
161
+ "$count" "$reason" ;;
162
+ digest-unverifiable)
163
+ printf '%d gate(s) omitted (%s): install sha256sum or shasum, then re-run checkwright init.\n' \
164
+ "$count" "$reason" ;;
165
+ *)
166
+ printf '%d gate(s) omitted (%s).\n' "$count" "$reason" ;;
167
+ esac
168
+ done < <(awk '$1 == "#" && $2 == "omitted:" { print $4 }' "$LIST" | sort | uniq -c)
169
+ }
170
+ report_omissions
142
171
  if [[ ${#failed[@]} -eq 0 ]]; then
143
172
  printf 'All %d gates passed.\n' "${#RUN_MEMBERS[@]}"
144
173
  exit 0
@@ -83,7 +83,7 @@ for r in "${fromroots[@]}"; do kitname_seen["$(basename "$r")"]=1; done
83
83
 
84
84
  ( cd "$CONS" && bash gate-sdk/bin/gen-pre-commit.sh --write >/dev/null ) \
85
85
  || { echo "upgrade-smoke: phase A gen-pre-commit failed at TO ($TO)" >&2; exit 2; }
86
- ( cd "$CONS" && bash gate-sdk/checks/check-graph.sh --emit > .workflow/CHECK-GRAPH.html ) \
86
+ ( cd "$CONS" && bash gate-sdk/checks/check-graph.sh --emit > scripts/CHECK-GRAPH.html ) \
87
87
  || { echo "upgrade-smoke: phase A check-graph --emit failed at TO ($TO)" >&2; exit 2; }
88
88
  if [[ -f "$CONS/doctrine-kit/bin/install-doctrine.sh" ]]; then
89
89
  ( cd "$CONS" && bash doctrine-kit/bin/install-doctrine.sh >/dev/null ) \
@@ -96,7 +96,7 @@ stray=()
96
96
  while IFS= read -r p; do
97
97
  [[ -n "$p" ]] || continue
98
98
  case "$p" in
99
- scripts/git-hooks/pre-commit|.workflow/CHECK-GRAPH.html|CLAUDE.md) continue ;;
99
+ scripts/git-hooks/pre-commit|scripts/CHECK-GRAPH.html|CLAUDE.md) continue ;;
100
100
  esac
101
101
  top="${p%%/*}"
102
102
  [[ -n "${kitname_seen[$top]:-}" ]] || stray+=("$p")
@@ -132,7 +132,7 @@ fi
132
132
 
133
133
  if [[ "$decl_st" -eq 2 ]]; then
134
134
  echo "upgrade-smoke: FAIL — TO ($ver) resolves note $decl_src, which carries no 'Tightened gates' section:" >&2
135
- echo " every release note carries all three fixed sections (docs/install.md §The upgrade contract)." >&2
135
+ echo " every release note carries the fixed sections its note grammar rosters (docs/install.md §The upgrade contract)." >&2
136
136
  exit 1
137
137
  fi
138
138
  if [[ "$decl_st" -ne 0 ]]; then
@@ -0,0 +1,2 @@
1
+ # graph: couples=.github/workflows/*.yml,.github/workflows/*.yaml,.github/ISSUE_TEMPLATE/*.yml,docs/_config.yml,kit:templates/*.yml,kit:templates/*.yaml dir=one valve=none tier=precommit
2
+ # spec: gate-sdk/SPEC.md §check-action-gh-repo — a job whose run: bodies invoke gh establishes a repository context: a checkout before the first call, GH_REPO in scope, or --repo on every call
@@ -0,0 +1,2 @@
1
+ # graph: couples=.github/workflows/*.yml,.github/workflows/*.yaml,.github/ISSUE_TEMPLATE/*.yml,docs/_config.yml,kit:templates/*.yml,kit:templates/*.yaml dir=one valve=none tier=precommit
2
+ # spec: gate-sdk/SPEC.md §check-action-pinning — every `uses:` ref in a scanned YAML file is immutable: a full 40-hex commit SHA, or a repo-local ./ path git pins at checkout
@@ -93,6 +93,7 @@ function processkey(rest, col, v) {
93
93
  if (v ~ /^>/) refuse(FNR, "a folded block scalar (run: " v ")")
94
94
  if (v ~ /^\|[0-9]/) refuse(FNR, "an explicit block-scalar indentation indicator (run: " v ")")
95
95
  if (v ~ /^\*/) refuse(FNR, "a YAML alias as the run: value (run: " v ")")
96
+ if (v ~ /^&/) refuse(FNR, "a YAML anchor on the run: value (run: " v ")")
96
97
  if (v ~ /^\|[-+]?$/) { startblock(col, FNR); return }
97
98
  if (v == "") return
98
99
  printf "P\t%d\n", FNR
@@ -175,7 +176,8 @@ for f in "${files[@]}"; do
175
176
  echo " $f:$a: $b" >&2
176
177
  echo " help: a multi-line run: body in an Actions-shaped file must be a literal block" >&2
177
178
  echo " scalar written 'run: |' (or '|-' / '|+'), with no explicit indentation" >&2
178
- echo " indicator and no YAML alias, and every \${{ }} on a body line balanced." >&2
179
+ echo " indicator and no YAML anchor or alias, and every \${{ }} on a body line" >&2
180
+ echo " balanced." >&2
179
181
  exit 2
180
182
  ;;
181
183
  P) plain=$((plain + 1)) ;;
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # graph: couples=scripts/core-files.list dir=one valve=none tier=precommit
2
+ # graph: couples=scripts/core-files.list,kit:SPEC.md,kit:README.md dir=one valve=none tier=precommit
3
3
  # spec: gate-sdk/SPEC.md §check-core-files — every path in the core-files manifest exists in the worktree and is tracked
4
4
  #
5
5
  # usage: check-core-files.sh [manifest]
@@ -18,12 +18,35 @@ if [[ ! -e "$MANIFEST" ]]; then
18
18
  fi
19
19
  [[ -r "$MANIFEST" ]] || { echo "check-core-files: manifest not readable: $MANIFEST" >&2; exit 2; }
20
20
 
21
- mapfile -t paths < <(gates_list_members "$MANIFEST")
22
- if [[ ${#paths[@]} -eq 0 ]]; then
21
+ mapfile -t lines < <(gates_list_members "$MANIFEST")
22
+ if [[ ${#lines[@]} -eq 0 ]]; then
23
23
  echo "CORE-FILES: clean (manifest $MANIFEST lists no paths)"
24
24
  exit 0
25
25
  fi
26
26
 
27
+ # spec: gate-sdk/SPEC.md §check-core-files — a kit: line derives one path per kit root; the
28
+ # wildcard refusal is fail-closed because this reader requires each expanded path to exist,
29
+ # which is a different invariant from the glob match a couples= field performs
30
+ paths=(); _cf_expanded=""
31
+ for line in "${lines[@]}"; do
32
+ if [[ "$line" == kit:* ]]; then
33
+ case "${line#kit:}" in
34
+ *'*'* | *'?'* | *'['*)
35
+ echo "check-core-files: kit: token carries a wildcard in $MANIFEST: $line" >&2
36
+ echo " help: this manifest requires every expanded path to exist and be tracked," >&2
37
+ echo " which a wildcard cannot express — name an exact per-kit basename" >&2
38
+ echo " (e.g. kit:SPEC.md), or hand-list the paths." >&2
39
+ exit 2
40
+ ;;
41
+ esac
42
+ gate_expand_couples_var _cf_expanded "$line"
43
+ IFS=',' read -ra _cf_parts <<<"$_cf_expanded"
44
+ paths+=("${_cf_parts[@]}")
45
+ else
46
+ paths+=("$line")
47
+ fi
48
+ done
49
+
27
50
  git rev-parse --git-dir >/dev/null 2>&1 || {
28
51
  echo "check-core-files: not a git repository — cannot verify tracked status" >&2; exit 2; }
29
52
 
@@ -48,5 +71,5 @@ if [[ ${#missing[@]} -gt 0 || ${#untracked[@]} -gt 0 ]]; then
48
71
  exit 1
49
72
  fi
50
73
 
51
- echo "CORE-FILES: clean ($present listed path(s) present and tracked in $MANIFEST)"
74
+ echo "CORE-FILES: clean ($present manifest path(s) present and tracked in $MANIFEST)"
52
75
  exit 0
@@ -47,10 +47,20 @@ is_pruned() {
47
47
  }
48
48
 
49
49
  bad=(); count=0
50
+ notexec=(); dcount=0
50
51
  while IFS= read -r line; do
51
52
  [[ -n "$line" ]] || continue
52
53
  mode="${line%% *}"
53
54
  path="${line#*$'\t'}"
55
+ # assertion: a .gate descriptor is data — never sourced, never run — so it
56
+ # must be committed non-executable; stated so "not executable" cannot read
57
+ # as "not covered" (gate-sdk/SPEC.md §check-exec-bit)
58
+ if [[ "$path" == *.gate ]]; then
59
+ is_pruned "$path" && continue
60
+ dcount=$((dcount + 1))
61
+ [[ "$mode" == 100644 ]] || notexec+=("$path (index mode $mode)")
62
+ continue
63
+ fi
54
64
  [[ "$path" == *.sh ]] || continue
55
65
  matched=0
56
66
  for g in "${EXEC_GLOBS[@]}"; do
@@ -72,5 +82,14 @@ if [[ ${#bad[@]} -gt 0 ]]; then
72
82
  exit 1
73
83
  fi
74
84
 
75
- echo "EXEC-BIT: clean ($count by-path-invoked script(s) at index mode 100755)"
85
+ if [[ ${#notexec[@]} -gt 0 ]]; then
86
+ echo "check-exec-bit: .gate descriptor(s) committed executable — a descriptor is data"
87
+ echo "carrying a manifest and directives, never sourced and never run; an executable one"
88
+ echo "invites a reader to run a file with no interpreter line:"
89
+ printf ' %s\n' "${notexec[@]}"
90
+ echo " help: git update-index --chmod=-x <path> (and chmod -x locally), then recommit."
91
+ exit 1
92
+ fi
93
+
94
+ echo "EXEC-BIT: clean ($count by-path-invoked script(s) at index mode 100755; $dcount .gate descriptor(s) non-executable)"
76
95
  exit 0
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env bash
2
+ # graph: couples=kit:checks/*.gate,scripts/gates.list,native/* dir=one valve=none tier=precommit
3
+ # spec: gate-sdk/SPEC.md §check-gate-binary-fresh — whenever a registered member resolving to a .gate descriptor makes the binary load-bearing, the binary was built from the source now in the tree
4
+ #
5
+ # usage: check-gate-binary-fresh.sh [gates-dir] [tree-stamp-file]
6
+ # No second argument: computes the tree-side stamp from the crate's tracked
7
+ # source with git. With one: reads it from that file (hermetic fixtures).
8
+ set -uo pipefail
9
+
10
+ SDK="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
11
+ # shellcheck source=../lib/gate.sh
12
+ source "$SDK/lib/gate.sh"
13
+
14
+ GATES_DIR="${1:-$(gate_sdk_gates_dir)}"
15
+ STAMP_FILE="${2:-}"
16
+ LIST="$GATES_DIR/gates.list"
17
+ BIN="$(gate_native_bin)"
18
+ CRATE="$(gate_native_crate)"
19
+ REBUILD="cargo build --release --manifest-path $CRATE/Cargo.toml"
20
+
21
+ RESOLVE_DIRS=("$GATES_DIR")
22
+ while IFS= read -r k; do RESOLVE_DIRS+=("$k/checks"); done < <(gate_kit_roots_rel)
23
+
24
+ # spec: gate-sdk/SPEC.md §check-gate-binary-fresh — the descriptor set is the trigger, derived over the resolve dirs as check-gate-substrate-parity assertion B already derives it
25
+ mapfile -t DESCRIPTORS < <(
26
+ for d in "${RESOLVE_DIRS[@]}"; do
27
+ [[ -d "$d" ]] || continue
28
+ for f in "$d"/*.gate; do
29
+ [[ -f "$f" ]] || continue
30
+ b="${f##*/}"; printf '%s\n' "${b%.gate}"
31
+ done
32
+ done | sort -u
33
+ )
34
+
35
+ # spec: gate-sdk/SPEC.md §check-gate-binary-fresh — a descriptor on disk is a declaration; a
36
+ # registered member resolving to one is a dispatch, and only a dispatch makes the binary
37
+ # load-bearing. The live registry is therefore an input, and an absent one is "cannot verify".
38
+ [[ -f "$LIST" ]] || {
39
+ echo "check-gate-binary-fresh: no gate registry at $LIST — the live member set is what decides whether the binary is load-bearing, so the check could not run; treating as failure (not clean)" >&2
40
+ echo " help: pass the gates dir carrying gates.list as the first argument, or set GATE_SDK_GATES_DIR." >&2
41
+ exit 2
42
+ }
43
+ mapfile -t DISPATCHING < <(
44
+ while IFS= read -r m; do
45
+ [[ -n "$m" ]] || continue
46
+ src="$(gate_resolve "$m" "${RESOLVE_DIRS[@]}")" || continue
47
+ [[ "$src" == *.gate ]] && printf '%s\n' "$m"
48
+ done < <(gates_list_members "$LIST")
49
+ )
50
+
51
+ # spec: gate-sdk/SPEC.md §check-gate-binary-fresh — nothing dispatching is a clean report, not a
52
+ # skipped assertion: no gate dispatches to the binary, so nothing can run stale. Both counts are
53
+ # named, so a reader can tell "no descriptors" from "descriptors nothing dispatches to".
54
+ # Deliberately *not* the split-halves shape check-gate-substrate-parity assertion B uses, for
55
+ # the reason that section states.
56
+ if [[ ${#DISPATCHING[@]} -eq 0 ]]; then
57
+ echo "GATE-BINARY-FRESH: clean (${#DESCRIPTORS[@]} .gate descriptor(s) across ${#RESOLVE_DIRS[@]} resolve dir(s), 0 dispatched to by a live member of $LIST, so nothing dispatches to $BIN and no build can be stale; crate $CRATE unread)"
58
+ exit 0
59
+ fi
60
+
61
+ # spec: gate-sdk/SPEC.md §Fail-closed contract — with the binary load-bearing, an absent
62
+ # or unreadable one is "cannot verify", which must not share an exit code with "verified fresh"
63
+ if [[ ! -x "$BIN" ]]; then
64
+ echo "check-gate-binary-fresh: $BIN is absent or not executable, but ${#DISPATCHING[@]} registered member(s) dispatch to it — the check could not run; treating as failure (not clean)" >&2
65
+ echo " help: build it — $REBUILD" >&2
66
+ exit 2
67
+ fi
68
+
69
+ baked="$("$BIN" --source-stamp 2>/dev/null)"; st=$?
70
+ fail_closed "$st" check-gate-binary-fresh "$BIN --source-stamp"
71
+ baked="${baked%%$'\n'*}"
72
+ [[ -n "$baked" ]] || {
73
+ echo "check-gate-binary-fresh: $BIN --source-stamp reported no stamp — the check could not run; treating as failure (not clean)" >&2
74
+ echo " help: rebuild it — $REBUILD" >&2
75
+ exit 2
76
+ }
77
+
78
+ if [[ -n "$STAMP_FILE" ]]; then
79
+ [[ -r "$STAMP_FILE" ]] || { echo "check-gate-binary-fresh: tree-stamp file not readable: $STAMP_FILE" >&2; exit 2; }
80
+ tree="$(cat -- "$STAMP_FILE")"; st=$?
81
+ fail_closed "$st" check-gate-binary-fresh cat
82
+ tree="${tree%%$'\n'*}"
83
+ source_desc="$STAMP_FILE"
84
+ else
85
+ tree="$(gate_native_source_stamp)" || {
86
+ echo "check-gate-binary-fresh: git could not hash the tracked source under $CRATE — the check could not run; treating as failure (not clean)" >&2
87
+ echo " help: the stamp is git's content identity for the crate's tracked source set, so the crate root must be a tracked directory inside a git worktree." >&2
88
+ exit 2
89
+ }
90
+ source_desc="$CRATE"
91
+ fi
92
+ [[ -n "$tree" ]] || { echo "check-gate-binary-fresh: no tree-side stamp from $source_desc" >&2; exit 2; }
93
+
94
+ if [[ "$baked" != "$tree" ]]; then
95
+ echo "check-gate-binary-fresh: the gate binary was not built from the source now in the tree:"
96
+ echo " $BIN reports source stamp $baked"
97
+ echo " $source_desc hashes to $tree"
98
+ echo " ${#DISPATCHING[@]} descriptor(s) dispatch to that binary: ${DISPATCHING[*]}"
99
+ echo " help: rebuild it — $REBUILD"
100
+ echo " Until then the descriptor-named gate(s) above run the old implementation"
101
+ echo " and pass on code that is not what is committed."
102
+ exit 1
103
+ fi
104
+
105
+ echo "GATE-BINARY-FRESH: clean (${#DESCRIPTORS[@]} .gate descriptor(s) across ${#RESOLVE_DIRS[@]} resolve dir(s), ${#DISPATCHING[@]} dispatched to by a live member of $LIST; $BIN built from the source now in $source_desc, stamp $baked)"
106
+ exit 0
@@ -26,11 +26,9 @@ done < <(awk '
26
26
  /^## Deferred/ { s=1; next }
27
27
  /^## Done/ { s=0 }
28
28
  /^## Lessons Learned/{ s=0 }
29
- s {
30
- while (match($0, /\*\*[a-z0-9][a-z0-9-]*\*\*/)) {
31
- print substr($0, RSTART+2, RLENGTH-4)
32
- $0 = substr($0, RSTART+RLENGTH)
33
- }
29
+ s && $0 ~ /^[[:space:]]*-[[:space:]]+\*\*[a-z0-9][a-z0-9-]*\*\*/ {
30
+ match($0, /\*\*[a-z0-9][a-z0-9-]*\*\*/)
31
+ print substr($0, RSTART+2, RLENGTH-4)
34
32
  }
35
33
  ' "$QUEUE" 2>/dev/null)
36
34
 
@@ -71,7 +69,8 @@ arrays=0
71
69
  scan_files=()
72
70
  shopt -s nullglob
73
71
  for d in "${DIRS[@]}"; do
74
- scan_files+=("$d"/*.sh)
72
+ # spec: gate-sdk/SPEC.md §Meta-gate conservation for the binary substrate
73
+ scan_files+=("$d"/*.sh "$d"/*.gate)
75
74
  done
76
75
  shopt -u nullglob
77
76
 
@@ -102,5 +101,5 @@ if [[ ${#errors[@]} -gt 0 ]]; then
102
101
  echo " help: annotate each exemption element '# until: <live-slug>' or '# permanent: <reason>'"
103
102
  exit 1
104
103
  fi
105
- echo "GATE-EXEMPTION-TASKS: clean ($arrays exemption array(s); every element declares until-with-live-task or permanent-with-reason)"
104
+ echo "GATE-EXEMPTION-TASKS: clean ($arrays exemption array(s), ${#IS_LIVE[@]} live task slug(s); every element declares until-with-live-task or permanent-with-reason)"
106
105
  exit 0
@@ -22,6 +22,7 @@ while IFS= read -r k; do RESOLVE_DIRS+=("$k/checks"); done < <(gate_kit_roots)
22
22
  missing=()
23
23
  no_help=()
24
24
  total=0
25
+ runtime=0
25
26
  while IFS= read -r m; do
26
27
  [[ -n "$m" ]] || continue
27
28
  total=$((total + 1))
@@ -29,6 +30,13 @@ while IFS= read -r m; do
29
30
  missing+=("$m (source resolves in none of: ${RESOLVE_DIRS[*]})")
30
31
  continue
31
32
  fi
33
+ # spec: gate-sdk/SPEC.md §Output contract — the source-grep is the oracle only
34
+ # for a member no fixture case can reach; every fixtured member is asserted on
35
+ # its real output by the runner (§run-gate-tests), which no substrate escapes
36
+ if ! grep -q '^# no-fixture:' "$src"; then
37
+ runtime=$((runtime + 1))
38
+ continue
39
+ fi
32
40
  if ! grep -Eq '(echo|printf).*: clean' "$src"; then
33
41
  missing+=("$m (no '<NAME>: clean (…)' success line)")
34
42
  fi
@@ -61,5 +69,5 @@ if [[ ${#missing[@]} -gt 0 || ${#no_help[@]} -gt 0 ]]; then
61
69
  exit 1
62
70
  fi
63
71
 
64
- echo "GATE-OUTPUT: clean ($total gates.list members emit a '<NAME>: clean' success line + a 'help:' remedy)"
72
+ echo "GATE-OUTPUT: clean ($total gates.list member(s): $((total - runtime)) source-grepped as no-fixture members, $runtime asserted on real output by run-gate-tests)"
65
73
  exit 0