checkwright 0.21.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 (236) 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 +279 -24
  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-payload-claim.sh +133 -0
  16. package/payload/canon-kit/checks/check-prose-enum.sh +1 -1
  17. package/payload/canon-kit/checks/check-spec-pointer.sh +9 -2
  18. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
  19. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +26 -3
  20. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -0
  21. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
  22. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/OUTSIDE.md +4 -0
  23. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
  24. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
  25. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +5 -3
  26. package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
  27. package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
  28. package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
  29. package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
  30. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
  31. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
  32. package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
  33. package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
  34. package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
  35. package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
  36. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
  37. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
  38. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +24 -1
  39. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +1 -0
  40. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
  41. package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
  42. package/payload/canon-kit/lib/spec.sh +22 -12
  43. package/payload/canon-kit/smoke/install.sh +20 -1
  44. package/payload/canon-kit/templates/SPEC-amendment.md +5 -1
  45. package/payload/context-kit/SPEC.md +25 -1
  46. package/payload/context-kit/lib/toolfloor.sh +1 -1
  47. package/payload/context-kit/smoke/install.sh +3 -1
  48. package/payload/delegation-kit/SPEC.md +383 -13
  49. package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
  50. package/payload/delegation-kit/checks/check-gate-tamper.sh +1 -1
  51. package/payload/delegation-kit/lib/delegation.sh +1 -0
  52. package/payload/delegation-kit/smoke/install.sh +2 -1
  53. package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
  54. package/payload/delegation-kit/templates/agent-execution.md +103 -12
  55. package/payload/delegation-kit/templates/delegation-config.sh +4 -0
  56. package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
  57. package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
  58. package/payload/doctrine-kit/DOCTRINE.md +27 -0
  59. package/payload/doctrine-kit/README.md +5 -0
  60. package/payload/doctrine-kit/SPEC.md +62 -3
  61. package/payload/doctrine-kit/bin/install-doctrine.sh +84 -4
  62. package/payload/doctrine-kit/smoke/install.sh +77 -1
  63. package/payload/drift-kit/README.md +3 -2
  64. package/payload/drift-kit/SPEC.md +253 -20
  65. package/payload/drift-kit/bin/stage-economics.sh +157 -3
  66. package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
  67. package/payload/drift-kit/smoke/install.sh +155 -1
  68. package/payload/drift-kit/templates/economics.md +9 -0
  69. package/payload/drift-kit/templates/kpis.list +6 -1
  70. package/payload/evidence-kit/README.md +20 -6
  71. package/payload/evidence-kit/SPEC.md +355 -17
  72. package/payload/evidence-kit/bin/run-validate.sh +51 -9
  73. package/payload/evidence-kit/checks/check-battery-roster.sh +86 -0
  74. package/payload/evidence-kit/checks/check-producer-liveness.sh +34 -0
  75. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
  76. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
  77. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
  78. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
  79. package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
  80. package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
  81. package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
  82. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
  83. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
  84. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
  85. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
  86. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
  87. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
  88. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
  89. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
  90. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
  91. package/payload/evidence-kit/lib/evidence.sh +18 -0
  92. package/payload/evidence-kit/smoke/install.sh +17 -3
  93. package/payload/gate-sdk/README.md +4 -1
  94. package/payload/gate-sdk/SPEC.md +1949 -74
  95. package/payload/gate-sdk/bin/gen-pre-commit.sh +12 -2
  96. package/payload/gate-sdk/bin/run-consumer-smoke.sh +121 -1
  97. package/payload/gate-sdk/bin/run-gate-tests.sh +40 -9
  98. package/payload/gate-sdk/bin/run-gates.sh +31 -2
  99. package/payload/gate-sdk/bin/upgrade-smoke.sh +3 -3
  100. package/payload/gate-sdk/checks/check-action-gh-repo.gate +2 -0
  101. package/payload/gate-sdk/checks/check-action-pinning.gate +2 -0
  102. package/payload/gate-sdk/checks/check-action-run-shell.sh +3 -1
  103. package/payload/gate-sdk/checks/check-core-files.sh +27 -4
  104. package/payload/gate-sdk/checks/check-exec-bit.sh +20 -1
  105. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +106 -0
  106. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +6 -7
  107. package/payload/gate-sdk/checks/check-gate-output.sh +9 -1
  108. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +302 -0
  109. package/payload/gate-sdk/checks/check-graph.sh +4 -5
  110. package/payload/gate-sdk/checks/check-readme-roster.sh +5 -0
  111. package/payload/gate-sdk/checks/check-reads-couples.sh +70 -21
  112. package/payload/gate-sdk/checks/check-template-registry-parity.sh +81 -0
  113. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
  114. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
  115. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
  116. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
  117. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
  118. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
  119. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
  120. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
  121. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
  122. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
  123. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
  124. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
  125. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
  126. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
  127. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
  128. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
  129. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
  130. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
  131. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
  132. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
  133. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
  134. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
  135. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
  136. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
  137. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
  138. package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
  139. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
  140. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
  141. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
  142. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
  143. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
  144. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
  145. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
  146. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
  147. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
  148. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
  149. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
  150. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
  151. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
  152. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
  153. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
  154. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
  155. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
  156. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
  157. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
  158. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
  159. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
  160. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
  161. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
  162. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
  163. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
  164. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
  165. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +123 -0
  166. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
  167. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
  168. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
  169. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
  170. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
  171. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
  172. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
  173. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
  174. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
  175. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
  176. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
  177. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
  178. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
  179. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
  180. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
  181. package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
  182. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +41 -1
  183. package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
  184. package/payload/gate-sdk/lib/consumer-smoke.sh +26 -1
  185. package/payload/gate-sdk/lib/gate.sh +75 -0
  186. package/payload/gate-sdk/lib/inject.sh +21 -1
  187. package/payload/gate-sdk/smoke/install.sh +19 -1
  188. package/payload/guard-kit/README.md +4 -3
  189. package/payload/guard-kit/SPEC.md +88 -10
  190. package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
  191. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
  192. package/payload/guard-kit/lib/guard.sh +1 -0
  193. package/payload/guard-kit/templates/close-triage.md +35 -7
  194. package/payload/guard-kit/templates/guard-config.sh +3 -0
  195. package/payload/lifecycle-kit/README.md +1 -0
  196. package/payload/lifecycle-kit/SPEC.md +575 -29
  197. package/payload/lifecycle-kit/bin/enter-stage.sh +13 -3
  198. package/payload/lifecycle-kit/bin/file-gap.sh +42 -1
  199. package/payload/lifecycle-kit/bin/file-survey.sh +50 -0
  200. package/payload/lifecycle-kit/checks/check-merge-attrs.sh +1 -1
  201. package/payload/lifecycle-kit/checks/check-skill-binding.sh +1 -1
  202. package/payload/lifecycle-kit/checks/check-survey-record.sh +102 -0
  203. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
  204. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
  205. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +1 -0
  206. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
  207. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
  208. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
  209. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
  210. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
  211. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
  212. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +84 -0
  213. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +94 -0
  214. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
  215. package/payload/lifecycle-kit/lib/stages.sh +8 -2
  216. package/payload/lifecycle-kit/smoke/install.sh +17 -1
  217. package/payload/lifecycle-kit/templates/consult.md +73 -0
  218. package/payload/lifecycle-kit/templates/lead.md +103 -7
  219. package/payload/lifecycle-kit/templates/stages/align.md +12 -0
  220. package/payload/lifecycle-kit/templates/stages/build.md +8 -0
  221. package/payload/lifecycle-kit/templates/stages/close.md +25 -4
  222. package/payload/lifecycle-kit/templates/stages/scope.md +34 -0
  223. package/payload/lifecycle-kit/templates/stages/spec.md +8 -0
  224. package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
  225. package/payload/queue-kit/README.md +4 -1
  226. package/payload/queue-kit/SPEC.md +230 -6
  227. package/payload/queue-kit/bin/queue-edges.sh +78 -0
  228. package/payload/queue-kit/checks/check-queue-entry-budget.sh +5 -3
  229. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
  230. package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
  231. package/payload/queue-kit/smoke/install.sh +4 -1
  232. package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
  233. package/payload/site-kit/SPEC.md +41 -27
  234. package/payload/site-kit/smoke/install.sh +9 -1
  235. package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
  236. package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
