@gate-forge/cli 0.7.0 → 0.8.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 (254) hide show
  1. package/README.md +511 -51
  2. package/dist/adapter-audit.d.ts +154 -0
  3. package/dist/adapter-audit.d.ts.map +1 -0
  4. package/dist/adapter-audit.js +531 -0
  5. package/dist/adapter-audit.js.map +1 -0
  6. package/dist/adapter-scaffold.d.ts +66 -0
  7. package/dist/adapter-scaffold.d.ts.map +1 -0
  8. package/dist/adapter-scaffold.js +353 -0
  9. package/dist/adapter-scaffold.js.map +1 -0
  10. package/dist/adopted-baseline.d.ts +10 -0
  11. package/dist/adopted-baseline.d.ts.map +1 -1
  12. package/dist/adopted-baseline.js +18 -1
  13. package/dist/adopted-baseline.js.map +1 -1
  14. package/dist/args.d.ts +15 -0
  15. package/dist/args.d.ts.map +1 -1
  16. package/dist/args.js +59 -2
  17. package/dist/args.js.map +1 -1
  18. package/dist/behavior-setup.d.ts +239 -0
  19. package/dist/behavior-setup.d.ts.map +1 -0
  20. package/dist/behavior-setup.js +738 -0
  21. package/dist/behavior-setup.js.map +1 -0
  22. package/dist/broker.d.ts.map +1 -1
  23. package/dist/broker.js +28 -2
  24. package/dist/broker.js.map +1 -1
  25. package/dist/cache-exclusions.d.ts +45 -0
  26. package/dist/cache-exclusions.d.ts.map +1 -0
  27. package/dist/cache-exclusions.js +205 -0
  28. package/dist/cache-exclusions.js.map +1 -0
  29. package/dist/candidate-tree.d.ts +86 -14
  30. package/dist/candidate-tree.d.ts.map +1 -1
  31. package/dist/candidate-tree.js +236 -62
  32. package/dist/candidate-tree.js.map +1 -1
  33. package/dist/ci-witnessed-template.d.ts +43 -0
  34. package/dist/ci-witnessed-template.d.ts.map +1 -0
  35. package/dist/ci-witnessed-template.js +283 -0
  36. package/dist/ci-witnessed-template.js.map +1 -0
  37. package/dist/cli.d.ts +1 -1
  38. package/dist/cli.d.ts.map +1 -1
  39. package/dist/cli.js +31 -4
  40. package/dist/cli.js.map +1 -1
  41. package/dist/commands/adapters.d.ts +15 -0
  42. package/dist/commands/adapters.d.ts.map +1 -0
  43. package/dist/commands/adapters.js +284 -0
  44. package/dist/commands/adapters.js.map +1 -0
  45. package/dist/commands/adopt.d.ts.map +1 -1
  46. package/dist/commands/adopt.js +9 -1
  47. package/dist/commands/adopt.js.map +1 -1
  48. package/dist/commands/baseline.d.ts.map +1 -1
  49. package/dist/commands/baseline.js +42 -1
  50. package/dist/commands/baseline.js.map +1 -1
  51. package/dist/commands/blocking.d.ts +81 -2
  52. package/dist/commands/blocking.d.ts.map +1 -1
  53. package/dist/commands/blocking.js +336 -53
  54. package/dist/commands/blocking.js.map +1 -1
  55. package/dist/commands/check.d.ts +36 -0
  56. package/dist/commands/check.d.ts.map +1 -1
  57. package/dist/commands/check.js +1008 -62
  58. package/dist/commands/check.js.map +1 -1
  59. package/dist/commands/classify.d.ts +2 -1
  60. package/dist/commands/classify.d.ts.map +1 -1
  61. package/dist/commands/classify.js +143 -5
  62. package/dist/commands/classify.js.map +1 -1
  63. package/dist/commands/enforce.d.ts +4 -4
  64. package/dist/commands/enforce.d.ts.map +1 -1
  65. package/dist/commands/enforce.js +41 -9
  66. package/dist/commands/enforce.js.map +1 -1
  67. package/dist/commands/enforcement.d.ts +13 -1
  68. package/dist/commands/enforcement.d.ts.map +1 -1
  69. package/dist/commands/enforcement.js +800 -30
  70. package/dist/commands/enforcement.js.map +1 -1
  71. package/dist/commands/history.d.ts +12 -0
  72. package/dist/commands/history.d.ts.map +1 -0
  73. package/dist/commands/history.js +45 -0
  74. package/dist/commands/history.js.map +1 -0
  75. package/dist/commands/init-presets.d.ts +148 -0
  76. package/dist/commands/init-presets.d.ts.map +1 -0
  77. package/dist/commands/init-presets.js +194 -0
  78. package/dist/commands/init-presets.js.map +1 -0
  79. package/dist/commands/init.d.ts +7 -12
  80. package/dist/commands/init.d.ts.map +1 -1
  81. package/dist/commands/init.js +610 -69
  82. package/dist/commands/init.js.map +1 -1
  83. package/dist/commands/keys.d.ts.map +1 -1
  84. package/dist/commands/keys.js +29 -13
  85. package/dist/commands/keys.js.map +1 -1
  86. package/dist/commands/next.d.ts.map +1 -1
  87. package/dist/commands/next.js +744 -15
  88. package/dist/commands/next.js.map +1 -1
  89. package/dist/commands/pre-commit.d.ts +25 -0
  90. package/dist/commands/pre-commit.d.ts.map +1 -1
  91. package/dist/commands/pre-commit.js +91 -6
  92. package/dist/commands/pre-commit.js.map +1 -1
  93. package/dist/commands/quarantine.d.ts +16 -0
  94. package/dist/commands/quarantine.d.ts.map +1 -0
  95. package/dist/commands/quarantine.js +213 -0
  96. package/dist/commands/quarantine.js.map +1 -0
  97. package/dist/commands/run.d.ts +39 -0
  98. package/dist/commands/run.d.ts.map +1 -0
  99. package/dist/commands/run.js +196 -0
  100. package/dist/commands/run.js.map +1 -0
  101. package/dist/commands/test-gates.d.ts +284 -2
  102. package/dist/commands/test-gates.d.ts.map +1 -1
  103. package/dist/commands/test-gates.js +3619 -186
  104. package/dist/commands/test-gates.js.map +1 -1
  105. package/dist/commands/tests.d.ts +1 -1
  106. package/dist/commands/tests.d.ts.map +1 -1
  107. package/dist/commands/tests.js +225 -22
  108. package/dist/commands/tests.js.map +1 -1
  109. package/dist/endpoint-compiler.d.ts.map +1 -1
  110. package/dist/endpoint-compiler.js +29 -8
  111. package/dist/endpoint-compiler.js.map +1 -1
  112. package/dist/engine-browser.d.ts +183 -0
  113. package/dist/engine-browser.d.ts.map +1 -0
  114. package/dist/engine-browser.js +381 -0
  115. package/dist/engine-browser.js.map +1 -0
  116. package/dist/engine-identity.d.ts +100 -0
  117. package/dist/engine-identity.d.ts.map +1 -0
  118. package/dist/engine-identity.js +182 -0
  119. package/dist/engine-identity.js.map +1 -0
  120. package/dist/evaluate.d.ts +89 -0
  121. package/dist/evaluate.d.ts.map +1 -1
  122. package/dist/evaluate.js +137 -16
  123. package/dist/evaluate.js.map +1 -1
  124. package/dist/execution.d.ts +253 -9
  125. package/dist/execution.d.ts.map +1 -1
  126. package/dist/execution.js +309 -12
  127. package/dist/execution.js.map +1 -1
  128. package/dist/git-hooks.d.ts +17 -0
  129. package/dist/git-hooks.d.ts.map +1 -1
  130. package/dist/git-hooks.js +119 -0
  131. package/dist/git-hooks.js.map +1 -1
  132. package/dist/git-objects.d.ts +60 -0
  133. package/dist/git-objects.d.ts.map +1 -0
  134. package/dist/git-objects.js +152 -0
  135. package/dist/git-objects.js.map +1 -0
  136. package/dist/history.d.ts +52 -0
  137. package/dist/history.d.ts.map +1 -0
  138. package/dist/history.js +116 -0
  139. package/dist/history.js.map +1 -0
  140. package/dist/host-load.d.ts +49 -0
  141. package/dist/host-load.d.ts.map +1 -0
  142. package/dist/host-load.js +78 -0
  143. package/dist/host-load.js.map +1 -0
  144. package/dist/input-snapshot.d.ts +63 -9
  145. package/dist/input-snapshot.d.ts.map +1 -1
  146. package/dist/input-snapshot.js +195 -17
  147. package/dist/input-snapshot.js.map +1 -1
  148. package/dist/io.d.ts +36 -0
  149. package/dist/io.d.ts.map +1 -1
  150. package/dist/io.js +21 -0
  151. package/dist/io.js.map +1 -1
  152. package/dist/mapping.d.ts +84 -1
  153. package/dist/mapping.d.ts.map +1 -1
  154. package/dist/mapping.js +276 -5
  155. package/dist/mapping.js.map +1 -1
  156. package/dist/native-freeze.d.ts +217 -0
  157. package/dist/native-freeze.d.ts.map +1 -0
  158. package/dist/native-freeze.js +332 -0
  159. package/dist/native-freeze.js.map +1 -0
  160. package/dist/pipeline.d.ts +52 -1
  161. package/dist/pipeline.d.ts.map +1 -1
  162. package/dist/pipeline.js +141 -3
  163. package/dist/pipeline.js.map +1 -1
  164. package/dist/playwright-browsers.d.ts +210 -0
  165. package/dist/playwright-browsers.d.ts.map +1 -0
  166. package/dist/playwright-browsers.js +364 -0
  167. package/dist/playwright-browsers.js.map +1 -0
  168. package/dist/plugins.d.ts +15 -5
  169. package/dist/plugins.d.ts.map +1 -1
  170. package/dist/plugins.js +59 -9
  171. package/dist/plugins.js.map +1 -1
  172. package/dist/progress.d.ts +148 -0
  173. package/dist/progress.d.ts.map +1 -0
  174. package/dist/progress.js +263 -0
  175. package/dist/progress.js.map +1 -0
  176. package/dist/providers.d.ts +26 -1
  177. package/dist/providers.d.ts.map +1 -1
  178. package/dist/providers.js +39 -0
  179. package/dist/providers.js.map +1 -1
  180. package/dist/receipts.d.ts +1 -0
  181. package/dist/receipts.d.ts.map +1 -1
  182. package/dist/receipts.js +35 -7
  183. package/dist/receipts.js.map +1 -1
  184. package/dist/repo-scan.d.ts +8 -1
  185. package/dist/repo-scan.d.ts.map +1 -1
  186. package/dist/repo-scan.js +221 -27
  187. package/dist/repo-scan.js.map +1 -1
  188. package/dist/reseal-chain.d.ts +184 -0
  189. package/dist/reseal-chain.d.ts.map +1 -0
  190. package/dist/reseal-chain.js +735 -0
  191. package/dist/reseal-chain.js.map +1 -0
  192. package/dist/reseal-evidence.d.ts +241 -0
  193. package/dist/reseal-evidence.d.ts.map +1 -0
  194. package/dist/reseal-evidence.js +319 -0
  195. package/dist/reseal-evidence.js.map +1 -0
  196. package/dist/reseal.d.ts +181 -0
  197. package/dist/reseal.d.ts.map +1 -0
  198. package/dist/reseal.js +1620 -0
  199. package/dist/reseal.js.map +1 -0
  200. package/dist/response-field-guidance.d.ts +82 -0
  201. package/dist/response-field-guidance.d.ts.map +1 -0
  202. package/dist/response-field-guidance.js +184 -0
  203. package/dist/response-field-guidance.js.map +1 -0
  204. package/dist/run-cache.d.ts +260 -0
  205. package/dist/run-cache.d.ts.map +1 -0
  206. package/dist/run-cache.js +771 -0
  207. package/dist/run-cache.js.map +1 -0
  208. package/dist/run-preflight.d.ts +77 -0
  209. package/dist/run-preflight.d.ts.map +1 -0
  210. package/dist/run-preflight.js +774 -0
  211. package/dist/run-preflight.js.map +1 -0
  212. package/dist/run-recipe.d.ts +107 -0
  213. package/dist/run-recipe.d.ts.map +1 -0
  214. package/dist/run-recipe.js +295 -0
  215. package/dist/run-recipe.js.map +1 -0
  216. package/dist/run-reliability.d.ts +126 -0
  217. package/dist/run-reliability.d.ts.map +1 -0
  218. package/dist/run-reliability.js +221 -0
  219. package/dist/run-reliability.js.map +1 -0
  220. package/dist/runtime.d.ts +15 -0
  221. package/dist/runtime.d.ts.map +1 -1
  222. package/dist/runtime.js +11 -1
  223. package/dist/runtime.js.map +1 -1
  224. package/dist/secret-guard.d.ts +36 -0
  225. package/dist/secret-guard.d.ts.map +1 -0
  226. package/dist/secret-guard.js +63 -0
  227. package/dist/secret-guard.js.map +1 -0
  228. package/dist/singleton-guidance.d.ts +73 -0
  229. package/dist/singleton-guidance.d.ts.map +1 -0
  230. package/dist/singleton-guidance.js +118 -0
  231. package/dist/singleton-guidance.js.map +1 -0
  232. package/dist/staged-candidate.d.ts +17 -0
  233. package/dist/staged-candidate.d.ts.map +1 -1
  234. package/dist/staged-candidate.js +50 -0
  235. package/dist/staged-candidate.js.map +1 -1
  236. package/dist/state-artifacts.d.ts +70 -0
  237. package/dist/state-artifacts.d.ts.map +1 -0
  238. package/dist/state-artifacts.js +215 -0
  239. package/dist/state-artifacts.js.map +1 -0
  240. package/dist/state.d.ts +170 -2
  241. package/dist/state.d.ts.map +1 -1
  242. package/dist/state.js +248 -8
  243. package/dist/state.js.map +1 -1
  244. package/dist/verifier-keys.d.ts +33 -2
  245. package/dist/verifier-keys.d.ts.map +1 -1
  246. package/dist/verifier-keys.js +95 -9
  247. package/dist/verifier-keys.js.map +1 -1
  248. package/guides/CONNECT-YOUR-PROJECT.md +367 -0
  249. package/guides/QUICKSTART.md +404 -0
  250. package/guides/RUNNER-NEUTRAL-EVIDENCE.md +199 -0
  251. package/guides/TEST-ENVIRONMENT.md +1226 -0
  252. package/guides/UPGRADE-0.6-to-0.7.md +65 -0
  253. package/guides/UPGRADE-0.7-to-0.8.md +114 -0
  254. package/package.json +12 -10
