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
@@ -384,3 +384,30 @@ link — an application of the load-trigger residency rule to the doctrine itsel
384
384
  contract and the quiet-default run surfaces
385
385
  ([gate-sdk/SPEC.md](../gate-sdk/SPEC.md) §run-gates).
386
386
  *Stages:* build
387
+
388
+ 23. **An assertion reports the size of the set it ranged over.** A verification a
389
+ session writes — a scan, a probe, a predicate under edit — whose subject is a
390
+ set prints that set's size beside its verdict, because an exit code cannot
391
+ distinguish *asserted and held* from *asserted nothing*: both are zero
392
+ failures. The corollary governs the probe that proves an assertion bites — a
393
+ mutation is valid only against a target the assertion actually ranges over,
394
+ or it reports an empty red set and reads as a pass. *Quiet green, loud red*
395
+ puts that count on a batch runner's summary line; this is the same tripwire
396
+ one altitude down, for the one-off verification a session writes and reads
397
+ inside the session.
398
+ *Under agent work:* an agent writes the check and reads its verdict in one
399
+ motion, so the exit code is the only evidence it holds that the check bit —
400
+ and a predicate just rewritten (a regex carried between dialects, a path list
401
+ narrowed) fails by matching nothing, which is indistinguishable from success.
402
+ A printed count is the one signal that survives the rewrite.
403
+ *Enforced by:* judgment, over a class only partly mechanizable — stated
404
+ honestly rather than promised to a scanner. Shipped: the vacuous-pass
405
+ tripwire in [gate-sdk/SPEC.md](../gate-sdk/SPEC.md) §run-gates, and the
406
+ `good/`+`bad/` fixture pair every gate already owes
407
+ ([gate-sdk/SPEC.md](../gate-sdk/SPEC.md) §The gate model), which exercises a
408
+ predicate rather than trusting it. Buildable but unbuilt: a branch-coverage
409
+ assertion over a check's fixture corpus, for the arm that ships with no
410
+ fixture to run it. Unreachable: whether a session's mutation probe targeted
411
+ something its assertion ranges over is a property of a session act that
412
+ leaves no residue in the tree, so that third stays judgment.
413
+ *Stages:* build, validate
@@ -62,6 +62,11 @@ Vendor the kit beside [gate-sdk](../gate-sdk/) (required), then:
62
62
  inside the digest section. The gate holds the digest in per-rule lockstep with
63
63
  the doctrine modulo declared trims, so a silent omission stays red; point
64
64
  `DOCTRINE_KIT_DIGEST_SECTION` at your heading if it is not `## Delivery doctrine`.