package/README.md CHANGED
@@ -9,8 +9,11 @@ for stateless agent sessions, and token-economics-aware context management.
9
9
 
10
10
  A one-shot vendoring installer. It copies pinned kit source out of its own
11
11
  payload into your repository and commits it, then prints the commands that
12
- finish the setup. What governs your tree afterwards is committed, auditable
13
- source you read before you run it.
12
+ finish the setup. What governs your tree afterwards is committed and auditable:
13
+ every gate arrives with its declaration, its `# spec:` pointer and the section
14
+ behind it, and its `good/`+`bad/` fixture pair, and a gate whose implementation
15
+ is compiled arrives as a digest-verified binary rather than as source
16
+ (gate-sdk/SPEC.md §Consumer payload, which rules that and bounds it).
14
17
 
15
18
  What it is not: a dependency channel. Nothing resolves at your build time,
16
19
  nothing is fetched after this package itself, and the installer writes no
@@ -52,7 +55,16 @@ with its version floors, is on the install page.
52
55
 
53
56
  `checkwright init` vendors the selected profile's kit source out of this
54
57
  package's own payload into your repository and commits it. One command, and
55
- what governs your tree afterwards is committed source you can read.
58
+ what governs your tree afterwards is committed and auditable on the terms
59
+ gate-sdk/SPEC.md §Consumer payload sets.
60
+
61
+ **No selection builds.** Not "no profile that happens to carry only shell
62
+ gates" — no selection, ever. `init` writes files and compiles nothing, so it
63
+ asks for no toolchain and cannot fail on one. A gate whose implementation is a
64
+ compiled subcommand reaches you as a prebuilt binary picked for your platform
65
+ and checked against a published digest before it is written, which is what makes
66
+ zero build step a property of `init` itself rather than of which profile you
67
+ picked (gate-sdk/SPEC.md §Porting a gate to the binary substrate, criterion 5).
56
68
 
57
69
  Three preconditions, and all three **refuse** rather than warn — a partial
58
70
  install is the outcome none of them may produce, so every one is checked before
@@ -79,7 +91,15 @@ run the battery.
79
91
  **Re-running is idempotent and non-destructive.** A second `init` reads each
80
92
  recorded hash from the manifest: a file whose hash still matches is `init`'s to
81
93
  rewrite, and one that has changed since is **yours** — it is reported and left
82
- alone, never overwritten, unless you pass `--force`. A re-run that finds
94
+ alone, never overwritten, unless you pass `--force`. That does not expire at the
95
+ next upgrade: a file reported as changed stays on `init`'s roster at the hash
96
+ `init` wrote there, so every later run reads it the same way and reports it
97
+ again. It does not expire when a release **stops shipping** the file either.
98
+ `init` owns what it wrote there, not what the current payload happens to carry,
99
+ so the path stays on the roster at that hash and a release that later re-adds it
100
+ meets the same protection rather than a clean slate — which is the one window in
101
+ which an unowned path could otherwise be written straight over your edits. A
102
+ re-run that finds
83
103
  nothing to change says so and exits clean; an unchanged tree is the success
84
104
  case, not an error. A payload older than the recorded install is refused as a
85
105
  silent downgrade — `--force` covers that refusal too, which is what makes a
@@ -100,6 +120,19 @@ whatever `templates/*-config.sh` it ships, and the destination is always your
100
120
  gates directory under the file's own name. A kit that grows a config template
101
121
  is picked up with no edit here.
102
122
 
123
+ **Everything `init` seeds takes one of two disciplines, and which one follows
124
+ from whether `init` keeps rewriting the file.** A surface `init` creates once and
125
+ then leaves to you — the queue file, the agent file, the evidence manifests, the
126
+ workflow-state file — is written **only when it is absent**, so a re-run never
127
+ disturbs a tree that has grown since. A surface `init` rewrites on every run —
128
+ every kit's config seam, and gate-sdk's `msg-patterns.list` — is **claimed
129
+ before it is written**, on the same non-destructive path as any vendored file:
130
+ the recipe *plans* the copy and `init` performs it, so your edit is compared
131
+ against the recorded hash while it is still on disk. Landing the copy first would
132
+ destroy the very evidence the comparison is made from, and these are precisely
133
+ the files whose whole purpose is to be edited by you — which is why the ordering
134
+ is stated here rather than left to each recipe.
135
+
103
136
  The **starting gate roster** is the subset a fresh consumer begins with, not
104
137
  the kit's full roster — the same distinction gate-sdk's own README draws. A
105
138
  gate whose subject you have not authored yet has nothing to read: canon-kit's
