@smoothbricks/nx-plugin 0.5.3 → 0.5.4

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 CHANGED
@@ -1328,13 +1328,27 @@ result line or dot. Output that finishes no test is not progress: nextest's `SLO
1328
1328
  period for a test still running, and a hung test's heartbeat both keep printing. A suite that keeps finishing tests
1329
1329
  therefore runs as long as it needs, however slow the host, and a test that never returns ends the run 180 s after the
1330
1330
  last test that finished. bun prints nothing per passing test when it believes an agent runs it, so the executor asks a
1331
- lone `bun test` for `--dots`, one dot per finished test. A command that reports no tests makes progress only by exiting.
1332
- nextest's slow-timeout and the serial groups' code-time classes only warn; no per-test bound kills a test or fails one
1333
- that passed. Bun has a per-test deadline of its own, 5000 ms unless the command sets one, and it reads no bunfig for it,
1334
- so every bun leg deletes it with `bun test --timeout=0` (`BUN_TEST_TIMEOUT_FLAG`; `0` means no deadline, measured on the
1335
- pinned Bun 1.4.2). A test waits for the event it is waiting for, however long a loaded host makes the work take; one
1336
- that never returns still ends the run through `idleTimeoutMs`. `timeoutMs`, an absolute ceiling, is for commands that
1337
- report no tests; a target names at least one of the two.
1331
+ lone `bun test` for `--dots`, one dot per finished test. Without a recognised execution lifecycle, the clock starts at
1332
+ command spawn; a command that reports no tests makes progress only by exiting. nextest's slow-timeout and the serial
1333
+ groups' code-time classes only warn; no per-test bound kills a test or fails one that passed. Bun has a per-test
1334
+ deadline of its own, 5000 ms unless the command sets one, and it reads no bunfig for it, so every bun leg deletes it
1335
+ with `bun test --timeout=0` (`BUN_TEST_TIMEOUT_FLAG`; `0` means no deadline, measured on the pinned Bun 1.4.2). A test
1336
+ waits for the event it is waiting for, however long a loaded host makes the work take; one that never returns still ends
1337
+ the run through `idleTimeoutMs`. `timeoutMs`, an absolute ceiling, is for commands that report no tests; a target names
1338
+ at least one of the two.
1339
+
1340
+ Direct `go test` invocations, including sequential `&&`, `||`, and `;` chains, are requested with `-json`. Go emits a
1341
+ package's `Action:start` only after its build dependencies settle; a package terminal (`pass`, `fail`, or `skip`) ends
1342
+ that execution interval. The unchanged idle bound runs while any package is executing, re-arms on test/package
1343
+ completion, and stops when none is executing. Initial linking and inter-package compilation therefore spend no test idle
1344
+ budget, while a stuck test or `TestMain` still expires after 180 s without a completion. `output`, `build-output`,
1345
+ pause/continue events, and arbitrary compiler activity are not progress. Mixed runner commands and unknown wrappers keep
1346
+ the existing spawn-based clock; Bun and Rust fixture compilation inside an active test gets no exemption.
1347
+
1348
+ Process-group timeout fixtures retain cleanup authority only until the command leader exits and every descendant closes
1349
+ its inherited lifetime FIFO. EOF is the terminal ownership event; a later `afterEach` must not signal the retired PGID
1350
+ again. Darwin can answer `EPERM` for an unreaped zombie-only group, and an ambient `ps` scan is not an ownership proof.
1351
+ Failed fixtures retain their cleanup obligation rather than suppressing signal errors.
1338
1352
 
1339
1353
  A job waiting for a CPU token is queued, not idle. A descendant whose own work waits in the host's CPU queue (a test's
1340
1354
  scratch cowshed project, say) writes `{"op":"host-wait"}` on the `BOUNDED_EXEC_CPU_POOL` it inherited and holds the
@@ -62,6 +62,19 @@ type WorkerFlagKind = 'stryker' | 'vitest' | 'go-test';
62
62
  * configured counts may only lower them.
63
63
  */
64
64
  export declare function runnerDemand(command: string, declared: number | undefined, cores: number, inherited: Readonly<NodeJS.ProcessEnv>, configured?: Readonly<NodeJS.ProcessEnv>): Demand;
