@gate-forge/cli 0.9.1 → 0.10.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 (61) hide show
  1. package/README.md +2 -0
  2. package/dist/cache-exclusions.d.ts +20 -13
  3. package/dist/cache-exclusions.d.ts.map +1 -1
  4. package/dist/cache-exclusions.js +47 -33
  5. package/dist/cache-exclusions.js.map +1 -1
  6. package/dist/cli.d.ts +1 -1
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +11 -0
  9. package/dist/cli.js.map +1 -1
  10. package/dist/commands/classify.d.ts +1 -0
  11. package/dist/commands/classify.d.ts.map +1 -1
  12. package/dist/commands/classify.js +230 -14
  13. package/dist/commands/classify.js.map +1 -1
  14. package/dist/commands/common.d.ts +6 -1
  15. package/dist/commands/common.d.ts.map +1 -1
  16. package/dist/commands/common.js +8 -1
  17. package/dist/commands/common.js.map +1 -1
  18. package/dist/commands/enforcement.d.ts +9 -1
  19. package/dist/commands/enforcement.d.ts.map +1 -1
  20. package/dist/commands/enforcement.js +296 -38
  21. package/dist/commands/enforcement.js.map +1 -1
  22. package/dist/commands/init.d.ts +20 -0
  23. package/dist/commands/init.d.ts.map +1 -1
  24. package/dist/commands/init.js +88 -56
  25. package/dist/commands/init.js.map +1 -1
  26. package/dist/commands/migrate.d.ts +14 -0
  27. package/dist/commands/migrate.d.ts.map +1 -0
  28. package/dist/commands/migrate.js +177 -0
  29. package/dist/commands/migrate.js.map +1 -0
  30. package/dist/commands/tests.d.ts.map +1 -1
  31. package/dist/commands/tests.js +47 -24
  32. package/dist/commands/tests.js.map +1 -1
  33. package/dist/docs-exclusions.d.ts +32 -5
  34. package/dist/docs-exclusions.d.ts.map +1 -1
  35. package/dist/docs-exclusions.js +60 -26
  36. package/dist/docs-exclusions.js.map +1 -1
  37. package/dist/evidence-config-text.d.ts +57 -0
  38. package/dist/evidence-config-text.d.ts.map +1 -0
  39. package/dist/evidence-config-text.js +263 -0
  40. package/dist/evidence-config-text.js.map +1 -0
  41. package/dist/execution.d.ts +51 -8
  42. package/dist/execution.d.ts.map +1 -1
  43. package/dist/execution.js +61 -29
  44. package/dist/execution.js.map +1 -1
  45. package/dist/gateforge-owned.d.ts +1 -1
  46. package/dist/gateforge-owned.d.ts.map +1 -1
  47. package/dist/gateforge-owned.js +6 -9
  48. package/dist/gateforge-owned.js.map +1 -1
  49. package/dist/input-snapshot.d.ts.map +1 -1
  50. package/dist/input-snapshot.js +2 -6
  51. package/dist/input-snapshot.js.map +1 -1
  52. package/dist/legacy-exclusion-paths.d.ts +28 -0
  53. package/dist/legacy-exclusion-paths.d.ts.map +1 -0
  54. package/dist/legacy-exclusion-paths.js +48 -0
  55. package/dist/legacy-exclusion-paths.js.map +1 -0
  56. package/guides/CONNECT-YOUR-PROJECT.md +50 -1
  57. package/guides/QUICKSTART.md +43 -10
  58. package/guides/REFERENCE.md +179 -29
  59. package/guides/TEST-ENVIRONMENT.md +36 -0
  60. package/guides/UPGRADE-0.9-to-0.10.md +137 -0
  61. package/package.json +10 -10
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The 0.9 evidence-exclusion declaration paths, and the one refusal that
3
+ * replaces reading them.
4
+ *
5
+ * 0.10 moved both lists into `.gateforge.yml` under `evidence.exclude`.
6
+ * There is NO dual read: a repository that still carries either file is
7
+ * refused by name, with the command that migrates it, because silently
8
+ * ignoring the file would silently drop the owner's exclusions and
9
+ * quietly change what evidence identity means.
10
+ */
11
+ import { existsSync } from 'node:fs';
12
+ import { join } from 'node:path';
13
+ import { UsageError } from './errors.js';
14
+ /** The removed documentation-folder declaration path (0.9 and earlier). */
15
+ export const LEGACY_DOCS_EXCLUSIONS_PATH = '.gateforge/docs-exclusions.yml';
16
+ /** The removed Python bytecode declaration path (0.9 and earlier). */
17
+ export const LEGACY_CACHE_EXCLUSIONS_PATH = '.gateforge/cache-exclusions.yml';
18
+ /**
19
+ * Lists the pre-0.10 exclusion files still present in the repository.
20
+ *
21
+ * Args:
22
+ * cwd: absolute repository root.
23
+ *
24
+ * Returns:
25
+ * string[]: repo-relative paths of the declarations that still exist.
26
+ */
27
+ export function legacyExclusionPathsPresent(cwd) {
28
+ return [LEGACY_DOCS_EXCLUSIONS_PATH, LEGACY_CACHE_EXCLUSIONS_PATH].filter((path) => existsSync(join(cwd, ...path.split('/'))));
29
+ }
30
+ /**
31
+ * Refuses a pre-0.10 declaration instead of reading it (fail closed).
32
+ *
33
+ * Args:
34
+ * cwd: absolute repository root (the tree the caller is about to read).
35
+ *
36
+ * Returns:
37
+ * void: nothing when no pre-0.10 declaration is present.
38
+ *
39
+ * Throws:
40
+ * UsageError: naming the file, the new location, and the migration.
41
+ */
42
+ export function rejectLegacyExclusions(cwd) {
43
+ for (const path of legacyExclusionPathsPresent(cwd)) {
44
+ throw new UsageError(`found ${path}: since 0.10 evidence exclusions live in .gateforge.yml under evidence.exclude — ` +
45
+ 'run `gateforge migrate`');
46
+ }
47
+ }
48
+ //# sourceMappingURL=legacy-exclusion-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-exclusion-paths.js","sourceRoot":"","sources":["../src/legacy-exclusion-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,2BAA2B,GAAG,gCAAgC,CAAC;AAE5E,sEAAsE;AACtE,MAAM,CAAC,MAAM,4BAA4B,GAAG,iCAAiC,CAAC;AAE9E;;;;;;;;GAQG;AACH,MAAM,UAAU,2BAA2B,CAAC,GAAW;IACrD,OAAO,CAAC,2BAA2B,EAAE,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CACjF,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,KAAK,MAAM,IAAI,IAAI,2BAA2B,CAAC,GAAG,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,UAAU,CAClB,SAAS,IAAI,mFAAmF;YAC9F,yBAAyB,CAC5B,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -23,7 +23,7 @@ ONE next action.
23
23
  An infrastructure route that serves no business data (health, readiness, metrics): Gateforge already classifies health and readiness probes as `global` itself. Do not cover a file that holds such probes with a `tenant` or `master` rule — the two answers contradict (`PLANE_CONTRADICTION`). If no route in the folder serves business data (`gateforge explain <endpoint>` shows `linkedResource: <none>`), answer `global` for it; if business routes share one router file with the probes, move the probes to their own router file. A file that is not part of the product: exclude it with `project.paths.exclude` in `.gateforge.yml`.