@@ -109,13 +142,129 @@ a tree that has done nothing wrong those would red on day one, so they are
109
142
  registered when the surface exists rather than at install. Each kit's README
110
143
  names the full roster to grow into.
111
144
 
112
- *The honest limit.* That per-kit starting roster is knowledge this installer
113
- holds, and each kit's `smoke/install.sh` holds a second encoding of the same
114
- fact for its own scratch consumer. The consumer smoke catches the drift that
145
+ *The honest limit.* That per-kit starting roster is `recipe_gates` in
146
+ `lib/common/recipe.sh`, and that function is the **whole** of a fresh
147
+ consumer's registry — what a tree `init` just made will run is read there, never
148
+ inferred from a kit's full roster or from this repo's own `gates.list`. Each
149
+ kit's `smoke/install.sh` holds a second encoding of the same fact for its own
150
+ scratch consumer. The consumer smoke catches the drift that
115
151
  matters — a roster naming a gate that fails to resolve reds it — but not a
116
152
  kit that adds a zero-config gate this roster never learns about. Collapsing the
117
153
  two into one per-kit source is filed as queued work, not papered over here.
118
154
 
155
+ ## The gate binary
156
+
157
+ A gate whose implementation is a compiled subcommand needs that binary on disk
158
+ before it can run, and `init` is what puts it there. It **selects, verifies and
159
+ places** — it never builds, and it never fetches. Everything below sits inside
160
+ the irreducible bootstrap the vendoring ruling leaves outside the binary
161
+ (gate-sdk/SPEC.md §Porting a gate to the binary substrate): the binary cannot
162
+ select itself, so something must resolve the platform, verify the artifact, and
163
+ place it. Each step is deliberately small enough to be written twice, in bash
164
+ and in PowerShell.
165
+
166
+ **Platform resolution is derived and never stored.** `target_of_host()` maps
167
+ `uname -s` and `uname -m` to one Rust target triple, and to the empty string on
168
+ a host that maps to none. It runs once per `init`, after the profile's kit set
169
+ resolves and before anything is written. The result stays a local: a stored copy
170
+ would be a second source for a fact the host already answers, and it is stale
171
+ the first time a vendored tree moves between machines — the case that matters
172
+ most, since a vendored tree is shared by construction. Two fields rather than
173
+ `uname -a` because that is the smallest input that answers the question, and it
174
+ is what a PowerShell half can answer without parsing prose. Nothing reads the
175
+ kernel version, so nothing collects it.
176
+
177
+ **Selection has three outcomes, and collapsing any two is the defect.** The
178
+ payload carries the target roster verbatim beside the artifacts
179
+ (gate-sdk/SPEC.md §Consumer payload), and `init` reads it rather than inferring
180
+ support from a directory's presence:
181
+
182
+ | the host resolves to | the payload holds | outcome |
183
+ | --- | --- | --- |
184
+ | a target **not** in the roster | — | **omit and declare** — a supported outcome, not a failure |
185
+ | a target **in** the roster | its binary and sidecar | verify, then write |
186
+ | a target **in** the roster | nothing, or half the pair | **refuse** — the payload is broken |
187
+
188
+ The third row is the whole reason the roster is read. Without it `init` cannot
189
+ tell a platform that was never committed to from a platform that was committed
190
+ to and whose artifact went missing, and reading the second as the first turns a
191
+ publisher defect into a silently smaller green battery. A payload assembled with
192
+ no artifacts at all carries no `artifact/` directory, so it reads as the first
193
+ row and never as a payload whose every target went missing. The refusal is the
194
+ one place this path fails an install, and it belongs there: a missing artifact
195
+ for a **declared** target is a defect the adopter cannot act on and must not
196
+ inherit silently.
197
+
198
+ **The digest is verified before anything is written.** `init` computes the
199
+ artifact's SHA-256 and compares it against the sidecar that travelled with it,
200
+ and only then writes. The ordering is the whole of it: a consumer who cannot
201
+ read the gate has nothing else standing between them and a substituted binary,
202
+ and a post-write check has already put it on disk. A mismatch refuses — never a
203
+ warning, never a write.
204
+
205
+ `sha256sum` is tried first, then `shasum -a 256`, because stock macOS ships the
206
+ second and not the first. When **neither** resolves the install proceeds and the
207
+ artifact is omitted rather than written unverified. Both halves are load-bearing:
208
+ never write what was not verified, and never fail an install over something the
209
+ adopter did not choose.
210
+
211
+ *The honest bound, stated so no surface overclaims it.* The digest travelled
212
+ inside the same payload as the artifact, so it catches corruption and a
213
+ substitution made to the artifact alone — not a compromised publisher, which no
214
+ in-payload value can. What raises it above a self-check is that the identical
215
+ bytes are published on the Release, so a human can cross-check the value out of
216
+ band. The claim is **verified against a published digest**, never *reproducible*.
217
+
218
+ **Omission is declared and counted.** An omitted member rides the registry
219
+ rather than a new file: `init` writes `# omitted: <name> <reason>` into the
220
+ consumer's `gates.list` in place of the member's name — a comment line the
221
+ runner already strips from the live set. The record then sits in the consumer's
222
+ tracked history where a reviewer reads it, instead of scrolling past in
223
+ install-time stdout, and a re-run on a machine that has since gained a hasher
224
+ converts it back into a live member with no hand edit. Two reason tokens,
225
+ because there are two remedies:
226
+
227
+ - `substrate-unavailable` — this host's platform has no declared artifact. There
228
+ is no adopter action; the platform is not in the support roster.
229
+ - `digest-unverifiable` — an artifact exists but no hasher does. Install
230
+ `sha256sum` or `shasum` and re-run `init`.
231
+
232
+ A third token would need a third remedy to earn its place. Which members are
233
+ affected is derived from the payload, never maintained here: a starting-roster
234
+ gate the payload declares as `<kit>/checks/<name>.gate` — and does not also ship
235
+ as a shell script — is one that dispatches to the binary. `run-gates.sh` reports
236
+ the count and remedy on a line of its own beside its summary
237
+ (gate-sdk/SPEC.md §run-gates), and `doctor` reports it against the reason that
238
+ caused it.
239
+
240
+ **The install location has one owner.** The binary is written to your gates
241
+ directory beside the `gates.list` seeded there, and `init` sets
242
+ `GATE_SDK_NATIVE_BIN` to that path in `<gates-dir>/gate-sdk-config.sh` — the
243
+ optional persistent config seam gate-sdk's library already sources when it
244
+ exists (gate-sdk/SPEC.md §Layout and configuration). `init` creates that file
245
+ when it places an artifact, and gate-sdk ships no config template for it because
246
+ **the seam file's content is resolved at install time rather than shipped**: its
247
+ one line sets `GATE_SDK_NATIVE_BIN` to the path the artifact was actually placed
248
+ at, and that path does not exist until selection has run. A static template could
249
+ only be copied and then immediately rewritten — the same file written twice, with
250
+ the copy contributing nothing. That is a property of the value, not of how the
251
+ template seam happens to copy, so it does not expire when the copy changes.
252
+ The knob's own default is unchanged and still names the crate's build output,
253
+ because it is a **stable relative path** on purpose: the generated hook persists
254
+ the emitted argv, so a machine-specific path baked into a tracked hook would make
255
+ the graph artifact's freshness comparison machine-dependent.
256
+
257
+ **Ordering is load-bearing.** The config seam and the binary are both in place
258
+ before the pre-commit hook is generated, because the generator resolves each
259
+ member's invocation argv and a `.gate` member resolves to this binary. A hook
260
+ generated first would resolve a dispatch it cannot make.
261
+
262
+ Every row of the table above runs under an oracle rather than a
263
+ hand-verification with a date on it: §The consumer smoke's artifact arm builds a
264
+ binary, packs it, and drives each outcome on every invocation. Nothing here
265
+ changes for that — the behavior this section specifies is what the arm asserts,
266
+ not something it added.
267
+
119
268
  ## doctor