package/README.md CHANGED
@@ -4,7 +4,17 @@ The gateforge command-line interface: initialize a project, discover
4
4
  resources and classification signals, inspect automatic decisions, reuse a
5
5
  repository's existing tests, evaluate obligations, run the supervised E2E
6
6
  gate, enforce the exact staged candidate, and maintain baselines.
7
- **0.7.0 vs. published 0.6.3:** external key ring, owner-approved docs exclusions, result-only runs, surface-doctor, protocol-based package-compatibility guard, diagnostic context, trusted `baseURL`/`storageState`, and the shared-dist spool race fix.
7
+ **0.8.0 vs. published 0.7.1:** one-command local proof (`gateforge run`), witnessed single tests (`--test`), test-only re-seal, owner-chosen strictness and quarantine, a strict run preflight in the doctor, CI progress stream and witnessed CI templates, adapter kit and scaffold, an engine-owned queue observer for `task` cases, timing chaos and twin path coverage. Upgrading: [UPGRADE-0.7-to-0.8](guides/UPGRADE-0.7-to-0.8.md).
8
+
9
+ ## Start here
10
+
11
+ - [Quickstart](guides/QUICKSTART.md)
12
+ - [Test environment](guides/TEST-ENVIRONMENT.md)
13
+ - [Upgrade from 0.7 to 0.8](guides/UPGRADE-0.7-to-0.8.md)
14
+ - [Upgrade from 0.6 to 0.7](guides/UPGRADE-0.6-to-0.7.md)
15
+ - [Runners other than Playwright](guides/RUNNER-NEUTRAL-EVIDENCE.md)
16
+
17
+ Also at https://github.com/umiddey/gateforge/tree/main/packages/cli/guides.
8
18
 
9
19
  Just added a new table or endpoint and the gate is blocking? Run
10
20
  `gateforge next` (or `gateforge next --json`) — it prints the ONE blocking
@@ -32,28 +42,53 @@ never rewrite existing journeys, never `tests mark` as proof.
32
42
  - **`tests mark` is intent, never proof.** A mapped test with no
33
43
  witnessed evidence grades `EVIDENCE_NOT_COLLECTED` — blocking.
34
44
 
45
+ ## What the gate catches that green mocks do not
46
+
47
+ - A test can intercept a request and return a complete response while the
48
+ real server drops a field. A mocked-only test is not evidence that the
49
+ server sends it.
50
+ - A UI action can look successful while the witness sees only a timestamp
51
+ change; an update obligation still needs a change to a classified
52
+ updateable field.
53
+ - A mocked route can hide a handler that never receives real traffic. The
54
+ gate needs a witnessed request and the resulting state, not a mock's
55
+ answer.
56
+
35
57
  ## Commands
36
58
 
37
59
  | Command | Purpose | Exit codes |
38
60
  | --- | --- | --- |
39
- | `gateforge init [--languages <comma,list>] [--plugins <comma,list>] [--accept-recommended] [--no-scan] [--proof overlay\|observe] [--blocking] [--strict-e2e] [--docs-exclude <folder,...>] [--confirm-doc-exclusions]` | Scan the repo (heuristics, no network), print the recommended install (plugins, persistence-only policy, overlay proof), and write the standard Gateforge scaffold. Idempotent — never overwrites existing files unless `--confirm-doc-exclusions` approves an exclusion update. `pack-task` is opt-in only (`--plugins`); `--proof observe` skips the overlay scaffold and prints the observe wiring checklist instead. Default language: `python`. `--strict-e2e` writes the `enforcement` block and refuses unavailable required proof channels. | 0/1/2 |
40
- | `gateforge next [--changed] [--json]` | Print the ONE blocking next action (`next`/`cause`/`why`/`do`; `--json` adds `remainingBlocking`). Navigation, not the gate: never requires an E2E receipt. Exit 0 clean, 1 next action, 2 config/usage. | 0/1/2 |
61
+ | `gateforge init [--preset light\|normal\|strict] [--explain-presets] [--languages <comma,list>] [--plugins <comma,list>] [--accept-recommended] [--no-scan] [--proof overlay\|observe] [--blocking] [--no-blocking] [--pre-commit] [--no-pre-commit] [--ci] [--no-ci] [--planes] [--no-planes] [--strict-e2e] [--docs-exclude <folder,...>] [--confirm-doc-exclusions]` | Scan the repo (heuristics, no network), print the recommended install (plugins, persistence policy, transport-only HTTP policy for consumed endpoints, overlay proof), and write the standard Gateforge scaffold. Idempotent — never overwrites existing files unless `--confirm-doc-exclusions` approves an exclusion update. `pack-task` is opt-in only (`--plugins`); `--proof observe` skips the overlay scaffold and prints the observe wiring checklist instead. Default language: `python`. `--preset` applies one goal in one step (`light` -> `mode: warn`, no hooks; `normal` -> `mode: changed` + pre-commit hook + CI job; `strict` -> `mode: strict` + staged gate + pre-push receipt check + CI job) and prints what it wrote plus an `undo:` line; `--explain-presets` prints that mapping and writes nothing. In a terminal init asks the same question instead; with no terminal and no `--preset` it writes `light` only and says so on one line with the `--preset` flag that changes it. The negative forms (`--no-blocking`, `--no-pre-commit`, `--no-ci`, `--no-planes`) answer the matching question without a prompt. A preset never writes a waiver, an adopted baseline or a plane rule, and an existing `.gateforge.yml` is never rewritten. `--strict-e2e` writes the `enforcement` block and refuses unavailable required proof channels. | 0/1/2 |
62
+
63
+
64
+
65
+ | `gateforge next [--changed] [--json]` | Print the ONE blocking next action (`next`/`cause`/`why`/`do`; `--json` adds `remainingBlocking` and route-specific `guidance` when relevant). For an endpoint with no plane, ask which boundary owns its data and show the owner-reviewed choices; internality remains owner-only. Navigation, not the gate: never requires an E2E receipt. Exit 0 clean, 1 next action, 2 config/usage. | 0/1/2 |
41
66
  | `gateforge discover [--json]` | Run every configured detector over the expanded `project.paths` and dump the resource graph (default: human listing; `--json`: GF-canonical JSON). | 0 |