24
24
  - **`gateforge adopt` comes after the plane answers** because a plane answer changes a resource's identity, so the debt set `adopt` records would not match the repository if it were captured before the answer.
25
25
  - **Declare the dependency directories the staged commit gate may link** (`prepare: { reuse: [node_modules] }` in `.gateforge/runtime.yml`): the gate runs on a checkout of the staged files only.
26
- - **Pin the owner-approved policy digest LAST**, right before the first strict commit: read the full value from `gateforge enforcement doctor` and set it as `GATEFORGE_APPROVED_POLICY_DIGEST`. It changes whenever a policy input changes — `.gateforge.yml`, the policies, the classification policy, `planes.json`, adapters, `runtime.yml`, waivers, hooks — so re-pin after every such edit. Stage every policy file first (`git add`) — the commit gate digests the staged bytes, and `enforcement doctor` warns when they differ from the working tree.
26
+ - **Pin the owner-approved policy digest LAST**, right before the first strict commit: `git add -A .gateforge .gateforge.yml && gateforge enforcement pin --pin-file ~/.config/<repo>.gateforge.env --confirm`. The flag is `--pin-file`, not `--env-file`: node itself consumes `--env-file <path>` anywhere in argv and would read the file instead of running the command. The pin file must live OUTSIDE the repository, and the command refuses a path inside it (a candidate-controlled file cannot approve policy) as well as a policy input that is not fully staged — it names the file instead of pinning a revision the gate never digests. Without `--confirm` it only prints the line it would write. The digest changes whenever a policy input changes — `.gateforge.yml`, the policies, the classification policy, `.gateforge/test-map.yml`, `planes.json`, adapters, `runtime.yml`, waivers, hooks — so re-pin after every such edit; `enforcement doctor` names the inputs that changed since HEAD (`policy-inputs-vs-HEAD`) and whether the provisioned pin still matches the staged bytes (`approved-digest`).
27
27
 
28
28
  ## 1. What you need
29
29
 
@@ -372,6 +372,55 @@ npx gateforge tests mark --test <key> --kind browser-e2e \
372
372
  Marking a test never satisfies an obligation; it only says which existing
373
373
  test is *about* it. New proof goes in `tests/e2e/gateforge/`.
374
374
 
375
+ ### 6a. Base an existing suite on Gateforge's fixture
376
+
377
+ An `observed-e2e` test proves transport and persistence through the witness
378
+ ONLY when its `page` comes from Gateforge's test object: that fixture is what
379
+ routes the test's app traffic through the supervisor's session observation
380
+ proxy. A test that takes `page` from plain `@playwright/test` reaches the app
381
+ directly, the witness observes nothing, and its claims finalize with "no HTTP
382
+ exchange passed through this session's observation proxy" — while the test
383
+ itself passes.
384
+
385
+ When the suite has one shared fixture file, that is a one-line rebase and
386
+ nothing else in the suite changes:
387
+
388
+ ```js
389
+ // CommonJS suite — the shape most existing Playwright suites have.
390
+ // `require` needs Node >= 20.19 / >= 22.12.
391
+ const { test: baseTest, expect } = require('@gate-forge/pack-playwright/fixture');
392
+ ```
393
+
394
+ ```ts
395
+ // ESM suite
396
+ import { test as baseTest, expect } from '@gate-forge/pack-playwright/fixture';
397
+ ```
398
+
399
+ Keep the suite's own journeys, steps, assertions and fixtures; change only
400
+ which `test` object they extend. Under a witnessed run, every test then runs
401
+ under a supervisor-issued session whose traffic the witness can observe.
402
+
403
+ ### 6b. Point the suite at the origin Gateforge routes
404
+
405
+ Rebasing the fixture is only half of it. The fixture rewrites requests to
406
+ `GATEFORGE_APP_BASE_URL` onto the supervisor's session observation proxy — and
407
+ only those. A suite whose own base URL differs (`E2E_BASE_URL` resolving to
408
+ `http://localhost:13001` while Gateforge runs at `http://localhost:13101`, or a
409
+ variable that never reaches the test process at all because it is not in
410
+ `envAllowlist`) sends every request past the witness, and its `observed-e2e`
411
+ claims finalize with "no HTTP exchange passed through this session's
412
+ observation proxy" while the tests pass.
413
+
414
+ So, for the suite you just rebased:
415
+
416
+ - list its base-URL variable in `runtime.yml` `envAllowlist` (see
417
+ `TEST-ENVIRONMENT.md`), or have the helpers read `GATEFORGE_APP_BASE_URL`;
418
+ - and make that origin the one the tests actually load.
419
+
420
+ When the origins disagree, the witness's zero-traffic note now names both —
421
+ the origin the page really requested and the one Gateforge routes — instead of
422
+ guessing at the fixture page alone.
423
+
375
424
  ## 7. First run
