checkwright 0.23.0 → 0.25.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 (375) hide show
  1. package/README.md +175 -13
  2. package/lib/common/lock.sh +7 -0
  3. package/lib/common/recipe.sh +1 -1
  4. package/lib/diff.sh +2 -0
  5. package/lib/init.sh +40 -16
  6. package/lib/uninstall.sh +2 -0
  7. package/package.json +2 -2
  8. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  9. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  10. package/payload/canon-kit/README.md +2 -0
  11. package/payload/canon-kit/SPEC.md +454 -28
  12. package/payload/canon-kit/checks/check-amendment-queue.gate +3 -0
  13. package/payload/canon-kit/checks/check-amendment-update-target.gate +3 -0
  14. package/payload/canon-kit/checks/check-docs-link-convention.gate +3 -0
  15. package/payload/canon-kit/checks/check-knob-default-coupling.gate +3 -0
  16. package/payload/canon-kit/checks/check-prose-tells.gate +3 -0
  17. package/payload/canon-kit/checks/check-spec-embedded-source.gate +3 -0
  18. package/payload/canon-kit/checks/check-unmarked-claim.gate +3 -0
  19. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-orphan.md +6 -0
  20. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +7 -2
  21. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +8 -0
  22. package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/SPEC-thing.md +26 -0
  23. package/payload/canon-kit/gate-tests/check-amendment-update-target/bad/expect.txt +8 -0
  24. package/payload/canon-kit/gate-tests/check-amendment-update-target/good/SPEC-widget.md +47 -0
  25. package/payload/canon-kit/gate-tests/check-amendment-update-target/good/expect.txt +1 -0
  26. package/payload/canon-kit/gate-tests/check-amendment-update-target.test.sh +82 -0
  27. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.sh +3 -0
  28. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +1 -0
  29. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
  30. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +4 -4
  31. package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +2 -2
  32. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/SPEC-wire.md +18 -0
  33. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/expect.txt +3 -1
  34. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/widget.proto +13 -0
  35. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC-wire.md +22 -0
  36. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC.md +17 -0
  37. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/widget.proto +13 -0
  38. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/SPEC.md +11 -0
  39. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/expect.txt +3 -0
  40. package/payload/canon-kit/gate-tests/check-unmarked-claim/bad/scripts/canon-config.sh +6 -0
  41. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/SPEC.md +18 -0
  42. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/expect.txt +1 -0
  43. package/payload/canon-kit/gate-tests/check-unmarked-claim/good/scripts/canon-config.sh +6 -0
  44. package/payload/canon-kit/gate-tests/check-unmarked-claim.test.sh +85 -0
  45. package/payload/canon-kit/lib/spec.sh +16 -0
  46. package/payload/canon-kit/smoke/install.sh +3 -1
  47. package/payload/canon-kit/templates/SPEC-amendment.md +17 -2
  48. package/payload/context-kit/README.md +6 -4
  49. package/payload/context-kit/SPEC.md +256 -76
  50. package/payload/context-kit/bin/always-loaded.sh +5 -21
  51. package/payload/context-kit/bin/env-probe.sh +2 -17
  52. package/payload/context-kit/checks/check-brevity.gate +3 -0
  53. package/payload/context-kit/checks/check-footprint-fresh.gate +3 -0
  54. package/payload/context-kit/checks/check-memory-off.gate +3 -0
  55. package/payload/context-kit/checks/check-settings-paths.gate +3 -0
  56. package/payload/context-kit/checks/check-settings-pins.gate +3 -0
  57. package/payload/context-kit/gate-tests/check-brevity.test.sh +3 -2
  58. package/payload/context-kit/gate-tests/check-memory-off/bad/scripts/context-config.sh +4 -0
  59. package/payload/context-kit/gate-tests/check-memory-off/good/scripts/context-config.sh +4 -0
  60. package/payload/context-kit/gate-tests/check-memory-off.test.sh +18 -4
  61. package/payload/context-kit/gate-tests/check-settings-pins.test.sh +70 -0
  62. package/payload/context-kit/index-tests/expected/toolfloor.txt +5 -5
  63. package/payload/context-kit/index-tests/toolfloor-cases.sh +5 -5
  64. package/payload/context-kit/lib/context.sh +56 -0
  65. package/payload/context-kit/lib/toolfloor.sh +1 -1
  66. package/payload/context-kit/smoke/agents-md.sh +16 -4
  67. package/payload/context-kit/smoke/install.sh +3 -2
  68. package/payload/context-kit/templates/session-context.sh +5 -5
  69. package/payload/delegation-kit/README.md +11 -1
  70. package/payload/delegation-kit/SPEC.md +652 -11
  71. package/payload/delegation-kit/bin/wait-probe.sh +184 -0
  72. package/payload/delegation-kit/checks/check-agent-tier-explicit.gate +3 -0
  73. package/payload/delegation-kit/checks/check-gate-tamper.gate +3 -0
  74. package/payload/delegation-kit/checks/check-rule-citation.gate +3 -0
  75. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/added-exemptions +5 -0
  76. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/expect.txt +2 -0
  77. package/payload/delegation-kit/gate-tests/check-gate-tamper.test.sh +108 -0
  78. package/payload/delegation-kit/gate-tests/subagent-stop-liveness.test.sh +99 -0
  79. package/payload/delegation-kit/smoke/install.sh +21 -1
  80. package/payload/delegation-kit/templates/agent-execution.md +88 -4
  81. package/payload/delegation-kit/templates/subagent-stop-liveness.sh +56 -0
  82. package/payload/doctrine-kit/SPEC.md +1 -1
  83. package/payload/doctrine-kit/checks/check-doctrine-registration.gate +3 -0
  84. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +2 -3
  85. package/payload/doctrine-kit/smoke/install.sh +17 -4
  86. package/payload/drift-kit/README.md +2 -2
  87. package/payload/drift-kit/SPEC.md +71 -7
  88. package/payload/drift-kit/bin/stage-economics.sh +1 -1
  89. package/payload/drift-kit/lib/drift.sh +43 -0
  90. package/payload/drift-kit/smoke/install.sh +21 -14
  91. package/payload/evidence-kit/README.md +3 -1
  92. package/payload/evidence-kit/SPEC.md +160 -19
  93. package/payload/evidence-kit/checks/check-battery-roster.gate +3 -0
  94. package/payload/evidence-kit/checks/check-evidence-baseline.gate +3 -0
  95. package/payload/evidence-kit/checks/check-evidence-manifest.gate +3 -0
  96. package/payload/evidence-kit/checks/check-producer-liveness.sh +42 -2
  97. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +4 -3
  98. package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +8 -5
  99. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/WORKFLOW-STATE.txt +1 -1
  100. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/scripts/evidence-config.sh +9 -0
  101. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/WORKFLOW-STATE.txt +1 -1
  102. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/scripts/evidence-config.sh +9 -0
  103. package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +6 -4
  104. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +42 -1
  105. package/payload/evidence-kit/lib/evidence.sh +2 -0
  106. package/payload/evidence-kit/smoke/install.sh +1 -1
  107. package/payload/gate-sdk/README.md +17 -9
  108. package/payload/gate-sdk/SPEC.md +4680 -295
  109. package/payload/gate-sdk/bin/build-native.sh +66 -1
  110. package/payload/gate-sdk/bin/install-hooks.sh +14 -2
  111. package/payload/gate-sdk/bin/port-blockers.sh +37 -9
  112. package/payload/gate-sdk/bin/run-gate-tests.sh +1 -2
  113. package/payload/gate-sdk/bin/run-gates.sh +137 -13
  114. package/payload/gate-sdk/bin/upgrade-smoke.sh +21 -16
  115. package/payload/gate-sdk/checks/check-action-run-shell.sh +2 -1
  116. package/payload/gate-sdk/checks/check-commit-msg.gate +3 -0
  117. package/payload/gate-sdk/checks/check-commit-subject.gate +3 -0
  118. package/payload/gate-sdk/checks/check-core-files.gate +3 -0
  119. package/payload/gate-sdk/checks/check-crate-arms.sh +1 -0
  120. package/payload/gate-sdk/checks/check-enforcement-fresh.gate +3 -0
  121. package/payload/gate-sdk/checks/check-exec-bit.gate +3 -0
  122. package/payload/gate-sdk/checks/check-gate-assertions.gate +3 -0
  123. package/payload/gate-sdk/checks/check-gate-binary-fresh.gate +3 -0
  124. package/payload/gate-sdk/checks/check-gate-exemption-tasks.gate +3 -0
  125. package/payload/gate-sdk/checks/check-gate-fail-closed.gate +3 -0
  126. package/payload/gate-sdk/checks/check-gate-fixture-coverage.gate +3 -0
  127. package/payload/gate-sdk/checks/check-gate-output.gate +3 -0
  128. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +132 -15
  129. package/payload/gate-sdk/checks/check-graph.gate +3 -0
  130. package/payload/gate-sdk/checks/check-hook-exec-bit.gate +3 -0
  131. package/payload/gate-sdk/checks/check-identity.gate +3 -0
  132. package/payload/gate-sdk/checks/check-install-disposition.sh +1 -0
  133. package/payload/gate-sdk/checks/check-kit-enum.gate +3 -0
  134. package/payload/gate-sdk/checks/check-readme-roster.gate +3 -0
  135. package/payload/gate-sdk/checks/check-reads-couples.gate +3 -0
  136. package/payload/gate-sdk/checks/check-root-tiering.gate +3 -0
  137. package/payload/gate-sdk/checks/check-shellcheck.sh +1 -0
  138. package/payload/gate-sdk/checks/check-template-copy-parity.gate +3 -0
  139. package/payload/gate-sdk/checks/check-tree-terms.gate +3 -0
  140. package/payload/gate-sdk/checks/check-workflow-tiering.gate +3 -0
  141. package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +17 -12
  142. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +4 -5
  143. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/dump.txt +2 -1
  144. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/expect.txt +2 -1
  145. package/payload/gate-sdk/gate-tests/check-exec-bit/good/dump.txt +3 -0
  146. package/payload/gate-sdk/gate-tests/check-exec-bit/good/expect.txt +1 -1
  147. package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +3 -4
  148. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/expect.txt +5 -1
  149. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/SPEC.md +22 -0
  150. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-count.sh +11 -0
  151. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-extra.sh +14 -0
  152. package/payload/gate-sdk/gate-tests/check-gate-assertions/bad/scripts/check-zero.sh +7 -0
  153. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
  154. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/SPEC.md +27 -0
  155. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/scripts/check-qux.sh +13 -0
  156. package/payload/gate-sdk/gate-tests/check-gate-assertions.test.sh +117 -0
  157. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +26 -4
  158. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/args +6 -1
  159. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +2 -0
  160. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/kitroot/checks/check-vendored-descriptor.gate +4 -0
  161. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/kitroot/checks/check-vendored.sh +14 -0
  162. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/scripts/check-descriptor.gate +4 -0
  163. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/scripts/check-held.sh +8 -0
  164. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/args +8 -1
  165. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +3 -0
  166. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/kitroot/checks/check-vendored-descriptor.gate +4 -0
  167. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/kitroot/checks/check-vendored.sh +14 -0
  168. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/scripts/check-descriptor.gate +4 -0
  169. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/scripts/check-held.sh +8 -0
  170. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks.test.sh +77 -0
  171. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +4 -5
  172. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +9 -0
  173. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kit-spec.md +6 -0
  174. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +1 -0
  175. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-bare.sh +4 -0
  176. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-both.sh +5 -0
  177. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-heldtwice.sh +5 -0
  178. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-nospec.sh +4 -0
  179. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +2 -0
  180. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-twice.sh +5 -0
  181. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-ungrounded.sh +5 -0
  182. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +6 -0
  183. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +2 -1
  184. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kit-spec.md +12 -0
  185. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +1 -0
  186. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-held.sh +5 -0
  187. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +1 -0
  188. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +49 -4
  189. package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +15 -5
  190. package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +12 -0
  191. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-example-gate.md +27 -5
  192. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-second-gate.md +12 -0
  193. package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +5 -4
  194. package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +14 -12
  195. package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +43 -17
  196. package/payload/gate-sdk/gate-tests/check-graph-tree.test.sh +190 -0
  197. package/payload/gate-sdk/gate-tests/check-identity/bad/gh-hosts.yml +9 -0
  198. package/payload/gate-sdk/gate-tests/check-identity/bad/identity.conf +4 -2
  199. package/payload/gate-sdk/gate-tests/check-identity/bad/scripts/gate-sdk-config.sh +10 -0
  200. package/payload/gate-sdk/gate-tests/check-identity/good/gh-hosts.yml +11 -0
  201. package/payload/gate-sdk/gate-tests/check-identity/good/identity.conf +5 -1
  202. package/payload/gate-sdk/gate-tests/check-identity/good/scripts/gate-sdk-config.sh +10 -0
  203. package/payload/gate-sdk/gate-tests/check-identity.test.sh +114 -0
  204. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/check-native-sample.gate +3 -0
  205. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/gates.list +4 -1
  206. package/payload/gate-sdk/gate-tests/check-kit-enum/good/check-native-sample.gate +3 -0
  207. package/payload/gate-sdk/gate-tests/check-kit-enum/good/expect.txt +1 -1
  208. package/payload/gate-sdk/gate-tests/check-kit-enum/good/gates.list +5 -2
  209. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/args +3 -1
  210. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/README.md +15 -0
  211. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/checks/check-delta-one.gate +2 -0
  212. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/checks/check-delta-two.sh +3 -0
  213. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/expect.txt +3 -1
  214. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +1 -1
  215. package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +3 -1
  216. package/payload/gate-sdk/gate-tests/check-readme-roster/good/delta-kit/README.md +13 -0
  217. package/payload/gate-sdk/gate-tests/check-readme-roster/good/delta-kit/checks/check-delta-one.gate +2 -0
  218. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/README.md +14 -0
  219. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/checks/check-eps-one.sh +3 -0
  220. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/checks/check-eps-two.gate +2 -0
  221. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +1 -1
  222. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +87 -89
  223. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/agent-budget-guard.sh +4 -0
  224. package/payload/gate-sdk/gate-tests/check-template-copy-parity.test.sh +56 -0
  225. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/expect.txt +5 -0
  226. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/multi.txt +4 -0
  227. package/payload/gate-sdk/gate-tests/check-tree-terms/bad/tree/second-leak.txt +2 -0
  228. package/payload/gate-sdk/gate-tests/check-tree-terms/good/expect.txt +1 -1
  229. package/payload/gate-sdk/gate-tests/check-tree-terms/good/patterns.list +3 -0
  230. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/anchored.txt +4 -0
  231. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.list +2 -0
  232. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/msg-patterns.local.list +3 -0
  233. package/payload/gate-sdk/gate-tests/check-tree-terms/good/tree/worktrees/vendored-note.txt +3 -0
  234. package/payload/gate-sdk/gate-tests/check-tree-terms.test.sh +94 -0
  235. package/payload/gate-sdk/gate-tests/declaration-lib-parity.test.sh +211 -0
  236. package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +16 -15
  237. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +94 -1
  238. package/payload/gate-sdk/lib/gate.sh +232 -25
  239. package/payload/gate-sdk/smoke/install.sh +28 -1
  240. package/payload/guard-kit/README.md +4 -3
  241. package/payload/guard-kit/SPEC.md +578 -47
  242. package/payload/guard-kit/bin/compare-settings-allow.sh +36 -12
  243. package/payload/guard-kit/bin/run-guard-tests.sh +27 -4
  244. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +46 -1
  245. package/payload/guard-kit/gate-tests/git-mutation-under-producer.test.sh +105 -0
  246. package/payload/guard-kit/guard-tests/background-cases.tsv +14 -0
  247. package/payload/guard-kit/guard-tests/cases.tsv +67 -9
  248. package/payload/guard-kit/lib/guard.sh +361 -18
  249. package/payload/guard-kit/templates/bash-guard.sh +2 -0
  250. package/payload/guard-kit/templates/close-triage.md +10 -3
  251. package/payload/guard-kit/templates/guard-config.sh +3 -0
  252. package/payload/lifecycle-kit/README.md +3 -2
  253. package/payload/lifecycle-kit/SPEC.md +509 -77
  254. package/payload/lifecycle-kit/bin/enter-stage.sh +72 -33
  255. package/payload/lifecycle-kit/bin/file-gap.sh +2 -2
  256. package/payload/lifecycle-kit/checks/check-close-surfaces.gate +3 -0
  257. package/payload/lifecycle-kit/checks/check-stage-entry.gate +3 -0
  258. package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +4 -4
  259. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +1 -1
  260. package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/.workflow/WORKFLOW-STATE.txt +3 -3
  261. package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/.workflow/WORKFLOW-STATE.txt +3 -3
  262. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +22 -22
  263. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/.workflow/WORKFLOW-STATE.txt +2 -2
  264. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/.workflow/WORKFLOW-STATE.txt +2 -2
  265. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +120 -10
  266. package/payload/lifecycle-kit/gate-tests/gap-inbox-route.test.sh +123 -0
  267. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +11 -11
  268. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +16 -5
  269. package/payload/lifecycle-kit/lib/stages.sh +5 -0
  270. package/payload/lifecycle-kit/smoke/install.sh +29 -15
  271. package/payload/lifecycle-kit/templates/lead.md +32 -0
  272. package/payload/lifecycle-kit/templates/stages/align.md +20 -2
  273. package/payload/lifecycle-kit/templates/stages/build.md +3 -3
  274. package/payload/lifecycle-kit/templates/stages/close.md +20 -6
  275. package/payload/lifecycle-kit/templates/stages/scope.md +20 -1
  276. package/payload/lifecycle-kit/templates/stages/spec.md +1 -1
  277. package/payload/lifecycle-kit/templates/stages/validate.md +1 -1
  278. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +1 -1
  279. package/payload/queue-kit/README.md +10 -10
  280. package/payload/queue-kit/SPEC.md +379 -84
  281. package/payload/queue-kit/bin/queue-counts.sh +1 -1
  282. package/payload/queue-kit/checks/check-queue-entry-budget.gate +1 -1
  283. package/payload/queue-kit/checks/check-queue-prose-precondition.gate +3 -0
  284. package/payload/queue-kit/checks/check-roadmap-fresh.gate +3 -0
  285. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +15 -0
  286. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +2 -0
  287. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +7 -0
  288. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/expect.txt +4 -0
  289. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/expect.txt +1 -1
  290. package/payload/queue-kit/gate-tests/queue-counts.test.sh +1 -1
  291. package/payload/queue-kit/gate-tests/queue-index.test.sh +55 -119
  292. package/payload/queue-kit/gate-tests/roadmap.test.sh +22 -12
  293. package/payload/queue-kit/lib/queue.sh +0 -49
  294. package/payload/queue-kit/smoke/install.sh +1 -1
  295. package/payload/site-kit/SPEC.md +41 -2
  296. package/payload/site-kit/checks/check-docs-cname-parity.gate +3 -0
  297. package/payload/site-kit/checks/check-docs-render-fidelity.sh +1 -0
  298. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +5 -4
  299. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +6 -5
  300. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/checks/check-sample.gate +3 -0
  301. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/expect.txt +1 -1
  302. package/payload/site-kit/smoke/install.sh +1 -1
  303. package/payload/canon-kit/checks/check-amendment-queue.sh +0 -117
  304. package/payload/canon-kit/checks/check-docs-link-convention.sh +0 -79
  305. package/payload/canon-kit/checks/check-knob-default-coupling.sh +0 -240
  306. package/payload/canon-kit/checks/check-prose-tells.sh +0 -208
  307. package/payload/canon-kit/checks/check-spec-embedded-source.sh +0 -134
  308. package/payload/context-kit/bin/footprint.sh +0 -144
  309. package/payload/context-kit/checks/check-brevity.sh +0 -124
  310. package/payload/context-kit/checks/check-footprint-fresh.sh +0 -39
  311. package/payload/context-kit/checks/check-memory-off.sh +0 -113
  312. package/payload/context-kit/checks/check-settings-paths.sh +0 -94
  313. package/payload/context-kit/checks/check-settings-pins.sh +0 -111
  314. package/payload/context-kit/gate-tests/check-memory-off/bad/args +0 -1
  315. package/payload/context-kit/gate-tests/check-memory-off/good/args +0 -1
  316. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +0 -62
  317. package/payload/delegation-kit/checks/check-gate-tamper.sh +0 -140
  318. package/payload/delegation-kit/checks/check-rule-citation.sh +0 -77
  319. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +0 -246
  320. package/payload/drift-kit/bin/trajectory.sh +0 -242
  321. package/payload/evidence-kit/checks/check-battery-roster.sh +0 -87
  322. package/payload/evidence-kit/checks/check-evidence-baseline.sh +0 -104
  323. package/payload/evidence-kit/checks/check-evidence-manifest.sh +0 -105
  324. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/args +0 -3
  325. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/args +0 -3
  326. package/payload/gate-sdk/bin/enforcement-map.sh +0 -273
  327. package/payload/gate-sdk/checks/check-commit-msg.sh +0 -51
  328. package/payload/gate-sdk/checks/check-commit-subject.sh +0 -44
  329. package/payload/gate-sdk/checks/check-core-files.sh +0 -76
  330. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +0 -38
  331. package/payload/gate-sdk/checks/check-exec-bit.sh +0 -96
  332. package/payload/gate-sdk/checks/check-gate-assertions.sh +0 -148
  333. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +0 -107
  334. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +0 -106
  335. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +0 -85
  336. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +0 -93
  337. package/payload/gate-sdk/checks/check-gate-output.sh +0 -103
  338. package/payload/gate-sdk/checks/check-graph.sh +0 -632
  339. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +0 -46
  340. package/payload/gate-sdk/checks/check-identity.sh +0 -135
  341. package/payload/gate-sdk/checks/check-kit-enum.sh +0 -95
  342. package/payload/gate-sdk/checks/check-readme-roster.sh +0 -108
  343. package/payload/gate-sdk/checks/check-reads-couples.sh +0 -200
  344. package/payload/gate-sdk/checks/check-root-tiering.sh +0 -67
  345. package/payload/gate-sdk/checks/check-template-copy-parity.sh +0 -127
  346. package/payload/gate-sdk/checks/check-tree-terms.sh +0 -66
  347. package/payload/gate-sdk/checks/check-workflow-tiering.sh +0 -85
  348. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/args +0 -1
  349. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/args +0 -1
  350. package/payload/gate-sdk/gate-tests/check-identity/bad/args +0 -1
  351. package/payload/gate-sdk/gate-tests/check-identity/good/args +0 -1
  352. package/payload/lifecycle-kit/bin/close-surfaces.sh +0 -94
  353. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +0 -64
  354. package/payload/lifecycle-kit/checks/check-stage-entry.sh +0 -198
  355. package/payload/queue-kit/bin/queue-index.sh +0 -182
  356. package/payload/queue-kit/bin/roadmap.sh +0 -76
  357. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +0 -64
  358. package/payload/queue-kit/checks/check-roadmap-fresh.sh +0 -111
  359. package/payload/site-kit/checks/check-docs-cname-parity.sh +0 -81
  360. /package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/{gates → scripts}/check-sample.sh +0 -0
  361. /package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/{gates → scripts}/check-sample.sh +0 -0
  362. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{check-gamma.sh → scripts/check-gamma.sh} +0 -0
  363. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gate-tests → scripts/gate-tests}/check-alpha/bad/.keep +0 -0
  364. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gate-tests → scripts/gate-tests}/check-alpha/good/.keep +0 -0
  365. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gates.list → scripts/gates.list} +0 -0
  366. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{check-beta.sh → scripts/check-beta.sh} +0 -0
  367. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gate-tests → scripts/gate-tests}/check-alpha/bad/.keep +0 -0
  368. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gate-tests → scripts/gate-tests}/check-alpha/good/.keep +0 -0
  369. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gates.list → scripts/gates.list} +0 -0
  370. /package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/{site-config.sh → scripts/site-config.sh} +0 -0
  371. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree → docs}/CNAME +0 -0
  372. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree → docs}/index.md +0 -0
  373. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree/docs → docs}/posts/2026-01-01-legacy.md +0 -0
  374. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree/pkg → pkg}/gate-tests/fixture.md +0 -0
  375. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{site-config.sh → scripts/site-config.sh} +0 -0