42
- | `gateforge classify [--json] [--write-snapshot <path>]` | Recompute effective classifications from detector signals and print decisions, traces, and typed blocks. Snapshots are derived review artifacts and never pipeline input. | 0/1/2 |
67
+ | `gateforge classify [--json] [--write-snapshot <path>]` | Recompute effective classifications from detector signals and print decisions, traces, and typed blocks. `classify plane` previews or explicitly appends an owner-reviewed endpoint plane rule to the existing `.gateforge/planes.json`; snapshots are derived review artifacts and never pipeline input. | 0/1/2 |
43
68
  | `gateforge explain <resourceId> [--json]` | Show one resource's detector signals, classification rules, decision fingerprint, typed blocks, and generated obligations. | 0/1/2 |
44
- | `gateforge tests discover [--json] [--pytest]` | Inventory existing tests into the derived run-state catalog: static analysis reconciled with native Playwright enumeration (`--list`). Unresolved wrappers, parse errors, and inventory gaps are DATA (never an empty catalog — failed native enumeration is exit 2). `--pytest` additionally collects the configured diagnostic suites' node ids (`--collect-only`). | 0/2 |
45
- | `gateforge tests suggest [--changed] [--json]` | Resolve mappings for the run's obligations and produce reuse-ordered existing-test candidates with typed causes (`TEST_MAPPING_MISSING` / `TEST_KIND_UNKNOWN` / `TEST_MAPPING_AMBIGUOUS` / `TEST_MAPPING_STALE`) and a `newTestNeeded` verdict per obligation. An inspection surface, NOT a gate: exit 0 even with blocking mapping problems. | 0/2 |
69
+ | `gateforge tests discover [--json] [--pytest]` | Inventory existing tests into the derived run-state catalog: static analysis reconciled with native Playwright enumeration (`--list`). Unresolved wrappers, parse errors, and inventory gaps are DATA (never an empty catalog — failed native enumeration is exit 2). `--pytest` additionally collects the configured diagnostic suites' node ids (`--collect-only`). Playwright enumeration runs ONE config (a repo-root config wins; otherwise the alphabetically first config one directory deep), and when the repo holds more than one the runner line names every config, the one used, why, and the ones NOT inventoried. `inventoryComplete=false` means a reconciliation gap (an enumerated-vs-static mismatch, an unresolved case, or a not-inventoried extra config), not a partial success. | 0/2 |
70
+ | `gateforge tests suggest [--changed] [--json]` | Resolve mappings for the run's obligations and produce reuse-ordered existing-test candidates with typed causes (`TEST_MAPPING_MISSING` / `TEST_KIND_UNKNOWN` / `TEST_MAPPING_AMBIGUOUS` / `TEST_MAPPING_STALE`). When Playwright reports load errors and enumerates no tests, report one `TEST_INVENTORY_INCOMPLETE` with the error count and first error instead of stale-mapping fan-out; the action is to install the missing dependency and rerun Gateforge. An inspection surface, NOT a gate: exit 0 even with blocking problems. | 0/2 |
46
71
  | `gateforge tests mark --test <key> --kind <kind> [--category <c>]... --obligation <id>... --reason "<text>"` | Declare an existing test in `.gateforge/test-map.yml` (see the test-reuse workflow below). Validates against the CURRENT catalog and obligation registry, writes atomically and idempotently, prints the exact diff. Never edits test files, never adds waivers, refuses contradictions. | 0/2 |
72
+ | `gateforge tests sync [--json]` | AST-only scan of test annotations; updates generated `source: annotation` entries in `.gateforge/test-map.yml` and leaves handwritten entries unchanged. Reports unresolved helpers with source locations; does not run tests. | 0/1/2 |
47
73
  | `gateforge tests explain --test <key> [--json]` | Per-test report: requirements, existing-test identity, mapping origin, honest execution status, next action, `New test needed`. | 0/2 (unknown key → 2) |
48
74
  | `gateforge tests diagnose [--suite <name>] [--json]` | Run the configured pytest diagnostic suites once per suite, isolated (own process, `GATEFORGE_*` stripped, finite timeout). Advisory: exit 0 completed run (≥1 pass, no unexpected failures), 1 test failures, 2 unavailable/incomplete (collection error, timeout, missing interpreter, interruption, zero tests, or only skipped/xfail). Never E2E proof. | 0/1/2 |
49
75
  | `gateforge obligations [--json]` | Evaluate policies against the automatically classified graph and dump obligations, blocking entries, and claim assessments. | 0/1/2 |
50
- | `gateforge check [--changed] [--staged] [--require-e2e] [--format text\|json\|sarif]` | The full gate: discover → classify → obligations → claims → verdicts → report. `--changed` evaluates one effective scope: only obligations/blockers tied to files the resolved diff provider reports — unless the diff touches a gate-defining input (`.gateforge.yml`, configured policy/classification paths, planes/http-clients/fastapi configs, adapters, waivers, repo-local plugin modules, dependency manifests/lockfiles, ignore controls), a test file or helper, the runner configuration, or the mapping sidecar, which expands the run to all obligations (reported as `scope` metadata with `expandedBecause` reasons). `--staged` gates the EXACT staged candidate (frozen index checkout, never the worktree; mutually exclusive with `--changed`). `--require-e2e` blocks without a valid, non-stale gate receipt (see Enforcement). `--format` default `text`. Verifier keys use `GATEFORGE_WITNESS_VERIFIER_KEY` or `GATEFORGE_WITNESS_VERIFIER_KEY_FILE` (see trust model). | 0 clean/waived, 1 unresolved, 2 config/usage |
51
- | `gateforge test-gates [--changed] [--scope full\|changed] [--result-only] [--suite <cmd>] [--out <dir>] [--format F] [--witness-url <url>] [--run-token <token>]` | Supervised `--changed` plans and runs mapped Playwright tests through the trusted adapter, checks planned/executed completeness, and seals an authenticated receipt only after complete success. `--scope changed` limits a sealed slice to obligations affected by changed files; incomplete mappings block, and `check --require-e2e` accepts it only when it covers every currently changed obligation. `--result-only` requires `--changed --scope changed`, reports selected results plus repository debt, and has no gate authority: without an external witness it uses private temporary state; with `--witness-url` it requires `--out` + `--run-token` shared with the external witness in a separate state directory (not the configured authoritative state directory). It never creates or clears a receipt. `--suite` remains legacy and cannot combine with `--changed` or redefine strict expected cases. Verifier keys use `GATEFORGE_WITNESS_VERIFIER_KEY` or the external key ring selected by `GATEFORGE_WITNESS_VERIFIER_KEY_FILE`. | 0/1/2 (suite failure forces 1) |
76
+ | `gateforge check [--changed] [--staged] [--candidate-commit <sha>] [--require-e2e] [--timing] [--no-cache] [--format text\|json\|sarif]` | The full gate: discover → classify → obligations → claims → verdicts → report. `--timing` appends per-step wall-clock timings (detectors, test collection, TS scan, planning, total) — an additive report key in json and one line in text, never an input to any verdict. Detector and pytest-collection results are cached under the excluded run-state dir. Detector keys include plugin config, executable module/script bytes, Python import environment, inputs, interpreter packages, and Gateforge engine version; pytest keys include all Python/config file bytes, collector argv/environment, interpreter identity, and engine version. Unchanged successful pytest collections reuse their node ids; any changed Python byte recollects. Any uncertainty runs fresh. The report carries additive `cache: {hits, misses}` counts. `--no-cache` (or `GATEFORGE_NO_CACHE=1`, or a CI environment) disables cache reads and writes. | 0 clean/waived, 1 unresolved, 2 config/usage error |
77
+
78
+ | `gateforge test-gates [--changed] [--scope full\|changed] [--progress stderr\|file:<path>\|off] [--result-only] [--suite <cmd>] [--out <dir>] [--format F] [--witness-url <url>] [--run-token <token>]` | The progress stream (additive, `--progress`, or the `run.progress` config key) prints the registered expected-set size, one line per finished test with exact `N/M` counters and the catalog title, an alive line per quiet minute, and the finish line before grading. It is built from witness-side facts only and never from runner output; a failing test's first error line passes a credential guard and is replaced whole when it matches, and the full guarded diagnosis lands in `.gateforge/test-gates/failures.json`. `auto` (the default) is stderr under `CI=true` and off locally. The stream is not evidence and no gate reads it. Supervised `--changed` plans and runs mapped Playwright tests through the trusted adapter, checks planned/executed completeness, and seals an authenticated receipt only after complete success. `--scope changed` limits a sealed slice to obligations affected by changed files; incomplete mappings block, and `check --require-e2e` accepts it only when it covers every currently changed obligation. `--result-only` requires `--changed --scope changed`, reports selected results plus repository debt, and has no gate authority: without an external witness it uses private temporary state; with `--witness-url` it requires `--out` + `--run-token` shared with the external witness in a separate state directory (not the configured authoritative state directory). It never creates or clears a receipt. `--suite` remains legacy and cannot combine with `--changed` or redefine strict expected cases. Verifier keys use `GATEFORGE_WITNESS_VERIFIER_KEY` or the external key ring selected by `GATEFORGE_WITNESS_VERIFIER_KEY_FILE`. | 0/1/2 (suite failure forces 1) |
79
+ | `gateforge test-gates --chaos <seed> --result-only` | Timing chaos (additive, opt-in, E63): the witness observation proxy releases proxied app RESPONSES on a schedule derived from `<seed>` — a delay in `[0, maxDelayMs]` per response, and, for requests sharing a route key inside one test session, the option of releasing a later response before an earlier one. Only timing changes; bytes, status, headers and evidence semantics never do. The schedule is a pure function of (seed, session identity, route key, k), so the same seed replays it exactly, and the report plus the sealed execution result carry `chaos: { seed, maxDelayMs, reorder, schedule }` (route key = method + pathname, query stripped) with the text line `timing chaos: seed <n>`. Accepted only with `--result-only`: a chaos run finds races, it never seals a receipt. `run.chaos: { maxDelayMs, reorder }` tunes the bounds of a witness the run spawns itself (default 400 ms, reorder on) and never enables chaos by itself — without the flag every run, report and execution result is byte-identical to before. With `--witness-url` nothing is configured on the witness side: the plan travels with the supervisor-authenticated run-context binding (`options.chaos`), which the witness applies before the first session opens, so `run.chaos` tunes the bounds in both cases. A NORMAL run against a witness that was itself started with `GATEFORGE_CHAOS_SEED` exits 2 before any test runs, naming the variable to unset (a perturbed witness can never seal), and a witness too old to accept run options is refused for `--chaos` rather than reporting a schedule it never applied. A normal run against a witness with no plan — including one too old to have the route — is byte-identical to before. A seed that is not a non-negative integer exits 2 with one plain line. |
80
+ | `enforcement.twinPaths` (with `enforcement.twinQueryKeys`) | Twin path coverage (additive, opt-in, E64): links a raw test and its witnessed twin — by `twinOf` in `.gateforge/test-map.yml` or by the title convention `X [witnessed]` next to `X raw` (or the one `X raw: <description>`) — and compares the REQUEST SHAPES each side exercised (method, route template, and the values of the allowlisted query keys; never a URL, a body or a non-allowlisted value). A pair that disagrees is reported as `TWIN_PATH_DIVERGENT`, naming both tests and the exact differing value; `advisory` reports it and leaves the exit code alone, `block` makes it a blocking entry (exit 1). The raw twin's session is marked OBSERVATION-ONLY engine-side, so every submission from it is refused with 403: it can issue no record, no attestation and satisfy nothing, and contributes only its shapes. Absent (or set with no pair linked), nothing is wired, no state file is written and the report is byte-identical. With `--witness-url` the shape plan travels with the run-context binding (`options.twinShapes`: the allowlist and the route inventory as templates), so a repository's own witness needs no twin environment; a witness too old to accept run options records nothing and the run says so in one line instead of reporting twins that agree because nobody looked. |
52
81
  | `gateforge broker commit --workspace <dir> --message <msg> [--receipt <path>] [--ref <ref>]` | Managed-mode commit broker (MECHANISM, not deployment): snapshots the workspace bytes into a throwaway index, recomputes the input + trusted-policy digests, verifies a valid non-stale gate receipt for EXACTLY those bytes, then creates the commit via compare-and-swap `git update-ref`. Typed rejections (`ENFORCEMENT_UNTRUSTED` / `EVIDENCE_STALE` / `RUN_INCOMPLETE` / `KEY_UNKNOWN` / `BROKER_CAS_MISMATCH` / `BROKER_UNSAFE_MESSAGE`); symlinks/submodules are typed rejections. Verifier keys use either supported environment source; the key file must be outside authority, workspace, and receipt artifact roots. | 0/2 |