120
269
 
121
270
  `checkwright doctor` tells you whether this machine meets the toolchain the
@@ -129,7 +278,22 @@ It has two behaviors, selected by where you run it rather than by a flag. Run
129
278
  anywhere, it reports the toolchain verdict. Run inside a repository that has
130
279
  been vendored into, it additionally reads `checkwright.lock` and reports the
131
280
  installed release, the upstream commit it came from, the profile, and the kit
132
- set.
281
+ set — plus, where one was installed, the gate binary's target re-verified
282
+ against its recorded digest **in place**, and any omitted members against the
283
+ reason that caused them (§The gate binary).
284
+
285
+ Those last two **report without setting the exit status**, and the asymmetry is
286
+ deliberate rather than lenient. The status is the toolchain contract, and `init`
287
+ gates its own precondition on it — so reddening here for a swapped or missing
288
+ binary would block the `init` re-run that is the finding's own remedy. A binary
289
+ that cannot be dispatched to is caught where it is dispatched from: the battery
290
+ treats it as a harness error rather than a skip.
291
+
292
+ Not setting the status is not the same as staying quiet about it, and the
293
+ verdict line says which state it is in. A run carrying an artifact finding
294
+ reports the toolchain clean **and names the finding**, rather than signing off
295
+ as plainly clean — a `doctor` that printed `DIGEST MISMATCH` above and `clean`
296
+ below would be the surface teaching a reader to disbelieve the last line.
133
297
 
134
298
  `doctor` defines no floor of its own. It sources the toolchain roster out of
135
299
  its own `payload/` and renders whatever verdict that roster's predicate
@@ -190,21 +354,118 @@ the shape behind it.
190
354
  | `commit` | the 40-hex commit the payload was assembled from | `doctor` prints it — it is what lets a reviewer resolve the vendored tree to an exact upstream state |
191
355
  | `profile` | the profile selected | a re-run of `init` re-applies the same profile without asking again |
192
356
  | `kits` | the vendored kit set | `init`'s re-run file plan, and `doctor`'s installed-set report |
193
- | `files` | each written path with its content hash | `init`'s changed-file detection: a file whose hash still matches is rewritten, one that has changed is reported rather than overwritten |
194
-
195
- A recorded hash is `git hash-object`, never `sha256sum`. Not a portability
196
- detail worth burying: macOS ships `shasum` rather than `sha256sum`, and the
197
- answer is not a new tool requirement — git is already something the toolchain
198
- contract asserts, its object hash is content-addressed and stable, so the
199
- manifest's integrity story stays inside the toolchain that contract already
357
+ | `files` | `init`'s ownership roster — each path it has written, at the content hash it last wrote there, until the file leaves the tree | `init`'s changed-file detection: a file whose hash still matches is rewritten, one that has changed is reported rather than overwritten, and stays on the roster so the next run reads it the same way, whether or not the running release still ships that path |
358
+ | `artifact` | the gate binary's `target` and its SHA-256 `digest`, or absent | `doctor` reports the target and re-verifies the digest in place; a re-run of `init` compares the target against this host and skips the rewrite while the digest still holds |
359
+
360
+ **A recorded hash is what `init` last wrote at that path** — on whichever run
361
+ last wrote it — and not the state of the tree at the end of the current run. The
362
+ two readings coincide for every path `init` rewrites and part company for exactly
363
+ one class: a path `init` left alone because you had edited it. That path stays in
364
+ `files` at the hash `init` put there, carried forward from the previous manifest
365
+ rather than recomputed, so the next run still has something to compare your
366
+ content against, still finds it different, and still leaves it alone. Editing a
367
+ file changes who may write it; it never changes whether `init` is tracking it.
368
+
369
+ **One entry is a span rather than a file, and it is still an ordinary entry.**
370
+ Everything above reads a `files` row as a whole file `init` wrote. The agent
371
+ file is the exception: `init` creates it only when it is absent, and thereafter
372
+ authors only the marker-bounded doctrine block *inside* it — everything outside
373
+ that span is yours and is never read or rewritten. The row is nonetheless
374
+ whole-file, hashed and compared like every other, and two things follow. Your
375
+ edit **anywhere** in the file marks the entry changed, which is a true report
376
+ rather than a defect. And that report does not stop the span from being
377
+ maintained: the block is injected before the file is claimed, so the doctrine
378
+ block keeps upgrading on every run while the rest of the file stays yours. What
379
+ survives *inside* the span across that rewrite is doctrine-kit's contract rather
380
+ than this installer's — its declared-trim round-trip and the bound on it are
381
+ `doctrine-kit/SPEC.md` §install-doctrine.
382
+
383
+ **A path leaves the roster when the file leaves the tree, and at no other
384
+ moment.** `init` owns a path because it wrote the file there, so only the file's
385
+ disappearance can end that. A release that stops shipping the path does not: the
386
+ file is still on disk, it may carry your edits, and disowning it is exactly what
387
+ would let a later release re-adding the same path write straight through them.
388
+
389
+ **A relinquished path is an ordinary entry, not a state of its own.** When a
390
+ release stops shipping something `init` created, nothing visits that path on the
391
+ run, so it is carried forward at the hash `init` last wrote there — the same
392
+ carry-forward, the same `files` row, the same protection every other entry gets.
393
+ There is no *once ours, now relinquished* state for a reader to learn. Nor can
394
+ the roster grow without bound from it: the existence test is already the reaper,
395
+ so `files` is bounded by the files `init` created that still exist, which is the
396
+ ownership set itself. What `init` never does is delete, so a path no release
397
+ ships any more stays on disk and stays yours to remove.
398
+
399
+ The hash carried forward is the one `init` wrote, not the one this payload would
400
+ have written. Either would protect the file, so protection does not decide it —
401
+ the **revert** does. Restore the file to what `init` put there and it is `init`'s
402
+ to rewrite again, which works only when the recorded hash is what `init` actually
403
+ wrote; recording an intended write would report the path as changed forever and
404
+ would record a write that never happened.
405
+
406
+ That is a change of meaning, not of shape, so the wire key stays
407
+ `checkwright-lock v1`. A reader built before it meets one of these entries, finds
408
+ a hash that disagrees with the tree, and does exactly what it does today: reports
409
+ the file changed and leaves it alone. A retained relinquished entry passes the
410
+ same test even more quietly — that reader's payload does not ship the path, so it
411
+ never asks whether it may write there and does nothing with the entry at all. The
412
+ old behavior on the new data is the behavior the new meaning wants, so there is
413
+ nothing for a version key to protect.
414
+
415
+ A recorded **`files`** hash is `git hash-object`, never `sha256sum`. Not a
416
+ portability detail worth burying: macOS ships `shasum` rather than `sha256sum`,
417
+ and the answer is not a new tool requirement — git is already something the
418
+ toolchain contract asserts, its object hash is content-addressed and stable, so
419
+ the manifest's integrity story stays inside the toolchain that contract already
200
420
  covers.
