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