53
- | `gateforge key create|import-env|rotate|retire --file <path> --confirm` | Owner-only key ceremony. Creates an external key ring, imports an existing environment key, rotates the active key while retaining old keys, or retires an inactive key. The secret is never printed. See verifier-key trust notes. | 0/2 |
82
+ | `gateforge key create|import-env|rotate|retire [--file <path>] --confirm` | Owner-only key ceremony. With no `--file` the ring is `${XDG_CONFIG_HOME:-$HOME/.config}/gateforge/verifier-keyring.json` — the parent directory is created, mode `0600` — and every later command reads that same path, so no `GATEFORGE_WITNESS_VERIFIER_KEY_FILE` export is needed; pass `--file <path>` AND export that variable only when the ring lives elsewhere. Creates, imports, rotates, or retires keys without printing secrets. | 0/2 |
54
83
  | `gateforge pre-commit --scope staged\|full` | The witnessed commit gate: freezes the Git index, materializes it into a scratch checkout, prepares the candidate's staged runtime (`.gateforge/runtime.yml` — below), runs the supervised witness gate INSIDE that checkout (`staged`: only tests mapped to obligations affected by the staged paths, `EVIDENCE_SCOPE_INCOMPLETE` blocks an unmapped affected obligation; `full`: the complete relevant mapped suite), validates the fresh receipt against the same checkout, rechecks the original index/HEAD/MERGE_HEAD, and copies only Gateforge audit artifacts (run state incl. runtime logs) back. Runtime preparation/readiness failures are typed (`RUNTIME_PREPARATION_FAILED` / `RUNTIME_READINESS_FAILED`); child process groups are cleaned up on every exit path. Install via `gateforge init --blocking --witnessed staged\|full`. | 0/1/2 |
55
- | `gateforge enforcement doctor [--json]` | Honest enforcement diagnostics: config, hook presence + ACTIVATION, runner readiness, observer capability, trusted binary/policy ownership, snapshot mode, and the standard/managed boundary. Detecting a hook NEVER counts as managed protection. Diagnostic only: exit 0 whenever it runs. | 0/2 |
84
+ | `gateforge enforcement doctor [--json]` | Reports verified enforcement `level` (0–3), hook activation, wired CI templates, and read-only GitHub/GitLab branch-protection results; missing credentials or uncertain responses remain `not verified`. A local hook never counts as server protection. Its `engine:` line reports the install provenance npm's own metadata proves: a tarball/directory install (read from `node_modules/.package-lock.json`, or the manifest's `_resolved`) is named as such instead of claiming the registry, and an install with no readable metadata is reported as unproven rather than as an all-clear. The receipt's `engine.source` is receipt-bound and keeps its meaning. Diagnostic only: exit 0 whenever it runs. | 0/2 |
85
+ | `gateforge enforce [--ci github\|gitlab]` | Add blocking wiring to an initialized repository. The provider defaults to GitLab unless GitHub is the only detected CI provider; the explicit flag selects GitHub Actions or GitLab CI. Appending to an EXISTING `.pre-commit-config.yaml` is announced as an action on one line, naming the file as the repository's own and printing the exact way back (`git restore -- .pre-commit-config.yaml` for a tracked file; for an untracked one, which has nothing to restore, the line says to delete the appended entry). The generated GitHub workflow installs `@gate-forge/cli@<version>` from the registry unless `GATEFORGE_CI_ENGINE_SOURCE` is set when the generator runs: it then installs that one npm specifier (a `.tgz` path, a directory, or any specifier) through the step environment, for a release that is not on the registry. Unset the variable and rerun for the registry install. | 0/2 |
56
86
  | `gateforge baseline update <fp...>` | Shrink the baseline to a strict subset (invariant 4). | 0/2 |
87
+ | `gateforge baseline diff <before> <after>` | Compare adopted obligations by ID without printing fingerprints. | 0/2 |
88
+
89
+ On a repo that already has Gateforge files, `init` reports only what THAT run did: it keeps an existing `.gateforge.yml` and says so instead of claiming to write a preset, and the `undo:` line it prints names only the paths the run created (it prints no undo line when it created nothing) — so following it can never delete pre-existing config, baselines, waivers, hooks or CI files. A preset that wires no local hook says whether your existing commit hook and/or CI job still decide what blocks your commits.
90
+
91
+ The cache is disabled by `--no-cache`, `GATEFORGE_NO_CACHE=1`, or recognized CI-provider markers (`GITHUB_ACTIONS`, `GITLAB_CI`, `BUILDKITE`, `CIRCLECI`, `JENKINS_URL`, `TF_BUILD`). A bare `CI=true` does not disable it.
57
92
 
58
93
  Global flags: `--help`, `--version`. Exit codes per architecture contract 4:
