@smoothbricks/nx-plugin 0.4.29 → 0.4.31
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 +104 -25
- package/dist/bin/smoo-nx-test-clocks.d.ts +3 -0
- package/dist/bin/smoo-nx-test-clocks.d.ts.map +1 -0
- package/dist/bin/smoo-nx-test-clocks.js +28 -0
- package/dist/bounded-test-policy.d.ts +1 -8
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +2 -8
- package/dist/cargo-closure-input.d.ts +11 -0
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +16 -6
- package/dist/ensure-built-receipt.d.ts +8 -2
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +45 -13
- package/dist/ensure-built-witness.d.ts +40 -4
- package/dist/ensure-built-witness.d.ts.map +1 -1
- package/dist/ensure-built-witness.js +68 -15
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +11 -3
- package/dist/executors/bounded-exec/cpu-pool.d.ts +7 -3
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +9 -4
- package/dist/executors/bounded-exec/cpu-tokens.d.ts +22 -5
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-tokens.js +189 -18
- package/dist/executors/bounded-exec/executor.d.ts +1 -1
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +38 -14
- package/dist/executors/bounded-exec/no-space.d.ts +8 -0
- package/dist/executors/bounded-exec/no-space.d.ts.map +1 -0
- package/dist/executors/bounded-exec/no-space.js +31 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +3 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +15 -4
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts +10 -0
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -0
- package/dist/executors/bounded-exec/run-cpu-pool.js +63 -0
- package/dist/executors/bounded-exec/verdict.d.ts +34 -4
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +54 -3
- package/dist/graph-input-contract.d.ts +4 -0
- package/dist/graph-input-contract.d.ts.map +1 -1
- package/dist/graph-input-contract.js +17 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -3
- package/dist/owned-installation.d.ts +14 -0
- package/dist/owned-installation.d.ts.map +1 -0
- package/dist/owned-installation.js +324 -0
- package/dist/producer-receipts.d.ts.map +1 -1
- package/dist/producer-receipts.js +15 -10
- package/dist/test-backstop.d.ts +9 -0
- package/dist/test-backstop.d.ts.map +1 -0
- package/dist/test-backstop.js +10 -0
- package/dist/test-clock-policy.d.ts +30 -0
- package/dist/test-clock-policy.d.ts.map +1 -0
- package/dist/test-clock-policy.js +686 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +8 -1
- package/managed/raw/tooling/direnv/developer-links.ts +1 -8
- package/managed/raw/tooling/direnv/setup-environment.ts +13 -1
- package/package.json +15 -4
- package/src/__tests__/cargo-closure-fixture.ts +113 -0
- package/src/__tests__/counted-cargo.ts +8 -25
- package/src/__tests__/directory-change.ts +27 -0
- package/src/__tests__/owned-installation.ts +4 -164
- package/src/__tests__/past-tick.ts +12 -0
- package/src/bin/smoo-nx-test-clocks.ts +29 -0
- package/src/bounded-test-policy.ts +2 -8
- package/src/cargo-closure-input.property.test.ts +50 -0
- package/src/cargo-closure-input.test.ts +15 -112
- package/src/cargo-closure-input.ts +23 -6
- package/src/cargo-closure-key.test.ts +240 -0
- package/src/cargo-resolve-cache.test.ts +29 -7
- package/src/ensure-built-receipt.ts +56 -13
- package/src/ensure-built-witness.test.ts +113 -4
- package/src/ensure-built-witness.ts +75 -16
- package/src/ensure-built.test.ts +74 -2
- package/src/ensure-built.ts +13 -2
- package/src/executors/bounded-exec/cpu-pool.test.ts +18 -0
- package/src/executors/bounded-exec/cpu-pool.ts +10 -4
- package/src/executors/bounded-exec/cpu-tokens.test.ts +205 -0
- package/src/executors/bounded-exec/cpu-tokens.ts +229 -22
- package/src/executors/bounded-exec/disk-lease.test.ts +47 -13
- package/src/executors/bounded-exec/executor-host.test.ts +23 -11
- package/src/executors/bounded-exec/executor.test.ts +189 -63
- package/src/executors/bounded-exec/executor.ts +39 -13
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +14 -8
- package/src/executors/bounded-exec/no-space.ts +40 -0
- package/src/executors/bounded-exec/ram-temp-host.test.ts +9 -8
- package/src/executors/bounded-exec/ram-temp.test.ts +32 -18
- package/src/executors/bounded-exec/ram-temp.ts +17 -4
- package/src/executors/bounded-exec/run-cpu-pool.test.ts +76 -0
- package/src/executors/bounded-exec/run-cpu-pool.ts +75 -0
- package/src/executors/bounded-exec/verdict.test.ts +125 -25
- package/src/executors/bounded-exec/verdict.ts +78 -3
- package/src/graph-input-contract.test.ts +8 -0
- package/src/graph-input-contract.ts +26 -4
- package/src/index.test.ts +12 -2
- package/src/index.ts +13 -3
- package/src/nextest-extraction.test.ts +114 -4
- package/src/nx-daemon-claim.test.ts +5 -3
- package/src/nx-daemon-idle-policy.test.ts +22 -18
- package/src/nx-daemon-validity.test.ts +5 -13
- package/src/owned-installation.ts +174 -0
- package/src/producer-receipts.ts +15 -10
- package/src/test-backstop.ts +11 -0
- package/src/test-clock-policy.test.ts +338 -0
- package/src/test-clock-policy.ts +708 -0
- package/src/testing.ts +8 -1
- package/test-timings.json +4 -0
|
@@ -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,EA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 import { workspaceDataDirectoryForWorkspace } from 'nx/src/utils/cache-directory
|
|
|
6
6
|
import { CPU_POOL_ENV, createCpuPool, readInheritedCpuPool, takeParentCpuTokens, } from './cpu-pool.js';
|
|
7
7
|
import { CPU_TOKENS_ENV, gatewayCpuBudget, runnerDemand, sizeRunner, } from './cpu-tokens.js';
|
|
8
8
|
import { captureHangDiagnostics, HANG_CAPTURE_MS } from './hang-diagnostics.js';
|
|
9
|
+
import { createNoSpaceWatch } from './no-space.js';
|
|
9
10
|
import { createRunProgress, withProgressReport } from './progress.js';
|
|
10
11
|
import { COWSHED_EXECUTABLE_ENV, createHostCommands, describeRamTempError, RAM_TEMP_CAPACITY_BYTES, RamTempVolume, ramTempPaths, } from './ram-temp.js';
|
|
11
|
-
import { clearTaskDirectory, JUNIT_FILE, JUNIT_REPORT_ENV, judgeOperationalFailure, judgeRun, readJunitReport, taskDirectory, withJunitReport, writeRecord, } from './verdict.js';
|
|
12
|
+
import { clearTaskDirectory, describeNoSpace, JUNIT_FILE, JUNIT_REPORT_ENV, judgeOperationalFailure, judgeRun, readJunitReport, taskDirectory, withJunitReport, writeRecord, } from './verdict.js';
|
|
12
13
|
const DEFAULT_KILL_AFTER_MS = 10_000;
|
|
13
14
|
const REAP_AFTER_FORCE_KILL_MS = 2_000;
|
|
14
15
|
const EXIT_CODE_BY_SIGNAL = {
|
|
@@ -130,6 +131,7 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
|
|
|
130
131
|
expiry: null,
|
|
131
132
|
forceKillNeeded: false,
|
|
132
133
|
poolCloseError: null,
|
|
134
|
+
noSpace: null,
|
|
133
135
|
};
|
|
134
136
|
const appendStdout = (chunk) => {
|
|
135
137
|
const text = chunk.toString();
|
|
@@ -189,14 +191,15 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
|
|
|
189
191
|
appendStderr(`${describeRamTempError(released.error)}\n`);
|
|
190
192
|
}
|
|
191
193
|
};
|
|
192
|
-
// The wait is one span line, as cowshed's own spans read.
|
|
193
|
-
//
|
|
194
|
+
// The wait is one span line, as cowshed's own spans read. On a host without a gateway the Nx run serves its own
|
|
195
|
+
// pool (`run-cpu-pool.ts`), taken below as a parent's; a command no pool and no gateway answers runs exactly as
|
|
196
|
+
// asked and nothing is said.
|
|
194
197
|
const cores = availableParallelism();
|
|
195
198
|
const demand = runnerDemand(requested, options.parallelism, cores, process.env, options.env);
|
|
196
199
|
const asked = Date.now();
|
|
197
|
-
// A run a parent's CPU pool
|
|
198
|
-
// A pool that answered and refused
|
|
199
|
-
//
|
|
200
|
+
// A run a parent's CPU pool serves takes its tokens there. Only an absent pool leaves the host budget to ask.
|
|
201
|
+
// A pool that answered and refused is a live budget of its own -- a lent grant, or a gate's or a resident's
|
|
202
|
+
// relay to the host -- so asking the host beside it would count the run twice; the run fails instead.
|
|
200
203
|
let grant = null;
|
|
201
204
|
let parentRefusal = null;
|
|
202
205
|
if (inherited !== null) {
|
|
@@ -254,7 +257,7 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
|
|
|
254
257
|
// Records the run's verdict when it has a task to record as. An `expiry` is set only when a bound ended the run.
|
|
255
258
|
// An `operational` run failed on its CPU budget (a sub-pool that did not close): an ordinary failure, whatever
|
|
256
259
|
// bound also fired, so it is never judged as a bound.
|
|
257
|
-
const recordRun = async (exitCode, expiry, elapsedMs, operational) => {
|
|
260
|
+
const recordRun = async (exitCode, expiry, elapsedMs, operational, noSpace) => {
|
|
258
261
|
if (context.record === undefined) {
|
|
259
262
|
return;
|
|
260
263
|
}
|
|
@@ -262,7 +265,7 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
|
|
|
262
265
|
const report = await readJunitReport(recordDirectory);
|
|
263
266
|
const verdict = operational
|
|
264
267
|
? judgeOperationalFailure(exitCode, report)
|
|
265
|
-
: judgeRun({ exitCode, elapsedMs, expiry, report });
|
|
268
|
+
: judgeRun({ exitCode, elapsedMs, expiry, report, noSpace });
|
|
266
269
|
if (verdict.outcome === 'bound' && verdict.bound === 'test') {
|
|
267
270
|
appendStderr(`Every failing test failed only on its per-test timeout: ${verdict.tests.join(', ')}\n`);
|
|
268
271
|
}
|
|
@@ -273,7 +276,7 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
|
|
|
273
276
|
appendStderr(message);
|
|
274
277
|
await releaseCpu();
|
|
275
278
|
await releaseLease();
|
|
276
|
-
await recordRun(1, null, Date.now() - asked, false);
|
|
279
|
+
await recordRun(1, null, Date.now() - asked, false, null);
|
|
277
280
|
return { success: false, terminalOutput: outputChunks.join('') };
|
|
278
281
|
};
|
|
279
282
|
if (parentRefusal !== null) {
|
|
@@ -335,6 +338,13 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
|
|
|
335
338
|
}
|
|
336
339
|
// Progress is a finished test, not output: a runner's SLOW warnings and a hung test's heartbeat keep printing.
|
|
337
340
|
const progress = createRunProgress();
|
|
341
|
+
// A write that found no space is said once, in the output, by whatever made it; the volume is read when it is said,
|
|
342
|
+
// since the writer usually removes what it half-wrote before it exits and the volume no longer looks full by then.
|
|
343
|
+
const noSpace = createNoSpaceWatch();
|
|
344
|
+
const sight = async (line) => {
|
|
345
|
+
const held = lease;
|
|
346
|
+
return { line, volume: held === null ? null : ((await tempVolume?.space(held)) ?? null) };
|
|
347
|
+
};
|
|
338
348
|
let idleTimer;
|
|
339
349
|
let captureTimer;
|
|
340
350
|
let idleCapture;
|
|
@@ -433,12 +443,18 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
|
|
|
433
443
|
const text = chunk.toString();
|
|
434
444
|
if (progress.scan('stdout', text))
|
|
435
445
|
armIdleTimer();
|
|
446
|
+
const said = noSpace.scan('stdout', text);
|
|
447
|
+
if (said !== null)
|
|
448
|
+
state.noSpace = sight(said);
|
|
436
449
|
appendStdout(text);
|
|
437
450
|
});
|
|
438
451
|
child.stderr?.on('data', (chunk) => {
|
|
439
452
|
const text = chunk.toString();
|
|
440
453
|
if (progress.scan('stderr', text))
|
|
441
454
|
armIdleTimer();
|
|
455
|
+
const said = noSpace.scan('stderr', text);
|
|
456
|
+
if (said !== null)
|
|
457
|
+
state.noSpace = sight(said);
|
|
442
458
|
appendStderr(text);
|
|
443
459
|
});
|
|
444
460
|
const killChildTree = async (force) => {
|
|
@@ -582,16 +598,24 @@ export async function runBoundedExec(options, context, killer, tempVolume, budge
|
|
|
582
598
|
if (state.expiry !== null && !state.forceKillNeeded) {
|
|
583
599
|
appendStderr(`Timed out command exited after graceful termination: ${command}\n`);
|
|
584
600
|
}
|
|
585
|
-
//
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
601
|
+
// ENOSPC said in the output names the writer's volume as it stood then. Without it, a volume still (nearly) full now
|
|
602
|
+
// is the likely cause, and the volume is named.
|
|
603
|
+
const seen = state.noSpace === null ? null : await state.noSpace;
|
|
604
|
+
if (seen !== null && (code !== 0 || state.expiry !== null)) {
|
|
605
|
+
const writer = context.record?.task.id;
|
|
606
|
+
appendStderr(`${writer === undefined ? '' : `${writer}: `}${describeNoSpace(seen)}\n`);
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
const full = code !== 0 && lease !== null ? await tempVolume?.fullness(lease) : null;
|
|
610
|
+
if (full) {
|
|
611
|
+
appendStderr(`${describeRamTempError(full)}\n`);
|
|
612
|
+
}
|
|
589
613
|
}
|
|
590
614
|
await releaseLease();
|
|
591
615
|
// A run whose sub-pool did not close cleanly fails even when the command exited 0, and whatever bound also fired:
|
|
592
616
|
// its verdict is an ordinary failure, never a bound.
|
|
593
617
|
const operationalFailure = state.poolCloseError !== null;
|
|
594
|
-
await recordRun(code, state.expiry, Date.now() - startedAt, operationalFailure);
|
|
618
|
+
await recordRun(code, state.expiry, Date.now() - startedAt, operationalFailure, seen);
|
|
595
619
|
return {
|
|
596
620
|
success: !operationalFailure && state.expiry === null && code === 0,
|
|
597
621
|
terminalOutput: outputChunks.join(''),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OutputStream } from './progress.js';
|
|
2
|
+
/** Watches a command's output for the first line that says a write found no space. */
|
|
3
|
+
export interface NoSpaceWatch {
|
|
4
|
+
/** One chunk of one output stream: the first matching line, once, as printed; `null` before and after it. */
|
|
5
|
+
scan(stream: OutputStream, chunk: string): string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function createNoSpaceWatch(): NoSpaceWatch;
|
|
8
|
+
//# sourceMappingURL=no-space.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-space.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/no-space.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAWlD,sFAAsF;AACtF,MAAM,WAAW,YAAY;IAC3B,6GAA6G;IAC7G,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC1D;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAsBjD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The operating system's own words for ENOSPC: the errno name Node and Bun print (`ENOSPC: no space left on device,
|
|
3
|
+
* write`), and `strerror(28)`, which Rust (`No space left on device (os error 28)`), Go and C print. Nothing else in a
|
|
4
|
+
* command's output says the disk was full, and a write that failed on it is otherwise reported as whatever its caller
|
|
5
|
+
* was doing: a failed test, an extraction error.
|
|
6
|
+
*/
|
|
7
|
+
const NO_SPACE = /\bENOSPC\b|No space left on device/;
|
|
8
|
+
const ANSI = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*[A-Za-z]`, 'g');
|
|
9
|
+
export function createNoSpaceWatch() {
|
|
10
|
+
const partial = { stdout: '', stderr: '' };
|
|
11
|
+
let seen = false;
|
|
12
|
+
return {
|
|
13
|
+
scan(stream, chunk) {
|
|
14
|
+
if (seen) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const lines = (partial[stream] + chunk).split('\n');
|
|
18
|
+
// The unfinished last line is kept for the next chunk, and read now too: a command that dies mid-line still
|
|
19
|
+
// printed the words.
|
|
20
|
+
partial[stream] = lines.at(-1) ?? '';
|
|
21
|
+
for (const line of lines) {
|
|
22
|
+
const text = line.replace(ANSI, '').trim();
|
|
23
|
+
if (NO_SPACE.test(text)) {
|
|
24
|
+
seen = true;
|
|
25
|
+
return text;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ProcessEntry } from '../../testing.js';
|
|
2
2
|
import { type PhaseShare } from './disk-lease.js';
|
|
3
|
+
import type { TempVolumeSpace } from './verdict.js';
|
|
3
4
|
/**
|
|
4
5
|
* The volume's ceiling, plus the revision's sectors. Pages are allocated as they are written and
|
|
5
6
|
* returned when the volume detaches, so this bounds what a runaway suite can take, not what a gate
|
|
@@ -166,6 +167,8 @@ export declare class RamTempVolume {
|
|
|
166
167
|
private waitOut;
|
|
167
168
|
/** After a failed task: whether the volume ran out of space, which is then the error to report. */
|
|
168
169
|
fullness(lease: RamTempLease): Promise<RamTempError | null>;
|
|
170
|
+
/** The lease's volume and the space left on it now; `null` when the volume cannot be read. */
|
|
171
|
+
space(lease: RamTempLease): Promise<TempVolumeSpace | null>;
|
|
169
172
|
private lock;
|
|
170
173
|
private end;
|
|
171
174
|
private locked;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ram-temp.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/ram-temp.ts"],"names":[],"mappings":"AAqBA,OAAO,EAEL,KAAK,YAAY,EAMlB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAe,KAAK,UAAU,EAAgC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"ram-temp.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/ram-temp.ts"],"names":[],"mappings":"AAqBA,OAAO,EAEL,K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OG;AACH,wBAAgB,kBAAkB,CAChC,iBAAiB,GAAE,MAAiC,EACpD,aAAa,GAAE,MAAuB,EACtC,WAAW,GAAE,UAA4B,EACzC,OAAO,SAAmD,GACzD,YAAY,CAwCd"}
|
|
@@ -579,12 +579,23 @@ export class RamTempVolume {
|
|
|
579
579
|
}
|
|
580
580
|
/** After a failed task: whether the volume ran out of space, which is then the error to report. */
|
|
581
581
|
async fullness(lease) {
|
|
582
|
+
const space = await this.space(lease);
|
|
583
|
+
if (space === null || space.freeBytes >= FULL_FREE_BYTES) {
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
586
|
+
const { mountpoint, capacityBytes, freeBytes } = space;
|
|
587
|
+
return { kind: 'volume-full', mountpoint, capacityBytes, freeBytes };
|
|
588
|
+
}
|
|
589
|
+
/** The lease's volume and the space left on it now; `null` when the volume cannot be read. */
|
|
590
|
+
async space(lease) {
|
|
582
591
|
try {
|
|
583
592
|
const fs = await statfs(lease.mountpoint);
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
:
|
|
593
|
+
return {
|
|
594
|
+
lease: lease.directory,
|
|
595
|
+
mountpoint: lease.mountpoint,
|
|
596
|
+
capacityBytes: lease.capacityBytes,
|
|
597
|
+
freeBytes: fs.bavail * fs.bsize,
|
|
598
|
+
};
|
|
588
599
|
}
|
|
589
600
|
catch {
|
|
590
601
|
return null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PostTasksExecutionContext, PreTasksExecutionContext } from 'nx/src/project-graph/plugins/public-api.js';
|
|
2
|
+
/**
|
|
3
|
+
* Serve `context`'s run a pool of `cores` tokens and publish it in `env`, which every task inherits, when the run
|
|
4
|
+
* inherits no pool and no gateway exists at `gateway`. A pool that cannot be made is said and leaves the run
|
|
5
|
+
* unbudgeted, as a run without a gateway was before.
|
|
6
|
+
*/
|
|
7
|
+
export declare function serveRunCpuPool(context: Pick<PreTasksExecutionContext, 'id'>, env?: NodeJS.ProcessEnv, gateway?: string, cores?: number): Promise<void>;
|
|
8
|
+
/** Close the pool `context`'s run was served, if it was served one. */
|
|
9
|
+
export declare function closeRunCpuPool(context: Pick<PostTasksExecutionContext, 'id'>): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=run-cpu-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-cpu-pool.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/run-cpu-pool.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAsBtH;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,EAC7C,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,OAAO,GAAE,MAAuB,EAChC,KAAK,GAAE,MAA+B,GACrC,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,uEAAuE;AACvE,wBAAsB,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,yBAAyB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUnG"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { lstat } from 'node:fs/promises';
|
|
2
|
+
import { availableParallelism } from 'node:os';
|
|
3
|
+
import { logger } from 'nx/src/devkit-exports.js';
|
|
4
|
+
import { createCpuPool, readInheritedCpuPool } from './cpu-pool.js';
|
|
5
|
+
import { GATEWAY_SOCKET } from './gateway-lease.js';
|
|
6
|
+
/**
|
|
7
|
+
* The CPU budget of an Nx run on a host without a gateway (specs/cowshed/05_gateway.md, "Host CPU budget", "A run
|
|
8
|
+
* without a gateway").
|
|
9
|
+
*
|
|
10
|
+
* Every runner sizes itself to the whole host unless something budgets it, and without a gateway nothing did: under
|
|
11
|
+
* `NX_PARALLEL=100%` Nx starts every target side by side and each one's runner takes the whole machine. The run
|
|
12
|
+
* therefore serves its own pool of one token per core, as a gateway-granted executor serves its children, and every
|
|
13
|
+
* task inherits it: `bounded-exec` and the `cargo` launcher take from it as from any parent pool, FIFO, the head
|
|
14
|
+
* taking `min(want, free)` once one token is free, so the runners of one run together stay within the cores.
|
|
15
|
+
*
|
|
16
|
+
* The run serves it only when nothing else budgets it: it inherits no pool, and the gateway's control socket does
|
|
17
|
+
* not exist. Only `ENOENT` proves the gateway absent, as for the launcher; a socket that exists but does not answer
|
|
18
|
+
* may be a live, saturated gateway, and a run budgeting itself beside it would count the host twice.
|
|
19
|
+
*/
|
|
20
|
+
/** The pools this process serves, by Nx run id, until that run's `postTasksExecution`. */
|
|
21
|
+
const pools = new Map();
|
|
22
|
+
/**
|
|
23
|
+
* Serve `context`'s run a pool of `cores` tokens and publish it in `env`, which every task inherits, when the run
|
|
24
|
+
* inherits no pool and no gateway exists at `gateway`. A pool that cannot be made is said and leaves the run
|
|
25
|
+
* unbudgeted, as a run without a gateway was before.
|
|
26
|
+
*/
|
|
27
|
+
export async function serveRunCpuPool(context, env = process.env, gateway = GATEWAY_SOCKET, cores = availableParallelism()) {
|
|
28
|
+
if (readInheritedCpuPool(env) !== null || !(await absent(gateway))) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// The pool lives until the run's `postTasksExecution` closes it, or with this process.
|
|
32
|
+
const made = await createCpuPool(cores, new Promise(() => { }), { begin() { }, end() { } });
|
|
33
|
+
if (!made.ok) {
|
|
34
|
+
logger.warn(`bounded-exec: no gateway at ${gateway}, and this run's CPU pool failed (${made.error}); its tasks run unbudgeted`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
pools.set(context.id, made.pool);
|
|
38
|
+
for (const [name, value] of Object.entries(made.pool.environment)) {
|
|
39
|
+
env[name] = value;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Close the pool `context`'s run was served, if it was served one. */
|
|
43
|
+
export async function closeRunCpuPool(context) {
|
|
44
|
+
const pool = pools.get(context.id);
|
|
45
|
+
if (pool === undefined) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
pools.delete(context.id);
|
|
49
|
+
const closed = await pool.close();
|
|
50
|
+
if (!closed.ok) {
|
|
51
|
+
logger.warn(`bounded-exec: this run's CPU pool did not close cleanly: ${closed.error}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function absent(path) {
|
|
55
|
+
try {
|
|
56
|
+
await lstat(path);
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
const code = error instanceof Error && 'code' in error ? error.code : undefined;
|
|
61
|
+
return code === 'ENOENT' || code === 'ENOTDIR';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -9,6 +9,9 @@
|
|
|
9
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
10
|
* the tests still running: those the runner said were running and never said finished, and those its report says
|
|
11
11
|
* it aborted when the bound stopped it.
|
|
12
|
+
* - `no-space`: the run failed and its output said a write found no space (ENOSPC). Whatever its tests then reported,
|
|
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
|
+
* its RAM temp volume as it stood when that line arrived.
|
|
12
15
|
* - `failed`: anything else that did not pass. That includes an assertion named in the report,
|
|
13
16
|
* or a non-zero exit with no report to say why.
|
|
14
17
|
*/
|
|
@@ -28,11 +31,27 @@ export type BoundedExecVerdict = {
|
|
|
28
31
|
readonly idleMs: number;
|
|
29
32
|
readonly elapsedMs: number;
|
|
30
33
|
readonly tests: readonly string[];
|
|
31
|
-
} | {
|
|
34
|
+
} | ({
|
|
35
|
+
readonly outcome: 'no-space';
|
|
36
|
+
readonly exitCode: number;
|
|
37
|
+
readonly tests: readonly string[];
|
|
38
|
+
} & NoSpaceSighting) | {
|
|
32
39
|
readonly outcome: 'failed';
|
|
33
40
|
readonly exitCode: number;
|
|
34
41
|
readonly tests: readonly string[];
|
|
35
42
|
};
|
|
43
|
+
/** The task's RAM temp volume, read when a line saying ENOSPC arrived: the writer's own lease, and the space left. */
|
|
44
|
+
export interface TempVolumeSpace {
|
|
45
|
+
readonly lease: string;
|
|
46
|
+
readonly mountpoint: string;
|
|
47
|
+
readonly capacityBytes: number;
|
|
48
|
+
readonly freeBytes: number;
|
|
49
|
+
}
|
|
50
|
+
/** The first output line that said a write found no space, and the task's RAM temp volume then; `null` without one. */
|
|
51
|
+
export interface NoSpaceSighting {
|
|
52
|
+
readonly line: string;
|
|
53
|
+
readonly volume: TempVolumeSpace | null;
|
|
54
|
+
}
|
|
36
55
|
/** One task's verdict, keyed by the Nx task and the hash it ran at. */
|
|
37
56
|
export interface BoundedExecRecord {
|
|
38
57
|
readonly task: string;
|
|
@@ -95,11 +114,16 @@ export interface RunEnd {
|
|
|
95
114
|
readonly expiry: ExpiredBound | null;
|
|
96
115
|
/** The run's report, or `null` when the command was asked for none or wrote none. */
|
|
97
116
|
readonly report: JunitFailures | null;
|
|
117
|
+
/** The first output line that said ENOSPC, or `null` when none did. */
|
|
118
|
+
readonly noSpace: NoSpaceSighting | null;
|
|
98
119
|
}
|
|
99
120
|
/**
|
|
100
|
-
* Judge a run. A
|
|
101
|
-
*
|
|
102
|
-
*
|
|
121
|
+
* Judge a run. A run that failed after its output said ENOSPC failed on the disk: that is read first, ahead of the
|
|
122
|
+
* tests it then failed, a bound it then hit or a hang the full disk caused; a passing run that printed it (a test of
|
|
123
|
+
* its own ENOSPC handling) passed. A test that failed on its own is a failure even when a bound fired too, and the
|
|
124
|
+
* no-progress bound is never load: the report's assertions and the idle bound are read next. A test the runner aborted
|
|
125
|
+
* because the total bound told its command to stop is not one that failed; one it aborted at the idle bound is a test
|
|
126
|
+
* still running.
|
|
103
127
|
*/
|
|
104
128
|
export declare function judgeRun(run: RunEnd): BoundedExecVerdict;
|
|
105
129
|
/**
|
|
@@ -159,4 +183,10 @@ export type FailedTask = {
|
|
|
159
183
|
*/
|
|
160
184
|
export declare function failedTasksOfRun(runJson: unknown, workspaceData: string): Promise<FailedTask[]>;
|
|
161
185
|
export declare function describeVerdict(verdict: BoundedExecVerdict): string;
|
|
186
|
+
/**
|
|
187
|
+
* What a run's output said about a write that found no space, and where the run's temp files lived then. The free
|
|
188
|
+
* space is read when the line arrives, not after the command exits: by then a writer that failed has usually removed
|
|
189
|
+
* its half-written files and the volume no longer looks full.
|
|
190
|
+
*/
|
|
191
|
+
export declare function describeNoSpace(sighting: NoSpaceSighting): string;
|
|
162
192
|
//# sourceMappingURL=verdict.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verdict.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/verdict.ts"],"names":[],"mappings":"AAGA
|
|
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;IAA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ACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA6BrG;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAqBnE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAQjE"}
|
|
@@ -94,11 +94,18 @@ function decodeEntities(value) {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* Judge a run. A
|
|
98
|
-
*
|
|
99
|
-
*
|
|
97
|
+
* Judge a run. A run that failed after its output said ENOSPC failed on the disk: that is read first, ahead of the
|
|
98
|
+
* tests it then failed, a bound it then hit or a hang the full disk caused; a passing run that printed it (a test of
|
|
99
|
+
* its own ENOSPC handling) passed. A test that failed on its own is a failure even when a bound fired too, and the
|
|
100
|
+
* no-progress bound is never load: the report's assertions and the idle bound are read next. A test the runner aborted
|
|
101
|
+
* because the total bound told its command to stop is not one that failed; one it aborted at the idle bound is a test
|
|
102
|
+
* still running.
|
|
100
103
|
*/
|
|
101
104
|
export function judgeRun(run) {
|
|
105
|
+
if (run.noSpace !== null && (run.exitCode !== 0 || run.expiry !== null)) {
|
|
106
|
+
const tests = run.report === null ? [] : [...run.report.failed, ...run.report.timedOut, ...run.report.cancelled];
|
|
107
|
+
return { outcome: 'no-space', exitCode: run.exitCode === 0 ? 1 : run.exitCode, tests, ...run.noSpace };
|
|
108
|
+
}
|
|
102
109
|
if (run.expiry?.kind === 'idle') {
|
|
103
110
|
const tests = [...new Set([...run.expiry.tests, ...(run.report?.cancelled ?? [])])];
|
|
104
111
|
return { outcome: 'wedged', idleMs: run.expiry.limitMs, elapsedMs: run.elapsedMs, tests };
|
|
@@ -245,6 +252,19 @@ function parseVerdict(value) {
|
|
|
245
252
|
return { outcome: 'wedged', idleMs: value.idleMs, elapsedMs: value.elapsedMs, tests: value.tests };
|
|
246
253
|
}
|
|
247
254
|
break;
|
|
255
|
+
case 'no-space': {
|
|
256
|
+
const volume = parseTempVolumeSpace(value.volume);
|
|
257
|
+
if (typeof value.exitCode === 'number' && isStrings(value.tests) && typeof value.line === 'string' && volume) {
|
|
258
|
+
return {
|
|
259
|
+
outcome: 'no-space',
|
|
260
|
+
exitCode: value.exitCode,
|
|
261
|
+
tests: value.tests,
|
|
262
|
+
line: value.line,
|
|
263
|
+
volume: volume.value,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
248
268
|
case 'failed':
|
|
249
269
|
if (typeof value.exitCode === 'number' && isStrings(value.tests)) {
|
|
250
270
|
return { outcome: 'failed', exitCode: value.exitCode, tests: value.tests };
|
|
@@ -254,6 +274,21 @@ function parseVerdict(value) {
|
|
|
254
274
|
}
|
|
255
275
|
throw new Error(`not a bounded-exec verdict: ${JSON.stringify(value)}`);
|
|
256
276
|
}
|
|
277
|
+
/** A recorded volume, wrapped so a well-formed `null` (no RAM volume) differs from a malformed one (`undefined`). */
|
|
278
|
+
function parseTempVolumeSpace(value) {
|
|
279
|
+
if (value === null) {
|
|
280
|
+
return { value: null };
|
|
281
|
+
}
|
|
282
|
+
if (isObject(value) &&
|
|
283
|
+
typeof value.lease === 'string' &&
|
|
284
|
+
typeof value.mountpoint === 'string' &&
|
|
285
|
+
typeof value.capacityBytes === 'number' &&
|
|
286
|
+
typeof value.freeBytes === 'number') {
|
|
287
|
+
const { lease, mountpoint, capacityBytes, freeBytes } = value;
|
|
288
|
+
return { value: { lease, mountpoint, capacityBytes, freeBytes } };
|
|
289
|
+
}
|
|
290
|
+
return undefined;
|
|
291
|
+
}
|
|
257
292
|
function isObject(value) {
|
|
258
293
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
259
294
|
}
|
|
@@ -310,9 +345,25 @@ export function describeVerdict(verdict) {
|
|
|
310
345
|
return `wedged: no test finished for ${verdict.idleMs}ms after ${verdict.elapsedMs}ms; ${verdict.tests.length > 0
|
|
311
346
|
? `still running: ${verdict.tests.join(', ')}`
|
|
312
347
|
: 'the runner named no test still running'}`;
|
|
348
|
+
case 'no-space':
|
|
349
|
+
return `${describeNoSpace(verdict)}${verdict.tests.length > 0 ? `; the tests that then failed: ${verdict.tests.join(', ')}` : ''}`;
|
|
313
350
|
case 'failed':
|
|
314
351
|
return verdict.tests.length > 0
|
|
315
352
|
? `failed: ${verdict.tests.join(', ')}`
|
|
316
353
|
: `exited ${verdict.exitCode} with no report naming a timeout`;
|
|
317
354
|
}
|
|
318
355
|
}
|
|
356
|
+
/**
|
|
357
|
+
* What a run's output said about a write that found no space, and where the run's temp files lived then. The free
|
|
358
|
+
* space is read when the line arrives, not after the command exits: by then a writer that failed has usually removed
|
|
359
|
+
* its half-written files and the volume no longer looks full.
|
|
360
|
+
*/
|
|
361
|
+
export function describeNoSpace(sighting) {
|
|
362
|
+
const said = `ENOSPC (no space left on device): the command printed ${JSON.stringify(sighting.line)}`;
|
|
363
|
+
const volume = sighting.volume;
|
|
364
|
+
if (volume === null) {
|
|
365
|
+
return `${said}; it held no RAM temp volume, so the full disk is the one that line's writer wrote to`;
|
|
366
|
+
}
|
|
367
|
+
const mib = (bytes) => (bytes / (1024 * 1024)).toFixed(1);
|
|
368
|
+
return `${said}; its TMPDIR ${volume.lease} is on the RAM temp volume ${volume.mountpoint}, which had ${mib(volume.freeBytes)} MiB free of ${mib(volume.capacityBytes)} MiB when that line arrived`;
|
|
369
|
+
}
|
|
@@ -73,6 +73,10 @@ export declare class GraphInputReadCollector {
|
|
|
73
73
|
private readonly scanned;
|
|
74
74
|
private readonly gitScopes;
|
|
75
75
|
private detail;
|
|
76
|
+
/** Read before the first observation: what each node stamp this reader records is judged by (unproven). */
|
|
77
|
+
private readonly start;
|
|
78
|
+
/** The witness's stamp of each node this reader read in the tick it changed in (recordedStamp), by path. */
|
|
79
|
+
private readonly unprovenStamps;
|
|
76
80
|
constructor(workspaceRoot: string, plugin: string, options: unknown);
|
|
77
81
|
refuse(detail: string): void;
|
|
78
82
|
private protect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-input-contract.d.ts","sourceRoot":"","sources":["../src/graph-input-contract.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAOjE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"graph-input-contract.d.ts","sourceRoot":"","sources":["../src/graph-input-contract.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAOjE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAWhF,mGAAmG;AACnG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;IACrE,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChF,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AACD,UAAU,iBAAiB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AACD,UAAU,WAAW;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CAC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, lstatSync, mkdirSync, readdirSync, r
|
|
|
4
4
|
import { createRequire } from 'node:module';
|
|
5
5
|
import { delimiter, dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
6
6
|
import typia from 'typia';
|
|
7
|
-
import { nodeStamp, nodesUnchanged, workspaceSnapshot } from './ensure-built-witness.js';
|
|
7
|
+
import { censusStart, movedNodes, nodeStamp, nodesUnchanged, recordedStamp, unproven, workspaceSnapshot, } from './ensure-built-witness.js';
|
|
8
8
|
function digest(value) {
|
|
9
9
|
return createHash('sha256').update(value).digest('hex');
|
|
10
10
|
}
|
|
@@ -92,6 +92,10 @@ export class GraphInputReadCollector {
|
|
|
92
92
|
scanned = new Set();
|
|
93
93
|
gitScopes = new Set();
|
|
94
94
|
detail;
|
|
95
|
+
/** Read before the first observation: what each node stamp this reader records is judged by (unproven). */
|
|
96
|
+
start = censusStart();
|
|
97
|
+
/** The witness's stamp of each node this reader read in the tick it changed in (recordedStamp), by path. */
|
|
98
|
+
unprovenStamps = new Map();
|
|
95
99
|
constructor(workspaceRoot, plugin, options) {
|
|
96
100
|
this.workspaceRoot = workspaceRoot;
|
|
97
101
|
this.plugin = plugin;
|
|
@@ -158,8 +162,12 @@ export class GraphInputReadCollector {
|
|
|
158
162
|
const stamp = scope === 'path' ? pathStamp(stats) : nodeStamp(stats);
|
|
159
163
|
if (previous !== undefined && previous.stamp !== (previous.scope === scope ? stamp : pathStamp(stats)))
|
|
160
164
|
this.refuse(`input changed during read: ${path}`);
|
|
161
|
-
if (previous === undefined || previous.scope !== scope)
|
|
165
|
+
if (previous === undefined || previous.scope !== scope) {
|
|
162
166
|
this.nodes.set(path, { path, scope, stamp });
|
|
167
|
+
// A path stamp holds no time; a node stamp read in its node's change tick is recorded unproven.
|
|
168
|
+
if (scope === 'node' && unproven(stats, this.start))
|
|
169
|
+
this.unprovenStamps.set(path, recordedStamp(stats, this.start));
|
|
170
|
+
}
|
|
163
171
|
if (stats.isSymbolicLink())
|
|
164
172
|
this.observe(realpathSync(path), membership);
|
|
165
173
|
else if (stats.isFile())
|
|
@@ -358,9 +366,11 @@ export class GraphInputReadCollector {
|
|
|
358
366
|
if (this.before === undefined)
|
|
359
367
|
return;
|
|
360
368
|
const after = captureNative(this.workspaceRoot, this.before);
|
|
369
|
+
// `after` re-hashed every node whose stamp does not prove it (its ctime alone moved, or `before` read it in the
|
|
370
|
+
// tick it changed in), and its native identity must be `before`'s.
|
|
361
371
|
if (!after.stable ||
|
|
362
372
|
nativeIdentity(after.files) !== nativeIdentity(this.before.files) ||
|
|
363
|
-
|
|
373
|
+
movedNodes(this.before.nodes, () => true) !== null ||
|
|
364
374
|
!readNodesUnchanged([...this.nodes.values()]))
|
|
365
375
|
this.refuse('graph inputs changed during the owning reader');
|
|
366
376
|
if (environmentIdentity(this.workspaceRoot) !== this.environment)
|
|
@@ -374,7 +384,10 @@ export class GraphInputReadCollector {
|
|
|
374
384
|
status: 'complete',
|
|
375
385
|
nativeIdentity: nativeIdentity(this.before.files),
|
|
376
386
|
nativeNodes: this.before.nodes,
|
|
377
|
-
nodes: [...this.nodes.values()]
|
|
387
|
+
nodes: [...this.nodes.values()].map((node) => {
|
|
388
|
+
const stamp = this.unprovenStamps.get(node.path);
|
|
389
|
+
return stamp === undefined ? node : { ...node, stamp };
|
|
390
|
+
}),
|
|
378
391
|
missing: [...this.missing].sort(),
|
|
379
392
|
resolutions: this.resolutions,
|
|
380
393
|
tools: [...this.tools.values()],
|
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,9 @@ export declare const createNodesV2: CreateNodesV2;
|
|
|
35
35
|
/**
|
|
36
36
|
* Nx accepts one pre/post task-hook pair per plugin. Two independent observers share it: the controller's task-results
|
|
37
37
|
* hint and the opt-in producer completion receipts. Each sees the same options and run context; neither reads the
|
|
38
|
-
* other's output. The hint is recorded first so a producer-receipt bug cannot cost the controller its evidence.
|
|
38
|
+
* other's output. The hint is recorded first so a producer-receipt bug cannot cost the controller its evidence. The
|
|
39
|
+
* pair also serves a run on a host without a gateway its own CPU pool, which every task inherits
|
|
40
|
+
* (`run-cpu-pool.ts`), and closes it when the run ends.
|
|
39
41
|
*/
|
|
40
42
|
export declare const preTasksExecution: PreTasksExecution<ProducerReceiptsOptions>;
|
|
41
43
|
export declare const postTasksExecution: PostTasksExecution<ProducerReceiptsOptions>;
|