@gate-forge/cli 0.7.1 → 0.9.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.
- package/README.md +91 -704
- package/dist/adapter-audit.d.ts +208 -0
- package/dist/adapter-audit.d.ts.map +1 -0
- package/dist/adapter-audit.js +579 -0
- package/dist/adapter-audit.js.map +1 -0
- package/dist/adapter-scaffold.d.ts +91 -0
- package/dist/adapter-scaffold.d.ts.map +1 -0
- package/dist/adapter-scaffold.js +474 -0
- package/dist/adapter-scaffold.js.map +1 -0
- package/dist/adopted-baseline.d.ts +10 -0
- package/dist/adopted-baseline.d.ts.map +1 -1
- package/dist/adopted-baseline.js +18 -1
- package/dist/adopted-baseline.js.map +1 -1
- package/dist/args.d.ts +15 -0
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +61 -2
- package/dist/args.js.map +1 -1
- package/dist/behavior-setup.d.ts +239 -0
- package/dist/behavior-setup.d.ts.map +1 -0
- package/dist/behavior-setup.js +751 -0
- package/dist/behavior-setup.js.map +1 -0
- package/dist/broker.d.ts.map +1 -1
- package/dist/broker.js +28 -2
- package/dist/broker.js.map +1 -1
- package/dist/cache-exclusions.d.ts +45 -0
- package/dist/cache-exclusions.d.ts.map +1 -0
- package/dist/cache-exclusions.js +205 -0
- package/dist/cache-exclusions.js.map +1 -0
- package/dist/candidate-tree.d.ts +86 -14
- package/dist/candidate-tree.d.ts.map +1 -1
- package/dist/candidate-tree.js +236 -62
- package/dist/candidate-tree.js.map +1 -1
- package/dist/ci-witnessed-template.d.ts +43 -0
- package/dist/ci-witnessed-template.d.ts.map +1 -0
- package/dist/ci-witnessed-template.js +283 -0
- package/dist/ci-witnessed-template.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +31 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/adapters.d.ts +15 -0
- package/dist/commands/adapters.d.ts.map +1 -0
- package/dist/commands/adapters.js +355 -0
- package/dist/commands/adapters.js.map +1 -0
- package/dist/commands/adopt.d.ts +7 -0
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +44 -2
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/baseline.d.ts.map +1 -1
- package/dist/commands/baseline.js +42 -1
- package/dist/commands/baseline.js.map +1 -1
- package/dist/commands/blocking.d.ts +105 -2
- package/dist/commands/blocking.d.ts.map +1 -1
- package/dist/commands/blocking.js +395 -53
- package/dist/commands/blocking.js.map +1 -1
- package/dist/commands/check.d.ts +36 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +1068 -64
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/classify.d.ts +2 -1
- package/dist/commands/classify.d.ts.map +1 -1
- package/dist/commands/classify.js +188 -5
- package/dist/commands/classify.js.map +1 -1
- package/dist/commands/enforce.d.ts +4 -4
- package/dist/commands/enforce.d.ts.map +1 -1
- package/dist/commands/enforce.js +41 -9
- package/dist/commands/enforce.js.map +1 -1
- package/dist/commands/enforcement.d.ts +13 -1
- package/dist/commands/enforcement.d.ts.map +1 -1
- package/dist/commands/enforcement.js +880 -33
- package/dist/commands/enforcement.js.map +1 -1
- package/dist/commands/explain.d.ts +1 -1
- package/dist/commands/explain.d.ts.map +1 -1
- package/dist/commands/explain.js +162 -3
- package/dist/commands/explain.js.map +1 -1
- package/dist/commands/history.d.ts +12 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +45 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/init-presets.d.ts +155 -0
- package/dist/commands/init-presets.d.ts.map +1 -0
- package/dist/commands/init-presets.js +203 -0
- package/dist/commands/init-presets.js.map +1 -0
- package/dist/commands/init.d.ts +7 -12
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +987 -99
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +29 -13
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/next.d.ts.map +1 -1
- package/dist/commands/next.js +846 -19
- package/dist/commands/next.js.map +1 -1
- package/dist/commands/pre-commit.d.ts +25 -0
- package/dist/commands/pre-commit.d.ts.map +1 -1
- package/dist/commands/pre-commit.js +91 -6
- package/dist/commands/pre-commit.js.map +1 -1
- package/dist/commands/quarantine.d.ts +16 -0
- package/dist/commands/quarantine.d.ts.map +1 -0
- package/dist/commands/quarantine.js +213 -0
- package/dist/commands/quarantine.js.map +1 -0
- package/dist/commands/run.d.ts +39 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +196 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/test-gates.d.ts +284 -2
- package/dist/commands/test-gates.d.ts.map +1 -1
- package/dist/commands/test-gates.js +3620 -187
- package/dist/commands/test-gates.js.map +1 -1
- package/dist/commands/tests.d.ts +1 -1
- package/dist/commands/tests.d.ts.map +1 -1
- package/dist/commands/tests.js +264 -29
- package/dist/commands/tests.js.map +1 -1
- package/dist/docs-exclusions.d.ts.map +1 -1
- package/dist/docs-exclusions.js +18 -3
- package/dist/docs-exclusions.js.map +1 -1
- package/dist/endpoint-compiler.d.ts.map +1 -1
- package/dist/endpoint-compiler.js +78 -9
- package/dist/endpoint-compiler.js.map +1 -1
- package/dist/engine-browser.d.ts +183 -0
- package/dist/engine-browser.d.ts.map +1 -0
- package/dist/engine-browser.js +381 -0
- package/dist/engine-browser.js.map +1 -0
- package/dist/engine-identity.d.ts +100 -0
- package/dist/engine-identity.d.ts.map +1 -0
- package/dist/engine-identity.js +182 -0
- package/dist/engine-identity.js.map +1 -0
- package/dist/evaluate.d.ts +105 -1
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +149 -18
- package/dist/evaluate.js.map +1 -1
- package/dist/execution.d.ts +253 -9
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +309 -12
- package/dist/execution.js.map +1 -1
- package/dist/gateforge-owned.d.ts +78 -0
- package/dist/gateforge-owned.d.ts.map +1 -0
- package/dist/gateforge-owned.js +254 -0
- package/dist/gateforge-owned.js.map +1 -0
- package/dist/git-hooks.d.ts +35 -0
- package/dist/git-hooks.d.ts.map +1 -1
- package/dist/git-hooks.js +140 -1
- package/dist/git-hooks.js.map +1 -1
- package/dist/git-ignored.d.ts +27 -0
- package/dist/git-ignored.d.ts.map +1 -0
- package/dist/git-ignored.js +102 -0
- package/dist/git-ignored.js.map +1 -0
- package/dist/git-objects.d.ts +60 -0
- package/dist/git-objects.d.ts.map +1 -0
- package/dist/git-objects.js +152 -0
- package/dist/git-objects.js.map +1 -0
- package/dist/glob.d.ts +33 -14
- package/dist/glob.d.ts.map +1 -1
- package/dist/glob.js +96 -5
- package/dist/glob.js.map +1 -1
- package/dist/history.d.ts +52 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +116 -0
- package/dist/history.js.map +1 -0
- package/dist/host-load.d.ts +49 -0
- package/dist/host-load.d.ts.map +1 -0
- package/dist/host-load.js +78 -0
- package/dist/host-load.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/input-snapshot.d.ts +63 -9
- package/dist/input-snapshot.d.ts.map +1 -1
- package/dist/input-snapshot.js +195 -17
- package/dist/input-snapshot.js.map +1 -1
- package/dist/io.d.ts +49 -0
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +22 -0
- package/dist/io.js.map +1 -1
- package/dist/mapping.d.ts +84 -1
- package/dist/mapping.d.ts.map +1 -1
- package/dist/mapping.js +276 -5
- package/dist/mapping.js.map +1 -1
- package/dist/native-freeze.d.ts +217 -0
- package/dist/native-freeze.d.ts.map +1 -0
- package/dist/native-freeze.js +332 -0
- package/dist/native-freeze.js.map +1 -0
- package/dist/pipeline.d.ts +67 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +164 -6
- package/dist/pipeline.js.map +1 -1
- package/dist/planes-inference.d.ts +12 -5
- package/dist/planes-inference.d.ts.map +1 -1
- package/dist/planes-inference.js +13 -15
- package/dist/planes-inference.js.map +1 -1
- package/dist/playwright-browsers.d.ts +210 -0
- package/dist/playwright-browsers.d.ts.map +1 -0
- package/dist/playwright-browsers.js +364 -0
- package/dist/playwright-browsers.js.map +1 -0
- package/dist/plugins.d.ts +15 -5
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +59 -9
- package/dist/plugins.js.map +1 -1
- package/dist/progress.d.ts +148 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +263 -0
- package/dist/progress.js.map +1 -0
- package/dist/providers.d.ts +26 -1
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +39 -0
- package/dist/providers.js.map +1 -1
- package/dist/receipts.d.ts +1 -0
- package/dist/receipts.d.ts.map +1 -1
- package/dist/receipts.js +35 -7
- package/dist/receipts.js.map +1 -1
- package/dist/repo-scan.d.ts +15 -1
- package/dist/repo-scan.d.ts.map +1 -1
- package/dist/repo-scan.js +329 -34
- package/dist/repo-scan.js.map +1 -1
- package/dist/reseal-chain.d.ts +184 -0
- package/dist/reseal-chain.d.ts.map +1 -0
- package/dist/reseal-chain.js +735 -0
- package/dist/reseal-chain.js.map +1 -0
- package/dist/reseal-evidence.d.ts +241 -0
- package/dist/reseal-evidence.d.ts.map +1 -0
- package/dist/reseal-evidence.js +319 -0
- package/dist/reseal-evidence.js.map +1 -0
- package/dist/reseal.d.ts +181 -0
- package/dist/reseal.d.ts.map +1 -0
- package/dist/reseal.js +1620 -0
- package/dist/reseal.js.map +1 -0
- package/dist/response-field-guidance.d.ts +82 -0
- package/dist/response-field-guidance.d.ts.map +1 -0
- package/dist/response-field-guidance.js +184 -0
- package/dist/response-field-guidance.js.map +1 -0
- package/dist/route-plane-proposals.d.ts +100 -0
- package/dist/route-plane-proposals.d.ts.map +1 -0
- package/dist/route-plane-proposals.js +213 -0
- package/dist/route-plane-proposals.js.map +1 -0
- package/dist/run-cache.d.ts +260 -0
- package/dist/run-cache.d.ts.map +1 -0
- package/dist/run-cache.js +771 -0
- package/dist/run-cache.js.map +1 -0
- package/dist/run-preflight.d.ts +77 -0
- package/dist/run-preflight.d.ts.map +1 -0
- package/dist/run-preflight.js +774 -0
- package/dist/run-preflight.js.map +1 -0
- package/dist/run-recipe.d.ts +107 -0
- package/dist/run-recipe.d.ts.map +1 -0
- package/dist/run-recipe.js +295 -0
- package/dist/run-recipe.js.map +1 -0
- package/dist/run-reliability.d.ts +126 -0
- package/dist/run-reliability.d.ts.map +1 -0
- package/dist/run-reliability.js +221 -0
- package/dist/run-reliability.js.map +1 -0
- package/dist/runtime.d.ts +15 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +11 -1
- package/dist/runtime.js.map +1 -1
- package/dist/scope.d.ts +20 -0
- package/dist/scope.d.ts.map +1 -1
- package/dist/scope.js +26 -5
- package/dist/scope.js.map +1 -1
- package/dist/secret-guard.d.ts +36 -0
- package/dist/secret-guard.d.ts.map +1 -0
- package/dist/secret-guard.js +63 -0
- package/dist/secret-guard.js.map +1 -0
- package/dist/singleton-guidance.d.ts +82 -0
- package/dist/singleton-guidance.d.ts.map +1 -0
- package/dist/singleton-guidance.js +138 -0
- package/dist/singleton-guidance.js.map +1 -0
- package/dist/staged-candidate.d.ts +17 -0
- package/dist/staged-candidate.d.ts.map +1 -1
- package/dist/staged-candidate.js +50 -0
- package/dist/staged-candidate.js.map +1 -1
- package/dist/state-artifacts.d.ts +70 -0
- package/dist/state-artifacts.d.ts.map +1 -0
- package/dist/state-artifacts.js +215 -0
- package/dist/state-artifacts.js.map +1 -0
- package/dist/state.d.ts +170 -2
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +248 -8
- package/dist/state.js.map +1 -1
- package/dist/unmatched-routes.d.ts +60 -0
- package/dist/unmatched-routes.d.ts.map +1 -0
- package/dist/unmatched-routes.js +131 -0
- package/dist/unmatched-routes.js.map +1 -0
- package/dist/verifier-keys.d.ts +33 -2
- package/dist/verifier-keys.d.ts.map +1 -1
- package/dist/verifier-keys.js +95 -9
- package/dist/verifier-keys.js.map +1 -1
- package/guides/CONNECT-YOUR-PROJECT.md +425 -0
- package/guides/QUICKSTART.md +306 -26
- package/guides/REFERENCE.md +1710 -0
- package/guides/RUNNER-NEUTRAL-EVIDENCE.md +199 -0
- package/guides/TEST-ENVIRONMENT.md +1044 -6
- package/guides/UPGRADE-0.6-to-0.7.md +3 -3
- package/guides/UPGRADE-0.7-to-0.8.md +114 -0
- package/guides/UPGRADE-0.8-to-0.9.md +104 -0
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -4,13 +4,37 @@ 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.9.0 vs. published 0.8.0:** `check --staged` reads the staged bytes, the scan skips untracked gitignored files (receipt identity unchanged), Gateforge's own setup files are policy inputs so the setup commit passes with the policy digest pinned, test-directory models stay out of the graph, per-tenant singletons are tagged only on an exact configured scope, `init` asks one plane question per route folder, `classify plane` takes a folder, `--docs-exclude-file`, `init --behavior`, `explain <path>`, ranked and capped `tests suggest`, `FASTAPI_ROUTER_UNMOUNTED` / `HTTP_METHOD_DYNAMIC` / `ENDPOINT_RESOURCE_CANDIDATE_UNMATCHED` / folded FastAPI prefixes, and no `.pyc` in a published tarball. Upgrading: [UPGRADE-0.8-to-0.9](guides/UPGRADE-0.8-to-0.9.md).
|
|
8
|
+
|
|
9
|
+
**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).
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
Install the CLI, the Playwright pack, and only the detector packs
|
|
14
|
+
that fit your app. Keep every direct `@gate-forge/*` package on
|
|
15
|
+
the same release:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm i -D @gate-forge/cli @gate-forge/pack-playwright
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
You need Node.js 20 or newer. Use the project-local `gateforge`
|
|
22
|
+
binary from your npm script, or add `node_modules/.bin` to your
|
|
23
|
+
shell `PATH`. The scan recommends the packs your code uses; a
|
|
24
|
+
mismatched Gateforge package contract stops the CLI with exit code
|
|
25
|
+
2 and `GATEFORGE_PACKAGE_INCOMPATIBLE`. The full walkthrough,
|
|
26
|
+
including tarball installs: [Quickstart](guides/QUICKSTART.md).
|
|
8
27
|
|
|
9
28
|
## Start here
|
|
10
29
|
|
|
11
30
|
- [Quickstart](guides/QUICKSTART.md)
|
|
12
31
|
- [Test environment](guides/TEST-ENVIRONMENT.md)
|
|
32
|
+
- [Upgrade from 0.8 to 0.9](guides/UPGRADE-0.8-to-0.9.md)
|
|
33
|
+
- [Upgrade from 0.7 to 0.8](guides/UPGRADE-0.7-to-0.8.md)
|
|
13
34
|
- [Upgrade from 0.6 to 0.7](guides/UPGRADE-0.6-to-0.7.md)
|
|
35
|
+
- [Runners other than Playwright](guides/RUNNER-NEUTRAL-EVIDENCE.md)
|
|
36
|
+
- [Connect your project](guides/CONNECT-YOUR-PROJECT.md)
|
|
37
|
+
- [Reference](guides/REFERENCE.md) — every command, flag, exit code, and protocol
|
|
14
38
|
|
|
15
39
|
Also at https://github.com/umiddey/gateforge/tree/main/packages/cli/guides.
|
|
16
40
|
|
|
@@ -19,6 +43,40 @@ Just added a new table or endpoint and the gate is blocking? Run
|
|
|
19
43
|
next action. New proof tests go in `tests/e2e/gateforge/` (overlay);
|
|
20
44
|
never rewrite existing journeys, never `tests mark` as proof.
|
|
21
45
|
|
|
46
|
+
## First commands
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
gateforge init # scan the repo and write the standard scaffold
|
|
50
|
+
gateforge next # the ONE blocking next action — run this after any change
|
|
51
|
+
gateforge check # the full gate: discover → classify → obligations → verdicts
|
|
52
|
+
gateforge test-gates --changed # supervise the changed tests and seal an authenticated receipt
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The four commands a repository needs, with their full reference rows:
|
|
56
|
+
|
|
57
|
+
| Command | Purpose | Exit codes |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| `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,...>] [--docs-exclude-file <path>] [--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. It also appends Gateforge's own engine state (`.gateforge/test-gates/`) to `.gitignore`, and on a repository that already has code it names `gateforge adopt` as the way through the debt the first commit will meet. `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 `undo:` lines for created and in-place-changed files; `--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 |
|
|
60
|
+
| `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 |
|
|
61
|
+
| `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 |
|
|
62
|
+
| `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) |
|
|
63
|
+
|
|
64
|
+
Every other command — `discover`, `classify`, `explain`,
|
|
65
|
+
`obligations`, the `tests` workflow (`discover` → `suggest` →
|
|
66
|
+
`sync`/`mark` → run), `tests diagnose`, `broker commit`,
|
|
67
|
+
`enforcement doctor`, `baseline`, the key ceremony, and every
|
|
68
|
+
flag — is documented in the [Reference](guides/REFERENCE.md).
|
|
69
|
+
|
|
70
|
+
To re-confirm a handful of hand-picked tests, `--test` names them
|
|
71
|
+
and the run is witnessed exactly like a full gate run:
|
|
72
|
+
`gateforge test-gates --test <selector> --result-only` (repeatable,
|
|
73
|
+
accepted only with `--result-only`, never seals a receipt).
|
|
74
|
+
|
|
75
|
+
Global flags: `--help`, `--version`. Exit codes per architecture contract 4:
|
|
76
|
+
`0` clean/waived, `1` unresolved obligations (or a failed/supervision-blocked
|
|
77
|
+
run), `2` config/usage error. `tests diagnose` has its own advisory contract
|
|
78
|
+
(0/1/2 above).
|
|
79
|
+
|
|
22
80
|
## Proof paths
|
|
23
81
|
|
|
24
82
|
- **Overlay (default).** New thin tests in `tests/e2e/gateforge/` using
|
|
@@ -40,699 +98,17 @@ never rewrite existing journeys, never `tests mark` as proof.
|
|
|
40
98
|
- **`tests mark` is intent, never proof.** A mapped test with no
|
|
41
99
|
witnessed evidence grades `EVIDENCE_NOT_COLLECTED` — blocking.
|
|
42
100
|
|
|
43
|
-
##
|
|
44
|
-
|
|
45
|
-
| Command | Purpose | Exit codes |
|
|
46
|
-
| --- | --- | --- |
|
|
47
|
-
| `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 |
|
|
48
|
-
| `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 |
|
|
49
|
-
| `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 |
|
|
50
|
-
| `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 |
|
|
51
|
-
| `gateforge explain <resourceId> [--json]` | Show one resource's detector signals, classification rules, decision fingerprint, typed blocks, and generated obligations. | 0/1/2 |
|
|
52
|
-
| `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 |
|
|
53
|
-
| `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 |
|
|
54
|
-
| `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 |
|
|
55
|
-
| `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) |
|
|
56
|
-
| `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 |
|
|
57
|
-
| `gateforge obligations [--json]` | Evaluate policies against the automatically classified graph and dump obligations, blocking entries, and claim assessments. | 0/1/2 |
|
|
58
|
-
| `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 |
|
|
59
|
-
| `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) |
|
|
60
|
-
| `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 |
|
|
61
|
-
| `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 |
|
|
62
|
-
| `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 |
|
|
63
|
-
| `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 |
|
|
64
|
-
| `gateforge baseline update <fp...>` | Shrink the baseline to a strict subset (invariant 4). | 0/2 |
|
|
65
|
-
|
|
66
|
-
Global flags: `--help`, `--version`. Exit codes per architecture contract 4:
|
|
67
|
-
`0` clean/waived, `1` unresolved obligations (or a failed/supervision-blocked
|
|
68
|
-
run), `2` config/usage error. `tests diagnose` has its own advisory contract
|
|
69
|
-
(0/1/2 above).
|
|
70
|
-
|
|
71
|
-
### Result-only with an external witness
|
|
72
|
-
|
|
73
|
-
Start the witness with a dedicated state directory, then pass that same
|
|
74
|
-
directory and its run token to `test-gates`. The directory must be separate
|
|
75
|
-
from the configured authoritative `.gateforge/test-gates` directory:
|
|
76
|
-
|
|
77
|
-
```sh
|
|
78
|
-
gateforge test-gates --changed --scope changed --result-only \
|
|
79
|
-
--witness-url "$GATEFORGE_WITNESS_URL" \
|
|
80
|
-
--out "$GATEFORGE_STATE_DIR" \
|
|
81
|
-
--run-token "$GATEFORGE_RUN_TOKEN"
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
`test-gates` claim planning reads current Playwright annotations using a
|
|
85
|
-
disposable `GATEFORGE_STATE_DIR`, plus the tracked `test-map.yml`. It never
|
|
86
|
-
treats a previous run's `claims.json` as a declaration source.
|
|
87
|
-
|
|
88
|
-
The report remains `authority: non-authoritative`. The external-witness
|
|
89
|
-
state may contain this run's report and attestation, but this command never
|
|
90
|
-
creates, replaces, or clears a gate receipt. Pre-commit, hook, and CI gate
|
|
91
|
-
paths remain authoritative and do not accept `--result-only`.
|
|
92
|
-
|
|
93
|
-
## Staged runtime (`.gateforge/runtime.yml`)
|
|
94
|
-
|
|
95
|
-
`gateforge pre-commit` executes the candidate inside a materialized checkout
|
|
96
|
-
that contains TRACKED bytes only — no installed dependencies, no built
|
|
97
|
-
assets, no application processes. The reviewed staged-runtime document
|
|
98
|
-
declares how that checkout becomes a runnable candidate. It is
|
|
99
|
-
security-sensitive: its bytes are hashed into the trusted policy digest and
|
|
100
|
-
the authenticated input snapshot, so a candidate that edits its own runtime
|
|
101
|
-
commands cannot approve the edit in the same commit.
|
|
102
|
-
|
|
103
|
-
```yaml
|
|
104
|
-
schemaVersion: 1
|
|
105
|
-
prepare:
|
|
106
|
-
command: npm ci --offline # or pnpm/bun/uv — frozen install, build steps
|
|
107
|
-
reuse: [node_modules] # dependency dirs EXPLICITLY allowed to link from the user repo
|
|
108
|
-
timeoutSeconds: 600
|
|
109
|
-
services: # candidate-owned app/database/worker processes
|
|
110
|
-
- id: app
|
|
111
|
-
command: node server.js --port ${service:app:port}
|
|
112
|
-
attested: true # fronted by the gate's attestation proxy
|
|
113
|
-
fingerprint: prod-v1 # GF-13 marker (reviewed adapters must declare the same)
|
|
114
|
-
target: true # this proxy URL becomes the run's attested target
|
|
115
|
-
ready: { log: 'listening on', timeoutSeconds: 60 } # or http: <url>
|
|
116
|
-
envAllowlist: [DATABASE_URL] # operator env names allowed through to children
|
|
117
|
-
executionTimeoutSeconds: 1800 # whole-run budget handed to the supervised gate
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Contract highlights:
|
|
121
|
-
|
|
122
|
-
- Services start from the CHECKOUT bytes (never the worktree) in their own
|
|
123
|
-
process groups; readiness (`log` regex or `http` 2xx), startup, and
|
|
124
|
-
execution timeouts are bounded; stdout/stderr are captured to
|
|
125
|
-
`<run-state>/runtime/<id>.log`; teardown happens on success, failure,
|
|
126
|
-
timeout, and interruption (SIGINT/SIGTERM kill the whole groups).
|
|
127
|
-
- Every `prepare.reuse` tree is constrained to a normalized repository-relative
|
|
128
|
-
path. Its reachable dependency bytes are hashed into the authenticated
|
|
129
|
-
input identity, so changing an ignored reused dependency invalidates the
|
|
130
|
-
receipt even though the checkout uses a link.
|
|
131
|
-
- `${service:<id>:port}` / `${service:<id>:url}` placeholders are
|
|
132
|
-
substituted by the supervisor and injected into every service's
|
|
133
|
-
environment (`GATEFORGE_SERVICE_PORT_<ID>` / `GATEFORGE_SERVICE_URL_<ID>`).
|
|
134
|
-
- The attested target is the process THE GATE started from the frozen
|
|
135
|
-
candidate — a bare target URL proves nothing. The receipt binds the raw-
|
|
136
|
-
ingested tree of the prepared checkout (`targetArtifactDigest`), and the
|
|
137
|
-
user's index is rechecked before authorization.
|
|
138
|
-
- ABSENT document = no bridge, no services (fail closed): discovery that
|
|
139
|
-
needs installed dependencies blocks honestly instead of silently reusing
|
|
140
|
-
the worktree's environment.
|
|
141
|
-
|
|
142
|
-
## Existing-test reuse (`gateforge tests`)
|
|
143
|
-
|
|
144
|
-
The reuse-first workflow: inspect what exists, declare what is unclear, run
|
|
145
|
-
it, and add a new test only for a confirmed behavior gap. The fixed agent
|
|
146
|
-
sequence is: `tests discover` → `tests suggest` → `tests mark` (or edit the
|
|
147
|
-
sidecar directly) → run the suite under supervision → `check --require-e2e`.
|
|
148
|
-
|
|
149
|
-
`tests discover` writes the catalog to `.gateforge/test-gates/test-catalog.json`
|
|
150
|
-
— a DERIVED artifact under the excluded run-state directory, never a pipeline
|
|
151
|
-
input and never beside the tests it inventories. Logical keys are stable
|
|
152
|
-
(`playwright:<project>:<file>:<title path>`; `-` when the runner has no
|
|
153
|
-
project) so manual mappings survive comment edits; source digests still move,
|
|
154
|
-
so old evidence goes stale. Renamed/deleted tests and removed parameters
|
|
155
|
-
surface as stale or ambiguous mappings — never a silent reassignment.
|
|
156
|
-
|
|
157
|
-
`tests mark` validates the declaration against the current catalog AND the
|
|
158
|
-
current obligation registry (an unknown obligation id or test key is a
|
|
159
|
-
precise exit-2 error) before writing `.gateforge/test-map.yml`:
|
|
160
|
-
|
|
161
|
-
```yaml
|
|
162
|
-
schemaVersion: 1
|
|
163
|
-
tests:
|
|
164
|
-
- key: playwright:chromium:e2e/accounts.spec.ts:deletes an account
|
|
165
|
-
selector:
|
|
166
|
-
runner: playwright
|
|
167
|
-
project: chromium
|
|
168
|
-
file: e2e/accounts.spec.ts
|
|
169
|
-
titlePath: [Accounts, deletes an account]
|
|
170
|
-
kind: browser-e2e
|
|
171
|
-
categories: [persistence.delete]
|
|
172
|
-
claims: [tenant.accounts:persistence:delete]
|
|
173
|
-
reason: Existing journey deletes the selected account.
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
`--kind` is one of `browser-e2e`, `observed-e2e`, `api-e2e`, `unit`, `integration`,
|
|
177
|
-
`component`, `unknown`. A declaration is INTENT, never proof:
|
|
178
|
-
|
|
179
|
-
- Native `{ type: 'gateforge', description: '<obligation id>' }` annotations
|
|
180
|
-
keep working; sidecar entries and native claims normalize through ONE
|
|
181
|
-
resolver. Exact duplicate claims deduplicate; contradictions block with
|
|
182
|
-
both source locations (`TEST_MAPPING_AMBIGUOUS`).
|
|
183
|
-
- An explicit kind may resolve `unknown` — and `observed-e2e` may refine an
|
|
184
|
-
inferred `browser-e2e` (same journey, witness-watched instead of
|
|
185
|
-
engine-driven) — but cannot override observed mocking or any other
|
|
186
|
-
strong code-signal inference — `tests mark` refuses with
|
|
187
|
-
both locations instead of writing the file.
|
|
188
|
-
- Agents may edit the sidecar directly; both paths receive identical
|
|
189
|
-
validation. `mark` is idempotent: re-running an exact declaration writes
|
|
190
|
-
nothing and reports `no changes`.
|
|
191
|
-
- Nothing here waives, weakens, or satisfies anything: a mapped test with no
|
|
192
|
-
witnessed evidence for this change grades `EVIDENCE_NOT_COLLECTED` —
|
|
193
|
-
blocking.
|
|
194
|
-
|
|
195
|
-
`tests suggest` emits `newTestNeeded: true` only when no suitable existing
|
|
196
|
-
candidate survives resolution. An unsupported proof channel produces a
|
|
197
|
-
capability task (`VERIFIER_UNSUPPORTED`), never a request to generate more
|
|
198
|
-
tests.
|
|
199
|
-
|
|
200
|
-
## Advisory pytest diagnostics
|
|
201
|
-
|
|
202
|
-
Register existing pytest suites under `diagnostics.suites` in
|
|
203
|
-
`.gateforge.yml` (explicit, tracked configuration — gateforge never scans
|
|
204
|
-
directories or executes commands on its own; only the `pytest` runner has an
|
|
205
|
-
adapter today):
|
|
206
|
-
|
|
207
|
-
```yaml
|
|
208
|
-
diagnostics:
|
|
209
|
-
suites:
|
|
210
|
-
- name: backend-pytest
|
|
211
|
-
runner: pytest
|
|
212
|
-
cwd: server
|
|
213
|
-
argv: [python, -m, pytest]
|
|
214
|
-
testPaths: [tests]
|
|
215
|
-
timeoutMs: 600000
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
`gateforge tests diagnose` runs each configured suite once against the
|
|
219
|
-
current inputs (drift around discovery refuses the run) and prints a SEPARATE
|
|
220
|
-
diagnostic report with `DIAGNOSTIC_TEST_FAILURE` /
|
|
221
|
-
`DIAGNOSTIC_RUN_INCOMPLETE` / `DIAGNOSTIC_RESULT_STALE` causes. Skips and
|
|
222
|
-
expected failures stay explicit counters; a run of only skipped/xfail cases
|
|
223
|
-
is INCOMPLETE (exit 2), never a passing alarm. Diagnostic results are never
|
|
224
|
-
fed into claims, witness records, baselines, waivers, or E2E satisfaction,
|
|
225
|
-
and are never merged into E2E pass counts — 100 passing pytest tests do not
|
|
226
|
-
clear one missing browser obligation. When the supervised run executes the
|
|
227
|
-
same suites, their results are displayed separately without changing the E2E
|
|
228
|
-
exit decision.
|
|
229
|
-
|
|
230
|
-
## Enforcement
|
|
231
|
-
|
|
232
|
-
Two named modes (ADR 0005 D1); the CLI never reports a hook as more than it
|
|
233
|
-
is.
|
|
234
|
-
|
|
235
|
-
**Standard mode** — an active local hook PLUS a mandatory trusted server
|
|
236
|
-
check:
|
|
237
|
-
|
|
238
|
-
- `gateforge init --blocking` installs the pre-commit hook into the resolved
|
|
239
|
-
hooks directory (`core.hooksPath` honored), verifies activation (exec bit +
|
|
240
|
-
a verified `--gateforge-verify` invocation), and writes a standalone
|
|
241
|
-
staged-gate script (`.gateforge/hooks/gateforge-staged.sh`) for consumers
|
|
242
|
-
with a foreign hook manager. The hook runs `gateforge check --staged
|
|
243
|
-
--require-e2e`; a missing engine blocks (fail closed). Idempotent — an
|
|
244
|
-
existing gateforge-owned hook is verified, never rewritten.
|
|
245
|
-
- The same `init --blocking` run writes `.gateforge/ci/gitlab-gateforge.yml`
|
|
246
|
-
plus the `.gitlab-ci.yml` include — the SERVER-side strict gate (pinned
|
|
247
|
-
engine, `test-gates --changed` receipt seal, `check --changed
|
|
248
|
-
--require-e2e`), with the required server-side settings documented in the
|
|
249
|
-
template header:
|
|
250
|
-
"Pipelines must succeed" (skipped ≠ successful), protected branches
|
|
251
|
-
excluding the agent role from direct pushes, and an organization-controlled
|
|
252
|
-
pipeline execution policy so a candidate cannot delete the gate job. THE
|
|
253
|
-
HONEST LIMIT: `--no-verify`, an alternate `core.hooksPath`, direct
|
|
254
|
-
plumbing, or an unrelated clone bypass any local hook — keeping bypassed
|
|
255
|
-
commits out of protected history is the server's job, not the hook's.
|
|
256
|
-
- The CI template checks that the installed `@gate-forge/cli` version equals
|
|
257
|
-
the version that generated it. Add that exact version as a root
|
|
258
|
-
`devDependency`. The template uses a package-manager lockfile when present;
|
|
259
|
-
without one, it installs from the manifest. Set
|
|
260
|
-
`GATEFORGE_CI_NESTED_PACKAGE_DIRS` to a space-separated list such as `e2e`
|
|
261
|
-
when the Playwright config imports dependencies from nested packages.
|
|
262
|
-
`enforce` and `adopt` use the same install and version checks, then run the
|
|
263
|
-
static `check --changed` gate. They do not recommend gating on report counts.
|
|
264
|
-
- A generated hook uses `GATEFORGE_DEV_ENGINE` when set, then the
|
|
265
|
-
repository-pinned CLI, `.gateforge/engine`, and `GATEFORGE_CLI`. A global
|
|
266
|
-
`gateforge` on `PATH` is a last-resort fallback with a warning.
|
|
267
|
-
- `check --staged [--require-e2e]` gates the EXACT staged bytes: the index
|
|
268
|
-
tree is frozen, materialized into an isolated scratch checkout, and the
|
|
269
|
-
regular gate runs against those bytes (never the worktree). The candidate
|
|
270
|
-
is re-checked after the gate — any index/HEAD drift during the run is a
|
|
271
|
-
typed `ENFORCEMENT_UNTRUSTED` block. Partial staging is fine; symlinks,
|
|
272
|
-
submodules, and unmerged index entries are typed blocks, never fallbacks.
|
|
273
|
-
- `check --changed --require-e2e` is the CI-side strict gate over the checked-
|
|
274
|
-
out candidate.
|
|
275
|
-
- `--strict-e2e` (config `enforcement.strictE2E`) makes waived or baselined
|
|
276
|
-
in-scope E2E obligations NOT proof (they block with `ENFORCEMENT_UNTRUSTED`
|
|
277
|
-
— no automatic debt forgiveness), and blocks unclassified changed files as
|
|
278
|
-
`CHANGE_UNMAPPED` until a resolved mapping covers them. Candidate edits to
|
|
279
|
-
policies, classification, adapters, waivers, baselines, or the mapping
|
|
280
|
-
sidecar cannot authorize weaker checks: gates evaluate under the trusted
|
|
281
|
-
policy digest, so a weakened candidate fails closed until a separate
|
|
282
|
-
trusted update is accepted.
|
|
283
|
-
|
|
284
|
-
**Receipts (the strict saved-state gate).** `check --require-e2e` accepts
|
|
285
|
-
only an authenticated gate receipt sealed by a COMPLETE supervised run for
|
|
286
|
-
the current input digest and trusted policy digest:
|
|
287
|
-
|
|
288
|
-
- no receipt (old record bundles included) → `RUN_INCOMPLETE`;
|
|
289
|
-
- receipt for different bytes/inputs → `EVIDENCE_STALE` (rerun for the
|
|
290
|
-
exact candidate);
|
|
291
|
-
- forged/tampered receipt → `ENFORCEMENT_UNTRUSTED`.
|
|
292
|
-
|
|
293
|
-
`test-gates --changed` seals a receipt only after planned-vs-executed
|
|
294
|
-
completeness, evidence grading, and a successful runner exit: zero selected
|
|
295
|
-
tests, skips, `.only`, retries, teardown failures, and incomplete shards all
|
|
296
|
-
fail the run. Identical authenticated inputs may reuse a prior receipt
|
|
297
|
-
(printed as `reused receipt <id>`); any changed input forces a fresh run.
|
|
298
|
-
Without the verifier key in the trusted environment nothing can be sealed
|
|
299
|
-
and `--require-e2e` blocks — it never downgrades to a weaker pass.
|
|
300
|
-
|
|
301
|
-
**Owner-declared documentation exclusions (explicit trust mode).** By default,
|
|
302
|
-
Gateforge hashes all inputs and all candidate files. On a terminal, the first
|
|
303
|
-
`gateforge init` asks for documentation-only folders to exclude. Automation can
|
|
304
|
-
use `gateforge init --docs-exclude docs,handbook`; a non-interactive run with no
|
|
305
|
-
option keeps the default. Gateforge writes the approved declaration to
|
|
306
|
-
`.gateforge/docs-exclusions.yml` and prints the candidate trusted-policy digest
|
|
307
|
-
to approve through the protected `GATEFORGE_APPROVED_POLICY_DIGEST` setting.
|
|
308
|
-
Gate checks refuse to use the exclusions until that external pin matches. A
|
|
309
|
-
later change to the exclusion declaration changes the digest; use
|
|
310
|
-
`--confirm-doc-exclusions` when `init` changes an existing approval.
|
|
311
|
-
|
|
312
|
-
The project states these folders do not affect the product or its tests.
|
|
313
|
-
Gateforge does not prove this. If application or test code reads an excluded
|
|
314
|
-
file, a later edit can make old evidence look valid without running the tests
|
|
315
|
-
again. Reports show the approved folders, pin identity, and this reduced
|
|
316
|
-
guarantee. Gateforge rejects exclusions that contain configured scan inputs,
|
|
317
|
-
source files, gate or trust metadata, manifests, lockfiles, or symlinks.
|
|
318
|
-
Every file must also use a supported document or raster-image format. MDX,
|
|
319
|
-
WASM, SVG, HTML, and unknown formats fail closed. This format allowlist does
|
|
320
|
-
not prove that an allowed file cannot affect application or test behavior;
|
|
321
|
-
the project assertion and its reduced guarantee still apply.
|
|
322
|
-
|
|
323
|
-
**Managed mode** (config `enforcement.mode: managed`) — the literal
|
|
324
|
-
no-bypass guarantee requires putting the authoritative Git metadata, commit
|
|
325
|
-
service, gate executable, policy authority, and signing material OUTSIDE the
|
|
326
|
-
agent's write/process boundary. `gateforge broker commit` ships the
|
|
327
|
-
MECHANISM — verify a receipt for the exact workspace bytes, then commit via
|
|
328
|
-
compare-and-swap ref update — not the deployment. Running the broker inside
|
|
329
|
-
the agent's own boundary provides NO managed guarantee.
|
|
330
|
-
`gateforge enforcement doctor` reports which boundary is actually active:
|
|
331
|
-
hook activation, runner/browser readiness, capability availability, trusted
|
|
332
|
-
binary/policy ownership, snapshot mode, and — in managed mode — an
|
|
333
|
-
agent-writable authoritative Git directory is a `fail`, never a pass.
|
|
334
|
-
|
|
335
|
-
## Contract capabilities
|
|
336
|
-
|
|
337
|
-
What the engine can grade today (single source of truth: the core capability
|
|
338
|
-
registry; `init --strict-e2e` preflight rejects setups that require anything
|
|
339
|
-
else):
|
|
340
|
-
|
|
341
|
-
| Namespace | Status |
|
|
342
|
-
| --- | --- |
|
|
343
|
-
| `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) |
|
|
344
|
-
| `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 |
|
|
345
|
-
| `http:frontend-request-observed` | UNAVAILABLE — no independent browser/test attribution channel; grades blocking `missing` before examining evidence |
|
|
346
|
-
| `crud:*` (UI-semantic) | FAIL-CLOSED — the tested suite owns the browser; use `persistence:*` |
|
|
347
|
-
| `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 |
|
|
348
|
-
| `auth:*`, `validation:*` | AVAILABLE (behavior-case channel) — same required-case aggregation over engine-controlled requests with independent state scopes |
|
|
349
|
-
| `task:*`, `webhook:*`, `workflow:*` | UNSUPPORTED — every contract fail-closed; surfaces as `VERIFIER_UNSUPPORTED` (remove the contract or drop the pack; do not add tests) |
|
|
350
|
-
|
|
351
|
-
Unsupported proof stays blocking. Nothing silently replaces browser proof
|
|
352
|
-
with HTTP status proof.
|
|
353
|
-
|
|
354
|
-
## Configuration
|
|
355
|
-
|
|
356
|
-
`.gateforge.yml` is loaded fail-closed from the working directory (the repo
|
|
357
|
-
root); see `@gate-forge/core` for the pinned schema. All paths are
|
|
358
|
-
repo-root-relative. `changed.provider: auto` (the default) picks
|
|
359
|
-
`github-pr` when `GITHUB_BASE_REF` is set, `gitlab-mr` when
|
|
360
|
-
`CI_MERGE_REQUEST_DIFF_BASE_SHA` is set, else `local-staged`
|
|
361
|
-
(`git diff --cached --name-only`). `clock.mode: fixed` freezes the run
|
|
362
|
-
instant for deterministic reports; `system` (default) freezes it at run
|
|
363
|
-
start.
|
|
364
|
-
|
|
365
|
-
Enforcement-relevant sections:
|
|
366
|
-
|
|
367
|
-
- `enforcement:` — `mode: standard | managed` (default `standard`) and
|
|
368
|
-
`strictE2E: boolean` (default `false`); see Enforcement above.
|
|
369
|
-
- `coveragePolicy:` (opt-in, fail closed) — the closed-world CRUD coverage
|
|
370
|
-
policy: enumerated user-facing tables (validated against the run's
|
|
371
|
-
resource inventory on EVERY run — an unknown table name is a config error,
|
|
372
|
-
a silently dropped inventory table is a violation), required operations,
|
|
373
|
-
and owner dispositions (`read-only-surface`, `admin-plane-unreachable`,
|
|
374
|
-
`not-user-facing`, `other`, with a note). With the policy enabled, an
|
|
375
|
-
uncovered, undispositioned required operation blocks with
|
|
376
|
-
`CRUD_COVERAGE_MISSING`. Recording or approving a disposition is a
|
|
377
|
-
trusted-policy act — the policy participates in the trusted policy
|
|
378
|
-
revision, so an agent edit never self-approves.
|
|
379
|
-
- `diagnostics.suites:` — the advisory pytest suites (see above).
|
|
380
|
-
|
|
381
|
-
## Plugin invocation
|
|
382
|
-
|
|
383
|
-
Every configured plugin runs over the same expanded include path list
|
|
384
|
-
(`project.paths.include` minus `exclude`; `.git` and `node_modules` are
|
|
385
|
-
never scanned):
|
|
386
|
-
|
|
387
|
-
- **subprocess** (GPP/3): `command` argv is spawned via
|
|
388
|
-
`@gate-forge/plugin-protocol`'s `PluginSession` — pinned handshake, one
|
|
389
|
-
lock-step `discover`, shutdown handshake, fail-closed on any protocol
|
|
390
|
-
violation. Plugins run without network.
|
|
391
|
-
- **in-process**: `module` is dynamically imported and its *default
|
|
392
|
-
export* must provide `discover(paths)` returning
|
|
393
|
-
`{resources, unresolved, findings}` in the pinned discovery shape.
|
|
394
|
-
Relative module specifiers resolve against the repo root; the result is
|
|
395
|
-
schema-validated and fails closed on invalid output.
|
|
396
|
-
|
|
397
|
-
The plugin's `discover` receives repo-relative file paths; in-process
|
|
398
|
-
plugins resolve them against the process working directory, which for a
|
|
399
|
-
CLI run is the repo root.
|
|
400
|
-
|
|
401
|
-
## Endpoint plane rules (`.gateforge/planes.json`)
|
|
402
|
-
|
|
403
|
-
The same declarative plane document the packs apply to business tables
|
|
404
|
-
also carries endpoint-plane evidence. It is consumed by the endpoint
|
|
405
|
-
compiler (the pipeline stage that builds `http.endpoint` resources) with
|
|
406
|
-
the same strict reader, the same schema
|
|
407
|
-
(`{ rules: [{ match?, tables?, plane, reason }] }`), and the same
|
|
408
|
-
fail-closed posture.
|
|
409
|
-
|
|
410
|
-
**Endpoint plane rules are explicit human declarations keyed on the
|
|
411
|
-
router SOURCE FILE path — not automatic filename inference.** The config
|
|
412
|
-
IS the documented evidence (mirroring the classification policy's
|
|
413
|
-
declaration channels): a rule whose `match` glob (repo-root-relative,
|
|
414
|
-
posix, core classifier glob semantics) matches an endpoint's router file
|
|
415
|
-
asserts that endpoint's `plane` (`tenant` | `master` | `global`) with a
|
|
416
|
-
required non-empty `reason` as the review artifact. `tables` rules never
|
|
417
|
-
apply to endpoints — endpoints carry no table identity.
|
|
418
|
-
|
|
419
|
-
Evaluation per endpoint, deterministic and fail closed:
|
|
420
|
-
|
|
421
|
-
- **All matching rules agree** → the plane is applied as a plane-dimension
|
|
422
|
-
declaration signal (`gateforge.endpoint-compiler:config`), the same
|
|
423
|
-
evidence channel the classifier's inheritance pass uses, so the graph
|
|
424
|
-
qualifies the endpoint id as `plane.<name>`.
|
|
425
|
-
- **Matching rules disagree** → a blocking `PLANE_RULE_CONTRADICTION`
|
|
426
|
-
entry is emitted (the required `reason` of each matching rule rides the
|
|
427
|
-
diagnostic) and NO plane is applied — never first-match-wins.
|
|
428
|
-
- **No rule matches** → no evidence; the endpoint stays on the existing
|
|
429
|
-
channels (linked-resource inheritance, operational `global`, else
|
|
430
|
-
`PLANE_UNRESOLVED`).
|
|
431
|
-
|
|
432
|
-
Interaction with the other plane channels: the config plane participates
|
|
433
|
-
as EVIDENCE, never as a blanket override. When the plane the classifier
|
|
434
|
-
would derive for the endpoint (exactly one linked business resource, or
|
|
435
|
-
the operational `global` rule) is already derivable from the detector
|
|
436
|
-
contributions and CONTRADICTS the config plane, the compiler emits both
|
|
437
|
-
assertions so the classifier blocks with `PLANE_CONTRADICTION`; when they
|
|
438
|
-
agree, one plane remains and the endpoint resolves.
|
|
439
|
-
|
|
440
|
-
Absence of `.gateforge/planes.json` is normal and byte-identical to not
|
|
441
|
-
having this channel; a malformed document (bad JSON, unknown keys, a rule
|
|
442
|
-
without `plane`/`reason`, an absolute or `..`-escaping `match`) fails the
|
|
443
|
-
run closed at startup (exit 2).
|
|
444
|
-
|
|
445
|
-
## Endpoint capability rules (`.gateforge/endpoints.json`)
|
|
446
|
-
|
|
447
|
-
Capability derivation uses detector FACTS only (method, canonical path,
|
|
448
|
-
handler simple name, schema symbols, resource linkage). A handler whose
|
|
449
|
-
logic lives behind a service call has no positive evidence and fail-closes
|
|
450
|
-
with `ENDPOINT_SEMANTICS_UNRESOLVED` — the compiler cannot see through
|
|
451
|
-
service-layer delegation, by design, and will not guess. This document is
|
|
452
|
-
the escape hatch that the blocking message names: an explicit, human
|
|
453
|
-
assertion of what an endpoint DOES.
|
|
454
|
-
|
|
455
|
-
A rule carries at least one selector (AND semantics when several) plus a
|
|
456
|
-
capability from the closed compiler vocabulary and a required non-empty
|
|
457
|
-
`reason` (the review artifact):
|
|
458
|
-
|
|
459
|
-
- `match` — repo-root-relative glob on the ROUTER SOURCE FILE path;
|
|
460
|
-
- `handlers` — globs on the handler SIMPLE name (case-sensitive; a route
|
|
461
|
-
with no handler symbol never matches);
|
|
462
|
-
- `paths` — globs on the canonical path (`/analytics/**`; must start
|
|
463
|
-
with `/`);
|
|
464
|
-
- `method` — optional exact verb (`GET`…`DELETE`, never `ANY`).
|
|
465
|
-
|
|
466
|
-
```json
|
|
467
|
-
{
|
|
468
|
-
"rules": [
|
|
469
|
-
{
|
|
470
|
-
"handlers": ["get_analytics_*"],
|
|
471
|
-
"capability": "crud-read",
|
|
472
|
-
"reason": "delegates to analytics_service; declared by the service owner"
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
"match": "backend/api/v1/accounts.py",
|
|
476
|
-
"method": "DELETE",
|
|
477
|
-
"capability": "crud-archive",
|
|
478
|
-
"reason": "sets archived_at via the service; soft delete by design"
|
|
479
|
-
}
|
|
480
|
-
]
|
|
481
|
-
}
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
Evaluation per endpoint identity, deterministic and fail closed:
|
|
485
|
-
|
|
486
|
-
- **All matching rules agree** → the capability is declared (composed
|
|
487
|
-
with detected ones; overlapping agreeing rules are one declaration).
|
|
488
|
-
A declared `crud-delete`/`crud-archive` on a DELETE endpoint resolves
|
|
489
|
-
the archive-vs-hard question the linked model could not prove.
|
|
490
|
-
- **Matching rules disagree** → a blocking
|
|
491
|
-
`ENDPOINT_CAPABILITY_CONTRADICTION` entry names every matching rule,
|
|
492
|
-
its capability, and its reason; NOTHING is applied — never
|
|
493
|
-
first-rule-wins.
|
|
494
|
-
- **No rule matches** → the endpoint stays on detector-fact evidence
|
|
495
|
-
only (and blocks if that is nothing).
|
|
496
|
-
|
|
497
|
-
The vocabulary is the compiler's own: `health-operations`,
|
|
498
|
-
`auth-session`, `webhook-callback`, `workflow-command`, `task-async`,
|
|
499
|
-
`search-query`, `validation-preview`, `file-transfer`, `ai-automation`,
|
|
500
|
-
`realtime`, `crud-create`, `crud-read`, `crud-update`, `crud-delete`,
|
|
501
|
-
`crud-archive`. Absence of the file is normal and byte-identical to not
|
|
502
|
-
having the channel; a malformed document fails the run closed at startup
|
|
503
|
-
(exit 2).
|
|
504
|
-
|
|
505
|
-
## Proposing planes at init (`gateforge init --planes`)
|
|
506
|
-
|
|
507
|
-
`gateforge init --planes` runs discovery over the repo's own include and
|
|
508
|
-
exclude configuration and PROPOSES `.gateforge/planes.json` from the
|
|
509
|
-
directories the discovered tables live in: one non-overlapping `match`
|
|
510
|
-
glob per model tree, `master` for trees whose path names a control-plane
|
|
511
|
-
segment (`admin`, `master`, `control`, `root`, `operator`), `tenant`
|
|
512
|
-
otherwise, and a reason on every rule naming the directory it was
|
|
513
|
-
inferred from. The keyword mapping IS a heuristic — that is why the file
|
|
514
|
-
is a review artifact: it is written only after explicit consent (flag,
|
|
515
|
-
or the TTY prompt), only when absent, and must be reviewed before the
|
|
516
|
-
next run reads it. Tables under test directories are excluded from the
|
|
517
|
-
proposal (fixtures are not business surface); they stay plane-less and
|
|
518
|
-
gate-visible. Non-interactive runs without `--planes` propose nothing
|
|
519
|
-
and print the tip.
|
|
520
|
-
|
|
521
|
-
## test-gates protocol (G6 surface)
|
|
522
|
-
|
|
523
|
-
`gateforge test-gates` writes a run state directory (default
|
|
524
|
-
`.gateforge/test-gates/`, `--out` overrides):
|
|
525
|
-
|
|
526
|
-
| File | Content |
|
|
527
|
-
| --- | --- |
|
|
528
|
-
| `manifest.json` | Pin #4 RunManifest (runId, injected-clock startedAt, gitSha, provider, plugin registrations, plus the `test-gates`-minted `invocationId` and tested `inputDigest`). At shutdown the witness appends `recordIds` + the v2 `attestation` envelope (never a legacy `recordIdsMac`). |
|
|
529
|
-
| `obligations.json` | Every obligation the suite must cover, with pin #2 fingerprint and resource source/location. |
|
|
530
|
-
| `env.json` | `GATEFORGE_RUN_ID`, `GATEFORGE_RUN_TOKEN`, `GATEFORGE_STATE_DIR`, `GATEFORGE_OBLIGATIONS`, `GATEFORGE_WITNESS_URL`. |
|
|
531
|
-
| `claims.json` / `records.json` | Reporter output consumed by the verifier (written by the suite). |
|
|
532
|
-
| `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. |
|
|
533
|
-
| `report.json` | Canonical json-format run report after evaluation. |
|
|
534
|
-
|
|
535
|
-
The legacy suite command (`--suite`) runs with those env vars; its reporter
|
|
536
|
-
extracts claims from `{type: 'gateforge', description: '<obligation id>'}`
|
|
537
|
-
annotations and posts evidence through the witness service (pin #7, header
|
|
538
|
-
`x-gateforge-run: <token>`; `GATEFORGE_WITNESS_URL` is set when a witness
|
|
539
|
-
service URL is provided via `--witness-url`). `gateforge check` reads
|
|
540
|
-
run-state evidence but takes native bindings only from `claimInventory`
|
|
541
|
-
in an execution result authenticated by a receipt for the current inputs;
|
|
542
|
-
it combines those with the current tracked `test-map.yml`. Raw
|
|
543
|
-
`claims.json` cannot add current declarations. Receipts created before
|
|
544
|
-
`claimInventory` existed remain valid, but supply no native bindings.
|
|
545
|
-
Records whose provenance does not verify never satisfy (GF-23). The
|
|
546
|
-
legacy escape hatch can never redefine the strict gate's expected cases
|
|
547
|
-
or turn an arbitrary exit-zero command into E2E proof — the hook and CI
|
|
548
|
-
run `check --staged/--changed --require-e2e`, which accept only supervised
|
|
549
|
-
receipts.
|
|
550
|
-
|
|
551
|
-
### Provenance trust model (GF-23, audited 2026-08-31, three rounds)
|
|
552
|
-
|
|
553
|
-
`records.json` and `manifest.json` live in the suite-writable state
|
|
554
|
-
directory, so NEITHER proves anything on its own: a hostile suite can
|
|
555
|
-
fabricate records (the id hash `recordIdOf` is public) and can write any id
|
|
556
|
-
list into the manifest. Two layers close this.
|
|
557
|
-
|
|
558
|
-
**Layer 1 — trust follows origin.** A record's `origin` is part of its
|
|
559
|
-
hashed identity:
|
|
560
|
-
|
|
561
|
-
- `suite-submitted` (`ui.action`, `ui.visible-result` POSTed by the
|
|
562
|
-
suite): the witness RECEIVED the assertion but cannot verify it
|
|
563
|
-
happened — the suite owns the browser and holds the run token. These
|
|
564
|
-
records are stamped `trust: 'claimed'` at issuance and only ANCHOR a
|
|
565
|
-
claim (entity + operation).
|
|
566
|
-
- `engine-observed` (`persistence.entity`, stamped by the witness from
|
|
567
|
-
its own adapter read): the only `trust: 'witnessed'` origin. This is
|
|
568
|
-
where `satisfied` is earned — the engine requires a witnessed
|
|
569
|
-
persistence record for the claimed entity, so fabricated outcomes can
|
|
570
|
-
never satisfy.
|
|
571
|
-
|
|
572
|
-
**Supervised session binding (Phase 1).** The trusted reporter opens ONE
|
|
573
|
-
witness session per started test (`runId`, `sessionId`, `testId`,
|
|
574
|
-
`worker`), and the evidence fixture's five primitives (`ui`, `visible`,
|
|
575
|
-
`persistence`, `http`, `finalize`) submit only under that OPEN session:
|
|
576
|
-
the witness rejects submissions without a session and forces each record's
|
|
577
|
-
testId onto the session's supervisor-registered value; sealing rejects all
|
|
578
|
-
late submissions. Every UI action runs inside a witness-recorded
|
|
579
|
-
observation interval (supervisor-issued session clock), so proxy exchanges
|
|
580
|
-
observed outside the action's interval — direct setup calls, stray
|
|
581
|
-
navigation — are never credited as browser evidence. For a mutation whose
|
|
582
|
-
journey collects input in the UI, the `ui.action` record's `fields` are
|
|
583
|
-
the declared input, and the independent engine-observed persistence read
|
|
584
|
-
must echo those values EXACTLY on the same entity identity: a mismatched
|
|
585
|
-
echo fails the obligation with `EVIDENCE_VALUE_MISMATCH` even when the
|
|
586
|
-
status was 2xx. Primitive receipts are frozen and branded — hand-rolled
|
|
587
|
-
forgeries fail closed (GF-22).
|
|
588
|
-
|
|
589
|
-
**UI-semantic `crud:*` contracts fail closed (audit round 5).** The suite
|
|
590
|
-
still owns the browser, so a claimed UI action cannot be verified at the
|
|
591
|
-
DOM level; the namespace advertises no gradable contract. The gradable
|
|
592
|
-
surface is the lifecycle-gated `persistence:*` namespace, graded on the
|
|
593
|
-
witness's OWN engine-side observation
|
|
594
|
-
(`{resourceId, entityId, found, fields, before}`) with expectations that
|
|
595
|
-
NEVER come from the tested suite:
|
|
596
|
-
|
|
597
|
-
- `persistence:create`: an engine-side id-set PRE-OBSERVATION (`POST
|
|
598
|
-
/witness/pre-observation`, backed by the adapter's optional `list`)
|
|
599
|
-
shows the entity absent before the action; the post-read shows it
|
|
600
|
-
present.
|
|
601
|
-
- `persistence:update`: an engine-side entity pre-observation exists,
|
|
602
|
-
the engine observed an actual before/after field delta, AND the delta
|
|
603
|
-
touches at least one classification-declared `updateableFields` entry
|
|
604
|
-
(audit round 6) — bookkeeping drift such as `updated_at` alone never
|
|
605
|
-
satisfies, and a resource whose classification omits
|
|
606
|
-
`updateableFields` fails closed for update obligations.
|
|
607
|
-
- `persistence:read`: the entity is present in the engine-observed state.
|
|
608
|
-
- `persistence:delete`: a hard delete observes the entity ABSENT; an
|
|
609
|
-
archive observes it present and matching the classification's
|
|
610
|
-
owner-declared `archiveFields` (e.g. `{status: archived}`) — the suite
|
|
611
|
-
cannot bless an unarchived entity by declaring its current state as
|
|
612
|
-
the expected result.
|
|
613
|
-
|
|
614
|
-
Presence alone, contradicted observations, missing pre-observations, or
|
|
615
|
-
absent deltas grade `invalid` — even when every provenance check passes.
|
|
616
|
-
|
|
617
|
-
**Layer 2 — versioned attestation binding evidence to tested inputs
|
|
618
|
-
(plan §11, F2).** A witnessed record is authorized only by ONE validated
|
|
619
|
-
v2 envelope that simultaneously matches its run id, the expected input
|
|
620
|
-
digest, the required invocation identity, and its record id:
|
|
621
|
-
|
|
622
|
-
- the durable manifest `attestation` (`attestationVersion: 2` with
|
|
623
|
-
`runId`, `invocationId`, `inputDigest`, sorted unique `recordIds`, and
|
|
624
|
-
`mac` — HMAC-SHA256 over the domain-tagged body
|
|
625
|
-
`gateforge.ledger.v2`), written by the witness at shutdown from its
|
|
626
|
-
FROZEN bound context plus EXACTLY its own ledger (pre-seeded forged
|
|
627
|
-
ids are discarded, never signed), or
|
|
628
|
-
- the live `GET /ledger-attestation` response: the SAME signed object,
|
|
629
|
-
fetched (and MAC-verified) by `test-gates` from a still-running wired
|
|
630
|
-
witness and persisted into the manifest as the durable fallback
|
|
631
|
-
before the witness stops (401 to the run token alone).
|
|
632
|
-
|
|
633
|
-
The `inputDigest` is a deterministic snapshot of everything the
|
|
634
|
-
pipeline examines (all Git-tracked files, nonignored untracked files,
|
|
635
|
-
configured scan inputs even when ignored, `.gateforge.yml`,
|
|
636
|
-
policies/classification/pack configs, adapters, local plugin modules,
|
|
637
|
-
manifests/lockfiles, effective obligations/classifications/routes —
|
|
638
|
-
`packages/cli/src/input-snapshot.ts`). A deleted file, an untracked
|
|
639
|
-
file, a policy edit, or a lockfile change all move the digest, so old
|
|
640
|
-
evidence blocks after any source/configuration change. The
|
|
641
|
-
`invocationId` is fresh per `test-gates` run, so a restored old bundle
|
|
642
|
-
cannot satisfy a new invocation. `check` (no suite) reuses a completed
|
|
643
|
-
signed run only for byte-identical inputs — it never equates its own
|
|
644
|
-
fresh manifest UUID with the evidence run UUID.
|
|
645
|
-
|
|
646
|
-
The witness never signs what a suite-writable file says: `test-gates`
|
|
647
|
-
binds the context with authenticated `POST /run-context` (run token
|
|
648
|
-
AND verifier key) BEFORE the suite starts, and the witness freezes it
|
|
649
|
-
in memory. Binding is allowed only before any observation or issuance;
|
|
650
|
-
a used witness answers 409, an identical rebind is idempotent, any
|
|
651
|
-
change is 409, and an unbound witness issues no attestation. A proxy
|
|
652
|
-
exchange in flight at bind time refuses the bind, and observations
|
|
653
|
-
that completed before binding are never consumable under the new
|
|
654
|
-
context.
|
|
655
|
-
|
|
656
|
-
The legacy v1 `recordIdsMac` (HMAC over `{runId, recordIds}` with no
|
|
657
|
-
digest binding) NEVER authorizes evidence — even when it verifies.
|
|
658
|
-
Invalid durable envelopes contribute nothing; live and durable
|
|
659
|
-
contexts are validated independently and never merged; mismatches
|
|
660
|
-
surface as explicit `evidence-context` blockers (missing vs malformed
|
|
661
|
-
vs forged stay distinguished) that waivers cannot hide.
|
|
662
|
-
|
|
663
|
-
The key comes from one trusted source: the protected
|
|
664
|
-
`GATEFORGE_WITNESS_VERIFIER_KEY` environment variable, or an external
|
|
665
|
-
owner-only key ring named by `GATEFORGE_WITNESS_VERIFIER_KEY_FILE`.
|
|
666
|
-
Do not set both. The file must be a regular file owned by the current
|
|
667
|
-
user, with mode `0600` or stricter, and it must not be a symlink. Store
|
|
668
|
-
it outside the candidate repository, Git directory, run state, `--out`
|
|
669
|
-
directory, workspace, and receipt-artifact directory. Gateforge refuses
|
|
670
|
-
unsafe paths and permissions. File mode is not supported on Windows;
|
|
671
|
-
use the protected environment source there.
|
|
672
|
-
|
|
673
|
-
Create and rotate keys only after an owner review:
|
|
674
|
-
|
|
675
|
-
If you already use an environment key, keep it in the protected environment
|
|
676
|
-
while you import it. Do not place key material in shell history or argv.
|
|
677
|
-
|
|
678
|
-
```sh
|
|
679
|
-
gateforge key create --file "$HOME/.config/gateforge/keys.json" --confirm
|
|
680
|
-
gateforge key import-env --file "$HOME/.config/gateforge/keys.json" --confirm
|
|
681
|
-
unset GATEFORGE_WITNESS_VERIFIER_KEY
|
|
682
|
-
export GATEFORGE_WITNESS_VERIFIER_KEY_FILE="$HOME/.config/gateforge/keys.json"
|
|
683
|
-
gateforge key rotate --file "$HOME/.config/gateforge/keys.json" --confirm
|
|
684
|
-
gateforge key retire --file "$HOME/.config/gateforge/keys.json" --key-id key-old-id --confirm
|
|
685
|
-
```
|
|
686
|
-
|
|
687
|
-
Create the parent directory first. `key import-env` retains an existing
|
|
688
|
-
environment key under its stable id before switching to the file source.
|
|
689
|
-
Key commands print only a non-secret
|
|
690
|
-
key id. Rotation keeps old keys so their receipts still verify. Retire an
|
|
691
|
-
old key only when its receipts no longer need to verify. Gateforge stores
|
|
692
|
-
the key id, not the secret, in new receipts. A receipt for a removed id
|
|
693
|
-
fails with `KEY_UNKNOWN`. The key ring file contains raw signing keys, so
|
|
694
|
-
protect its backups with the same care as the original.
|
|
695
|
-
|
|
696
|
-
`test-gates` strips both key-source variables from the suite child's
|
|
697
|
-
environment. The supervised browser runner and candidate runtime also
|
|
698
|
-
refuse both sources, and Gateforge does not write either value or file
|
|
699
|
-
path into run state. The trusted witness process receives the active key
|
|
700
|
-
to authenticate records. A suite-owned Playwright global setup therefore
|
|
701
|
-
cannot bootstrap trusted issuance by inheriting the key — it fails closed
|
|
702
|
-
unless an externally wired trusted witness is provided. Residuals (not
|
|
703
|
-
eliminable by env hygiene alone): a same-uid process can read environ when yama
|
|
704
|
-
`ptrace_scope=0`, and env vars never isolate hostile same-user OS
|
|
705
|
-
processes — for strong isolation run the suite as a distinct user or
|
|
706
|
-
container. File-change capture is snapshot-based, not an OS sandbox:
|
|
707
|
-
it guards changes visible at capture points, not a malicious process
|
|
708
|
-
that changes and restores files between snapshots.
|
|
709
|
-
|
|
710
|
-
Fail closed: without the key, or when no envelope validates for the
|
|
711
|
-
expected context, every witnessed record demotes to claimed-tier
|
|
712
|
-
(blocking, never satisfied).
|
|
713
|
-
|
|
714
|
-
### Evidence migration (v1 → v2, no auto-migration)
|
|
101
|
+
## What the gate catches that green mocks do not
|
|
715
102
|
|
|
716
|
-
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
in-scope waived/baselined E2E obligation is not proof at all
|
|
726
|
-
(`ENFORCEMENT_UNTRUSTED`).
|
|
727
|
-
- External witness setup: start `gateforge-witness` (or `startWitness`)
|
|
728
|
-
with the run id/token from a TRUSTED parent env carrying
|
|
729
|
-
`GATEFORGE_WITNESS_VERIFIER_KEY`, pass `--witness-url`/`--run-token`
|
|
730
|
-
to `test-gates`, and start a FRESH witness per invocation (a witness
|
|
731
|
-
used by an older invocation rejects binding with 409).
|
|
732
|
-
- Non-Git checkouts keep discovery but fail evidence authorization
|
|
733
|
-
with a `snapshot-unavailable` diagnostic; submodules, escaping
|
|
734
|
-
symlinks, and `--out` overlapping source fail closed with explicit
|
|
735
|
-
diagnostics.
|
|
103
|
+
- A test can intercept a request and return a complete response while the
|
|
104
|
+
real server drops a field. A mocked-only test is not evidence that the
|
|
105
|
+
server sends it.
|
|
106
|
+
- A UI action can look successful while the witness sees only a timestamp
|
|
107
|
+
change; an update obligation still needs a change to a classified
|
|
108
|
+
updateable field.
|
|
109
|
+
- A mocked route can hide a handler that never receives real traffic. The
|
|
110
|
+
gate needs a witnessed request and the resulting state, not a mock's
|
|
111
|
+
answer.
|
|
736
112
|
|
|
737
113
|
## Limitations
|
|
738
114
|
|
|
@@ -741,18 +117,29 @@ expected context, every witnessed record demotes to claimed-tier
|
|
|
741
117
|
explicit, never fallbacks; support is not implemented.
|
|
742
118
|
- A Playwright config with NO named project yields native rows with an
|
|
743
119
|
empty project name, which the strict catalog schema rejects as an
|
|
744
|
-
internal error (exit 2) instead of a typed row
|
|
745
|
-
|
|
120
|
+
internal error (exit 2) instead of a typed row; a typed empty-project
|
|
121
|
+
row is open work.
|
|
746
122
|
- Run-state hygiene is enforced, not forgiven: a committed run-state
|
|
747
|
-
directory
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
`
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
123
|
+
directory or include globs that omit the spec directories fail closed —
|
|
124
|
+
gitignore `.gateforge/test-gates/` and include the spec globs.
|
|
125
|
+
- Consumer-worktree migration and the server-side GitLab enforcement
|
|
126
|
+
settings are pending owner actions — the complete template and settings
|
|
127
|
+
list ship from `init --blocking`, but a local simulation does not
|
|
128
|
+
complete a server rollout.
|
|
129
|
+
|
|
130
|
+
Every limitation with its full context: [Limitations](guides/REFERENCE.md#limitations).
|
|
131
|
+
|
|
132
|
+
## Existing repositories
|
|
133
|
+
|
|
134
|
+
On a repository that already has code, `gateforge check` reports
|
|
135
|
+
today's findings as blocking debt from day one. The sanctioned
|
|
136
|
+
one-time bulk-add is `gateforge adopt`: it records today's blocking
|
|
137
|
+
findings as forgiven (shrink-only, once per repository) and applies
|
|
138
|
+
the blocking wiring. The full adopt contract, and the baseline
|
|
139
|
+
commands that shrink the recorded set: [Reference](guides/REFERENCE.md).
|
|
140
|
+
Under `strictE2E`, an adopted E2E obligation still blocks
|
|
141
|
+
as soon as a change touches it — adoption forgives today's
|
|
142
|
+
debt, never new work.
|
|
756
143
|
|
|
757
144
|
## Development
|
|
758
145
|
|