@@ -41,14 +41,19 @@ done
41
41
 
42
42
  # spec: guard-kit/SPEC.md §compare-settings-allow — the breadth question: guard_allow_match with the
43
43
  # arguments swapped, asking whether a local glob would auto-allow a probe rather than whether a
44
- # committed glob already grants a local entry
44
+ # committed glob already grants a local entry, then partitions on an exact-string declaration lookup
45
45
  too_broad=()
46
+ declared=()
46
47
  for entry in "${LOCAL_ALLOW[@]}"; do
47
48
  [[ -z "$entry" ]] && continue
48
49
  for probe in "${GUARD_KIT_BREADTH_PROBES[@]}"; do
49
50
  [[ -z "$probe" ]] && continue
50
51
  if guard_allow_match "$probe" "$entry"; then
51
- too_broad+=("$entry ⊇ $probe")
52
+ if [[ -n "${GUARD_KIT_BREADTH_DECLARED[$entry]+set}" ]]; then
53
+ declared+=("$entry ⊇ $probe — ${GUARD_KIT_BREADTH_DECLARED[$entry]}")
54
+ else
55
+ too_broad+=("$entry ⊇ $probe")
56
+ fi
52
57
  break
53
58
  fi
54
59
  done
@@ -75,17 +80,36 @@ fi
75
80
  [[ ${#GUARD_KIT_BREADTH_PROBES[@]} -eq 0 ]] && exit 0
76
81
 
77
82
  echo
78
- echo "=== settings allowlist breadth (advisory — narrowing candidates) ==="
79
- if [[ ${#too_broad[@]} -eq 0 ]]; then
80
- echo "no over-broad local entries (no configured probe is auto-allowed by a $LOCAL glob)"
81
- exit 0
83
+ # spec: guard-kit/SPEC.md §compare-settings-allow — an over-broad set that is entirely declared
84
+ # prints the declared section and no narrowing section: the clean line would be false there
85
+ if [[ ${#too_broad[@]} -gt 0 || ${#declared[@]} -eq 0 ]]; then
86
+ echo "=== settings allowlist breadth (advisory — narrowing candidates) ==="
87
+ if [[ ${#too_broad[@]} -eq 0 ]]; then
88
+ echo "no over-broad local entries (no configured probe is auto-allowed by a $LOCAL glob)"
89
+ exit 0
90
+ fi
91
+ echo "${#too_broad[@]} local allow entr(ies) auto-allow a configured probe — candidates to narrow in $LOCAL:"
92
+ echo
93
+ printf ' %s\n' "${too_broad[@]}"
94
+ echo
95
+ echo "help: narrow each listed glob on the left, or record that the breadth is"
96
+ echo " intended — the probe on the right witnesses what it auto-allows."
97
+ echo " Probes are witnesses, not a roster: no completeness is claimed, so an"
98
+ echo " empty report is not a proof that every local glob is narrow enough."
82
99
  fi
83
100
 
84
- echo "${#too_broad[@]} local allow entr(ies) auto-allow a configured probe — candidates to narrow in $LOCAL:"
101
+ # spec: guard-kit/SPEC.md §compare-settings-allow — a declared glob is not dropped from the report:
102
+ # it moves out of the narrowing set and prints with its reason, so the ruling has a reader
103
+ [[ ${#declared[@]} -eq 0 ]] && exit 0
104
+
105
+ [[ ${#too_broad[@]} -gt 0 ]] && echo
106
+ echo "=== settings allowlist breadth (advisory — declared intended) ==="
107
+ echo "${#declared[@]} over-broad local allow entr(ies) whose breadth was ruled intended:"
85
108
  echo
86
- printf ' %s\n' "${too_broad[@]}"
109
+ printf ' %s\n' "${declared[@]}"
87
110
  echo
88
- echo "help: narrow each listed glob on the left, or record that the breadth is"
89
- echo " intended — the probe on the right witnesses what it auto-allows."
90
- echo " Probes are witnesses, not a roster: no completeness is claimed, so an"
91
- echo " empty report is not a proof that every local glob is narrow enough."
111
+ echo "help: no narrowing is owed — each glob on the left auto-allows the probe beside"
112
+ echo " it, and that breadth was ruled intended. The ruling lives with the probes"
113
+ echo " in the committed guard-kit config, as a GUARD_KIT_BREADTH_DECLARED entry."
114
+ echo " A declaration is keyed on the exact glob string it ruled, so re-spelling"
115
+ echo " or narrowing that glob returns the entry to the narrowing candidates."
@@ -8,8 +8,9 @@ ESC_GUARD="$KIT/templates/escalation-guard.sh"
8
8
  LIB="$KIT/lib/guard.sh"
9
9
  CASES="${1:-$KIT/guard-tests/cases.tsv}"
10
10
  ESC_CASES="${2:-$KIT/guard-tests/escalation-cases.tsv}"
11
+ BG_CASES="${3:-$KIT/guard-tests/background-cases.tsv}"
11
12
 
12
- for f in "$BASH_GUARD" "$ESC_GUARD" "$LIB" "$CASES" "$ESC_CASES"; do
13
+ for f in "$BASH_GUARD" "$ESC_GUARD" "$LIB" "$CASES" "$ESC_CASES" "$BG_CASES"; do
13
14
  [[ -f "$f" ]] || { echo "run-guard-tests: missing $f" >&2; exit 2; }
14
15
  done
15
16
  command -v jq >/dev/null 2>&1 || { echo "run-guard-tests: jq not found on PATH" >&2; exit 2; }
@@ -18,11 +19,16 @@ SANDBOX="$(mktemp -d)"
18
19
  trap 'rm -rf "$SANDBOX"' EXIT
19
20
  git -C "$SANDBOX" init -q
20
21
  printf 'scratch.txt\n.tmp/\nfriction.log\n' >"$SANDBOX/.gitignore"
21
- # spec: guard-kit/SPEC.md §The generic ruleset — rule 16 splits on tracked vs not, so the sandbox needs one of each
22
+ # spec: guard-kit/SPEC.md §The generic ruleset — rule 21 splits on tracked vs not, so the sandbox needs one of each
22
23
  printf 'tracked\n' >"$SANDBOX/tracked.md"
23
24
  printf 'scratch\n' >"$SANDBOX/scratch.txt"
24
25
  git -C "$SANDBOX" add tracked.md
25
26
 
27
+ # spec: guard-kit/SPEC.md §The generic ruleset — rule 14 reads '*.run' records under GUARD_KIT_SCRATCH_DIRS; the table's sandbox carries a dead-PID record and a non-record file beside it, so every mutating-git row below asserts the rule's decline arm rather than the vacuous absence of any record at all. The live arm needs a PID the test owns and lives in gate-tests/git-mutation-under-producer.test.sh.
28
+ mkdir -p "$SANDBOX/.tmp"
29
+ printf 'pid=2147483646 run=dead-producer\n' >"$SANDBOX/.tmp/dead-producer.run"
30
+ printf 'not a record\n' >"$SANDBOX/.tmp/notes.txt"
31
+
26
32
  mkdir -p "$SANDBOX/.claude"
27
33
  printf '%s\n' '{ "permissions": { "allow": ["Bash(git status)", "Bash(ls)", "Bash(printf:*)"] } }' \
28
34
  >"$SANDBOX/.claude/settings.json"
@@ -65,6 +71,23 @@ while IFS=$'\t' read -r want cmd; do
65
71
  check_case "$want" "$(classify "$rc" "$out")" "$cmd"
66
72
  done <"$CASES"
67
73
 
74
+ # spec: guard-kit/SPEC.md §Testing — drives rule 15's harness arm: the backgrounding flag is a tool parameter, so the payload carries it beside the command rather than in it
75
+ while IFS=$'\t' read -r want rib cmd; do
76
+ [[ -z "${want// }" ]] && continue
77
+ [[ "$want" == \#* ]] && continue
78
+ cmd="${cmd//@ROOT@/$SANDBOX}"
79
+ cmd="${cmd//@NL@/$'\n'}"
80
+ if [[ "$rib" == "true" ]]; then
81
+ json="$(jq -nc --arg c "$cmd" '{tool_input:{command:$c,run_in_background:true}}')"
82
+ else
83
+ json="$(jq -nc --arg c "$cmd" '{tool_input:{command:$c}}')"
84
+ fi
85
+ out="$(cd "$SANDBOX" && printf '%s' "$json" \
86
+ | GUARD_KIT_LIB="$LIB" GUARD_KIT_LOG="$LOG" bash "$BASH_GUARD" 2>/dev/null)"
87
+ rc=$?
88
+ check_case "$want" "$(classify "$rc" "$out")" "[run_in_background=$rib] $cmd"
89
+ done <"$BG_CASES"
90
+
68
91
  # spec: guard-kit/SPEC.md §wakeup-guard — drives the escalation-guard advisory table
69
92
  while IFS=$'\t' read -r want to msg; do
70
93
  [[ -z "${want// }" ]] && continue
@@ -76,12 +99,12 @@ while IFS=$'\t' read -r want to msg; do
76
99
  done <"$ESC_CASES"
77
100
 
78
101
  if [[ "$ran" -eq 0 ]]; then
79
- echo "run-guard-tests: no cases parsed from $CASES / $ESC_CASES" >&2
102
+ echo "run-guard-tests: no cases parsed from $CASES / $BG_CASES / $ESC_CASES" >&2
80
103
  exit 2
81
104
  fi
82
105
  if [[ "$fails" -gt 0 ]]; then
83
106
  echo "run-guard-tests: $fails/$ran case(s) failed"
84
107
  exit 1
85
108
  fi
86
- echo "run-guard-tests: ok ($ran cases across the generic ruleset + the escalation advisory)"
109
+ echo "run-guard-tests: ok ($ran cases across the generic ruleset, the backgrounding arm, and the escalation advisory)"
87
110
  exit 0
@@ -33,6 +33,20 @@ printf '%s\n' '{ "permissions": { "allow": ["Bash(git fetch --dry-run)"] } }' >
33
33
  printf '%s\n' 'GUARD_KIT_BREADTH_PROBES=("Bash(git reset --hard)")' > "$sb/probes.sh"
34
34
  printf '%s\n' '# no probes declared' > "$sb/empty.sh"
35
35
 
36
+ # The declaration is keyed on the exact local allow-rule string; 'off-by-one.sh'
37
+ # differs from the overlay entry by one character and must not silence it.
38
+ two_probes='GUARD_KIT_BREADTH_PROBES=("Bash(git reset --hard)" "Bash(gh repo delete)")'
39
+ {
40
+ printf '%s\n' "$two_probes"
41
+ printf '%s\n' 'declare -A GUARD_KIT_BREADTH_DECLARED=(["Bash(git *)"]="sandbox repo, every git write is disposable")'
42
+ } > "$sb/declared.sh"
43
+ {
44
+ printf '%s\n' "$two_probes"
45
+ printf '%s\n' 'declare -A GUARD_KIT_BREADTH_DECLARED=(["Bash(git*)"]="one character off the overlay entry")'
46
+ } > "$sb/off-by-one.sh"
47
+
48
+ printf '%s\n' '{ "permissions": { "allow": ["Bash(git *)", "Bash(gh *)"] } }' > "$sb/mixed.json"
49
+
36
50
  # Firing probe: the blanket glob auto-allows the destructive probe, reported with its witness.
37
51
  firing="$(run "$sb/broad.json" "$sb/probes.sh")"
38
52
  assert_has firing-section 'settings allowlist breadth' "$firing"
@@ -59,6 +73,37 @@ c_empty="$(run "$sb/broad.json" "$sb/empty.sh" --count)"
59
73
  c_absent="$(run "$sb/does-not-exist.json" "$sb/probes.sh" --count)"
60
74
  [[ "$c_absent" == "0 0" ]] || { echo "FAIL [count-absent]: expected '0 0', got '$c_absent'"; fails=$((fails + 1)); }
61
75
 
76
+ # Empty declaration map (every case above): the declared subsection is absent too.
77
+ assert_absent empty-declared-silent 'advisory — declared intended' "$firing"
78
+
79
+ # An over-broad set that is entirely declared: the declared section prints with its
80
+ # reason, and no narrowing section and no false clean line appear.
81
+ all_declared="$(run "$sb/broad.json" "$sb/declared.sh")"
82
+ assert_has all-declared-section 'advisory — declared intended' "$all_declared"
83
+ assert_has all-declared-reason 'sandbox repo, every git write is disposable' "$all_declared"
84
+ assert_absent all-declared-narrow 'advisory — narrowing candidates' "$all_declared"
85
+ assert_absent all-declared-clean 'no over-broad local entries' "$all_declared"
86
+
87
+ # A mixed set: the declared entry leaves the narrowing set, the undeclared one stays.
88
+ mixed="$(run "$sb/mixed.json" "$sb/declared.sh")"
89
+ assert_has mixed-narrowing 'advisory — narrowing candidates' "$mixed"
90
+ assert_has mixed-undeclared 'Bash(gh *) ⊇ Bash(gh repo delete)' "$mixed"
91
+ assert_has mixed-declared 'Bash(git *) ⊇ Bash(git reset --hard) — sandbox repo' "$mixed"
92
+ # The narrowing lane prints the pair bare; only the declared lane appends the reason,
93
+ # so an exact whole-line match on the bare pair is the partition assertion.
94
+ grep -qxF -- ' Bash(git *) ⊇ Bash(git reset --hard)' <<<"$mixed" \
95
+ && { echo "FAIL [mixed-partition]: the declared glob is still in the narrowing set"; fails=$((fails + 1)); }
96
+
97
+ # --count: the breadth number counts narrowing candidates, so the declared entry is excluded.
98
+ c_mixed="$(run "$sb/mixed.json" "$sb/declared.sh" --count)"
99
+ [[ "$c_mixed" == "0 1" ]] || { echo "FAIL [count-declared]: expected '0 1', got '$c_mixed'"; fails=$((fails + 1)); }
100
+
101
+ # Exactness: a declaration one character off the overlay entry silences nothing.
102
+ off="$(run "$sb/broad.json" "$sb/off-by-one.sh")"
103
+ assert_has off-by-one-narrowing 'advisory — narrowing candidates' "$off"
104
+ assert_has off-by-one-entry 'Bash(git *) ⊇ Bash(git reset --hard)' "$off"
105
+ assert_absent off-by-one-declared 'advisory — declared intended' "$off"
106
+
62
107
  [[ "$fails" -eq 0 ]] || { echo "compare-settings-allow.test: $fails assertion(s) failed"; exit 1; }
63
- echo "compare-settings-allow.test: clean (a firing probe names its witnessing glob, a non-firing probe reports clean, an empty probe set omits the section)"
108
+ echo "compare-settings-allow.test: clean (a firing probe names its witnessing glob, a non-firing probe reports clean, an empty probe set omits the section, a declared breadth moves out of the narrowing set and out of --count, and an exactness miss silences nothing)"
64
109
  exit 0
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env bash
2
+ # Direct unit test of lib/guard.sh's rule 14 — a tracked-tree mutation blocked
3
+ # while a recorded producer is still alive. The decision table cannot hold this
4
+ # rule's firing arm: its second conjunct is a *live* PID, and a sandbox carrying
5
+ # one would turn every other git row in that table into a block. The table keeps
6
+ # the decline arm (a dead record present); everything below needs a process the
7
+ # test itself owns.
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)" # guard-kit/
14
+ # shellcheck source=../lib/guard.sh
15
+ source "$DIR/lib/guard.sh"
16
+
17
+ fails=0
18
+ checks=0
19
+ tmp="$(mktemp -d)"
20
+ live=""
21
+ cleanup() { [[ -n "$live" ]] && kill "$live" 2>/dev/null; rm -rf "$tmp"; }
22
+ trap cleanup EXIT
23
+
24
+ sleep 60 &
25
+ live=$!
26
+
27
+ mkdir -p "$tmp/scratch"
28
+ GUARD_KIT_SCRATCH_DIRS=("$tmp/scratch")
29
+
30
+ # guard_block exits 2, so each verdict is taken in a subshell: 2 = blocked,
31
+ # 0 = declined and fell through to the rules after it.
32
+ verdict() { ( guard_rule_git_mutation_under_producer "$1" ) >/dev/null 2>&1; echo $?; }
33
+
34
+ want() { # $1=label $2=command $3=want-rc
35
+ checks=$((checks + 1))
36
+ local got; got="$(verdict "$2")"
37
+ [[ "$got" == "$3" ]] || { echo " FAIL [$1]: '$2' gave rc=$got, want $3"; fails=$((fails + 1)); }
38
+ }
39
+
40
+ # --- no record at all: the rule is inert, whatever the command
41
+ want "empty-dir-commit" "git commit -m done" 0
42
+
43
+ # --- a record naming a dead pid is not a live producer
44
+ printf 'pid=2147483646 run=dead-run\n' >"$tmp/scratch/dead-run.run"
45
+ want "dead-record-commit" "git commit -m done" 0
46
+ want "dead-record-add" "git add -A" 0
47
+
48
+ # --- a live record: the whole named write set blocks
49
+ printf 'pid=%s run=validate-batch\n' "$live" >"$tmp/scratch/validate-batch.run"
50
+ for sub in add commit rm mv restore checkout switch reset stash merge rebase \
51
+ cherry-pick revert apply am clean; do
52
+ want "live-blocks-$sub" "git $sub" 2
53
+ done
54
+
55
+ # The corrective must name the blocking run so the reader can tell 'wait for
56
+ # that' from 'reclaim a record whose owner is gone'.
57
+ out="$( ( guard_rule_git_mutation_under_producer "git commit -m done" ) 2>&1 )"
58
+ checks=$((checks + 1))
59
+ if [[ "$out" != *"validate-batch"* || "$out" != *"$live"* ]]; then
60
+ echo " FAIL [names-the-run]: the block did not name the blocking run and pid: $out"
61
+ fails=$((fails + 1))
62
+ fi
63
+
64
+ # --- git's global options are walked, so a decorated invocation is still reached
65
+ want "global-C" "git -C . commit -m done" 2
66
+ want "global-c" "git -c user.name=x commit -m done" 2
67
+ want "global-no-pager" "git --no-pager stash" 2
68
+ want "global-glued" "git --git-dir=.git commit -m done" 2
69
+
70
+ # --- and a compound fires on the mutating segment wherever it sits
71
+ want "compound-tail" "make build; git commit -m done" 2
72
+
73
+ # --- read-only git passes: the harm is the mutation, not the producer's liveness
74
+ for sub in status log diff show rev-parse ls-files branch remote; do
75
+ want "readonly-$sub" "git $sub" 0
76
+ done
77
+ want "readonly-args" "git log --oneline -3" 0
78
+
79
+ # --- conservative in this ruleset's established directions
80
+ want "non-git" "make build" 0
81
+ want "unknown-subcmd" "git frobnicate --hard" 0
82
+ want "unknown-global" "git --frobnicate commit -m done" 0
83
+ want "expansion" "git commit -m \$MSG" 0
84
+ want "substitution" "git commit -m \$(date)" 0
85
+ want "backtick" 'git commit -m `date`' 0
86
+ # A mutating verb inside a quoted span is not a command: the skeleton view is
87
+ # what makes that true, and a rule reading the raw text would false-block here.
88
+ want "quoted-mention" "printf 'git commit -m x' >> notes.txt" 0
89
+
90
+ # --- a record that does not parse declines rather than blocks: a guard is not
91
+ # where a corruption verdict is taken (check-producer-liveness exits 2 on one)
92
+ rm -f "$tmp/scratch/validate-batch.run" "$tmp/scratch/dead-run.run"
93
+ printf 'garbage\n' >"$tmp/scratch/broken.run"
94
+ want "unparseable-record" "git commit -m done" 0
95
+
96
+ # --- and a file without the '.run' suffix is not a record at all
97
+ printf 'pid=%s run=not-a-record\n' "$live" >"$tmp/scratch/notes.txt"
98
+ want "suffix-bound" "git commit -m done" 0
99
+
100
+ if [[ "$fails" -gt 0 ]]; then
101
+ echo "git-mutation-under-producer.test: $fails of $checks assertion(s) failed"
102
+ exit 1
103
+ fi
104
+ echo "git-mutation-under-producer.test: ok ($checks assertions; the write set blocks under a live record, read-only git and every conservative direction decline)"
105
+ exit 0
@@ -0,0 +1,14 @@
1
+ # spec: guard-kit/SPEC.md §Testing — rule 15's harness arm: the backgrounding flag is tool
2
+ # input, not command text, so it cannot be written in cases.tsv's decision/command grammar.
3
+ # Columns: <expected-decision> <TAB> <run_in_background> <TAB> <command>.
4
+ #
5
+ # rule 15 — a backgrounded launch that records no producer is advised. The
6
+ # non-firing cases are the load-bearing ones: an inline record
7
+ # discharges the obligation, a wait loop is a waiter rather than a
8
+ # producer, a read-only pipeline owns nothing a commit could corrupt,
9
+ # and a foreground call never reaches the rule at all.
10
+ advise true bash worker.sh
11
+ fallthrough true bash worker.sh > .tmp/worker.log 2>&1 & printf 'pid=1 run=worker\n' > .tmp/worker.run
12
+ fallthrough true until grep -q DONE .tmp/worker.log; do sleep 5; done
13
+ allow true grep -rn foo src | head
14
+ fallthrough false bash worker.sh
@@ -40,8 +40,8 @@ fallthrough awk '$1' data.txt
40
40
  # cannot expand, and the shell is what guarantees that — so its body is inert
41
41
  block cat <<EOF > .tmp/n.md@NL@value is $(date)@NL@EOF
42
42
  fallthrough cat <<'EOF' > .tmp/n.md@NL@value is $(date)@NL@EOF
43
- # reaches rule 15's advisory, which is the correct verdict for a commit -F; the
44
- # point is that rule 6 no longer blocks it before rule 15 is ever consulted
43
+ # reaches rule 20's advisory, which is the correct verdict for a commit -F; the
44
+ # point is that rule 6 no longer blocks it before rule 20 is ever consulted
45
45
  advise git commit -F - <<'MSG'@NL@names a $(cmd) in the body@NL@MSG
46
46
 
47
47
  # rule 7 — unquoted brace glyph: bare {} placeholder rewritten, expansions blocked.
@@ -99,11 +99,69 @@ block git grep needle -- src
99
99
  fallthrough git grep foo HEAD
100
100
  fallthrough git grep --cached foo
101
101
 
102
- # rule 12 — `: > file` truncation auto-allowed iff every target is gitignored
102
+ # rule 12 — self-matching process-liveness predicate: a `pgrep -f` pattern the
103
+ # command's own text repeats can never go false, since `-f` scans the
104
+ # waiter's own argv. A lone query, a `pgrep` without `-f`, and a pattern
105
+ # occurring nowhere else are genuine queries and pass.
106
+ block bash run-smoke.sh & until ! pgrep -f run-smoke.sh; do sleep 5; done
107
+ block pkill -f run-smoke.sh; bash run-smoke.sh
108
+ fallthrough pgrep -f run-smoke.sh
109
+ fallthrough pgrep run-smoke.sh; bash run-smoke.sh
110
+
111
+ # rule 13 — bare foreground sleep steered to a condition wait. The non-firing
112
+ # cases are the load-bearing ones: a sleep inside an `until … do … done`
113
+ # loop *is* the sanctioned form, and a quoted mention is inert. The
114
+ # quoted-mention row is an `allow` because rule 17 grants the append
115
+ # outright, which still proves rule 13 inert: a block exits 2 at rule
116
+ # 13 and never reaches an auto-allow eight rules later.
117
+ block sleep 30
118
+ block sleep 180; echo waited
119
+ fallthrough until grep -q DONE .tmp/smoke.log; do sleep 5; done
120
+ allow printf 'sleep 5' >> .tmp/note.txt
121
+
122
+ # rule 14 — tracked-tree mutation under a live producer. The sandbox's only
123
+ # `*.run` record names a dead pid and a non-record file sits beside
124
+ # it, so every mutating form below declines: the rule's second
125
+ # conjunct is a *live* record, and read-only git never reaches it at
126
+ # all. The block arm needs a pid the test owns and lives in
127
+ # gate-tests/git-mutation-under-producer.test.sh.
128
+ fallthrough git add tracked.md
129
+ fallthrough git stash
130
+ fallthrough git -C . commit -m done
131
+ fallthrough git rev-parse HEAD
132
+
133
+ # rule 15 — a backgrounded launch that records no producer is advised. The
134
+ # shell `&` arm lives here because it *is* command text; the harness
135
+ # flag is tool input and cannot be written in this grammar, so that
136
+ # arm lives in background-cases.tsv.
137
+ advise bash worker.sh &
138
+ fallthrough bash worker.sh & printf 'pid=1 run=worker\n' > .tmp/worker.run
139
+
140
+ # rule 16 — `: > file` truncation auto-allowed iff every target is gitignored
103
141
  allow : > scratch.txt
104
142
  fallthrough : > tracked.txt
105
143
 
106
- # rule 13 — read-only pipeline auto-allow; a non-roster segment falls through
144
+ # rule 17 — append-only write to gitignored targets auto-allowed. The four
145
+ # clauses each get their refusing case, because each is what keeps the
146
+ # grant from blessing something the redirect alone would: (a) a single
147
+ # truncating `>` anywhere, (b) a target outside the ignore set, (c) a
148
+ # leading command that writes somewhere other than its stdout, and the
149
+ # single-statement half of (c) — a second statement on a line of its
150
+ # own, which is what the heredoc residue must never be confused with.
151
+ # Targets are relative, as rules 3 and 16's are: the runner drives the
152
+ # guard from inside the sandbox, and an `@ROOT@`-absolute target would
153
+ # meet rule 5's repo-root-prefix block nine rules earlier.
154
+ allow cat >> .tmp/journal.md <<'EOF'@NL@line@NL@EOF
155
+ fallthrough cat > .tmp/journal.md <<'EOF'@NL@line@NL@EOF
156
+ fallthrough cat >> tracked.md <<'EOF'@NL@line@NL@EOF
157
+ fallthrough rm -rf .tmp/x >> .tmp/journal.md
158
+ fallthrough printf x >> .tmp/journal.md@NL@rm -rf .tmp/x
159
+ # the two inert targets are exempt from (a) and (b): neither is a file the
160
+ # append-only split protects, and neither is a path git check-ignore can answer
161
+ allow printf 'x@NL@' >> .tmp/journal.md 2>/dev/null
162
+ allow cat >> .tmp/journal.md 2>&1
163
+
164
+ # rule 18 — read-only pipeline auto-allow; a non-roster segment falls through
107
165
  allow grep -rn foo src | head
108
166
  fallthrough grep foo file | awk '{print}'
109
167
  # banner tolerance (rules 9 and 10's, third caller): a literal echo/printf
@@ -111,7 +169,7 @@ fallthrough grep foo file | awk '{print}'
111
169
  allow echo === | grep foo src
112
170
  fallthrough echo a | echo b
113
171
  # widened lead: a bare committed allow entry may lead, since it was reviewed —
114
- # but only where something decorates it, so the undecorated form (rule 14's
172
+ # but only where something decorates it, so the undecorated form (rule 19's
115
173
  # 'fallthrough git status' below) is still never intercepted here
116
174
  allow git status | head
117
175
  allow git status | head -20
@@ -128,7 +186,7 @@ fallthrough grep -rln foo src | xargs sed -i s/a/b/
128
186
  block ls | xargs chmod 777
129
187
  block ls | xargs xargs rm
130
188
 
131
- # rule 14 — decorated allowlisted bare lead with an unmatched segment blocked;
189
+ # rule 19 — decorated allowlisted bare lead with an unmatched segment blocked;
132
190
  # chaining steer, redirect steer, and the untouched non-firing cases
133
191
  block git status && rm -rf tmp
134
192
  block git status 2>&1
@@ -137,7 +195,7 @@ fallthrough frobnicate && git status
137
195
  fallthrough git status && ls
138
196
  fallthrough git status && printf done
139
197
 
140
- # rule 15 — git history-rewrite advisory: amend / commit -F / soft-reset steered;
198
+ # rule 20 — git history-rewrite advisory: amend / commit -F / soft-reset steered;
141
199
  # a plain commit and a non-soft reset pass
142
200
  advise git commit --amend
143
201
  advise git commit --amend --no-edit
@@ -146,7 +204,7 @@ advise git reset --soft HEAD~1
146
204
  fallthrough git commit -m done
147
205
  fallthrough git reset --hard HEAD~1
148
206
 
149
- # rule 16 — bare rm of a tracked path steers to 'git rm -q'; untracked,
207
+ # rule 21 — bare rm of a tracked path steers to 'git rm -q'; untracked,
150
208
  # gitignored, and the already-correct git rm form pass
151
209
  block rm tracked.md
152
210
  block rm -f tracked.md
@@ -155,5 +213,5 @@ fallthrough rm scratch.txt
155
213
  fallthrough rm untracked-nowhere.md
156
214
  fallthrough git rm -q tracked.md
157
215
 
158
- # rule 17 — anything else falls through to the friction log
216
+ # rule 22 — anything else falls through to the friction log
159
217
  fallthrough make build