59
94
  `0` clean/waived, `1` unresolved obligations (or a failed/supervision-blocked
@@ -82,11 +117,95 @@ state may contain this run's report and attestation, but this command never
82
117
  creates, replaces, or clears a gate receipt. Pre-commit, hook, and CI gate
83
118
  paths remain authoritative and do not accept `--result-only`.
84
119
 
120
+ ### Re-check one failing test in seconds (`--test`)
121
+
122
+ To re-confirm a handful of hand-picked tests you do not need a whole
123
+ suite. `--test` names them, and the run is witnessed exactly like a full
124
+ gate run — the same supervisor, the same run token, the same server-side
125
+ evidence:
126
+
127
+ ```sh
128
+ # one test (a logical key, or any unique substring of one)
129
+ gateforge test-gates --test 'backend/tests/test_x.py::test_commits' --result-only
130
+
131
+ # several at once — --test is repeatable
132
+ gateforge test-gates --test UC-53 --test UC-51 --result-only
133
+ ```
134
+
135
+ `--test` is accepted **only** together with `--result-only`. A
136
+ hand-picked list never seals a receipt, so combining `--test` with a
137
+ sealing run exits 2 and says so. The named run never reads, writes, or
138
+ clears a gate receipt, so `check --require-e2e` is unaffected, and it
139
+ carries `authority: non-authoritative` plus `outcome: partial-selection`
140
+ in the report.
141
+
142
+ A selector is resolved against the **planned** rows — the expected set
143
+ fixed before the run — never against raw runner output, so it can only
144
+ name a test the gate already planned. An exact logical key always wins;
145
+ otherwise a unique case-insensitive substring is used. An unknown or
146
+ ambiguous selector exits 2 and lists the candidate logical keys, because
147
+ a narrower selection is never guessed:
148
+
149
+ ```sh
150
+ $ gateforge test-gates --test 'session proxy' --result-only
151
+ gateforge: the selector 'session proxy' matches 2 planned tests — pick one exact logical key. Run `gateforge tests discover --json`. [TEST_SELECTOR_AMBIGUOUS]
152
+ candidate logical keys:
153
+ - tests/green.test.mjs#creates account through the session proxy
154
+ - tests/second.test.mjs#creates the billing account through the session proxy
155
+ ```
156
+
157
+ The report gains an additive `selectors` field naming exactly what each
158
+ selector resolved to, and the run uses the `named-selection` selection
159
+ mode, so it can never collide with a full or a diff-linked slice:
160
+
161
+ ```json
162
+ { "outcome": "partial-selection", "selectors": [{ "selector": "UC-53", "logicalKeys": ["pytest:backend/tests/test_x.py::test_commits"] }] }
163
+ ```
164
+
165
+ Selection works for every runner (Playwright, pytest, vitest, Cypress)
166
+ through the shared runner-adapter contract. Because it works from the
167
+ plan, it does not need the changed-file set — that is why `--test` is
168
+ useful when a fix touches a `.env`, a fixture, or a helper that no test
169
+ links to.
170
+
171
+ Each runner narrows to the named tests as far as it honestly can:
172
+ Playwright, pytest and vitest receive the exact `file:line` / node id /
173
+ anchored test name, so a named test never drags its file neighbours
174
+ along. Cypress cannot filter below the spec without a plugin the gate
175
+ refuses to trust, so it executes the whole spec, drops every unselected
176
+ outcome and session (an unselected test never becomes evidence), and
177
+ says `also ran N other test(s) in the same file — not graded`.
178
+
179
+ #### What a named run grades, and its exit codes
180
+
181
+ A named run grades **only the selection**: the obligations its selected
182
+ tests declare through the sidecar or native annotations. Everything else
183
+ — repository-wide policy, mapping and inventory findings, the coverage
184
+ policy — is still reported, under `repositoryDebt` and as
185
+ `not graded in a named run: N obligation(s)`, but never blocks: the run
186
+ never observed it. What still blocks is everything about the run itself
187
+ (supervision findings, lifecycle conflicts, intent failures, the witness
188
+ channel, evidence-context failures) and any finding that names a graded
189
+ obligation. The report and the diagnostic context both carry
190
+ `scope: "named"`, and the execution summary keeps the whole-repository
191
+ counts next to the selection's own.
192
+
193
+ | Exit | Meaning |
194
+ | --- | --- |
195
+ | `0` | every selected test passed and every obligation it declares is satisfied (or waived by the owner), with a complete run and no run-execution finding |
196
+ | `1` | anything else: a red selected test, an unproven graded obligation, an incomplete run, changed inputs, or a workspace that moved during the run |
197
+ | `2` | the selector could not be resolved (unknown or ambiguous) — nothing ran |
198
+
199
+ A named run never carries gate authority: it is `--result-only` only,
200
+ never creates, replaces or clears a receipt, and `check --require-e2e`
201
+ keeps reading the seal the authoritative run left. A run without
202
+ `--test` is unaffected by any of this.
203
+
85
204
  ## Staged runtime (`.gateforge/runtime.yml`)
86
205
 
87
206
  `gateforge pre-commit` executes the candidate inside a materialized checkout
88
207
  that contains TRACKED bytes only — no installed dependencies, no built
89
- assets, no application processes. The owner-reviewed staged-runtime document
208
+ assets, no application processes. The reviewed staged-runtime document
90
209
  declares how that checkout becomes a runnable candidate. It is
91
210
  security-sensitive: its bytes are hashed into the trusted policy digest and
92
211
  the authenticated input snapshot, so a candidate that edits its own runtime
@@ -98,6 +217,14 @@ prepare:
98
217
  command: npm ci --offline # or pnpm/bun/uv — frozen install, build steps
99
218
  reuse: [node_modules] # dependency dirs EXPLICITLY allowed to link from the user repo
100
219
  timeoutSeconds: 600
220
+ preflight: # optional cheap checks before prepare
221
+ - { name: lint, command: npm run lint, timeoutSeconds: 60 }
222
+ health: # optional probes before/after the suite
223
+ - { name: database, tcp: '127.0.0.1:5432', timeoutSeconds: 5 }
224
+ - name: worker-startup
225
+ logAbsent:
226
+ command: ./tools/recent-worker-logs.sh
227
+ pattern: 'worker startup failed'
101
228
  services: # candidate-owned app/database/worker processes
102
229
  - id: app
103
230
  command: node server.js --port ${service:app:port}
@@ -105,7 +232,7 @@ services: # candidate-owned app/database/worker processes
105
232
  fingerprint: prod-v1 # GF-13 marker (reviewed adapters must declare the same)
106
233
  target: true # this proxy URL becomes the run's attested target
107
234
  ready: { log: 'listening on', timeoutSeconds: 60 } # or http: <url>
108
- envAllowlist: [DATABASE_URL] # operator env names allowed through to children
235
+ envAllowlist: [DATABASE_URL] # operator env names for services and supervised tests
109
236
  executionTimeoutSeconds: 1800 # whole-run budget handed to the supervised gate
110
237
  ```
111
238
 
@@ -116,6 +243,14 @@ Contract highlights:
116
243
  execution timeouts are bounded; stdout/stderr are captured to
117
244
  `<run-state>/runtime/<id>.log`; teardown happens on success, failure,
118
245
  timeout, and interruption (SIGINT/SIGTERM kill the whole groups).
246
+ - `prepare.preflight` checks run in order before `prepare`; the first
247
+ non-zero exit blocks preparation with `PREFLIGHT_FAILED <name>` and the
248
+ command's last 30 output lines.
249
+ - `health` supports one `tcp`, `http`, `command`, or `logAbsent` probe per
250
+ entry. `logAbsent` runs its declared log command after startup and blocks
251
+ when the configured regex is found. A failed startup probe blocks with
252
+ `FIXTURE_UNHEALTHY <name>`; the post-run probe is advisory and does not
253
+ change test verdicts. HTTPS uses normal certificate verification.
119
254
  - Every `prepare.reuse` tree is constrained to a normalized repository-relative
120
255
  path. Its reachable dependency bytes are hashed into the authenticated
121
256
  input identity, so changing an ignored reused dependency invalidates the
@@ -131,12 +266,52 @@ Contract highlights:
131
266
  needs installed dependencies blocks honestly instead of silently reusing
132
267
  the worktree's environment.
133
268
 
269
+ ## Harness and run history
270
+
271
+ The optional `.gateforge.yml` `harness` section declares `up`, `reset`,
272
+ `seed`, `health`, and `down` shell commands. Supervised runs invoke configured
273
+ setup commands in that order before the suite; the first failure blocks the
274
+ suite, prints its last 30 output lines, and still attempts `down`. Gateforge
275
+ executes these commands but does not manage containers or other infrastructure.
276
+ Absent `harness` preserves current behavior.
277
+
278
+ ```yaml
279
+ harness:
280
+ up: ./tools/test-up.sh
281
+ reset: ./tools/test-reset.sh
282
+ seed: ./tools/test-seed.sh
283
+ health: ./tools/test-health.sh
284
+ down: ./tools/test-down.sh
285
+ serviceLogs:
286
+ command: docker compose logs --no-color --tail ${lines} ${service}
287
+ services: [database, worker]
288
+ lines: 100
289
+ ```
290
+
291
+ On a failed supervised run, `serviceLogs` runs the declared log command for
292
+ each service and saves the configured tail to
293
+ `<run-state>/diagnostics/service-logs.txt`. Log capture is advisory and does
294
+ not change test verdicts.
295
+
296
+ Each `verifyPersistence` adapter call is timed in
297
+ `<run-state>/diagnostics/adapter-timing.jsonl`; calls over two seconds also
298
+ print a warning. Timed-out tests report the observed app/runner time separately
299
+ from their summed witness-adapter time. These diagnostics do not alter the
300
+ receipt or verdict.
301
+
302
+ Run history is opt-in through `.gateforge.yml` `history`; when configured,
303
+ retention defaults to 14 days and is capped at 90. Set `retentionDays: off`
304
+ to disable it. History is stored beneath the ignored test-gates state and is
305
+ not receipt input. Query it with `gateforge history [--test TEXT] [--failed]
306
+ [--since ISO-8601]`.
307
+
134
308
  ## Existing-test reuse (`gateforge tests`)
135
309
 
136
310
  The reuse-first workflow: inspect what exists, declare what is unclear, run
137
311
  it, and add a new test only for a confirmed behavior gap. The fixed agent
138
- sequence is: `tests discover` → `tests suggest` → `tests mark` (or edit the
139
- sidecar directly) → run the suite under supervision → `check --require-e2e`.
312
+ sequence is: `tests discover` → `tests suggest` → `tests sync` for annotated
313
+ tests or `tests mark` for hand-written sidecar mappings → run the suite under
314
+ supervision → `check --require-e2e`.
140
315
 
141
316
  `tests discover` writes the catalog to `.gateforge/test-gates/test-catalog.json`
142
317
  — a DERIVED artifact under the excluded run-state directory, never a pipeline
@@ -146,6 +321,14 @@ project) so manual mappings survive comment edits; source digests still move,
146
321
  so old evidence goes stale. Renamed/deleted tests and removed parameters
147
322
  surface as stale or ambiguous mappings — never a silent reassignment.
148
323
 
324
+ `tests sync` statically resolves direct Gateforge annotations and local pure
325
+ helpers that return literals. It never loads a test runner or executes a test.
326
+ Entries marked `source: annotation` are regenerated; handwritten entries are
327
+ preserved. Unresolvable annotations are printed as `UNRESOLVED` with the test
328
+ file and location. `check` reports missing/extra generated claims as the
329
+ non-blocking `TEST_MAP_OUT_OF_SYNC` advisory for this release period; run
330
+ `gateforge tests sync` to reconcile them.
331
+
149
332
  `tests mark` validates the declaration against the current catalog AND the
150
333
  current obligation registry (an unknown obligation id or test key is a
151
334
  precise exit-2 error) before writing `.gateforge/test-map.yml`:
@@ -205,6 +388,7 @@ diagnostics:
205
388
  argv: [python, -m, pytest]
206
389
  testPaths: [tests]
207
390
  timeoutMs: 600000
391
+ hostLoad: true # opt-in: sample load average, CPU count, and disk space
208
392
  ```
209
393
 
210
394
  `gateforge tests diagnose` runs each configured suite once against the
@@ -219,32 +403,50 @@ clear one missing browser obligation. When the supervised run executes the
219
403
  same suites, their results are displayed separately without changing the E2E
220
404
  exit decision.
221
405
 
406
+ When enabled, the supervised run writes `diagnostics/host-load.json` at start,
407
+ every 30 seconds, and at completion. Failed tests completed while load exceeds
408
+ 1.5× CPU count get a note with the nearest preceding sample. Free disk below
409
+ 5% at start emits a warning; load and disk data are diagnostic only.
410
+
222
411
  ## Enforcement
223
412
 
224
413
  Two named modes (ADR 0005 D1); the CLI never reports a hook as more than it
225
414
  is.
226
415
 
416
+ When a witnessed pre-commit run reaches a blocking result, Gateforge reports
417
+ how many tests the current commit selected and, when recorded, how long the
418
+ last full run took. This is cost context only; the current run and its receipt
419
+ still decide whether the commit passes.
420
+
227
421
  **Standard mode** — an active local hook PLUS a mandatory trusted server
228
422
  check:
229
423
 
230
- - `gateforge init --blocking` installs the pre-commit hook into the resolved
231
- hooks directory (`core.hooksPath` honored), verifies activation (exec bit +
232
- a verified `--gateforge-verify` invocation), and writes a standalone
233
- staged-gate script (`.gateforge/hooks/gateforge-staged.sh`) for consumers
234
- with a foreign hook manager. The hook runs `gateforge check --staged
235
- --require-e2e`; a missing engine blocks (fail closed). Idempotent — an
236
- existing gateforge-owned hook is verified, never rewritten.
237
- - The same `init --blocking` run writes `.gateforge/ci/gitlab-gateforge.yml`
238
- plus the `.gitlab-ci.yml` include — the SERVER-side strict gate (pinned
239
- engine, `test-gates --changed` receipt seal, `check --changed
240
- --require-e2e`), with the required server-side settings documented in the
241
- template header:
242
- "Pipelines must succeed" (skipped ≠ successful), protected branches
243
- excluding the agent role from direct pushes, and an organization-controlled
244
- pipeline execution policy so a candidate cannot delete the gate job. THE
245
- HONEST LIMIT: `--no-verify`, an alternate `core.hooksPath`, direct
246
- plumbing, or an unrelated clone bypass any local hook — keeping bypassed
247
- commits out of protected history is the server's job, not the hook's.
424
+ - `gateforge init --blocking` installs a static pre-commit check and, for
425
+ new configs (`enforcement.receiptStage: pre-push`), a pre-push hook that
426
+ checks each pushed commit tip with `check --candidate-commit <sha>
427
+ --require-e2e`. The static lane does not require a receipt; the pre-push
428
+ lane does. Existing configs without `receiptStage` keep their previous
429
+ pre-commit behavior. Hook activation is verified; foreign hooks are never
430
+ overwritten.
431
+ By default, `init --blocking` writes `.gateforge/ci/gitlab-gateforge.yml`
432
+ plus the `.gitlab-ci.yml` include. `gateforge enforce --ci github` writes
433
+ `.github/workflows/gateforge.yml` instead. Both strict templates run
434
+ `test-gates --changed`, then verify the exact CI commit with
435
+ `check --changed --candidate-commit "$CI_COMMIT_SHA"` (GitLab) or
436
+ `--candidate-commit "$GITHUB_SHA"` (GitHub). The verifier key and policy
437
+ pin come from protected CI secrets.
438
+ `init --blocking` prints exact GitHub/GitLab protection commands for
439
+ owner review; it never runs server mutations itself.
440
+ Protect the branch, require its Gateforge pipeline to succeed (skipped jobs
441
+ do not count), exclude agent roles from direct pushes, and use an
442
+ organization-controlled pipeline execution policy so a candidate cannot
443
+ remove the gate job. THE HONEST LIMIT: `--no-verify`, an alternate
444
+ `core.hooksPath`, direct plumbing, or an unrelated clone bypass any local
445
+ hook — keeping bypassed commits out of protected history is the server's
446
+ job, not the hook's.
447
+ `gateforge enforcement doctor` reports level 0–3. It reports level 3 only
448
+ when a read-only provider API confirms branch protection plus a required
449
+ Gateforge status check or passing-pipeline setting.
248
450
  - The CI template checks that the installed `@gate-forge/cli` version equals
249
451
  the version that generated it. Add that exact version as a root
250
452
  `devDependency`. The template uses a package-manager lockfile when present;
@@ -282,6 +484,12 @@ the current input digest and trusted policy digest:
282
484
  exact candidate);
