@smoothbricks/nx-plugin 0.4.28 → 0.4.30
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 +277 -89
- 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 +8 -8
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +18 -30
- package/dist/cargo-closure-input.d.ts +23 -0
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +41 -9
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +42 -19
- package/dist/ensure-built-receipt.d.ts +40 -6
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +297 -159
- package/dist/ensure-built-witness.d.ts +65 -4
- package/dist/ensure-built-witness.d.ts.map +1 -1
- package/dist/ensure-built-witness.js +2237 -23
- package/dist/ensure-built.d.ts +99 -1
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +45 -56
- package/dist/executors/bounded-exec/cpu-pool.d.ts +22 -7
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +51 -22
- package/dist/executors/bounded-exec/executor.d.ts +12 -3
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +174 -51
- 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 +20 -11
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +42 -17
- 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/generators/bun-test-tracing/generator.js +2 -2
- package/dist/graph-input-contract.d.ts +102 -0
- package/dist/graph-input-contract.d.ts.map +1 -0
- package/dist/graph-input-contract.js +637 -0
- package/dist/index.d.ts +12 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -3
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +5 -2
- package/dist/managed-files/publish-workflow.d.ts +11 -1
- package/dist/managed-files/publish-workflow.d.ts.map +1 -1
- 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 +19 -0
- package/dist/producer-receipts.d.ts.map +1 -0
- package/dist/producer-receipts.js +926 -0
- 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 +8 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +66 -1
- package/managed/raw/patches/nx@23.2.1.patch +328 -50
- package/managed/raw/tooling/direnv/developer-links.ts +148 -29
- package/managed/raw/tooling/direnv/devenv.smoo.nix +7 -7
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -5
- package/managed/raw/tooling/direnv/linked-snapshots.ts +206 -40
- package/managed/raw/tooling/direnv/repo-path +15 -2
- package/managed/raw/tooling/direnv/setup-environment.ts +179 -115
- package/managed/templates/github/actions/cache-node-modules/action.yml +9 -0
- package/managed/templates/github/actions/setup-devenv/action.yml +63 -7
- package/nextest.toml +1 -1
- package/package.json +25 -9
- 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__/fixture-nx-env.ts +7 -0
- package/src/__tests__/owned-installation.ts +14 -0
- package/src/__tests__/past-tick.ts +12 -0
- package/src/bin/smoo-nx-bound-failures.test.ts +1 -1
- package/src/bin/smoo-nx-test-clocks.ts +29 -0
- package/src/bounded-test-policy.test.ts +36 -22
- package/src/bounded-test-policy.ts +18 -32
- package/src/bun-bootstrap.test.ts +1 -1
- package/src/cargo-closure-input.property.test.ts +50 -0
- package/src/cargo-closure-input.test.ts +73 -121
- package/src/cargo-closure-input.ts +47 -8
- package/src/cargo-closure-key.test.ts +239 -0
- package/src/cargo-resolve-cache.test.ts +168 -31
- package/src/cargo-source-hash.test.ts +78 -3
- package/src/cargo-source-hash.ts +48 -30
- package/src/cross-check-policy.test.ts +2 -2
- package/src/ensure-built-receipt.test.ts +111 -16
- package/src/ensure-built-receipt.ts +294 -149
- package/src/ensure-built-witness.test.ts +306 -13
- package/src/ensure-built-witness.ts +255 -24
- package/src/ensure-built.test.ts +228 -102
- package/src/ensure-built.ts +127 -66
- package/src/executors/bounded-exec/cpu-pool.test.ts +134 -32
- package/src/executors/bounded-exec/cpu-pool.ts +64 -20
- package/src/executors/bounded-exec/cpu-tokens.test.ts +2 -2
- package/src/executors/bounded-exec/disk-lease.test.ts +47 -13
- package/src/executors/bounded-exec/executor-host.test.ts +74 -52
- package/src/executors/bounded-exec/executor.test.ts +343 -97
- package/src/executors/bounded-exec/executor.ts +192 -56
- 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/progress.test.ts +1 -1
- package/src/executors/bounded-exec/ram-temp-host.test.ts +51 -21
- package/src/executors/bounded-exec/ram-temp.test.ts +92 -16
- package/src/executors/bounded-exec/ram-temp.ts +49 -20
- package/src/executors/bounded-exec/verdict.test.ts +127 -22
- package/src/executors/bounded-exec/verdict.ts +78 -3
- package/src/generators/bounded-test-targets/generator.test.ts +1 -3
- package/src/generators/bun-test-tracing/generator.test.ts +2 -2
- package/src/generators/bun-test-tracing/generator.ts +2 -2
- package/src/graph-input-contract.test.ts +379 -0
- package/src/graph-input-contract.ts +627 -0
- package/src/index.test.ts +3 -3
- package/src/index.ts +24 -3
- package/src/linked-snapshots.nx.test.ts +112 -30
- package/src/managed-files/ci-workflow.ts +5 -2
- package/src/managed-files/publish-workflow.ts +12 -1
- package/src/managed-files/repo-path.test.ts +44 -1
- package/src/managed-files/setup-devenv-free-disk.test.ts +95 -0
- package/src/nextest-code-bound.test.ts +23 -17
- package/src/nextest-extraction.test.ts +114 -4
- package/src/nextest-partitions.test.ts +7 -1
- package/src/nx-cache-restore-mtime.test.ts +2 -2
- package/src/nx-daemon-claim.test.ts +10 -8
- package/src/nx-daemon-idle-cpu.test.ts +0 -1
- package/src/nx-daemon-idle-policy.test.ts +61 -1
- package/src/nx-daemon-ignore-files.test.ts +2 -2
- package/src/nx-daemon-validity.test.ts +36 -22
- package/src/nx-dot-input-policy.test.ts +5 -5
- package/src/nx-files-archive-racy.test.ts +1 -1
- package/src/nx-incomplete-run-summary.test.ts +1 -1
- package/src/nx-plugin-load-errors.test.ts +2 -2
- package/src/nx-project-graph-errors.test.ts +70 -0
- package/src/nx-skipped-task-exit.test.ts +2 -2
- package/src/nx-store-resolution.test.ts +7 -25
- package/src/nx-task-output-lease.test.ts +3 -3
- package/src/nx-use-local.test.ts +7 -5
- package/src/owned-installation.ts +174 -0
- package/src/producer-receipts.test.ts +164 -0
- package/src/producer-receipts.ts +636 -0
- package/src/runtime-input.test.ts +1 -1
- package/src/serial-group-wiring.test.ts +4 -4
- package/src/task-results.test.ts +18 -16
- 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/test-timings.test.ts +2 -2
- package/src/testing.test.ts +5 -5
- package/src/testing.ts +67 -1
- package/src/typecheck-test-policy.test.ts +1 -1
- package/src/typescript-resolution.test.ts +76 -0
- package/test-timings.json +8 -0
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
+
import {
|
|
3
|
+
existsSync,
|
|
4
|
+
lstatSync,
|
|
5
|
+
mkdirSync,
|
|
6
|
+
readdirSync,
|
|
7
|
+
readFileSync,
|
|
8
|
+
realpathSync,
|
|
9
|
+
renameSync,
|
|
10
|
+
rmSync,
|
|
11
|
+
writeFileSync,
|
|
12
|
+
} from 'node:fs';
|
|
13
|
+
import { createRequire } from 'node:module';
|
|
14
|
+
import { delimiter, dirname, join, resolve } from 'node:path';
|
|
15
|
+
import type { NxJsonConfiguration } from 'nx/src/config/nx-json';
|
|
16
|
+
import type { ProjectGraph } from 'nx/src/config/project-graph';
|
|
17
|
+
import type { Task, TaskGraph } from 'nx/src/config/task-graph';
|
|
18
|
+
import type { PostTasksExecutionContext, PreTasksExecutionContext } from 'nx/src/project-graph/plugins/public-api';
|
|
19
|
+
import typia from 'typia';
|
|
20
|
+
import {
|
|
21
|
+
createWorkspaceNxRequire,
|
|
22
|
+
type EnsureBuiltProducerReceipt,
|
|
23
|
+
type EnsureBuiltProducerTool,
|
|
24
|
+
type EnsureBuiltReceipt,
|
|
25
|
+
parseTargetSelector,
|
|
26
|
+
providerInputProof,
|
|
27
|
+
selectorTaskId,
|
|
28
|
+
} from './ensure-built.js';
|
|
29
|
+
import {
|
|
30
|
+
captureProducerSource,
|
|
31
|
+
type ProducerSourceWitness,
|
|
32
|
+
producerOutputPaths,
|
|
33
|
+
providerReceipt,
|
|
34
|
+
type ReceiptEvidence,
|
|
35
|
+
receiptNode,
|
|
36
|
+
} from './ensure-built-receipt.js';
|
|
37
|
+
import {
|
|
38
|
+
censusStart,
|
|
39
|
+
graphInstallationIdentity,
|
|
40
|
+
movedNodes,
|
|
41
|
+
type NodeWitness,
|
|
42
|
+
workspaceSnapshot,
|
|
43
|
+
} from './ensure-built-witness.js';
|
|
44
|
+
import { graphInputContractIdentity } from './graph-input-contract.js';
|
|
45
|
+
|
|
46
|
+
export interface ProducerReceiptsOptions {
|
|
47
|
+
readonly producerReceipts?: { readonly targets: readonly string[] };
|
|
48
|
+
}
|
|
49
|
+
interface ToolResolution {
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly from: string;
|
|
52
|
+
readonly target: string | null;
|
|
53
|
+
}
|
|
54
|
+
interface Installation {
|
|
55
|
+
readonly nodes: readonly NodeWitness[];
|
|
56
|
+
readonly resolutions: readonly (readonly [string, string, string | null])[];
|
|
57
|
+
readonly localInputs: string | null;
|
|
58
|
+
}
|
|
59
|
+
interface TargetBasis {
|
|
60
|
+
readonly graph: TaskGraph;
|
|
61
|
+
readonly source: ProducerSourceWitness;
|
|
62
|
+
}
|
|
63
|
+
interface RunBasis {
|
|
64
|
+
readonly projectGraph: ProjectGraph;
|
|
65
|
+
readonly nxJson: NxJsonConfiguration;
|
|
66
|
+
readonly targets: ReadonlyMap<string, TargetBasis>;
|
|
67
|
+
readonly tools: readonly EnsureBuiltProducerTool[];
|
|
68
|
+
readonly toolNodes: readonly NodeWitness[];
|
|
69
|
+
}
|
|
70
|
+
type RunFrame = ReceiptEvidence<RunBasis>;
|
|
71
|
+
interface PublishedReceipt {
|
|
72
|
+
readonly version: 1;
|
|
73
|
+
readonly disposition: 'published';
|
|
74
|
+
readonly receipt: EnsureBuiltReceipt;
|
|
75
|
+
readonly projectGraph: ProjectGraph;
|
|
76
|
+
readonly taskGraph: TaskGraph;
|
|
77
|
+
readonly nxJson: NxJsonConfiguration;
|
|
78
|
+
}
|
|
79
|
+
interface RefusedReceipt {
|
|
80
|
+
readonly version: 1;
|
|
81
|
+
readonly disposition: 'refused';
|
|
82
|
+
readonly target: string;
|
|
83
|
+
readonly detail: string;
|
|
84
|
+
}
|
|
85
|
+
type ProducerRecord = PublishedReceipt | RefusedReceipt;
|
|
86
|
+
const runs = new Map<string, RunFrame>();
|
|
87
|
+
function sha(value: unknown): string {
|
|
88
|
+
return createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
89
|
+
}
|
|
90
|
+
function configured(options: ProducerReceiptsOptions | undefined): readonly string[] {
|
|
91
|
+
return options?.producerReceipts?.targets ?? [];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Where a record of `disposition` lives. A refusal has its own file beside the receipt, so a run that could not prove
|
|
95
|
+
* its products never replaces the receipt an earlier run published: readers validate that receipt on its own evidence.
|
|
96
|
+
*/
|
|
97
|
+
function recordPath(root: string, target: string, disposition: ProducerRecord['disposition']): string {
|
|
98
|
+
const load = createWorkspaceNxRequire(root);
|
|
99
|
+
return join(
|
|
100
|
+
load('nx/src/utils/cache-directory').workspaceDataDirectoryForWorkspace(root),
|
|
101
|
+
`producer-${disposition === 'published' ? 'receipt' : 'refusal'}-${sha(target)}.json`,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
function publish(root: string, target: string, record: ProducerRecord): ReceiptEvidence<true> {
|
|
105
|
+
try {
|
|
106
|
+
const path = recordPath(root, target, record.disposition);
|
|
107
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
108
|
+
const temporary = `${path}.${randomUUID()}`;
|
|
109
|
+
try {
|
|
110
|
+
writeFileSync(temporary, JSON.stringify(record), { flag: 'wx', mode: 0o600 });
|
|
111
|
+
renameSync(temporary, path);
|
|
112
|
+
} finally {
|
|
113
|
+
rmSync(temporary, { force: true });
|
|
114
|
+
}
|
|
115
|
+
// A receipt answers the refusal of any run before it.
|
|
116
|
+
if (record.disposition === 'published') rmSync(recordPath(root, target, 'refused'), { force: true });
|
|
117
|
+
return { ok: true, value: true };
|
|
118
|
+
} catch (error) {
|
|
119
|
+
if (error instanceof Error)
|
|
120
|
+
return { ok: false, detail: `Cannot publish producer ${record.disposition} record: ${error.message}` };
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function same(left: unknown, right: unknown): boolean {
|
|
125
|
+
return JSON.stringify(left) === JSON.stringify(right);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Whether a tool node whose stamp does not prove it (its ctime alone moved, or it was read in the tick it changed in,
|
|
129
|
+
* recordedStamp) still reads as `tools` recorded it: the same bytes, link text,
|
|
130
|
+
* membership and mode. Bun's global store is shared by every checkout, and linking a package's bin on any of their
|
|
131
|
+
* installs re-chmods the store file to the mode it already has; that moves the ctime of a node these tools witness
|
|
132
|
+
* without changing it, and is no reason to refuse the run.
|
|
133
|
+
*/
|
|
134
|
+
function recordedTool(tools: readonly EnsureBuiltProducerTool[]): (path: string) => boolean {
|
|
135
|
+
const recorded = new Map(tools.flatMap((tool) => tool.nodes.map((node) => [node.path, node] as const)));
|
|
136
|
+
return (path) => {
|
|
137
|
+
const node = recorded.get(path);
|
|
138
|
+
return node !== undefined && same(receiptNode(path, path), node);
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function missing(paths: readonly string[]): boolean {
|
|
142
|
+
return paths.every((path) => {
|
|
143
|
+
try {
|
|
144
|
+
lstatSync(path);
|
|
145
|
+
return false;
|
|
146
|
+
} catch (error) {
|
|
147
|
+
if (error instanceof Error && 'code' in error && ['ENOENT', 'ENOTDIR'].includes(String(error.code))) return true;
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function defaultOverrides(task: Task): boolean {
|
|
153
|
+
return Object.entries(task.overrides).every(
|
|
154
|
+
([name, value]) => name === '__overrides_unparsed__' && Array.isArray(value) && value.length === 0,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
function targetGraph(root: string, target: string, projectGraph: ProjectGraph): TaskGraph {
|
|
158
|
+
const selector = parseTargetSelector(target);
|
|
159
|
+
if (selector === null) throw new Error(`Invalid declared producer target ${target}`);
|
|
160
|
+
return createWorkspaceNxRequire(root)('nx/src/tasks-runner/create-task-graph').createTaskGraph(
|
|
161
|
+
projectGraph,
|
|
162
|
+
{},
|
|
163
|
+
[selector.project],
|
|
164
|
+
[selector.target],
|
|
165
|
+
selector.configuration,
|
|
166
|
+
{},
|
|
167
|
+
false,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
/** Tool resolution is captured in producer scope; readers inspect its recorded filesystem, not their own environment. */
|
|
171
|
+
function toolsFor(
|
|
172
|
+
root: string,
|
|
173
|
+
nxJson: NxJsonConfiguration,
|
|
174
|
+
projectGraph: ProjectGraph,
|
|
175
|
+
bases: readonly TargetBasis[],
|
|
176
|
+
): ReceiptEvidence<{ readonly tools: readonly EnsureBuiltProducerTool[]; readonly nodes: readonly NodeWitness[] }> {
|
|
177
|
+
try {
|
|
178
|
+
const load = createWorkspaceNxRequire(root);
|
|
179
|
+
const data = load('nx/src/utils/cache-directory').workspaceDataDirectoryForWorkspace(root);
|
|
180
|
+
const snapshot = workspaceSnapshot(root, new (load('nx/src/native').WorkspaceContext)(root, data), undefined);
|
|
181
|
+
const local = graphInputContractIdentity(root, nxJson, snapshot);
|
|
182
|
+
// A task's npm external inputs (AllExternalDependencies, and the `npm:` nodes of its project's dependency closure)
|
|
183
|
+
// are Nx's lockfile identities, bound by the receipt's hashDetails and the committed tree's bun.lock. They add no
|
|
184
|
+
// installed closure: resolved from the task's project, a transitive or uninstalled-optional node is unresolvable
|
|
185
|
+
// under Bun's isolated linker, and the installed closure of every lockfile package measured 46 MB of evidence and
|
|
186
|
+
// 10 s of census. The tools that compute the graph and hashes are still bound below.
|
|
187
|
+
let needsCargo = false;
|
|
188
|
+
for (const basis of bases) {
|
|
189
|
+
const proof = providerInputProof(root, nxJson, projectGraph, basis.graph, load);
|
|
190
|
+
if (proof.runtimeSource.kind === 'opaque') return { ok: false, detail: proof.runtimeSource.detail };
|
|
191
|
+
needsCargo ||= Object.values(proof.inputs).some((input) => input.runtime.length > 0);
|
|
192
|
+
}
|
|
193
|
+
let installationMiss = 'unproved installed module/resolution closure';
|
|
194
|
+
const identity = graphInstallationIdentity(
|
|
195
|
+
root,
|
|
196
|
+
nxJson,
|
|
197
|
+
load('nx/src/utils/package-json').readModulePackageJson,
|
|
198
|
+
load('nx/src/native').expandOutputs,
|
|
199
|
+
local ?? { plugins: [], packages: [], identity: '[]' },
|
|
200
|
+
(detail) => {
|
|
201
|
+
installationMiss = detail;
|
|
202
|
+
},
|
|
203
|
+
);
|
|
204
|
+
if (identity === null)
|
|
205
|
+
return { ok: false, detail: `Producer installed module/resolution closure is unproved: ${installationMiss}` };
|
|
206
|
+
const installation = typia.json.isParse<Installation>(identity);
|
|
207
|
+
if (installation === null) return { ok: false, detail: 'Invalid installed module closure evidence' };
|
|
208
|
+
const observed: NodeWitness[] = [];
|
|
209
|
+
const census = { start: censusStart(), observed };
|
|
210
|
+
const paths = new Set(installation.nodes.map(({ path }) => path));
|
|
211
|
+
const absent = new Set<string>();
|
|
212
|
+
function namespace(path: string): void {
|
|
213
|
+
let stats: ReturnType<typeof lstatSync>;
|
|
214
|
+
try {
|
|
215
|
+
stats = lstatSync(path);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
if (error instanceof Error && 'code' in error && ['ENOENT', 'ENOTDIR'].includes(String(error.code))) {
|
|
218
|
+
absent.add(path);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
throw error;
|
|
222
|
+
}
|
|
223
|
+
paths.add(path);
|
|
224
|
+
if (stats.isSymbolicLink()) paths.add(realpathSync(path));
|
|
225
|
+
if (stats.isDirectory()) for (const name of readdirSync(path)) paths.add(join(path, name));
|
|
226
|
+
}
|
|
227
|
+
const resolutions: ToolResolution[] = [];
|
|
228
|
+
for (const [from, name, target] of installation.resolutions) {
|
|
229
|
+
resolutions.push({ from, name, target });
|
|
230
|
+
for (const directory of createRequire(join(from, 'package.json')).resolve.paths(name) ?? []) {
|
|
231
|
+
namespace(directory);
|
|
232
|
+
const candidate = join(directory, name);
|
|
233
|
+
if (existsSync(candidate)) namespace(candidate);
|
|
234
|
+
else absent.add(candidate);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const nodes = [...paths].sort().map((path) => receiptNode(path, path, census));
|
|
238
|
+
const module: EnsureBuiltProducerTool = {
|
|
239
|
+
kind: 'module',
|
|
240
|
+
name: 'installed-nx-plugin-closure',
|
|
241
|
+
from: root,
|
|
242
|
+
path: root,
|
|
243
|
+
physicalPath: realpathSync(root),
|
|
244
|
+
nodes,
|
|
245
|
+
missing: [...absent].sort(),
|
|
246
|
+
resolutions,
|
|
247
|
+
sha256: sha(nodes),
|
|
248
|
+
};
|
|
249
|
+
const tools: EnsureBuiltProducerTool[] = [module];
|
|
250
|
+
for (const name of ['nx-runtime', 'bun', 'sh', 'git', ...(needsCargo ? ['rustc', 'cargo'] : [])]) {
|
|
251
|
+
const candidates =
|
|
252
|
+
name === 'nx-runtime'
|
|
253
|
+
? [process.execPath]
|
|
254
|
+
: (process.env.PATH ?? '').split(delimiter).map((directory) => resolve(directory || root, name));
|
|
255
|
+
const skipped: string[] = [];
|
|
256
|
+
let path: string | undefined;
|
|
257
|
+
for (const candidate of candidates) {
|
|
258
|
+
if (
|
|
259
|
+
(existsSync(candidate) && lstatSync(candidate).isFile()) ||
|
|
260
|
+
(existsSync(candidate) && lstatSync(candidate).isSymbolicLink())
|
|
261
|
+
) {
|
|
262
|
+
path = candidate;
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
skipped.push(candidate);
|
|
266
|
+
}
|
|
267
|
+
if (path === undefined) return { ok: false, detail: `Unbound producer executable ${name}` };
|
|
268
|
+
const physicalPath = realpathSync(path);
|
|
269
|
+
const entries = [...new Set([path, physicalPath])].map((entry) => receiptNode(entry, entry, census));
|
|
270
|
+
tools.push({
|
|
271
|
+
kind: 'executable',
|
|
272
|
+
name,
|
|
273
|
+
from: root,
|
|
274
|
+
path,
|
|
275
|
+
physicalPath,
|
|
276
|
+
nodes: entries,
|
|
277
|
+
missing: skipped,
|
|
278
|
+
resolutions: [],
|
|
279
|
+
sha256: sha(entries),
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
const capture = movedNodes(observed, recordedTool(tools));
|
|
283
|
+
if (capture !== null)
|
|
284
|
+
return { ok: false, detail: `Producer tool/module namespace moved during capture: ${capture}` };
|
|
285
|
+
if (!missing(module.missing))
|
|
286
|
+
return { ok: false, detail: 'Producer tool/module namespace moved during capture: a missing candidate appeared' };
|
|
287
|
+
return { ok: true, value: { tools, nodes: observed } };
|
|
288
|
+
} catch (error) {
|
|
289
|
+
if (error instanceof Error) return { ok: false, detail: `Cannot prove producer tool closure: ${error.message}` };
|
|
290
|
+
throw error;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function verifyTools(tools: readonly EnsureBuiltProducerTool[]): ReceiptEvidence<readonly NodeWitness[]> {
|
|
294
|
+
try {
|
|
295
|
+
const observed: NodeWitness[] = [];
|
|
296
|
+
const census = { start: censusStart(), observed };
|
|
297
|
+
for (const tool of tools) {
|
|
298
|
+
if (realpathSync(tool.path) !== tool.physicalPath || !missing(tool.missing))
|
|
299
|
+
return { ok: false, detail: `Producer tool alias/namespace changed: ${tool.name}` };
|
|
300
|
+
const nodes = tool.nodes.map((node) => receiptNode(node.path, node.path, census));
|
|
301
|
+
if (!same(nodes, tool.nodes) || sha(nodes) !== tool.sha256)
|
|
302
|
+
return { ok: false, detail: `Producer tool/module bytes changed: ${tool.name}` };
|
|
303
|
+
}
|
|
304
|
+
const moved = movedNodes(observed, recordedTool(tools));
|
|
305
|
+
return moved === null
|
|
306
|
+
? { ok: true, value: observed }
|
|
307
|
+
: { ok: false, detail: `Producer tool nodes changed during readonly validation: ${moved}` };
|
|
308
|
+
} catch (error) {
|
|
309
|
+
if (error instanceof Error) return { ok: false, detail: `Cannot validate producer tools: ${error.message}` };
|
|
310
|
+
throw error;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
export function completedProducerTasks(
|
|
314
|
+
graph: TaskGraph,
|
|
315
|
+
results: PostTasksExecutionContext['taskResults'],
|
|
316
|
+
): ReceiptEvidence<readonly Task[]> {
|
|
317
|
+
const tasks: Task[] = [];
|
|
318
|
+
for (const planned of Object.values(graph.tasks)) {
|
|
319
|
+
const result = results[planned.id];
|
|
320
|
+
if (
|
|
321
|
+
result === undefined ||
|
|
322
|
+
result.code !== 0 ||
|
|
323
|
+
!['success', 'local-cache', 'local-cache-kept-existing', 'remote-cache'].includes(result.status)
|
|
324
|
+
)
|
|
325
|
+
return { ok: false, detail: `No actual successful completion for ${planned.id}` };
|
|
326
|
+
if (
|
|
327
|
+
result.task.hash === undefined ||
|
|
328
|
+
result.task.hashDetails === undefined ||
|
|
329
|
+
!defaultOverrides(result.task) ||
|
|
330
|
+
!same(result.task.outputs, planned.outputs) ||
|
|
331
|
+
!same(result.task.target, planned.target)
|
|
332
|
+
)
|
|
333
|
+
return { ok: false, detail: `Unbound actual hash/default target/outputs for ${planned.id}` };
|
|
334
|
+
tasks.push(result.task);
|
|
335
|
+
}
|
|
336
|
+
return { ok: true, value: tasks };
|
|
337
|
+
}
|
|
338
|
+
export function producerEnvironmentIdentity(inputs: EnsureBuiltProducerReceipt['inputs']): string {
|
|
339
|
+
return sha(
|
|
340
|
+
inputs.map(({ taskId, expanded, hashDetails }) => ({
|
|
341
|
+
taskId,
|
|
342
|
+
runtime: expanded.runtime,
|
|
343
|
+
environment: expanded.environment,
|
|
344
|
+
identity: hashDetails,
|
|
345
|
+
})),
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
export async function preTasksExecution(
|
|
349
|
+
options: ProducerReceiptsOptions | undefined,
|
|
350
|
+
context: PreTasksExecutionContext,
|
|
351
|
+
): Promise<void> {
|
|
352
|
+
const targets = configured(options);
|
|
353
|
+
if (targets.length === 0) return;
|
|
354
|
+
try {
|
|
355
|
+
const load = createWorkspaceNxRequire(context.workspaceRoot);
|
|
356
|
+
const projectGraph = await load('nx/src/project-graph/project-graph').createProjectGraphAsync();
|
|
357
|
+
const bases = new Map<string, TargetBasis>();
|
|
358
|
+
for (const target of targets) {
|
|
359
|
+
const graph = targetGraph(context.workspaceRoot, target, projectGraph);
|
|
360
|
+
const outputs = producerOutputPaths(
|
|
361
|
+
context.workspaceRoot,
|
|
362
|
+
Object.values(graph.tasks),
|
|
363
|
+
load('nx/src/native').expandOutputs,
|
|
364
|
+
);
|
|
365
|
+
const source = captureProducerSource(context.workspaceRoot, outputs);
|
|
366
|
+
if (!source.ok) {
|
|
367
|
+
runs.set(context.id, source);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
bases.set(target, { graph, source: source.value });
|
|
371
|
+
}
|
|
372
|
+
const tools = toolsFor(context.workspaceRoot, context.nxJsonConfiguration, projectGraph, [...bases.values()]);
|
|
373
|
+
runs.set(
|
|
374
|
+
context.id,
|
|
375
|
+
tools.ok
|
|
376
|
+
? {
|
|
377
|
+
ok: true,
|
|
378
|
+
value: {
|
|
379
|
+
projectGraph,
|
|
380
|
+
nxJson: context.nxJsonConfiguration,
|
|
381
|
+
targets: bases,
|
|
382
|
+
tools: tools.value.tools,
|
|
383
|
+
toolNodes: tools.value.nodes,
|
|
384
|
+
},
|
|
385
|
+
}
|
|
386
|
+
: tools,
|
|
387
|
+
);
|
|
388
|
+
} catch (error) {
|
|
389
|
+
if (error instanceof Error) runs.set(context.id, { ok: false, detail: error.message });
|
|
390
|
+
else throw error;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
export async function postTasksExecution(
|
|
394
|
+
options: ProducerReceiptsOptions | undefined,
|
|
395
|
+
context: PostTasksExecutionContext,
|
|
396
|
+
): Promise<void> {
|
|
397
|
+
const frame = runs.get(context.id);
|
|
398
|
+
runs.delete(context.id);
|
|
399
|
+
for (const target of configured(options)) {
|
|
400
|
+
const selected = parseTargetSelector(target);
|
|
401
|
+
if (selected === null) continue;
|
|
402
|
+
const targetBasis = frame?.ok === true ? frame.value.targets.get(target) : undefined;
|
|
403
|
+
const plannedRoot =
|
|
404
|
+
targetBasis === undefined
|
|
405
|
+
? undefined
|
|
406
|
+
: Object.values(targetBasis.graph.tasks).find(
|
|
407
|
+
(task) => task.target.project === selected.project && task.target.target === selected.target,
|
|
408
|
+
);
|
|
409
|
+
const rootResult =
|
|
410
|
+
plannedRoot === undefined
|
|
411
|
+
? Object.values(context.taskResults).find(
|
|
412
|
+
({ task }) =>
|
|
413
|
+
task.target.project === selected.project &&
|
|
414
|
+
task.target.target === selected.target &&
|
|
415
|
+
(selected.configuration === undefined || task.target.configuration === selected.configuration),
|
|
416
|
+
)
|
|
417
|
+
: context.taskResults[plannedRoot.id];
|
|
418
|
+
if (rootResult === undefined) continue;
|
|
419
|
+
const refuse = (detail: string) => {
|
|
420
|
+
const saved = publish(context.workspaceRoot, target, { version: 1, disposition: 'refused', target, detail });
|
|
421
|
+
if (!saved.ok) process.stderr.write(`producerReceipts: ${target}: ${saved.detail}\n`);
|
|
422
|
+
process.stderr.write(`producerReceipts: ${target}: ${detail}\n`);
|
|
423
|
+
};
|
|
424
|
+
if (frame === undefined || !frame.ok) {
|
|
425
|
+
refuse(frame === undefined ? 'No bound producer pre-execution frame' : frame.detail);
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
const basis = frame.value.targets.get(target);
|
|
429
|
+
if (basis === undefined) {
|
|
430
|
+
refuse('No declared target pre-execution basis');
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
const completed = completedProducerTasks(basis.graph, context.taskResults);
|
|
434
|
+
if (!completed.ok) {
|
|
435
|
+
refuse(completed.detail);
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
const tasks = completed.value;
|
|
439
|
+
let detail: string | undefined;
|
|
440
|
+
const execution = movedNodes(frame.value.toolNodes, recordedTool(frame.value.tools));
|
|
441
|
+
if (execution !== null) {
|
|
442
|
+
refuse(`Producer tool/module nodes changed across actual execution: ${execution}`);
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
445
|
+
const load = createWorkspaceNxRequire(context.workspaceRoot);
|
|
446
|
+
const graph: TaskGraph = { ...basis.graph, tasks: Object.fromEntries(tasks.map((task) => [task.id, task])) };
|
|
447
|
+
const proof = providerInputProof(
|
|
448
|
+
context.workspaceRoot,
|
|
449
|
+
context.nxJsonConfiguration,
|
|
450
|
+
frame.value.projectGraph,
|
|
451
|
+
graph,
|
|
452
|
+
load,
|
|
453
|
+
);
|
|
454
|
+
if (proof.runtimeSource.kind === 'opaque') {
|
|
455
|
+
refuse(proof.runtimeSource.detail);
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
const files = new Map(basis.source.files.map((file) => [file.path, file]));
|
|
459
|
+
const inputs: EnsureBuiltProducerReceipt['inputs'][number][] = [];
|
|
460
|
+
for (const task of tasks) {
|
|
461
|
+
const expanded = proof.inputs[task.id];
|
|
462
|
+
const hashDetails = task.hashDetails;
|
|
463
|
+
if (expanded === undefined || hashDetails === undefined || expanded.files.some((path) => !files.has(path))) {
|
|
464
|
+
detail = `Actual FILE/hash evidence is unbound for ${task.id}`;
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
const declared =
|
|
468
|
+
frame.value.projectGraph.nodes[task.target.project]?.data.targets?.[task.target.target]?.inputs ?? [];
|
|
469
|
+
inputs.push({
|
|
470
|
+
taskId: task.id,
|
|
471
|
+
overrides: task.overrides,
|
|
472
|
+
declared,
|
|
473
|
+
expanded,
|
|
474
|
+
hashDetails,
|
|
475
|
+
files: expanded.files.map((path) => {
|
|
476
|
+
const file = files.get(path);
|
|
477
|
+
if (file === undefined) throw new Error(`Lost HEAD-bound input ${path}`);
|
|
478
|
+
return file;
|
|
479
|
+
}),
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
if (detail !== undefined) {
|
|
483
|
+
refuse(detail);
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
const producer: Omit<EnsureBuiltProducerReceipt, 'outputSha256'> = {
|
|
487
|
+
version: 1,
|
|
488
|
+
target,
|
|
489
|
+
argv: [...context.argv],
|
|
490
|
+
trackedTreeClean: true,
|
|
491
|
+
environmentIdentity: producerEnvironmentIdentity(inputs),
|
|
492
|
+
inputs,
|
|
493
|
+
tools: frame.value.tools,
|
|
494
|
+
wallTimeMs: context.endTime - context.startTime,
|
|
495
|
+
};
|
|
496
|
+
if (!Number.isFinite(producer.wallTimeMs) || producer.wallTimeMs < 0) {
|
|
497
|
+
refuse('Invalid actual Nx execution timing');
|
|
498
|
+
continue;
|
|
499
|
+
}
|
|
500
|
+
const result = providerReceipt(
|
|
501
|
+
context.workspaceRoot,
|
|
502
|
+
selectorTaskId(selected),
|
|
503
|
+
tasks,
|
|
504
|
+
proof,
|
|
505
|
+
load('nx/src/native').expandOutputs,
|
|
506
|
+
basis.source,
|
|
507
|
+
producer,
|
|
508
|
+
);
|
|
509
|
+
if (result.disposition !== 'hit') {
|
|
510
|
+
refuse(result.reason.detail);
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
const census = movedNodes(frame.value.toolNodes, recordedTool(frame.value.tools));
|
|
514
|
+
if (census !== null) {
|
|
515
|
+
refuse(`Producer tools changed during post-execution product census: ${census}`);
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
const publication = publish(context.workspaceRoot, target, {
|
|
519
|
+
version: 1,
|
|
520
|
+
disposition: 'published',
|
|
521
|
+
receipt: result.receipt,
|
|
522
|
+
projectGraph: frame.value.projectGraph,
|
|
523
|
+
taskGraph: graph,
|
|
524
|
+
nxJson: frame.value.nxJson,
|
|
525
|
+
});
|
|
526
|
+
if (!publication.ok) process.stderr.write(`producerReceipts: ${target}: ${publication.detail}\n`);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Readonly consumers accept actual producer completion evidence, never their own environment/cache rows. A receipt
|
|
531
|
+
* that does not validate is a miss whose detail also carries the refusal of the producer's latest run, when it left one.
|
|
532
|
+
*/
|
|
533
|
+
export function readProducerReceipt(root: string, target: string): ReceiptEvidence<EnsureBuiltReceipt> {
|
|
534
|
+
const published = validatedReceipt(root, target);
|
|
535
|
+
if (published.ok) return published;
|
|
536
|
+
const refusal = latestRefusal(root, target);
|
|
537
|
+
return refusal === null
|
|
538
|
+
? published
|
|
539
|
+
: { ok: false, detail: `${published.detail}; the producer's latest run refused: ${refusal}` };
|
|
540
|
+
}
|
|
541
|
+
/** The detail of the refusal a producer run left after the last receipt, or null when none did. */
|
|
542
|
+
function latestRefusal(root: string, target: string): string | null {
|
|
543
|
+
try {
|
|
544
|
+
const record = typia.json.isParse<RefusedReceipt>(readFileSync(recordPath(root, target, 'refused'), 'utf8'));
|
|
545
|
+
return record === null || record.version !== 1 ? 'corrupt producer refusal record' : record.detail;
|
|
546
|
+
} catch (error) {
|
|
547
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') return null;
|
|
548
|
+
if (error instanceof Error) return `unreadable producer refusal record: ${error.message}`;
|
|
549
|
+
throw error;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
function validatedReceipt(root: string, target: string): ReceiptEvidence<EnsureBuiltReceipt> {
|
|
553
|
+
try {
|
|
554
|
+
const record = typia.json.isParse<PublishedReceipt>(readFileSync(recordPath(root, target, 'published'), 'utf8'));
|
|
555
|
+
if (record === null || record.version !== 1)
|
|
556
|
+
return { ok: false, detail: 'Missing/corrupt producer completion contract' };
|
|
557
|
+
const receipt = record.receipt;
|
|
558
|
+
if (
|
|
559
|
+
receipt.workspaceRoot !== realpathSync(root) ||
|
|
560
|
+
receipt.producer.version !== 1 ||
|
|
561
|
+
receipt.producer.target !== target ||
|
|
562
|
+
!receipt.producer.trackedTreeClean
|
|
563
|
+
)
|
|
564
|
+
return { ok: false, detail: 'Producer receipt target/provider identity differs' };
|
|
565
|
+
if (receipt.producer.environmentIdentity !== producerEnvironmentIdentity(receipt.producer.inputs))
|
|
566
|
+
return { ok: false, detail: 'Corrupt declared producer environment identity' };
|
|
567
|
+
if (
|
|
568
|
+
receipt.producer.inputs.length !== receipt.tasks.length ||
|
|
569
|
+
new Set(receipt.producer.inputs.map(({ taskId }) => taskId)).size !== receipt.tasks.length
|
|
570
|
+
)
|
|
571
|
+
return { ok: false, detail: 'Producer input/task membership differs' };
|
|
572
|
+
const expected = targetGraph(root, target, record.projectGraph);
|
|
573
|
+
if (
|
|
574
|
+
!same(Object.keys(expected.tasks).sort(), Object.keys(record.taskGraph.tasks).sort()) ||
|
|
575
|
+
Object.values(record.taskGraph.tasks).some(
|
|
576
|
+
(task) =>
|
|
577
|
+
!defaultOverrides(task) ||
|
|
578
|
+
!same(task.target, expected.tasks[task.id]?.target) ||
|
|
579
|
+
!same(task.outputs, expected.tasks[task.id]?.outputs),
|
|
580
|
+
)
|
|
581
|
+
)
|
|
582
|
+
return { ok: false, detail: 'Producer target/default overrides or configuration differ' };
|
|
583
|
+
const source = captureProducerSource(
|
|
584
|
+
root,
|
|
585
|
+
receipt.tasks.flatMap(({ outputs }) => outputs.map(({ path }) => path)),
|
|
586
|
+
);
|
|
587
|
+
if (!source.ok) return source;
|
|
588
|
+
if (source.value.headTree !== receipt.headTree)
|
|
589
|
+
return { ok: false, detail: 'Current committed tree differs from producer basis tree' };
|
|
590
|
+
const tools = verifyTools(receipt.producer.tools);
|
|
591
|
+
if (!tools.ok) return tools;
|
|
592
|
+
const load = createWorkspaceNxRequire(root);
|
|
593
|
+
const proof = providerInputProof(root, record.nxJson, record.projectGraph, record.taskGraph, load);
|
|
594
|
+
const files = new Map(source.value.files.map((file) => [file.path, file]));
|
|
595
|
+
for (const task of receipt.tasks) {
|
|
596
|
+
const input = receipt.producer.inputs.find(({ taskId }) => taskId === task.id);
|
|
597
|
+
if (
|
|
598
|
+
input === undefined ||
|
|
599
|
+
!same(input.expanded, proof.inputs[task.id]) ||
|
|
600
|
+
!same(input.hashDetails, record.taskGraph.tasks[task.id]?.hashDetails) ||
|
|
601
|
+
!same(input.overrides, record.taskGraph.tasks[task.id]?.overrides) ||
|
|
602
|
+
input.files.some((file) => !same(files.get(file.path), file))
|
|
603
|
+
)
|
|
604
|
+
return { ok: false, detail: `Declared FILE/input identity differs for ${task.id}` };
|
|
605
|
+
}
|
|
606
|
+
const census = providerReceipt(
|
|
607
|
+
root,
|
|
608
|
+
target,
|
|
609
|
+
Object.values(record.taskGraph.tasks),
|
|
610
|
+
proof,
|
|
611
|
+
load('nx/src/native').expandOutputs,
|
|
612
|
+
source.value,
|
|
613
|
+
receipt.producer,
|
|
614
|
+
);
|
|
615
|
+
if (
|
|
616
|
+
census.disposition !== 'hit' ||
|
|
617
|
+
!same(census.receipt.tasks, receipt.tasks) ||
|
|
618
|
+
census.receipt.producer.outputSha256 !== receipt.producer.outputSha256
|
|
619
|
+
)
|
|
620
|
+
return {
|
|
621
|
+
ok: false,
|
|
622
|
+
detail:
|
|
623
|
+
census.disposition === 'hit'
|
|
624
|
+
? 'Public product bytes differ from actual producer receipt'
|
|
625
|
+
: census.reason.detail,
|
|
626
|
+
};
|
|
627
|
+
const moved = movedNodes(tools.value, recordedTool(receipt.producer.tools));
|
|
628
|
+
if (moved !== null)
|
|
629
|
+
return { ok: false, detail: `Producer tool namespace changed during independent product validation: ${moved}` };
|
|
630
|
+
return { ok: true, value: receipt };
|
|
631
|
+
} catch (error) {
|
|
632
|
+
if (error instanceof Error)
|
|
633
|
+
return { ok: false, detail: `Cannot validate producer completion receipt: ${error.message}` };
|
|
634
|
+
throw error;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
@@ -141,7 +141,7 @@ describe('a planted runtime input failure through real Nx', () => {
|
|
|
141
141
|
expect(await readFile(join(record, 'stderr'), 'utf8')).toBe('planted-cause\n');
|
|
142
142
|
expect(await readFile(join(record, 'report'), 'utf8')).toContain('runtime input exited 3: sh -c');
|
|
143
143
|
});
|
|
144
|
-
}
|
|
144
|
+
});
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
|
|
@@ -81,7 +81,7 @@ describe('the real-APFS serial groups of this repository', () => {
|
|
|
81
81
|
for (const inputs of [device, host]) {
|
|
82
82
|
expect(inputs.filter((input) => input.startsWith('!') && /\btests?\b/.test(input))).toEqual([]);
|
|
83
83
|
}
|
|
84
|
-
}
|
|
84
|
+
});
|
|
85
85
|
|
|
86
86
|
it('run the host group after the device group, so two real-image runners never overlap', async () => {
|
|
87
87
|
const nx = await readRecord('nx.json', JSON.parse);
|
|
@@ -160,7 +160,7 @@ describe('the real-APFS serial groups of this repository', () => {
|
|
|
160
160
|
expect(planned(['host-e2e']).filter((id) => id !== hostGate)).toEqual(planned([DEVICE_GROUP, HOST_GROUP]));
|
|
161
161
|
expect(planned(['test'])).not.toContain(device);
|
|
162
162
|
expect(planned(['test'])).not.toContain(host);
|
|
163
|
-
}
|
|
163
|
+
});
|
|
164
164
|
|
|
165
165
|
it('wrap exactly their tests in the 30s code-bound class, behind the 60s class that wins first', async () => {
|
|
166
166
|
const config = await readRecord(NEXTEST_REPO_CONFIG_PATH, parseToml);
|
|
@@ -198,7 +198,7 @@ describe('the real-APFS serial groups of this repository', () => {
|
|
|
198
198
|
// ordinary shard beside every other test, not in a serial group.
|
|
199
199
|
expect([...owners].filter((name) => !scoped.has(name))).toEqual([]);
|
|
200
200
|
expect([...owners].sort()).toEqual(['cowshed-apfs-tests', 'cowshed-cli', 'cowshed-core']);
|
|
201
|
-
}
|
|
201
|
+
});
|
|
202
202
|
|
|
203
203
|
it('pin each exact test by a function that exists at that module path', async () => {
|
|
204
204
|
const groups = serialTestGroups(join(REPOSITORY, NEXTEST_REPO_CONFIG_PATH));
|
|
@@ -217,7 +217,7 @@ describe('the real-APFS serial groups of this repository', () => {
|
|
|
217
217
|
expect(holders[0]?.path, exactName).toMatch(new RegExp(`/src/${modulePath}(?:/mod)?\\.rs$`));
|
|
218
218
|
expect(holders[0]?.text, exactName).toContain('mod tests');
|
|
219
219
|
}
|
|
220
|
-
}
|
|
220
|
+
});
|
|
221
221
|
});
|
|
222
222
|
|
|
223
223
|
/** `path` of the repository, parsed by `parse`, which must be an object. */
|