65
+ The declaration survives the next run: the installer reads your block before it
66
+ rewrites it and carries each declared marker back into the trimmed rule's
67
+ position, so re-vendoring never restores a rule you removed. That is the only
68
+ customization it preserves — see
69
+ [SPEC.md](SPEC.md#install-doctrine) for the bound and the two findings it reports.
65
70
 
66
71
  ## Test
67
72
 
@@ -52,9 +52,11 @@ updated where it sits. A begin marker without its end is a malformed target: the
52
52
  installer refuses (exit 2) rather than guess the block bounds. The agent file
53
53
  must already exist — the installer edits an always-loaded file, it does not mint
54
54
  one — so a missing target is exit 2. The marker insert/replace itself is not
55
- this installer's code: it rides gate-sdk's shared `lib/inject.sh` helper
56
- (`inject_marker_block`), the single copy `lifecycle-kit`'s injector also uses;
57
- `install-doctrine.sh` supplies only the block content (the digest) on stdin.
55
+ this installer's code: it rides gate-sdk's shared `lib/inject.sh` helpers
56
+ (`inject_marker_block` to write, `read_marker_block` to read the block as it
57
+ stands), the single copy `lifecycle-kit`'s injector also uses;
58
+ `install-doctrine.sh` supplies the block content (the digest) on stdin and owns
59
+ every rule about what survives from one run to the next.
58
60
 
59
61
  The block is the always-loaded shape applied to the doctrine itself: a one-line
60
62
  digest of the methodology-maintenance rules plus a markdown link to the doctrine
@@ -70,6 +72,63 @@ keep resident stays legal, but rides a declared-trim marker rather than a silent
70
72
  deletion: the gate asserts name-lockstep modulo declared trims (§check-doctrine-registration
71
73
  assertion B).
72
74
 
75
+ **The declared-trim round-trip.** A generated block that is unconditionally
76
+ rewritten would revoke that right on the next run — and revoke it *silently*,
77
+ because a trim the installer restores to a bullet leaves an agent file whose
78
+ hash matches what the installer last recorded. So the run is read-compute-emit
79
+ rather than emit: `read_marker_block` returns the block as it stands, the
80
+ installer harvests every
81
+ `<!-- doctrine-digest-trim: <rule name> — <reason> -->` line out of it, and each
82
+ digest rule is emitted as **either** its bullet **or** — when that rule's name is
83
+ trimmed — the harvested marker line verbatim, **in the bullet's position**.
84
+ Substitution, not addition: a block carrying the trim *and* its bullet would
85
+ satisfy assertions B and C while handing the consumer back the rule they
86
+ removed, which is the customization defeated while appearing honored. In-place
87
+ rather than appended so the consumer's reason stays where the rule it answers
88
+ would have been; the gate accepts the marker anywhere in the digest section, so
89
+ readability decides. The rule names the substitution keys on are the digest's
90
+ own bullet names, read exactly as assertion C reads them — installer and gate
91
+ never disagree about which rule a marker names.
92
+
93
+ Four behaviors the round-trip fixes:
94
+
95
+ - **No trims declared → byte-identical output.** Load-bearing rather than
96
+ incidental: without it every consumer's agent file churns on every upgrade,
97
+ and the installer's caller starts reporting a file nobody edited.
98
+ - **A trim naming no rule in the current digest** — a rule renamed or dropped
99
+ upstream — is carried forward *and* reported. It has no bullet position to
100
+ take, so it is carried at the digest's end. Surfacing it at the re-vendor
101
+ moment is the declared-not-silent design working: that is the moment the
102
+ consumer's decision gets reconciled.
103
+ - **Duplicate trims for one rule** — the first is carried, the duplicate
104
+ dropped and reported. Silently collapsing them would be the same class of
105
+ quiet edit-loss one layer up.
106
+ - **The report has two channels, and the split is deliberate.** The standing
107
+ rule it instances: an installer a machine may drive puts **findings on
108
+ stderr** and narration on stdout, and stays silent on a clean run — stderr
109
+ chatter on success is how a channel gets ignored. So each finding above goes
110
+ to stderr, and the action line on stdout gains the count of trims carried and
111
+ a tally of those findings. What makes the rule binding here rather than merely
112
+ tidy is the caller class this script has: a vendoring installer whose own
113
+ stdout is a machine-read channel of seeded paths must discard this script's,
114
+ so stdout is exactly where a reconciliation the consumer owes would be lost.
115
+ The honest consequence is that under such a caller the count has no reader —
116
+ the carried trims are read from the commit that install makes — while every
117
+ finding still reaches whoever ran it.
118
+
119
+ **The honest bound.** The block is generated, and the declared trim is the only
120
+ customization preserved across a run. An unsanctioned edit *inside* the span — a
121
+ reworded bullet, an added line — is reverted by design, and would red
122
+ §check-doctrine-registration assertion C independently; everything *outside* the
123
+ markers is the adopter's and is never read or written. Stating the bound is what
124
+ makes the preserved case a contract rather than an accident.
125
+
126
+ The round-trip's acceptor is `smoke/install.sh`, per the coverage tier
127
+ gate-sdk/SPEC.md §lib/inject.sh sets for a sourced library with no gate surface:
128
+ it declares a trim in the block the installer just emitted, re-runs the
129
+ installer, and holds that the marker survived in the trimmed bullet's position,
130
+ that the bullet is gone, and that the gate is green across the re-run.
131
+
73
132
  Positional overrides `install-doctrine.sh [agent-file [doctrine-file]]` let a
74
133
  smoke or a fixture point both paths at a scratch tree without touching consumer
75
134
  config; unset, they fall to the knob defaults.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # spec: doctrine-kit/SPEC.md §install-doctrine — idempotent insert/replace of the doctrine reference block between fixed markers in the always-loaded agent file
2
+ # spec: doctrine-kit/SPEC.md §install-doctrine — idempotent insert/replace of the doctrine reference block between fixed markers in the always-loaded agent file, carrying the consumer's declared trims across the rewrite
3
3
  set -euo pipefail
4
4
 
5
5
  KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -17,8 +17,8 @@ DOCTRINE_FILE="${2:-$DOCTRINE_KIT_DOCTRINE_FILE}"
17
17
  BEGIN="<!-- doctrine-kit:begin -->"
18
18
  END="<!-- doctrine-kit:end -->"
19
19
 
20
- # spec: doctrine-kit/SPEC.md §install-doctrine — the block is the always-loaded shape applied to the doctrine itself: a one-line-per-rule digest plus the markdown link to the doctrine file
21
- block() {
20
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the untrimmed digest: the always-loaded shape applied to the doctrine itself, a one-line-per-rule digest plus the markdown link to the doctrine file
21
+ digest() {
22
22
  cat <<EOF
23
23
  ## Delivery doctrine
24
24
 
@@ -40,5 +40,85 @@ an engineering-craft section behind the link:
40
40
  EOF
41
41
  }
42
42
 
43
+ # spec: doctrine-kit/SPEC.md §install-doctrine — a digest bullet's rule name, extracted exactly as check-doctrine-registration extracts it (assertion C), so the substitution keys on the same string the gate keys on
44
+ bullet_name() { # $1 = a digest line -> its bold lead-in name, non-zero when the line is not a rule bullet
45
+ local l="$1"
46
+ [[ "$l" == "- **"*"**"* ]] || return 1
47
+ l="${l#- \*\*}"
48
+ printf '%s\n' "${l%%\*\**}"
49
+ }
50
+
51
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the declared-trim grammar read exactly as check-doctrine-registration reads it (assertion B), so installer and gate never disagree about which rule a marker names
52
+ harvest_trims() { # block content on stdin -> one '<rule name><TAB><marker line verbatim>' per declared trim, in declaration order
53
+ awk '
54
+ /doctrine-digest-trim:/ {
55
+ name = $0
56
+ sub(/^.*doctrine-digest-trim:[[:space:]]*/, "", name)
57
+ sub(/[[:space:]]*—.*$/, "", name)
58
+ print name "\t" $0
59
+ }
60
+ '
61
+ }
62
+
63
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the round-trip's read half: the block as it stands is the only record of what the consumer declared, so it is harvested before the rewrite that would erase it
64
+ CURRENT="$(read_marker_block "$AGENT_FILE" "$BEGIN" "$END")" || exit $?
65
+
66
+ declare -A TRIM_LINE=()
67
+ TRIM_ORDER=()
68
+ DUPES=()
69
+ while IFS=$'\t' read -r tname tline; do
70
+ [[ -n "$tname" ]] || continue
71
+ if [[ -n "${TRIM_LINE[$tname]+set}" ]]; then
72
+ DUPES+=("$tname")
73
+ continue
74
+ fi
75
+ TRIM_LINE["$tname"]="$tline"
76
+ TRIM_ORDER+=("$tname")
77
+ done < <(printf '%s\n' "$CURRENT" | harvest_trims)
78
+
79
+ declare -A IS_RULE=()
80
+ while IFS= read -r dline; do
81
+ if rname="$(bullet_name "$dline")"; then IS_RULE["$rname"]=1; fi
82
+ done < <(digest)
83
+
84
+ ORPHANS=()
85
+ if [[ ${#TRIM_ORDER[@]} -gt 0 ]]; then
86
+ for tname in "${TRIM_ORDER[@]}"; do
87
+ [[ -n "${IS_RULE[$tname]:-}" ]] || ORPHANS+=("$tname")
88
+ done
89
+ fi
90
+
91
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the emit: a trimmed rule's marker replaces its bullet in place, because a block carrying both would satisfy the gate while handing back the rule the consumer removed
92
+ block() {
93
+ local line name
94
+ while IFS= read -r line; do
95
+ if name="$(bullet_name "$line")" && [[ -n "${TRIM_LINE[$name]+set}" ]]; then
96
+ printf '%s\n' "${TRIM_LINE[$name]}"
97
+ continue
98
+ fi
99
+ printf '%s\n' "$line"
100
+ done < <(digest)
101
+ # spec: doctrine-kit/SPEC.md §install-doctrine — a trim naming no live rule has no bullet position to take, so it is carried at the digest's end rather than dropped
102
+ if [[ ${#ORPHANS[@]} -gt 0 ]]; then
103
+ for name in "${ORPHANS[@]}"; do printf '%s\n' "${TRIM_LINE[$name]}"; done
104
+ fi
105
+ }
106
+
43
107
  action="$(block | inject_marker_block "$AGENT_FILE" "$BEGIN" "$END")" || exit $?
44
- echo "install-doctrine: $action the doctrine reference block in $AGENT_FILE (link → $DOCTRINE_FILE)"
108
+
109
+ # spec: doctrine-kit/SPEC.md §install-doctrine — findings go to stderr, the one channel init does not discard, so a reconciliation the consumer owes is never silent on the install path
110
+ if [[ ${#ORPHANS[@]} -gt 0 ]]; then
111
+ for tname in "${ORPHANS[@]}"; do
112
+ echo "install-doctrine: declared trim names '$tname', which no rule in the current doctrine digest matches — carried forward unchanged; adopt the renamed rule or drop the marker" >&2
113
+ done
114
+ fi
115
+ if [[ ${#DUPES[@]} -gt 0 ]]; then
116
+ for tname in "${DUPES[@]}"; do
117
+ echo "install-doctrine: duplicate declared trim for '$tname' — the first is carried, the duplicate dropped" >&2
118
+ done
119
+ fi
120
+
121
+ findings=""
122
+ if [[ ${#ORPHANS[@]} -gt 0 ]]; then findings="$findings, ${#ORPHANS[@]} unmatched"; fi
123
+ if [[ ${#DUPES[@]} -gt 0 ]]; then findings="$findings, ${#DUPES[@]} duplicate"; fi
124
+ echo "install-doctrine: $action the doctrine reference block in $AGENT_FILE (link → $DOCTRINE_FILE); ${#TRIM_ORDER[@]} declared trim(s) carried$findings"
@@ -15,10 +15,86 @@ EOF
15
15
  fi
16
16
  bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" >/dev/null
17
17
 
18
+ # spec: doctrine-kit/SPEC.md §install-doctrine — every assertion below reads the doctrine block alone, never the whole agent file: a consumer with several kits installed carries several marker blocks in one CLAUDE.md, and a bullet outside this kit's span is not this kit's to reason about
19
+ SMOKE_BEGIN="<!-- doctrine-kit:begin -->"
20
+ SMOKE_END="<!-- doctrine-kit:end -->"
21
+ smoke_block() { awk -v b="$SMOKE_BEGIN" -v e="$SMOKE_END" '$0 == e { inb = 0 } inb; $0 == b { inb = 1 }' CLAUDE.md; }
22
+
23
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the declared-trim round-trip's acceptor. inject.sh is a sourced library with no gate surface (gate-sdk/SPEC.md §lib/inject.sh), so its read half and this installer's preservation rule are exercised here: declare a trim in the block the installer just emitted, re-run the installer, and hold that the marker survived *in the trimmed bullet's position* with the bullet gone and the gate green
24
+ mapfile -t SMOKE_RULES < <(smoke_block | awk '/^- \*\*/ { sub(/^- \*\*/, ""); sub(/\*\*.*/, ""); print }')
25
+ if [[ ${#SMOKE_RULES[@]} -lt 2 ]]; then
26
+ echo "doctrine smoke: the installed digest has fewer than two rule bullets — nothing to trim against" >&2
27
+ exit 2
28
+ fi
29
+ SMOKE_TRIMMED="${SMOKE_RULES[0]}"
30
+ SMOKE_NEXT="- **${SMOKE_RULES[1]}**"
31
+ SMOKE_TRIM="<!-- doctrine-digest-trim: $SMOKE_TRIMMED — smoke: the declared-trim round-trip acceptor -->"
32
+
33
+ awk -v b="$SMOKE_BEGIN" -v e="$SMOKE_END" -v bullet="- **$SMOKE_TRIMMED**" -v trim="$SMOKE_TRIM" '
34
+ $0 == b { inb = 1 }
35
+ $0 == e { inb = 0 }
36
+ inb && index($0, bullet) == 1 { print trim; next }
37
+ { print }
38
+ ' CLAUDE.md > CLAUDE.md.smoke && mv CLAUDE.md.smoke CLAUDE.md
39
+
40
+ bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" >/dev/null
41
+
42
+ if ! smoke_block | grep -qF -- "$SMOKE_TRIM"; then
43
+ echo "doctrine smoke: the re-run dropped the declared trim for '$SMOKE_TRIMMED' — init silently revokes a customization doctrine-kit's own gate grants" >&2
44
+ exit 1
45
+ fi
46
+ if smoke_block | grep -qF -- "- **$SMOKE_TRIMMED**"; then
47
+ echo "doctrine smoke: the re-run restored the bullet for '$SMOKE_TRIMMED' — a block carrying the trim *and* its bullet hands back the rule the consumer removed" >&2
48
+ exit 1
49
+ fi
50
+ if [[ "$(smoke_block | grep -A1 -F -- "$SMOKE_TRIM" | tail -n1)" != "$SMOKE_NEXT"* ]]; then
51
+ echo "doctrine smoke: the carried trim for '$SMOKE_TRIMMED' is not in the trimmed bullet's position (expected '$SMOKE_NEXT' beneath it)" >&2
52
+ exit 1
53
+ fi
54
+ bash "$SMOKE_KIT_ROOT/checks/check-doctrine-registration.sh" >/dev/null \
55
+ || { echo "doctrine smoke: check-doctrine-registration is not green across the trim round-trip" >&2; exit 1; }
56
+
57
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the two reported findings, each carried *and* named. Both ride stderr, so this captures that channel and not stdout
58
+ SMOKE_ORPHAN="<!-- doctrine-digest-trim: Rule-that-left — smoke: renamed upstream -->"
59
+ SMOKE_DUP="<!-- doctrine-digest-trim: $SMOKE_TRIMMED — smoke: a second declaration for one rule -->"
60
+ awk -v e="$SMOKE_END" -v orphan="$SMOKE_ORPHAN" -v dup="$SMOKE_DUP" '
61
+ $0 == e { print orphan; print dup }
62
+ { print }
63
+ ' CLAUDE.md > CLAUDE.md.smoke && mv CLAUDE.md.smoke CLAUDE.md
64
+
65
+ SMOKE_ERR="$(bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" 2>&1 >/dev/null)"
66
+ if ! smoke_block | grep -qF -- "$SMOKE_ORPHAN"; then
67
+ echo "doctrine smoke: the re-run dropped a trim naming no live rule — a rule renamed upstream must survive to the re-vendor moment, not vanish before the consumer can reconcile it" >&2
68
+ exit 1
69
+ fi
70
+ case "$SMOKE_ERR" in
71
+ *Rule-that-left*) : ;;
72
+ *) echo "doctrine smoke: a trim naming no live rule was carried but never reported (stderr was: $SMOKE_ERR)" >&2; exit 1 ;;
73
+ esac
74
+ if [[ "$(smoke_block | grep -cF -- "doctrine-digest-trim: $SMOKE_TRIMMED")" != "1" ]]; then
75
+ echo "doctrine smoke: the duplicate trim for '$SMOKE_TRIMMED' was not carried exactly once" >&2
76
+ exit 1
77
+ fi
78
+ case "$SMOKE_ERR" in
79
+ *duplicate*"$SMOKE_TRIMMED"*) : ;;
80
+ *) echo "doctrine smoke: the duplicate trim for '$SMOKE_TRIMMED' was collapsed silently (stderr was: $SMOKE_ERR)" >&2; exit 1 ;;
81
+ esac
82
+ # spec: doctrine-kit/SPEC.md §install-doctrine — carrying an unmatched trim forward is only safe if the gate tolerates one; a gate that red on it would hand the consumer a broken battery instead of a reconciliation
83
+ bash "$SMOKE_KIT_ROOT/checks/check-doctrine-registration.sh" >/dev/null \
84
+ || { echo "doctrine smoke: check-doctrine-registration reds on a carried-forward trim naming no live rule — carrying it forward would break the consumer's battery" >&2; exit 1; }
85
+
86
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the other direction, and the reason the smoke's steady state is an untrimmed consumer: withdrawing the declarations restores the bullet where it was
87
+ grep -v -F -e "$SMOKE_TRIM" -e "$SMOKE_ORPHAN" -e "$SMOKE_DUP" CLAUDE.md > CLAUDE.md.smoke && mv CLAUDE.md.smoke CLAUDE.md
88
+ bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" >/dev/null
89
+ if ! smoke_block | grep -qF -- "- **$SMOKE_TRIMMED**"; then
90
+ echo "doctrine smoke: withdrawing the trim for '$SMOKE_TRIMMED' did not restore its bullet" >&2
91
+ exit 1
92
+ fi
93
+
18
94
  cat >> scripts/gates.list <<'EOF'
19
95
  # doctrine-kit
20
96
  check-doctrine-registration
21
97
  EOF
22
98
 
23
99
  bash "$SDK/bin/gen-pre-commit.sh" --write >/dev/null
24
- bash "$SDK/checks/check-graph.sh" --emit > .workflow/CHECK-GRAPH.html
100
+ bash "$SDK/checks/check-graph.sh" --emit > scripts/CHECK-GRAPH.html
@@ -105,8 +105,9 @@ gates dir and naming it in the registry; shadow a bundled one with a same-named
105
105
  file. The bundled set (drift-kit/SPEC.md §Bundled KPIs) covers, as lead KPIs, the
106
106
  queue split and its per-iteration net delta, the gate backlog, amendment/deferred
107
107
  age, prompt friction, the always-loaded surface, the local permission overlay,
108
- gate runtime, session overhead, and the price table's age and expiry; and one lag
109
- KPI, `kpi-knowledge-friction`, fed by the loop below.
108
+ gate runtime, session overhead, and the price table's age and expiry; and as lag
109
+ KPIs, `kpi-knowledge-friction` (fed by the loop below) and
110
+ `kpi-incident-recurrence` (fed by the queue's `recurrence:` declarations).
110
111
 
111
112
  ## Test
112
113