283
485
  - forged/tampered receipt → `ENFORCEMENT_UNTRUSTED`.
284
486
 
487
+ Receipts sealed by newer Gateforge versions add the `engine` identity
488
+ (`version`, `source`, and `unpublished`) inside the authenticated envelope.
489
+ When present, `check --require-e2e` requires the installed CLI version to
490
+ match the version that sealed the receipt. Legacy receipts without `engine`
491
+ continue to verify as before.
492
+
285
493
  `test-gates --changed` seals a receipt only after planned-vs-executed
286
494
  completeness, evidence grading, and a successful runner exit: zero selected
287
495
  tests, skips, `.only`, retries, teardown failures, and incomplete shards all
@@ -294,14 +502,14 @@ and `--require-e2e` blocks — it never downgrades to a weaker pass.
294
502
  Gateforge hashes all inputs and all candidate files. On a terminal, the first
295
503
  `gateforge init` asks for documentation-only folders to exclude. Automation can
296
504
  use `gateforge init --docs-exclude docs,handbook`; a non-interactive run with no
297
- option keeps the default. Gateforge writes the owner declaration to
505
+ option keeps the default. Gateforge writes the approved declaration to
298
506
  `.gateforge/docs-exclusions.yml` and prints the candidate trusted-policy digest
299
507
  to approve through the protected `GATEFORGE_APPROVED_POLICY_DIGEST` setting.
300
508
  Gate checks refuse to use the exclusions until that external pin matches. A
301
509
  later change to the exclusion declaration changes the digest; use
302
510
  `--confirm-doc-exclusions` when `init` changes an existing approval.
303
511
 
304
- The owner declares that these folders do not affect the product or its tests.
512
+ The project states these folders do not affect the product or its tests.
305
513
  Gateforge does not prove this. If application or test code reads an excluded
306
514
  file, a later edit can make old evidence look valid without running the tests
307
515
  again. Reports show the approved folders, pin identity, and this reduced
@@ -310,7 +518,21 @@ source files, gate or trust metadata, manifests, lockfiles, or symlinks.
310
518
  Every file must also use a supported document or raster-image format. MDX,
311
519
  WASM, SVG, HTML, and unknown formats fail closed. This format allowlist does
312
520
  not prove that an allowed file cannot affect application or test behavior;
313
- the owner assertion and its reduced guarantee still apply.
521
+ the project assertion and its reduced guarantee still apply.
522
+
523
+ **Owner-declared Python bytecode exclusions (explicit trust mode).** By
524
+ default, Python bytecode remains part of candidate and input identity. To
525
+ exclude only exact generated cache files, run
526
+ `gateforge init --cache-exclude src/__pycache__/module.cpython-313.pyc`.
527
+ The command writes `.gateforge/cache-exclusions.yml` and prints the trusted
528
+ policy digest to approve outside the repository. A matching protected
529
+ `GATEFORGE_APPROVED_POLICY_DIGEST` pin is REQUIRED before a gate uses the
530
+ list; changing an existing list requires `--confirm-cache-exclusions`.
531
+ Only exact `.pyc` or `.pyo` files directly under `__pycache__` are allowed;
532
+ globs, symlinks, configured inputs, and other file types fail closed. Reports
533
+ show the exact files, pin status, and reduced trust guarantee. This is an
534
+ owner assertion, not proof that the excluded bytecode cannot affect runtime
535
+ behavior.
314
536
 
315
537
  **Managed mode** (config `enforcement.mode: managed`) — the literal
316
538
  no-bypass guarantee requires putting the authoritative Git metadata, commit
@@ -323,6 +545,59 @@ the agent's own boundary provides NO managed guarantee.
323
545
  hook activation, runner/browser readiness, capability availability, trusted
324
546
  binary/policy ownership, snapshot mode, and — in managed mode — an
325
547
  agent-writable authoritative Git directory is a `fail`, never a pass.
548
+ When `.pre-commit-config.yaml` exists, the doctor runs its hooks twice in a
549
+ temporary checkout, reports files they modify, and recommends placing
550
+ `gateforge-check` before mutating hooks. Hook commands still run with the
551
+ caller’s system permissions; review them as you would any local command.
552
+
553
+ ### Owner-operated systemd deployment recipe
554
+
555
+ This is an operator deployment pattern, not an installed Gateforge service.
556
+ Use a dedicated authority account and keep the bare authoritative repository,
557
+ trusted config, CLI binary, and verifier key outside the agent's writable
558
+ process boundary. Give agents write access only to unique inbox workspaces;
559
+ allow them to request this one fixed unit, never arbitrary systemd units.
560
+ Do not pass candidate-controlled environment variables to the service.
561
+
562
+ Create an owner-only key ring and approved config as the authority account:
563
+
564
+ ```sh
565
+ sudo install -d -o gateforge-authority -g gateforge-authority -m 0700 /etc/gateforge
566
+ sudo -u gateforge-authority gateforge key create --file /etc/gateforge/verifier-keyring.json --confirm
567
+ ```
568
+
569
+ Install `/etc/systemd/system/gateforge-broker@.service` (replace the
570
+ root-owned CLI path and ref for your installation):
571
+
572
+ ```ini
573
+ [Unit]
574
+ Description=Verify and commit one Gateforge workspace
575
+
576
+ [Service]
577
+ Type=oneshot
578
+ User=gateforge-authority
579
+ Group=gateforge-authority
580
+ WorkingDirectory=/srv/gateforge/authority.git
581
+ Environment=GATEFORGE_WITNESS_VERIFIER_KEY_FILE=/etc/gateforge/verifier-keyring.json
582
+ Environment=GATEFORGE_TRUSTED_CONFIG=/etc/gateforge/approved.yml
583
+ ExecStart=/usr/local/bin/gateforge broker commit --workspace /srv/gateforge/inbox/%i --message "verified candidate" --ref refs/heads/main
584
+ ProtectSystem=strict
585
+ ProtectHome=true
586
+ PrivateTmp=true
587
+ NoNewPrivileges=true
588
+ ReadOnlyPaths=/srv/gateforge/inbox
589
+ ReadWritePaths=/srv/gateforge/authority.git
590
+ ```
591
+
592
+ Provision `/srv/gateforge/authority.git`, `/srv/gateforge/inbox/<opaque-id>`,
593
+ and `/etc/gateforge/approved.yml` with owner-controlled permissions. Restrict
594
+ service activation to the agent role via an exact polkit rule; do not grant
595
+ general `sudo systemctl` access. The broker verifies the workspace receipt,
596
+ current approved policy, raw tree bytes, and compare-and-swap target ref
597
+ before committing. A missing, stale, forged, or wrong-key receipt fails
598
+ closed. `enforcement doctor` can verify the local boundary only; the owner
599
+ must separately audit the service account, polkit rule, filesystem
600
+ permissions, and immutable engine/config deployment.
326
601
 
