@gate-forge/cli 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +511 -51
- package/dist/adapter-audit.d.ts +154 -0
- package/dist/adapter-audit.d.ts.map +1 -0
- package/dist/adapter-audit.js +531 -0
- package/dist/adapter-audit.js.map +1 -0
- package/dist/adapter-scaffold.d.ts +66 -0
- package/dist/adapter-scaffold.d.ts.map +1 -0
- package/dist/adapter-scaffold.js +353 -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 +59 -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 +738 -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 +284 -0
- package/dist/commands/adapters.js.map +1 -0
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +9 -1
- 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 +81 -2
- package/dist/commands/blocking.d.ts.map +1 -1
- package/dist/commands/blocking.js +336 -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 +1008 -62
- 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 +143 -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 +800 -30
- package/dist/commands/enforcement.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 +148 -0
- package/dist/commands/init-presets.d.ts.map +1 -0
- package/dist/commands/init-presets.js +194 -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 +610 -69
- 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 +744 -15
- 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 +3619 -186
- 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 +225 -22
- package/dist/commands/tests.js.map +1 -1
- package/dist/endpoint-compiler.d.ts.map +1 -1
- package/dist/endpoint-compiler.js +29 -8
- 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 +89 -0
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +137 -16
- 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/git-hooks.d.ts +17 -0
- package/dist/git-hooks.d.ts.map +1 -1
- package/dist/git-hooks.js +119 -0
- package/dist/git-hooks.js.map +1 -1
- 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/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/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 +36 -0
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +21 -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 +52 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +141 -3
- package/dist/pipeline.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 +8 -1
- package/dist/repo-scan.d.ts.map +1 -1
- package/dist/repo-scan.js +221 -27
- 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/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/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 +73 -0
- package/dist/singleton-guidance.d.ts.map +1 -0
- package/dist/singleton-guidance.js +118 -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/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 +367 -0
- package/guides/QUICKSTART.md +404 -0
- package/guides/RUNNER-NEUTRAL-EVIDENCE.md +199 -0
- package/guides/TEST-ENVIRONMENT.md +1226 -0
- package/guides/UPGRADE-0.6-to-0.7.md +65 -0
- package/guides/UPGRADE-0.7-to-0.8.md +114 -0
- package/package.json +12 -10
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
# Quickstart
|
|
2
|
+
|
|
3
|
+
> Connecting a second project, or the whole flow including evidence adapters, the test map, and the first green commit? Read [Connect your project](CONNECT-YOUR-PROJECT.md) first; this guide stays the shortest path.
|
|
4
|
+
|
|
5
|
+
This guide takes a project from install to a blocking gate. Gateforge does not create your app, database, seed data, logins, or test services. Your team or agent provides those first. See [Test environment](TEST-ENVIRONMENT.md).
|
|
6
|
+
|
|
7
|
+
You need Node.js 20 or newer and an existing Playwright suite that can run against a disposable app.
|
|
8
|
+
|
|
9
|
+
## 1. Install the CLI and the packs you use
|
|
10
|
+
|
|
11
|
+
Install the CLI, Playwright pack, and only the detector packs that fit your app. Keep every direct `@gate-forge/*` package on the same release.
|
|
12
|
+
|
|
13
|
+
Example for a React frontend, FastAPI backend, and SQLAlchemy data layer:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm i -D \
|
|
17
|
+
@gate-forge/cli@0.8.0 \
|
|
18
|
+
@gate-forge/pack-playwright@0.8.0 \
|
|
19
|
+
@gate-forge/pack-http@0.8.0 \
|
|
20
|
+
@gate-forge/pack-fastapi@0.8.0 \
|
|
21
|
+
@gate-forge/pack-sqlalchemy@0.8.0
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
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`.
|
|
25
|
+
|
|
26
|
+
**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`.
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
npm i -D ./gate-forge-*.tgz
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This installs every pack of the release; the scan still recommends the ones your code uses, and `.gateforge.yml` loads only those.
|
|
33
|
+
|
|
34
|
+
**You should see:** npm installs the packages without a Gateforge compatibility error.
|
|
35
|
+
|
|
36
|
+
**If not:** align every direct `@gate-forge/*` package to `0.8.0`, then install again. Do not work around the compatibility error.
|
|
37
|
+
|
|
38
|
+
## 2. Pick a goal
|
|
39
|
+
|
|
40
|
+
Decide what Gateforge should do for you, then say so once:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
gateforge init --explain-presets # read what each goal writes
|
|
44
|
+
gateforge init --preset normal # or: light, or strict
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or run `gateforge init` in a terminal and answer the one question it asks.
|
|
48
|
+
|
|
49
|
+
| Goal | What you get | What it writes |
|
|
50
|
+
| --- | --- | --- |
|
|
51
|
+
| `light` | untested code is listed, nothing blocks | `mode: warn` |
|
|
52
|
+
| `normal` | a commit that adds untested endpoints or models is refused (about a second, no test run) | `mode: changed`, pre-commit hook, CI job |
|
|
53
|
+
| `strict` | every push needs a real test run Gateforge watches (the *witness*) plus a *receipt*, the signed record of that run | `mode: strict`, staged gate, pre-push receipt check, CI job |
|
|
54
|
+
|
|
55
|
+
An *obligation* is one thing your policies say must be proven (for example
|
|
56
|
+
"this endpoint really stores what it receives"). A preset only chooses how
|
|
57
|
+
hard the gate blocks; it never waives an obligation and never hides code
|
|
58
|
+
from the scan.
|
|
59
|
+
|
|
60
|
+
An AI agent or CI run with no terminal and no `--preset` writes `light` only
|
|
61
|
+
and says so on ONE line, together with the flag that changes it:
|
|
62
|
+
`no terminal: writing the light preset (report everything, block nothing) — a
|
|
63
|
+
human must choose the goal: re-run with --preset <light|normal|strict>`. The
|
|
64
|
+
closing summary then reports what was written without naming the goal again.
|
|
65
|
+
Gateforge will not guess `normal` or `strict` for someone who is not there.
|
|
66
|
+
|
|
67
|
+
**You should see:** the goal you asked for, followed by a summary of what was
|
|
68
|
+
written and an `undo:` command.
|
|
69
|
+
|
|
70
|
+
**If not:** run `gateforge init --explain-presets`. To change the goal later,
|
|
71
|
+
edit the `mode:` key in `.gateforge.yml` (see
|
|
72
|
+
[Choose how strict the gate is](#choose-how-strict-the-gate-is)); re-running
|
|
73
|
+
`init` never rewrites an existing config.
|
|
74
|
+
|
|
75
|
+
## 3. Initialize the repository
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
gateforge init
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Gateforge scans the repository and prints recommended packs, then applies the
|
|
82
|
+
goal you chose in step 2 (`--preset`, or the answer to the goal question).
|
|
83
|
+
It writes:
|
|
84
|
+
|
|
85
|
+
- `.gateforge.yml`
|
|
86
|
+
- `.gateforge/policies.yml`
|
|
87
|
+
- `.gateforge/classification-policy.yml`
|
|
88
|
+
- `.gateforge/baselines/obligations.json`
|
|
89
|
+
- `GATEFORGE.md`
|
|
90
|
+
- `tests/e2e/gateforge/README.md` for the default overlay proof path
|
|
91
|
+
|
|
92
|
+
It also creates `.gateforge/adapters/` and `.gateforge/waivers/`. It preserves existing files. A chosen documentation exclusion adds `.gateforge/docs-exclusions.yml`.
|
|
93
|
+
|
|
94
|
+
**You should see:** a scan summary, recommended packages, the goal summary
|
|
95
|
+
with its `undo:` line, and a `skeleton ready` message.
|
|
96
|
+
|
|
97
|
+
**If not:** read the first error. Fix invalid or missing project configuration, install a recommended pack, then run `gateforge init` again. Existing files are not replaced by a normal rerun.
|
|
98
|
+
|
|
99
|
+
## 4. Find existing tests and suggestions
|
|
100
|
+
|
|
101
|
+
First inventory the test suite:
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
gateforge tests discover
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Then ask Gateforge which existing tests may cover the obligations:
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
gateforge tests suggest
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Discovery writes a derived catalog under `.gateforge/test-gates/`. Suggestions are for inspection; they do not create declarations or prove a test.
|
|
114
|
+
|
|
115
|
+
**You should see:** discovered test keys and suggestions with obligation IDs and any mapping problems.
|
|
116
|
+
|
|
117
|
+
**If not:** fix Playwright installation, configuration, or test enumeration first. Do not treat an empty or failed inventory as proof that no tests exist. If a test does not fit, the suggestion report explains what is missing.
|
|
118
|
+
|
|
119
|
+
## 5. Declare which existing tests cover claims
|
|
120
|
+
|
|
121
|
+
Use either a Playwright annotation or the tracked map file. Declarations tell the gate which test is relevant; they are not proof by themselves.
|
|
122
|
+
|
|
123
|
+
An annotation uses the exact obligation ID:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
test('updates a profile', {
|
|
127
|
+
annotation: { type: 'gateforge', description: '<obligation-id-from-suggest>' },
|
|
128
|
+
}, async ({ page }) => {
|
|
129
|
+
// Existing test body.
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Or declare an existing catalog entry with `tests mark`:
|
|
134
|
+
|
|
135
|
+
```sh
|
|
136
|
+
gateforge tests mark \
|
|
137
|
+
--test '<exact-test-key-from-discover>' \
|
|
138
|
+
--kind browser-e2e \
|
|
139
|
+
--category persistence.update \
|
|
140
|
+
--obligation '<exact-obligation-id-from-suggest>' \
|
|
141
|
+
--reason 'Existing test updates a profile.'
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`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.
|
|
145
|
+
|
|
146
|
+
**You should see:** the sidecar diff, or a current annotation in the test. A repeated identical `tests mark` reports no changes.
|
|
147
|
+
|
|
148
|
+
**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.
|
|
149
|
+
|
|
150
|
+
## 6. Prepare a verifier key and the app
|
|
151
|
+
|
|
152
|
+
Keep the key outside the repository and run-state folder:
|
|
153
|
+
|
|
154
|
+
```sh
|
|
155
|
+
gateforge key create --confirm
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
That is the whole ceremony: with no `--file` the CLI creates the key ring at
|
|
159
|
+
`"${XDG_CONFIG_HOME:-$HOME/.config}/gateforge/verifier-keyring.json"` (parent
|
|
160
|
+
directory included, owner-only, mode `0600`) and reads that same path on every
|
|
161
|
+
later command, so nothing has to be exported. Keep a key ring somewhere else
|
|
162
|
+
only on purpose: pass `--file <path>` to the ceremony AND export
|
|
163
|
+
`GATEFORGE_WITNESS_VERIFIER_KEY_FILE=<path>` for the runs that must read it —
|
|
164
|
+
one source, never both.
|
|
165
|
+
|
|
166
|
+
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).
|
|
167
|
+
|
|
168
|
+
**You should see:** `verifier key ring created` and an active key ID.
|
|
169
|
+
|
|
170
|
+
**If a ring already exists:** the command says so — it names the ring, the active
|
|
171
|
+
key ID and `gateforge key rotate --confirm` — and exits `2` without changing
|
|
172
|
+
anything. That is not a failure to fix: there is nothing to do while that key is
|
|
173
|
+
active.
|
|
174
|
+
|
|
175
|
+
**If not:** check file permissions, and keep the key file outside `.gateforge/test-gates/` and the repository. `gateforge enforcement doctor` names the ring it resolves (`verifier-key-location`) or the command that creates one.
|
|
176
|
+
|
|
177
|
+
## 7. Run the supervised tests
|
|
178
|
+
|
|
179
|
+
```sh
|
|
180
|
+
gateforge test-gates --changed
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Gateforge supervises the full relevant mapped suite and writes an authenticated receipt only after a complete successful run. To run only the tests affected by your change, add `--scope changed` (see [How much runs?](#how-much-runs)).
|
|
184
|
+
|
|
185
|
+
**Once per machine, install the browsers the runner pins:**
|
|
186
|
+
|
|
187
|
+
```sh
|
|
188
|
+
cd <the directory holding your Playwright config>
|
|
189
|
+
npx playwright install chromium
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
On a Linux machine without the browser's system libraries — a container, a CI
|
|
193
|
+
image, WSL — use `npx playwright install --with-deps chromium` instead (it
|
|
194
|
+
installs them too, and needs root or sudo). `gateforge enforcement doctor`
|
|
195
|
+
names whichever case you are in: a missing build names `npx playwright install`,
|
|
196
|
+
and a build that is installed but cannot start names the loader's own line and
|
|
197
|
+
`npx playwright install-deps chromium`.
|
|
198
|
+
|
|
199
|
+
**You should see:** the selected tests pass and the run seals a receipt.
|
|
200
|
+
|
|
201
|
+
**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.
|
|
202
|
+
|
|
203
|
+
## 8. Check the changed code
|
|
204
|
+
|
|
205
|
+
```sh
|
|
206
|
+
gateforge check --changed --require-e2e
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
This checks the changed scope and requires a current receipt for the exact inputs. Do not edit files between the witnessed run and this check; changed bytes make the receipt stale.
|
|
210
|
+
|
|
211
|
+
New receipt JSON includes an authenticated `engine` identity. If present,
|
|
212
|
+
`check --require-e2e` blocks when the installed CLI version differs; older
|
|
213
|
+
receipts without this additive key retain their existing behavior.
|
|
214
|
+
|
|
215
|
+
**You should see:** a clean report for the changed scope.
|
|
216
|
+
|
|
217
|
+
**If not:** ask Gateforge for one next action:
|
|
218
|
+
|
|
219
|
+
```sh
|
|
220
|
+
gateforge next
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Follow its `do:` line, then run the check again. See [Test environment](TEST-ENVIRONMENT.md) if the block is caused by setup or test state.
|
|
224
|
+
|
|
225
|
+
The first real `next` on a FastAPI repository asks which data plane owns a
|
|
226
|
+
route's records. That is an owner decision, so Gateforge explains the
|
|
227
|
+
question before asking it and prints one runnable command per answer. For
|
|
228
|
+
`DELETE /items/{}` on tenant-scoped records, the answer is `tenant`:
|
|
229
|
+
|
|
230
|
+
```sh
|
|
231
|
+
gateforge init --planes # once: create the owner-reviewed planes file
|
|
232
|
+
gateforge classify plane 'app/main.py' tenant \
|
|
233
|
+
--reason 'Owner review confirms the tenant plane for DELETE /items/{}.' --confirm
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Then run `gateforge next` again: the same block must not reappear. A route
|
|
237
|
+
that is genuinely internal is the other answer, and it stays owner-only (an
|
|
238
|
+
`internalRules` entry in `.gateforge/classification-policy.yml`).
|
|
239
|
+
|
|
240
|
+
To verify a specific commit tree (for example, the tip of a pushed ref)
|
|
241
|
+
instead of the current worktree or index:
|
|
242
|
+
|
|
243
|
+
```sh
|
|
244
|
+
gateforge check --candidate-commit <full-commit-sha> --require-e2e
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Add `--changed` to evaluate only that commit's first-parent diff. The command
|
|
248
|
+
uses an isolated checkout of the immutable commit tree.
|
|
249
|
+
|
|
250
|
+
## 8a. Enable behavior cases
|
|
251
|
+
|
|
252
|
+
Behavior cases are the strongest evidence Gateforge can grade: the ENGINE
|
|
253
|
+
drives the request, the app's own state is read back, and the record is
|
|
254
|
+
sealed. They are opt-in, and the setup is printed rather than guessed.
|
|
255
|
+
|
|
256
|
+
`gateforge init` reads the repository and names the behavior packs it
|
|
257
|
+
finds — the code that decides a webhook signature, an authorization
|
|
258
|
+
outcome, a state transition, or a request schema. A non-interactive run
|
|
259
|
+
(an agent, a CI job) enables **nothing** and prints the exact flag for
|
|
260
|
+
each pack it found; in a terminal it asks per pack. Either way:
|
|
261
|
+
|
|
262
|
+
```sh
|
|
263
|
+
gateforge init --behavior-packs webhook
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
That writes `.gateforge/behavior.yml` — a scaffold, not approval: one
|
|
267
|
+
commented example case per enabled pack — and prints the exact
|
|
268
|
+
`behaviorPolicy: .gateforge/behavior.yml` line to add to an existing
|
|
269
|
+
`.gateforge.yml`. `--behavior` enables every pack the scan found,
|
|
270
|
+
`--behavior-packs webhook,auth` names them yourself, and `--no-behavior`
|
|
271
|
+
keeps the run silent. A repository with no behavior pack is byte-identical
|
|
272
|
+
to before.
|
|
273
|
+
|
|
274
|
+
`gateforge next` then prints the whole remaining setup for a route it
|
|
275
|
+
found but cannot prove, and every block is finished work rather than a
|
|
276
|
+
template:
|
|
277
|
+
|
|
278
|
+
* the `endpoints:` entry for that exact route, with the case ids, the
|
|
279
|
+
adapter-backed entity the case is graded against, and the recipe the
|
|
280
|
+
repository declares under `fixtures/`;
|
|
281
|
+
* the proof test that asks the ENGINE to drive each case;
|
|
282
|
+
* the `.gateforge/test-map.yml` entries that map every case to its test;
|
|
283
|
+
* the command that runs the gate.
|
|
284
|
+
|
|
285
|
+
Paste the blocks as printed, run the gate command, and run
|
|
286
|
+
`gateforge next` again. `example/webhook` is exactly this flow: a fresh
|
|
287
|
+
copy, `gateforge init --behavior-packs webhook`, the printed steps, and a
|
|
288
|
+
green `test-gates --changed` + `check --require-e2e`.
|
|
289
|
+
|
|
290
|
+
When a declaration needs a fact the repository has not declared (an
|
|
291
|
+
entity with no reviewed adapter, a recipe that does not say what a
|
|
292
|
+
delivery records), `next` prints that fact instead of a block that could
|
|
293
|
+
not pass: the case is never printed as if it were provable.
|
|
294
|
+
|
|
295
|
+
## 9. Install the blocking hook and CI wiring
|
|
296
|
+
|
|
297
|
+
```sh
|
|
298
|
+
gateforge init --blocking
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
`gateforge init --preset strict` does the same wiring plus the strict E2E
|
|
302
|
+
enforcement block, and `--preset normal` writes the fast static pre-commit
|
|
303
|
+
lane plus the CI job without the receipt lane. The explicit flags below keep
|
|
304
|
+
working exactly as before and always win over a preset.
|
|
305
|
+
|
|
306
|
+
This installs a static pre-commit lane and (for a new config) a pre-push
|
|
307
|
+
receipt lane, then adds strict CI wiring. Review the output and generated files:
|
|
308
|
+
|
|
309
|
+
- `.git/hooks/pre-commit` (or the configured Git hooks path)
|
|
310
|
+
- `.git/hooks/pre-push` (verifies each pushed commit tip)
|
|
311
|
+
- `.gateforge/hooks/gateforge-staged.sh`
|
|
312
|
+
- `.gateforge/ci/gitlab-gateforge.yml` and `.gitlab-ci.yml` by default
|
|
313
|
+
|
|
314
|
+
The pre-commit lane checks staged bytes without requiring a receipt. The
|
|
315
|
+
pre-push lane runs `check --candidate-commit <sha> --require-e2e`; a missing
|
|
316
|
+
or stale receipt blocks the push. Existing configs without
|
|
317
|
+
`enforcement.receiptStage` retain their previous hook behavior.
|
|
318
|
+
|
|
319
|
+
`init --blocking` prints GitHub and GitLab branch-protection commands for an
|
|
320
|
+
owner to review and run; Gateforge never changes server settings itself.
|
|
321
|
+
For GitHub Actions, use `gateforge enforce --ci github` in an initialized
|
|
322
|
+
repository. It writes `.github/workflows/gateforge.yml`, which runs
|
|
323
|
+
`test-gates --changed` and verifies the exact commit with
|
|
324
|
+
`check --changed --candidate-commit "$GITHUB_SHA" --require-e2e`. Configure
|
|
325
|
+
the verifier key and policy pin as protected secrets. A local hook alone is
|
|
326
|
+
not server enforcement.
|
|
327
|
+
|
|
328
|
+
The generated GitHub workflow installs the published `@gate-forge/cli` from
|
|
329
|
+
the registry. To gate a release that is not on the registry yet (a local
|
|
330
|
+
`.tgz` or a directory), declare where CI must install it from and
|
|
331
|
+
regenerate:
|
|
332
|
+
|
|
333
|
+
```sh
|
|
334
|
+
GATEFORGE_CI_ENGINE_SOURCE=vendor/gate-forge-cli-0.8.0.tgz \
|
|
335
|
+
gateforge enforce --ci github
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
The workflow then installs that one specifier instead of the registry
|
|
339
|
+
release, so the file it must reach has to be committed with the repository.
|
|
340
|
+
Unset the variable and rerun the generator for the registry install. The
|
|
341
|
+
GitLab template needs no variable: it installs the repository's own declared
|
|
342
|
+
`@gate-forge/cli` dependency.
|
|
343
|
+
|
|
344
|
+
If your repository already had a `.pre-commit-config.yaml`, the wiring
|
|
345
|
+
appends to it and says so on one line, with the exact way back
|
|
346
|
+
(`undo: git restore -- .pre-commit-config.yaml`). Check that line before
|
|
347
|
+
you commit. Then put the `gateforge-check` entry FIRST: hooks that rewrite
|
|
348
|
+
files must not run after the gate, or they invalidate its receipt —
|
|
349
|
+
`enforcement doctor` reports those hooks as `hook-mutation` and names
|
|
350
|
+
those files.
|
|
351
|
+
|
|
352
|
+
**You should see:** `installed:`, `updated:`, `verified:`, or a framework-managed hook message, followed by `blocking gate wired`.
|
|
353
|
+
|
|
354
|
+
**If not:** follow the exact `required action` printed for an incomplete installation. Resolve hook-manager conflicts, then rerun `gateforge init --blocking` and verify the active hook.
|
|
355
|
+
|
|
356
|
+
## How much runs?
|
|
357
|
+
|
|
358
|
+
| Command | Runs |
|
|
359
|
+
| --- | --- |
|
|
360
|
+
| `gateforge test-gates --changed` | every mapped test relevant to the repository (full scope) |
|
|
361
|
+
| `gateforge test-gates --changed --scope changed` | only tests mapped to obligations affected by the changed files |
|
|
362
|
+
|
|
363
|
+
"Changed files" come from `changed.provider`: the staged index locally, or the pull/merge request diff against its base in CI. No earlier receipt or full run is needed first, and commits already on the base branch are not re-tested.
|
|
364
|
+
|
|
365
|
+
A changed slice that affects no obligation (for example, only a log constant changed) does not seal a receipt, because "nothing affected" is not proof. Run full scope in that case. Documentation-only edits avoid this when their folders are approved with `gateforge init --docs-exclude`.
|
|
366
|
+
|
|
367
|
+
`check --changed --require-e2e` accepts a slice receipt only when it covers every currently changed obligation.
|
|
368
|
+
|
|
369
|
+
## Choose how strict the gate is
|
|
370
|
+
|
|
371
|
+
`.gateforge.yml` takes one optional key:
|
|
372
|
+
|
|
373
|
+
```yaml
|
|
374
|
+
mode: warn # evaluate and report everything, exit 0 (wouldBlock says what was found)
|
|
375
|
+
mode: changed # block only on debt this change touches; the full debt is still reported
|
|
376
|
+
mode: strict # today's behavior — also the default when the key is absent
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
The key changes the GATE, never the evidence: verdicts, counts and cause
|
|
380
|
+
codes are identical in every mode, the active mode is printed in every
|
|
381
|
+
report, and `gateforge enforcement doctor` reports a non-strict mode as
|
|
382
|
+
`WARN`. A config/usage error still exits 2 in every mode. The key lives
|
|
383
|
+
inside the pinned trusted policy, so changing it is an owner decision.
|
|
384
|
+
|
|
385
|
+
## Quarantine a flaky test
|
|
386
|
+
|
|
387
|
+
```bash
|
|
388
|
+
gateforge quarantine 'playwright:chromium:tests/e2e/orders.spec.js:Orders>lists orders' \
|
|
389
|
+
--owner team-orders --approver lead@example.invalid \
|
|
390
|
+
--reason 'flaky in CI: seeded clock race' --expires 2026-04-30
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
The test key is the catalog's logical key (`gateforge tests discover`
|
|
394
|
+
prints them). The quarantine removes that test from the required set for
|
|
395
|
+
at most 14 days. It proves nothing (an obligation only it covered stays
|
|
396
|
+
`missing`) and never blocks. An expired quarantine is ignored and BLOCKS
|
|
397
|
+
until it is renewed or deleted. Only the owner can write one, and the
|
|
398
|
+
file is part of the pinned trusted policy.
|
|
399
|
+
|
|
400
|
+
## Coming next
|
|
401
|
+
|
|
402
|
+
- `gateforge tests sync` will generate test-map entries from annotations.
|
|
403
|
+
- Unprovable contracts will be off by default.
|
|
404
|
+
- Multiple updates on one row will be evaluated per step.
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Runners other than Playwright
|
|
2
|
+
|
|
3
|
+
The witness is an HTTP proxy plus a DB/queue reader. It does not care who
|
|
4
|
+
sends the traffic, so the only runner-specific work is three jobs:
|
|
5
|
+
|
|
6
|
+
1. **List** the tests before the run (the expected set is fixed first).
|
|
7
|
+
2. **Tag** every request with the test identity (a per-test session proxy
|
|
8
|
+
origin, or a signed session header).
|
|
9
|
+
3. **Read results** from a structured report (native JSON or JUnit XML) —
|
|
10
|
+
never from terminal colors.
|
|
11
|
+
|
|
12
|
+
Each runner below is a `RunnerAdapter` behind the same contract
|
|
13
|
+
(`@gate-forge/witness/adapter`) and is graded by the same conformance
|
|
14
|
+
suite: every planned test passes on the first attempt, a failure blocks, a
|
|
15
|
+
skip blocks, a runner-assisted retry blocks, an unplanned test blocks, a
|
|
16
|
+
zero-test run blocks, and a report row with no runner identity is
|
|
17
|
+
attributed to nothing. A runner's own "passed" is never authority.
|
|
18
|
+
|
|
19
|
+
Additions only: JSON keys, cause codes, exit codes, config keys and receipts
|
|
20
|
+
are frozen, and an existing Playwright project sees no change at all.
|
|
21
|
+
|
|
22
|
+
## In-process test clients are refused
|
|
23
|
+
|
|
24
|
+
The rule behind all of it: a request that never crosses the session proxy
|
|
25
|
+
can never be witnessed. supertest handed the app instance, FastAPI
|
|
26
|
+
`TestClient`, or an in-process fetch therefore fails the run with a typed
|
|
27
|
+
message instead of passing quietly. Point the client at the app's base URL
|
|
28
|
+
under the supervised run and the same test becomes real evidence.
|
|
29
|
+
|
|
30
|
+
## pytest + httpx
|
|
31
|
+
|
|
32
|
+
- **Where**: `@gate-forge/pack-playwright` — `discovery/pytest-runner-adapter.ts`
|
|
33
|
+
plus the pack's pytest plugin (`python/gateforge_pytest_plugin.py`).
|
|
34
|
+
- **Enumerate**: the configured suite argv with `--collect-only -q`. The
|
|
35
|
+
expected set is the collection result, before anything runs.
|
|
36
|
+
- **Tag**: the plugin opens a witness session per test and routes the
|
|
37
|
+
test's `httpx` client through that test's session proxy origin.
|
|
38
|
+
- **Read**: strict JUnit XML. A case without its file attribute is never
|
|
39
|
+
attributed to a test, and a duplicated case (a rerun) is reported as a
|
|
40
|
+
runner-assisted retry.
|
|
41
|
+
- **Use it**: configure the suite with `witnessed: true` and load the
|
|
42
|
+
plugin through `PYTHONPATH` (the adapter does this for you). Drive the
|
|
43
|
+
app over HTTP (`await client.post(f"{base_url}/...")`) — a
|
|
44
|
+
`TestClient(app)` call is refused.
|
|
45
|
+
|
|
46
|
+
## Jest/Vitest + supertest
|
|
47
|
+
|
|
48
|
+
- **Where**: `@gate-forge/pack-playwright` — `discovery/vitest-runner-adapter.ts`,
|
|
49
|
+
the reporter at `src/vitest/reporter.ts`, the in-test helper exported as
|
|
50
|
+
`@gate-forge/pack-playwright/vitest`.
|
|
51
|
+
- **Enumerate**: the project's own `vitest list --run --json`, so the
|
|
52
|
+
expected set comes from the runner that will execute it.
|
|
53
|
+
- **Tag**: the pack's reporter spools the same lifecycle events the
|
|
54
|
+
Playwright reporter writes, and the in-test helper resolves the
|
|
55
|
+
supervisor session for the RUNNING test and rewrites supertest traffic
|
|
56
|
+
onto that session's proxy origin.
|
|
57
|
+
- **Read**: the jest-compatible JSON report, strictly. A row with no
|
|
58
|
+
file/title identity is never attributed, and the reporter's flags
|
|
59
|
+
document surfaces `test.retry` attempts (required retries are zero).
|
|
60
|
+
- **Use it**:
|
|
61
|
+
```js
|
|
62
|
+
import request from 'supertest';
|
|
63
|
+
import { gateforgeSupertest } from '@gate-forge/pack-playwright/vitest';
|
|
64
|
+
const gate = gateforgeSupertest(request);
|
|
65
|
+
|
|
66
|
+
test('creates an account', async () => {
|
|
67
|
+
const api = await gate(process.env.GATEFORGE_APP_BASE_URL);
|
|
68
|
+
const response = await api.post('/api/accounts').send({ first_name: 'Grace' });
|
|
69
|
+
expect(response.status).toBe(201);
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
`gate(app)` with the app itself (in-process supertest) is REFUSED with
|
|
73
|
+
`IN_PROCESS_CLIENT_REFUSED` — it would be a counterfeit green.
|
|
74
|
+
|
|
75
|
+
## Cypress
|
|
76
|
+
|
|
77
|
+
- **Where**: `@gate-forge/pack-playwright` — `discovery/cypress-runner-adapter.ts`,
|
|
78
|
+
the plugin at `src/cypress/plugin.ts`, plus the support file the adapter
|
|
79
|
+
generates per run.
|
|
80
|
+
- **Enumerate**: Cypress cannot list tests without running them, so the
|
|
81
|
+
expected set is read from the spec SOURCES. A spec whose titles are not
|
|
82
|
+
static string literals enumerates as unavailable — the adapter refuses to
|
|
83
|
+
guess a half-set rather than run against an incomplete expectation.
|
|
84
|
+
- **Tag**: the adapter runs the project's own Cypress CLI with a generated
|
|
85
|
+
config that chains your config (`setupNodeEvents` included). The pack's
|
|
86
|
+
plugin registers lifecycle tasks; the generated support file resolves the
|
|
87
|
+
session for the running test and rewrites `cy.request` traffic at the app
|
|
88
|
+
origin onto that session's proxy. Traffic that does not go through it — a
|
|
89
|
+
raw browser `fetch`, a third-party origin — stays unattributed and is
|
|
90
|
+
credited to nothing.
|
|
91
|
+
- **Read**: mocha's own `after:run` results, sealed into a per-run report.
|
|
92
|
+
More than one attempt for a test is a runner-assisted retry and blocks.
|
|
93
|
+
- **Use it**: nothing to import. Run your specs as usual with
|
|
94
|
+
`cy.request` for app traffic; `cy.request` at the app origin is tagged
|
|
95
|
+
automatically under the supervised run. A CommonJS project config
|
|
96
|
+
(`cypress.config.js`/`.cjs`) is chained; an ESM/TypeScript config is
|
|
97
|
+
refused rather than silently replaced.
|
|
98
|
+
|
|
99
|
+
## Running a non-Playwright runner
|
|
100
|
+
|
|
101
|
+
Set the runner in `.gateforge.yml` and the ordinary commands drive it:
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
runner: vitest # playwright (the default) | pytest | vitest | cypress
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- `gateforge init` — scans the repository and writes `runner:` into a NEW
|
|
108
|
+
config when it sees exactly one non-Playwright runner. An ambiguous
|
|
109
|
+
repository (Playwright plus something else, or several others) keeps the
|
|
110
|
+
default and tells you to set the key yourself. An existing config is never
|
|
111
|
+
rewritten.
|
|
112
|
+
- `gateforge enforcement doctor` — reports runner readiness without
|
|
113
|
+
launching anything: its `runner` check looks for the `vitest`/`cypress`
|
|
114
|
+
config file at the repository root and an installed package, for an
|
|
115
|
+
installed `playwright`, and for `pytest` a configured
|
|
116
|
+
`diagnostics.suites` entry plus a `pytest` executable on `PATH`. It is
|
|
117
|
+
diagnostic only: it exits 0 either way, and its `runner` line is the one
|
|
118
|
+
to read. (There is no `gateforge doctor` command — that name exits 2 with
|
|
119
|
+
`unknown command 'doctor'`.)
|
|
120
|
+
- `gateforge test-gates --changed` — runs the mapped selection under the
|
|
121
|
+
configured runner and seals the receipt.
|
|
122
|
+
- `gateforge check --changed --require-e2e` — the gate; `receipt-verified`
|
|
123
|
+
means the obligation was witnessed, not that the runner went green.
|
|
124
|
+
|
|
125
|
+
### Per-runner setup
|
|
126
|
+
|
|
127
|
+
**pytest** — one suite under `diagnostics.suites`, and HTTP over the plugin's
|
|
128
|
+
client:
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
diagnostics:
|
|
132
|
+
suites:
|
|
133
|
+
- name: accounts
|
|
134
|
+
runner: pytest
|
|
135
|
+
cwd: .
|
|
136
|
+
argv: ['python', '-m', 'pytest']
|
|
137
|
+
testPaths: ['tests']
|
|
138
|
+
witnessed: true
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
`witnessed: true` keeps the suite out of the advisory diagnostic window: the
|
|
142
|
+
adapter's supervised execution IS that suite, so a second pass would run it
|
|
143
|
+
twice. The plugin (loaded automatically through `PYTHONPATH`) provides the
|
|
144
|
+
`gateforge_http` fixture — an `httpx.Client` routed through the running
|
|
145
|
+
test's session proxy:
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
def test_creates_account(gateforge_http):
|
|
149
|
+
response = gateforge_http.post('/api/accounts', json={'first_name': 'Grace'})
|
|
150
|
+
assert response.status_code == 201
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`TestClient(app)` never reaches the witness and is refused.
|
|
154
|
+
|
|
155
|
+
**vitest** — route supertest through the helper:
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
import request from 'supertest';
|
|
159
|
+
import { gateforgeSupertest } from '@gate-forge/pack-playwright/vitest';
|
|
160
|
+
const gate = gateforgeSupertest(request);
|
|
161
|
+
|
|
162
|
+
test('creates an account', async () => {
|
|
163
|
+
const api = await gate(process.env.GATEFORGE_APP_BASE_URL);
|
|
164
|
+
expect((await api.post('/api/accounts').send({ first_name: 'Grace' })).status).toBe(201);
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`request(app)` — in-process supertest — is refused with
|
|
169
|
+
`IN_PROCESS_CLIENT_REFUSED`.
|
|
170
|
+
|
|
171
|
+
**cypress** — nothing to import. Keep a CommonJS project config
|
|
172
|
+
(`cypress.config.js`/`.cjs`); an ESM/TypeScript config is refused rather than
|
|
173
|
+
silently replaced. Send app traffic with `cy.request` at the app origin and it
|
|
174
|
+
is tagged for the running test. A raw browser `fetch` is not credited, because
|
|
175
|
+
it never crosses the session proxy. The adapter pins the run's screenshot,
|
|
176
|
+
video and download folders into the run state directory, so a failing test
|
|
177
|
+
cannot drop artifacts into your tree.
|
|
178
|
+
|
|
179
|
+
### Mapping keys
|
|
180
|
+
|
|
181
|
+
In `.gateforge/test-map.yml` a non-Playwright test's `key` is
|
|
182
|
+
`<file>#<titlePath joined by '>'>` — the same identity the adapter reports:
|
|
183
|
+
|
|
184
|
+
```yaml
|
|
185
|
+
tests:
|
|
186
|
+
- key: tests/accounts.test.ts#accounts>creates an account
|
|
187
|
+
selector:
|
|
188
|
+
runner: vitest
|
|
189
|
+
file: tests/accounts.test.ts
|
|
190
|
+
titlePath: [accounts, creates an account]
|
|
191
|
+
kind: observed-e2e
|
|
192
|
+
claims: [tenant.accounts:persistence:create]
|
|
193
|
+
reason: The test creates an account over HTTP and the witness confirms persistence.
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Selection granularity follows the runner: the FILE for vitest and Cypress
|
|
197
|
+
(one spec file executes, so a partial selection is a whole file), the pytest
|
|
198
|
+
NODE id for pytest. The verdict always comes from supervision over the
|
|
199
|
+
enumerated plan, never from the runner's exit code.
|