201
421
 
422
+ **Two hash families, on two classes of file, each stated where it is used.** The
423
+ scope above is exactly `files`, and `artifact` is deliberately outside it. The
424
+ two hashes answer different questions and are not unified. A `files` hash is
425
+ **change detection** — has the adopter edited something `init` wrote — where
426
+ collision resistance is not the property needed and staying inside git's
427
+ already-asserted toolchain is worth more. The artifact's digest is an
428
+ **integrity claim**, published for a reader to cross-check; `git hash-object`
429
+ defaults to SHA-1, and a SHA-1 supply-chain digest would undercut the one claim
430
+ §The gate binary makes.
431
+
432
+ That is also why `artifact` is its own key rather than a `files` row. A `files`
433
+ entry means *hashed with `git hash-object`, rewritten when unmodified*, and this
434
+ one is hashed with SHA-256 against a published value and rewritten on a
435
+ different rule — so a `files` row would put two hash families on one map. The
436
+ uniformity that map is held to is the hash *function* across every entry, which
437
+ is why the argument survives the paragraphs above: it never rested on an entry
438
+ agreeing with the tree. The consumer smoke does assert that agreement entry by
439
+ entry, against a **freshly initialized** consumer, where no adopter edit exists
440
+ for a carried-forward hash to come from. The
441
+ binary is still written by `init` and still tracked. A new optional top-level key
442
+ is additive within the versioned wire key: a reader that does not know it sees
443
+ the same manifest it always did.
444
+
445
+ **The path is absent, and that is not an omission.** The install location has
446
+ exactly one owner — `GATE_SDK_NATIVE_BIN` in your `gate-sdk-config.sh` — and
447
+ that value is what the battery actually dispatches to. A stored copy could
448
+ disagree with the live one, so every reader that wants the path resolves it from
449
+ the same owner.
450
+
202
451
  ## The consumer smoke
203
452
 
204
453
  `consumer-smoke/run-smoke.sh` is the acceptor for everything above, and it is
205
454
  registered as a validate suite so a bit-rotted activation path is a red
206
455
  validate rather than a discovery at announcement.
207
456
 
457
+ **Run it with the current directory inside the tree under test.** The script
458
+ resolves that tree from its own path, while `scripts/pack-installer.sh` — which
459
+ it invokes to build the payload — resolves the tree it packs from the current
460
+ directory. Invoke a clone's copy by path from somewhere else and the two
461
+ disagree silently: the run packs the *invoking* tree and asserts a green
462
+ activation path for source the clone never contributed, printing an ordinary
463
+ success. Use `env -C <clone>` for a second checkout or a worktree. The rule is
464
+ stated as an invocation requirement because that is what it is under either
465
+ resolution of the disagreement: today nothing detects it, and a version that
466
+ refuses on a mismatch would refuse exactly the invocations this sentence tells
467
+ you not to make.
468
+
208
469
  It packs the package, installs it **from the resulting tarball with
209
470
  `--offline`**, and drives a scratch consumer once per profile: `init`, then the
210
471
  battery must be green, then the manifest must agree with the tree it describes
@@ -224,8 +485,8 @@ the largest payload with the widest `doctor` toolchain read. The smoke's
224
485
  preflight still requires `npm` and `node`, because packing needs them; the
225
486
  masking is around this arm's `init` only.
226
487
 
227
- Two arms, two load-bearing properties, neither displacing the other. The
228
- offline tarball install is what turns "this is a one-shot vendoring installer,
488
+ Those transport arms carry two load-bearing properties, neither displacing the
489
+ other. The offline tarball install is what turns "this is a one-shot vendoring installer,
229
490
  not a dependency channel" from a claim into an assertion: a package that
230
491
  installs and runs with no registry access after the fetch is not resolving
231
492
  anything on your behalf. The masked-`PATH` arm is what turns "the Release
@@ -241,9 +502,114 @@ it wherever Node is installed there. The residue is that a payload merely
241
502
  *probing* for a Node binary still finds a name; one that *runs* it fails loudly
242
503
  and says which name it reached.
243
504
 