327
602
  ## Contract capabilities
328
603
 
@@ -334,14 +609,73 @@ else):
334
609
  | --- | --- |
335
610
  | `persistence:create\|read\|update\|delete` | AVAILABLE — engine-observed same-entity persistence reads with the exact-value echo requirement (`EVIDENCE_VALUE_MISMATCH` on a mismatched echo, even when the status was 2xx) |
336
611
  | `http:request-observed`, `http:response-status-ok` | AVAILABLE — transport semantics only: a witness-observed exchange plus a provenance-verified claimed `ui.action` anchor from the declaring test |
337
- | `http:frontend-request-observed` | UNAVAILABLE — no independent browser/test attribution channel; grades blocking `missing` before examining evidence |
612
+ | `http:frontend-request-observed` | UNAVAILABLE — no independent browser/test attribution channel; explicit selection remains blocking `missing` with `VERIFIER_UNSUPPORTED` |
338
613
  | `crud:*` (UI-semantic) | FAIL-CLOSED — the tested suite owns the browser; use `persistence:*` |
339
614
  | `http:effect-verified`, `http:read-result-verified` | AVAILABLE (behavior-case channel) — graded across the approved required cases with witness-issued `behavior.case` records; needs a compiled `behaviorPolicy` requirement set |
340
- | `auth:*`, `validation:*` | AVAILABLE (behavior-case channel) — same required-case aggregation over engine-controlled requests with independent state scopes |
341
- | `task:*`, `webhook:*`, `workflow:*` | UNSUPPORTED — every contract fail-closed; surfaces as `VERIFIER_UNSUPPORTED` (remove the contract or drop the pack; do not add tests) |
615
+ | `auth:*`, `validation:*`, `task:*`, `webhook:*`, `workflow:*` | AVAILABLE (behavior-case channel) — same required-case aggregation over engine-controlled requests with independent state scopes. A repository that declares no case for the obligation stays blocking `missing`: the grader never falls back to transport evidence |
616
+
617
+
618
+ A behavior case may declare a `signatureProfile` on its `request`
619
+ action: an algorithm plus bounded `;key=value` parameters
620
+ (`header`, `timestampHeader`, `toleranceMs`, `attemptHeader`,
621
+ `attempt`, `forgery`). One parser serves both the config schema and
622
+ the witness driver, so `hmac-sha256;forgery=signature` is understood
623
+ identically at parse time and at run time and an unknown parameter is
624
+ refused rather than defaulted. The signing secret is read only from
625
+ the trusted lease; the signature always covers the exact bytes on the
626
+ wire.
342
627
 
343
628
  Unsupported proof stays blocking. Nothing silently replaces browser proof
344
629
  with HTTP status proof.
630
+ `gateforge init` includes the available transport-only contracts for consumed
631
+ HTTP endpoints in new installations. Existing policies are unchanged;
632
+ explicitly requiring `http:frontend-request-observed` still blocks. The init
633
+ scan names that unavailable channel once as not yet provable.
634
+
635
+ ### Observation scope for HTTP endpoints (opt-in policy option)
636
+
637
+ By default an `http.endpoint` owes the observation contracts
638
+ (`http:request-observed`, `http:response-status-ok`) only when a
639
+ `consumed: true` policy matches it — the static join with the frontend.
640
+ A brand-new route that no UI calls therefore owes nothing, and "you
641
+ forgot a test" stays invisible: `check` exits 0.
642
+
643
+ The pinned policies document (`.gateforge/policies.yml`, the trusted
644
+ policy) takes one additive option that widens that scope:
645
+
646
+ ```yaml
647
+ schemaVersion: 1
648
+ options:
649
+ 'http.endpoint.requireObservation': all # or 'consumed' (the default)
650
+ policies:
651
+ - id: frontend-consumed-endpoints-transport-only
652
+ when:
653
+ kind: http.endpoint
654
+ consumed: true
655
+ require:
656
+ - http:request-observed
657
+ - http:response-status-ok
658
+ ```
659
+
660
+ - Absent (or `consumed`): today's behavior, byte for byte. A document
661
+ without the `options` section generates the same obligations, the same
662
+ report and the same exit code it always did.
663
+ - `all`: EVERY discovered endpoint owes the observation contracts of a
664
+ `consumed: true` endpoint policy. An unmapped one is `missing` with the
665
+ existing `TEST_MAPPING_MISSING` cause and the existing overlay next
666
+ action. Existing routes are not re-litigated: run `gateforge adopt`
667
+ once (the sanctioned bulk-add) and the adopted baseline forgives them,
668
+ so only NEW routes block.
669
+ - The option never widens a `consumed: false` policy, a policy that does
670
+ not name the `http.endpoint` kind, or anything that is not a route; it
671
+ adds no contract, cause code or exit code.
672
+ - It lives in the pinned policy document, so an agent cannot widen or
673
+ narrow the scope by itself — that is a policy revision.
674
+ - `gateforge next` names the option on the one item it explains (an
675
+ unmapped obligation on a route the frontend never calls while the
676
+ option is `all`) and stays silent everywhere else.
677
+
678
+
345
679
 
346
680
  ## Configuration
347
681
 
@@ -356,8 +690,10 @@ start.
356
690
 
357
691
  Enforcement-relevant sections:
358
692
 
359
- - `enforcement:` — `mode: standard | managed` (default `standard`) and
360
- `strictE2E: boolean` (default `false`); see Enforcement above.
693
+ - `enforcement:` — `mode: standard | managed` (default `standard`),
694
+ `strictE2E: boolean` (default `false`), and optional
695
+ `receiptStage: pre-push | pre-commit | ci`. New configs choose `pre-push`;
696
+ omission preserves legacy behavior.
361
697
  - `coveragePolicy:` (opt-in, fail closed) — the closed-world CRUD coverage