376
425
 
377
426
  ```bash
@@ -14,7 +14,7 @@ You need Node.js 20 or newer and an existing Playwright suite that can run again
14
14
  - Answer the plane questions with `gateforge classify plane <folder> <tenant|master|global> --reason "<why>" --confirm` (run `gateforge init --planes` once first to create the owner-reviewed `.gateforge/planes.json`).
15
15
  - Adopt comes after the plane answers because a plane answer changes a resource's identity, so the debt set `adopt` records would not match the repository if it were captured before the answer.
16
16
  - Declare the dependency directories the staged commit gate may link (`prepare: { reuse: [node_modules] }` in `.gateforge/runtime.yml`): the gate runs on a checkout of the staged files only.
17
- - Pin the owner-approved policy digest LAST, right before the first strict commit: read the full value from `gateforge enforcement doctor` and set it as `GATEFORGE_APPROVED_POLICY_DIGEST`. It changes whenever a policy input changes — `.gateforge.yml`, the policies, the classification policy, `planes.json`, adapters, `runtime.yml`, waivers, hooks — so re-pin after every such edit. Stage every policy file first (`git add`) — the commit gate digests the staged bytes, and `enforcement doctor` warns when they differ from the working tree.
17
+ - Pin the owner-approved policy digest LAST, right before the first strict commit: `git add -A .gateforge .gateforge.yml && gateforge enforcement pin --pin-file ~/.config/<repo>.gateforge.env --confirm`. The flag is `--pin-file`, not `--env-file`: node itself consumes `--env-file <path>` anywhere in argv and would read the file instead of running the command. Without `--confirm` the command only prints the line it would write. The pin file must live OUTSIDE the repository — a file the candidate controls cannot approve its own policy revision — and the command refuses any path inside the repo, plus a policy input that is not fully staged (it names the file). The digest changes whenever a policy input changes — `.gateforge.yml`, the policies, the classification policy, `.gateforge/test-map.yml`, `planes.json`, adapters, `runtime.yml`, waivers, hooks — so re-pin after every such edit. `gateforge enforcement doctor` names the inputs that changed since HEAD (`policy-inputs-vs-HEAD`) and whether the provisioned pin still matches the staged bytes (`approved-digest`).
18
18
 
19
19
  ## 1. Install the CLI and the packs you use
20
20
 
@@ -24,15 +24,21 @@ Example for a React frontend, FastAPI backend, and SQLAlchemy data layer:
24
24
 
25
25
  ```sh
26
26
  npm i -D \
27
- @gate-forge/cli@0.9.1 \
28
- @gate-forge/pack-playwright@0.9.1 \
29
- @gate-forge/pack-http@0.9.1 \
30
- @gate-forge/pack-fastapi@0.9.1 \
31
- @gate-forge/pack-sqlalchemy@0.9.1
27
+ @gate-forge/cli@0.10.0 \
28
+ @gate-forge/pack-playwright@0.10.0 \
29
+ @gate-forge/pack-http@0.10.0 \
30
+ @gate-forge/pack-fastapi@0.10.0 \
31
+ @gate-forge/pack-sqlalchemy@0.10.0
32
32
  ```
33
33
 
34
34
  Use the project-local `gateforge` binary from your npm script or add `node_modules/.bin` to your shell `PATH`. If the scan recommends other packs, add only the ones your code uses, at the same version. A mismatched Gateforge package contract can stop the CLI with exit code 2 and `GATEFORGE_PACKAGE_INCOMPATIBLE`.
35
35
 
36
+ `gateforge init` prints that same command for you: after it writes the
37
+ config it names — in ONE line — every detector pack it enabled that your
38
+ `package.json` does not already declare, at the CLI's own version. Run
39
+ that line (init never runs npm for you), and commit the install on its own
40
+ before committing the setup files.
41
+
36
42
  **Installing from tarballs** (a release that is not on the registry yet): install every `.tgz` of that release in ONE command. The CLI depends on shared packages and packs that are not in the list above, and npm resolves them from the files only when they are all in the same install; a partial set makes npm look for the rest on the registry and fail with `E404`.
37
43
 
38
44
  ```sh
@@ -43,7 +49,7 @@ This installs every pack of the release; the scan still recommends the ones your
43
49
 
44
50
  **You should see:** npm installs the packages without a Gateforge compatibility error.
45
51
 
46
- **If not:** align every direct `@gate-forge/*` package to `0.9.1`, then install again. Do not work around the compatibility error.
52
+ **If not:** align every direct `@gate-forge/*` package to `0.10.0`, then install again. Do not work around the compatibility error.
47
53
 
48
54
  ## 2. Pick a goal
49
55
 
@@ -102,8 +108,8 @@ It writes:
102
108
  It also creates `.gateforge/adapters/` and `.gateforge/waivers/`, and adds
103
109
  `.gateforge/test-gates/` (Gateforge's own run state: catalog, caches,
104
110
  receipts, history) to `.gitignore` so `git add -A` never stages it. It
105
- preserves existing files. A chosen documentation exclusion adds
106
- `.gateforge/docs-exclusions.yml`.
111
+ preserves existing files. A chosen documentation exclusion is added to
112
+ `.gateforge.yml` under `evidence.exclude.docs`.
107
113
 
108
114
  **You should see:** a scan summary, recommended packages, the goal summary
109
115
  with its `undo:` lines, and a `skeleton ready` message.
@@ -300,6 +306,33 @@ Then run `gateforge next` again: the same block must not reappear. A route
300
306
  that is genuinely internal is the other answer, and it stays owner-only (an
301
307
  `internalRules` entry in `.gateforge/classification-policy.yml`).
302
308
 