505
+ **The upgrade arm** drives a cross-version run, because every arm above installs
506
+ at one version and re-runs at that same one. It packs a second tarball a patch
507
+ version higher, installs `starter` from the first, has the adopter edit and
508
+ commit two vendored files, then runs the second package's `init` with no flags at
509
+ all. What only that reaches: the manifest's version comparison falling *through*
510
+ in the upgrade direction rather than refusing, the profile re-read from the
511
+ manifest when none is passed, and `claim()` re-applying the payload around a file
512
+ that has changed since `init` wrote it — left alone, reported, and still the
513
+ adopter's afterwards. The roster is asserted directly rather than only through
514
+ that effect, because two different manifests leave the same intact file on this
515
+ hop and neither survives the next: an entry dropped altogether reads as *never
516
+ installed* on the following run, and an entry recorded at the adopter's own hash
517
+ reads as *unchanged*. Both would let the next `init` claim the path, so both are
518
+ named apart.
519
+
520
+ The second edited file is the **relinquish subject**, and it is what makes the arm
521
+ reach §The manifest's exit rule at all. The pack step assembles every version from
522
+ one worktree, so two hops would otherwise carry byte-identical payloads and no
523
+ path would ever leave a kit's shipped set — the arm therefore deletes that path
524
+ from the *extracted package's own* `payload/` before the hop runs, rather than
525
+ through a flag on the publishing path, which leaves the publisher no way to ship a
526
+ payload with a hole in it. The subject is chosen against a criterion rather than
527
+ by taste: a `starter`-kit payload file `init` records in `files` that no `init`
528
+ step and neither generated projection reads, so dropping it exercises the roster's
529
+ exit condition and nothing else. On this hop the file must be untouched on disk
530
+ and must **still be on the roster at the hash `init` wrote there** — disowning it
531
+ here is exactly what would arm the next release to write through the adopter's
532
+ edits.
533
+
534
+ It then chains a **third** version onto the same consumer with no fresh edit,
535
+ because one hop only shows the protection starting. The second hop is where it
536
+ either persists or inverts, and nothing above reaches it: the already-edited,
537
+ already-reported file must still be the adopter's and must still be reported, and
538
+ the manifest the first hop wrote must still carry it. It is also the hop whose
539
+ payload **re-adds** the relinquished path, which is where the ownership rule pays:
540
+ that path must meet the carried claim, be refused, be reported, and keep `init`'s
541
+ own hash on the roster. Without the exit rule this hop overwrites it silently, so
542
+ the defect is reproduced end to end rather than argued about. Each version is
543
+ derived from the one packed before it and the arm refuses to run unless the
544
+ derivation is strictly higher, so neither hop can quietly turn into a second test
545
+ of the downgrade refusal.
546
+
547
+ **The seam arm** covers the two surfaces `init` rewrites on every run — a
548
+ `templates/*-config.sh` destination and gate-sdk's `msg-patterns.list` — which no
549
+ arm above reaches. That is not an oversight in those arms: the upgrade arm's
550
+ subject is an ordinary vendored file on the plain `copy_in`/`claim` path, so they
551
+ exercise a different file class and stay true without covering this one. This arm
552
+ re-runs at the **same version with no flags**, which is the whole point — the
553
+ class needs no upgrade and no `--force`, so an arm that only ran across versions
554
+ would attribute it to a path it does not live on. It is its own scratch consumer
555
+ at the `delegation` profile: `starter` is gate-sdk alone and gate-sdk ships no
556
+ config template, so the templates are reachable only from `delegation` up, and an
557
+ adopter edit inside the per-profile loop would break the file-by-file agreement
558
+ that loop exists to assert. After the adopter edits and commits both, the re-run
559
+ must leave both byte-identical, name both as changed, and still record `init`'s
560
+ hash for each rather than the adopter's. It reuses the already-installed package,
561
+ so it costs no second pack.
562
+
563
+ **The artifact arm rides the per-profile post-conditions**, taking whichever of
564
+ §The gate binary's outcomes the payload and the host actually produce. Every arm
565
+ above packs with no artifacts, so each takes the **omission** outcome: no binary
566
+ is written, no `artifact` key reaches the manifest, and the members recorded as
567
+ `# omitted:` are exactly the ones the consumer's own vendored tree implements as
568
+ a binary subcommand. That set is derived rather than spelled, which is what keeps
569
+ the assertion alive: a literal would read as green on a tree where nothing has
570
+ ported and stop asserting on the first tree where something has.
571
+
572
+ **The placement branch is exercised by a leg that builds the binary it packs.**
573
+ The arm compiles the crate for the host target, emits the digest sidecar beside
574
+ it, and hands the pair to `pack-installer.sh --artifacts`, so `init` meets a real
575
+ artifact from the real producer. A fabricated stand-in with a matching digest
576
+ would drive the same placement code while leaving the one thing most likely to
577
+ break — the build's own digest agreeing with what `init` verifies before
578
+ writing — covered by nothing. Against that pack the arm asserts the target
579
+ `init` selected against what `rustc` independently reports this host to be, the
580
+ recorded digest against the one the build leg emitted, the binary executable at
581
+ the path the config seam names, and both that path and the seam on the manifest
582
+ roster. It then drives the outcomes a single install cannot show, each against a
583
+ payload mutated in the extracted package rather than through a flag on the
584
+ publishing path: a host **off** the roster omits and declares and exits clean, a
585
+ **tampered** artifact refuses with the consumer's tree object unchanged and no
586
+ manifest written, and a **declared** target whose artifact is gone refuses rather
587
+ than omitting. The last two are what keep the three outcomes of §The gate
588
+ binary's table from collapsing into each other.
589
+
590
+ `pack-installer.sh` gains nothing from this: the **smoke** builds and hands it a
591
+ directory, while the publishing path still never builds, so a locally built
592
+ binary can still never substitute for a released one.
593
+
594
+ *The honest limit, recorded because it is a fact about today's roster rather
595
+ than a property of the design.* A single host build satisfies `--artifacts` only
596
+ while `native/targets.list` declares this host alone — pack refuses a roster
597
+ target no leg built, and refusing is right, because a payload missing a declared
598
+ target is broken rather than narrower. The moment the roster declares a second
599
+ target the arm blocks rather than passing, naming its own re-entry: steer the
600
+ arm's pack at a narrowed roster through `GATE_SDK_NATIVE_TARGETS_FILE`
601
+ (gate-sdk/SPEC.md §Layout and configuration) so the smoke commits to the host
602
+ alone while the published payload still commits to all of them, or give the leg
603
+ a cross-compiling build. Neither is built ahead of the second target.
604
+
244
605
  Its only knob is `INSTALLER_SMOKE_TMP_DIR`, and it writes nothing inside the