362
698
  policy: enumerated user-facing tables (validated against the run's
363
699
  resource inventory on EVERY run — an unknown table name is a config error,
@@ -369,6 +705,10 @@ Enforcement-relevant sections:
369
705
  trusted-policy act — the policy participates in the trusted policy
370
706
  revision, so an agent edit never self-approves.
371
707
  - `diagnostics.suites:` — the advisory pytest suites (see above).
708
+ - `runner:` — the test runner the supervised gate drives:
709
+ `playwright` (the default when the key is absent), `pytest`, `vitest` or
710
+ `cypress`. `check`, `next`, `tests`, `test-gates`, `doctor` and `init`
711
+ all follow it. See `guides/RUNNER-NEUTRAL-EVIDENCE.md`.
372
712
 
373
713
  ## Plugin invocation
374
714
 
@@ -434,6 +774,31 @@ having this channel; a malformed document (bad JSON, unknown keys, a rule
434
774
  without `plane`/`reason`, an absolute or `..`-escaping `match`) fails the
435
775
  run closed at startup (exit 2).
436
776
 
777
+ ### Review an endpoint plane
778
+
779
+ When `next` cannot resolve a route's plane, it asks which data boundary owns
780
+ the route and prints one command for each supported choice. Run only the
781
+ choice the owner has reviewed. `classify plane` accepts one repo-relative
782
+ router source path, one plane, and a non-empty reason:
783
+
784
+ ```sh
785
+ gateforge classify plane 'src/routes.js' tenant \
786
+ --reason 'Owner review confirms tenant-owned records for this route.'
787
+ ```
788
+
789
+ The default is a dry run: it prints the exact config diff and does not write.
790
+ Add `--confirm` to append the rule to an **existing**
791
+ `.gateforge/planes.json`. The command never creates another trust file,
792
+ replaces a rule, or writes an internality declaration; conflicting rules
793
+ must be resolved by editing the owner-reviewed config. This file is a
794
+ classification input, so changing it changes the trusted-policy digest; an
795
+ approved policy pin must be re-approved before strict gates run.
796
+
797
+ The alternative in `next` is owner-only: use the existing
798
+ `.gateforge/classification-policy.yml` `internalRules` declaration only when
799
+ the route is genuinely internal. Internal rules still require the existing
800
+ internality certificate; they are not overrides.
801
+
437
802
  ## Endpoint capability rules (`.gateforge/endpoints.json`)
438
803
 
439
804
  Capability derivation uses detector FACTS only (method, canonical path,
@@ -473,12 +838,22 @@ capability from the closed compiler vocabulary and a required non-empty
473
838
  }
474
839
  ```
475
840
 
841
+ Resource linkage accepts the path-derived name or its singular form with
842
+ one trailing `s` removed: `/items/{id}` can link to model `item`.
843
+ Exactly one discovered model must match, and a schema symbol or whole
844
+ handler-name word must corroborate it. Name coincidence alone never links;
845
+ if both `items` and `item` exist, the compiler blocks the ambiguity rather
846
+ than preferring one.
847
+
476
848
  Evaluation per endpoint identity, deterministic and fail closed:
477
849
 
478
850
  - **All matching rules agree** → the capability is declared (composed
479
851
  with detected ones; overlapping agreeing rules are one declaration).
480
852
  A declared `crud-delete`/`crud-archive` on a DELETE endpoint resolves
481
853
  the archive-vs-hard question the linked model could not prove.
854
+ The declaration also supplies that evidence to the linked model's
855
+ classifier. Conflicting model/route semantics still block; an archive
856
+ declaration still needs the model's archive-state evidence.
482
857
  - **Matching rules disagree** → a blocking
483
858
  `ENDPOINT_CAPABILITY_CONTRADICTION` entry names every matching rule,
484
859
  its capability, and its reason; NOTHING is applied — never
@@ -494,6 +869,42 @@ The vocabulary is the compiler's own: `health-operations`,
494
869
  having the channel; a malformed document fails the run closed at startup
495
870
  (exit 2).
496
871
 
872
+ ### Answering `ENDPOINT_SEMANTICS_UNRESOLVED`
873
+
874
+ When `gateforge next` prints that code, the run has found an endpoint and
875
+ cannot tell what it DOES; the remedy is an owner-authored rule, not
876
+ another read-only command. The printed block carries the whole answer for
877
+ THAT endpoint: its own method and canonical path as the selectors, the two
878
+ owner-chosen fields (`capability`, `reason`) marked in the snippet, and the
879
+ allowed values. Answer it by replacing the two marked fields and writing
880
+ the file (append the rule to `rules` when the file already exists), then
881
+ prove it applied with the printed `gateforge explain <endpoint-id>` — its
882
+ `capabilities:` line names the capability and its trace says
883
+ `endpoints.json`.
884
+
885
+ The shortest useful file — one exact endpoint, no glob at all — is:
886
+
887
+ ```json
888
+ {
889
+ "rules": [
890
+ {
891
+ "method": "DELETE",
892
+ "paths": ["/items/{item_id}"],
893
+ "capability": "crud-archive",
894
+ "reason": "The handler sets archived_at; the row is never removed."
895
+ }
896
+ ]
897
+ }
898
+ ```
899
+
900
+ `paths` patterns are globs on the canonical path (`*` within a segment,
901
+ `**` across segments, `?` one character); a path with no wildcard is an
902
+ exact selector, which is what you want for one route. On a `DELETE`, the
903
+ capability is the archive-vs-hard answer (`crud-archive` /
904
+ `crud-delete`) and nothing else resolves that block; on any other verb it
905
+ is the closed vocabulary above. A rule left with a placeholder capability
906
+ fails the run closed at startup (exit 2) with the allowed values named.
907
+
497
908
  ## Proposing planes at init (`gateforge init --planes`)
498
909
 
499
910
  `gateforge init --planes` runs discovery over the repo's own include and
@@ -523,6 +934,8 @@ and print the tip.
523
934
  | `claims.json` / `records.json` | Reporter output consumed by the verifier (written by the suite). |
524
935
  | `execution-result.json` / `receipt.json` / `diagnostics.json` | Supervised `--changed` mode: the sealed execution result (planned vs executed instances, outcomes, native claim inventory, runner exit, completeness), the authenticated gate receipt issued after complete success, and the separate advisory diagnostic report. |
525
936
  | `report.json` | Canonical json-format run report after evaluation. |
937
+ | `last-full-run.json` | Advisory test count and measured duration for the latest completed full run; used only to explain commit cost, never as gate evidence. |
938
+
526
939
 
527
940
  The legacy suite command (`--suite`) runs with those env vars; its reporter
528
941
  extracts claims from `{type: 'gateforge', description: '<obligation id>'}`
@@ -540,6 +953,12 @@ or turn an arbitrary exit-zero command into E2E proof — the hook and CI
540
953
  run `check --staged/--changed --require-e2e`, which accept only supervised
541
954
  receipts.
542
955
 
956
+ Before supervised execution, Gateforge compares Playwright's scrubbed
957
+ inventory with a second `--list` using the safe run variables supplied to
958
+ the runner. A difference stops the run before tests start and names each
959
+ project, file, and title present in only one inventory. Static discovery
960
+ also warns when `process.env.GATEFORGE_*` controls test registration.
961
+
543
962
  ### Provenance trust model (GF-23, audited 2026-08-31, three rounds)
544
963
 
545
964
  `records.json` and `manifest.json` live in the suite-writable state
@@ -603,11 +1022,22 @@ NEVER come from the tested suite:
603
1022
  cannot bless an unarchived entity by declaring its current state as
604
1023
  the expected result.
605
1024
 
1025
+ An adapter may declare an optional literal `fields: [...]` projection.
1026
+ Anchored persistence fails before consuming its pre-observation when the
1027
+ action changes a field outside that projection. `check` also reports
1028
+ model updateable fields missing from a statically readable projection.
1029
+ Adapters without this metadata keep their existing behavior.
1030
+
606
1031
  Presence alone, contradicted observations, missing pre-observations, or
607
1032
  absent deltas grade `invalid` — even when every provenance check passes.
608
1033
 
609
- **Layer 2 — versioned attestation binding evidence to tested inputs
610
- (plan §11, F2).** A witnessed record is authorized only by ONE validated
1034
+
1035
+ When the complete endpoint inventory contains no update-capable route linked
1036
+ to the resource, the failure also says that no observed UI request writes the
1037
+ fields and the feature may be unreachable from the UI. This is diagnostic only;
1038
+ it does not change the verdict.
1039
+
1040
+ **Layer 2 — versioned attestation binding evidence to tested inputs.** A witnessed record is authorized only by ONE validated
611
1041
  v2 envelope that simultaneously matches its run id, the expected input
612
1042
  digest, the required invocation identity, and its record id:
613
1043
 
@@ -653,27 +1083,27 @@ surface as explicit `evidence-context` blockers (missing vs malformed
653
1083
  vs forged stay distinguished) that waivers cannot hide.
654
1084
 
655
1085
  The key comes from one trusted source: the protected
656
- `GATEFORGE_WITNESS_VERIFIER_KEY` environment variable, or an external
657
- owner-only key ring named by `GATEFORGE_WITNESS_VERIFIER_KEY_FILE`.
658
- Do not set both. The file must be a regular file owned by the current
1086
+ `GATEFORGE_WITNESS_VERIFIER_KEY` environment variable, an external
1087
+ owner-only key ring named by `GATEFORGE_WITNESS_VERIFIER_KEY_FILE`, or the
1088
+ default `$XDG_CONFIG_HOME/gateforge/verifier-keyring.json` (otherwise
1089
+ `~/.config/gateforge/verifier-keyring.json`) when present. Do not set both
1090
+ explicit sources. The file must be a regular file owned by the current
659
1091
  user, with mode `0600` or stricter, and it must not be a symlink. Store
660
1092
  it outside the candidate repository, Git directory, run state, `--out`
661
1093
  directory, workspace, and receipt-artifact directory. Gateforge refuses
662
1094
  unsafe paths and permissions. File mode is not supported on Windows;
663
1095
  use the protected environment source there.
664
-
665
1096
  Create and rotate keys only after an owner review:
666
1097
 
667
1098
  If you already use an environment key, keep it in the protected environment
668
1099
  while you import it. Do not place key material in shell history or argv.
669
1100
 
670
1101
  ```sh
671
- gateforge key create --file "$HOME/.config/gateforge/keys.json" --confirm
672
- gateforge key import-env --file "$HOME/.config/gateforge/keys.json" --confirm
1102
+ gateforge key create --confirm
1103
+ gateforge key import-env --confirm
673
1104
  unset GATEFORGE_WITNESS_VERIFIER_KEY
674
- export GATEFORGE_WITNESS_VERIFIER_KEY_FILE="$HOME/.config/gateforge/keys.json"
675
- gateforge key rotate --file "$HOME/.config/gateforge/keys.json" --confirm
676
- gateforge key retire --file "$HOME/.config/gateforge/keys.json" --key-id key-old-id --confirm
1105
+ gateforge key rotate --confirm
1106
+ gateforge key retire --key-id key-old-id --confirm
677
1107
  ```
678
1108
 
679
1109
  Create the parent directory first. `key import-env` retains an existing
@@ -699,6 +1129,36 @@ container. File-change capture is snapshot-based, not an OS sandbox:
699
1129
  it guards changes visible at capture points, not a malicious process
700
1130
  that changes and restores files between snapshots.
701
1131
 
1132
+ ### The operator's fixture/actor provider
1133
+
1134
+ A declared behavior case names a `fixture` recipe and an `actor`, and the
1135
+ witness — not the test suite — must materialize them before it drives the
1136
+ case. `GATEFORGE_FIXTURE_PROVIDER` names the module that does that. The
1137
+ CLI-spawned witness loads it at startup; a repository that declares no
1138
+ behavior cases is unaffected.
1139
+
1140
+ The module's default export is `{ prepare(input), release(leaseId),
1141
+ resolveCredential(credentialRef) }`:
1142
+
1143
+ - `prepare` provisions the case's subjects and actor identities and returns
1144
+ `{ leaseId, namespace, subjects, actors }`. Subjects are server-issued
1145
+ identities; a lease namespace keeps concurrent cases isolated.
1146
+ - `release` drops what that lease provisioned.
1147
+ - `resolveCredential` turns a lease `credentialRef` into request material.
1148
+ It runs in the witness process, so a secret stays there; a declared
1149
+ `credentialVariant: valid` that cannot resolve fails closed rather than
1150
+ degrading.
1151
+
1152
+ The provider is ENGINE-SIDE code and is the only caller of its own
1153
+ provisioning HTTP calls — the suite never imports it, and nothing it
1154
+ returns can mint evidence, only supply the subjects a case drives. Because
1155
+ of that, a repository should exclude the provider from its product scan
1156
+ scope (`.gateforge.yml` `project.paths.exclude`, matching
1157
+ `classification-policy.yml` `scanRoots`): its calls are fixture
1158
+ provisioning, not application call sites, and scanning them reports the
1159
+ engine's own traffic as unresolved frontend targets. See
1160
+ `example/behavior/fixtures/fixture-provider.mjs` for a working provider.
1161
+
702
1162
  Fail closed: without the key, or when no envelope validates for the
703
1163
  expected context, every witnessed record demotes to claimed-tier
704
1164
  (blocking, never satisfied).