309
+ The second owner question is what removal MEANS. Delete semantics are
310
+ proven, never guessed: a model that declares nothing keeps its resource
311
+ `unclassified` and blocks with `DELETE_SEMANTICS_UNRESOLVED` (nothing on
312
+ it accrues, and `gateforge explain <resource>` names it). You answer with
313
+ `hard` (the row is removed) or `archive` (the row stays, with your own
314
+ archived state):
315
+
316
+ ```sh
317
+ gateforge classify delete 'backend/models' hard \
318
+ --reason 'Rows in this model tree are removed permanently.' --confirm
319
+ ```
320
+
321
+ Like `classify plane` it previews without `--confirm`, and it takes one
322
+ file, one FOLDER (written as `match: 'backend/models/**'`), or one glob —
323
+ one reviewed rule per model tree, not per model. `archive` refuses to run
324
+ without the archived field values the run grades removal against:
325
+
326
+ ```sh
327
+ gateforge classify delete 'backend/models/invoice' archive \
328
+ --archive-field status=archived --archive-field archived_by=system \
329
+ --reason 'Invoices are archived, never removed.' --confirm
330
+ ```
331
+
332
+ Your declaration is an evidence contract, not an override: if a detector
333
+ reads the model and disagrees with your rule, the run blocks and names
334
+ both instead of picking one. Then run `gateforge next` again.
335
+
303
336
  To verify a specific commit tree (for example, the tip of a pushed ref)
304
337
  instead of the current worktree or index:
305
338
 
