@gate-forge/cli 0.7.0 → 0.7.1
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 +12 -4
- package/guides/QUICKSTART.md +169 -0
- package/guides/TEST-ENVIRONMENT.md +191 -0
- package/guides/UPGRADE-0.6-to-0.7.md +65 -0
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -6,6 +6,14 @@ repository's existing tests, evaluate obligations, run the supervised E2E
|
|
|
6
6
|
gate, enforce the exact staged candidate, and maintain baselines.
|
|
7
7
|
**0.7.0 vs. published 0.6.3:** external key ring, owner-approved docs exclusions, result-only runs, surface-doctor, protocol-based package-compatibility guard, diagnostic context, trusted `baseURL`/`storageState`, and the shared-dist spool race fix.
|
|
8
8
|
|
|
9
|
+
## Start here
|
|
10
|
+
|
|
11
|
+
- [Quickstart](guides/QUICKSTART.md)
|
|
12
|
+
- [Test environment](guides/TEST-ENVIRONMENT.md)
|
|
13
|
+
- [Upgrade from 0.6 to 0.7](guides/UPGRADE-0.6-to-0.7.md)
|
|
14
|
+
|
|
15
|
+
Also at https://github.com/umiddey/gateforge/tree/main/packages/cli/guides.
|
|
16
|
+
|
|
9
17
|
Just added a new table or endpoint and the gate is blocking? Run
|
|
10
18
|
`gateforge next` (or `gateforge next --json`) — it prints the ONE blocking
|
|
11
19
|
next action. New proof tests go in `tests/e2e/gateforge/` (overlay);
|
|
@@ -86,7 +94,7 @@ paths remain authoritative and do not accept `--result-only`.
|
|
|
86
94
|
|
|
87
95
|
`gateforge pre-commit` executes the candidate inside a materialized checkout
|
|
88
96
|
that contains TRACKED bytes only — no installed dependencies, no built
|
|
89
|
-
assets, no application processes. The
|
|
97
|
+
assets, no application processes. The reviewed staged-runtime document
|
|
90
98
|
declares how that checkout becomes a runnable candidate. It is
|
|
91
99
|
security-sensitive: its bytes are hashed into the trusted policy digest and
|
|
92
100
|
the authenticated input snapshot, so a candidate that edits its own runtime
|
|
@@ -294,14 +302,14 @@ and `--require-e2e` blocks — it never downgrades to a weaker pass.
|
|
|
294
302
|
Gateforge hashes all inputs and all candidate files. On a terminal, the first
|
|
295
303
|
`gateforge init` asks for documentation-only folders to exclude. Automation can
|
|
296
304
|
use `gateforge init --docs-exclude docs,handbook`; a non-interactive run with no
|
|
297
|
-
option keeps the default. Gateforge writes the
|
|
305
|
+
option keeps the default. Gateforge writes the approved declaration to
|
|
298
306
|
`.gateforge/docs-exclusions.yml` and prints the candidate trusted-policy digest
|
|
299
307
|
to approve through the protected `GATEFORGE_APPROVED_POLICY_DIGEST` setting.
|
|
300
308
|
Gate checks refuse to use the exclusions until that external pin matches. A
|
|
301
309
|
later change to the exclusion declaration changes the digest; use
|
|
302
310
|
`--confirm-doc-exclusions` when `init` changes an existing approval.
|
|
303
311
|
|
|
304
|
-
The
|
|
312
|
+
The project states these folders do not affect the product or its tests.
|
|
305
313
|
Gateforge does not prove this. If application or test code reads an excluded
|
|
306
314
|
file, a later edit can make old evidence look valid without running the tests
|
|
307
315
|
again. Reports show the approved folders, pin identity, and this reduced
|
|
@@ -310,7 +318,7 @@ source files, gate or trust metadata, manifests, lockfiles, or symlinks.
|
|
|
310
318
|
Every file must also use a supported document or raster-image format. MDX,
|
|
311
319
|
WASM, SVG, HTML, and unknown formats fail closed. This format allowlist does
|
|
312
320
|
not prove that an allowed file cannot affect application or test behavior;
|
|
313
|
-
the
|
|
321
|
+
the project assertion and its reduced guarantee still apply.
|
|
314
322
|
|
|
315
323
|
**Managed mode** (config `enforcement.mode: managed`) — the literal
|
|
316
324
|
no-bypass guarantee requires putting the authoritative Git metadata, commit
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Quickstart
|
|
2
|
+
|
|
3
|
+
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).
|
|
4
|
+
|
|
5
|
+
You need Node.js 20 or newer and an existing Playwright suite that can run against a disposable app.
|
|
6
|
+
|
|
7
|
+
## 1. Install the CLI and the packs you use
|
|
8
|
+
|
|
9
|
+
Install the CLI, Playwright pack, and only the detector packs that fit your app. Keep every direct `@gate-forge/*` package on the same release.
|
|
10
|
+
|
|
11
|
+
Example for a React frontend, FastAPI backend, and SQLAlchemy data layer:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm i -D \
|
|
15
|
+
@gate-forge/cli@0.7.1 \
|
|
16
|
+
@gate-forge/pack-playwright@0.7.1 \
|
|
17
|
+
@gate-forge/pack-http@0.7.1 \
|
|
18
|
+
@gate-forge/pack-fastapi@0.7.1 \
|
|
19
|
+
@gate-forge/pack-sqlalchemy@0.7.1
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
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`.
|
|
23
|
+
|
|
24
|
+
**You should see:** npm installs the packages without a Gateforge compatibility error.
|
|
25
|
+
|
|
26
|
+
**If not:** align every direct `@gate-forge/*` package to `0.7.1`, then install again. Do not work around the compatibility error.
|
|
27
|
+
|
|
28
|
+
## 2. Initialize the repository
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
gateforge init
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Gateforge scans the repository and prints recommended packs. By default, it writes:
|
|
35
|
+
|
|
36
|
+
- `.gateforge.yml`
|
|
37
|
+
- `.gateforge/policies.yml`
|
|
38
|
+
- `.gateforge/classification-policy.yml`
|
|
39
|
+
- `.gateforge/baselines/obligations.json`
|
|
40
|
+
- `GATEFORGE.md`
|
|
41
|
+
- `tests/e2e/gateforge/README.md` for the default overlay proof path
|
|
42
|
+
|
|
43
|
+
It also creates `.gateforge/adapters/` and `.gateforge/waivers/`. It preserves existing files. A chosen documentation exclusion adds `.gateforge/docs-exclusions.yml`.
|
|
44
|
+
|
|
45
|
+
**You should see:** a scan summary, recommended packages, and a `skeleton ready` message.
|
|
46
|
+
|
|
47
|
+
**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.
|
|
48
|
+
|
|
49
|
+
## 3. Find existing tests and suggestions
|
|
50
|
+
|
|
51
|
+
First inventory the test suite:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
gateforge tests discover
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Then ask Gateforge which existing tests may cover the obligations:
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
gateforge tests suggest
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Discovery writes a derived catalog under `.gateforge/test-gates/`. Suggestions are for inspection; they do not create declarations or prove a test.
|
|
64
|
+
|
|
65
|
+
**You should see:** discovered test keys and suggestions with obligation IDs and any mapping problems.
|
|
66
|
+
|
|
67
|
+
**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.
|
|
68
|
+
|
|
69
|
+
## 4. Declare which existing tests cover claims
|
|
70
|
+
|
|
71
|
+
Use either a Playwright annotation or the tracked map file. Declarations tell the gate which test is relevant; they are not proof by themselves.
|
|
72
|
+
|
|
73
|
+
An annotation uses the exact obligation ID:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
test('updates a profile', {
|
|
77
|
+
annotation: { type: 'gateforge', description: '<obligation-id-from-suggest>' },
|
|
78
|
+
}, async ({ page }) => {
|
|
79
|
+
// Existing test body.
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Or declare an existing catalog entry with `tests mark`:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
gateforge tests mark \
|
|
87
|
+
--test '<exact-test-key-from-discover>' \
|
|
88
|
+
--kind browser-e2e \
|
|
89
|
+
--category persistence.update \
|
|
90
|
+
--obligation '<exact-obligation-id-from-suggest>' \
|
|
91
|
+
--reason 'Existing test updates a profile.'
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`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.
|
|
95
|
+
|
|
96
|
+
**You should see:** the sidecar diff, or a current annotation in the test. A repeated identical `tests mark` reports no changes.
|
|
97
|
+
|
|
98
|
+
**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.
|
|
99
|
+
|
|
100
|
+
## 5. Prepare a verifier key and the app
|
|
101
|
+
|
|
102
|
+
Keep the key outside the repository and run-state folder:
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
mkdir -p "$HOME/.config/gateforge"
|
|
106
|
+
gateforge key create --file "$HOME/.config/gateforge/keys.json" --confirm
|
|
107
|
+
export GATEFORGE_WITNESS_VERIFIER_KEY_FILE="$HOME/.config/gateforge/keys.json"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
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).
|
|
111
|
+
|
|
112
|
+
**You should see:** `verifier key ring created` and an active key ID.
|
|
113
|
+
|
|
114
|
+
**If not:** create the parent directory, check file permissions, and keep the key file outside `.gateforge/test-gates/` and the repository.
|
|
115
|
+
|
|
116
|
+
## 6. Run the supervised tests
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
gateforge test-gates --changed
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Gateforge supervises the selected suite and writes an authenticated receipt only after a complete successful run.
|
|
123
|
+
|
|
124
|
+
**You should see:** the selected tests pass and the run seals a receipt.
|
|
125
|
+
|
|
126
|
+
**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.
|
|
127
|
+
|
|
128
|
+
## 7. Check the changed code
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
gateforge check --changed --require-e2e
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
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.
|
|
135
|
+
|
|
136
|
+
**You should see:** a clean report for the changed scope.
|
|
137
|
+
|
|
138
|
+
**If not:** ask Gateforge for one next action:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
gateforge next
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
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.
|
|
145
|
+
|
|
146
|
+
## 8. Install the blocking hook and CI wiring
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
gateforge init --blocking
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
This installs and verifies an active pre-commit hook and adds CI wiring. Review the output and generated files:
|
|
153
|
+
|
|
154
|
+
- `.git/hooks/pre-commit` (or the configured Git hooks path)
|
|
155
|
+
- `.gateforge/hooks/gateforge-staged.sh`
|
|
156
|
+
- `.gateforge/ci/gitlab-gateforge.yml`
|
|
157
|
+
- `.gitlab-ci.yml` include
|
|
158
|
+
|
|
159
|
+
The hook and CI gate block changes that lack the required evidence. Configure protected CI secrets and require the generated CI job to pass on the protected branch; a local hook alone is not server enforcement.
|
|
160
|
+
|
|
161
|
+
**You should see:** `installed:`, `updated:`, `verified:`, or a framework-managed hook message, followed by `blocking gate wired`.
|
|
162
|
+
|
|
163
|
+
**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.
|
|
164
|
+
|
|
165
|
+
## Coming next
|
|
166
|
+
|
|
167
|
+
- `gateforge tests sync` will generate test-map entries from annotations.
|
|
168
|
+
- Unprovable contracts will be off by default.
|
|
169
|
+
- Multiple updates on one row will be evaluated per step.
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Test environment
|
|
2
|
+
|
|
3
|
+
**Gateforge does not build the test environment.** It does not create databases, seed data, logins, or services. Your team or agent builds and resets them. This guide lists what Gateforge needs from that environment.
|
|
4
|
+
|
|
5
|
+
## Use an isolated, disposable stack
|
|
6
|
+
|
|
7
|
+
**Rule:** Use separate test containers, network, and volumes. Never point a witnessed run at staging or production.
|
|
8
|
+
|
|
9
|
+
**Why:** Tests create and change data. A shared or live target can leak test data or let one run affect another.
|
|
10
|
+
|
|
11
|
+
**Example:** Give the test stack its own Compose project name, such as `gateforge-test`, and its own database volume.
|
|
12
|
+
|
|
13
|
+
## Reset and seed before every run
|
|
14
|
+
|
|
15
|
+
**Rule:** Reset to a known baseline before every run. Restore a baseline dump or run a seed script from the same checkout being tested.
|
|
16
|
+
|
|
17
|
+
**Why:** Old data makes outcomes depend on run order or another developer's test.
|
|
18
|
+
|
|
19
|
+
**Example:** `reset disposable database -> seed from this checkout -> run tests`.
|
|
20
|
+
|
|
21
|
+
## Create login state against the app
|
|
22
|
+
|
|
23
|
+
**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.
|
|
24
|
+
|
|
25
|
+
**Why:** The witness must bind a run context before it observes traffic. Once the proxy has observed traffic, binding a new run is refused. Repeated login attempts can also hit rate limits.
|
|
26
|
+
|
|
27
|
+
**Example:** Create `.cache/gateforge-session.json` against `http://app.example.test`, then set `GATEFORGE_SESSION_STATE=.cache/gateforge-session.json`.
|
|
28
|
+
|
|
29
|
+
## Run containers as your user
|
|
30
|
+
|
|
31
|
+
**Rule:** Give containers your user and group IDs.
|
|
32
|
+
|
|
33
|
+
**Why:** Root-owned auth or key files can become unreadable to your account. Git may also report dubious ownership.
|
|
34
|
+
|
|
35
|
+
**Example:**
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
docker compose run --user "$(id -u):$(id -g)" app
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Replace `app` with the service in your Compose file.
|
|
42
|
+
|
|
43
|
+
## Keep the repository unchanged during a run
|
|
44
|
+
|
|
45
|
+
**Rule:** Do not mount a different environment file over a tracked file or create temporary symlinks in the repository. Ignored files count too. Precompile first, or set `PYTHONDONTWRITEBYTECODE=1`; warm caches before the run.
|
|
46
|
+
|
|
47
|
+
**Why:** The candidate must stay the same from test planning through receipt verification. A changed or newly written cache can stale the receipt even when Git does not show it by default.
|
|
48
|
+
|
|
49
|
+
**Example:** Set `PYTHONDONTWRITEBYTECODE=1` before Python tests. Prewarm `.pytest_cache` before sealing a run, or configure the tool not to write it.
|
|
50
|
+
|
|
51
|
+
## Make hooks repeatable
|
|
52
|
+
|
|
53
|
+
**Rule:** Hooks must not rewrite ignored files on each run, such as a linter cache. Run the full hook list twice and compare a stable tree ID before and after.
|
|
54
|
+
|
|
55
|
+
**Why:** A hook that changes its own inputs makes repeated checks non-reproducible.
|
|
56
|
+
|
|
57
|
+
**Example:** This Linux example hashes repository files, including ignored files, but excludes Git's internal directory:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
tree_id() {
|
|
61
|
+
tar --sort=name --exclude=./.git --mtime='@0' --owner=0 --group=0 --numeric-owner -cf - . | sha256sum
|
|
62
|
+
}
|
|
63
|
+
before="$(tree_id)"
|
|
64
|
+
# Run the full hook list.
|
|
65
|
+
# Run the full hook list again.
|
|
66
|
+
test "$before" = "$(tree_id)"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The final comparison must pass. If it fails, find and disable or prewarm the writer before the witnessed run.
|
|
70
|
+
|
|
71
|
+
## Sync a private Git copy
|
|
72
|
+
|
|
73
|
+
**Rule:** If the runner uses a private copy of `.git`, sync both refs and the index before every run.
|
|
74
|
+
|
|
75
|
+
**Why:** A copied checkout with stale refs or a stale index can calculate a different changed-file set than the working repository.
|
|
76
|
+
|
|
77
|
+
**Example:** Before invoking the runner, copy the current branch refs and staged index into its private Git directory.
|
|
78
|
+
|
|
79
|
+
## Keep the harness in a durable place
|
|
80
|
+
|
|
81
|
+
**Rule:** Store the harness in this repository or a shared tools repository, not in `/tmp`.
|
|
82
|
+
|
|
83
|
+
**Why:** Temporary directories can be wiped on reboot and are not reproducible by teammates or CI.
|
|
84
|
+
|
|
85
|
+
**Example:** Keep reset, seed, and test-run scripts under a tracked `tools/` directory.
|
|
86
|
+
|
|
87
|
+
## Keep the verifier key outside the repository
|
|
88
|
+
|
|
89
|
+
**Rule:** Use a current-user-only key ring outside the repository and run-state folder, with mode `0600` or stricter. CI can use a protected secret instead. Never put key material in the state folder.
|
|
90
|
+
|
|
91
|
+
**Why:** The key signs trusted evidence. A repository file or run artifact is writable by the candidate and cannot be a safe secret store.
|
|
92
|
+
|
|
93
|
+
**Example:**
|
|
94
|
+
|
|
95
|
+
```sh
|
|
96
|
+
mkdir -p "$HOME/.config/gateforge"
|
|
97
|
+
gateforge key create --file "$HOME/.config/gateforge/keys.json" --confirm
|
|
98
|
+
export GATEFORGE_WITNESS_VERIFIER_KEY_FILE="$HOME/.config/gateforge/keys.json"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The CLI does not print the secret. Keep backups private too.
|
|
102
|
+
|
|
103
|
+
## Register the same tests in every mode
|
|
104
|
+
|
|
105
|
+
**Rule:** Register the same test set in discovery and witnessed modes. Only the witnessed test body may depend on `GATEFORGE_*` environment variables.
|
|
106
|
+
|
|
107
|
+
**Why:** If environment checks hide tests from the planned suite, the witness sees planned tests that did not execute and refuses the receipt.
|
|
108
|
+
|
|
109
|
+
**Example:** Do not wrap a whole `test()` declaration in `if (process.env.GATEFORGE_WITNESS_URL)`. Keep the test registered and put mode-specific setup inside the body.
|
|
110
|
+
|
|
111
|
+
## Declare claims before the gate
|
|
112
|
+
|
|
113
|
+
**Rule:** Put claims in the tracked `.gateforge/test-map.yml` when `check` must know them without listing the suite.
|
|
114
|
+
|
|
115
|
+
**Why:** Hooks and CI run `check`; they do not enumerate the test suite to discover annotations. A declaration in the map is visible before test execution.
|
|
116
|
+
|
|
117
|
+
**Example:** Use `gateforge tests mark` to write the entry, then commit `.gateforge/test-map.yml` with the test changes.
|
|
118
|
+
|
|
119
|
+
## Set the changed-file base in CI
|
|
120
|
+
|
|
121
|
+
**Rule:** Set `changed.provider` to `auto` or the intended CI provider, and provide that provider's base reference.
|
|
122
|
+
|
|
123
|
+
**Why:** Without the correct diff base, `--changed` can select no files or the wrong files. `auto` uses `GITHUB_BASE_REF` on GitHub Actions, `CI_MERGE_REQUEST_DIFF_BASE_SHA` on GitLab merge requests, and otherwise the local staged diff.
|
|
124
|
+
|
|
125
|
+
**Example:**
|
|
126
|
+
|
|
127
|
+
```yaml
|
|
128
|
+
changed:
|
|
129
|
+
provider: auto
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
For a GitHub Actions pull request, set `GITHUB_BASE_REF`. For a GitLab merge request, set `CI_MERGE_REQUEST_DIFF_BASE_SHA`.
|
|
133
|
+
|
|
134
|
+
## Keep the runner quiet
|
|
135
|
+
|
|
136
|
+
**Rule:** Keep concurrent work below the machine's CPU count. Prefer a quiet runner for witnessed tests.
|
|
137
|
+
|
|
138
|
+
**Why:** Heavy parallel jobs compete with the app and browser and can cause timeouts.
|
|
139
|
+
|
|
140
|
+
**Example:** Run one changed slice at a time on a small CI runner.
|
|
141
|
+
|
|
142
|
+
## Verify service names and fallbacks
|
|
143
|
+
|
|
144
|
+
**Rule:** App, database, and worker names or aliases must resolve inside the container network. Read service logs and check for silent fallbacks.
|
|
145
|
+
|
|
146
|
+
**Why:** A service can appear healthy while the app falls back to a local database, default credentials, or a different endpoint.
|
|
147
|
+
|
|
148
|
+
**Example:** From the app container, verify the configured database hostname resolves, then inspect the app log for its selected database URL.
|
|
149
|
+
|
|
150
|
+
## Start with a small changed slice
|
|
151
|
+
|
|
152
|
+
**Rule:** Start with `--changed`; a full run can take much longer. Use `--result-only` to inspect selected test results when unrelated existing debt blocks the full gate.
|
|
153
|
+
|
|
154
|
+
**Why:** A small slice shortens feedback. Result-only reports results but cannot authorize a gate receipt.
|
|
155
|
+
|
|
156
|
+
**Example:**
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
gateforge test-gates --changed --scope changed --result-only
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
For an authoritative run, use `gateforge test-gates --changed` without `--result-only`, then run `gateforge check --changed --require-e2e` on the same inputs.
|
|
163
|
+
|
|
164
|
+
## Write witnessed tests for observable behavior
|
|
165
|
+
|
|
166
|
+
**Rule:** Read a response body only when the app itself reads it. Use a random token in unique names. Anchor only fields the configured adapter exposes. Use one update anchor per entity. Wait for the page's own requests to finish before typing into a form that refetches data.
|
|
167
|
+
|
|
168
|
+
**Why:** Extra response reads can leave Playwright waiting. Reused names collide with seeded data. Unavailable or duplicate anchors cannot be independently checked. Typing before a refetch finishes can target stale UI.
|
|
169
|
+
|
|
170
|
+
**Example:** Use a unique name such as `profile-${randomToken}`, wait for the form's data request, then enter only adapter-supported fields.
|
|
171
|
+
|
|
172
|
+
## Reusable run script
|
|
173
|
+
|
|
174
|
+
Replace the reset and seed comments with durable commands for your disposable stack. The seed must come from this checkout. `test-gates` starts and supervises the witness for the run.
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
#!/usr/bin/env bash
|
|
178
|
+
set -euo pipefail
|
|
179
|
+
|
|
180
|
+
# Reset the disposable database from a baseline dump or reset script.
|
|
181
|
+
# <your reset command>
|
|
182
|
+
|
|
183
|
+
# Seed it from this checkout.
|
|
184
|
+
# <your seed command>
|
|
185
|
+
|
|
186
|
+
# Start the supervised witnessed run and seal a receipt on complete success.
|
|
187
|
+
gateforge test-gates --changed
|
|
188
|
+
|
|
189
|
+
# Check the same changed inputs against that receipt.
|
|
190
|
+
gateforge check --changed --require-e2e
|
|
191
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Upgrade from 0.6 to 0.7
|
|
2
|
+
|
|
3
|
+
## Upgrade steps
|
|
4
|
+
|
|
5
|
+
1. Set every direct `@gate-forge/*` dependency to `0.7.1`. Update any wrapper script, CI image, or install command that pins an older CLI version. The CLI checks the supervised Playwright contract; an incompatible package set exits 2 with `GATEFORGE_PACKAGE_INCOMPATIBLE`.
|
|
6
|
+
|
|
7
|
+
Example package set:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i -D \
|
|
11
|
+
@gate-forge/cli@0.7.1 \
|
|
12
|
+
@gate-forge/pack-playwright@0.7.1 \
|
|
13
|
+
@gate-forge/pack-http@0.7.1 \
|
|
14
|
+
@gate-forge/pack-fastapi@0.7.1 \
|
|
15
|
+
@gate-forge/pack-sqlalchemy@0.7.1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
2. Install the updated lockfile:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
3. Keep the verifier key in a protected environment variable or an external key ring. For example, create a current-user-owned key ring outside the repository and state directory:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
mkdir -p "$HOME/.config/gateforge"
|
|
28
|
+
gateforge key create --file "$HOME/.config/gateforge/keys.json" --confirm
|
|
29
|
+
export GATEFORGE_WITNESS_VERIFIER_KEY_FILE="$HOME/.config/gateforge/keys.json"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
4. Run the suite under Gateforge after upgrading:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
gateforge test-gates --changed
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This supervised run records the current claim inventory in its authenticated receipt. A leftover `claims.json` is not a declaration source. Keep annotation-only claims in `.gateforge/test-map.yml` when hooks or CI must see them before a suite runs.
|
|
39
|
+
|
|
40
|
+
5. Check the same candidate bytes:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
gateforge check --changed --require-e2e
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you edit an input after the witnessed run, run the suite again before checking.
|
|
47
|
+
|
|
48
|
+
## Behavior changes in 0.7.0
|
|
49
|
+
|
|
50
|
+
- **Claim inventory:** `check` no longer trusts a leftover `claims.json`. Annotations are collected for the current supervised run and authenticated in its receipt. A tracked `.gateforge/test-map.yml` makes claims available to a static check without running or listing the suite.
|
|
51
|
+
- **External key ring:** `gateforge key create`, `import-env`, `rotate`, and `retire` manage keys outside the repository. The key file must be a regular file owned by the current user, mode `0600` or stricter, and outside run state. CI may instead provide the protected key environment variable.
|
|
52
|
+
- **Documentation exclusions:** Input hashing includes files by default. An explicit docs-only exclusion is written to `.gateforge/docs-exclusions.yml` and stays inactive until its policy digest is approved in protected CI settings. For example, `gateforge init --docs-exclude docs,handbook` selects folders; review the generated policy before enabling it.
|
|
53
|
+
- **Result-only runs:** `gateforge test-gates --changed --scope changed --result-only` reports a changed slice and repository debt but has no gate authority and does not create, replace, or clear a receipt.
|
|
54
|
+
- **External-witness result-only:** The same result-only mode accepts `--witness-url`, `--out`, and `--run-token`. Use a dedicated state directory separate from `.gateforge/test-gates`; an external-witness result does not become an authoritative receipt.
|
|
55
|
+
- **Surface diagnostic:** `gateforge tests surface-doctor` lists Playwright tests that need a UI surface descriptor.
|
|
56
|
+
- **Runner context:** The supervised Playwright runner passes the configured app base URL and `GATEFORGE_SESSION_STATE` as trusted `baseURL` and `storageState` settings.
|
|
57
|
+
|
|
58
|
+
## If something breaks
|
|
59
|
+
|
|
60
|
+
| If you see | Do this |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `GATEFORGE_PACKAGE_INCOMPATIBLE` | Align direct Gateforge packages to `0.7.1`, update wrapper pins, then run `npm install`. |
|
|
63
|
+
| `EVIDENCE_STALE` or `RUN_INCOMPLETE` | Run `gateforge test-gates --changed` on the exact candidate, then check again. |
|
|
64
|
+
| A missing or stale test mapping | Run `gateforge tests discover`, then inspect `gateforge tests suggest`; declare a valid existing test in `.gateforge/test-map.yml`. |
|
|
65
|
+
| Tests are missing a UI surface | Run `gateforge tests surface-doctor` and add the required descriptor. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gate-forge/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"gateforgeCompatibility": {
|
|
5
5
|
"supervisedFixtureProtocol": "gateforge.supervised-playwright.v1"
|
|
6
6
|
},
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"bin",
|
|
24
|
-
"dist"
|
|
24
|
+
"dist",
|
|
25
|
+
"guides"
|
|
25
26
|
],
|
|
26
27
|
"scripts": {
|
|
27
28
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -30,14 +31,14 @@
|
|
|
30
31
|
"test": "vitest run"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@gate-forge/core": "^0.7.
|
|
34
|
-
"@gate-forge/http-contract": "^0.7.
|
|
35
|
-
"@gate-forge/pack-fastapi": "^0.7.
|
|
36
|
-
"@gate-forge/pack-http": "^0.7.
|
|
37
|
-
"@gate-forge/pack-playwright": "^0.7.
|
|
38
|
-
"@gate-forge/pack-sqlalchemy": "^0.7.
|
|
39
|
-
"@gate-forge/pack-task": "^0.7.
|
|
40
|
-
"@gate-forge/plugin-protocol": "^0.7.
|
|
34
|
+
"@gate-forge/core": "^0.7.1",
|
|
35
|
+
"@gate-forge/http-contract": "^0.7.1",
|
|
36
|
+
"@gate-forge/pack-fastapi": "^0.7.1",
|
|
37
|
+
"@gate-forge/pack-http": "^0.7.1",
|
|
38
|
+
"@gate-forge/pack-playwright": "^0.7.1",
|
|
39
|
+
"@gate-forge/pack-sqlalchemy": "^0.7.1",
|
|
40
|
+
"@gate-forge/pack-task": "^0.7.1",
|
|
41
|
+
"@gate-forge/plugin-protocol": "^0.7.1",
|
|
41
42
|
"picomatch": "^4.0.7",
|
|
42
43
|
"yaml": "^2.8.1"
|
|
43
44
|
},
|