@orkestrel/capture 0.0.5 → 0.0.7
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/dist/src/core/index.d.cts +2 -1
- package/dist/src/core/index.d.ts +2 -1
- package/dist/src/server/index.cjs +79 -64
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +8 -7
- package/dist/src/server/index.d.ts +8 -7
- package/dist/src/server/index.js +79 -64
- package/dist/src/server/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -552,11 +552,11 @@ export declare const CAPTURE_REFUSAL_LIMIT = 16;
|
|
|
552
552
|
export declare const CAPTURE_REGISTRY_LINE = "REGISTRY";
|
|
553
553
|
|
|
554
554
|
/**
|
|
555
|
-
* Names the stage
|
|
555
|
+
* Names the one stage a registry refresh runs every selected producing variant's complete journey in.
|
|
556
556
|
*
|
|
557
557
|
* @example
|
|
558
558
|
* ```ts
|
|
559
|
-
*
|
|
559
|
+
* `runs/${id}/${CAPTURE_REGISTRY_STAGE}/light-390.json` // 'runs/<id>/registry/light-390.json'
|
|
560
560
|
* ```
|
|
561
561
|
*/
|
|
562
562
|
export declare const CAPTURE_REGISTRY_STAGE = "registry";
|
|
@@ -2292,15 +2292,16 @@ export declare interface CaptureReceiptInput {
|
|
|
2292
2292
|
}
|
|
2293
2293
|
|
|
2294
2294
|
/**
|
|
2295
|
-
* Refreshes the accepted registry from one complete capture-free journey
|
|
2295
|
+
* Refreshes the accepted registry from one complete capture-free journey stage over the selected variants.
|
|
2296
2296
|
*
|
|
2297
2297
|
* @remarks
|
|
2298
2298
|
* The refresh is the one route that bootstraps or replaces the registry the stage transaction
|
|
2299
2299
|
* requires, so it cannot stamp through the integrity engine. It reads the wrapper through the same
|
|
2300
2300
|
* discovery the runner uses, takes the same invocation entity, request file, and Vitest child, and runs
|
|
2301
|
-
*
|
|
2302
|
-
*
|
|
2303
|
-
*
|
|
2301
|
+
* every selected producing variant in one stage, one child that receives each variant's project, with
|
|
2302
|
+
* the `all` selector and no capture variable. It reads the stage's reporter once and each variant's
|
|
2303
|
+
* final record, takes each project's input population before and after, and builds one receipt per
|
|
2304
|
+
* variant, all naming the one reporter, through `buildCaptureRegistry`. The registry is written to a
|
|
2304
2305
|
* candidate beside its target, read back through the integrity engine, and only then renamed into
|
|
2305
2306
|
* place, so a registry the engine would refuse never replaces a good one. With `--variant`, the
|
|
2306
2307
|
* existing registry's receipts for the other declared variants are kept. It never widens a scoped
|
|
@@ -2331,7 +2332,7 @@ export declare class CaptureRegistrar implements CaptureRegistrarInterface {
|
|
|
2331
2332
|
}
|
|
2332
2333
|
|
|
2333
2334
|
/**
|
|
2334
|
-
* Refreshes the accepted registry from one complete capture-free journey
|
|
2335
|
+
* Refreshes the accepted registry from one complete capture-free journey stage over the selected variants.
|
|
2335
2336
|
*
|
|
2336
2337
|
* @example
|
|
2337
2338
|
* ```ts
|
|
@@ -552,11 +552,11 @@ export declare const CAPTURE_REFUSAL_LIMIT = 16;
|
|
|
552
552
|
export declare const CAPTURE_REGISTRY_LINE = "REGISTRY";
|
|
553
553
|
|
|
554
554
|
/**
|
|
555
|
-
* Names the stage
|
|
555
|
+
* Names the one stage a registry refresh runs every selected producing variant's complete journey in.
|
|
556
556
|
*
|
|
557
557
|
* @example
|
|
558
558
|
* ```ts
|
|
559
|
-
*
|
|
559
|
+
* `runs/${id}/${CAPTURE_REGISTRY_STAGE}/light-390.json` // 'runs/<id>/registry/light-390.json'
|
|
560
560
|
* ```
|
|
561
561
|
*/
|
|
562
562
|
export declare const CAPTURE_REGISTRY_STAGE = "registry";
|
|
@@ -2292,15 +2292,16 @@ export declare interface CaptureReceiptInput {
|
|
|
2292
2292
|
}
|
|
2293
2293
|
|
|
2294
2294
|
/**
|
|
2295
|
-
* Refreshes the accepted registry from one complete capture-free journey
|
|
2295
|
+
* Refreshes the accepted registry from one complete capture-free journey stage over the selected variants.
|
|
2296
2296
|
*
|
|
2297
2297
|
* @remarks
|
|
2298
2298
|
* The refresh is the one route that bootstraps or replaces the registry the stage transaction
|
|
2299
2299
|
* requires, so it cannot stamp through the integrity engine. It reads the wrapper through the same
|
|
2300
2300
|
* discovery the runner uses, takes the same invocation entity, request file, and Vitest child, and runs
|
|
2301
|
-
*
|
|
2302
|
-
*
|
|
2303
|
-
*
|
|
2301
|
+
* every selected producing variant in one stage, one child that receives each variant's project, with
|
|
2302
|
+
* the `all` selector and no capture variable. It reads the stage's reporter once and each variant's
|
|
2303
|
+
* final record, takes each project's input population before and after, and builds one receipt per
|
|
2304
|
+
* variant, all naming the one reporter, through `buildCaptureRegistry`. The registry is written to a
|
|
2304
2305
|
* candidate beside its target, read back through the integrity engine, and only then renamed into
|
|
2305
2306
|
* place, so a registry the engine would refuse never replaces a good one. With `--variant`, the
|
|
2306
2307
|
* existing registry's receipts for the other declared variants are kept. It never widens a scoped
|
|
@@ -2331,7 +2332,7 @@ export declare class CaptureRegistrar implements CaptureRegistrarInterface {
|
|
|
2331
2332
|
}
|
|
2332
2333
|
|
|
2333
2334
|
/**
|
|
2334
|
-
* Refreshes the accepted registry from one complete capture-free journey
|
|
2335
|
+
* Refreshes the accepted registry from one complete capture-free journey stage over the selected variants.
|
|
2335
2336
|
*
|
|
2336
2337
|
* @example
|
|
2337
2338
|
* ```ts
|
package/dist/src/server/index.js
CHANGED
|
@@ -316,11 +316,11 @@ var CAPTURE_SHEET_FILES = Object.freeze({
|
|
|
316
316
|
notes: "index.md"
|
|
317
317
|
});
|
|
318
318
|
/**
|
|
319
|
-
* Names the stage
|
|
319
|
+
* Names the one stage a registry refresh runs every selected producing variant's complete journey in.
|
|
320
320
|
*
|
|
321
321
|
* @example
|
|
322
322
|
* ```ts
|
|
323
|
-
*
|
|
323
|
+
* `runs/${id}/${CAPTURE_REGISTRY_STAGE}/light-390.json` // 'runs/<id>/registry/light-390.json'
|
|
324
324
|
* ```
|
|
325
325
|
*/
|
|
326
326
|
var CAPTURE_REGISTRY_STAGE = "registry";
|
|
@@ -4071,15 +4071,16 @@ var CapturePreflight = class {
|
|
|
4071
4071
|
};
|
|
4072
4072
|
// src/server/CaptureRegistrar.ts
|
|
4073
4073
|
/**
|
|
4074
|
-
* 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.
|
|
4075
4075
|
*
|
|
4076
4076
|
* @remarks
|
|
4077
4077
|
* The refresh is the one route that bootstraps or replaces the registry the stage transaction
|
|
4078
4078
|
* requires, so it cannot stamp through the integrity engine. It reads the wrapper through the same
|
|
4079
4079
|
* discovery the runner uses, takes the same invocation entity, request file, and Vitest child, and runs
|
|
4080
|
-
*
|
|
4081
|
-
*
|
|
4082
|
-
*
|
|
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
|
|
4083
4084
|
* candidate beside its target, read back through the integrity engine, and only then renamed into
|
|
4084
4085
|
* place, so a registry the engine would refuse never replaces a good one. With `--variant`, the
|
|
4085
4086
|
* existing registry's receipts for the other declared variants are kept. It never widens a scoped
|
|
@@ -4153,9 +4154,13 @@ var CaptureRegistrar = class {
|
|
|
4153
4154
|
context: { variant }
|
|
4154
4155
|
});
|
|
4155
4156
|
const variants = declared.filter((variant) => parsed.variants.length === 0 || parsed.variants.includes(variant));
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
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;
|
|
4159
4164
|
});
|
|
4160
4165
|
const target = `${resolveCaptureRelative(root, primary.directory)}/${CAPTURE_REGISTRY_FILE}`;
|
|
4161
4166
|
const candidate = `${target}.${invocation.id}.candidate`;
|
|
@@ -4172,11 +4177,8 @@ var CaptureRegistrar = class {
|
|
|
4172
4177
|
});
|
|
4173
4178
|
const retained = parsed.variants.length === 0 ? [] : this.#retain(target, variants, declared);
|
|
4174
4179
|
if (retained.length > 0) buildCaptureRegistry(retained);
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
if (invocation.interrupted) return CAPTURE_EXIT.failed;
|
|
4178
|
-
imports.push(await this.#stage(invocation, parsed, projects, primary, variant));
|
|
4179
|
-
}
|
|
4180
|
+
if (invocation.interrupted) return CAPTURE_EXIT.failed;
|
|
4181
|
+
const imports = await this.#stage(invocation, parsed, projects, primary, selected);
|
|
4180
4182
|
if (invocation.interrupted) return CAPTURE_EXIT.failed;
|
|
4181
4183
|
const registry = buildCaptureRegistry([...retained, ...imports]);
|
|
4182
4184
|
const path = resolve(root, candidate);
|
|
@@ -4216,23 +4218,19 @@ var CaptureRegistrar = class {
|
|
|
4216
4218
|
}
|
|
4217
4219
|
}
|
|
4218
4220
|
}
|
|
4219
|
-
async #stage(invocation, parsed, projects, primary,
|
|
4221
|
+
async #stage(invocation, parsed, projects, primary, selected) {
|
|
4220
4222
|
const { root } = this.#options;
|
|
4221
|
-
const project = projects.find((candidate) => candidate.variant === variant);
|
|
4222
|
-
if (project === void 0) throw new CaptureError(`The wrapper declares no journey project for ${variant}`, {
|
|
4223
|
-
code: "HOST",
|
|
4224
|
-
context: { variant }
|
|
4225
|
-
});
|
|
4226
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));
|
|
4227
|
-
const stage =
|
|
4224
|
+
const stage = CAPTURE_REGISTRY_STAGE;
|
|
4225
|
+
const variants = selected.map((project) => project.variant);
|
|
4228
4226
|
const reportFile = resolve(invocation.directory, `${stage}.json`);
|
|
4229
4227
|
const log = resolve(invocation.directory, `${stage}.log`);
|
|
4230
|
-
const
|
|
4228
|
+
const records = `${resolveCaptureRelative(root, primary.directory)}/${CAPTURE_RUNS_DIRECTORY}/${invocation.id}/${stage}`;
|
|
4231
4229
|
const args = buildCaptureArguments({
|
|
4232
4230
|
entry: resolve(root, CAPTURE_VITEST_ENTRY),
|
|
4233
4231
|
config: parsed.config,
|
|
4234
4232
|
report: reportFile,
|
|
4235
|
-
projects:
|
|
4233
|
+
projects: selected.map((project) => project.name),
|
|
4236
4234
|
filter: buildCaptureFilter("journey", "all", selectors),
|
|
4237
4235
|
final: primary.final,
|
|
4238
4236
|
...parsed.mode === void 0 ? {} : { mode: parsed.mode }
|
|
@@ -4246,67 +4244,84 @@ var CaptureRegistrar = class {
|
|
|
4246
4244
|
command: "journey",
|
|
4247
4245
|
...parsed.mode === void 0 ? {} : { mode: parsed.mode },
|
|
4248
4246
|
selector: "all",
|
|
4249
|
-
variants
|
|
4247
|
+
variants,
|
|
4250
4248
|
args
|
|
4251
4249
|
};
|
|
4252
|
-
const
|
|
4250
|
+
const snapshots = selected.map((project) => ({
|
|
4251
|
+
project,
|
|
4252
|
+
before: readCaptureInputs(root, project.inputs)
|
|
4253
|
+
}));
|
|
4253
4254
|
const started = Date.now();
|
|
4254
4255
|
rmSync(reportFile, { force: true });
|
|
4255
|
-
this.#stdout(`registry ${stage}: ${
|
|
4256
|
+
this.#stdout(`registry ${stage}: ${variants.join(", ")}; all; report=${reportFile}; records=${records}/<variant>.json\n`);
|
|
4256
4257
|
const outcome = await this.#run(invocation, request, log);
|
|
4257
4258
|
if (invocation.interrupted) throw new CaptureError("Runner interrupted", {
|
|
4258
4259
|
code: "STAGE",
|
|
4259
|
-
context: {
|
|
4260
|
+
context: {
|
|
4261
|
+
stage,
|
|
4262
|
+
variants
|
|
4263
|
+
}
|
|
4260
4264
|
});
|
|
4261
|
-
|
|
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)})`, {
|
|
4262
4267
|
code: "STAGE",
|
|
4263
4268
|
context: {
|
|
4264
|
-
|
|
4269
|
+
stage,
|
|
4270
|
+
variants,
|
|
4265
4271
|
code: outcome.code,
|
|
4266
4272
|
signal: outcome.signal
|
|
4267
4273
|
}
|
|
4268
4274
|
});
|
|
4269
|
-
if (!existsSync(reportFile)) throw new CaptureError(
|
|
4275
|
+
if (!existsSync(reportFile)) throw new CaptureError(`${subject} wrote no reporter at ${reportFile}`, {
|
|
4270
4276
|
code: "EVIDENCE",
|
|
4271
|
-
context: {
|
|
4277
|
+
context: {
|
|
4278
|
+
stage,
|
|
4279
|
+
variants
|
|
4280
|
+
}
|
|
4272
4281
|
});
|
|
4273
4282
|
const text = readFileSync(reportFile, "utf8");
|
|
4274
4283
|
const report = readCaptureReport(parseJSON(text));
|
|
4275
4284
|
if (report.start < started || report.end > Date.now()) throw new CaptureError("Reporter does not belong to this refresh", { code: "EVIDENCE" });
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
variant
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
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
|
|
4300
4319
|
},
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
report: text,
|
|
4307
|
-
outcome,
|
|
4308
|
-
capped: false
|
|
4309
|
-
};
|
|
4320
|
+
report: text,
|
|
4321
|
+
outcome,
|
|
4322
|
+
capped: false
|
|
4323
|
+
};
|
|
4324
|
+
});
|
|
4310
4325
|
}
|
|
4311
4326
|
async #run(invocation, request, log) {
|
|
4312
4327
|
try {
|