@@ -394,7 +427,7 @@ the registry. To gate a release that is not on the registry yet (a local
394
427
  regenerate:
395
428
 
396
429
  ```sh
397
- GATEFORGE_CI_ENGINE_SOURCE=vendor/gate-forge-cli-0.9.1.tgz \
430
+ GATEFORGE_CI_ENGINE_SOURCE=vendor/gate-forge-cli-0.10.0.tgz \
398
431
  gateforge enforce --ci github
399
432
  ```
400
433
 
@@ -9,7 +9,8 @@ first commands; the guides cover the walks:
9
9
  [Quickstart](QUICKSTART.md), [Connect your project](CONNECT-YOUR-PROJECT.md),
10
10
  [Test environment](TEST-ENVIRONMENT.md),
11
11
  [Runners other than Playwright](RUNNER-NEUTRAL-EVIDENCE.md),
12
- [Upgrade from 0.8 to 0.9](UPGRADE-0.8-to-0.9.md).
12
+ [Upgrade from 0.8 to 0.9](UPGRADE-0.8-to-0.9.md),
13
+ [Upgrade from 0.9 to 0.10](UPGRADE-0.9-to-0.10.md).
13
14
 
14
15
  ## Contents
15
16
 
@@ -21,6 +22,7 @@ first commands; the guides cover the walks:
21
22
  - [Enforcement](#enforcement)
22
23
  - [Contract capabilities](#contract-capabilities)
23
24
  - [Configuration](#configuration)
25
+ - [Classification policy (`.gateforge/classification-policy.yml`)](#classification-policy-gateforgeclassification-policyyml)
24
26
  - [Plugin invocation](#plugin-invocation)
25
27
  - [Endpoint plane rules (`.gateforge/planes.json`)](#endpoint-plane-rules-gateforgeplanesjson)
26
28
  - [Endpoint capability rules (`.gateforge/endpoints.json`)](#endpoint-capability-rules-gateforgeendpointsjson)
@@ -42,18 +44,20 @@ first commands; the guides cover the walks:
42
44
  | Command | Purpose | Exit codes |
43
45
  | --- | --- | --- |
44
46
  | `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 |
47
+ | `gateforge migrate [--confirm]` | Move owner declarations out of their own files and into `.gateforge.yml`. Today that is the evidence exclusions: `.gateforge/docs-exclusions.yml` and `.gateforge/cache-exclusions.yml` become `evidence.exclude.docs` and `evidence.exclude.cache`. Preview by default — it prints the exact `.gateforge.yml` diff and the files it would delete, writes nothing, exits 0; `--confirm` writes the block as TEXT (your YAML is never re-serialized), deletes the old files, and ends with `policy inputs changed: re-pin the approved digest (gateforge enforcement doctor)`. It validates the old files with the loader rules, refuses an `evidence:`/`exclude:`/`docs` form it cannot extend safely by name, and is idempotent (`nothing to migrate`, exit 0). Every other command refuses a repository that still carries an old file, naming this one. | 0/2 |
45
48
 
46
49
 
47
50
 
48
51
  | `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 |
49
52
  | `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
53
  | `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 |
54
+ | `gateforge classify delete <file\|folder\|glob> <hard\|archive> [--archive-field <key=value>]... --reason <text> [--confirm]` | Preview (default) or explicitly append one owner delete-semantics rule to `.gateforge/classification-policy.yml`: how removal manifests for every model whose source file matches the pattern. `archive` requires at least one `--archive-field` (the owner-owned archived state the run grades removal against); `hard` refuses the flag. The preview writes nothing, prints the exact diff, and quotes the policy-pin consequence; `--confirm` appends the rule at TEXT level — the key at the end of the document when absent, a new `- match:` item at the end of the block when present — so every byte the owner wrote survives (comments, key order, flow sequences), and the resulting document is validated against the pinned schema. A `deleteRules` the command cannot extend safely (flow style, or a value that is not a list of rules) is refused by name. An existing rule for the same source is reported, never shadowed. Declaring is an evidence contract, not an override: contradicting detector evidence still blocks. | 0/2 |
51
55
  | `gateforge explain <resourceId\|path> [--json]` | Show one resource's detector signals, classification rules, decision fingerprint, typed blocks, and generated obligations. A repo-relative PATH is also a target: when no resource matches it, the command prints what the file is and what governs it (Gateforge policy input, declared gate input, owner-declared documentation folder, known source of a resource, or an unclassified change) with the steps that attribute it — this is the answer an unmapped `CHANGE_UNMAPPED` file needs. An unknown target stays unknown (exit 1). | 0/1/2 |
52
56
  | `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 |
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`). Candidates are RANKED by the evidence their catalog row carries (explicit tag, resource token in title/file, operation word, route segment, unmocked folder, minus mocks) with the matching reason printed as `why:`; the text surface prints the top five and names how many it hid, `--json` carries every candidate with its `rank` and `score`. With a candidate present the next action is to MARK it `observed-e2e` and run it under the witness — the overlay instruction belongs to `newTestNeeded: true`. 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 |
57
+ | `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`). Candidates are RANKED by the evidence their catalog row carries (explicit tag, resource token in title/file, operation word, route segment, unmocked folder, minus mocks) with the matching reason printed as `why:`; the text surface prints the top five and names how many it hid, `--json` carries every candidate with its `rank` and `score`. The reuse verdict `newTestNeeded` has THREE honest values: `no` (the `#1` candidate is an unmocked e2e row more than one signal supports), `yes` (no candidate survived resolution, or every candidate mocks the system under test) and `unverified` (a candidate exists but one signal carries it — confirm the request with `gateforge explain <obligation>` before marking). The next action follows it: MARK the candidate and run it under the witness when the verdict is `no`, write the overlay when it is `yes`. 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 |
54
58
  | `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
59
  | `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 |
56
- | `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) |
60
+ | `gateforge tests explain --test <key> [--json]` | Per-test report: requirements, existing-test identity, mapping origin, honest execution status, next action, and the same three-state reuse verdict `New test needed` (`no` / `yes` / `unverified`) `tests suggest` prints — built from the SAME route evidence, so the two surfaces never disagree about one test. | 0/2 (unknown key → 2) |
57
61
  | `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 |
58
62
  | `gateforge obligations [--json]` | Evaluate policies against the automatically classified graph and dump obligations, blocking entries, and claim assessments. | 0/1/2 |
59
63
  | `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 |
@@ -65,6 +69,7 @@ first commands; the guides cover the walks:
65
69
  | `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 |
66
70
  | `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 |
67
71
  | `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 |
72
+ | `gateforge enforcement pin --pin-file <path> [--confirm]` | Writes the owner-approved policy digest of the STAGED candidate into an env file OUTSIDE the repository. The flag is `--pin-file`, NOT `--env-file`: Node itself consumes `--env-file <path>` (and `--env-file-if-exists <path>`) anywhere in argv — it reads the file and exits 9 on a missing one, so the CLI would never run. The digest is the one the commit gate computes: the index is frozen and materialized exactly as `check --staged` does, and the entries are hashed by the same function. It refuses when a policy input is not fully staged, naming the files. Preview by default — the line it would write, nothing written. `--confirm` replaces exactly the `GATEFORGE_APPROVED_POLICY_DIGEST=<hex>` line, drops a duplicate assignment, leaves every other line untouched, never prints another line of the file, and writes the file mode `0600`. A path inside the repository is refused: the pin must live outside the candidate, because a candidate-controlled file cannot approve policy. A symlink or a non-regular file is refused too (fail closed). | 0/2 |
68
73
  | `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 |
69
74
  | `gateforge adopt` | Adopt an EXISTING repository: run it once, after `init`, on a project that already has code and therefore already has findings. Records today's blocking findings (pin-#2 obligation fingerprints, blocking entries, and the classification-blocked resource identities) into `.gateforge/baselines/obligations.json`, sanctioned by a dated, count-annotated receipt `.gateforge/baselines/adoption.json` — without that receipt a baseline forgives nothing — then applies the blocking wiring through the same idempotent path as `init --blocking`. It is the ONE sanctioned bulk-add and only once per repository: a second `adopt` is a no-op success. The recorded set is shrink-only (`gateforge baseline update` shrinks it) and never forgives new work. With `enforcement.strictE2E: true`, a baselined E2E obligation is not proof and blocks with `ENFORCEMENT_UNTRUSTED` again as soon as a change touches it. `adopt --help` prints this contract. | 0/2 |
70
75
  | `gateforge baseline update <fp...>` | Shrink the baseline to a strict subset (invariant 4). | 0/2 |
@@ -394,10 +399,18 @@ tests:
394
399
  witnessed evidence for this change grades `EVIDENCE_NOT_COLLECTED` —
395
400
  blocking.
396
401
 
397
- `tests suggest` emits `newTestNeeded: true` only when no suitable existing
398
- candidate survives resolution. An unsupported proof channel produces a
399
- capability task (`VERIFIER_UNSUPPORTED`), never a request to generate more
400
- tests.
402
+ `tests suggest` emits a THREE-STATE reuse verdict, never a boolean:
403
+ `no` when the `#1` candidate is an unmocked e2e row that more than ONE
404
+ signal supports (an explicit tag naming this resource, or a resource-token
405
+ match together with a file that names the route); `yes` when no candidate
406
+ survived resolution or every candidate mocks the system under test; and
407
+ `unverified` when a candidate exists but ONE signal carries it — a name in
408
+ common is not proof the test drives that request, so the next action is
409
+ the check (`new test needed: unverified — check that a candidate really
410
+ sends <METHOD> <route> before marking (gateforge explain <obligation>)`),
411
+ never a ready-made `tests mark` command. An unsupported proof channel
412
+ produces a capability task (`VERIFIER_UNSUPPORTED`), never a request to
413
+ generate more tests.
401
414
 
402
415
  ### Ranked candidates
403
416
 
@@ -405,6 +418,26 @@ Candidates are RANKED by the evidence the catalog row itself carries, not
405
418
  listed alphabetically: an explicit `@crud(...)` tag, a resource token in the
406
419
  title path or the file, the obligation's operation word, a route segment from
407
420
  the run's route inventory, a `real/` (unmocked) folder, minus a mock signal.
421
+ Tokens are matched WHOLE-WORD (title path words; file path segments split on
422
+ `/ . _ -`), never inside a longer word, and a generated resource id
423
+ contributes only its NAME: the plane (`tenant`), the transport (`http`), the
424
+ method (`get`), route furniture (`api`, `v1`), the `param` marker that stands
425
+ in for a `{route_param}`, and the trailing id hash identify no resource, so
426
+ `@crud(tenant.accounts:create)` is never evidence for
427
+ `tenant.http-get-api-v1-notifications-…`. A tag is a DECLARATION: only its
428
+ resource part (the text before `:` in `@crud(tenant.accounts:read)`, minus the
429
+ plane) counts as a resource name, and the tag text itself is stripped before
430
+ the title is read as prose — the `:read` in that tag never matches a `…/read`
431
+ route segment.
432
+ For an `http:*` obligation that operation must also FIT the route's method —
433
+ `GET`/`HEAD` read, `POST` create, `PUT`/`PATCH` update, `DELETE` delete. A tag
434
+ declaring `create` says the test creates the resource, which is no evidence
435
+ that it reads `GET /api/v2/accounts`, so it scores nothing there; with no
436
+ other evidence the row is not a candidate and the verdict is `unverified`,
437
+ never a `no` that would send the owner to mark a create test as the proof of
438
+ a read. A non-transport obligation has no route method to fit, so its tags
439
+ stay judged on the resource alone.
440
+
408
441
  Every weight is additive and printed as a `why:` line, so the order explains
409
442
  itself — the score is never a bare number. Ties break on the logical key, so
410
443
  the list is deterministic. The text surface prints the top five and says how
@@ -431,12 +464,14 @@ that line.
431
464
 
432
465
  ### One instruction, not two
433
466
 
434
- When a candidate exists, the suggestion's next action is to MARK that
435
- existing test `observed-e2e` and run it under the witness
436
- (`gateforge tests mark --test <key> --kind observed-e2e --obligation <id>
437
- --reason "…"` then `gateforge test-gates --changed`). The overlay
438
- instruction — write `tests/e2e/gateforge/<resource>.<op>.spec.js` — belongs
439
- to `newTestNeeded: true`, i.e. no existing test fits. A suggestion block
467
+ When a candidate exists and its verdict is `no`, the suggestion's next
468
+ action is to MARK that existing test `observed-e2e` and run it under the
469
+ witness (`gateforge tests mark --test <key> --kind observed-e2e
470
+ --obligation <id> --reason "…"` then `gateforge test-gates --changed`).
471
+ The overlay instruction — write
472
+ `tests/e2e/gateforge/<resource>.<op>.spec.js` — belongs to
473
+ `newTestNeeded: yes`, i.e. no existing test fits; an `unverified` verdict
474
+ asks you to confirm the candidate's request first. A suggestion block
440
475
  never tells you to write a new overlay test and, in the same breath, to
441
476
  reuse the test it just listed.
442
477
 
@@ -629,12 +664,17 @@ and `--require-e2e` blocks — it never downgrades to a weaker pass.
629
664
  Gateforge hashes all inputs and all candidate files. On a terminal, the first
630
665
  `gateforge init` asks for documentation-only folders to exclude. Automation can
631
666
  use `gateforge init --docs-exclude docs,handbook`; a non-interactive run with no
632
- option keeps the default. Gateforge writes the approved declaration to
633
- `.gateforge/docs-exclusions.yml` and prints the candidate trusted-policy digest
634
- to approve through the protected `GATEFORGE_APPROVED_POLICY_DIGEST` setting.
635
- Gate checks refuse to use the exclusions until that external pin matches. A
636
- later change to the exclusion declaration changes the digest; use
637
- `--confirm-doc-exclusions` when `init` changes an existing approval.
667
+ option keeps the default. Gateforge writes the approved declaration into
668
+ `.gateforge.yml`, under `evidence.exclude.docs`, and prints the candidate
669
+ trusted-policy digest to approve through the protected
670
+ `GATEFORGE_APPROVED_POLICY_DIGEST` setting. Gate checks refuse to use the
671
+ exclusions until that external pin matches. A later change to the declaration
672
+ changes the digest; use `--confirm-doc-exclusions` when `init` changes an
673
+ existing approval. The declaration is inserted as text, so the rest of your
674
+ `.gateforge.yml` (comments, key order, quoting) is preserved byte for byte.
675
+ Before 0.10 this list lived in its own `.gateforge/docs-exclusions.yml`; a
676
+ repository that still carries that file is refused by name until
677
+ `gateforge migrate --confirm` moves it.
638
678
 
639
679
  The project states these folders do not affect the product or its tests.
640
680
  Gateforge does not prove this. If application or test code reads an excluded
@@ -658,16 +698,36 @@ reduced guarantee still apply.
658
698
  default, Python bytecode remains part of candidate and input identity. To
659
699
  exclude only exact generated cache files, run
660
700
  `gateforge init --cache-exclude src/__pycache__/module.cpython-313.pyc`.
661
- The command writes `.gateforge/cache-exclusions.yml` and prints the trusted
662
- policy digest to approve outside the repository. A matching protected
701
+ The command writes the list into `.gateforge.yml` under
702
+ `evidence.exclude.cache` and prints the trusted policy digest to approve
703
+ outside the repository. A matching protected
663
704
  `GATEFORGE_APPROVED_POLICY_DIGEST` pin is REQUIRED before a gate uses the
664
- list; changing an existing list requires `--confirm-cache-exclusions`.
705
+ list; changing an existing list requires `--confirm-cache-exclusions`. Before
706
+ 0.10 this list lived in `.gateforge/cache-exclusions.yml`, and
707
+ `gateforge migrate --confirm` moves it.
665
708
  Only exact `.pyc` or `.pyo` files directly under `__pycache__` are allowed;
666
709
  globs, symlinks, configured inputs, and other file types fail closed. Reports
667
710
  show the exact files, pin status, and reduced trust guarantee. This is an
668
711
  owner assertion, not proof that the excluded bytecode cannot affect runtime
669
712
  behavior.
670
713
 
714
+ **Re-pinning the approved policy digest.** The pin is one aggregate hash, so a
715
+ mismatch alone never said WHICH input moved. Two things answer that now.
716
+ `gateforge enforcement doctor` reports `policy-inputs-vs-HEAD` — the
717
+ trusted-digest inputs whose STAGED bytes differ from HEAD, named one by one
718
+ (`policy inputs changed since HEAD: .gateforge.yml, .gateforge/runtime.yml`); a
719
+ whitespace-only edit counts, because it moves the digest — and `approved-digest`,
720
+ which compares the provisioned pin with the STAGED digest: `matches staged`,
721
+ `does NOT match staged (changed inputs: …)`, or `absent`. Both rows read the one
722
+ entry list the digest is computed from, so they cannot disagree.
723
+ `gateforge enforcement pin --pin-file <path> [--confirm]` then writes that value
724
+ for you. The policy inputs it covers are `.gateforge.yml`, the policies and
725
+ classification-policy documents, `.gateforge/test-map.yml`, the behavior and
726
+ runtime documents, the adapters, waivers and quarantine directories, and every
727
+ local in-process plugin module. Stage every policy file first: the pin digests
728
+ the STAGED bytes, and a working tree that differs from the index is refused by
729
+ name instead of pinning a revision the gate never digests.
730
+
671
731
  **Managed mode** (config `enforcement.mode: managed`) — the literal
672
732
  no-bypass guarantee requires putting the authoritative Git metadata, commit
673
733
  service, gate executable, policy authority, and signing material OUTSIDE the
@@ -742,7 +802,7 @@ else):
742
802
  | Namespace | Status |
743
803
  | --- | --- |
744
804
  | `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) |
745
- | `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 |
805
+ | `http:request-observed`, `http:response-status-ok` | AVAILABLE — engine browser, or the Observe channel for tests mapped `observed-e2e` (an exchange the witness proxied in the test's own session; test attribution is suite-claimed). The engine path grades FIRST and its verdict is final: a `satisfied` grade keeps its own record ids, and an `invalid` one (a witnessed exchange of a different endpoint, a non-2xx response) is an engine-found error no second channel may mask. The Observe channel is consulted only when the engine path found nothing |
746
806
  | `http:frontend-request-observed` | UNAVAILABLE — no independent browser/test attribution channel; explicit selection remains blocking `missing` with `VERIFIER_UNSUPPORTED` |
747
807
  | `crud:*` (UI-semantic) | FAIL-CLOSED — the tested suite owns the browser; use `persistence:*` |
748
808
  | `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 |
@@ -844,6 +904,77 @@ Enforcement-relevant sections:
844
904
  `cypress`. `check`, `next`, `tests`, `test-gates`, `doctor` and `init`
845
905
  all follow it. See `guides/RUNNER-NEUTRAL-EVIDENCE.md`.
846
906
 
907
+ ## Classification policy (`.gateforge/classification-policy.yml`)
908
+
909
+ The repository-wide deterministic classification inputs. `gateforge init`
910
+ scaffolds the file; every key is an OWNER answer, and the file
911
+ participates in the trusted-policy digest, so changing it re-approves any
912
+ approved policy pin before strict gates run.
913
+
914
+ | Key | What it decides | Shape |
915
+ | --- | --- | --- |
916
+ | `scanRoots` | the files a closed-world proof must cover | repo-root-relative globs |
917
+ | `trustedInternalEntryPoints` | which entry-point categories certify internality | category + patterns + detector |
918
+ | `internalRules` | organization rules for internal resources | `resourceName` / `resourceKind` patterns |
919
+ | `lifecycleRules` | operations that structurally do not exist, for one EXACT resource | exact `<plane>.<resource>` + `disable` |
920
+ | `deleteRules` | how removal manifests, per source glob | `match` glob + `semantics` (+ `archiveFields`) |
921
+ | `coverage` | which detector must examine which files before a proof counts | capability + detector + globs (+ `exhaustive`) |
922
+ | `declarations` | the declaration syntax detectors may emit | source strings |
923
+ | `volatileFields` | bookkeeping columns that never satisfy an update | column names |
924
+
925
+ Unknown keys, an unknown value, and two rules answering the same target
926
+ are refused (exit 2, fail closed) — the document is an input, never a
927
+ place to smuggle intent past the schema.
928
+
929
+ ### Owner-declared delete semantics (`deleteRules`)
930
+
931
+ Delete semantics are proven, never guessed. A detector that reads the
932
+ model's own declaration can prove `hard` or `archive`; when nothing
933
+ proves them, the resource stays `unclassified` and blocks with
934
+ `DELETE_SEMANTICS_UNRESOLVED` (no obligations accrue, and `gateforge
935
+ explain <resource>` names the resource and its source file). `lifecycleRules`
936
+ can DISABLE delete for one exact resource; declaring semantics is the
937
+ other half of the answer, and it needs a pattern because one declaration
938
+ usually covers a whole model tree.
939
+
940
+ ```yaml
941
+ deleteRules:
942
+ - match: 'backend/models/session/**'
943
+ semantics: hard
944
+ reason: 'Sessions are removed the moment the tenant logs out.'
945
+ - match: 'backend/models/invoice/**'
946
+ semantics: archive
947
+ archiveFields:
948
+ status: archived
949
+ reason: 'Invoices are retained for the audit window.'
950
+ ```
951
+
952
+ - `match` is a repo-root-relative glob over the SOURCE FILE of the
953
+ resources it declares for — the same glob engine `.gateforge/planes.json`
954
+ uses. It must stay inside the repository.
955
+ - `semantics` is `hard` or `archive`. `archive` REQUIRES non-empty
956
+ `archiveFields`: the owner-owned archived state (e.g.
957
+ `{status: archived}`) the engine grades removal against. `hard` must not
958
+ carry the key — a permanent removal has no archived state.
959
+ - `reason` is required and is shown with the rule in traces.
960
+
961
+ Write it with the command, which previews without `--confirm` and writes
962
+ with it (folder answers become `match: '<folder>/**'`):
963
+
964
+ ```sh
965
+ gateforge classify delete backend/models/invoice archive \
966
+ --archive-field status=archived \
967
+ --reason 'Invoices are retained for the audit window.' --confirm
968
+ ```
969
+
970
+ Declaring semantics is an evidence CONTRACT, not an override: the rule
971
+ contributes the same delete-semantics / archive-state evidence a detector
972
+ would. Detector evidence that disagrees therefore still blocks — the
973
+ conflicting-semantics detail names the owner declaration — and nothing is
974
+ ever silently overridden. A resolved decision names the rule it used
975
+ (`DELETE_SEMANTICS_OWNER_RULE(<match>)` in the trace), and a resource
976
+ outside every `match` is exactly as it was.
977
+
847
978
  ## Plugin invocation
848
979
 
849
980
  Every configured plugin runs over the same expanded include path list
@@ -1479,13 +1610,32 @@ artifacts automatically creates auditable testing responsibilities.
1479
1610
 
1480
1611
  Blocked agents run `gateforge next` (or `gateforge next --json`): exactly
1481
1612
  one blocking next action (`next`/`cause`/`why`/`do`), never a dump. Do the
1482
- single `do:` line and stop. New proof tests go in `tests/e2e/gateforge/`
1613
+ single `do:` line and stop. New proof goes in `tests/e2e/gateforge/`
1483
1614
  (overlay, engine-driven fixture — wizard creates via surface v2 steps);
1484
- existing suite-driven browser tests prove persistence via the Observe
1485
- channel once mapped `--kind observed-e2e`. Never rewrite existing
1486
- `tests/e2e/**` journeys, never `tests mark` as proof, never edit policies
1487
- or waivers to self-approve. `GATEFORGE.md` (written by `gateforge init`)
1488
- carries the full loop contract.
1615
+ existing suite-driven browser tests prove persistence and transport via the
1616
+ Observe channel once mapped `--kind observed-e2e` — but ONLY when the test's
1617
+ `page` comes from Gateforge's own test object, because that fixture is what
1618
+ routes the test's app traffic through the supervisor's session observation
1619
+ proxy. A test that takes `page` from plain `@playwright/test` reaches the app
1620
+ directly, the witness observes nothing, and the claims finalize missing while
1621
+ the test passes. When the suite has one shared fixture file, rebase it on
1622
+ Gateforge's fixture and change nothing else in the suite:
1623
+
1624
+ ```js
1625
+ // CommonJS suite (Node >= 20.19 / >= 22.12 for require)
1626
+ const { test: baseTest, expect } = require('@gate-forge/pack-playwright/fixture');
1627
+ ```
1628
+
1629
+ ```ts
1630
+ // ESM suite
1631
+ import { test as baseTest, expect } from '@gate-forge/pack-playwright/fixture';
1632
+ ```
1633
+
1634
+ Rebasing the shared base is not rewriting a journey: the journeys' own steps,
1635
+ assertions and fixtures stay as they are, and only the `test` object they
1636
+ extend changes. Never rewrite existing `tests/e2e/**` journeys, never
1637
+ `tests mark` as proof, never edit policies or waivers to self-approve.
1638
+ `GATEFORGE.md` (written by `gateforge init`) carries the full loop contract.
1489
1639
 
1490
1640
  ## Fix a failing test without a full run
1491
1641
 
@@ -37,6 +37,42 @@ Export those values before `gateforge run` or `test-gates`. Only listed names re
37
37
 
38
38
  Engine `GATEFORGE_*` names and process-loader controls (`NODE_OPTIONS`, `NODE_PATH`, `LD_*`, `DYLD_*`, `PYTHONPATH`, `PYTHONHOME`, `BASH_ENV`, `ENV`) are refused even if listed. No list means no additional variables are forwarded. Supervised test-gates refuses these names with usage error 2 before its harness setup, plugin pipeline, or native test enumeration.
39
39
 
40
+ ## Point the suite at the origin Gateforge routes
41
+
42
+ **Rule:** Make the origin your suite loads the SAME origin
43
+ `GATEFORGE_APP_BASE_URL` names, and make sure the suite's own base-URL
44
+ variable actually reaches the test process — one of these two, never
45
+ neither:
46
+
47
+ - the suite's base URL variable is listed in `runtime.yml`
48
+ `envAllowlist` (`E2E_BASE_URL`, `TEST_API_URL`, … — whatever your
49
+ helpers read), or
50
+ - the suite reads no variable of its own and uses
51
+ `GATEFORGE_APP_BASE_URL` directly.
52
+
53
+ **Why:** A witnessed run only rewrites requests to `GATEFORGE_APP_BASE_URL`
54
+ onto the supervisor's session observation proxy. When the tests load some
55
+ other origin — `http://localhost:13001` while Gateforge was pointed at
56
+ `http://localhost:13101` — nothing is routed, the witness observes nothing,
57
+ and every `observed-e2e` transport claim finalizes as missing while the test
58
+ itself passes. A missing variable fails the same way, only more quietly: the
59
+ suite falls back to its own default and Gateforge never learns about it.
60
+
61
+ The zero-traffic note names the origin the page really requested when it can:
62
+
63
+ ```
64
+ observe 'tenant.accounts:http:request-observed': no HTTP exchange passed
65
+ through this session's observation proxy before finalize …; this test's page
66
+ requested 'http://localhost:13001', which the fixture did not route: it
67
+ rewrites only GATEFORGE_APP_BASE_URL ('http://localhost:13101') onto this
68
+ session's proxy — set GATEFORGE_APP_BASE_URL to the origin your suite uses, or
69
+ add your suite's base-URL variable to envAllowlist in runtime.yml so it
70
+ reaches the test process
71
+ ```
72
+
73
+ That sentence is a diagnostic: it names the cause, it decides nothing. A
74
+ claim that stays missing stays missing.
75
+
40
76
  ## Create login state against the app
41
77
 
42
78
  **Rule:** Mint the Playwright login state by connecting directly to the app, not through the witness proxy. Reuse one session file instead of repeatedly logging in. Set `GATEFORGE_SESSION_STATE` to that file for the supervised run.