@gate-forge/pack-playwright 0.7.1 → 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 +31 -0
- package/dist/constants.d.ts +13 -140
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +13 -148
- package/dist/constants.js.map +1 -1
- package/dist/cypress/plugin.d.ts +53 -0
- package/dist/cypress/plugin.d.ts.map +1 -0
- package/dist/cypress/plugin.js +369 -0
- package/dist/cypress/plugin.js.map +1 -0
- package/dist/cypress/spec-scan.d.ts +39 -0
- package/dist/cypress/spec-scan.d.ts.map +1 -0
- package/dist/cypress/spec-scan.js +301 -0
- package/dist/cypress/spec-scan.js.map +1 -0
- package/dist/diagnosis.d.ts +39 -0
- package/dist/diagnosis.d.ts.map +1 -0
- package/dist/diagnosis.js +63 -0
- package/dist/diagnosis.js.map +1 -0
- package/dist/discovery/adapter-projection.d.ts +13 -0
- package/dist/discovery/adapter-projection.d.ts.map +1 -0
- package/dist/discovery/adapter-projection.js +84 -0
- package/dist/discovery/adapter-projection.js.map +1 -0
- package/dist/discovery/config-locations.d.ts +5 -0
- package/dist/discovery/config-locations.d.ts.map +1 -0
- package/dist/discovery/config-locations.js +19 -0
- package/dist/discovery/config-locations.js.map +1 -0
- package/dist/discovery/cypress-runner-adapter.d.ts +112 -0
- package/dist/discovery/cypress-runner-adapter.d.ts.map +1 -0
- package/dist/discovery/cypress-runner-adapter.js +501 -0
- package/dist/discovery/cypress-runner-adapter.js.map +1 -0
- package/dist/discovery/discover.d.ts +53 -1
- package/dist/discovery/discover.d.ts.map +1 -1
- package/dist/discovery/discover.js +100 -3
- package/dist/discovery/discover.js.map +1 -1
- package/dist/discovery/git-ignore.d.ts +13 -0
- package/dist/discovery/git-ignore.d.ts.map +1 -0
- package/dist/discovery/git-ignore.js +62 -0
- package/dist/discovery/git-ignore.js.map +1 -0
- package/dist/discovery/index.d.ts +9 -0
- package/dist/discovery/index.d.ts.map +1 -1
- package/dist/discovery/index.js +9 -0
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/playwright-runner-adapter.d.ts +108 -0
- package/dist/discovery/playwright-runner-adapter.d.ts.map +1 -0
- package/dist/discovery/playwright-runner-adapter.js +185 -0
- package/dist/discovery/playwright-runner-adapter.js.map +1 -0
- package/dist/discovery/prepare-barrier.d.ts +522 -0
- package/dist/discovery/prepare-barrier.d.ts.map +1 -0
- package/dist/discovery/prepare-barrier.js +739 -0
- package/dist/discovery/prepare-barrier.js.map +1 -0
- package/dist/discovery/pytest-adapter.d.ts.map +1 -1
- package/dist/discovery/pytest-adapter.js +6 -2
- package/dist/discovery/pytest-adapter.js.map +1 -1
- package/dist/discovery/pytest-runner-adapter.d.ts +124 -0
- package/dist/discovery/pytest-runner-adapter.d.ts.map +1 -0
- package/dist/discovery/pytest-runner-adapter.js +454 -0
- package/dist/discovery/pytest-runner-adapter.js.map +1 -0
- package/dist/discovery/reconcile.d.ts +80 -11
- package/dist/discovery/reconcile.d.ts.map +1 -1
- package/dist/discovery/reconcile.js +395 -78
- package/dist/discovery/reconcile.js.map +1 -1
- package/dist/discovery/runner-env.d.ts +88 -2
- package/dist/discovery/runner-env.d.ts.map +1 -1
- package/dist/discovery/runner-env.js +142 -4
- package/dist/discovery/runner-env.js.map +1 -1
- package/dist/discovery/static-discovery.d.ts +38 -3
- package/dist/discovery/static-discovery.d.ts.map +1 -1
- package/dist/discovery/static-discovery.js +454 -15
- package/dist/discovery/static-discovery.js.map +1 -1
- package/dist/discovery/supervised-run.d.ts +199 -10
- package/dist/discovery/supervised-run.d.ts.map +1 -1
- package/dist/discovery/supervised-run.js +350 -39
- package/dist/discovery/supervised-run.js.map +1 -1
- package/dist/discovery/trusted-config.d.ts +180 -6
- package/dist/discovery/trusted-config.d.ts.map +1 -1
- package/dist/discovery/trusted-config.js +279 -10
- package/dist/discovery/trusted-config.js.map +1 -1
- package/dist/discovery/vitest-runner-adapter.d.ts +172 -0
- package/dist/discovery/vitest-runner-adapter.d.ts.map +1 -0
- package/dist/discovery/vitest-runner-adapter.js +607 -0
- package/dist/discovery/vitest-runner-adapter.js.map +1 -0
- package/dist/fixture/consumer-runner.d.ts +4 -0
- package/dist/fixture/consumer-runner.d.ts.map +1 -0
- package/dist/fixture/consumer-runner.js +38 -0
- package/dist/fixture/consumer-runner.js.map +1 -0
- package/dist/fixture/evidence.d.ts +27 -0
- package/dist/fixture/evidence.d.ts.map +1 -1
- package/dist/fixture/evidence.js +12 -0
- package/dist/fixture/evidence.js.map +1 -1
- package/dist/fixture/fixture.d.ts +2 -1
- package/dist/fixture/fixture.d.ts.map +1 -1
- package/dist/fixture/fixture.js +1 -17
- package/dist/fixture/fixture.js.map +1 -1
- package/dist/fixture/witness-client.d.ts +6 -174
- package/dist/fixture/witness-client.d.ts.map +1 -1
- package/dist/fixture/witness-client.js +6 -267
- package/dist/fixture/witness-client.js.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +6 -12
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +6 -17
- package/dist/json.js.map +1 -1
- package/dist/reporter/project-graph-reporter.d.ts +92 -0
- package/dist/reporter/project-graph-reporter.d.ts.map +1 -0
- package/dist/reporter/project-graph-reporter.js +92 -0
- package/dist/reporter/project-graph-reporter.js.map +1 -0
- package/dist/reporter/reporter.cjs.map +1 -1
- package/dist/reporter/reporter.d.ts +93 -4
- package/dist/reporter/reporter.d.ts.map +1 -1
- package/dist/reporter/reporter.js +174 -18
- package/dist/reporter/reporter.js.map +1 -1
- package/dist/runner-claims.d.ts +13 -0
- package/dist/runner-claims.d.ts.map +1 -0
- package/dist/runner-claims.js +46 -0
- package/dist/runner-claims.js.map +1 -0
- package/dist/runner-resolution.d.ts +3 -0
- package/dist/runner-resolution.d.ts.map +1 -0
- package/dist/runner-resolution.js +14 -0
- package/dist/runner-resolution.js.map +1 -0
- package/dist/supervisor/client.d.ts +23 -1
- package/dist/supervisor/client.d.ts.map +1 -1
- package/dist/supervisor/client.js +49 -0
- package/dist/supervisor/client.js.map +1 -1
- package/dist/supervisor/drain.d.ts +65 -0
- package/dist/supervisor/drain.d.ts.map +1 -1
- package/dist/supervisor/drain.js +353 -9
- package/dist/supervisor/drain.js.map +1 -1
- package/dist/supervisor/index.d.ts +7 -3
- package/dist/supervisor/index.d.ts.map +1 -1
- package/dist/supervisor/index.js +7 -3
- package/dist/supervisor/index.js.map +1 -1
- package/dist/supervisor/spool.d.ts +65 -2
- package/dist/supervisor/spool.d.ts.map +1 -1
- package/dist/supervisor/spool.js +47 -0
- package/dist/supervisor/spool.js.map +1 -1
- package/dist/surface.d.ts +6 -207
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +6 -264
- package/dist/surface.js.map +1 -1
- package/dist/vitest/index.d.ts +23 -0
- package/dist/vitest/index.d.ts.map +1 -0
- package/dist/vitest/index.js +356 -0
- package/dist/vitest/index.js.map +1 -0
- package/dist/vitest/reporter.d.ts +83 -0
- package/dist/vitest/reporter.d.ts.map +1 -0
- package/dist/vitest/reporter.js +211 -0
- package/dist/vitest/reporter.js.map +1 -0
- package/dist/vitest/worker-slot.d.ts +36 -0
- package/dist/vitest/worker-slot.d.ts.map +1 -0
- package/dist/vitest/worker-slot.js +51 -0
- package/dist/vitest/worker-slot.js.map +1 -0
- package/dist/witness/adapter-registry.d.ts +6 -50
- package/dist/witness/adapter-registry.d.ts.map +1 -1
- package/dist/witness/adapter-registry.js +6 -257
- package/dist/witness/adapter-registry.js.map +1 -1
- package/dist/witness/behavior-request.d.ts +6 -76
- package/dist/witness/behavior-request.d.ts.map +1 -1
- package/dist/witness/behavior-request.js +6 -273
- package/dist/witness/behavior-request.js.map +1 -1
- package/dist/witness/behavior.d.ts +6 -48
- package/dist/witness/behavior.d.ts.map +1 -1
- package/dist/witness/behavior.js +6 -114
- package/dist/witness/behavior.js.map +1 -1
- package/dist/witness/bin.d.ts +6 -17
- package/dist/witness/bin.d.ts.map +1 -1
- package/dist/witness/bin.js +6 -168
- package/dist/witness/bin.js.map +1 -1
- package/dist/witness/browser.d.ts +14 -206
- package/dist/witness/browser.d.ts.map +1 -1
- package/dist/witness/browser.js +15 -654
- package/dist/witness/browser.js.map +1 -1
- package/dist/witness/classifications.d.ts +6 -38
- package/dist/witness/classifications.d.ts.map +1 -1
- package/dist/witness/classifications.js +6 -83
- package/dist/witness/classifications.js.map +1 -1
- package/dist/witness/env-attestation.d.ts +6 -94
- package/dist/witness/env-attestation.d.ts.map +1 -1
- package/dist/witness/env-attestation.js +6 -198
- package/dist/witness/env-attestation.js.map +1 -1
- package/dist/witness/fixture-provider.d.ts +6 -82
- package/dist/witness/fixture-provider.d.ts.map +1 -1
- package/dist/witness/fixture-provider.js +6 -105
- package/dist/witness/fixture-provider.js.map +1 -1
- package/dist/witness/loopback-pins.d.ts +6 -75
- package/dist/witness/loopback-pins.d.ts.map +1 -1
- package/dist/witness/loopback-pins.js +6 -240
- package/dist/witness/loopback-pins.js.map +1 -1
- package/dist/witness/server.d.ts +8 -26
- package/dist/witness/server.d.ts.map +1 -1
- package/dist/witness/server.js +24 -3761
- package/dist/witness/server.js.map +1 -1
- package/dist/witness/types.d.ts +6 -882
- package/dist/witness/types.d.ts.map +1 -1
- package/dist/witness/types.js +9 -1
- package/dist/witness/types.js.map +1 -1
- package/examples/overlay-proof.spec.js +75 -0
- package/package.json +8 -2
- package/python/__pycache__/gateforge_persistence_intents.cpython-312.pyc +0 -0
- package/python/__pycache__/gateforge_persistence_intents.cpython-314.pyc +0 -0
- package/python/gateforge_pytest_plugin.py +462 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Writing witnessed journeys
|
|
2
|
+
|
|
3
|
+
A witnessed journey must exercise the real application behavior and verify the result that users depend on. A passing test declaration is not proof: only a valid receipt proves a run, and an adopted baseline forgives previously accepted debt.
|
|
4
|
+
|
|
5
|
+
## Start from a complete example
|
|
6
|
+
|
|
7
|
+
`examples/overlay-proof.spec.js` (in this package, so `node_modules/@gate-forge/pack-playwright/examples/overlay-proof.spec.js` in your repo) is a complete overlay proof test: a surface descriptor for a small list/create/edit/archive app, the `gateforge` annotation, and the witnessed `evidence.ui.*` / `visible.confirm` / `http.observe` / `persistence.verify` / `finalize` sequence. Copy it, change the selectors, and the fixture calls stay the same.
|
|
8
|
+
|
|
9
|
+
## Keep each journey isolated
|
|
10
|
+
|
|
11
|
+
- Create distinct records and tenant context for every test. Do not reuse a per-tenant singleton across tests; shared state can hide cross-tenant leaks and make outcomes depend on test order.
|
|
12
|
+
- Give test data unique identifiers, and clean it up through the same supported application path the test is checking.
|
|
13
|
+
- Keep setup independent of Gateforge environment variables so discovery can register the same tests in local and CI runs.
|
|
14
|
+
|
|
15
|
+
## Observe mutation results without hanging
|
|
16
|
+
|
|
17
|
+
- Read a mutation response body only when the application returns one. Calling `.json()` on an intentionally empty response waits forever; assert the status and then query the resulting state through the application’s normal read path.
|
|
18
|
+
- Check both the submitted value and the persisted value on the same record. A successful HTTP status or click alone does not prove the update happened.
|
|
19
|
+
- Prefer a specific response or visible application condition over fixed sleeps and transient loading text.
|
|
20
|
+
|
|
21
|
+
## Prefer real behavior over mocks
|
|
22
|
+
|
|
23
|
+
- Use the real server and persistence path when the journey claims a user-facing behavior. A `page.route()` stub can prove client handling, but it cannot show that the server stored the right value or enforced tenant boundaries.
|
|
24
|
+
- Keep mock-only tests, but do not treat them as evidence for the real application surface.
|
|
25
|
+
- When multiple journeys cover the same obligation, state why each one is needed; avoid copy-pasted tests that compete for shared data.
|
|
26
|
+
|
|
27
|
+
Run the configured suite with `gateforge test-gates --changed`. For a selected non-authoritative slice, use `gateforge test-gates --changed --scope changed --result-only`; this reports selected results without creating or changing a receipt.
|
|
28
|
+
|
|
29
|
+
## Install the browsers before the first witnessed run
|
|
30
|
+
|
|
31
|
+
`npx playwright install chromium`, from the directory that holds your Playwright config. On a Linux machine without the browser's system libraries — a container, a CI image, WSL — install those too in the same command: `npx playwright install --with-deps chromium` (it needs root or sudo). `gateforge enforcement doctor` names the case: a missing build names the install, and a build that is installed but cannot start names the loader's own line and the `npx playwright install-deps chromium` that fixes it.
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,146 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Compatibility re-export: `constants` now lives in the runner-neutral
|
|
3
|
+
* `@gate-forge/witness` package (plan 2026-09-25 phase 1).
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* test-gates` (packages/cli/README.md "test-gates protocol") — the CLI
|
|
8
|
-
* already exports GATEFORGE_RUN_ID / GATEFORGE_RUN_TOKEN /
|
|
9
|
-
* GATEFORGE_STATE_DIR / GATEFORGE_OBLIGATIONS / GATEFORGE_WITNESS_URL;
|
|
10
|
-
* the pack augments the target/attestation/adapter surface below.
|
|
5
|
+
* The move is physical, not behavioural: this module forwards every
|
|
6
|
+
* export unchanged so `@gate-forge/pack-playwright`'s published import
|
|
7
|
+
* paths — which consumers pin — keep resolving to the same values.
|
|
11
8
|
*/
|
|
12
|
-
|
|
13
|
-
export declare const CLAIM_ANNOTATION_TYPE = "gateforge";
|
|
14
|
-
/** Per-run auth header on every witness call (pin #7). */
|
|
15
|
-
export declare const RUN_HEADER = "x-gateforge-run";
|
|
9
|
+
export * from '@gate-forge/witness/constants';
|
|
16
10
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* the
|
|
21
|
-
*
|
|
22
|
-
*
|
|
11
|
+
* Non-secret runner-child context: the absolute directory holding the
|
|
12
|
+
* consumer's Playwright config, handed to the supervised runner so the
|
|
13
|
+
* evidence fixture can bind to the SAME consumer runner the enumeration
|
|
14
|
+
* and the supervised execution use (see fixture/consumer-runner.ts).
|
|
15
|
+
* A path, never a secret; unset is normal (a repository that relies on the
|
|
16
|
+
* pack's own pinned runner).
|
|
23
17
|
*/
|
|
24
|
-
export declare const
|
|
25
|
-
/** Marker header the SUT (or its attestation proxy) must present. */
|
|
26
|
-
export declare const ENV_FINGERPRINT_HEADER = "x-gateforge-env-fingerprint";
|
|
27
|
-
/** Marker header the SUT (or its attestation proxy) may present. */
|
|
28
|
-
export declare const ATTESTATION_SCOPE_HEADER = "x-gateforge-attestation-scope";
|
|
29
|
-
/** Evidence kinds the witness /records endpoint accepts (plan §5.3). */
|
|
30
|
-
export declare const UI_ACTION_KIND = "ui.action";
|
|
31
|
-
export declare const UI_VISIBLE_RESULT_KIND = "ui.visible-result";
|
|
32
|
-
export declare const PERSISTENCE_KIND = "persistence.entity";
|
|
33
|
-
/**
|
|
34
|
-
* Observe-channel persistence kind (Phase 2): issued ONLY by the
|
|
35
|
-
* witness's observe finalize (engine-side proxy capture + adapter
|
|
36
|
-
* read) — never suite-submittable (`/records` rejects it like every
|
|
37
|
-
* persistence kind) and never engine-driven.
|
|
38
|
-
*/
|
|
39
|
-
export declare const OBSERVED_KIND = "persistence.observed";
|
|
40
|
-
export declare const KNOWN_RECORD_KINDS: readonly string[];
|
|
41
|
-
/** Persistence kinds are ONLY issued by the witness (engine-side adapter reads). */
|
|
42
|
-
export declare const KNOWN_PERSISTENCE_KINDS: readonly string[];
|
|
43
|
-
/** Env the CLI test-gates suite already receives (documented contract). */
|
|
44
|
-
export declare const ENV_RUN_ID = "GATEFORGE_RUN_ID";
|
|
45
|
-
export declare const ENV_RUN_TOKEN = "GATEFORGE_RUN_TOKEN";
|
|
46
|
-
export declare const ENV_STATE_DIR = "GATEFORGE_STATE_DIR";
|
|
47
|
-
export declare const ENV_OBLIGATIONS = "GATEFORGE_OBLIGATIONS";
|
|
48
|
-
export declare const ENV_WITNESS_URL = "GATEFORGE_WITNESS_URL";
|
|
49
|
-
/** Pack-extended env surface (documented in this package's README). */
|
|
50
|
-
export declare const ENV_APP_BASE_URL = "GATEFORGE_APP_BASE_URL";
|
|
51
|
-
export declare const ENV_TARGET_BASE_URL = "GATEFORGE_TARGET_BASE_URL";
|
|
52
|
-
export declare const ENV_TARGET_FINGERPRINT = "GATEFORGE_TARGET_FINGERPRINT";
|
|
53
|
-
export declare const ENV_ADAPTERS_DIR = "GATEFORGE_ADAPTERS_DIR";
|
|
54
|
-
export declare const ENV_CLASSIFICATIONS = "GATEFORGE_CLASSIFICATIONS";
|
|
55
|
-
export declare const ENV_ADAPTER_BASE_URL = "GATEFORGE_ADAPTER_BASE_URL";
|
|
56
|
-
/** Observation proxy target (loopback base URL the proxy forwards to). */
|
|
57
|
-
export declare const ENV_PROXY_TARGET = "GATEFORGE_PROXY_TARGET";
|
|
58
|
-
/**
|
|
59
|
-
* Observation-proxy mount prefix (e.g. `/api`): the browser-facing path
|
|
60
|
-
* prefix a frontend dev proxy adds before backend routes. The proxy
|
|
61
|
-
* strips it before forwarding and before recording observations, so
|
|
62
|
-
* records match backend-derived obligation identities.
|
|
63
|
-
*/
|
|
64
|
-
export declare const ENV_MOUNT_PATH = "GATEFORGE_MOUNT_PATH";
|
|
65
|
-
/**
|
|
66
|
-
* Verifier key for the witness attestation surface. Environment ONLY —
|
|
67
|
-
* never argv (a process's cmdline is world-readable via /proc), and
|
|
68
|
-
* never exported to the tested suite. Same variable the orchestrating
|
|
69
|
-
* CLI reads (`gateforge test-gates`).
|
|
70
|
-
*/
|
|
71
|
-
export declare const ENV_WITNESS_VERIFIER_KEY = "GATEFORGE_WITNESS_VERIFIER_KEY";
|
|
72
|
-
/** Opt-in reporter exit-code semantics (standalone runs only). */
|
|
73
|
-
export declare const ENV_REPORTER_FAIL_RUN = "GATEFORGE_REPORTER_FAIL_RUN";
|
|
74
|
-
/**
|
|
75
|
-
* Absolute path of the runner-outcomes document the gateforge reporter
|
|
76
|
-
* writes for trusted runner supervision (plan Phase 4 item 4, ADR 0005
|
|
77
|
-
* D2): per-instance outcomes, attempts, expected failures, and the
|
|
78
|
-
* run-level fixture/teardown outcome. Set by the supervised adapter
|
|
79
|
-
* (`test-gates --changed`); when absent the reporter writes nothing —
|
|
80
|
-
* supervision then fails closed on the missing outcomes file.
|
|
81
|
-
*/
|
|
82
|
-
export declare const ENV_OUTCOMES_FILE = "GATEFORGE_OUTCOMES_FILE";
|
|
83
|
-
/**
|
|
84
|
-
* Run-state file (written by the orchestrating CLI) carrying the mapped
|
|
85
|
-
* obligation claims for sidecar/native-mapped tests, keyed by
|
|
86
|
-
* `<file>#<titlePath.join('>')>` (the reconciliation key). The reporter
|
|
87
|
-
* carries these claims on the session-open path (Phase 4 claim
|
|
88
|
-
* injection) so their evidence lands on the right claims; native
|
|
89
|
-
* annotations keep working unchanged.
|
|
90
|
-
*/
|
|
91
|
-
export declare const CLAIM_INJECTIONS_FILE = "claim-injections.json";
|
|
92
|
-
/** Run-state file carrying the sealed supervision execution result. */
|
|
93
|
-
export declare const EXECUTION_RESULT_FILE = "execution-result.json";
|
|
94
|
-
/**
|
|
95
|
-
* Run-state spool directory (enforcement-review fix 3): the runner-side
|
|
96
|
-
* reporter writes test lifecycle events (testBegin/testEnd with outcome)
|
|
97
|
-
* as NUL-safe JSON lines under `<stateDir>/spool/<runId>/`; the trusted
|
|
98
|
-
* CLI drains them and performs the witness supervisor calls (session
|
|
99
|
-
* open/close) with credentials that exist ONLY in the CLI process. The
|
|
100
|
-
* runner child holds no supervisor rights.
|
|
101
|
-
*/
|
|
102
|
-
export declare const SPOOL_DIR_NAME = "spool";
|
|
103
|
-
/** The spool's event file (JSON lines; consumed by the CLI drain loop). */
|
|
104
|
-
export declare const SPOOL_EVENTS_FILE = "events.jsonl";
|
|
105
|
-
/**
|
|
106
|
-
* The spool's persistence-claim-intent file (JSON lines; same NUL-safe
|
|
107
|
-
* line protocol as `events.jsonl`): the supervised (UNTRUSTED) test
|
|
108
|
-
* process reports claim INTENTS here — {entity, operation, phase, intent,
|
|
109
|
-
* key, claimId, testId, sequence}. The suite can only write intents; it
|
|
110
|
-
* can NEVER stamp evidence. The trusted CLI's spool drain forwards each
|
|
111
|
-
* intent to the witness over the verifier-key supervisor surface, where
|
|
112
|
-
* the resource's adapter SERVER PROBE runs (witness-side) and — only
|
|
113
|
-
* then — a witnessed `persistence.entity` record stamped
|
|
114
|
-
* `channel: 'server'` may be issued.
|
|
115
|
-
*/
|
|
116
|
-
export declare const SPOOL_INTENTS_FILE = "persistence-intents.jsonl";
|
|
117
|
-
/**
|
|
118
|
-
* Payload discriminant the witness stamps on server-probed persistence
|
|
119
|
-
* records (core's verdict engine keys the server-witnessed channel off
|
|
120
|
-
* this + {@link SERVER_E2E_TEST_KIND}).
|
|
121
|
-
*/
|
|
122
|
-
export declare const SERVER_CHANNEL = "server";
|
|
123
|
-
/** The mapping kind that unlocks the server-witnessed channel. */
|
|
124
|
-
export declare const SERVER_E2E_TEST_KIND = "server-e2e";
|
|
125
|
-
/**
|
|
126
|
-
* Payload discriminant the witness stamps on observe-finalized
|
|
127
|
-
* persistence records (Observe channel, Phase 2: core's verdict engine
|
|
128
|
-
* keys the observe branch off this channel on `persistence.observed`
|
|
129
|
-
* records).
|
|
130
|
-
*/
|
|
131
|
-
export declare const OBSERVE_CHANNEL = "observe";
|
|
132
|
-
/** The mapping kind that unlocks the Observe channel. */
|
|
133
|
-
export declare const OBSERVED_E2E_TEST_KIND = "observed-e2e";
|
|
134
|
-
/** Run-state file carrying the authenticated gate receipt. */
|
|
135
|
-
export declare const GATE_RECEIPT_FILE = "receipt.json";
|
|
136
|
-
/** Run-state diagnostics report (plan §3.5; never witness evidence). */
|
|
137
|
-
export declare const DIAGNOSTICS_REPORT_FILE = "diagnostics.json";
|
|
138
|
-
/** Witness file inside the state dir carrying the spawned URL. */
|
|
139
|
-
export declare const WITNESS_URL_FILE = "witness-url.json";
|
|
140
|
-
/** Default per-witness-call timeout (pin #7: 5s). */
|
|
141
|
-
export declare const DEFAULT_REQUEST_TIMEOUT_MS = 5000;
|
|
142
|
-
/** The loopback hostname the witness, proxy, and fixture servers bind. */
|
|
143
|
-
export declare const LOOPBACK_HOSTNAME = "127.0.0.1";
|
|
144
|
-
/** Loopback-equivalent hostnames the witness accepts as attestation subjects. */
|
|
145
|
-
export declare const LOOPBACK_HOSTS: Record<string, true>;
|
|
18
|
+
export declare const ENV_PLAYWRIGHT_CONFIG_DIR = "GATEFORGE_PLAYWRIGHT_CONFIG_DIR";
|
|
146
19
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,+BAA+B,CAAC;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,oCAAoC,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,154 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Compatibility re-export: `constants` now lives in the runner-neutral
|
|
3
|
+
* `@gate-forge/witness` package (plan 2026-09-25 phase 1).
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* test-gates` (packages/cli/README.md "test-gates protocol") — the CLI
|
|
8
|
-
* already exports GATEFORGE_RUN_ID / GATEFORGE_RUN_TOKEN /
|
|
9
|
-
* GATEFORGE_STATE_DIR / GATEFORGE_OBLIGATIONS / GATEFORGE_WITNESS_URL;
|
|
10
|
-
* the pack augments the target/attestation/adapter surface below.
|
|
5
|
+
* The move is physical, not behavioural: this module forwards every
|
|
6
|
+
* export unchanged so `@gate-forge/pack-playwright`'s published import
|
|
7
|
+
* paths — which consumers pin — keep resolving to the same values.
|
|
11
8
|
*/
|
|
12
|
-
|
|
13
|
-
export const CLAIM_ANNOTATION_TYPE = 'gateforge';
|
|
14
|
-
/** Per-run auth header on every witness call (pin #7). */
|
|
15
|
-
export const RUN_HEADER = 'x-gateforge-run';
|
|
9
|
+
export * from '@gate-forge/witness/constants';
|
|
16
10
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* the
|
|
21
|
-
*
|
|
22
|
-
*
|
|
11
|
+
* Non-secret runner-child context: the absolute directory holding the
|
|
12
|
+
* consumer's Playwright config, handed to the supervised runner so the
|
|
13
|
+
* evidence fixture can bind to the SAME consumer runner the enumeration
|
|
14
|
+
* and the supervised execution use (see fixture/consumer-runner.ts).
|
|
15
|
+
* A path, never a secret; unset is normal (a repository that relies on the
|
|
16
|
+
* pack's own pinned runner).
|
|
23
17
|
*/
|
|
24
|
-
export const
|
|
25
|
-
/** Marker header the SUT (or its attestation proxy) must present. */
|
|
26
|
-
export const ENV_FINGERPRINT_HEADER = 'x-gateforge-env-fingerprint';
|
|
27
|
-
/** Marker header the SUT (or its attestation proxy) may present. */
|
|
28
|
-
export const ATTESTATION_SCOPE_HEADER = 'x-gateforge-attestation-scope';
|
|
29
|
-
/** Evidence kinds the witness /records endpoint accepts (plan §5.3). */
|
|
30
|
-
export const UI_ACTION_KIND = 'ui.action';
|
|
31
|
-
export const UI_VISIBLE_RESULT_KIND = 'ui.visible-result';
|
|
32
|
-
export const PERSISTENCE_KIND = 'persistence.entity';
|
|
33
|
-
/**
|
|
34
|
-
* Observe-channel persistence kind (Phase 2): issued ONLY by the
|
|
35
|
-
* witness's observe finalize (engine-side proxy capture + adapter
|
|
36
|
-
* read) — never suite-submittable (`/records` rejects it like every
|
|
37
|
-
* persistence kind) and never engine-driven.
|
|
38
|
-
*/
|
|
39
|
-
export const OBSERVED_KIND = 'persistence.observed';
|
|
40
|
-
export const KNOWN_RECORD_KINDS = [
|
|
41
|
-
UI_ACTION_KIND,
|
|
42
|
-
UI_VISIBLE_RESULT_KIND,
|
|
43
|
-
];
|
|
44
|
-
/** Persistence kinds are ONLY issued by the witness (engine-side adapter reads). */
|
|
45
|
-
export const KNOWN_PERSISTENCE_KINDS = [PERSISTENCE_KIND, OBSERVED_KIND];
|
|
46
|
-
/** Env the CLI test-gates suite already receives (documented contract). */
|
|
47
|
-
export const ENV_RUN_ID = 'GATEFORGE_RUN_ID';
|
|
48
|
-
export const ENV_RUN_TOKEN = 'GATEFORGE_RUN_TOKEN';
|
|
49
|
-
export const ENV_STATE_DIR = 'GATEFORGE_STATE_DIR';
|
|
50
|
-
export const ENV_OBLIGATIONS = 'GATEFORGE_OBLIGATIONS';
|
|
51
|
-
export const ENV_WITNESS_URL = 'GATEFORGE_WITNESS_URL';
|
|
52
|
-
/** Pack-extended env surface (documented in this package's README). */
|
|
53
|
-
export const ENV_APP_BASE_URL = 'GATEFORGE_APP_BASE_URL';
|
|
54
|
-
export const ENV_TARGET_BASE_URL = 'GATEFORGE_TARGET_BASE_URL';
|
|
55
|
-
export const ENV_TARGET_FINGERPRINT = 'GATEFORGE_TARGET_FINGERPRINT';
|
|
56
|
-
export const ENV_ADAPTERS_DIR = 'GATEFORGE_ADAPTERS_DIR';
|
|
57
|
-
export const ENV_CLASSIFICATIONS = 'GATEFORGE_CLASSIFICATIONS';
|
|
58
|
-
export const ENV_ADAPTER_BASE_URL = 'GATEFORGE_ADAPTER_BASE_URL';
|
|
59
|
-
/** Observation proxy target (loopback base URL the proxy forwards to). */
|
|
60
|
-
export const ENV_PROXY_TARGET = 'GATEFORGE_PROXY_TARGET';
|
|
61
|
-
/**
|
|
62
|
-
* Observation-proxy mount prefix (e.g. `/api`): the browser-facing path
|
|
63
|
-
* prefix a frontend dev proxy adds before backend routes. The proxy
|
|
64
|
-
* strips it before forwarding and before recording observations, so
|
|
65
|
-
* records match backend-derived obligation identities.
|
|
66
|
-
*/
|
|
67
|
-
export const ENV_MOUNT_PATH = 'GATEFORGE_MOUNT_PATH';
|
|
68
|
-
/**
|
|
69
|
-
* Verifier key for the witness attestation surface. Environment ONLY —
|
|
70
|
-
* never argv (a process's cmdline is world-readable via /proc), and
|
|
71
|
-
* never exported to the tested suite. Same variable the orchestrating
|
|
72
|
-
* CLI reads (`gateforge test-gates`).
|
|
73
|
-
*/
|
|
74
|
-
export const ENV_WITNESS_VERIFIER_KEY = 'GATEFORGE_WITNESS_VERIFIER_KEY';
|
|
75
|
-
/** Opt-in reporter exit-code semantics (standalone runs only). */
|
|
76
|
-
export const ENV_REPORTER_FAIL_RUN = 'GATEFORGE_REPORTER_FAIL_RUN';
|
|
77
|
-
/**
|
|
78
|
-
* Absolute path of the runner-outcomes document the gateforge reporter
|
|
79
|
-
* writes for trusted runner supervision (plan Phase 4 item 4, ADR 0005
|
|
80
|
-
* D2): per-instance outcomes, attempts, expected failures, and the
|
|
81
|
-
* run-level fixture/teardown outcome. Set by the supervised adapter
|
|
82
|
-
* (`test-gates --changed`); when absent the reporter writes nothing —
|
|
83
|
-
* supervision then fails closed on the missing outcomes file.
|
|
84
|
-
*/
|
|
85
|
-
export const ENV_OUTCOMES_FILE = 'GATEFORGE_OUTCOMES_FILE';
|
|
86
|
-
/**
|
|
87
|
-
* Run-state file (written by the orchestrating CLI) carrying the mapped
|
|
88
|
-
* obligation claims for sidecar/native-mapped tests, keyed by
|
|
89
|
-
* `<file>#<titlePath.join('>')>` (the reconciliation key). The reporter
|
|
90
|
-
* carries these claims on the session-open path (Phase 4 claim
|
|
91
|
-
* injection) so their evidence lands on the right claims; native
|
|
92
|
-
* annotations keep working unchanged.
|
|
93
|
-
*/
|
|
94
|
-
export const CLAIM_INJECTIONS_FILE = 'claim-injections.json';
|
|
95
|
-
/** Run-state file carrying the sealed supervision execution result. */
|
|
96
|
-
export const EXECUTION_RESULT_FILE = 'execution-result.json';
|
|
97
|
-
/**
|
|
98
|
-
* Run-state spool directory (enforcement-review fix 3): the runner-side
|
|
99
|
-
* reporter writes test lifecycle events (testBegin/testEnd with outcome)
|
|
100
|
-
* as NUL-safe JSON lines under `<stateDir>/spool/<runId>/`; the trusted
|
|
101
|
-
* CLI drains them and performs the witness supervisor calls (session
|
|
102
|
-
* open/close) with credentials that exist ONLY in the CLI process. The
|
|
103
|
-
* runner child holds no supervisor rights.
|
|
104
|
-
*/
|
|
105
|
-
export const SPOOL_DIR_NAME = 'spool';
|
|
106
|
-
/** The spool's event file (JSON lines; consumed by the CLI drain loop). */
|
|
107
|
-
export const SPOOL_EVENTS_FILE = 'events.jsonl';
|
|
108
|
-
/**
|
|
109
|
-
* The spool's persistence-claim-intent file (JSON lines; same NUL-safe
|
|
110
|
-
* line protocol as `events.jsonl`): the supervised (UNTRUSTED) test
|
|
111
|
-
* process reports claim INTENTS here — {entity, operation, phase, intent,
|
|
112
|
-
* key, claimId, testId, sequence}. The suite can only write intents; it
|
|
113
|
-
* can NEVER stamp evidence. The trusted CLI's spool drain forwards each
|
|
114
|
-
* intent to the witness over the verifier-key supervisor surface, where
|
|
115
|
-
* the resource's adapter SERVER PROBE runs (witness-side) and — only
|
|
116
|
-
* then — a witnessed `persistence.entity` record stamped
|
|
117
|
-
* `channel: 'server'` may be issued.
|
|
118
|
-
*/
|
|
119
|
-
export const SPOOL_INTENTS_FILE = 'persistence-intents.jsonl';
|
|
120
|
-
/**
|
|
121
|
-
* Payload discriminant the witness stamps on server-probed persistence
|
|
122
|
-
* records (core's verdict engine keys the server-witnessed channel off
|
|
123
|
-
* this + {@link SERVER_E2E_TEST_KIND}).
|
|
124
|
-
*/
|
|
125
|
-
export const SERVER_CHANNEL = 'server';
|
|
126
|
-
/** The mapping kind that unlocks the server-witnessed channel. */
|
|
127
|
-
export const SERVER_E2E_TEST_KIND = 'server-e2e';
|
|
128
|
-
/**
|
|
129
|
-
* Payload discriminant the witness stamps on observe-finalized
|
|
130
|
-
* persistence records (Observe channel, Phase 2: core's verdict engine
|
|
131
|
-
* keys the observe branch off this channel on `persistence.observed`
|
|
132
|
-
* records).
|
|
133
|
-
*/
|
|
134
|
-
export const OBSERVE_CHANNEL = 'observe';
|
|
135
|
-
/** The mapping kind that unlocks the Observe channel. */
|
|
136
|
-
export const OBSERVED_E2E_TEST_KIND = 'observed-e2e';
|
|
137
|
-
/** Run-state file carrying the authenticated gate receipt. */
|
|
138
|
-
export const GATE_RECEIPT_FILE = 'receipt.json';
|
|
139
|
-
/** Run-state diagnostics report (plan §3.5; never witness evidence). */
|
|
140
|
-
export const DIAGNOSTICS_REPORT_FILE = 'diagnostics.json';
|
|
141
|
-
/** Witness file inside the state dir carrying the spawned URL. */
|
|
142
|
-
export const WITNESS_URL_FILE = 'witness-url.json';
|
|
143
|
-
/** Default per-witness-call timeout (pin #7: 5s). */
|
|
144
|
-
export const DEFAULT_REQUEST_TIMEOUT_MS = 5000;
|
|
145
|
-
/** The loopback hostname the witness, proxy, and fixture servers bind. */
|
|
146
|
-
export const LOOPBACK_HOSTNAME = '127.0.0.1';
|
|
147
|
-
/** Loopback-equivalent hostnames the witness accepts as attestation subjects. */
|
|
148
|
-
export const LOOPBACK_HOSTS = {
|
|
149
|
-
localhost: true,
|
|
150
|
-
'[::1]': true,
|
|
151
|
-
'::1': true,
|
|
152
|
-
'127.0.0.1': true,
|
|
153
|
-
};
|
|
18
|
+
export const ENV_PLAYWRIGHT_CONFIG_DIR = 'GATEFORGE_PLAYWRIGHT_CONFIG_DIR';
|
|
154
19
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,+BAA+B,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** The session credential the browser receives for one test. */
|
|
2
|
+
export interface CypressSessionCredential {
|
|
3
|
+
readonly sessionId: string;
|
|
4
|
+
readonly sessionToken: string;
|
|
5
|
+
readonly proxyUrl: string | null;
|
|
6
|
+
}
|
|
7
|
+
/** The report document `parseResults` reads. */
|
|
8
|
+
export interface CypressRunReport {
|
|
9
|
+
readonly schemaVersion: 1;
|
|
10
|
+
readonly retriesDetected: boolean;
|
|
11
|
+
readonly specs: Array<{
|
|
12
|
+
readonly file: string;
|
|
13
|
+
readonly tests: Array<{
|
|
14
|
+
readonly titlePath: string[];
|
|
15
|
+
readonly state: string;
|
|
16
|
+
readonly attempts: number;
|
|
17
|
+
}>;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
/** The Cypress `on` registration surface this plugin uses. */
|
|
21
|
+
interface PluginRegistrar {
|
|
22
|
+
(event: 'task', handlers: Record<string, (payload: unknown) => unknown>): void;
|
|
23
|
+
(event: 'after:run', handler: (results: unknown) => void | Promise<void>): void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Registers the gateforge Cypress tasks and the run report writer.
|
|
27
|
+
*
|
|
28
|
+
* Args:
|
|
29
|
+
* on: Cypress's `setupNodeEvents(on, config)` registrar.
|
|
30
|
+
*
|
|
31
|
+
* Returns:
|
|
32
|
+
* void
|
|
33
|
+
*/
|
|
34
|
+
export declare function registerGateforgeCypressPlugin(on: PluginRegistrar): void;
|
|
35
|
+
/**
|
|
36
|
+
* The generated Cypress support file: the in-browser half of the
|
|
37
|
+
* channel. It opens each test's session through the plugin task, and
|
|
38
|
+
* rewrites `cy.request` traffic addressed at the app origin onto that
|
|
39
|
+
* session's proxy origin, so every exchange is attributed to the test
|
|
40
|
+
* that issued it. Traffic addressed anywhere else (a raw browser
|
|
41
|
+
* `fetch` to the app, a third-party origin) is left ALONE and therefore
|
|
42
|
+
* stays unattributed — the witness credits it to nothing.
|
|
43
|
+
*
|
|
44
|
+
* Args:
|
|
45
|
+
* projectSupportFile: the project's own support file (required first,
|
|
46
|
+
* so its hooks and commands keep working), or null.
|
|
47
|
+
*
|
|
48
|
+
* Returns:
|
|
49
|
+
* string: CommonJS support-file source.
|
|
50
|
+
*/
|
|
51
|
+
export declare function cypressSupportSource(projectSupportFile: string | null): string;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/cypress/plugin.ts"],"names":[],"mappings":"AAmHA,gEAAgE;AAChE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;QACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;YACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;YAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;SAC3B,CAAC,CAAC;KACJ,CAAC,CAAC;CACJ;AAED,8DAA8D;AAC9D,UAAU,eAAe;IACvB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,IAAI,CAAC;IAC/E,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACjF;AAkBD;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,eAAe,GAAG,IAAI,CAkDxE;AA+JD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CA6E9E"}
|