65
+ /**
66
+ * Where `invocation` ends in `command`, and where its own arguments end: the next `;`, `&`, `|`, `(` or `)` outside
67
+ * quotes and `$(…)`.
68
+ */
69
+ export declare function invocationSpan(command: string, invocation: RegExp): {
70
+ end: number;
71
+ argsEnd: number;
72
+ };
73
+ /**
74
+ * `command` with every `flag` in `invocation`'s own arguments replaced by `value`; when it names none, `value` is
75
+ * added right after the invocation if `add` says so.
76
+ */
77
+ export declare function withInvocationFlag(command: string, invocation: RegExp, flag: RegExp, value: string, add: boolean): string;
65
78
  /**
66
79
  * Size the runner to the lesser of its bounded demand and grant, keeping the test-thread ceilings. Rewrite named flags
67
80
  * so they cannot outrank that size. `CPU_TOKENS_ENV` still reports the actual held grant.
@@ -1 +1 @@
1
- {"version":3,"file":"cpu-tokens.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/cpu-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnF;;;;;;;;;;GAUG;AAEH,kGAAkG;AAClG,MAAM,MAAM,UAAU;AACpB,mFAAmF;AACjF,SAAS;AACX,mDAAmD;GACjD,cAAc;AAChB,2EAA2E;GACzE,cAAc;AAChB,yHAAyH;GACvH,eAAe;AACjB,kGAAkG;GAChG,OAAO;AACT,2FAA2F;GACzF,SAAS,CAAC;AAEd;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,MAAM,MAAM,GACd;IAAE,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,kBAAkB,CAAA;CAAE,GAC5E;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvF,kGAAkG;AAClG,eAAO,MAAM,cAAc,4BAA4B,CAAC;AAkBxD,KAAK,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AA+CvD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GAAG,SA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import { BUN_TEST, NEXTEST_RUN } from './verdict.js';
2
+ import { BUN_TEST, GO_TEST, NEXTEST_RUN } from './verdict.js';
3
3
  /** Every budgeted command learns its grant here, so a script that starts a runner can size it. */
4
4
  export const CPU_TOKENS_ENV = 'BOUNDED_EXEC_CPU_TOKENS';
5
5
  const CARGO_BUILD = /(?<=^|[\s;&|()])(?:cargo(?:\s+-\S+)*\s+(?:build|test|check|clippy|rustc|doc|run|nextest\s+archive)|napi\s+build)(?=\s|$)/;
@@ -36,7 +36,7 @@ const WORKER_FLAGS = {
36
36
  },
37
37
  /** `go test -p`: packages built and tested at once, `GOMAXPROCS` by default, normally one per core. */
