@gate-forge/pack-playwright 0.1.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/LICENSE +202 -0
- package/bin/gateforge-witness.js +40 -0
- package/dist/attestation/proxy.d.ts +40 -0
- package/dist/attestation/proxy.d.ts.map +1 -0
- package/dist/attestation/proxy.js +78 -0
- package/dist/attestation/proxy.js.map +1 -0
- package/dist/constants.d.ts +130 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +138 -0
- package/dist/constants.js.map +1 -0
- package/dist/discovery/adapters.d.ts +167 -0
- package/dist/discovery/adapters.d.ts.map +1 -0
- package/dist/discovery/adapters.js +276 -0
- package/dist/discovery/adapters.js.map +1 -0
- package/dist/discovery/discover.d.ts +57 -0
- package/dist/discovery/discover.d.ts.map +1 -0
- package/dist/discovery/discover.js +544 -0
- package/dist/discovery/discover.js.map +1 -0
- package/dist/discovery/index.d.ts +15 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +15 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/inference.d.ts +63 -0
- package/dist/discovery/inference.d.ts.map +1 -0
- package/dist/discovery/inference.js +173 -0
- package/dist/discovery/inference.js.map +1 -0
- package/dist/discovery/pytest-adapter.d.ts +205 -0
- package/dist/discovery/pytest-adapter.d.ts.map +1 -0
- package/dist/discovery/pytest-adapter.js +548 -0
- package/dist/discovery/pytest-adapter.js.map +1 -0
- package/dist/discovery/reconcile.d.ts +106 -0
- package/dist/discovery/reconcile.d.ts.map +1 -0
- package/dist/discovery/reconcile.js +268 -0
- package/dist/discovery/reconcile.js.map +1 -0
- package/dist/discovery/runner-env.d.ts +80 -0
- package/dist/discovery/runner-env.d.ts.map +1 -0
- package/dist/discovery/runner-env.js +139 -0
- package/dist/discovery/runner-env.js.map +1 -0
- package/dist/discovery/static-discovery.d.ts +121 -0
- package/dist/discovery/static-discovery.d.ts.map +1 -0
- package/dist/discovery/static-discovery.js +1028 -0
- package/dist/discovery/static-discovery.js.map +1 -0
- package/dist/discovery/supervised-run.d.ts +110 -0
- package/dist/discovery/supervised-run.d.ts.map +1 -0
- package/dist/discovery/supervised-run.js +328 -0
- package/dist/discovery/supervised-run.js.map +1 -0
- package/dist/discovery/trusted-config.d.ts +103 -0
- package/dist/discovery/trusted-config.d.ts.map +1 -0
- package/dist/discovery/trusted-config.js +117 -0
- package/dist/discovery/trusted-config.js.map +1 -0
- package/dist/fixture/evidence.d.ts +191 -0
- package/dist/fixture/evidence.d.ts.map +1 -0
- package/dist/fixture/evidence.js +366 -0
- package/dist/fixture/evidence.js.map +1 -0
- package/dist/fixture/fixture.d.ts +37 -0
- package/dist/fixture/fixture.d.ts.map +1 -0
- package/dist/fixture/fixture.js +38 -0
- package/dist/fixture/fixture.js.map +1 -0
- package/dist/fixture/witness-client.d.ts +164 -0
- package/dist/fixture/witness-client.d.ts.map +1 -0
- package/dist/fixture/witness-client.js +253 -0
- package/dist/fixture/witness-client.js.map +1 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/json.d.ts +16 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +21 -0
- package/dist/json.js.map +1 -0
- package/dist/reporter/ledger.d.ts +105 -0
- package/dist/reporter/ledger.d.ts.map +1 -0
- package/dist/reporter/ledger.js +197 -0
- package/dist/reporter/ledger.js.map +1 -0
- package/dist/reporter/reporter.cjs +105 -0
- package/dist/reporter/reporter.cjs.map +1 -0
- package/dist/reporter/reporter.d.cts +35 -0
- package/dist/reporter/reporter.d.cts.map +1 -0
- package/dist/reporter/reporter.d.ts +167 -0
- package/dist/reporter/reporter.d.ts.map +1 -0
- package/dist/reporter/reporter.js +673 -0
- package/dist/reporter/reporter.js.map +1 -0
- package/dist/setup.d.ts +49 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +167 -0
- package/dist/setup.js.map +1 -0
- package/dist/supervisor/client.d.ts +73 -0
- package/dist/supervisor/client.d.ts.map +1 -0
- package/dist/supervisor/client.js +164 -0
- package/dist/supervisor/client.js.map +1 -0
- package/dist/supervisor/drain.d.ts +45 -0
- package/dist/supervisor/drain.d.ts.map +1 -0
- package/dist/supervisor/drain.js +235 -0
- package/dist/supervisor/drain.js.map +1 -0
- package/dist/supervisor/index.d.ts +16 -0
- package/dist/supervisor/index.d.ts.map +1 -0
- package/dist/supervisor/index.js +13 -0
- package/dist/supervisor/index.js.map +1 -0
- package/dist/supervisor/spool.d.ts +137 -0
- package/dist/supervisor/spool.d.ts.map +1 -0
- package/dist/supervisor/spool.js +263 -0
- package/dist/supervisor/spool.js.map +1 -0
- package/dist/surface.d.ts +134 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +139 -0
- package/dist/surface.js.map +1 -0
- package/dist/witness/adapter-registry.d.ts +38 -0
- package/dist/witness/adapter-registry.d.ts.map +1 -0
- package/dist/witness/adapter-registry.js +158 -0
- package/dist/witness/adapter-registry.js.map +1 -0
- package/dist/witness/bin.d.ts +21 -0
- package/dist/witness/bin.d.ts.map +1 -0
- package/dist/witness/bin.js +172 -0
- package/dist/witness/bin.js.map +1 -0
- package/dist/witness/browser.d.ts +173 -0
- package/dist/witness/browser.d.ts.map +1 -0
- package/dist/witness/browser.js +580 -0
- package/dist/witness/browser.js.map +1 -0
- package/dist/witness/classifications.d.ts +42 -0
- package/dist/witness/classifications.d.ts.map +1 -0
- package/dist/witness/classifications.js +87 -0
- package/dist/witness/classifications.js.map +1 -0
- package/dist/witness/env-attestation.d.ts +98 -0
- package/dist/witness/env-attestation.d.ts.map +1 -0
- package/dist/witness/env-attestation.js +202 -0
- package/dist/witness/env-attestation.js.map +1 -0
- package/dist/witness/loopback-pins.d.ts +79 -0
- package/dist/witness/loopback-pins.d.ts.map +1 -0
- package/dist/witness/loopback-pins.js +244 -0
- package/dist/witness/loopback-pins.js.map +1 -0
- package/dist/witness/server.d.ts +34 -0
- package/dist/witness/server.d.ts.map +1 -0
- package/dist/witness/server.js +2539 -0
- package/dist/witness/server.js.map +1 -0
- package/dist/witness/types.d.ts +643 -0
- package/dist/witness/types.d.ts.map +1 -0
- package/dist/witness/types.js +2 -0
- package/dist/witness/types.js.map +1 -0
- package/package.json +64 -0
- package/python/gateforge_persistence_intents.py +100 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runner adapters over the core contract (plan 2026-09-13 phase 2 item
|
|
3
|
+
* 6 + Phase 4 items 1/9): the Playwright adapter and the bounded pytest
|
|
4
|
+
* diagnostic adapter.
|
|
5
|
+
*
|
|
6
|
+
* Capability honesty (declared, never implied):
|
|
7
|
+
* - Playwright: `inventory`, `resolveInstances`, and (since Phase 4)
|
|
8
|
+
* `execute` are AVAILABLE. `execute` runs the suite under trusted
|
|
9
|
+
* supervision (ADR 0005 D2 + execution-authority fix): the consumer's
|
|
10
|
+
* config file is NEVER loaded — the supervisor synthesizes a minimal
|
|
11
|
+
* trusted config (exact selected files, bare project names as data,
|
|
12
|
+
* the engine reporter forced by absolute path, serial workers, zero
|
|
13
|
+
* retries) and runs it with a finite timeout. The gateforge
|
|
14
|
+
* reporter's runner-outcomes document is REQUIRED input; a missing
|
|
15
|
+
* document is an incomplete run (never a silent green). Consumer
|
|
16
|
+
* globalSetup/teardown/reporters/webServer/per-project options are
|
|
17
|
+
* NOT honored (constrained model, see trusted-config.ts).
|
|
18
|
+
* - Pytest: `inventory` (bounded collection), `resolveInstances`
|
|
19
|
+
* (node-id identity), and (since Phase 4) `execute` — the §3.5
|
|
20
|
+
* diagnostic execution: one isolated junit-XML run per suite in the
|
|
21
|
+
* excluded run-state dir. Its results are DIAGNOSTIC data (never
|
|
22
|
+
* witness evidence, never E2E satisfaction).
|
|
23
|
+
*
|
|
24
|
+
* Both adapters fail closed: an undeclared capability is an error, and
|
|
25
|
+
* inventory problems come back as typed catalog rows, never silence.
|
|
26
|
+
*/
|
|
27
|
+
import { loadConfig } from '@gate-forge/core';
|
|
28
|
+
import type { DiagnosticSuite, RunnerCapabilities, RunnerExecutionEnvelope, RunnerSelection, RunnerExecutionEnv, RunnerTestInstance, TestCatalog, TestCatalogEntry, TestRunnerAdapter } from '@gate-forge/core';
|
|
29
|
+
import { type DiscoverOptions } from './discover.js';
|
|
30
|
+
import { type DiagnosticRunResult } from './pytest-adapter.js';
|
|
31
|
+
import { listNativePlaywrightTests } from './reconcile.js';
|
|
32
|
+
import { type SupervisedRunOptions } from './supervised-run.js';
|
|
33
|
+
/** Error thrown when an adapter capability is not available. */
|
|
34
|
+
export declare class AdapterCapabilityError extends Error {
|
|
35
|
+
constructor(message: string);
|
|
36
|
+
}
|
|
37
|
+
/** Options the adapters need beyond cwd (config-loading override). */
|
|
38
|
+
export interface AdapterOptions {
|
|
39
|
+
/** Discovery knobs (pytest collection, timeouts). */
|
|
40
|
+
discover?: Omit<DiscoverOptions, 'cwd' | 'config'>;
|
|
41
|
+
/**
|
|
42
|
+
* Pre-loaded config; when absent the adapter loads `.gateforge.yml`
|
|
43
|
+
* from `cwd` itself (fail-closed via core).
|
|
44
|
+
*/
|
|
45
|
+
config?: ReturnType<typeof loadConfig>;
|
|
46
|
+
/**
|
|
47
|
+
* Supervised-run knobs for `execute` (runner command override for
|
|
48
|
+
* tests, whole-run timeout). Production uses the defaults.
|
|
49
|
+
*/
|
|
50
|
+
run?: SupervisedRunOptions;
|
|
51
|
+
}
|
|
52
|
+
/** The Playwright runner adapter. */
|
|
53
|
+
export declare class PlaywrightAdapter implements TestRunnerAdapter<TestCatalogEntry> {
|
|
54
|
+
private readonly options;
|
|
55
|
+
readonly runner = "playwright";
|
|
56
|
+
readonly capabilities: RunnerCapabilities;
|
|
57
|
+
constructor(options?: AdapterOptions);
|
|
58
|
+
/**
|
|
59
|
+
* Enumerates the configured playwright tests (static + reconciled).
|
|
60
|
+
*
|
|
61
|
+
* Args:
|
|
62
|
+
* cwd: absolute repo root.
|
|
63
|
+
*
|
|
64
|
+
* Returns:
|
|
65
|
+
* Promise<readonly TestCatalogEntry[]>: catalog rows (gaps included).
|
|
66
|
+
*/
|
|
67
|
+
inventory(cwd: string): Promise<readonly TestCatalogEntry[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Resolves a logical key to its runtime instances (project + native
|
|
70
|
+
* framework id) via the reconciled catalog.
|
|
71
|
+
*
|
|
72
|
+
* Args:
|
|
73
|
+
* logicalKey: the stable logical identity.
|
|
74
|
+
* cwd: absolute repo root.
|
|
75
|
+
*
|
|
76
|
+
* Returns:
|
|
77
|
+
* Promise<readonly RunnerTestInstance[]>: matching instances (empty
|
|
78
|
+
* when the key has no current instance — a visible stale mapping).
|
|
79
|
+
*/
|
|
80
|
+
resolveInstances(logicalKey: string, cwd: string): Promise<readonly RunnerTestInstance[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Executes the playwright suite under trusted supervision (plan
|
|
83
|
+
* Phase 4 item 1, ADR 0005 D2, execution-authority fix): the
|
|
84
|
+
* consumer's config file is never loaded (trusted-config synthesis
|
|
85
|
+
* over the exact selected files); the gateforge reporter's outcomes
|
|
86
|
+
* document is the per-instance data source. Expected-set comparison
|
|
87
|
+
* is the supervisor's job (core supervision module) — this envelope
|
|
88
|
+
* is structured INPUT, never a gate result.
|
|
89
|
+
*
|
|
90
|
+
* Args:
|
|
91
|
+
* selection: exact logical keys the supervisor expects (carried for
|
|
92
|
+
* the supervisor; the run itself is the full configured suite).
|
|
93
|
+
* env: run-state dir + run identity + pre-sanitized child env vars.
|
|
94
|
+
*
|
|
95
|
+
* Returns:
|
|
96
|
+
* Promise<RunnerExecutionEnvelope>: structured outcome envelope —
|
|
97
|
+
* `complete: false` with a single-cause detail for missing config,
|
|
98
|
+
* missing/malformed outcomes, timeout, or nonzero exit.
|
|
99
|
+
*/
|
|
100
|
+
execute(selection: RunnerSelection, env: RunnerExecutionEnv): Promise<RunnerExecutionEnvelope>;
|
|
101
|
+
}
|
|
102
|
+
/** The bounded pytest diagnostic adapter (§3.5; collection + execution). */
|
|
103
|
+
export declare class PytestAdapter implements TestRunnerAdapter<TestCatalogEntry> {
|
|
104
|
+
private readonly suite;
|
|
105
|
+
readonly runner = "pytest";
|
|
106
|
+
readonly capabilities: RunnerCapabilities;
|
|
107
|
+
constructor(suite: DiagnosticSuite);
|
|
108
|
+
/**
|
|
109
|
+
* Collects the configured suite (bounded, structured node ids).
|
|
110
|
+
*
|
|
111
|
+
* Args:
|
|
112
|
+
* cwd: absolute repo root (suite.cwd resolves against it).
|
|
113
|
+
*
|
|
114
|
+
* Returns:
|
|
115
|
+
* Promise<readonly TestCatalogEntry[]>: one row per collected node
|
|
116
|
+
* id; collection failure yields a single unresolved row (never an
|
|
117
|
+
* empty success).
|
|
118
|
+
*/
|
|
119
|
+
inventory(cwd: string): Promise<readonly TestCatalogEntry[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Resolves a logical key to its collected node ids.
|
|
122
|
+
*
|
|
123
|
+
* Args:
|
|
124
|
+
* logicalKey: the stable logical identity.
|
|
125
|
+
* cwd: absolute repo root.
|
|
126
|
+
*
|
|
127
|
+
* Returns:
|
|
128
|
+
* Promise<readonly RunnerTestInstance[]>: matching instances.
|
|
129
|
+
*/
|
|
130
|
+
resolveInstances(logicalKey: string, cwd: string): Promise<readonly RunnerTestInstance[]>;
|
|
131
|
+
/**
|
|
132
|
+
* Executes the configured diagnostic suite ONCE (plan Phase 4 item 9,
|
|
133
|
+
* §3.5): isolated process (GATEFORGE_* stripped), junit XML into the
|
|
134
|
+
* EXCLUDED run-state dir, finite timeout. The result is advisory
|
|
135
|
+
* diagnostic data — never witness evidence, never E2E satisfaction.
|
|
136
|
+
*
|
|
137
|
+
* Args:
|
|
138
|
+
* selection: ignored (the suite's configured testPaths are the scope).
|
|
139
|
+
* env: the run env whose stateDir hosts the junit report.
|
|
140
|
+
*
|
|
141
|
+
* Returns:
|
|
142
|
+
* Promise<RunnerExecutionEnvelope>: a structured envelope wrapping
|
|
143
|
+
* the diagnostic outcome — `complete` mirrors the diagnostic run's
|
|
144
|
+
* completeness. Use {@link executeDiagnostic} for the full typed
|
|
145
|
+
* result (causes, counters, report path).
|
|
146
|
+
*/
|
|
147
|
+
execute(selection: RunnerSelection, env: RunnerExecutionEnv): Promise<RunnerExecutionEnvelope>;
|
|
148
|
+
/**
|
|
149
|
+
* Executes the configured diagnostic suite and returns the FULL typed
|
|
150
|
+
* diagnostic result (§3.5): status, exit code, counters (skips/xfail
|
|
151
|
+
* explicit), collection/setup errors, failure locations/messages,
|
|
152
|
+
* completeness, report path. Advisory data only.
|
|
153
|
+
*
|
|
154
|
+
* Args:
|
|
155
|
+
* repoRoot: absolute repo root (suite.cwd resolves against it).
|
|
156
|
+
* stateDir: absolute run-state dir for the junit report.
|
|
157
|
+
*
|
|
158
|
+
* Returns:
|
|
159
|
+
* Promise<DiagnosticRunResult>: the structured diagnostic result.
|
|
160
|
+
*/
|
|
161
|
+
executeDiagnostic(repoRoot: string, stateDir: string): Promise<DiagnosticRunResult>;
|
|
162
|
+
}
|
|
163
|
+
/** Loads the catalog a discovery run produced (shared helper). */
|
|
164
|
+
export declare function loadCatalog(options: DiscoverOptions): Promise<TestCatalog>;
|
|
165
|
+
/** Native list re-export for CLI-level reconciliation previews. */
|
|
166
|
+
export { listNativePlaywrightTests };
|
|
167
|
+
//# sourceMappingURL=adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/discovery/adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAuB,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AAC,QAAQ,CAAC,KAAK;IATlC,QAAQ,CAAC,MAAM,YAAY;IAE3B,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAKvC;gBAE2B,KAAK,EAAE,eAAe;IAEnD;;;;;;;;;;OAUG;IACG,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAAC;IAkDlE;;;;;;;;;OASG;IACG,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAAC;IAW/F;;;;;;;;;;;;;;;OAeG;IACG,OAAO,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAuBpG;;;;;;;;;;;;OAYG;IACG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAG1F;AAED,kEAAkE;AAClE,wBAAsB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,CAGhF;AAED,mEAAmE;AACnE,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runner adapters over the core contract (plan 2026-09-13 phase 2 item
|
|
3
|
+
* 6 + Phase 4 items 1/9): the Playwright adapter and the bounded pytest
|
|
4
|
+
* diagnostic adapter.
|
|
5
|
+
*
|
|
6
|
+
* Capability honesty (declared, never implied):
|
|
7
|
+
* - Playwright: `inventory`, `resolveInstances`, and (since Phase 4)
|
|
8
|
+
* `execute` are AVAILABLE. `execute` runs the suite under trusted
|
|
9
|
+
* supervision (ADR 0005 D2 + execution-authority fix): the consumer's
|
|
10
|
+
* config file is NEVER loaded — the supervisor synthesizes a minimal
|
|
11
|
+
* trusted config (exact selected files, bare project names as data,
|
|
12
|
+
* the engine reporter forced by absolute path, serial workers, zero
|
|
13
|
+
* retries) and runs it with a finite timeout. The gateforge
|
|
14
|
+
* reporter's runner-outcomes document is REQUIRED input; a missing
|
|
15
|
+
* document is an incomplete run (never a silent green). Consumer
|
|
16
|
+
* globalSetup/teardown/reporters/webServer/per-project options are
|
|
17
|
+
* NOT honored (constrained model, see trusted-config.ts).
|
|
18
|
+
* - Pytest: `inventory` (bounded collection), `resolveInstances`
|
|
19
|
+
* (node-id identity), and (since Phase 4) `execute` — the §3.5
|
|
20
|
+
* diagnostic execution: one isolated junit-XML run per suite in the
|
|
21
|
+
* excluded run-state dir. Its results are DIAGNOSTIC data (never
|
|
22
|
+
* witness evidence, never E2E satisfaction).
|
|
23
|
+
*
|
|
24
|
+
* Both adapters fail closed: an undeclared capability is an error, and
|
|
25
|
+
* inventory problems come back as typed catalog rows, never silence.
|
|
26
|
+
*/
|
|
27
|
+
import { loadConfig } from '@gate-forge/core';
|
|
28
|
+
import { discoverTestCatalog } from './discover.js';
|
|
29
|
+
import { collectPytestSuite, executePytestSuite, pytestExecutionArgv, } from './pytest-adapter.js';
|
|
30
|
+
import { listNativePlaywrightTests } from './reconcile.js';
|
|
31
|
+
import { executeSupervisedPlaywright } from './supervised-run.js';
|
|
32
|
+
/** Error thrown when an adapter capability is not available. */
|
|
33
|
+
export class AdapterCapabilityError extends Error {
|
|
34
|
+
constructor(message) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.name = 'AdapterCapabilityError';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** The Playwright runner adapter. */
|
|
40
|
+
export class PlaywrightAdapter {
|
|
41
|
+
options;
|
|
42
|
+
runner = 'playwright';
|
|
43
|
+
capabilities = {
|
|
44
|
+
inventory: 'available',
|
|
45
|
+
resolveInstances: 'available',
|
|
46
|
+
// Phase 4 + execution-authority fix: trusted supervision is wired —
|
|
47
|
+
// execute runs the trusted-synthesized suite (consumer config never
|
|
48
|
+
// loaded) and returns the structured outcome envelope (ADR 0005 D2).
|
|
49
|
+
execute: 'available',
|
|
50
|
+
};
|
|
51
|
+
constructor(options = {}) {
|
|
52
|
+
this.options = options;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Enumerates the configured playwright tests (static + reconciled).
|
|
56
|
+
*
|
|
57
|
+
* Args:
|
|
58
|
+
* cwd: absolute repo root.
|
|
59
|
+
*
|
|
60
|
+
* Returns:
|
|
61
|
+
* Promise<readonly TestCatalogEntry[]>: catalog rows (gaps included).
|
|
62
|
+
*/
|
|
63
|
+
async inventory(cwd) {
|
|
64
|
+
const config = this.options.config ?? loadConfig(`${cwd}/.gateforge.yml`);
|
|
65
|
+
const { catalog } = await discoverTestCatalog({
|
|
66
|
+
cwd,
|
|
67
|
+
config,
|
|
68
|
+
...this.options.discover,
|
|
69
|
+
});
|
|
70
|
+
return catalog.entries;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Resolves a logical key to its runtime instances (project + native
|
|
74
|
+
* framework id) via the reconciled catalog.
|
|
75
|
+
*
|
|
76
|
+
* Args:
|
|
77
|
+
* logicalKey: the stable logical identity.
|
|
78
|
+
* cwd: absolute repo root.
|
|
79
|
+
*
|
|
80
|
+
* Returns:
|
|
81
|
+
* Promise<readonly RunnerTestInstance[]>: matching instances (empty
|
|
82
|
+
* when the key has no current instance — a visible stale mapping).
|
|
83
|
+
*/
|
|
84
|
+
async resolveInstances(logicalKey, cwd) {
|
|
85
|
+
const config = this.options.config ?? loadConfig(`${cwd}/.gateforge.yml`);
|
|
86
|
+
const { catalog } = await discoverTestCatalog({
|
|
87
|
+
cwd,
|
|
88
|
+
config,
|
|
89
|
+
...this.options.discover,
|
|
90
|
+
});
|
|
91
|
+
return catalog.entries
|
|
92
|
+
.filter((entry) => entry.logicalKey === logicalKey)
|
|
93
|
+
.map((entry) => ({
|
|
94
|
+
logicalKey,
|
|
95
|
+
project: entry.project,
|
|
96
|
+
frameworkId: entry.parameterIdentity ?? '',
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Executes the playwright suite under trusted supervision (plan
|
|
101
|
+
* Phase 4 item 1, ADR 0005 D2, execution-authority fix): the
|
|
102
|
+
* consumer's config file is never loaded (trusted-config synthesis
|
|
103
|
+
* over the exact selected files); the gateforge reporter's outcomes
|
|
104
|
+
* document is the per-instance data source. Expected-set comparison
|
|
105
|
+
* is the supervisor's job (core supervision module) — this envelope
|
|
106
|
+
* is structured INPUT, never a gate result.
|
|
107
|
+
*
|
|
108
|
+
* Args:
|
|
109
|
+
* selection: exact logical keys the supervisor expects (carried for
|
|
110
|
+
* the supervisor; the run itself is the full configured suite).
|
|
111
|
+
* env: run-state dir + run identity + pre-sanitized child env vars.
|
|
112
|
+
*
|
|
113
|
+
* Returns:
|
|
114
|
+
* Promise<RunnerExecutionEnvelope>: structured outcome envelope —
|
|
115
|
+
* `complete: false` with a single-cause detail for missing config,
|
|
116
|
+
* missing/malformed outcomes, timeout, or nonzero exit.
|
|
117
|
+
*/
|
|
118
|
+
async execute(selection, env) {
|
|
119
|
+
return executeSupervisedPlaywright(selection, env, this.options.run);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/** The bounded pytest diagnostic adapter (§3.5; collection + execution). */
|
|
123
|
+
export class PytestAdapter {
|
|
124
|
+
suite;
|
|
125
|
+
runner = 'pytest';
|
|
126
|
+
capabilities = {
|
|
127
|
+
inventory: 'available',
|
|
128
|
+
resolveInstances: 'available',
|
|
129
|
+
// Phase 4: §3.5 diagnostic execution (junit-XML outcomes) is wired.
|
|
130
|
+
execute: 'available',
|
|
131
|
+
};
|
|
132
|
+
constructor(suite) {
|
|
133
|
+
this.suite = suite;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Collects the configured suite (bounded, structured node ids).
|
|
137
|
+
*
|
|
138
|
+
* Args:
|
|
139
|
+
* cwd: absolute repo root (suite.cwd resolves against it).
|
|
140
|
+
*
|
|
141
|
+
* Returns:
|
|
142
|
+
* Promise<readonly TestCatalogEntry[]>: one row per collected node
|
|
143
|
+
* id; collection failure yields a single unresolved row (never an
|
|
144
|
+
* empty success).
|
|
145
|
+
*/
|
|
146
|
+
async inventory(cwd) {
|
|
147
|
+
const collection = await collectPytestSuite(this.suite, `${cwd}/${this.suite.cwd}`.replace('//', '/'));
|
|
148
|
+
if (collection.status !== 'discovered') {
|
|
149
|
+
return [
|
|
150
|
+
{
|
|
151
|
+
logicalKey: `pytest:${this.suite.name}:<collection-unavailable>`,
|
|
152
|
+
runner: 'pytest',
|
|
153
|
+
project: this.suite.name,
|
|
154
|
+
file: this.suite.cwd,
|
|
155
|
+
titlePath: ['<collection-unavailable>'],
|
|
156
|
+
title: '<collection-unavailable>',
|
|
157
|
+
sourceLocation: { file: this.suite.cwd, line: 1, col: 0 },
|
|
158
|
+
parameterIdentity: null,
|
|
159
|
+
sourceDigest: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
|
160
|
+
discoveryStatus: 'unresolved',
|
|
161
|
+
reconciliation: 'unavailable',
|
|
162
|
+
inferredKind: 'unknown',
|
|
163
|
+
kindSignals: [],
|
|
164
|
+
weakSignals: [],
|
|
165
|
+
rulesFired: [],
|
|
166
|
+
categorySignals: [],
|
|
167
|
+
suppressionSignals: [],
|
|
168
|
+
unresolvedReason: { code: 'pytest-collection-unavailable', detail: collection.detail },
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
return collection.cases.map((testCase) => ({
|
|
173
|
+
logicalKey: `pytest:${this.suite.name}:${testCase.nodeId}`,
|
|
174
|
+
runner: 'pytest',
|
|
175
|
+
project: this.suite.name,
|
|
176
|
+
file: testCase.file,
|
|
177
|
+
titlePath: testCase.titlePath,
|
|
178
|
+
title: testCase.titlePath[testCase.titlePath.length - 1] ?? testCase.nodeId,
|
|
179
|
+
sourceLocation: { file: testCase.file, line: 1, col: 0 },
|
|
180
|
+
parameterIdentity: testCase.nodeId,
|
|
181
|
+
// Digest composition mirrors discover.ts (suite-cwd-relative →
|
|
182
|
+
// repo-relative); zero here only when the adapter is used
|
|
183
|
+
// standalone without a repo file backing the node id.
|
|
184
|
+
sourceDigest: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
|
185
|
+
discoveryStatus: 'discovered',
|
|
186
|
+
reconciliation: 'unavailable',
|
|
187
|
+
inferredKind: 'unknown',
|
|
188
|
+
kindSignals: [],
|
|
189
|
+
weakSignals: [],
|
|
190
|
+
rulesFired: [],
|
|
191
|
+
categorySignals: [],
|
|
192
|
+
suppressionSignals: [],
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Resolves a logical key to its collected node ids.
|
|
197
|
+
*
|
|
198
|
+
* Args:
|
|
199
|
+
* logicalKey: the stable logical identity.
|
|
200
|
+
* cwd: absolute repo root.
|
|
201
|
+
*
|
|
202
|
+
* Returns:
|
|
203
|
+
* Promise<readonly RunnerTestInstance[]>: matching instances.
|
|
204
|
+
*/
|
|
205
|
+
async resolveInstances(logicalKey, cwd) {
|
|
206
|
+
const entries = await this.inventory(cwd);
|
|
207
|
+
return entries
|
|
208
|
+
.filter((entry) => entry.logicalKey === logicalKey)
|
|
209
|
+
.map((entry) => ({
|
|
210
|
+
logicalKey,
|
|
211
|
+
project: entry.project,
|
|
212
|
+
frameworkId: entry.parameterIdentity ?? '',
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Executes the configured diagnostic suite ONCE (plan Phase 4 item 9,
|
|
217
|
+
* §3.5): isolated process (GATEFORGE_* stripped), junit XML into the
|
|
218
|
+
* EXCLUDED run-state dir, finite timeout. The result is advisory
|
|
219
|
+
* diagnostic data — never witness evidence, never E2E satisfaction.
|
|
220
|
+
*
|
|
221
|
+
* Args:
|
|
222
|
+
* selection: ignored (the suite's configured testPaths are the scope).
|
|
223
|
+
* env: the run env whose stateDir hosts the junit report.
|
|
224
|
+
*
|
|
225
|
+
* Returns:
|
|
226
|
+
* Promise<RunnerExecutionEnvelope>: a structured envelope wrapping
|
|
227
|
+
* the diagnostic outcome — `complete` mirrors the diagnostic run's
|
|
228
|
+
* completeness. Use {@link executeDiagnostic} for the full typed
|
|
229
|
+
* result (causes, counters, report path).
|
|
230
|
+
*/
|
|
231
|
+
async execute(selection, env) {
|
|
232
|
+
void selection;
|
|
233
|
+
const result = await this.executeDiagnostic(`${env.stateDir}`, process.cwd());
|
|
234
|
+
const complete = result.complete && result.status === 'completed';
|
|
235
|
+
return {
|
|
236
|
+
processExit: result.exitCode,
|
|
237
|
+
complete,
|
|
238
|
+
outcomes: [],
|
|
239
|
+
fixtureOutcome: result.complete ? (complete ? 'passed' : 'failed') : 'unknown',
|
|
240
|
+
shards: null,
|
|
241
|
+
retriesDetected: false,
|
|
242
|
+
engines: { node: process.version },
|
|
243
|
+
browsers: {},
|
|
244
|
+
...(complete
|
|
245
|
+
? {}
|
|
246
|
+
: {
|
|
247
|
+
incompleteDetail: result.incompleteDetail ??
|
|
248
|
+
`suite '${this.suite.name}' reported failures — diagnostic data, never E2E satisfaction`,
|
|
249
|
+
}),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Executes the configured diagnostic suite and returns the FULL typed
|
|
254
|
+
* diagnostic result (§3.5): status, exit code, counters (skips/xfail
|
|
255
|
+
* explicit), collection/setup errors, failure locations/messages,
|
|
256
|
+
* completeness, report path. Advisory data only.
|
|
257
|
+
*
|
|
258
|
+
* Args:
|
|
259
|
+
* repoRoot: absolute repo root (suite.cwd resolves against it).
|
|
260
|
+
* stateDir: absolute run-state dir for the junit report.
|
|
261
|
+
*
|
|
262
|
+
* Returns:
|
|
263
|
+
* Promise<DiagnosticRunResult>: the structured diagnostic result.
|
|
264
|
+
*/
|
|
265
|
+
async executeDiagnostic(repoRoot, stateDir) {
|
|
266
|
+
return executePytestSuite(this.suite, repoRoot, stateDir);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/** Loads the catalog a discovery run produced (shared helper). */
|
|
270
|
+
export async function loadCatalog(options) {
|
|
271
|
+
const { catalog } = await discoverTestCatalog(options);
|
|
272
|
+
return catalog;
|
|
273
|
+
}
|
|
274
|
+
/** Native list re-export for CLI-level reconciliation previews. */
|
|
275
|
+
export { listNativePlaywrightTests };
|
|
276
|
+
//# sourceMappingURL=adapters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../src/discovery/adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAY9C,OAAO,EAAE,mBAAmB,EAAwB,MAAM,eAAe,CAAC;AAC1E,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAA6B,MAAM,qBAAqB,CAAC;AAE7F,gEAAgE;AAChE,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAkBD,qCAAqC;AACrC,MAAM,OAAO,iBAAiB;IAYC;IAXpB,MAAM,GAAG,YAAY,CAAC;IAEtB,YAAY,GAAuB;QAC1C,SAAS,EAAE,WAAW;QACtB,gBAAgB,EAAE,WAAW;QAC7B,oEAAoE;QACpE,oEAAoE;QACpE,qEAAqE;QACrE,OAAO,EAAE,WAAW;KACrB,CAAC;IAEF,YAA6B,UAA0B,EAAE;QAA5B,YAAO,GAAP,OAAO,CAAqB;IAAG,CAAC;IAE7D;;;;;;;;OAQG;IACH,KAAK,CAAC,SAAS,CAAC,GAAW;QACzB,MAAM,MAA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AAC,CAAC;IACvD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,mEAAmE;AACnE,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type GateforgeConfig, type TestCatalog } from '@gate-forge/core';
|
|
2
|
+
import { repoRelative } from './pytest-adapter.js';
|
|
3
|
+
/** Options for one discovery run. */
|
|
4
|
+
export interface DiscoverOptions {
|
|
5
|
+
/** Absolute repo root. */
|
|
6
|
+
cwd: string;
|
|
7
|
+
/** The validated gateforge config. */
|
|
8
|
+
config: GateforgeConfig;
|
|
9
|
+
/** Collect configured pytest suites (default: list them only). */
|
|
10
|
+
collectPytest?: boolean;
|
|
11
|
+
/** Native playwright `--list` timeout (default 60s). */
|
|
12
|
+
playwrightTimeoutMs?: number;
|
|
13
|
+
}
|
|
14
|
+
/** The discovery result: the validated catalog plus its canonical JSON. */
|
|
15
|
+
export interface DiscoverResult {
|
|
16
|
+
catalog: TestCatalog;
|
|
17
|
+
/** Canonical JSON of the catalog (deterministic, snapshot-able). */
|
|
18
|
+
json: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Runs discovery + reconciliation and returns the validated catalog.
|
|
22
|
+
*
|
|
23
|
+
* Pytest suites (plan §3.5) are registered-but-diagnostic-only by
|
|
24
|
+
* default: they appear in `runnerSummaries` with status `registered`
|
|
25
|
+
* (their configured identities, no execution, no collection). With
|
|
26
|
+
* `collectPytest: true` (CLI `--pytest`), the adapter runs the
|
|
27
|
+
* configured argv with `--collect-only -q` and adds one entry per
|
|
28
|
+
* collected node id; diagnostic EXECUTION remains Phase 4 work.
|
|
29
|
+
*
|
|
30
|
+
* Args:
|
|
31
|
+
* options: cwd, config, optional pytest collection + timeouts.
|
|
32
|
+
*
|
|
33
|
+
* Returns:
|
|
34
|
+
* Promise<DiscoverResult>: validated catalog + canonical JSON.
|
|
35
|
+
*
|
|
36
|
+
* Throws:
|
|
37
|
+
* TestDiscoveryError: when an enabled native enumeration could not
|
|
38
|
+
* run at all (spawn failure, timeout, unparseable output) — the CLI
|
|
39
|
+
* maps this to exit 2. Scanner-detectable problems are rows, not
|
|
40
|
+
* throws.
|
|
41
|
+
*/
|
|
42
|
+
export declare function discoverTestCatalog(options: DiscoverOptions): Promise<DiscoverResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Builds the instance-title matcher for a parameterized static title, or
|
|
45
|
+
* null when the title carries no `${}` template slots. Literal parts
|
|
46
|
+
* match exactly (regex-escaped); each slot matches any (possibly empty)
|
|
47
|
+
* text — the same expansion the runner performs over the loop values.
|
|
48
|
+
*
|
|
49
|
+
* Args:
|
|
50
|
+
* title: the static title (may contain `${}` slots).
|
|
51
|
+
*
|
|
52
|
+
* Returns:
|
|
53
|
+
* Anchored RegExp, or null for non-parameterized titles.
|
|
54
|
+
*/
|
|
55
|
+
export declare function templateTitlePattern(title: string): RegExp | null;
|
|
56
|
+
export { repoRelative };
|
|
57
|
+
//# sourceMappingURL=discover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../../src/discovery/discover.ts"],"names":[],"mappings":"AA2BA,OAAO,EAOL,KAAK,eAAe,EAGpB,KAAK,WAAW,EAGjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEL,YAAY,EACb,MAAM,qBAAqB,CAAC;AAe7B,qCAAqC;AACrC,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,MAAM,EAAE,eAAe,CAAC;IACxB,kEAAkE;IAClE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,wDAAwD;IACxD,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,WAAW,CAAC;IACrB,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAgD3F;AAgXD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIjE;AA6FD,OAAO,EAAE,YAAY,EAAE,CAAC"}
|