@gate-forge/cli 0.13.0 → 0.13.2
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/CHANGELOG.md +164 -0
- package/README.md +2 -0
- package/bin/gateforge.js +17 -1
- package/dist/args.d.ts +13 -0
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +16 -0
- package/dist/args.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +5 -1
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/common.d.ts +26 -0
- package/dist/commands/common.d.ts.map +1 -1
- package/dist/commands/common.js +41 -0
- package/dist/commands/common.js.map +1 -1
- package/dist/commands/enforcement.d.ts.map +1 -1
- package/dist/commands/enforcement.js +40 -1
- 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 +17 -7
- package/dist/commands/explain.js.map +1 -1
- package/dist/commands/init-presets.d.ts +5 -3
- package/dist/commands/init-presets.d.ts.map +1 -1
- package/dist/commands/init-presets.js +7 -3
- package/dist/commands/init-presets.js.map +1 -1
- package/dist/commands/init.js +2 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/next.d.ts.map +1 -1
- package/dist/commands/next.js +5 -14
- package/dist/commands/next.js.map +1 -1
- package/dist/commands/test-gates.d.ts.map +1 -1
- package/dist/commands/test-gates.js +21 -2
- 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 +280 -10
- package/dist/commands/tests.js.map +1 -1
- package/dist/repo-scan.d.ts +2 -1
- package/dist/repo-scan.d.ts.map +1 -1
- package/dist/repo-scan.js +51 -0
- package/dist/repo-scan.js.map +1 -1
- package/dist/run-evidence.d.ts +190 -0
- package/dist/run-evidence.d.ts.map +1 -0
- package/dist/run-evidence.js +361 -0
- package/dist/run-evidence.js.map +1 -0
- package/dist/staged-candidate.d.ts.map +1 -1
- package/dist/staged-candidate.js +2 -1
- package/dist/staged-candidate.js.map +1 -1
- package/guides/CONNECT-YOUR-PROJECT.md +37 -5
- package/guides/QUICKSTART.md +29 -12
- package/guides/REFERENCE.md +68 -4
- package/guides/TEST-ENVIRONMENT.md +21 -0
- package/package.json +11 -11
package/guides/QUICKSTART.md
CHANGED
|
@@ -24,11 +24,11 @@ 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.13.
|
|
28
|
-
@gate-forge/pack-playwright@0.13.
|
|
29
|
-
@gate-forge/pack-http@0.13.
|
|
30
|
-
@gate-forge/pack-fastapi@0.13.
|
|
31
|
-
@gate-forge/pack-sqlalchemy@0.13.
|
|
27
|
+
@gate-forge/cli@0.13.2 \
|
|
28
|
+
@gate-forge/pack-playwright@0.13.2 \
|
|
29
|
+
@gate-forge/pack-http@0.13.2 \
|
|
30
|
+
@gate-forge/pack-fastapi@0.13.2 \
|
|
31
|
+
@gate-forge/pack-sqlalchemy@0.13.2
|
|
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`.
|
|
@@ -49,7 +49,7 @@ This installs every pack of the release; the scan still recommends the ones your
|
|
|
49
49
|
|
|
50
50
|
**You should see:** npm installs the packages without a Gateforge compatibility error.
|
|
51
51
|
|
|
52
|
-
**If not:** align every direct `@gate-forge/*` package to `0.13.
|
|
52
|
+
**If not:** align every direct `@gate-forge/*` package to `0.13.2`, then install again. Do not work around the compatibility error.
|
|
53
53
|
|
|
54
54
|
## 2. Pick a goal
|
|
55
55
|
|
|
@@ -74,11 +74,12 @@ hard the gate blocks; it never waives an obligation and never hides code
|
|
|
74
74
|
from the scan.
|
|
75
75
|
|
|
76
76
|
An AI agent or CI run with no terminal and no `--preset` writes `light` only
|
|
77
|
-
and says so on ONE line, together with the
|
|
77
|
+
and says so on ONE line, together with the edit that changes it:
|
|
78
78
|
`no terminal: writing the light preset (report everything, block nothing) — a
|
|
79
|
-
human must choose the goal:
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
human must choose the goal: edit `mode:` in .gateforge.yml (light: `mode: warn`,
|
|
80
|
+
normal: `mode: changed`, strict: `mode: strict`)`. The closing summary then
|
|
81
|
+
reports what was written without naming the goal again. Gateforge will not guess
|
|
82
|
+
`normal` or `strict` for someone who is not there.
|
|
82
83
|
|
|
83
84
|
**You should see:** the goal you asked for, followed by a summary of what was
|
|
84
85
|
written and an `undo:` command.
|
|
@@ -212,6 +213,14 @@ gateforge tests mark \
|
|
|
212
213
|
|
|
213
214
|
`tests mark` writes `.gateforge/test-map.yml`. Commit that file so `check`, hooks, and CI can read the declaration without listing the suite. Replace the example values with exact values from your catalog and suggestion output. Never mark a test that does not perform the claimed behavior.
|
|
214
215
|
|
|
216
|
+
`--obligation` is repeatable — one mark can declare several claims for one
|
|
217
|
+
test (`--obligation '<id-a>' --obligation '<id-b>'`). A second `tests mark` for
|
|
218
|
+
the same test ADDS its claims to the existing declaration (it never replaces
|
|
219
|
+
them) and prints the full resulting claim list. A repeat that declares a
|
|
220
|
+
DIFFERENT `--kind` or a different `--category` set is refused, naming both —
|
|
221
|
+
edit the entry's `kind:`/`categories:` in `.gateforge/test-map.yml` yourself to
|
|
222
|
+
change a declaration's meaning.
|
|
223
|
+
|
|
215
224
|
**You should see:** the sidecar diff, or a current annotation in the test. A repeated identical `tests mark` reports no changes.
|
|
216
225
|
|
|
217
226
|
**If not:** rerun discovery, copy the exact test key and obligation ID, and resolve any mapping contradiction. Do not use a declaration to silence a blocker.
|
|
@@ -273,6 +282,14 @@ one source, never both.
|
|
|
273
282
|
|
|
274
283
|
The command prints a key ID, not the secret. Set the app URL and any session state the suite needs. The application and test environment must already be running; see [Test environment](TEST-ENVIRONMENT.md).
|
|
275
284
|
|
|
285
|
+
If the suite reads its own environment variables (a base URL, a test mail
|
|
286
|
+
box, a seeded password), the supervised runner forwards ONLY the names
|
|
287
|
+
declared in `.gateforge/runtime.yml`'s `envAllowlist` — and that file
|
|
288
|
+
counts only when `.gateforge.yml` also declares
|
|
289
|
+
`runtime: .gateforge/runtime.yml`. Both blocks together are the recipe in
|
|
290
|
+
[Test environment → Declare test-service environment variables](TEST-ENVIRONMENT.md#declare-test-service-environment-variables); a suite whose variables never reach the test process silently falls
|
|
291
|
+
back to its own defaults.
|
|
292
|
+
|
|
276
293
|
**You should see:** `verifier key ring created` and an active key ID.
|
|
277
294
|
|
|
278
295
|
**If a ring already exists:** the command says so — it names the ring, the active
|
|
@@ -306,7 +323,7 @@ and a build that is installed but cannot start names the loader's own line and
|
|
|
306
323
|
|
|
307
324
|
**You should see:** the selected tests pass and the run seals a receipt.
|
|
308
325
|
|
|
309
|
-
**If not:** use the first typed blocker. Check the changed-file base, mapping, app readiness, seed data, and verifier key. A test declaration or a plain passing test run is not a receipt.
|
|
326
|
+
**If not:** use the first typed blocker. Check the changed-file base, mapping, app readiness, seed data, and verifier key. A test that fails on an environment variable the raw runner saw — `ECONNREFUSED` on a stale default host, an empty token — is the env recipe: list the name in `.gateforge/runtime.yml` `envAllowlist` AND declare `runtime: .gateforge/runtime.yml` in `.gateforge.yml` (the file without the `.gateforge.yml` block is silently ignored) — [Test environment → Declare test-service environment variables](TEST-ENVIRONMENT.md#declare-test-service-environment-variables). A test declaration or a plain passing test run is not a receipt.
|
|
310
327
|
|
|
311
328
|
## 8. Check the changed code
|
|
312
329
|
|
|
@@ -484,7 +501,7 @@ the registry. To gate a release that is not on the registry yet (a local
|
|
|
484
501
|
regenerate:
|
|
485
502
|
|
|
486
503
|
```sh
|
|
487
|
-
GATEFORGE_CI_ENGINE_SOURCE=vendor/gate-forge-cli-0.13.
|
|
504
|
+
GATEFORGE_CI_ENGINE_SOURCE=vendor/gate-forge-cli-0.13.2.tgz \
|
|
488
505
|
gateforge enforce --ci github
|
|
489
506
|
```
|
|
490
507
|
|
package/guides/REFERENCE.md
CHANGED
|
@@ -44,7 +44,7 @@ first commands; the guides cover the walks:
|
|
|
44
44
|
|
|
45
45
|
| Command | Purpose | Exit codes |
|
|
46
46
|
| --- | --- | --- |
|
|
47
|
-
| `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
|
|
47
|
+
| `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. The scan reads every `package.json` it walks — root or nested (a `frontend/` workspace): `react-router` or `react-router-dom` in `dependencies` or `devDependencies` recommends `@gate-forge/pack-react-router`, with the declaring file as the printed reason. 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 `mode:` edit in `.gateforge.yml` that changes it — a `--preset` re-run cannot be the remedy, because init never rewrites an existing config and the re-run would exit 2. 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 |
|
|
48
48
|
| `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 |
|
|
49
49
|
|
|
50
50
|
|
|
@@ -53,10 +53,10 @@ first commands; the guides cover the walks:
|
|
|
53
53
|
| `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 |
|
|
54
54
|
| `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 `planes:` section of the owner-answers document; snapshots are derived review artifacts and never pipeline input. | 0/1/2 |
|
|
55
55
|
| `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 |
|
|
56
|
-
| `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 |
|
|
56
|
+
| `gateforge explain <resourceId\|obligationId\|path> [--json]` | Show one resource's detector signals, classification rules, decision fingerprint, typed blocks, and generated obligations. An OBLIGATION id (`<resourceId>:<contract>` — the exact id `tests suggest`, `check` and `next` print) resolves to that obligation's resource and names it in the obligation list (`<- requested`), so a trace an owner is pointed at is always reachable. 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 |
|
|
57
57
|
| `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 |
|
|
58
|
-
| `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 |
|
|
59
|
-
| `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). `--test` accepts EITHER documented key form: the catalog `logicalKey` (`playwright:chromium:e2e/accounts.spec.ts:Accounts>deletes an account`) or the reconciliation key `<file>#<titlePath joined by '>'` (`e2e/accounts.spec.ts#Accounts>deletes an account`). The sidecar always stores the `logicalKey`. 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 |
|
|
58
|
+
| `gateforge tests suggest [--changed] [--from-run [--run-dir <dir>]] [--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. `--from-run` reads a COMPLETED witnessed run and names tests by what their pages actually called (see "Suggestions from a witnessed run" below). An inspection surface, NOT a gate: exit 0 even with blocking problems. | 0/2 |
|
|
59
|
+
| `gateforge tests mark --test <key> --kind <kind> [--category <c>]... (--obligation <id>... \| --rule <ruleId>/<caseId>) --reason "<text>"` | Declare an existing test in `.gateforge/test-map.yml` (see the test-reuse workflow below). `--test` accepts EITHER documented key form: the catalog `logicalKey` (`playwright:chromium:e2e/accounts.spec.ts:Accounts>deletes an account`) or the reconciliation key `<file>#<titlePath joined by '>'` (`e2e/accounts.spec.ts#Accounts>deletes an account`). The sidecar always stores the `logicalKey`. Validates against the CURRENT catalog and obligation registry, writes atomically and idempotently, prints the exact diff. A repeated mark for the same test UNIONS its claims (never replaces; prints the resulting claim list) and refuses a changed kind or category set. Never edits test files, never adds waivers, refuses contradictions. | 0/2 |
|
|
60
60
|
| `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 |
|
|
61
61
|
| `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. `--test` takes the same two key forms as `tests mark` (see above). | 0/2 (unknown or ambiguous key → 2) |
|
|
62
62
|
| `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 |
|
|
@@ -407,6 +407,15 @@ tests:
|
|
|
407
407
|
reason: Existing journey deletes the selected account.
|
|
408
408
|
```
|
|
409
409
|
|
|
410
|
+
`--obligation` (and `--rule`, `--case`) are repeatable: one mark declares
|
|
411
|
+
several claims for one test. A repeated `tests mark` for a test that already
|
|
412
|
+
has a declaration UNIONS the new claims with the existing ones — it never
|
|
413
|
+
replaces the earlier declaration — and prints the full resulting claim list.
|
|
414
|
+
The merge refuses (exit 2, nothing written) when the repeat declares a
|
|
415
|
+
different `kind` or a different `categories` set, naming both; edit the
|
|
416
|
+
entry's `kind:`/`categories:` in `.gateforge/test-map.yml` yourself to change
|
|
417
|
+
what an existing declaration means. An identical repeat stays a no-op.
|
|
418
|
+
|
|
410
419
|
`--test` accepts EITHER of the two key forms the surfaces hand you, and
|
|
411
420
|
both name the same test. The catalog `logicalKey` is what `tests discover`,
|
|
412
421
|
`tests suggest` and `check` print:
|
|
@@ -528,6 +537,27 @@ asks you to confirm the candidate's request first. A suggestion block
|
|
|
528
537
|
never tells you to write a new overlay test and, in the same breath, to
|
|
529
538
|
reuse the test it just listed.
|
|
530
539
|
|
|
540
|
+
### Suggestions from a witnessed run (`--from-run`)
|
|
541
|
+
|
|
542
|
+
Name-based ranking guesses; a witnessed run OBSERVES. After a
|
|
543
|
+
`gateforge test-gates` run, the page observer has recorded, per test, every
|
|
544
|
+
API request each page made (`apiStatuses` on the run's `page.observed`
|
|
545
|
+
records, each entry carrying its method). `tests suggest --from-run`
|
|
546
|
+
[--run-dir <dir>] reads that ledger from the run state directory (default:
|
|
547
|
+
`.gateforge/test-gates`) and matches every same-origin app API exchange with
|
|
548
|
+
a status under 400 against the CURRENT endpoint inventory under the router
|
|
549
|
+
semantics the static join uses: a literal segment beats a parameter, and
|
|
550
|
+
more than one equal match is reported as AMBIGUOUS — never guessed. For
|
|
551
|
+
every observation obligation (`http:request-observed`,
|
|
552
|
+
`http:response-status-ok`) the run's evidence can answer but no test
|
|
553
|
+
declares and the run itself did not satisfy, it prints the tests whose pages
|
|
554
|
+
made the call, the evidence lines (`METHOD path -> status (run <runId>)`),
|
|
555
|
+
and the exact `tests mark --test '<key>' --kind observed-e2e …` command —
|
|
556
|
+
advisory only; nothing is written. Two advisory sections follow: exchanges
|
|
557
|
+
that matched NO endpoint (a call to a route the backend does not serve is
|
|
558
|
+
usually an app bug) and the ambiguous ones, each with the test and path.
|
|
559
|
+
The sweep referee's own visits (`page-sweep`) are never a test's evidence.
|
|
560
|
+
|
|
531
561
|
### A declared mapping is visible in `check`
|
|
532
562
|
|
|
533
563
|
After `tests mark`, `check` says `mapped to: <test keys> (not yet witnessed)`
|
|
@@ -1218,6 +1248,30 @@ controller-held — derived from the audience declaration, registered with
|
|
|
1218
1248
|
the witness, never supplied by the suite — so both proof channels grade it
|
|
1219
1249
|
identically.
|
|
1220
1250
|
|
|
1251
|
+
A page may legitimately keep a connection open forever: a long poll, a
|
|
1252
|
+
WebSocket, or a server-sent-events stream. Declare those path prefixes
|
|
1253
|
+
under `pages.liveChannels` (each starting with `/`) and both channels
|
|
1254
|
+
treat a same-origin request under a declared prefix — plus any WebSocket
|
|
1255
|
+
upgrade on the app host and any `text/event-stream` response, as protocol
|
|
1256
|
+
facts — as a LIVE CHANNEL: it never counts as app data evidence, never
|
|
1257
|
+
holds the visit's settle wait, and never refuses the page by itself; the
|
|
1258
|
+
visit payload lists what it saw under `liveChannels` (count + paths).
|
|
1259
|
+
Nothing is guessed from names or traffic: an undeclared long poll is still
|
|
1260
|
+
an unfinished app data request and refuses the page with
|
|
1261
|
+
`PAGE_API_UNSETTLED` once the settle budget expires. Like the rest of the
|
|
1262
|
+
page configuration, the prefixes are controller-held and registered with
|
|
1263
|
+
the witness, so both proof channels apply the same rule.
|
|
1264
|
+
|
|
1265
|
+
A rejected audience session stops that audience's sweep. When an audience
|
|
1266
|
+
WITH a session lands on one of its declared login routes on the FIRST
|
|
1267
|
+
visited page, that page is graded as today, and every remaining page of
|
|
1268
|
+
the same audience is refused WITHOUT visiting, with
|
|
1269
|
+
`PAGE_AUDIENCE_SESSION_INVALID` — the records still issue, and the sweep
|
|
1270
|
+
payload says each page was not visited and why. Session-less audiences are
|
|
1271
|
+
unaffected. The usual cause is a rotating refresh token: the suite's run
|
|
1272
|
+
consumed the session a storage-state file carried, so mint a session file
|
|
1273
|
+
the suite does not consume.
|
|
1274
|
+
|
|
1221
1275
|
Per test, only a page's LATEST observation (`observationSequence`) counts.
|
|
1222
1276
|
An early clean visit cannot hide a later refusal by the same test, and
|
|
1223
1277
|
another passing test's latest clean visit still proves the page. A missing
|
|
@@ -2174,6 +2228,16 @@ const { test: baseTest, expect } = require('@gate-forge/pack-playwright/fixture'
|
|
|
2174
2228
|
import { test as baseTest, expect } from '@gate-forge/pack-playwright/fixture';
|
|
2175
2229
|
```
|
|
2176
2230
|
|
|
2231
|
+
The fixture module also exports `request` (next to `test`/`expect`): the
|
|
2232
|
+
witnessed Playwright APIRequestContext channel. The `request` fixture and
|
|
2233
|
+
`page.request`/`context.request` of witnessed tests are wrapped
|
|
2234
|
+
automatically; a context from `request.newContext()` is witnessed when the
|
|
2235
|
+
call happens inside a test body and goes straight to the app in worker
|
|
2236
|
+
hooks and module scope (setup stays uncredited). Every app-origin call is
|
|
2237
|
+
rehosted onto the session proxy — path, query, headers and body untouched;
|
|
2238
|
+
other origins pass through, and a same-host or loopback other origin is
|
|
2239
|
+
reported through the same unrouted-origin channel as the page.
|
|
2240
|
+
|
|
2177
2241
|
Rebasing the shared base is not rewriting a journey: the journeys' own steps,
|
|
2178
2242
|
assertions and fixtures stay as they are, and only the `test` object they
|
|
2179
2243
|
extend changes. Never rewrite existing `tests/e2e/**` journeys, never
|
|
@@ -73,6 +73,27 @@ reaches the test process
|
|
|
73
73
|
That sentence is a diagnostic: it names the cause, it decides nothing. A
|
|
74
74
|
claim that stays missing stays missing.
|
|
75
75
|
|
|
76
|
+
## Present the environment marker on the app origin itself
|
|
77
|
+
|
|
78
|
+
**Rule:** The app behind `GATEFORGE_APP_BASE_URL` must answer
|
|
79
|
+
`x-gateforge-env-fingerprint: <value>` — the same value exported as
|
|
80
|
+
`GATEFORGE_TARGET_FINGERPRINT` in the environment that runs the gate — and
|
|
81
|
+
the witness checks the marker at STARTUP against `GATEFORGE_APP_BASE_URL`
|
|
82
|
+
itself: the origin the browser loads, not only the adapter routes that
|
|
83
|
+
read the header. An app with several origins behind that base URL
|
|
84
|
+
(frontend and backend) needs a front that adds the header on ALL of them.
|
|
85
|
+
|
|
86
|
+
**Why:** The run refuses to start with `AttestationError` GF-13
|
|
87
|
+
("presents no 'x-gateforge-env-fingerprint' marker") when the base URL's
|
|
88
|
+
first response carries no marker — before any test executes. An app that
|
|
89
|
+
sets the header only on its API routes fails that startup check exactly
|
|
90
|
+
like an app that never heard of the marker; the failure names the origin
|
|
91
|
+
it checked.
|
|
92
|
+
|
|
93
|
+
**Example:** a small reverse proxy in front of `GATEFORGE_APP_BASE_URL`
|
|
94
|
+
that sets the header on every proxied response, frontend and backend
|
|
95
|
+
alike.
|
|
96
|
+
|
|
76
97
|
## Create login state against the app
|
|
77
98
|
|
|
78
99
|
**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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gate-forge/cli",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"gateforgeCompatibility": {
|
|
5
5
|
"supervisedFixtureProtocol": "gateforge.supervised-playwright.v1"
|
|
6
6
|
},
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"test": "vitest run"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@gate-forge/core": "^0.13.
|
|
37
|
-
"@gate-forge/http-contract": "^0.13.
|
|
38
|
-
"@gate-forge/pack-fastapi": "^0.13.
|
|
39
|
-
"@gate-forge/pack-alembic": "^0.13.
|
|
40
|
-
"@gate-forge/pack-http": "^0.13.
|
|
41
|
-
"@gate-forge/pack-react-router": "^0.13.
|
|
42
|
-
"@gate-forge/pack-playwright": "^0.13.
|
|
43
|
-
"@gate-forge/pack-sqlalchemy": "^0.13.
|
|
44
|
-
"@gate-forge/pack-task": "^0.13.
|
|
45
|
-
"@gate-forge/plugin-protocol": "^0.13.
|
|
36
|
+
"@gate-forge/core": "^0.13.2",
|
|
37
|
+
"@gate-forge/http-contract": "^0.13.2",
|
|
38
|
+
"@gate-forge/pack-fastapi": "^0.13.2",
|
|
39
|
+
"@gate-forge/pack-alembic": "^0.13.2",
|
|
40
|
+
"@gate-forge/pack-http": "^0.13.2",
|
|
41
|
+
"@gate-forge/pack-react-router": "^0.13.2",
|
|
42
|
+
"@gate-forge/pack-playwright": "^0.13.2",
|
|
43
|
+
"@gate-forge/pack-sqlalchemy": "^0.13.2",
|
|
44
|
+
"@gate-forge/pack-task": "^0.13.2",
|
|
45
|
+
"@gate-forge/plugin-protocol": "^0.13.2",
|
|
46
46
|
"picomatch": "^4.0.7",
|
|
47
47
|
"yaml": "^2.8.1"
|
|
48
48
|
},
|