@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,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reporter ledger computation (pure helpers).
|
|
3
|
+
*
|
|
4
|
+
* Per-claim verdicts are computed with the REAL verdict engine
|
|
5
|
+
* (`evaluateObligation`, G3 pin #9) — the reporter never trusts a test's
|
|
6
|
+
* own conclusion. Per-claim isolation: each row evaluates exactly that
|
|
7
|
+
* test's claim against the run's witness ledger; the engine attributes
|
|
8
|
+
* records by (obligationId, testId), so a claim cannot borrow another
|
|
9
|
+
* test's evidence.
|
|
10
|
+
*
|
|
11
|
+
* The ledger needs the run's obligations (from `GATEFORGE_OBLIGATIONS`)
|
|
12
|
+
* and each resource's classification (primaryKey etc.) from the witness
|
|
13
|
+
* (`GET /classifications`). When either is unavailable the row carries
|
|
14
|
+
* `verdict: null` and the reason says exactly what is missing.
|
|
15
|
+
*/
|
|
16
|
+
import { evaluateObligation, isWitnessedRecord, } from '@gate-forge/core';
|
|
17
|
+
/** Load a valid claim-shaped object from the annotation source. */
|
|
18
|
+
export function claimOf(obligationId, test) {
|
|
19
|
+
const location = test.location === undefined || test.location === null
|
|
20
|
+
? null
|
|
21
|
+
: { file: test.location.file, line: test.location.line, col: test.location.column };
|
|
22
|
+
return {
|
|
23
|
+
obligationId,
|
|
24
|
+
testId: test.id,
|
|
25
|
+
testFile: location === null ? '' : location.file,
|
|
26
|
+
location,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Plain-object guard for lenient state parsing. */
|
|
30
|
+
function isPlainObject(value) {
|
|
31
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
32
|
+
}
|
|
33
|
+
/** Reads a lifecycle object leniently (absent booleans → false). */
|
|
34
|
+
function lifecycleOf(value) {
|
|
35
|
+
if (typeof value !== 'object' || value === null) {
|
|
36
|
+
return { create: false, read: false, update: false, delete: false };
|
|
37
|
+
}
|
|
38
|
+
const entry = value;
|
|
39
|
+
return {
|
|
40
|
+
create: entry['create'] === true,
|
|
41
|
+
read: entry['read'] === true,
|
|
42
|
+
update: entry['update'] === true,
|
|
43
|
+
delete: entry['delete'] === true,
|
|
44
|
+
...(entry['deleteSemantics'] === 'hard' || entry['deleteSemantics'] === 'archive'
|
|
45
|
+
? { deleteSemantics: entry['deleteSemantics'] }
|
|
46
|
+
: {}),
|
|
47
|
+
...(isPlainObject(entry['archiveFields'])
|
|
48
|
+
? { archiveFields: entry['archiveFields'] }
|
|
49
|
+
: {}),
|
|
50
|
+
...(Array.isArray(entry['updateableFields'])
|
|
51
|
+
? { updateableFields: entry['updateableFields'].filter((f) => typeof f === 'string') }
|
|
52
|
+
: {}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Parses the obligations document (fail-lenient: missing → null). */
|
|
56
|
+
export function parseObligationsDocument(raw) {
|
|
57
|
+
try {
|
|
58
|
+
const parsed = JSON.parse(raw);
|
|
59
|
+
if (typeof parsed !== 'object' || parsed === null)
|
|
60
|
+
return null;
|
|
61
|
+
const entry = parsed;
|
|
62
|
+
if (!Array.isArray(entry['obligations']))
|
|
63
|
+
return null;
|
|
64
|
+
const obligations = entry['obligations'].flatMap((item) => {
|
|
65
|
+
if (typeof item !== 'object' || item === null)
|
|
66
|
+
return [];
|
|
67
|
+
const candidate = item;
|
|
68
|
+
if (typeof candidate['id'] !== 'string' || typeof candidate['contract'] !== 'string') {
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
id: candidate['id'],
|
|
74
|
+
resourceId: typeof candidate['resourceId'] === 'string' ? candidate['resourceId'] : '',
|
|
75
|
+
contract: candidate['contract'],
|
|
76
|
+
policyId: typeof candidate['policyId'] === 'string' ? candidate['policyId'] : '',
|
|
77
|
+
lifecycle: lifecycleOf(candidate['lifecycle']),
|
|
78
|
+
fingerprint: typeof candidate['fingerprint'] === 'string' ? candidate['fingerprint'] : '',
|
|
79
|
+
source: typeof candidate['source'] === 'string' ? candidate['source'] : '',
|
|
80
|
+
location: typeof candidate['location'] === 'object' && candidate['location'] !== null
|
|
81
|
+
? candidate['location']
|
|
82
|
+
: null,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
});
|
|
86
|
+
return { schemaVersion: 1, obligations };
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Computes one ledger row for a claim.
|
|
94
|
+
*
|
|
95
|
+
* Advisory only (plan §9): the reporter runs inside the suite-side
|
|
96
|
+
* runtime, so its rows can never be authoritative. HTTP rows grade
|
|
97
|
+
* against the CLI-derived route inventory when the caller supplies it;
|
|
98
|
+
* without route context the core resolver blocks with a missing-context
|
|
99
|
+
* result — the reporter never shows an authoritative pass merely
|
|
100
|
+
* because it lacked the inventory.
|
|
101
|
+
*
|
|
102
|
+
* Args:
|
|
103
|
+
* claim: the claim under judgment.
|
|
104
|
+
* obligations: the run's obligations (state doc).
|
|
105
|
+
* classifications: per-resource classification map (witness surface).
|
|
106
|
+
* records: the full run ledger.
|
|
107
|
+
* now: injected instant for the verdict engine.
|
|
108
|
+
* httpRoutes: advisory route inventory (CLI-derived `http-routes.json`
|
|
109
|
+
* when present, else null). The authoritative CLI recomputes this
|
|
110
|
+
* from source and never trusts a reporter-supplied list.
|
|
111
|
+
*
|
|
112
|
+
* Returns:
|
|
113
|
+
* LedgerRow: verdict + reason + considered record ids. `verdict:
|
|
114
|
+
* null` (with reason) when required context is missing.
|
|
115
|
+
*/
|
|
116
|
+
export function ledgerRowFor(claim, obligations, classifications, records, now, httpRoutes) {
|
|
117
|
+
if (obligations === null) {
|
|
118
|
+
return {
|
|
119
|
+
claim: claim.obligationId,
|
|
120
|
+
testId: claim.testId,
|
|
121
|
+
testFile: claim.testFile,
|
|
122
|
+
verdict: null,
|
|
123
|
+
reason: 'obligations document unavailable; per-claim verdicts need the run obligations',
|
|
124
|
+
recordIds: [],
|
|
125
|
+
trustTier: null,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const obligation = obligations.obligations.find((entry) => entry.id === claim.obligationId);
|
|
129
|
+
if (obligation === undefined) {
|
|
130
|
+
return {
|
|
131
|
+
claim: claim.obligationId,
|
|
132
|
+
testId: claim.testId,
|
|
133
|
+
testFile: claim.testFile,
|
|
134
|
+
verdict: null,
|
|
135
|
+
reason: `claim references '${claim.obligationId}' which is not in the run's obligations`,
|
|
136
|
+
recordIds: [],
|
|
137
|
+
trustTier: null,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const classification = classifications[obligation.resourceId] ?? null;
|
|
141
|
+
const engineObligation = {
|
|
142
|
+
schemaVersion: 1,
|
|
143
|
+
id: obligation.id,
|
|
144
|
+
resourceId: obligation.resourceId,
|
|
145
|
+
contract: obligation.contract,
|
|
146
|
+
policyId: obligation.policyId,
|
|
147
|
+
lifecycle: obligation.lifecycle,
|
|
148
|
+
};
|
|
149
|
+
const outcome = evaluateObligation(engineObligation, {
|
|
150
|
+
claims: [
|
|
151
|
+
{
|
|
152
|
+
schemaVersion: 1,
|
|
153
|
+
obligationId: claim.obligationId,
|
|
154
|
+
testId: claim.testId,
|
|
155
|
+
// ClaimSchema requires a non-empty optional testFile: an absent
|
|
156
|
+
// location must omit the field entirely (an emitted '' made the
|
|
157
|
+
// strict schema drop the whole claim — honest evidence then
|
|
158
|
+
// graded `missing`).
|
|
159
|
+
...(claim.testFile === '' ? {} : { testFile: claim.testFile }),
|
|
160
|
+
...(claim.location === null ? {} : { location: claim.location }),
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
records: records,
|
|
164
|
+
waivers: [],
|
|
165
|
+
classification,
|
|
166
|
+
// Advisory route context (plan §9): supplied by the caller from the
|
|
167
|
+
// CLI-derived inventory when available; null/undefined lets the
|
|
168
|
+
// core resolver return its blocking missing-context result.
|
|
169
|
+
httpRoutes: httpRoutes ?? null,
|
|
170
|
+
now,
|
|
171
|
+
});
|
|
172
|
+
const mine = records.filter((record) => record.testId === claim.testId);
|
|
173
|
+
// Provenance-aware (GF-23): a record counts as witnessed only when its
|
|
174
|
+
// recordId recomputes from its contents — the same predicate the
|
|
175
|
+
// engine applies, so the display can never disagree with the verdict.
|
|
176
|
+
const trustTier = mine.some((record) => isWitnessedRecord(record))
|
|
177
|
+
? 'witnessed'
|
|
178
|
+
: mine.length > 0
|
|
179
|
+
? 'claimed'
|
|
180
|
+
: null;
|
|
181
|
+
return {
|
|
182
|
+
claim: claim.obligationId,
|
|
183
|
+
testId: claim.testId,
|
|
184
|
+
testFile: claim.testFile,
|
|
185
|
+
verdict: outcome.verdict,
|
|
186
|
+
reason: outcome.reason,
|
|
187
|
+
recordIds: outcome.recordIds,
|
|
188
|
+
trustTier,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/** Blocks the run? (satisfied/waived are clean.) */
|
|
192
|
+
export function isBlocking(verdict) {
|
|
193
|
+
return (verdict !== null &&
|
|
194
|
+
verdict !== 'satisfied' &&
|
|
195
|
+
verdict !== 'waived');
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../src/reporter/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAKlB,MAAM,kBAAkB,CAAC;AAgD1B,mEAAmE;AACnE,MAAM,UAAU,OAAO,CACrB,YAAoB,EACpB,IAAsF;IAEtF,MAAM,QAAQ,GACZ,IAAI,CAAC,QAAQ,KAAK,SAAS,IAA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D,OAAO,CACL,OAAO,KAAK,IAAI;QAChB,OAAO,KAAK,WAAW;QACvB,OAAO,KAAK,QAAQ,CACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CommonJS entry for `@gate-forge/pack-playwright/reporter` (the
|
|
4
|
+
* `require` export condition; compiled from this `.cts` to
|
|
5
|
+
* `dist/reporter/reporter.cjs`).
|
|
6
|
+
*
|
|
7
|
+
* WHY a shim and not a compiled CJS build: the pack AND its dependency
|
|
8
|
+
* `@gate-forge/core` are ESM-only (`"type": "module"`), so no CJS
|
|
9
|
+
* compilation of the reporter can `require()` the engine on every
|
|
10
|
+
* supported Node runtime. What CJS consumers actually need is a
|
|
11
|
+
* constructor: Playwright resolves custom reporters with
|
|
12
|
+
* `require.resolve('@gate-forge/pack-playwright/reporter')` (which needs
|
|
13
|
+
* this condition to exist — without it CJS playwright configs died with
|
|
14
|
+
* ERR_PACKAGE_PATH_NOT_EXPORTED) and then loads the resolved file with
|
|
15
|
+
* require-or-import. Plain `require()` gets THIS module: a class whose
|
|
16
|
+
* constructor synchronously returns while the ESM implementation loads
|
|
17
|
+
* in the background. EVERY runner callback is forwarded (buffered until
|
|
18
|
+
* the implementation arrives, in call order): `onTestBegin` is the
|
|
19
|
+
* trusted-supervisor session open (plan Phase 1) — dropping it would
|
|
20
|
+
* silently strip every test of its witness session and fail all
|
|
21
|
+
* evidence primitives; `onTestEnd` seals claims + the supervision
|
|
22
|
+
* outcome row; `onEnd` is awaited by the runner, so it can wait for the
|
|
23
|
+
* load and fails closed if the implementation never loads (evidence is
|
|
24
|
+
* never silently dropped).
|
|
25
|
+
*
|
|
26
|
+
* Supported syntaxes (both ESM and CJS playwright configs):
|
|
27
|
+
*
|
|
28
|
+
* reporter: [['@gate-forge/pack-playwright/reporter']]
|
|
29
|
+
*
|
|
30
|
+
* and from any CJS script:
|
|
31
|
+
*
|
|
32
|
+
* const GateforgeReporter =
|
|
33
|
+
* require('@gate-forge/pack-playwright/reporter');
|
|
34
|
+
*/
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
class GateforgeReporterCjs {
|
|
37
|
+
options;
|
|
38
|
+
buffered = [];
|
|
39
|
+
implementation = null;
|
|
40
|
+
loadError = null;
|
|
41
|
+
ready;
|
|
42
|
+
constructor(options = {}) {
|
|
43
|
+
this.options = options;
|
|
44
|
+
this.ready = import('./reporter.js').then((module) => {
|
|
45
|
+
const implementation = new module.GateforgeReporter(this.options);
|
|
46
|
+
this.implementation = implementation;
|
|
47
|
+
const buffered = this.buffered.splice(0, this.buffered.length);
|
|
48
|
+
for (const [name, args] of buffered) {
|
|
49
|
+
this.dispatch(implementation, name, args);
|
|
50
|
+
}
|
|
51
|
+
}, (error) => {
|
|
52
|
+
this.loadError = error instanceof Error ? error : new Error(String(error));
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/** Runner callback (synchronous): buffered until the impl arrives. */
|
|
56
|
+
onTestBegin(test, result) {
|
|
57
|
+
this.forward('onTestBegin', [test, result]);
|
|
58
|
+
}
|
|
59
|
+
/** Runner callback (synchronous): buffered until the impl arrives. */
|
|
60
|
+
onTestEnd(test, result) {
|
|
61
|
+
this.forward('onTestEnd', [test, result]);
|
|
62
|
+
}
|
|
63
|
+
/** Runner callback (synchronous): buffered until the impl arrives. */
|
|
64
|
+
onError(error) {
|
|
65
|
+
this.forward('onError', [error]);
|
|
66
|
+
}
|
|
67
|
+
/** Runner callback (awaited): waits for the load, then delegates.
|
|
68
|
+
* The FullResult argument MUST be forwarded — it is the only source
|
|
69
|
+
* of the final run status the supervisor reads from the outcomes
|
|
70
|
+
* document (dropping it fails every supervised run as 'unknown'). */
|
|
71
|
+
async onEnd(result) {
|
|
72
|
+
await this.ready;
|
|
73
|
+
if (this.implementation === null) {
|
|
74
|
+
throw (this.loadError ??
|
|
75
|
+
new Error('gateforge reporter implementation failed to load (no error reported)'));
|
|
76
|
+
}
|
|
77
|
+
return this.implementation.onEnd(result);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Buffers or dispatches one runner callback. Order is preserved: the
|
|
81
|
+
* implementation replays the buffer in arrival order exactly once,
|
|
82
|
+
* and post-load calls dispatch straight through.
|
|
83
|
+
*/
|
|
84
|
+
forward(name, args) {
|
|
85
|
+
if (this.implementation !== null) {
|
|
86
|
+
this.dispatch(this.implementation, name, args);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
this.buffered.push([name, args]);
|
|
90
|
+
}
|
|
91
|
+
dispatch(implementation, name, args) {
|
|
92
|
+
const method = implementation[name];
|
|
93
|
+
if (typeof method !== 'function') {
|
|
94
|
+
throw new Error(`gateforge reporter implementation has no ${name} method`);
|
|
95
|
+
}
|
|
96
|
+
void method.apply(implementation, args);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Playwright expects the constructor itself (require-or-import default
|
|
100
|
+
// resolution); the named/default aliases cover destructuring consumers.
|
|
101
|
+
module.exports = GateforgeReporterCjs;
|
|
102
|
+
module.exports['GateforgeReporter'] =
|
|
103
|
+
GateforgeReporterCjs;
|
|
104
|
+
module.exports['default'] = GateforgeReporterCjs;
|
|
105
|
+
//# sourceMappingURL=reporter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.cjs","sourceRoot":"","sources":["../../src/reporter/reporter.cts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;AAuBH,MAAM,oBAAoB;IACP,OAAO,CAA0B;IACjC,QAAQ,GAA2C,EAAE,CAAC;IAC/D,cAAc,GAA2C,IAAI,CAAC;IAC9D,SAAS,GAAiB,IAAI,CAAC;IACtB,KAAK,CAAgB;IAEtC,YAAY,UAAmC,EAAE;QAC/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,eAAe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AE,CAAC;YACjC,MAAM,CACJ,IAAI,CAAC,SAAS;gBACd,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAClF,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACK,OAAO,CAAC,IAAuB,EAAE,IAAe;QACtD,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YAC/C,OAAO;QACT,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACnC,CAAC;IAEO,QAAQ,CACd,cAA+C,EAC/C,IAAY,EACZ,IAAe;QAEf,MAAM,MAAM,GAAI,cAAgE,CAAC,IAAI,CAAC,CAAC;QACvF,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,4CAA4C,IAAI,SAAS,CAAC,CAAC;QAC7E,CAAC;QACD,KAAK,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF;AAED,uEAAuE;AACvE,wEAAwE;AACxE,MAAM,CAAC,OAAO,GAAG,oBAAoB,CAAC;AACrC,MAAM,CAAC,OAA8C,CAAC,mBAAmB,CAAC;IACzE,oBAAoB,CAAC;AACtB,MAAM,CAAC,OAA8C,CAAC,SAAS,CAAC,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CommonJS entry for `@gate-forge/pack-playwright/reporter` (the
|
|
3
|
+
* `require` export condition; compiled from this `.cts` to
|
|
4
|
+
* `dist/reporter/reporter.cjs`).
|
|
5
|
+
*
|
|
6
|
+
* WHY a shim and not a compiled CJS build: the pack AND its dependency
|
|
7
|
+
* `@gate-forge/core` are ESM-only (`"type": "module"`), so no CJS
|
|
8
|
+
* compilation of the reporter can `require()` the engine on every
|
|
9
|
+
* supported Node runtime. What CJS consumers actually need is a
|
|
10
|
+
* constructor: Playwright resolves custom reporters with
|
|
11
|
+
* `require.resolve('@gate-forge/pack-playwright/reporter')` (which needs
|
|
12
|
+
* this condition to exist — without it CJS playwright configs died with
|
|
13
|
+
* ERR_PACKAGE_PATH_NOT_EXPORTED) and then loads the resolved file with
|
|
14
|
+
* require-or-import. Plain `require()` gets THIS module: a class whose
|
|
15
|
+
* constructor synchronously returns while the ESM implementation loads
|
|
16
|
+
* in the background. EVERY runner callback is forwarded (buffered until
|
|
17
|
+
* the implementation arrives, in call order): `onTestBegin` is the
|
|
18
|
+
* trusted-supervisor session open (plan Phase 1) — dropping it would
|
|
19
|
+
* silently strip every test of its witness session and fail all
|
|
20
|
+
* evidence primitives; `onTestEnd` seals claims + the supervision
|
|
21
|
+
* outcome row; `onEnd` is awaited by the runner, so it can wait for the
|
|
22
|
+
* load and fails closed if the implementation never loads (evidence is
|
|
23
|
+
* never silently dropped).
|
|
24
|
+
*
|
|
25
|
+
* Supported syntaxes (both ESM and CJS playwright configs):
|
|
26
|
+
*
|
|
27
|
+
* reporter: [['@gate-forge/pack-playwright/reporter']]
|
|
28
|
+
*
|
|
29
|
+
* and from any CJS script:
|
|
30
|
+
*
|
|
31
|
+
* const GateforgeReporter =
|
|
32
|
+
* require('@gate-forge/pack-playwright/reporter');
|
|
33
|
+
*/
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=reporter.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.d.cts","sourceRoot":"","sources":["../../src/reporter/reporter.cts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { type LedgerRow } from './ledger.js';
|
|
2
|
+
/** Minimal reporter-side test shape (Playwright's TestCase in practice). */
|
|
3
|
+
export interface ReporterTest {
|
|
4
|
+
id: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
titlePath?: () => string[];
|
|
7
|
+
annotations?: Array<{
|
|
8
|
+
type: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
}>;
|
|
11
|
+
location?: {
|
|
12
|
+
file: string;
|
|
13
|
+
line: number;
|
|
14
|
+
column: number;
|
|
15
|
+
};
|
|
16
|
+
/** Project name when the runner exposes it (best effort). */
|
|
17
|
+
project?: {
|
|
18
|
+
name?: string;
|
|
19
|
+
} | null;
|
|
20
|
+
/**
|
|
21
|
+
* The enclosing suite (playwright's reporter hierarchy
|
|
22
|
+
* root → project → file → describe), when the runner exposes it —
|
|
23
|
+
* the describe-stack source for the catalog-identity title path.
|
|
24
|
+
*/
|
|
25
|
+
parent?: ReporterSuiteLike | null;
|
|
26
|
+
}
|
|
27
|
+
/** Structural subset of the runner's suite node (see {@link ReporterTest}). */
|
|
28
|
+
export interface ReporterSuiteLike {
|
|
29
|
+
/** Suite title ('' for root, project-less, and file suites). */
|
|
30
|
+
title?: string;
|
|
31
|
+
/** Source location; MISSING for root and project suites. */
|
|
32
|
+
location?: {
|
|
33
|
+
file: string;
|
|
34
|
+
line: number;
|
|
35
|
+
column: number;
|
|
36
|
+
} | null;
|
|
37
|
+
/** Suite kind when the runner exposes it (`root`/`project`/`file`/`describe`). */
|
|
38
|
+
type?: 'root' | 'project' | 'file' | 'describe';
|
|
39
|
+
parent?: ReporterSuiteLike | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Computes the honest aggregate line (plan Phase 4 item 7, §2 row): the
|
|
43
|
+
* reporter NEVER prints an overall gate pass based only on claimed rows
|
|
44
|
+
* while unclaimed obligations block. Pure and deterministic — exported
|
|
45
|
+
* so the honesty contract is directly testable.
|
|
46
|
+
*
|
|
47
|
+
* Args:
|
|
48
|
+
* rows: the per-claim ledger rows.
|
|
49
|
+
* unclaimedObligations: count of run obligations with no claim row.
|
|
50
|
+
*
|
|
51
|
+
* Returns:
|
|
52
|
+
* string: the aggregate summary line.
|
|
53
|
+
*/
|
|
54
|
+
export declare function gateSummaryLine(rows: readonly LedgerRow[], unclaimedObligations: number): string;
|
|
55
|
+
/** Constructor options for the gateforge reporter (trusted-config path). */
|
|
56
|
+
export interface GateforgeReporterOptions {
|
|
57
|
+
/** Run-state dir override (precedence over GATEFORGE_STATE_DIR env). */
|
|
58
|
+
stateDir?: string;
|
|
59
|
+
/** Run id override (precedence over GATEFORGE_RUN_ID env). */
|
|
60
|
+
runId?: string;
|
|
61
|
+
/** Runner-outcomes path override (precedence over GATEFORGE_OUTCOMES_FILE env). */
|
|
62
|
+
outcomesPath?: string;
|
|
63
|
+
/** Obligations document path override (precedence over GATEFORGE_OBLIGATIONS env). */
|
|
64
|
+
obligationsPath?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The gateforge reporter. No options today; the constructor signature is
|
|
68
|
+
* the Playwright reporter contract (`(options: object)`).
|
|
69
|
+
*/
|
|
70
|
+
export declare class GateforgeReporter {
|
|
71
|
+
private readonly rows;
|
|
72
|
+
/**
|
|
73
|
+
* Phase 4 claim injections (reconciliation key → obligation ids),
|
|
74
|
+
* loaded once from the CLI-written run-state document. Declarations
|
|
75
|
+
* only — they never satisfy anything by themselves.
|
|
76
|
+
*/
|
|
77
|
+
private readonly injections;
|
|
78
|
+
/** Phase 4 runner-outcome capture (supervision input, ADR 0005 D2). */
|
|
79
|
+
private readonly runnerOutcomes;
|
|
80
|
+
private runStatus;
|
|
81
|
+
private readonly runnerErrors;
|
|
82
|
+
/** The lifecycle spool file (null when the run has no state dir). */
|
|
83
|
+
private readonly spoolFile;
|
|
84
|
+
/** Resolved run-state paths (options win, env is the legacy fallback). */
|
|
85
|
+
private readonly resolved;
|
|
86
|
+
constructor(options?: GateforgeReporterOptions);
|
|
87
|
+
/**
|
|
88
|
+
* Lifecycle spool write (enforcement-review fix 3): announces the
|
|
89
|
+
* STARTED test to the trusted CLI's drain — which opens the witness
|
|
90
|
+
* session on the supervisor channel, carrying the mapped obligation
|
|
91
|
+
* claims for sidecar/native-mapped tests (Phase 4 claim injection) —
|
|
92
|
+
* and binds worker → session there. The runner itself performs no
|
|
93
|
+
* privileged call. Synchronous API: the CLI's poll cadence absorbs
|
|
94
|
+
* the dispatch latency (the fixture's session resolve waits up to 5s).
|
|
95
|
+
*/
|
|
96
|
+
onTestBegin(test: ReporterTest, result: {
|
|
97
|
+
workerIndex?: number;
|
|
98
|
+
}): void;
|
|
99
|
+
/** Runner-level error hook: a global setup/teardown/runner error. */
|
|
100
|
+
onError(error: {
|
|
101
|
+
message?: string;
|
|
102
|
+
}): void;
|
|
103
|
+
/** Collects claims + test identity + the outcome row at test end (synchronous). */
|
|
104
|
+
onTestEnd(test: ReporterTest, result: {
|
|
105
|
+
status: string;
|
|
106
|
+
workerIndex?: number;
|
|
107
|
+
retry?: number;
|
|
108
|
+
}): void;
|
|
109
|
+
/** Playswright `onEnd`: seal the run-level outcome + write artifacts. */
|
|
110
|
+
onEnd(result?: {
|
|
111
|
+
status?: string;
|
|
112
|
+
}): Promise<void>;
|
|
113
|
+
/** Full title path of a test (runner API when present, else [title]). */
|
|
114
|
+
/**
|
|
115
|
+
* The catalog-identity title path: describe titles + the test title —
|
|
116
|
+
* NOT the runner's full path. Playwright's suite hierarchy is
|
|
117
|
+
* root → project → file → describe; identity joins (supervision,
|
|
118
|
+
* claim injections) use the SAME shape the native `--list` enumeration
|
|
119
|
+
* reports (describes + title), so the root/project/file suites are
|
|
120
|
+
* stripped here — by suite `type` when exposed, else by the location
|
|
121
|
+
* heuristic (root/project suites carry no source location; the file
|
|
122
|
+
* suite is the outermost suite that does). A project name or file name
|
|
123
|
+
* must never leak into the identity. Without a parent chain, the bare
|
|
124
|
+
* title keeps the row visible (never misjoined).
|
|
125
|
+
*/
|
|
126
|
+
private titlePathOf;
|
|
127
|
+
/**
|
|
128
|
+
* The runner project name for the supervision identity: the
|
|
129
|
+
* `project`-typed ancestor's title (reporter-API `TestCase` carries no
|
|
130
|
+
* `project` member), else the first location-less ancestor, else the
|
|
131
|
+
* runner-provided `project.name` best-effort. Absence stays `null` —
|
|
132
|
+
* never a fabricated project.
|
|
133
|
+
*/
|
|
134
|
+
private projectOf;
|
|
135
|
+
/**
|
|
136
|
+
* Whether this suite is at or above the describe level (root, project,
|
|
137
|
+
* or the file suite itself) — walking must stop here. By `type` when
|
|
138
|
+
* exposed; otherwise the file suite is the OUTERMOST suite with a
|
|
139
|
+
* source location (its parent is root/project or absent).
|
|
140
|
+
*/
|
|
141
|
+
private isDescribeBoundary;
|
|
142
|
+
/** Repo-relative posix file of a test (null when unknown). */
|
|
143
|
+
private repoRelativeOf;
|
|
144
|
+
/** Native annotation claims of one test (`{type: 'gateforge'}`). */
|
|
145
|
+
private annotationClaimsOf;
|
|
146
|
+
/** Injection-key lookup for one test: `<file>#<titlePath.join('>')>`. */
|
|
147
|
+
private injectedClaimsFor;
|
|
148
|
+
/** Writes the runner-outcomes document when the supervisor asked for it. */
|
|
149
|
+
private writeRunnerOutcomes;
|
|
150
|
+
/** The witness classification projection (real lifecycle + primaryKey). */
|
|
151
|
+
private fetchClassifications;
|
|
152
|
+
private ledgerRows;
|
|
153
|
+
/** Deterministic instant: the run manifest's injected `startedAt`. */
|
|
154
|
+
private runInstant;
|
|
155
|
+
/**
|
|
156
|
+
* Prints the per-claim verdict ledger + the HONEST aggregate line
|
|
157
|
+
* (plan Phase 4 item 7): never an overall pass while unclaimed
|
|
158
|
+
* obligations block; the authoritative CLI remains the only final
|
|
159
|
+
* gate result.
|
|
160
|
+
*/
|
|
161
|
+
private printLedger;
|
|
162
|
+
/** GF-24 observability: obligations nobody claimed + records nobody claimed. */
|
|
163
|
+
private printRegistryMismatches;
|
|
164
|
+
}
|
|
165
|
+
export default GateforgeReporter;
|
|
166
|
+
export type { LedgerRow };
|
|
167
|
+
//# sourceMapping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