@gate-forge/cli 0.13.7 → 0.13.8
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/CHANGELOG.md +47 -0
- package/README.md +1 -0
- package/dist/commands/test-gates.d.ts +7 -0
- package/dist/commands/test-gates.d.ts.map +1 -1
- package/dist/commands/test-gates.js +100 -12
- package/dist/commands/test-gates.js.map +1 -1
- package/dist/serial-expansion.d.ts +44 -0
- package/dist/serial-expansion.d.ts.map +1 -0
- package/dist/serial-expansion.js +118 -0
- package/dist/serial-expansion.js.map +1 -0
- package/guides/QUICKSTART.md +7 -7
- package/guides/REFERENCE.md +36 -0
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.13.8
|
|
4
|
+
|
|
5
|
+
- **cli: a selected step of a serial journey selects the whole serial
|
|
6
|
+
group.** A named selection narrows the supervised Playwright run to
|
|
7
|
+
the mapped tests' exact `file:line` locations, so a serial journey
|
|
8
|
+
whose MAPPED steps were its later ones executed without the group's
|
|
9
|
+
own earlier steps — the steps that create the state the later steps
|
|
10
|
+
read — and failed by construction (a real consumer serial describe of
|
|
11
|
+
8 dependent steps with 3 mapped could never run green). When a
|
|
12
|
+
selected test belongs to a describe in serial mode, the run now
|
|
13
|
+
selects every test of that group in file order: the runner receives
|
|
14
|
+
every step's location, the expected set registers every step, and
|
|
15
|
+
each step's own claims are graded like any selected test's (a step
|
|
16
|
+
that declares nothing contributes nothing). Serial mode is read
|
|
17
|
+
STATICALLY from the spec source — Playwright's own list mode never
|
|
18
|
+
exposes a suite's declared mode — and detects exactly three
|
|
19
|
+
declaration forms: `test.describe.serial(...)`, a describe whose body
|
|
20
|
+
calls `test.describe.configure({ mode: 'serial' })` (before or after
|
|
21
|
+
the tests it governs), and the file-level
|
|
22
|
+
`test.describe.configure({ mode: 'serial' })` (the whole file is one
|
|
23
|
+
serial scope). A describe that declares nothing serial is never
|
|
24
|
+
expanded, and an expansion never leaks beyond the selected test's own
|
|
25
|
+
file or project. The run names each expansion on its output
|
|
26
|
+
(`selection: added 2 tests of serial group 'journey'
|
|
27
|
+
(specs/journey.spec.js)`) and the report carries an additive
|
|
28
|
+
`serialExpansions` field. A full run selects everything already, a
|
|
29
|
+
re-seal replays its parent's file-scoped plan, and a changed slice
|
|
30
|
+
for Playwright is file-granular, so none of those print an expansion;
|
|
31
|
+
members are drawn from the planned set only, so quarantined tests are
|
|
32
|
+
never re-added.
|
|
33
|
+
|
|
34
|
+
- **pack-playwright: `runtime.yml trace` sets the supervised run's
|
|
35
|
+
Playwright trace mode.** The generated config a supervised Playwright
|
|
36
|
+
run executes under hardcoded `use.trace: 'off'`, and the consumer
|
|
37
|
+
config is never loaded by design, so an owner who turned traces on in
|
|
38
|
+
their own config never got a `trace.zip` — `<state>/last-failures/`
|
|
39
|
+
held error contexts and screenshots but nothing to replay the failure
|
|
40
|
+
from. The runtime document now declares `trace` with one of
|
|
41
|
+
Playwright's six modes (`off`, `on`, `retain-on-failure`,
|
|
42
|
+
`on-first-retry`, `on-all-retries`, `retain-on-first-failure`),
|
|
43
|
+
validated (an unknown mode is a typed schema violation), resolved
|
|
44
|
+
beside the stall and assertion bounds, and written into the generated
|
|
45
|
+
config's `use.trace` — following the 0.13.6 `expectTimeoutSeconds`
|
|
46
|
+
precedent. When the key is absent the generated config keeps
|
|
47
|
+
`trace: 'off'` byte-identically, and a declared run's `trace.zip`
|
|
48
|
+
survives into `last-failures` with the other failure artifacts.
|
|
49
|
+
|
|
3
50
|
## 0.13.7
|
|
4
51
|
|
|
5
52
|
- **pack-fastapi: a once-called registry function now orders its
|
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@ The gateforge command-line interface: initialize a project, discover
|
|
|
4
4
|
resources and classification signals, inspect automatic decisions, reuse a
|
|
5
5
|
repository's existing tests, evaluate obligations, run the supervised E2E
|
|
6
6
|
gate, enforce the exact staged candidate, and maintain baselines.
|
|
7
|
+
**0.13.8:** Selecting one step of a serial journey (`test.describe.serial`, or a describe or file that calls `test.describe.configure({ mode: 'serial' })`) selects the whole serial group in file order, so a named run no longer starts at step 3 without steps 1–2; each expansion is printed and recorded in the report. `runtime.yml trace` sets the supervised run's Playwright trace mode (e.g. `retain-on-failure`), and the trace lands in `<state dir>/last-failures/`.
|
|
7
8
|
**0.13.7:** Registration order reaches apps that mount every router through one registration function (`register_all_routers(app)`): when the function is a plain module-level `def` called exactly once at the app module's top level, its top-level `include_router` calls are ordered in place, so literal-vs-parameter overlaps such as `/items/export` vs `/items/{item_id}` resolve there too. Conditional or looped includes, repeated or nested calls and foreign call sites stay unordered (ambiguous).
|
|
8
9
|
**0.13.6:** A FastAPI literal-vs-parameter route overlap (`/items/export` vs `/items/{item_id}`) is attributed by registration order, as Starlette dispatches it, whenever pack-fastapi can place every matching route statically (otherwise it stays ambiguous). `runtime.yml expectTimeoutSeconds` sets the supervised run's `expect` timeout. A red `--result-only` run keeps Playwright's failure artifacts in `<state dir>/last-failures/`. A blocked transport claim names its own blocked call instead of an unrelated exchange from the same test.
|
|
9
10
|
**0.13.5:** Supervised runs honour a project's declared test timeout: the timeout Playwright resolves for each project (read from `playwright test --list` JSON, never by loading the config) becomes that project's timeout in the generated config, with 60 s as the floor.
|
|
@@ -66,6 +66,13 @@ export interface SupervisedOptions {
|
|
|
66
66
|
* `expect` key is emitted and Playwright's own 5-second default stands.
|
|
67
67
|
*/
|
|
68
68
|
expectTimeoutMs?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Playwright trace mode, written as `use.trace` in the generated
|
|
71
|
+
* config the supervised run executes under. Undefined resolves from
|
|
72
|
+
* `runtime.yml trace`; when neither declares a value the generated
|
|
73
|
+
* config keeps `trace: 'off'` — the default is unchanged.
|
|
74
|
+
*/
|
|
75
|
+
trace?: 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | 'on-all-retries' | 'retain-on-first-failure';
|
|
69
76
|
/**
|
|
70
77
|
* `--progress` target (additive): `stderr`, `file:<path>`, `off`, or
|
|
71
78
|
* undefined for the `run.progress` config key and then the CI-aware
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-gates.d.ts","sourceRoot":"","sources":["../../src/commands/test-gates.ts"],"names":[],"mappings":"AA6DA,OAAO,EA4BL,KAAK,eAAe,EAEpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,eAAe,EAEpB,KAAK,WAAW,EAGhB,KAAK,iBAAiB,EAKtB,KAAK,SAAS,EAcd,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAGf,KAAK,WAAW,EAKhB,KAAK,QAAQ,EAEd,MAAM,kBAAkB,CAAC;AAsD1B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AA2CnC,OAAO,EAOL,KAAK,0BAA0B,EAChC,MAAM,cAAc,CAAC;AAyBtB,OAAO,EAQL,KAAK,yBAAyB,EAE/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAwC7D,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"test-gates.d.ts","sourceRoot":"","sources":["../../src/commands/test-gates.ts"],"names":[],"mappings":"AA6DA,OAAO,EA4BL,KAAK,eAAe,EAEpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,eAAe,EAEpB,KAAK,WAAW,EAGhB,KAAK,iBAAiB,EAKtB,KAAK,SAAS,EAcd,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAGf,KAAK,WAAW,EAKhB,KAAK,QAAQ,EAEd,MAAM,kBAAkB,CAAC;AAsD1B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AA2CnC,OAAO,EAOL,KAAK,0BAA0B,EAChC,MAAM,cAAc,CAAC;AAyBtB,OAAO,EAQL,KAAK,yBAAyB,EA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CAAC;IACf,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG;IAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAyHrD;AACD;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiJhG;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GACnC,aAAa,EAAE,CAajB;AAmlID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,eAAe,GAAG,IAAI,EACvC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,GACrC,MAAM,CAgDR"}
|
|
@@ -99,6 +99,7 @@ import { pruneRunHistory, recordRunHistory } from '../history.js';
|
|
|
99
99
|
import { ProgressStream, resolveProgressTarget } from '../progress.js';
|
|
100
100
|
import { writeRunScopeView, writeStateFile, writeTestFailures } from '../state.js';
|
|
101
101
|
import { keepFailureArtifacts } from '../failure-artifacts.js';
|
|
102
|
+
import { expandSerialSelection } from '../serial-expansion.js';
|
|
102
103
|
export const TEST_GATES_USAGE = 'usage: gateforge test-gates [--changed] [--scope full|changed] [--suite <command>] [--out <dir>] ' +
|
|
103
104
|
'[--result-only] [--test <selector>] [--format text|json|sarif] [--witness-url <url>] [--run-token <token>] ' +
|
|
104
105
|
'[--run-timeout-min <minutes>] [--progress stderr|file:<path>|off|auto] ' +
|
|
@@ -231,6 +232,7 @@ export async function testGatesCommand(io, argv) {
|
|
|
231
232
|
runTimeoutMs: parseRunTimeoutMin(stringFlag(options, 'run-timeout-min')) ?? runtimeRunTimeoutMs(io.cwd),
|
|
232
233
|
stallTimeoutMs: runtimeStallTimeoutMs(io.cwd),
|
|
233
234
|
expectTimeoutMs: runtimeExpectTimeoutMs(io.cwd),
|
|
235
|
+
trace: runtimeTrace(io.cwd),
|
|
234
236
|
progress: progressFlag,
|
|
235
237
|
scope,
|
|
236
238
|
resultOnly,
|
|
@@ -391,6 +393,31 @@ function runtimeExpectTimeoutMs(cwd) {
|
|
|
391
393
|
return undefined;
|
|
392
394
|
}
|
|
393
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* The Playwright trace mode the OWNER declared in the staged runtime
|
|
398
|
+
* document, or undefined when the document declares none.
|
|
399
|
+
*
|
|
400
|
+
* `runtime.yml`'s `trace` is the owner's answer to "leave me a trace to
|
|
401
|
+
* diagnose a red supervised test from": the consumer config is never
|
|
402
|
+
* loaded, so this declaration is the only way a `use.trace` above `off`
|
|
403
|
+
* reaches the run's generated config and a `trace.zip` reaches
|
|
404
|
+
* `last-failures`. A document that cannot be read declares nothing, and
|
|
405
|
+
* `trace: 'off'` stands.
|
|
406
|
+
*
|
|
407
|
+
* Args:
|
|
408
|
+
* cwd: absolute repository root.
|
|
409
|
+
*
|
|
410
|
+
* Returns:
|
|
411
|
+
* string | undefined: the declared trace mode, or undefined for off.
|
|
412
|
+
*/
|
|
413
|
+
function runtimeTrace(cwd) {
|
|
414
|
+
try {
|
|
415
|
+
return loadRuntimeConfigAt(cwd, loadConfigAt(cwd).runtime)?.trace;
|
|
416
|
+
}
|
|
417
|
+
catch {
|
|
418
|
+
return undefined;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
394
421
|
/**
|
|
395
422
|
* The legacy `--suite` orchestration (unchanged behavior): materialize
|
|
396
423
|
* run state, run the user's suite command, evaluate, report.
|
|
@@ -1677,6 +1704,21 @@ function quarantinedFrameworkIds(catalog, quarantinedKeys) {
|
|
|
1677
1704
|
}
|
|
1678
1705
|
return ids;
|
|
1679
1706
|
}
|
|
1707
|
+
/**
|
|
1708
|
+
* The catalog lookup the serial expansion ranges and orders members by:
|
|
1709
|
+
* one logical key's source line, or undefined when the catalog never
|
|
1710
|
+
* located the test.
|
|
1711
|
+
*
|
|
1712
|
+
* Args:
|
|
1713
|
+
* catalog: the current test catalog.
|
|
1714
|
+
*
|
|
1715
|
+
* Returns:
|
|
1716
|
+
* (logicalKey: string) => number | undefined: the line lookup.
|
|
1717
|
+
*/
|
|
1718
|
+
function catalogLineOf(catalog) {
|
|
1719
|
+
const lines = new Map(catalog.entries.map((entry) => [entry.logicalKey, entry.sourceLocation.line]));
|
|
1720
|
+
return (logicalKey) => lines.get(logicalKey);
|
|
1721
|
+
}
|
|
1680
1722
|
/**
|
|
1681
1723
|
* Builds one planned row from a contract-enumerated test identity
|
|
1682
1724
|
* (plan 2026-09-25, runner-agnostic evidence): the adapter's logical
|
|
@@ -1808,6 +1850,10 @@ async function runSupervisedTestGatesInner(io, options, declaredRunnerEnvNames)
|
|
|
1808
1850
|
// value wins, the document is re-read for an in-process caller, and
|
|
1809
1851
|
// neither declaring one means no `expect` key in the generated config.
|
|
1810
1852
|
const expectTimeoutMs = options.expectTimeoutMs ?? runtimeExpectTimeoutMs(io.cwd);
|
|
1853
|
+
// The trace mode: the same rule again — the caller's value wins, the
|
|
1854
|
+
// document is re-read for an in-process caller, and neither declaring
|
|
1855
|
+
// one keeps `trace: 'off'` in the generated config.
|
|
1856
|
+
const trace = options.trace ?? runtimeTrace(io.cwd);
|
|
1811
1857
|
// The reuse digest is the IDENTITY of the dependency bytes this run
|
|
1812
1858
|
// executes against, and it must be the same value whoever computes it.
|
|
1813
1859
|
// ONE resolver owns that value: the commit hook hands over the digest
|
|
@@ -2468,9 +2514,47 @@ async function runSupervisedTestGatesInner(io, options, declaredRunnerEnvNames)
|
|
|
2468
2514
|
: resolveTestSelectors(options.testSelectors, plannedRows.map((row) => ({ logicalKey: row.planned.logicalKey })));
|
|
2469
2515
|
// The selected logical keys, hoisted for the grading step below: a
|
|
2470
2516
|
// named run grades exactly the claims of the tests it ran.
|
|
2471
|
-
|
|
2517
|
+
let namedTestIds = namedSelections === null
|
|
2472
2518
|
? null
|
|
2473
2519
|
: [...new Set(namedSelections.flatMap((entry) => [...entry.logicalKeys]))].sort();
|
|
2520
|
+
if (namedSelections !== null) {
|
|
2521
|
+
const named = new Set(namedTestIds ?? []);
|
|
2522
|
+
plannedRows = plannedRows.filter((row) => named.has(row.planned.logicalKey));
|
|
2523
|
+
// A test this run did not execute can never have produced
|
|
2524
|
+
// evidence, so a claim row alone proves nothing: the graded SET is
|
|
2525
|
+
// `namedObligationIds` below, and the declaration inventory stays
|
|
2526
|
+
// whole. (A per-test filter here would silently drop a
|
|
2527
|
+
// declaration whose source location a sibling declaration in the
|
|
2528
|
+
// same file already occupies — the inventory is deduplicated per
|
|
2529
|
+
// source location, not per test.)
|
|
2530
|
+
}
|
|
2531
|
+
// Serial-group expansion (serial journeys fail by construction when a
|
|
2532
|
+
// mapped later step runs without the group's own earlier steps): a
|
|
2533
|
+
// selected test inside a describe in serial mode selects the WHOLE
|
|
2534
|
+
// group, in file order. The expansion joins the graded set too — an
|
|
2535
|
+
// added step's own claims are graded like any selected test's, and a
|
|
2536
|
+
// step that declares nothing contributes nothing. A full run already
|
|
2537
|
+
// selects everything; a re-seal replays the parent receipt's own
|
|
2538
|
+
// file-scoped plan; a non-Playwright runner has no serial scopes; and
|
|
2539
|
+
// a spec that declares nothing serial expands nothing.
|
|
2540
|
+
const serialExpansion = runnerName === 'playwright' &&
|
|
2541
|
+
catalog !== null &&
|
|
2542
|
+
reSealPlan === null &&
|
|
2543
|
+
(namedSelections !== null || options.scope === 'changed')
|
|
2544
|
+
? expandSerialSelection({
|
|
2545
|
+
cwd: io.cwd,
|
|
2546
|
+
rows: plannedRows,
|
|
2547
|
+
allRows: allPlannedRows,
|
|
2548
|
+
lineOf: catalogLineOf(catalog),
|
|
2549
|
+
})
|
|
2550
|
+
: null;
|
|
2551
|
+
if (serialExpansion !== null && serialExpansion.addedLogicalKeys.length > 0) {
|
|
2552
|
+
plannedRows = serialExpansion.rows;
|
|
2553
|
+
if (namedTestIds !== null) {
|
|
2554
|
+
namedTestIds = [...new Set([...namedTestIds, ...serialExpansion.addedLogicalKeys])].sort();
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
const serialExpansionRecords = serialExpansion?.expansions ?? [];
|
|
2474
2558
|
// What the SELECTION declares, through EITHER surface: the trusted
|
|
2475
2559
|
// mapping resolution's bindings (the sidecar) or the current claim
|
|
2476
2560
|
// declarations of the selected tests (native Playwright annotations
|
|
@@ -2510,17 +2594,6 @@ async function runSupervisedTestGatesInner(io, options, declaredRunnerEnvNames)
|
|
|
2510
2594
|
}
|
|
2511
2595
|
return [...declared].sort();
|
|
2512
2596
|
})();
|
|
2513
|
-
if (namedSelections !== null) {
|
|
2514
|
-
const named = new Set(namedTestIds ?? []);
|
|
2515
|
-
plannedRows = plannedRows.filter((row) => named.has(row.planned.logicalKey));
|
|
2516
|
-
// A test this run did not execute can never have produced
|
|
2517
|
-
// evidence, so a claim row alone proves nothing: the graded SET is
|
|
2518
|
-
// `namedObligationIds` below, and the declaration inventory stays
|
|
2519
|
-
// whole. (A per-test filter here would silently drop a
|
|
2520
|
-
// declaration whose source location a sibling declaration in the
|
|
2521
|
-
// same file already occupies — the inventory is deduplicated per
|
|
2522
|
-
// source location, not per test.)
|
|
2523
|
-
}
|
|
2524
2597
|
// Dependency closure for a NARROWED plan (`--scope changed` or
|
|
2525
2598
|
// `--test`): Playwright runs a dependency project's tests before the
|
|
2526
2599
|
// dependent project, so a plan that selected only a `chromium` test
|
|
@@ -2556,6 +2629,15 @@ async function runSupervisedTestGatesInner(io, options, declaredRunnerEnvNames)
|
|
|
2556
2629
|
? `scope: changed (${plannedRows.length} tests) — ${providerChangedFiles.length} changed files (provider: ${providerIdentity})`
|
|
2557
2630
|
: `scope: full (${fullPlannedCount} planned tests) — add --scope changed for the ${affectedTestCount} tests affected by ${providerChangedFiles.length} changed files (provider: ${providerIdentity})`);
|
|
2558
2631
|
}
|
|
2632
|
+
// Serial-group selection: the run names each expansion on the
|
|
2633
|
+
// narration stream (stderr in every format — stdout stays pure json
|
|
2634
|
+
// under `--format json`), so the growth beyond the named or mapped
|
|
2635
|
+
// rows is on the record in plain words, and in the report's additive
|
|
2636
|
+
// `serialExpansions` field.
|
|
2637
|
+
for (const expansion of serialExpansionRecords) {
|
|
2638
|
+
const group = expansion.describe === null ? 'the file-level serial scope' : `serial group '${expansion.describe}'`;
|
|
2639
|
+
io.stderr.write(`selection: added ${String(expansion.added)} test${expansion.added === 1 ? '' : 's'} of ${group} (${expansion.file})\n`);
|
|
2640
|
+
}
|
|
2559
2641
|
const inventoryBlocking = discoveryError !== null
|
|
2560
2642
|
? [
|
|
2561
2643
|
{
|
|
@@ -3684,6 +3766,7 @@ async function runSupervisedTestGatesInner(io, options, declaredRunnerEnvNames)
|
|
|
3684
3766
|
...(runTimeoutMs !== undefined ? { timeoutMs: runTimeoutMs } : {}),
|
|
3685
3767
|
...(stallTimeoutMs !== undefined ? { stallTimeoutMs } : {}),
|
|
3686
3768
|
...(expectTimeoutMs !== undefined ? { expectTimeoutMs } : {}),
|
|
3769
|
+
...(trace !== undefined ? { trace } : {}),
|
|
3687
3770
|
activity: runActivity,
|
|
3688
3771
|
},
|
|
3689
3772
|
})
|
|
@@ -4952,6 +5035,10 @@ async function runSupervisedTestGatesInner(io, options, declaredRunnerEnvNames)
|
|
|
4952
5035
|
diagnosticContext,
|
|
4953
5036
|
...(options.resultOnly ? { outcome: 'partial-selection' } : {}),
|
|
4954
5037
|
...(namedSelections !== null ? { selectors: namedSelections } : {}),
|
|
5038
|
+
// Serial-group selection (additive): what each expansion added, so
|
|
5039
|
+
// the report says out loud that the selection grew beyond the named
|
|
5040
|
+
// or mapped rows. Empty adds no key.
|
|
5041
|
+
...(serialExpansionRecords.length === 0 ? {} : { serialExpansions: serialExpansionRecords }),
|
|
4955
5042
|
...(chaosRun === null
|
|
4956
5043
|
? {}
|
|
4957
5044
|
: { chaos: { ...chaosRun, ...(chaosSchedule === null ? {} : { schedule: chaosSchedule }) } }),
|
|
@@ -4977,6 +5064,7 @@ async function runSupervisedTestGatesInner(io, options, declaredRunnerEnvNames)
|
|
|
4977
5064
|
diagnosticContext,
|
|
4978
5065
|
...(options.resultOnly ? { outcome: 'partial-selection' } : {}),
|
|
4979
5066
|
...(namedSelections !== null ? { selectors: namedSelections } : {}),
|
|
5067
|
+
...(serialExpansionRecords.length === 0 ? {} : { serialExpansions: serialExpansionRecords }),
|
|
4980
5068
|
...(chaosRun === null
|
|
4981
5069
|
? {}
|
|
4982
5070
|
: { chaos: { ...chaosRun, ...(chaosSchedule === null ? {} : { schedule: chaosSchedule }) } }),
|