245
- worktree. It needs a clean worktree, because the pack step refuses to stamp a
246
- commit the payload does not match.
606
+ worktree: the crate's build output lands in gitignored build space and the
607
+ artifact directory it assembles lives under the smoke's own scratch, so the
608
+ clean-worktree precondition keeps its meaning. It needs that clean worktree,
609
+ because the pack step refuses to stamp a commit the payload does not match. It
610
+ needs `cargo` and `rustc` too, alongside the tools every other arm needs, and
611
+ refuses at the same preflight when either is missing — a machine that cannot
612
+ compile the crate has not falsified the install path.
247
613
 
248
614
  *Why the payload has no gate of its own.* The obvious sibling check would assert
249
615
  that the packed payload matches the repository's kit roots. It is deliberately
@@ -0,0 +1,18 @@
1
+ # shellcheck shell=bash
2
+ # spec: installer/README.md §The gate binary — sourceable owner of the artifact digest mechanism: which hasher this host has and how a SHA-256 is taken with it. Deliberately not lock.sh's, because the two hashes answer different questions — the manifest's git hash-object is change detection over files init wrote, this one is an integrity claim against a value published outside the payload
3
+
4
+ # spec: installer/README.md §The gate binary — sha256sum first, then shasum -a 256, because stock macOS ships the second and not the first; an absent hasher is not a refusal, it is what selects the digest-unverifiable omission
5
+ digest_hasher() { # -> the resolved hasher's name, empty when neither is on PATH
6
+ if command -v sha256sum >/dev/null 2>&1; then
7
+ printf 'sha256sum'
8
+ elif command -v shasum >/dev/null 2>&1; then
9
+ printf 'shasum'
10
+ fi
11
+ }
12
+
13
+ digest_of() { # $1 = file -> its SHA-256 in hex, empty when no hasher resolved
14
+ case "$(digest_hasher)" in
15
+ sha256sum) sha256sum -- "$1" 2>/dev/null | cut -d' ' -f1 ;;
16
+ shasum) shasum -a 256 -- "$1" 2>/dev/null | cut -d' ' -f1 ;;
17
+ esac
18
+ }
@@ -26,3 +26,14 @@ lock_field() { # $1 = manifest path, $2 = field name -> its value, arrays spac
26
26
  lock_hash() { # $1 = file -> the content hash a files[] entry records
27
27
  git hash-object -- "$1"
28
28
  }
29
+
30
+ # spec: installer/README.md §The manifest — resolve one of the consumer's *own* seam files out of files[]. A bare suffix match is not a resolver: the vendored kits carry fixture trees with their own scripts/gates.list and scripts/gate-sdk-config.sh, so matching on the tail alone picks whichever sorts first — a fixture, not the tree's real seam. The recorded kit set is what excludes them, and it is the same predicate init writes with
31
+ lock_own_file() { # $1 = manifest path, $2 = path suffix -> the consumer's own matching path, empty when none
32
+ jq -r --arg sfx "$2" '
33
+ (.kits // []) as $k
34
+ | (.files // {} | keys)
35
+ | map(select(endswith($sfx)))
36
+ | map(select(. as $p | ($k | any(. as $kit | $p | startswith($kit + "/"))) | not))
37
+ | first // ""
38
+ ' "$1" 2>/dev/null
39
+ }
@@ -1,15 +1,13 @@
1
1
  # shellcheck shell=bash
2
- # spec: installer/README.md §What init seeds — sourceable owner of the per-kit install recipe: the starting gate roster a kit registers in a fresh consumer, and the seam surfaces it needs before those gates can run. Every function here prints one repo-relative path per file it wrote, which is what the manifest's files[] is built from
2
+ # spec: installer/README.md §What init seeds — sourceable owner of the per-kit install recipe: the starting gate roster a kit registers in a fresh consumer, and the seam surfaces it needs before those gates can run. Two output channels, and the difference is who writes the file: a bare repo-relative path is one this module seeded itself and init need only claim for the roster, while a '<src>\t<dest>' pair is a plan init performs through copy_in. Both feed the manifest's files[]
3
3
 
4
- # spec: installer/README.md §What init seeds — the config seam is derived, never listed: a kit's consumer config is whatever `templates/*-config.sh` it ships, and the destination is always the gates dir under the file's own name
5
- recipe_config_seam() { # $1 = kit payload dir, $2 = consumer root, $3 = gates dir
6
- local t base dest
4
+ # spec: installer/README.md §What init seeds — the config seam is derived, never listed: a kit's consumer config is whatever `templates/*-config.sh` it ships, and the destination is always the gates dir under the file's own name. It plans and writes nothing, because the seam is rewritten on every run and is the file class whose whole purpose is to be edited: a copy landing before claim() hashes the tree destroys the very evidence the refusal is computed from, so the write belongs to copy_in
5
+ recipe_config_seam_plan() { # $1 = kit payload dir, $2 = gates dir -> one '<src><TAB><dest>' line per config template
6
+ local t base
7
7
  shopt -s nullglob
8
8
  for t in "$1"/templates/*-config.sh; do
9
9
  base="${t##*/}"
10
- dest="$3/$base"
11
- cp "$t" "$2/$dest" || return 1
12
- printf '%s\n' "$dest"
10
+ printf '%s\t%s/%s\n' "$t" "$2" "$base"
13
11
  done
14
12
  shopt -u nullglob
15
13
  }
@@ -45,8 +43,8 @@ recipe_needs_agent_file() { # $1 = kit name -> 0 iff one of its starting gates
45
43
  case "$1" in context-kit|doctrine-kit) return 0 ;; *) return 1 ;; esac
46
44
  }
47
45
 
48
- # spec: installer/README.md §What init seeds — a seam surface is written only when it is absent: init owns what it created, never what the adopter authored, which is what keeps a re-run non-destructive on a tree that has grown since
49
- recipe_seed() { # $1 = kit name, $2 = kit payload dir, $3 = consumer root, $4 = queue file
46
+ # spec: installer/README.md §What init seeds — seed what is absent, plan what must be claimed. A surface init creates once and then leaves alone is written here only when it is absent, which is what keeps a re-run non-destructive on a tree that has grown since; a surface init rewrites on every run is never written here at all but planned for copy_in, because only claim() can compare the adopter's content before the overwrite lands. The two disciplines are not interchangeable and each arm below takes the one its surface needs
47
+ recipe_seed() { # $1 = kit name, $2 = kit payload dir, $3 = consumer root, $4 = queue file; prints seeded paths and '<src><TAB><dest>' plans
50
48
  local kit="$1" pay="$2" root="$3" queue="$4"
51
49
 
52
50
  if recipe_needs_queue "$kit" && [[ ! -f "$root/$queue" ]]; then
@@ -63,8 +61,7 @@ recipe_seed() { # $1 = kit name, $2 = kit payload dir, $3 = consumer root, $4
63
61
  case "$kit" in
64
62
  gate-sdk)
65
63
  [[ -f "$pay/templates/msg-patterns.list" ]] || return 0
66
- cp "$pay/templates/msg-patterns.list" "$root/$GATES_DIR/msg-patterns.list" || return 1
67
- printf '%s\n' "$GATES_DIR/msg-patterns.list" ;;
64
+ printf '%s\t%s/msg-patterns.list\n' "$pay/templates/msg-patterns.list" "$GATES_DIR" ;;
68
65
  evidence-kit)
69
66
  mkdir -p "$root/.workflow" || return 1
70
67
  if [[ ! -f "$root/.workflow/validate-baseline.txt" ]]; then
package/lib/doctor.sh CHANGED
@@ -28,6 +28,8 @@ esac
28
28
  source "$FLOOR"
29
29
  # shellcheck source=./common/lock.sh
30
30
  source "$INSTALLER/lib/common/lock.sh"
31
+ # shellcheck source=./common/digest.sh
32
+ source "$INSTALLER/lib/common/digest.sh"
31
33
 
32
34
  # spec: context-kit/SPEC.md §bin/env-probe — both version probes read from /dev/null, and `-V` is only the fallback: a tool rejecting `--version` would otherwise reach a `-V` that reads inherited stdin and hangs
33
35
  probe_banner() { # $1 = tool -> its raw version banner, empty when the tool is absent
@@ -53,6 +55,7 @@ render() { # $1 = tool, $2 = verdict words -> one report line; sets FAILED whe
53
55
  }
54
56
 
55
57
  FAILED=0
58
+ ARTIFACT_FINDING=""
56
59
  printf 'toolchain\n'
57
60
  for elem in "${PROBE_SET[@]}"; do
58
61
  tool_floor_parse "$elem"
@@ -79,6 +82,46 @@ else
79
82
  printf ' %-12s %s\n' commit "$(lock_field "$LOCK" commit)"
80
83
  printf ' %-12s %s\n' profile "$(lock_field "$LOCK" profile)"
81
84
  printf ' %-12s %s\n' kits "$(lock_field "$LOCK" kits)"
85
+
86
+ # spec: installer/README.md §The gate binary — the recorded digest's second reader: re-verifying the binary in place is the only thing standing between a consumer and one swapped after install, and the path is resolved from the knob that owns it rather than from a copy the manifest would otherwise have to store
87
+ artifact_target="$(jq -r '.artifact.target // ""' "$LOCK" 2>/dev/null)"
88
+ artifact_digest="$(jq -r '.artifact.digest // ""' "$LOCK" 2>/dev/null)"
89
+ if [[ -n "$artifact_target" ]]; then
90
+ seam="$(lock_own_file "$LOCK" /gate-sdk-config.sh)"
91
+ bin=""
92
+ [[ -n "$seam" && -f "$ROOT/$seam" ]] \
93
+ && bin="$(sed -n 's/^GATE_SDK_NATIVE_BIN=//p' "$ROOT/$seam" | head -n1)"
94
+ # spec: installer/README.md §doctor — an artifact finding reports without setting the verdict, and that is deliberate rather than lenient: the exit status is the toolchain contract init gates on, so failing it here would block the re-run that is this finding's own remedy
95
+ if [[ -z "$bin" || ! -f "$ROOT/$bin" ]]; then
96
+ printf ' %-12s %s — recorded, but nothing at the path GATE_SDK_NATIVE_BIN names; re-run init\n' \
97
+ artifact "$artifact_target"
98
+ ARTIFACT_FINDING="the recorded gate binary is not on disk"
99
+ elif [[ "$(digest_of "$ROOT/$bin")" == "$artifact_digest" ]]; then
100
+ printf ' %-12s %s (verified in place)\n' artifact "$artifact_target"
101
+ else
102
+ printf ' %-12s %s — DIGEST MISMATCH, %s differs from what init wrote; re-run init\n' \
103
+ artifact "$artifact_target" "$bin"
104
+ ARTIFACT_FINDING="the installed gate binary does not match its recorded digest"
105
+ fi
106
+ fi
107
+
108
+ # spec: installer/README.md §The gate binary — the omitted-member record's second reader, reported against the reason that caused it because a remedy is what an adopter comes here for
109
+ list="$(lock_own_file "$LOCK" /gates.list)"
110
+ if [[ -n "$list" && -f "$ROOT/$list" ]]; then
111
+ while read -r count reason; do
112
+ [[ -n "$reason" ]] || continue
113
+ case "$reason" in
114
+ substrate-unavailable)
115
+ printf ' %-12s %d gate(s), %s — no prebuilt binary is published for this platform\n' \
116
+ omitted "$count" "$reason" ;;
117
+ digest-unverifiable)
118
+ printf ' %-12s %d gate(s), %s — install sha256sum or shasum, then re-run init\n' \
119
+ omitted "$count" "$reason" ;;
120
+ *)
121
+ printf ' %-12s %d gate(s), %s\n' omitted "$count" "$reason" ;;
122
+ esac
123
+ done < <(awk '$1 == "#" && $2 == "omitted:" { print $4 }' "$ROOT/$list" | sort | uniq -c)
124
+ fi
82
125
  fi
83
126
 
84
127
  if (( FAILED )); then
@@ -86,5 +129,11 @@ if (( FAILED )); then
86
129
  printf ' help: install or upgrade each tool reported above; the floors are the ones the gate battery needs to run, not preferences.\n'
87
130
  exit 1
88
131
  fi
132
+ # spec: installer/README.md §doctor — the verdict line names an artifact finding rather than swallowing it: the exit status stays the toolchain contract, but a run that reported a digest mismatch must not sign off as plainly clean
133
+ if [[ -n "$ARTIFACT_FINDING" ]]; then
134
+ printf '\nDOCTOR: toolchain clean, 1 artifact finding — %s\n' "$ARTIFACT_FINDING"
135
+ printf ' help: re-run init; it re-verifies the published digest and rewrites the binary.\n'
136
+ exit 0
137
+ fi
89
138
  printf '\nDOCTOR: clean\n'
90
139
  exit 0