@orkestrel/capture 0.0.4 → 0.0.6
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 +10 -8
- package/dist/src/core/index.cjs +2 -1
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +4 -1
- package/dist/src/core/index.d.ts +4 -1
- package/dist/src/core/index.js +2 -1
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +123 -86
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +40 -17
- package/dist/src/server/index.d.ts +40 -17
- package/dist/src/server/index.js +123 -86
- package/dist/src/server/index.js.map +1 -1
- package/package.json +6 -6
package/dist/src/server/index.js
CHANGED
|
@@ -97,7 +97,8 @@ var CAPTURE_COMMAND_OPTIONS = Object.freeze({
|
|
|
97
97
|
}),
|
|
98
98
|
case: Object.freeze({ type: "string" }),
|
|
99
99
|
changed: Object.freeze({ type: "string" }),
|
|
100
|
-
plan: Object.freeze({ type: "boolean" })
|
|
100
|
+
plan: Object.freeze({ type: "boolean" }),
|
|
101
|
+
mode: Object.freeze({ type: "string" })
|
|
101
102
|
}),
|
|
102
103
|
capture: Object.freeze({
|
|
103
104
|
config: Object.freeze({ type: "string" }),
|
|
@@ -108,7 +109,8 @@ var CAPTURE_COMMAND_OPTIONS = Object.freeze({
|
|
|
108
109
|
case: Object.freeze({ type: "string" }),
|
|
109
110
|
state: Object.freeze({ type: "string" }),
|
|
110
111
|
changed: Object.freeze({ type: "string" }),
|
|
111
|
-
plan: Object.freeze({ type: "boolean" })
|
|
112
|
+
plan: Object.freeze({ type: "boolean" }),
|
|
113
|
+
mode: Object.freeze({ type: "string" })
|
|
112
114
|
}),
|
|
113
115
|
stale: Object.freeze({
|
|
114
116
|
config: Object.freeze({ type: "string" }),
|
|
@@ -118,7 +120,8 @@ var CAPTURE_COMMAND_OPTIONS = Object.freeze({
|
|
|
118
120
|
}),
|
|
119
121
|
case: Object.freeze({ type: "string" }),
|
|
120
122
|
state: Object.freeze({ type: "string" }),
|
|
121
|
-
portfolio: Object.freeze({ type: "string" })
|
|
123
|
+
portfolio: Object.freeze({ type: "string" }),
|
|
124
|
+
mode: Object.freeze({ type: "string" })
|
|
122
125
|
}),
|
|
123
126
|
preflight: Object.freeze({
|
|
124
127
|
variant: Object.freeze({
|
|
@@ -130,7 +133,8 @@ var CAPTURE_COMMAND_OPTIONS = Object.freeze({
|
|
|
130
133
|
portfolio: Object.freeze({ type: "string" }),
|
|
131
134
|
config: Object.freeze({ type: "string" }),
|
|
132
135
|
journeys: Object.freeze({ type: "string" }),
|
|
133
|
-
checks: Object.freeze({ type: "string" })
|
|
136
|
+
checks: Object.freeze({ type: "string" }),
|
|
137
|
+
mode: Object.freeze({ type: "string" })
|
|
134
138
|
}),
|
|
135
139
|
sheets: Object.freeze({
|
|
136
140
|
variant: Object.freeze({
|
|
@@ -143,6 +147,7 @@ var CAPTURE_COMMAND_OPTIONS = Object.freeze({
|
|
|
143
147
|
config: Object.freeze({ type: "string" }),
|
|
144
148
|
journeys: Object.freeze({ type: "string" }),
|
|
145
149
|
checks: Object.freeze({ type: "string" }),
|
|
150
|
+
mode: Object.freeze({ type: "string" }),
|
|
146
151
|
output: Object.freeze({ type: "string" })
|
|
147
152
|
}),
|
|
148
153
|
registry: Object.freeze({
|
|
@@ -311,11 +316,11 @@ var CAPTURE_SHEET_FILES = Object.freeze({
|
|
|
311
316
|
notes: "index.md"
|
|
312
317
|
});
|
|
313
318
|
/**
|
|
314
|
-
* Names the stage
|
|
319
|
+
* Names the one stage a registry refresh runs every selected producing variant's complete journey in.
|
|
315
320
|
*
|
|
316
321
|
* @example
|
|
317
322
|
* ```ts
|
|
318
|
-
*
|
|
323
|
+
* `runs/${id}/${CAPTURE_REGISTRY_STAGE}/light-390.json` // 'runs/<id>/registry/light-390.json'
|
|
319
324
|
* ```
|
|
320
325
|
*/
|
|
321
326
|
var CAPTURE_REGISTRY_STAGE = "registry";
|
|
@@ -413,13 +418,13 @@ var CAPTURE_DISCOVERY = Object.freeze({
|
|
|
413
418
|
var CAPTURE_USAGE = [
|
|
414
419
|
"Usage: capture <command> [arguments]",
|
|
415
420
|
"Commands:",
|
|
416
|
-
" journey <selector> [--variant <name>]... [--case <full name>] [--config <file>]",
|
|
417
|
-
" journey --changed <ref> [--plan] [--variant <name>]... [--case <full name>] [--config <file>]",
|
|
418
|
-
" frames <selector> [--variant <name>]... [--case <full name>] [--state <name>] [--config <file>]",
|
|
419
|
-
" frames --changed <ref> [--plan] [--variant <name>]... [--case <full name>] [--state <name>] [--config <file>]",
|
|
420
|
-
" stale <selector> [--variant <name>]... [--case <full name>] [--state <name>] [--portfolio <name>] [--config <file>]",
|
|
421
|
-
" preflight <selector> [--variant <name>]... [--state <name>] [--case <full name>] [--portfolio <name>] [--config <file>] [--journeys <directory>] [--checks <module>]",
|
|
422
|
-
" sheets <selector> --output <new directory> [--variant <name>]... [--state <name>] [--case <full name>] [--portfolio <name>] [--config <file>] [--journeys <directory>] [--checks <module>]",
|
|
421
|
+
" journey <selector> [--variant <name>]... [--case <full name>] [--mode <name>] [--config <file>]",
|
|
422
|
+
" journey --changed <ref> [--plan] [--variant <name>]... [--case <full name>] [--mode <name>] [--config <file>]",
|
|
423
|
+
" frames <selector> [--variant <name>]... [--case <full name>] [--state <name>] [--mode <name>] [--config <file>]",
|
|
424
|
+
" frames --changed <ref> [--plan] [--variant <name>]... [--case <full name>] [--state <name>] [--mode <name>] [--config <file>]",
|
|
425
|
+
" stale <selector> [--variant <name>]... [--case <full name>] [--state <name>] [--portfolio <name>] [--mode <name>] [--config <file>]",
|
|
426
|
+
" preflight <selector> [--variant <name>]... [--state <name>] [--case <full name>] [--portfolio <name>] [--mode <name>] [--config <file>] [--journeys <directory>] [--checks <module>]",
|
|
427
|
+
" sheets <selector> --output <new directory> [--variant <name>]... [--state <name>] [--case <full name>] [--portfolio <name>] [--mode <name>] [--config <file>] [--journeys <directory>] [--checks <module>]",
|
|
423
428
|
" registry [--variant <name>]... [--mode <name>] [--config <file>]",
|
|
424
429
|
"--changed takes one Git ref; HEAD selects uncommitted work. It cannot accompany a selector.",
|
|
425
430
|
"--plan requires --changed and prints paths and commands after read-only discovery; no execution child starts.",
|
|
@@ -495,6 +500,7 @@ function renderCaptureCommand(command, parsed, selector, root) {
|
|
|
495
500
|
command === "registry" ? command : CAPTURE_COMMAND_NAMES[command],
|
|
496
501
|
...selector === void 0 ? [] : [selector],
|
|
497
502
|
...parsed.variants.flatMap((variant) => ["--variant", variant]),
|
|
503
|
+
...parsed.mode === void 0 ? [] : ["--mode", parsed.mode],
|
|
498
504
|
...parsed.case === void 0 ? [] : parsed.case.startsWith("-") ? [`--case=${parsed.case}`] : ["--case", parsed.case],
|
|
499
505
|
...parsed.state === void 0 ? [] : ["--state", parsed.state],
|
|
500
506
|
...config.startsWith("-") ? [`--config=${config}`] : ["--config", config]
|
|
@@ -1372,7 +1378,7 @@ function buildCaptureArguments(options) {
|
|
|
1372
1378
|
"run",
|
|
1373
1379
|
"--config",
|
|
1374
1380
|
options.config,
|
|
1375
|
-
...options.mode === void 0 ? [] : ["--mode", options.mode],
|
|
1381
|
+
...options.mode === void 0 ? [] : options.mode.startsWith("-") ? [`--mode=${options.mode}`] : ["--mode", options.mode],
|
|
1376
1382
|
"--configLoader",
|
|
1377
1383
|
"runner",
|
|
1378
1384
|
"--no-cache",
|
|
@@ -1510,6 +1516,7 @@ function readCaptureArguments(argv, command, root, fallback) {
|
|
|
1510
1516
|
const state = "state" in values && typeof values.state === "string" ? values.state : void 0;
|
|
1511
1517
|
if (state !== void 0 && !isCaptureSegment(state)) throw new CaptureError(`Invalid state identity; ${describeCaptureFault("--state", state, "a portable nonempty state identity; valid values come from the selected case's state declarations")}`, { code: "USAGE" });
|
|
1512
1518
|
const name = values.case;
|
|
1519
|
+
const mode = values.mode;
|
|
1513
1520
|
if (name !== void 0 && name.trim() === "") throw new CaptureError("Empty case name", { code: "USAGE" });
|
|
1514
1521
|
const portfolio = "portfolio" in values && typeof values.portfolio === "string" ? values.portfolio : void 0;
|
|
1515
1522
|
const selector = positional.at(0);
|
|
@@ -1522,6 +1529,7 @@ function readCaptureArguments(argv, command, root, fallback) {
|
|
|
1522
1529
|
...changed === void 0 ? {} : { changed },
|
|
1523
1530
|
...plan ? { plan: true } : {},
|
|
1524
1531
|
config: resolve(root, values.config ?? fallback),
|
|
1532
|
+
...mode === void 0 ? {} : { mode },
|
|
1525
1533
|
variants,
|
|
1526
1534
|
...name === void 0 ? {} : { case: name },
|
|
1527
1535
|
...state === void 0 ? {} : { state },
|
|
@@ -1782,6 +1790,7 @@ function readCaptureRequest(options) {
|
|
|
1782
1790
|
if (parsed.version !== 1) throw new CaptureError("Journey selection request has invalid version", { code: "HOST" });
|
|
1783
1791
|
if (!isCaptureSegment(parsed.id) || !isCaptureSegment(parsed.stage)) throw new CaptureError("Journey selection request has invalid identity", { code: "HOST" });
|
|
1784
1792
|
if (parsed.config !== options.config) throw new CaptureError("Journey selection request has invalid config", { code: "HOST" });
|
|
1793
|
+
if (parsed.mode !== void 0 && (typeof parsed.mode !== "string" || parsed.mode.trim() === "")) throw new CaptureError("Journey selection request has invalid mode", { code: "HOST" });
|
|
1785
1794
|
const command = parsed.command === "journey" || parsed.command === "capture" ? parsed.command : void 0;
|
|
1786
1795
|
if (parsed.state !== void 0 && (typeof parsed.state !== "string" || parsed.state.trim() === "" || command !== "capture")) throw new CaptureError("Journey selection request has invalid state", { code: "HOST" });
|
|
1787
1796
|
const selector = typeof parsed.selector === "string" ? parsed.selector : void 0;
|
|
@@ -1794,6 +1803,7 @@ function readCaptureRequest(options) {
|
|
|
1794
1803
|
config: options.config,
|
|
1795
1804
|
pid: options.ppid,
|
|
1796
1805
|
command,
|
|
1806
|
+
...typeof parsed.mode === "string" ? { mode: parsed.mode } : {},
|
|
1797
1807
|
selector,
|
|
1798
1808
|
...typeof parsed.case === "string" ? { case: parsed.case } : {},
|
|
1799
1809
|
variants,
|
|
@@ -1807,7 +1817,7 @@ function readCaptureRequest(options) {
|
|
|
1807
1817
|
* @remarks
|
|
1808
1818
|
* The first argument is the selector and every flag after it takes one nonempty value, separated
|
|
1809
1819
|
* or in equals form. Only `--variant` repeats. `--output` belongs to sheets; the preflight option
|
|
1810
|
-
* table refuses it before discovery. The wrapper, the journey artifact directory, and the checks module
|
|
1820
|
+
* table refuses it before discovery. `--mode` selects the wrapper's Vitest mode. The wrapper, the journey artifact directory, and the checks module
|
|
1811
1821
|
* resolve against `root`; `defaults` supplies the first two when the command line names neither.
|
|
1812
1822
|
*
|
|
1813
1823
|
* @param argv - The arguments after the entry name
|
|
@@ -1837,10 +1847,12 @@ function readCaptureReaderArguments(argv, root, defaults, command = "sheets") {
|
|
|
1837
1847
|
const portfolio = values.portfolio;
|
|
1838
1848
|
const checks = values.checks;
|
|
1839
1849
|
const output = "output" in values && typeof values.output === "string" ? values.output : void 0;
|
|
1850
|
+
const mode = values.mode;
|
|
1840
1851
|
return {
|
|
1841
1852
|
reader: {
|
|
1842
1853
|
root: resolve(root),
|
|
1843
1854
|
config: resolve(root, values.config ?? defaults.config),
|
|
1855
|
+
...mode === void 0 ? {} : { mode },
|
|
1844
1856
|
journeys: resolve(root, values.journeys ?? defaults.journeys),
|
|
1845
1857
|
selection: {
|
|
1846
1858
|
selector,
|
|
@@ -2002,8 +2014,8 @@ function readCaptureRunning(pid) {
|
|
|
2002
2014
|
* Resolves one entry of a wrapper's project list to the project it declares.
|
|
2003
2015
|
*
|
|
2004
2016
|
* @remarks
|
|
2005
|
-
* A factory entry is called with the serve command and the
|
|
2006
|
-
* promise is awaited. The result is the project as plain data
|
|
2017
|
+
* A factory entry is called with the serve command and the requested mode, or the default test
|
|
2018
|
+
* mode, as Vitest calls it, and a promise is awaited. The result is the project as plain data: the runner reads
|
|
2007
2019
|
* and validates it, so one reader owns every refusal.
|
|
2008
2020
|
*
|
|
2009
2021
|
* @param input - The entry as the wrapper declared it: an inline project, a promise of one, or a factory
|
|
@@ -2014,10 +2026,10 @@ function readCaptureRunning(pid) {
|
|
|
2014
2026
|
* const project = await resolveCaptureWrapperProject(wrapper.test.projects[0])
|
|
2015
2027
|
* ```
|
|
2016
2028
|
*/
|
|
2017
|
-
async function resolveCaptureWrapperProject(input) {
|
|
2029
|
+
async function resolveCaptureWrapperProject(input, mode = "test") {
|
|
2018
2030
|
return isFunction(input) ? await input({
|
|
2019
2031
|
command: "serve",
|
|
2020
|
-
mode
|
|
2032
|
+
mode
|
|
2021
2033
|
}) : await input;
|
|
2022
2034
|
}
|
|
2023
2035
|
/**
|
|
@@ -2180,13 +2192,15 @@ async function answerCaptureDiscovery(options) {
|
|
|
2180
2192
|
if (parsed.version !== CAPTURE_VERSION) throw new CaptureError("Discovery request has invalid version", { code: "HOST" });
|
|
2181
2193
|
if (!isCaptureSegment(parsed.id) || !isCaptureSegment(parsed.nonce)) throw new CaptureError("Discovery request has invalid identity", { code: "HOST" });
|
|
2182
2194
|
if (parsed.config !== options.config) throw new CaptureError("Discovery request has invalid config", { code: "HOST" });
|
|
2195
|
+
if (parsed.mode !== void 0 && (typeof parsed.mode !== "string" || parsed.mode.trim() === "")) throw new CaptureError("Discovery request has invalid mode", { code: "HOST" });
|
|
2183
2196
|
const answer = resolve(directory, CAPTURE_RUNS_DIRECTORY, parsed.id, CAPTURE_DISCOVERY.description);
|
|
2184
2197
|
const prior = existsSync(answer) ? parseJSON(readFileSync(answer, "utf8")) : void 0;
|
|
2185
2198
|
if (prior !== void 0 && !(isRecord(prior) && prior.pid === process.pid)) throw new CaptureError(`Discovery was already answered for this request: ${file}`, {
|
|
2186
2199
|
code: "HOST",
|
|
2187
2200
|
context: { file }
|
|
2188
2201
|
});
|
|
2189
|
-
const
|
|
2202
|
+
const mode = typeof parsed.mode === "string" ? parsed.mode : void 0;
|
|
2203
|
+
const projects = await Promise.all(options.projects.map((input) => resolveCaptureWrapperProject(input, mode)));
|
|
2190
2204
|
writeCaptureDocument(answer, {
|
|
2191
2205
|
version: CAPTURE_VERSION,
|
|
2192
2206
|
id: parsed.id,
|
|
@@ -2346,7 +2360,7 @@ var CaptureDiscovery = class {
|
|
|
2346
2360
|
...CAPTURE_DISCOVERY.arguments,
|
|
2347
2361
|
"--config",
|
|
2348
2362
|
resolve(root, config),
|
|
2349
|
-
...mode === void 0 ? [] : ["--mode", mode],
|
|
2363
|
+
...mode === void 0 ? [] : mode.startsWith("-") ? [`--mode=${mode}`] : ["--mode", mode],
|
|
2350
2364
|
"--configLoader",
|
|
2351
2365
|
"runner"
|
|
2352
2366
|
];
|
|
@@ -2356,6 +2370,7 @@ var CaptureDiscovery = class {
|
|
|
2356
2370
|
id: invocation.id,
|
|
2357
2371
|
nonce,
|
|
2358
2372
|
config: relative,
|
|
2373
|
+
...mode === void 0 ? {} : { mode },
|
|
2359
2374
|
pid: process.pid,
|
|
2360
2375
|
args
|
|
2361
2376
|
};
|
|
@@ -3908,7 +3923,7 @@ var CapturePreflight = class {
|
|
|
3908
3923
|
}
|
|
3909
3924
|
}
|
|
3910
3925
|
async #load(config, invocation) {
|
|
3911
|
-
const { root, deadline } = this.#options;
|
|
3926
|
+
const { root, deadline, mode } = this.#options;
|
|
3912
3927
|
invocation.prepare();
|
|
3913
3928
|
requireCaptureArgument(root, resolve(root, this.#options.journeys), "--journeys");
|
|
3914
3929
|
if (this.#options.checks !== void 0) requireCaptureArgument(root, resolve(root, this.#options.checks), "--checks");
|
|
@@ -3916,6 +3931,7 @@ var CapturePreflight = class {
|
|
|
3916
3931
|
root,
|
|
3917
3932
|
config,
|
|
3918
3933
|
invocation,
|
|
3934
|
+
...mode === void 0 ? {} : { mode },
|
|
3919
3935
|
...deadline === void 0 ? {} : { deadline }
|
|
3920
3936
|
}).describe()).projects.map(({ project, viewport }) => {
|
|
3921
3937
|
if (viewport === void 0) throw new CaptureError("A reader project declares no viewport geometry", { code: "HOST" });
|
|
@@ -4055,15 +4071,16 @@ var CapturePreflight = class {
|
|
|
4055
4071
|
};
|
|
4056
4072
|
// src/server/CaptureRegistrar.ts
|
|
4057
4073
|
/**
|
|
4058
|
-
* Refreshes the accepted registry from one complete capture-free journey
|
|
4074
|
+
* Refreshes the accepted registry from one complete capture-free journey stage over the selected variants.
|
|
4059
4075
|
*
|
|
4060
4076
|
* @remarks
|
|
4061
4077
|
* The refresh is the one route that bootstraps or replaces the registry the stage transaction
|
|
4062
4078
|
* requires, so it cannot stamp through the integrity engine. It reads the wrapper through the same
|
|
4063
4079
|
* discovery the runner uses, takes the same invocation entity, request file, and Vitest child, and runs
|
|
4064
|
-
*
|
|
4065
|
-
*
|
|
4066
|
-
*
|
|
4080
|
+
* every selected producing variant in one stage, one child that receives each variant's project, with
|
|
4081
|
+
* the `all` selector and no capture variable. It reads the stage's reporter once and each variant's
|
|
4082
|
+
* final record, takes each project's input population before and after, and builds one receipt per
|
|
4083
|
+
* variant, all naming the one reporter, through `buildCaptureRegistry`. The registry is written to a
|
|
4067
4084
|
* candidate beside its target, read back through the integrity engine, and only then renamed into
|
|
4068
4085
|
* place, so a registry the engine would refuse never replaces a good one. With `--variant`, the
|
|
4069
4086
|
* existing registry's receipts for the other declared variants are kept. It never widens a scoped
|
|
@@ -4137,9 +4154,13 @@ var CaptureRegistrar = class {
|
|
|
4137
4154
|
context: { variant }
|
|
4138
4155
|
});
|
|
4139
4156
|
const variants = declared.filter((variant) => parsed.variants.length === 0 || parsed.variants.includes(variant));
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4157
|
+
const selected = variants.map((variant) => {
|
|
4158
|
+
const project = projects.find((candidate) => candidate.variant === variant);
|
|
4159
|
+
if (project === void 0) throw new CaptureError(`The wrapper declares no journey project for ${variant}`, {
|
|
4160
|
+
code: "HOST",
|
|
4161
|
+
context: { variant }
|
|
4162
|
+
});
|
|
4163
|
+
return project;
|
|
4143
4164
|
});
|
|
4144
4165
|
const target = `${resolveCaptureRelative(root, primary.directory)}/${CAPTURE_REGISTRY_FILE}`;
|
|
4145
4166
|
const candidate = `${target}.${invocation.id}.candidate`;
|
|
@@ -4156,11 +4177,8 @@ var CaptureRegistrar = class {
|
|
|
4156
4177
|
});
|
|
4157
4178
|
const retained = parsed.variants.length === 0 ? [] : this.#retain(target, variants, declared);
|
|
4158
4179
|
if (retained.length > 0) buildCaptureRegistry(retained);
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
if (invocation.interrupted) return CAPTURE_EXIT.failed;
|
|
4162
|
-
imports.push(await this.#stage(invocation, parsed, projects, primary, variant));
|
|
4163
|
-
}
|
|
4180
|
+
if (invocation.interrupted) return CAPTURE_EXIT.failed;
|
|
4181
|
+
const imports = await this.#stage(invocation, parsed, projects, primary, selected);
|
|
4164
4182
|
if (invocation.interrupted) return CAPTURE_EXIT.failed;
|
|
4165
4183
|
const registry = buildCaptureRegistry([...retained, ...imports]);
|
|
4166
4184
|
const path = resolve(root, candidate);
|
|
@@ -4200,23 +4218,19 @@ var CaptureRegistrar = class {
|
|
|
4200
4218
|
}
|
|
4201
4219
|
}
|
|
4202
4220
|
}
|
|
4203
|
-
async #stage(invocation, parsed, projects, primary,
|
|
4221
|
+
async #stage(invocation, parsed, projects, primary, selected) {
|
|
4204
4222
|
const { root } = this.#options;
|
|
4205
|
-
const project = projects.find((candidate) => candidate.variant === variant);
|
|
4206
|
-
if (project === void 0) throw new CaptureError(`The wrapper declares no journey project for ${variant}`, {
|
|
4207
|
-
code: "HOST",
|
|
4208
|
-
context: { variant }
|
|
4209
|
-
});
|
|
4210
4223
|
const selectors = [...new Set(projects.flatMap((candidate) => candidate.tags))].filter((tag) => tag.startsWith(CAPTURE_OWNER_PREFIX)).map((tag) => tag.slice(CAPTURE_OWNER_PREFIX.length));
|
|
4211
|
-
const stage =
|
|
4224
|
+
const stage = CAPTURE_REGISTRY_STAGE;
|
|
4225
|
+
const variants = selected.map((project) => project.variant);
|
|
4212
4226
|
const reportFile = resolve(invocation.directory, `${stage}.json`);
|
|
4213
4227
|
const log = resolve(invocation.directory, `${stage}.log`);
|
|
4214
|
-
const
|
|
4228
|
+
const records = `${resolveCaptureRelative(root, primary.directory)}/${CAPTURE_RUNS_DIRECTORY}/${invocation.id}/${stage}`;
|
|
4215
4229
|
const args = buildCaptureArguments({
|
|
4216
4230
|
entry: resolve(root, CAPTURE_VITEST_ENTRY),
|
|
4217
4231
|
config: parsed.config,
|
|
4218
4232
|
report: reportFile,
|
|
4219
|
-
projects:
|
|
4233
|
+
projects: selected.map((project) => project.name),
|
|
4220
4234
|
filter: buildCaptureFilter("journey", "all", selectors),
|
|
4221
4235
|
final: primary.final,
|
|
4222
4236
|
...parsed.mode === void 0 ? {} : { mode: parsed.mode }
|
|
@@ -4228,68 +4242,86 @@ var CaptureRegistrar = class {
|
|
|
4228
4242
|
config: resolveCaptureRelative(root, parsed.config),
|
|
4229
4243
|
pid: process.pid,
|
|
4230
4244
|
command: "journey",
|
|
4245
|
+
...parsed.mode === void 0 ? {} : { mode: parsed.mode },
|
|
4231
4246
|
selector: "all",
|
|
4232
|
-
variants
|
|
4247
|
+
variants,
|
|
4233
4248
|
args
|
|
4234
4249
|
};
|
|
4235
|
-
const
|
|
4250
|
+
const snapshots = selected.map((project) => ({
|
|
4251
|
+
project,
|
|
4252
|
+
before: readCaptureInputs(root, project.inputs)
|
|
4253
|
+
}));
|
|
4236
4254
|
const started = Date.now();
|
|
4237
4255
|
rmSync(reportFile, { force: true });
|
|
4238
|
-
this.#stdout(`registry ${stage}: ${
|
|
4256
|
+
this.#stdout(`registry ${stage}: ${variants.join(", ")}; all; report=${reportFile}; records=${records}/<variant>.json\n`);
|
|
4239
4257
|
const outcome = await this.#run(invocation, request, log);
|
|
4240
4258
|
if (invocation.interrupted) throw new CaptureError("Runner interrupted", {
|
|
4241
4259
|
code: "STAGE",
|
|
4242
|
-
context: {
|
|
4260
|
+
context: {
|
|
4261
|
+
stage,
|
|
4262
|
+
variants
|
|
4263
|
+
}
|
|
4243
4264
|
});
|
|
4244
|
-
|
|
4265
|
+
const subject = `The registry journey for ${variants.join(", ")} in stage ${stage}`;
|
|
4266
|
+
if (outcome.code !== 0 || outcome.signal !== null) throw new CaptureError(`${subject} did not exit successfully (${String(outcome.code ?? outcome.signal)})`, {
|
|
4245
4267
|
code: "STAGE",
|
|
4246
4268
|
context: {
|
|
4247
|
-
|
|
4269
|
+
stage,
|
|
4270
|
+
variants,
|
|
4248
4271
|
code: outcome.code,
|
|
4249
4272
|
signal: outcome.signal
|
|
4250
4273
|
}
|
|
4251
4274
|
});
|
|
4252
|
-
if (!existsSync(reportFile)) throw new CaptureError(
|
|
4275
|
+
if (!existsSync(reportFile)) throw new CaptureError(`${subject} wrote no reporter at ${reportFile}`, {
|
|
4253
4276
|
code: "EVIDENCE",
|
|
4254
|
-
context: {
|
|
4277
|
+
context: {
|
|
4278
|
+
stage,
|
|
4279
|
+
variants
|
|
4280
|
+
}
|
|
4255
4281
|
});
|
|
4256
4282
|
const text = readFileSync(reportFile, "utf8");
|
|
4257
4283
|
const report = readCaptureReport(parseJSON(text));
|
|
4258
4284
|
if (report.start < started || report.end > Date.now()) throw new CaptureError("Reporter does not belong to this refresh", { code: "EVIDENCE" });
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
variant
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4285
|
+
const file = resolveCaptureRelative(root, reportFile);
|
|
4286
|
+
const digest = computeCaptureHash(text);
|
|
4287
|
+
return snapshots.map(({ project, before }) => {
|
|
4288
|
+
const variant = project.variant;
|
|
4289
|
+
const record = `${records}/${variant}.json`;
|
|
4290
|
+
if (!existsSync(resolve(root, record))) throw new CaptureError(`The registry journey for ${variant} wrote no final record at ${record}`, {
|
|
4291
|
+
code: "EVIDENCE",
|
|
4292
|
+
context: { variant }
|
|
4293
|
+
});
|
|
4294
|
+
const run = parseJSON(readFileSync(resolve(root, record), "utf8"));
|
|
4295
|
+
if (!isCaptureRun(run) || run.request === void 0 || run.variant !== variant || describeCaptureRequest(run.request) !== describeCaptureRequest(request)) throw new CaptureError(`Invalid or mismatched final record: ${record}`, { code: "EVIDENCE" });
|
|
4296
|
+
if (Date.parse(run.time) < started || Date.parse(run.time) > report.end) throw new CaptureError("Final record time does not belong to this refresh", { code: "EVIDENCE" });
|
|
4297
|
+
validateCaptureRun(run, report, project.name);
|
|
4298
|
+
if (!run.complete) throw new CaptureError(`The registry journey for ${variant} was not a complete run; a refresh imports complete runs only`, {
|
|
4299
|
+
code: "EVIDENCE",
|
|
4300
|
+
context: { variant }
|
|
4301
|
+
});
|
|
4302
|
+
if (JSON.stringify(readCaptureInputs(root, project.inputs)) !== JSON.stringify(before)) throw new CaptureError("Bounded host inputs or membership changed during the refresh", {
|
|
4303
|
+
code: "STAGE",
|
|
4304
|
+
context: { variant }
|
|
4305
|
+
});
|
|
4306
|
+
return {
|
|
4307
|
+
receipt: {
|
|
4308
|
+
version: CAPTURE_VERSION,
|
|
4309
|
+
variant,
|
|
4310
|
+
time: run.time,
|
|
4311
|
+
report: {
|
|
4312
|
+
file,
|
|
4313
|
+
digest
|
|
4314
|
+
},
|
|
4315
|
+
inputs: before,
|
|
4316
|
+
declarations: run.declarations,
|
|
4317
|
+
registry: run.registry,
|
|
4318
|
+
complete: run.complete
|
|
4283
4319
|
},
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
report: text,
|
|
4290
|
-
outcome,
|
|
4291
|
-
capped: false
|
|
4292
|
-
};
|
|
4320
|
+
report: text,
|
|
4321
|
+
outcome,
|
|
4322
|
+
capped: false
|
|
4323
|
+
};
|
|
4324
|
+
});
|
|
4293
4325
|
}
|
|
4294
4326
|
async #run(invocation, request, log) {
|
|
4295
4327
|
try {
|
|
@@ -4380,6 +4412,7 @@ var CaptureRunner = class {
|
|
|
4380
4412
|
root,
|
|
4381
4413
|
config: parsed.config,
|
|
4382
4414
|
invocation,
|
|
4415
|
+
...parsed.mode === void 0 ? {} : { mode: parsed.mode },
|
|
4383
4416
|
...this.#options.deadline === void 0 ? {} : { deadline: this.#options.deadline }
|
|
4384
4417
|
}).describe()).projects.map((entry) => entry.project);
|
|
4385
4418
|
if (parsed.selector !== void 0) requireCaptureSelection(parsed.selector, [], projects, [], parsed.portfolio);
|
|
@@ -4421,7 +4454,8 @@ var CaptureRunner = class {
|
|
|
4421
4454
|
const shared = plan.changes.filter((change) => change.classification === "shared");
|
|
4422
4455
|
const complete = renderCaptureCommand("journey", {
|
|
4423
4456
|
config: parsed.config,
|
|
4424
|
-
variants: parsed.variants
|
|
4457
|
+
variants: parsed.variants,
|
|
4458
|
+
...parsed.mode === void 0 ? {} : { mode: parsed.mode }
|
|
4425
4459
|
}, "all", root);
|
|
4426
4460
|
for (const next of commands) this.#stdout(`COMMAND ${next}\n`);
|
|
4427
4461
|
const variants = resolveCaptureVariants(parsed.variants, projects);
|
|
@@ -4555,7 +4589,8 @@ var CaptureRunner = class {
|
|
|
4555
4589
|
...parsed.state === void 0 ? {} : { state: parsed.state },
|
|
4556
4590
|
final: primary.final,
|
|
4557
4591
|
directory: resolveCaptureRelative(root, primary.directory),
|
|
4558
|
-
config: resolveCaptureRelative(root, parsed.config)
|
|
4592
|
+
config: resolveCaptureRelative(root, parsed.config),
|
|
4593
|
+
...parsed.mode === void 0 ? {} : { mode: parsed.mode }
|
|
4559
4594
|
};
|
|
4560
4595
|
const outcomes = [];
|
|
4561
4596
|
const stages = resolveCaptureStages(variants, primary.first, command);
|
|
@@ -4599,6 +4634,7 @@ var CaptureRunner = class {
|
|
|
4599
4634
|
report,
|
|
4600
4635
|
projects: selected.map((project) => project.name),
|
|
4601
4636
|
filter: plan.filter,
|
|
4637
|
+
...plan.mode === void 0 ? {} : { mode: plan.mode },
|
|
4602
4638
|
...plan.case === void 0 ? {} : { case: plan.case },
|
|
4603
4639
|
...plan.case === void 0 ? {} : { titles: readCaptureTitles(root, resolve(root, plan.directory, CAPTURE_REGISTRY_FILE)) },
|
|
4604
4640
|
final: plan.final
|
|
@@ -4610,6 +4646,7 @@ var CaptureRunner = class {
|
|
|
4610
4646
|
config: plan.config,
|
|
4611
4647
|
pid: process.pid,
|
|
4612
4648
|
command: plan.command,
|
|
4649
|
+
...plan.mode === void 0 ? {} : { mode: plan.mode },
|
|
4613
4650
|
selector: plan.selector,
|
|
4614
4651
|
...plan.case === void 0 ? {} : { case: plan.case },
|
|
4615
4652
|
...plan.state === void 0 ? {} : { state: plan.state },
|