38
38
  'go-test': {
39
- invocation: /(?<=^|[\s;&|()])go\s+test(?=\s|$)/,
39
+ invocation: GO_TEST,
40
40
  flag: new RegExp(String.raw `(?<![\w-])-p(?:=|\s+)${WORD}`, 'g'),
41
41
  sized: (count) => `-p=${count}`,
42
42
  ownDefault: (cores, env) => parseInheritedTokens(env.GOMAXPROCS) ?? cores,
@@ -148,7 +148,7 @@ function namedCounts(text, flag) {
148
148
  * Where `invocation` ends in `command`, and where its own arguments end: the next `;`, `&`, `|`, `(` or `)` outside
149
149
  * quotes and `$(…)`.
150
150
  */
151
- function invocationSpan(command, invocation) {
151
+ export function invocationSpan(command, invocation) {
152
152
  const found = invocation.exec(command);
153
153
  const end = found === null ? command.length : found.index + found[0].length;
154
154
  let quote = null;
@@ -179,13 +179,13 @@ function invocationArgs(command, invocation) {
179
179
  return command.slice(end, argsEnd);
180
180
  }
181
181
  /**
182
- * `command` with every `flag` in `invocation`'s own arguments replaced by `sized`; when it names none, `sized` is
182
+ * `command` with every `flag` in `invocation`'s own arguments replaced by `value`; when it names none, `value` is
183
183
  * added right after the invocation if `add` says so.
184
184
  */
185
- function withSizedFlag(command, invocation, flag, sized, add) {
185
+ export function withInvocationFlag(command, invocation, flag, value, add) {
186
186
  const { end, argsEnd } = invocationSpan(command, invocation);
187
187
  const args = command.slice(end, argsEnd);
188
- const sizedArgs = args.search(flag) === -1 && add ? ` ${sized}${args}` : args.replace(flag, sized);
188
+ const sizedArgs = args.search(flag) === -1 && add ? ` ${value}${args}` : args.replace(flag, value);
189
189
  return `${command.slice(0, end)}${sizedArgs}${command.slice(argsEnd)}`;
190
190
  }
191
191
  /**
@@ -226,7 +226,7 @@ export function sizeRunner(demand, command, tokens) {
226
226
  case 'go-test': {
227
227
  const runner = WORKER_FLAGS[demand.kind];
228
228
  return {
229
- command: withSizedFlag(command, runner.invocation, runner.flag, runner.sized(runnerCount), true),
229
+ command: withInvocationFlag(command, runner.invocation, runner.flag, runner.sized(runnerCount), true),
230
230
  env: { [CPU_TOKENS_ENV]: held },
231
231
  };
232
232
  }
@@ -235,9 +235,9 @@ export function sizeRunner(demand, command, tokens) {
235
235
  // `--jobs` is lowered only where it was set: cargo-mutants refuses it beside `--in-place`.
236
236
  const jobs = Math.min(demand.jobs, runnerCount);
237
237
  const share = String(Math.max(1, Math.floor(runnerCount / jobs)));
238
- const tasks = withSizedFlag(command, CARGO_MUTANTS, JOBSERVER_TASKS, `--jobserver-tasks=${count}`, true);
238
+ const tasks = withInvocationFlag(command, CARGO_MUTANTS, JOBSERVER_TASKS, `--jobserver-tasks=${count}`, true);
239
239
  return {
240
- command: withSizedFlag(tasks, CARGO_MUTANTS, MUTANTS_JOBS, `--jobs=${jobs}`, false),
240
+ command: withInvocationFlag(tasks, CARGO_MUTANTS, MUTANTS_JOBS, `--jobs=${jobs}`, false),
241
241
  env: {
242
242
  [CPU_TOKENS_ENV]: held,
243
243
  ...(demand.jobs > 1 ? { CARGO_MUTANTS_JOBS: String(jobs) } : {}),
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/executor.ts"],"names":[],"mappings":"AAMA,OAAO,EAKL,KAAK,gBAAgB,EAGtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,iBAAiB,CAAC;AAEzB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GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAOzB,GACA,MAAM,GAAG,SAAS,CAiBpB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,iBAAiB,CAAC,CAE5B;AAED,mGAAmG;AACnG,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CA2B5B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,kBAAkB,CAiBxE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,iBAAiB,EACzB,UAAU,EAAE,UAAU,GAAG,IAAI,EAC7B,MAAM,EAAE,SAAS,GAAG,IAAI,EACxB,SAAS,GAAE,gBAAgB,GAAG,IAAW,EACzC,kBAAkB,GAAE,OAAO,sBAA+C,GACzE,OAAO,CAAC,iBAAiB,CAAC,CA6jB5B;AAED,wBAAgB,uBAAuB,IAAI,iBAAiB,CAM3D"}
@@ -343,7 +343,7 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
343
343
  return refuse(`cowshed: could not start the command: ${error instanceof Error ? error.message : String(error)}\n`);
344
344
  }
345
345
  // Progress is a finished test, not output: a runner's SLOW warnings and a hung test's heartbeat keep printing.
346
- const progress = createRunProgress();
346
+ const progress = createRunProgress(command);
347
347
  // A write that found no space is said once, in the output, by whatever made it; the volume is read when it is said,
348
348
  // since the writer usually removes what it half-wrote before it exits and the volume no longer looks full by then.
349
349
  const noSpace = createNoSpaceWatch();
@@ -405,7 +405,7 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
405
405
  idleTimer = setTimeout(() => expire({ kind: 'idle', limitMs, tests: progress.inFlight() }, queuedMs), leftMs);
406
406
  };
407
407
  const armIdleTimer = () => {
408
- if (idleTimeoutMs === undefined || state.settled || state.expiry !== null) {
408
+ if (idleTimeoutMs === undefined || state.settled || state.expiry !== null || !progress.isTesting()) {
409
409
  return;
410
410
  }
411
411
  idleLeftMs = idleTimeoutMs;
@@ -438,6 +438,10 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
438
438
  const waitedMs = Date.now() - queuedSinceMs;
439
439
  queuedMs += waitedMs;
440
440
  queuedSinceMs = null;
441
+ if (!progress.isTesting()) {
442
+ appendStderr(`bounded-exec: host CPU wait ended after ${waitedMs}ms; no test runner is active\n`);
443
+ return;
444
+ }
441
445
  appendStderr(`bounded-exec: idle clock restarted: no descendant's work is queued for host CPU tokens after ${waitedMs}ms; ${idleLeftMs}ms of idleTimeoutMs=${idleTimeoutMs} left\n`);
442
446
  scheduleIdle(idleTimeoutMs, idleLeftMs);
443
447
  },
@@ -445,10 +449,21 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
445
449
  // Only the CHILD's own output is read for progress. The diagnostics below go
446
450
  // through appendStderr as well, and re-arming on those would let a teardown
447
451
  // message extend the very bound that just fired.
452
+ const scanProgress = (stream, text) => {
453
+ const wasTesting = progress.isTesting();
454
+ const finished = progress.scan(stream, text);
455
+ if (!progress.isTesting()) {
456
+ clearTimeout(idleTimer);
457
+ cancelCapture();
458
+ idleCapture = undefined;
459
+ }
460
+ else if (finished || !wasTesting) {
461
+ armIdleTimer();
462
+ }
463
+ };
448
464
  child.stdout?.on('data', (chunk) => {
449
465
  const text = chunk.toString();
450
- if (progress.scan('stdout', text))
451
- armIdleTimer();
466
+ scanProgress('stdout', text);
452
467
  const said = noSpace.scan('stdout', text);
453
468
  if (said !== null)
454
469
  state.noSpace = sight(said);
@@ -456,8 +471,7 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
456
471
  });
457
472
  child.stderr?.on('data', (chunk) => {
458
473
  const text = chunk.toString();
459
- if (progress.scan('stderr', text))
460
- armIdleTimer();
474
+ scanProgress('stderr', text);
461
475
  const said = noSpace.scan('stderr', text);
462
476
  if (said !== null)
463
477
  state.noSpace = sight(said);
@@ -15,17 +15,22 @@
15
15
  * - bun: a line of dots, one per test finished (`--dots`, which `withProgressReport` asks for: bun prints nothing
16
16
  * per passing test when it believes an agent runs it), or a `(pass)`/`(fail)`/`(skip)`/`(todo)` line. bun names
17
17
  * no test before it finishes, so a bun run names nothing in flight.
18
+ * - go: structured `go test -json` package `start` follows the package's build dependencies; package `pass`,
19
+ * `fail`, or `skip` ends that execution interval. Test terminals re-arm the bound, but `output` and
20
+ * `build-output` never do. Initial and inter-package builds are outside an active test interval.
18
21
  *
19
- * A command that reports no tests makes progress only by exiting.
22
+ * A command without a recognised execution lifecycle remains bounded from spawn.
20
23
  */
21
24
  export interface RunProgress {
22
- /** One chunk of one of the command's output streams; true when it reports at least one finished test. */
25
+ /** One chunk of one of the command's output streams; true when it reports a finished test or Go package. */
23
26
  scan(stream: OutputStream, chunk: string): boolean;
24
27
  /** The tests the runner reported running and has not reported finished, in the order it first named them. */
25
28
  inFlight(): string[];
29
+ /** Whether test idle time is currently chargeable; unknown runner lifecycles stay chargeable. */
30
+ isTesting(): boolean;
26
31
  }
27
32
  export type OutputStream = 'stdout' | 'stderr';
28
- export declare function createRunProgress(): RunProgress;
33
+ export declare function createRunProgress(command?: string): RunProgress;
29
34
  /**
30
35
  * `command` with its one `bun test` asked for a line of dots, one per finished test: the only per-test report bun
31
36
  * prints whoever runs it. A command that runs no bun, more than one runner, or already chose bun's dots is returned
@@ -1 +1 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/progress.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,WAAW;IAC1B,yGAAyG;IACzG,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACnD,6GAA6G;IAC7G,QAAQ,IAAI,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAsB/C,wBAAgB,iBAAiB,IAAI,WAAW,CAoD/C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAO1D"}
1
+ {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/progress.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,WAAW;IAC1B,4GAA4G;IAC5G,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACnD,6GAA6G;IAC7G,QAAQ,IAAI,MAAM,EAAE,CAAC;IACrB,iGAAiG;IACjG,SAAS,IAAI,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAqD/C,wBAAgB,iBAAiB,CAAC,OAAO,SAAK,GAAG,WAAW,CAqF3D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAmB1D"}
@@ -1,4 +1,6 @@
1
- import { BUN_TEST, NEXTEST_RUN } from './verdict.js';
1
+ import typia from 'typia';
2
+ import { invocationSpan, withInvocationFlag } from './cpu-tokens.js';
3
+ import { BUN_TEST, GO_TEST, NEXTEST_RUN } from './verdict.js';
2
4
  const ANSI = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*[A-Za-z]`, 'g');
3
5
  /** Lines naming a test that finished; group 1 is its name. */
4
6
  const FINISHED = [
@@ -12,14 +14,90 @@ const RUNNING = [
12
14
  /^test (\S+) has been running for over \d+ seconds$/,
13
15
  ];
14
16
  const DOTS = /^\.+$/;
15
- export function createRunProgress() {
17
+ const isGoTestEvent = (() => {
18
+ const _ip0 = input => "string" === typeof input["Package"];
19
+ const _ip1 = input => undefined === input["Test"] || "string" === typeof input["Test"];
20
+ const _io0 = input => "start" === input.Action && _ip0(input);
21
+ const _io1 = input => ("cont" === input.Action || "pause" === input.Action || "run" === input.Action) && _ip0(input) && "string" === typeof input.Test;
22
+ const _io2 = input => ("bench" === input.Action || "fail" === input.Action || "pass" === input.Action || "skip" === input.Action) && _ip0(input) && _ip1(input);
23
+ const _io3 = input => "output" === input.Action && _ip0(input) && "string" === typeof input.Output && _ip1(input);
24
+ const _iu0 = input => (() => {
25
+ if ("start" === input.Action)
26
+ return _io0(input);
27
+ else if ("bench" === input.Action || "fail" === input.Action || "pass" === input.Action || "skip" === input.Action)
28
+ return _io2(input);
29
+ else if ("cont" === input.Action || "pause" === input.Action || "run" === input.Action)
30
+ return _io1(input);
31
+ else if ("output" === input.Action)
32
+ return _io3(input);
33
+ else
34
+ return false;
35
+ })();
36
+ return input => "object" === typeof input && null !== input && _iu0(input);
37
+ })();
38
+ function goTestEvent(text) {
39
+ if (!text.startsWith('{'))
40
+ return null;
41
+ try {
42
+ const event = JSON.parse(text);
43
+ return isGoTestEvent(event) ? event : null;
44
+ }
45
+ catch (error) {
46
+ if (error instanceof SyntaxError)
47
+ return null;
48
+ throw error;
49
+ }
50
+ }
51
+ /** Defer only a direct Go command/chain; an unknown shell wrapper or another runner keeps its existing bound. */
52
+ function onlyGoTests(command) {
53
+ let rest = command.trim();
54
+ while (rest.search(GO_TEST) === 0) {
55
+ rest = rest.slice(invocationSpan(rest, GO_TEST).argsEnd).trimStart();
56
+ if (rest === '')
57
+ return true;
58
+ const separator = /^(?:&&|\|\||;)\s*/.exec(rest);
59
+ if (separator === null)
60
+ return false;
61
+ rest = rest.slice(separator[0].length);
62
+ }
63
+ return false;
64
+ }
65
+ export function createRunProgress(command = '') {
66
+ const goLifecycle = onlyGoTests(command);
16
67
  const streams = {
17
68
  stdout: { partial: '', countedDots: 0 },
18
69
  stderr: { partial: '', countedDots: 0 },
19
70
  };
20
71
  const running = new Set();
72
+ const packages = new Map();
21
73
  // One complete line, ANSI stripped, that is not a line of dots: true when it names a finished test.
22
74
  const finishedLine = (text) => {
75
+ const event = goTestEvent(text);
76
+ if (event !== null) {
77
+ switch (event.Action) {
78
+ case 'start':
79
+ packages.set(event.Package, new Set());
80
+ return false;
81
+ case 'run':
82
+ packages.get(event.Package)?.add(event.Test);
83
+ return false;
84
+ case 'pass':
85
+ case 'fail':
86
+ case 'skip':
87
+ case 'bench':
88
+ if (event.Test === undefined)
89
+ packages.delete(event.Package);
90
+ else
91
+ packages.get(event.Package)?.delete(event.Test);
92
+ return true;
93
+ case 'pause':
94
+ case 'cont':
95
+ case 'output':
96
+ return false;
97
+ }
98
+ }
99
+ if (goLifecycle)
100
+ return false;
23
101
  for (const pattern of FINISHED) {
24
102
  const name = pattern.exec(text)?.[1];
25
103
  if (name !== undefined) {
@@ -47,7 +125,9 @@ export function createRunProgress() {
47
125
  for (const raw of lines) {
48
126
  const text = raw.replace(ANSI, '').trimEnd();
49
127
  if (DOTS.test(text)) {
50
- progressed ||= text.length > counted;
128
+ if (!goLifecycle && DOTS.test(text)) {
129
+ progressed ||= text.length > counted;
130
+ }
51
131
  }
52
132
  else if (finishedLine(text)) {
53
133
  progressed = true;
@@ -55,13 +135,17 @@ export function createRunProgress() {
55
135
  counted = 0;
56
136
  }
57
137
  const tail = rest.replace(ANSI, '');
58
- const dots = DOTS.test(tail) ? tail.length : 0;
138
+ const dots = !goLifecycle && DOTS.test(tail) ? tail.length : 0;
59
139
  progressed ||= dots > counted;
60
140
  state.partial = rest;
61
141
  state.countedDots = dots;
62
142
  return progressed;
63
143
  },
64
- inFlight: () => [...running],
144
+ inFlight: () => [
145
+ ...running,
146
+ ...[...packages].flatMap(([name, tests]) => tests.size === 0 ? [name] : [...tests].map((test) => `${name} ${test}`)),
147
+ ],
148
+ isTesting: () => !goLifecycle || packages.size > 0,
65
149
  };
66
150
  }
67
151
  /**
@@ -70,10 +154,16 @@ export function createRunProgress() {
70
154
  * unchanged.
71
155
  */
72
156
  export function withProgressReport(command) {
73
- const bun = command.match(BUN_TEST)?.length ?? 0;
74
- const nextest = command.match(NEXTEST_RUN)?.length ?? 0;
75
- if (bun !== 1 || nextest !== 0 || /(?:^|\s)(?:--dots|--reporter[=\s]dots)(?=\s|$)/.test(command)) {
76
- return command;
157
+ let reported = command;
158
+ for (const match of [...command.matchAll(new RegExp(GO_TEST, 'g'))].reverse()) {
159
+ reported =
160
+ reported.slice(0, match.index) +
161
+ withInvocationFlag(reported.slice(match.index), GO_TEST, /(?<![\w-])-json(?:=(?:true|false))?(?=\s|$)/g, '-json', true);
162
+ }
163
+ const bun = reported.match(BUN_TEST)?.length ?? 0;
164
+ const nextest = reported.match(NEXTEST_RUN)?.length ?? 0;
165
+ if (bun !== 1 || nextest !== 0 || /(?:^|\s)(?:--dots|--reporter[=\s]dots)(?=\s|$)/.test(reported)) {
166
+ return reported;
77
167
  }
78
- return command.replace(BUN_TEST, (_match, runtime) => `${runtime} test --dots`);
168
+ return reported.replace(BUN_TEST, (_match, runtime) => `${runtime} test --dots`);
79
169
  }
@@ -5,10 +5,10 @@
5
5
  * - `bound`: the run hit a wall-clock bound and nothing else failed. Either the command
6
6
  * outlived `timeoutMs` (`total`), or every failing test in the runner's report failed on
7
7
  * its runner's per-test timeout (`test`). A loaded host produces exactly these.
8
- * - `wedged`: `idleTimeoutMs` fired: no test finished for that long. A machine that is only slow still finishes
9
- * tests, so this is a hang, not a slow host, and the fix is the opposite one, so it is never a `bound`. It names
10
- * the tests still running: those the runner said were running and never said finished, and those its report says
11
- * it aborted when the bound stopped it.
8
+ * - `wedged`: `idleTimeoutMs` fired: no test finished for that long during a chargeable test interval. This proves
9
+ * the suite's completion bound was exceeded, not that every process stopped: an expensive active fixture can
10
+ * exceed it too. The verdict names tests reported running but never finished and tests the report says were
11
+ * aborted; diagnostics distinguish a stalled wait from a progressing but oversized lifecycle.
12
12
  * - `no-space`: the run failed and its output said a write found no space (ENOSPC). Whatever its tests then reported,
13
13
  * they failed on the disk, not on their own: the verdict names the line that said so and, when the task held one,
14
14
  * its RAM temp volume as it stood when that line arrived.
@@ -147,6 +147,7 @@ export declare const JUNIT_FILE = "report.xml";
147
147
  */
148
148
  export declare const BUN_TEST: RegExp;
149
149
  export declare const NEXTEST_RUN: RegExp;
150
+ export declare const GO_TEST: RegExp;
150
151
  /**
151
152
  * `command` with its test runner asked to write a JUnit report into `directory`, the report
152
153
  * `judgeRun` reads. Both runners are recognised by their invocation, so every target that runs
@@ -1 +1 @@
1
- {"version":3,"file":"verdict.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/verdict.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC5G;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACxF;IACE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,GACD,CAAC;IAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG,eAAe,CAAC,GAClH;IAAE,QAAQ,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@@ const NEXTEST_REPORT_CONFIG_FILE = 'nextest-report.toml';
157
157
  */
158
158
  export const BUN_TEST = /(?<=^|[\s;&|()])((?:[^\s;&|()<>'"`\\=]*\/)?bun)\s+test(?=\s|$)/g;
159
159
  export const NEXTEST_RUN = /(?<=^|[\s;&|()-])nextest\s+run(?=\s|$)/g;
160
+ export const GO_TEST = /(?<=^|[\s;&|()])go\s+test(?=\s|$)/;
160
161
  /**
161
162
  * `command` with its test runner asked to write a JUnit report into `directory`, the report
162
163
  * `judgeRun` reads. Both runners are recognised by their invocation, so every target that runs
package/dist/testing.js CHANGED
@@ -145,7 +145,7 @@ export async function pidsWorkingIn(root) {
145
145
  for (const pid of (await readdir('/proc')).filter((name) => /^\d+$/.test(name))) {
146
146
  const cwd = await readlink(`/proc/${pid}/cwd`).catch((error) => {
147
147
  // Another user's process, or one that exited since the listing.
148
- if (errorCode(error) === 'EACCES' || errorCode(error) === 'ENOENT') {
148
+ if (errorCode(error) === 'EACCES' || errorCode(error) === 'ENOENT' || errorCode(error) === 'ESRCH') {
149
149
  return null;
150
150
  }
151
151
  throw error;
@@ -67,6 +67,32 @@ index 5a59f762f2002f61f84d0966c8fb48d48b3bdce2..f190d2b93cc7c1d0f59dcb1e76ef7d3e
67
67
  function handleNoWorkspace(globalNxVersion) {
68
68
  output_1.output.log({
69
69
  title: `The current directory isn't part of an Nx workspace.`,
70
+ diff --git a/dist/src/command-line/daemon/daemon.js b/dist/src/command-line/daemon/daemon.js
71
+ index 237830c6863aa8c5bdab8c4794c6fc9f1e4a48b5..857a97118d646f25f61696b2db672de56f558327 100644
72
+ --- a/dist/src/command-line/daemon/daemon.js
73
+ +++ b/dist/src/command-line/daemon/daemon.js
74
+ @@ -7,6 +7,21 @@ const handle_import_1 = require("../../utils/handle-import");
75
+ const output_1 = require("../../utils/output");
76
+ async function daemonHandler(args) {
77
+ const { daemonClient } = await (0, handle_import_1.handleImport)('../../daemon/client/client.js', __dirname);
78
+ + if (args.start && process.env.NX_DAEMON_START === 'never') {
79
+ + // An explicit start is a start: under the rule every cowshed job runs
80
+ + // with, it is refused as policy, never quietly honoured, or one command
81
+ + // would recreate the daemon that outlives its job.
82
+ + output_1.output.error({
83
+ + title: 'Nx daemon not started: NX_DAEMON_START=never forbids this client starting a daemon',
84
+ + bodyLines: [
85
+ + 'Every cowshed job runs under it, so no daemon outlives the job that started it.',
86
+ + "The checkout's daemon is its keeper's to start. A test that must start its own daemon runs that one nx",
87
+ + 'without NX_DAEMON_START, through its named fixture escape (FIXTURE_STARTS_ITS_OWN_DAEMON).',
88
+ + ],
89
+ + });
90
+ + // The handler's number is the command's exit code (handleErrors).
91
+ + return 1;
92
+ + }
93
+ if (args.start) {
94
+ const pid = await daemonClient.startInBackground();
95
+ output_1.output.log({
70
96
  diff --git a/dist/src/command-line/release/version/version-actions.js b/dist/src/command-line/release/version/version-actions.js
71
97
  index 006c077033a6e92a8bdcc6c732110736fb465b5a..2ac4a0252c813cec5492b7ac83e2d5160b97bc32 100644
72
98
  --- a/dist/src/command-line/release/version/version-actions.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smoothbricks/nx-plugin",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "./loader.js",
@@ -263,7 +263,7 @@
263
263
  }
264
264
  ],
265
265
  "options": {
266
- "command": "bun test --timeout=0 ./src/executors/bounded-exec/ram-temp-host.test.ts ./src/executors/bounded-exec/executor-host.test.ts",
266
+ "command": "bun test --timeout=0 ./src/executors/bounded-exec/ram-temp-host.test.ts ./src/executors/bounded-exec/executor-host.test.ts ./src/executors/bounded-exec/go-progress-host.test.ts",
267
267
  "cwd": "{projectRoot}",
268
268
  "env": {
269
269
  "COWSHED_EXECUTABLE": "{workspaceRoot}/packages/cowshed/bin/cowshed"
@@ -1,5 +1,5 @@
1
1
  import { GATEWAY_SOCKET, holdLease, type UnleasedCause } from './gateway-lease.js';
2
- import { BUN_TEST, NEXTEST_RUN } from './verdict.js';
2
+ import { BUN_TEST, GO_TEST, NEXTEST_RUN } from './verdict.js';
3
3
 
4
4
  /**
5
5
  * The client half of cowshed's host CPU budget (specs/cowshed/05_gateway.md, "Host CPU budget").
@@ -105,7 +105,7 @@ const WORKER_FLAGS: Readonly<Record<WorkerFlagKind, WorkerFlag>> = {
105
105
  },
106
106
  /** `go test -p`: packages built and tested at once, `GOMAXPROCS` by default, normally one per core. */
107
107
  'go-test': {
108
- invocation: /(?<=^|[\s;&|()])go\s+test(?=\s|$)/,
108
+ invocation: GO_TEST,
109
109
  flag: new RegExp(String.raw`(?<![\w-])-p(?:=|\s+)${WORD}`, 'g'),
110
110
  sized: (count) => `-p=${count}`,
111
111
  ownDefault: (cores, env) => parseInheritedTokens(env.GOMAXPROCS) ?? cores,
@@ -236,7 +236,7 @@ function namedCounts(text: string, flag: RegExp): number[] {
236
236
  * Where `invocation` ends in `command`, and where its own arguments end: the next `;`, `&`, `|`, `(` or `)` outside
237
237
  * quotes and `$(…)`.
238
238
  */
239
- function invocationSpan(command: string, invocation: RegExp): { end: number; argsEnd: number } {
239
+ export function invocationSpan(command: string, invocation: RegExp): { end: number; argsEnd: number } {
240
240
  const found = invocation.exec(command);
241
241
  const end = found === null ? command.length : found.index + found[0].length;
242
242
  let quote: string | null = null;
@@ -265,13 +265,19 @@ function invocationArgs(command: string, invocation: RegExp): string {
265
265
  }
266
266
 
267
267
  /**
268
- * `command` with every `flag` in `invocation`'s own arguments replaced by `sized`; when it names none, `sized` is
268
+ * `command` with every `flag` in `invocation`'s own arguments replaced by `value`; when it names none, `value` is
269
269
  * added right after the invocation if `add` says so.
270
270
  */
271
- function withSizedFlag(command: string, invocation: RegExp, flag: RegExp, sized: string, add: boolean): string {
271
+ export function withInvocationFlag(
272
+ command: string,
273
+ invocation: RegExp,
274
+ flag: RegExp,
275
+ value: string,
276
+ add: boolean,
277
+ ): string {
272
278
  const { end, argsEnd } = invocationSpan(command, invocation);
273
279
  const args = command.slice(end, argsEnd);
274
- const sizedArgs = args.search(flag) === -1 && add ? ` ${sized}${args}` : args.replace(flag, sized);
280
+ const sizedArgs = args.search(flag) === -1 && add ? ` ${value}${args}` : args.replace(flag, value);
275
281
  return `${command.slice(0, end)}${sizedArgs}${command.slice(argsEnd)}`;
276
282
  }
277
283
 
@@ -317,7 +323,7 @@ export function sizeRunner(
317
323
  case 'go-test': {
318
324
  const runner = WORKER_FLAGS[demand.kind];
319
325
  return {
320
- command: withSizedFlag(command, runner.invocation, runner.flag, runner.sized(runnerCount), true),
326
+ command: withInvocationFlag(command, runner.invocation, runner.flag, runner.sized(runnerCount), true),
321
327
  env: { [CPU_TOKENS_ENV]: held },
322
328
  };
323
329
  }
@@ -326,9 +332,9 @@ export function sizeRunner(
326
332
  // `--jobs` is lowered only where it was set: cargo-mutants refuses it beside `--in-place`.
327
333
  const jobs = Math.min(demand.jobs, runnerCount);
328
334
  const share = String(Math.max(1, Math.floor(runnerCount / jobs)));
329
- const tasks = withSizedFlag(command, CARGO_MUTANTS, JOBSERVER_TASKS, `--jobserver-tasks=${count}`, true);
335
+ const tasks = withInvocationFlag(command, CARGO_MUTANTS, JOBSERVER_TASKS, `--jobserver-tasks=${count}`, true);
330
336
  return {
331
- command: withSizedFlag(tasks, CARGO_MUTANTS, MUTANTS_JOBS, `--jobs=${jobs}`, false),
337
+ command: withInvocationFlag(tasks, CARGO_MUTANTS, MUTANTS_JOBS, `--jobs=${jobs}`, false),
332
338
  env: {
333
339
  [CPU_TOKENS_ENV]: held,
334
340
  ...(demand.jobs > 1 ? { CARGO_MUTANTS_JOBS: String(jobs) } : {}),