@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.
Files changed (158) hide show
  1. package/README.md +277 -89
  2. package/dist/bin/smoo-nx-test-clocks.d.ts +3 -0
  3. package/dist/bin/smoo-nx-test-clocks.d.ts.map +1 -0
  4. package/dist/bin/smoo-nx-test-clocks.js +28 -0
  5. package/dist/bounded-test-policy.d.ts +8 -8
  6. package/dist/bounded-test-policy.d.ts.map +1 -1
  7. package/dist/bounded-test-policy.js +18 -30
  8. package/dist/cargo-closure-input.d.ts +23 -0
  9. package/dist/cargo-closure-input.d.ts.map +1 -1
  10. package/dist/cargo-closure-input.js +41 -9
  11. package/dist/cargo-source-hash.d.ts.map +1 -1
  12. package/dist/cargo-source-hash.js +42 -19
  13. package/dist/ensure-built-receipt.d.ts +40 -6
  14. package/dist/ensure-built-receipt.d.ts.map +1 -1
  15. package/dist/ensure-built-receipt.js +297 -159
  16. package/dist/ensure-built-witness.d.ts +65 -4
  17. package/dist/ensure-built-witness.d.ts.map +1 -1
  18. package/dist/ensure-built-witness.js +2237 -23
  19. package/dist/ensure-built.d.ts +99 -1
  20. package/dist/ensure-built.d.ts.map +1 -1
  21. package/dist/ensure-built.js +45 -56
  22. package/dist/executors/bounded-exec/cpu-pool.d.ts +22 -7
  23. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
  24. package/dist/executors/bounded-exec/cpu-pool.js +51 -22
  25. package/dist/executors/bounded-exec/executor.d.ts +12 -3
  26. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  27. package/dist/executors/bounded-exec/executor.js +174 -51
  28. package/dist/executors/bounded-exec/no-space.d.ts +8 -0
  29. package/dist/executors/bounded-exec/no-space.d.ts.map +1 -0
  30. package/dist/executors/bounded-exec/no-space.js +31 -0
  31. package/dist/executors/bounded-exec/ram-temp.d.ts +20 -11
  32. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
  33. package/dist/executors/bounded-exec/ram-temp.js +42 -17
  34. package/dist/executors/bounded-exec/verdict.d.ts +34 -4
  35. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  36. package/dist/executors/bounded-exec/verdict.js +54 -3
  37. package/dist/generators/bun-test-tracing/generator.js +2 -2
  38. package/dist/graph-input-contract.d.ts +102 -0
  39. package/dist/graph-input-contract.d.ts.map +1 -0
  40. package/dist/graph-input-contract.js +637 -0
  41. package/dist/index.d.ts +12 -5
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +17 -3
  44. package/dist/managed-files/ci-workflow.d.ts.map +1 -1
  45. package/dist/managed-files/ci-workflow.js +5 -2
  46. package/dist/managed-files/publish-workflow.d.ts +11 -1
  47. package/dist/managed-files/publish-workflow.d.ts.map +1 -1
  48. package/dist/owned-installation.d.ts +14 -0
  49. package/dist/owned-installation.d.ts.map +1 -0
  50. package/dist/owned-installation.js +324 -0
  51. package/dist/producer-receipts.d.ts +19 -0
  52. package/dist/producer-receipts.d.ts.map +1 -0
  53. package/dist/producer-receipts.js +926 -0
  54. package/dist/test-backstop.d.ts +9 -0
  55. package/dist/test-backstop.d.ts.map +1 -0
  56. package/dist/test-backstop.js +10 -0
  57. package/dist/test-clock-policy.d.ts +30 -0
  58. package/dist/test-clock-policy.d.ts.map +1 -0
  59. package/dist/test-clock-policy.js +686 -0
  60. package/dist/testing.d.ts +8 -0
  61. package/dist/testing.d.ts.map +1 -1
  62. package/dist/testing.js +66 -1
  63. package/managed/raw/patches/nx@23.2.1.patch +328 -50
  64. package/managed/raw/tooling/direnv/developer-links.ts +148 -29
  65. package/managed/raw/tooling/direnv/devenv.smoo.nix +7 -7
  66. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -5
  67. package/managed/raw/tooling/direnv/linked-snapshots.ts +206 -40
  68. package/managed/raw/tooling/direnv/repo-path +15 -2
  69. package/managed/raw/tooling/direnv/setup-environment.ts +179 -115
  70. package/managed/templates/github/actions/cache-node-modules/action.yml +9 -0
  71. package/managed/templates/github/actions/setup-devenv/action.yml +63 -7
  72. package/nextest.toml +1 -1
  73. package/package.json +25 -9
  74. package/src/__tests__/cargo-closure-fixture.ts +113 -0
  75. package/src/__tests__/counted-cargo.ts +8 -25
  76. package/src/__tests__/directory-change.ts +27 -0
  77. package/src/__tests__/fixture-nx-env.ts +7 -0
  78. package/src/__tests__/owned-installation.ts +14 -0
  79. package/src/__tests__/past-tick.ts +12 -0
  80. package/src/bin/smoo-nx-bound-failures.test.ts +1 -1
  81. package/src/bin/smoo-nx-test-clocks.ts +29 -0
  82. package/src/bounded-test-policy.test.ts +36 -22
  83. package/src/bounded-test-policy.ts +18 -32
  84. package/src/bun-bootstrap.test.ts +1 -1
  85. package/src/cargo-closure-input.property.test.ts +50 -0
  86. package/src/cargo-closure-input.test.ts +73 -121
  87. package/src/cargo-closure-input.ts +47 -8
  88. package/src/cargo-closure-key.test.ts +239 -0
  89. package/src/cargo-resolve-cache.test.ts +168 -31
  90. package/src/cargo-source-hash.test.ts +78 -3
  91. package/src/cargo-source-hash.ts +48 -30
  92. package/src/cross-check-policy.test.ts +2 -2
  93. package/src/ensure-built-receipt.test.ts +111 -16
  94. package/src/ensure-built-receipt.ts +294 -149
  95. package/src/ensure-built-witness.test.ts +306 -13
  96. package/src/ensure-built-witness.ts +255 -24
  97. package/src/ensure-built.test.ts +228 -102
  98. package/src/ensure-built.ts +127 -66
  99. package/src/executors/bounded-exec/cpu-pool.test.ts +134 -32
  100. package/src/executors/bounded-exec/cpu-pool.ts +64 -20
  101. package/src/executors/bounded-exec/cpu-tokens.test.ts +2 -2
  102. package/src/executors/bounded-exec/disk-lease.test.ts +47 -13
  103. package/src/executors/bounded-exec/executor-host.test.ts +74 -52
  104. package/src/executors/bounded-exec/executor.test.ts +343 -97
  105. package/src/executors/bounded-exec/executor.ts +192 -56
  106. package/src/executors/bounded-exec/hang-diagnostics.test.ts +14 -8
  107. package/src/executors/bounded-exec/no-space.ts +40 -0
  108. package/src/executors/bounded-exec/progress.test.ts +1 -1
  109. package/src/executors/bounded-exec/ram-temp-host.test.ts +51 -21
  110. package/src/executors/bounded-exec/ram-temp.test.ts +92 -16
  111. package/src/executors/bounded-exec/ram-temp.ts +49 -20
  112. package/src/executors/bounded-exec/verdict.test.ts +127 -22
  113. package/src/executors/bounded-exec/verdict.ts +78 -3
  114. package/src/generators/bounded-test-targets/generator.test.ts +1 -3
  115. package/src/generators/bun-test-tracing/generator.test.ts +2 -2
  116. package/src/generators/bun-test-tracing/generator.ts +2 -2
  117. package/src/graph-input-contract.test.ts +379 -0
  118. package/src/graph-input-contract.ts +627 -0
  119. package/src/index.test.ts +3 -3
  120. package/src/index.ts +24 -3
  121. package/src/linked-snapshots.nx.test.ts +112 -30
  122. package/src/managed-files/ci-workflow.ts +5 -2
  123. package/src/managed-files/publish-workflow.ts +12 -1
  124. package/src/managed-files/repo-path.test.ts +44 -1
  125. package/src/managed-files/setup-devenv-free-disk.test.ts +95 -0
  126. package/src/nextest-code-bound.test.ts +23 -17
  127. package/src/nextest-extraction.test.ts +114 -4
  128. package/src/nextest-partitions.test.ts +7 -1
  129. package/src/nx-cache-restore-mtime.test.ts +2 -2
  130. package/src/nx-daemon-claim.test.ts +10 -8
  131. package/src/nx-daemon-idle-cpu.test.ts +0 -1
  132. package/src/nx-daemon-idle-policy.test.ts +61 -1
  133. package/src/nx-daemon-ignore-files.test.ts +2 -2
  134. package/src/nx-daemon-validity.test.ts +36 -22
  135. package/src/nx-dot-input-policy.test.ts +5 -5
  136. package/src/nx-files-archive-racy.test.ts +1 -1
  137. package/src/nx-incomplete-run-summary.test.ts +1 -1
  138. package/src/nx-plugin-load-errors.test.ts +2 -2
  139. package/src/nx-project-graph-errors.test.ts +70 -0
  140. package/src/nx-skipped-task-exit.test.ts +2 -2
  141. package/src/nx-store-resolution.test.ts +7 -25
  142. package/src/nx-task-output-lease.test.ts +3 -3
  143. package/src/nx-use-local.test.ts +7 -5
  144. package/src/owned-installation.ts +174 -0
  145. package/src/producer-receipts.test.ts +164 -0
  146. package/src/producer-receipts.ts +636 -0
  147. package/src/runtime-input.test.ts +1 -1
  148. package/src/serial-group-wiring.test.ts +4 -4
  149. package/src/task-results.test.ts +18 -16
  150. package/src/test-backstop.ts +11 -0
  151. package/src/test-clock-policy.test.ts +338 -0
  152. package/src/test-clock-policy.ts +708 -0
  153. package/src/test-timings.test.ts +2 -2
  154. package/src/testing.test.ts +5 -5
  155. package/src/testing.ts +67 -1
  156. package/src/typecheck-test-policy.test.ts +1 -1
  157. package/src/typescript-resolution.test.ts +76 -0
  158. package/test-timings.json +8 -0
@@ -1,14 +1,18 @@
1
1
  import { spawnSync } from 'node:child_process';
2
2
  import { createHash } from 'node:crypto';
3
- import { closeSync, lstatSync, openSync, readdirSync, readlinkSync, readSync, realpathSync } from 'node:fs';
3
+ import { closeSync, lstatSync, openSync, readdirSync, readFileSync, readlinkSync, readSync, realpathSync, } from 'node:fs';
4
4
  import { isAbsolute, join, relative } from 'node:path';
5
5
  import { CARGO_TOOLCHAIN_PIN_INPUTS, cargoRuntimeInput } from './cargo-toolchain-policy.js';
6
- import { nodeStamp, nodesUnchanged } from './ensure-built-witness.js';
7
- function git(root, args) {
8
- // Provenance belongs to this provider, not a Git directory/index/object
9
- // namespace an outer build lent the process. Nx's hashing environment is
10
- // unchanged; only these read-only evidence children bind their own Git state.
11
- const env = { ...process.env };
6
+ import { censusStart, movedNodes, recordedStamp } from './ensure-built-witness.js';
7
+ /**
8
+ * Git as receipts read it: the checkout and nothing of the operator's home. The producer hooks run in whichever process
9
+ * Nx runs plugins in, a workspace's sandboxed daemon included, which adopts a host client's HOME; git with that HOME
10
+ * reads the operator's global configuration, the sandbox denies it, and git dies (specs/cowshed/04_sandbox.md, the
11
+ * runtime-input contract). A receipt's tree, HEAD and tracked-file status are read under the repository's own
12
+ * configuration alone, so a host run and a sandboxed run agree on them.
13
+ */
14
+ export function receiptGit(root, args) {
15
+ const env = { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' };
12
16
  for (const key of [
13
17
  'GIT_DIR',
14
18
  'GIT_COMMON_DIR',
@@ -27,7 +31,7 @@ function git(root, args) {
27
31
  detail: `git ${args.join(' ')}: ${child.error?.message ?? child.stderr.trim()} (exit ${child.status}, signal ${child.signal})`,
28
32
  };
29
33
  }
30
- /** NUL-delimited Git paths preserve whitespace, rename sources and index-only changes. */
34
+ /** NUL-delimited paths preserve whitespace, rename sources and index-only changes. */
31
35
  export function dirtyProviderPaths(status) {
32
36
  const entries = status.split('\0');
33
37
  const paths = [];
@@ -44,8 +48,230 @@ export function dirtyProviderPaths(status) {
44
48
  }
45
49
  return paths;
46
50
  }
47
- export function providerReceipt(workspaceRoot, taskId, tasks, proof, expand) {
48
- const root = realpathSync(workspaceRoot);
51
+ function graphConfiguration(path) {
52
+ const name = path.slice(path.lastIndexOf('/') + 1);
53
+ return [
54
+ 'nx.json',
55
+ 'project.json',
56
+ 'package.json',
57
+ 'bun.lock',
58
+ 'bun.lockb',
59
+ 'package-lock.json',
60
+ 'pnpm-lock.yaml',
61
+ 'yarn.lock',
62
+ ].includes(name);
63
+ }
64
+ let readBuffer;
65
+ function fileReadBuffer() {
66
+ if (readBuffer === undefined)
67
+ readBuffer = Buffer.allocUnsafe(1 << 20);
68
+ return readBuffer;
69
+ }
70
+ function hashFile(path, size, algorithms, blob) {
71
+ const hashes = algorithms.map((algorithm) => createHash(algorithm));
72
+ if (blob)
73
+ for (const hash of hashes)
74
+ hash.update(`blob ${size}\0`);
75
+ const buffer = fileReadBuffer();
76
+ const descriptor = openSync(path, 'r');
77
+ try {
78
+ for (let offset = 0; offset < size; offset += buffer.length) {
79
+ const length = Math.min(buffer.length, size - offset);
80
+ if (readSync(descriptor, buffer, 0, length, offset) !== length)
81
+ throw new Error(`File moved while reading ${path}`);
82
+ for (const hash of hashes)
83
+ hash.update(buffer.subarray(0, length));
84
+ }
85
+ }
86
+ finally {
87
+ closeSync(descriptor);
88
+ }
89
+ return hashes.map((hash) => hash.digest('hex'));
90
+ }
91
+ function sourceFileDigests(path, size, algorithm) {
92
+ const blob = createHash(algorithm).update(`blob ${size}\0`);
93
+ const raw = createHash('sha256');
94
+ const buffer = fileReadBuffer();
95
+ const descriptor = openSync(path, 'r');
96
+ try {
97
+ for (let offset = 0; offset < size; offset += buffer.length) {
98
+ const length = Math.min(buffer.length, size - offset);
99
+ if (readSync(descriptor, buffer, 0, length, offset) !== length)
100
+ throw new Error(`Source moved while reading ${path}`);
101
+ const bytes = buffer.subarray(0, length);
102
+ blob.update(bytes);
103
+ raw.update(bytes);
104
+ }
105
+ }
106
+ finally {
107
+ closeSync(descriptor);
108
+ }
109
+ return { gitBlob: blob.digest('hex'), sha256: raw.digest('hex') };
110
+ }
111
+ /**
112
+ * One independently read node; absolute paths also serve tool/package closures. A census records the node's stamp as
113
+ * of its `start` (recordedStamp); a re-read against a record records none.
114
+ */
115
+ export function receiptNode(path, name, census) {
116
+ const stats = lstatSync(path, { bigint: true });
117
+ census?.observed.push({ path, stamp: recordedStamp(stats, census.start) });
118
+ const mode = Number(stats.mode & 4095n);
119
+ if (stats.isFile())
120
+ return { path: name, type: 'file', mode, sha256: hashFile(path, Number(stats.size), ['sha256'], false)[0] };
121
+ if (stats.isSymbolicLink())
122
+ return { path: name, type: 'symlink', mode, linkText: readlinkSync(path) };
123
+ if (stats.isDirectory()) {
124
+ const entries = readdirSync(path).sort();
125
+ return {
126
+ path: name,
127
+ type: 'directory',
128
+ mode,
129
+ entries,
130
+ sha256: createHash('sha256').update(JSON.stringify(entries)).digest('hex'),
131
+ };
132
+ }
133
+ throw new Error(`Unsupported receipt node ${path}`);
134
+ }
135
+ /**
136
+ * Whether a tracked source node whose stamp does not prove it (its ctime alone moved, or it was read in the tick it
137
+ * changed in) still holds the bytes or link text `files` recorded for it.
138
+ */
139
+ function recordedSource(root, files) {
140
+ const recorded = new Map(files.map((file) => [join(root, file.path), file.sha256]));
141
+ return (path) => recorded.get(path) ===
142
+ createHash('sha256')
143
+ .update(lstatSync(path).isSymbolicLink() ? readlinkSync(path) : readFileSync(path))
144
+ .digest('hex');
145
+ }
146
+ /** Capture every tracked source byte at pre. Unrelated untracked files are not source basis. */
147
+ export function captureProducerSource(root, outputs) {
148
+ try {
149
+ const revision = receiptGit(root, ['rev-parse', '--verify', 'HEAD']);
150
+ if (!revision.ok)
151
+ return revision;
152
+ const head = revision.value.trim();
153
+ const tree = receiptGit(root, ['rev-parse', '--verify', `${head}^{tree}`]);
154
+ if (!tree.ok)
155
+ return tree;
156
+ const listed = receiptGit(root, ['ls-tree', '-r', '-z', '--full-tree', head]);
157
+ if (!listed.ok)
158
+ return listed;
159
+ const format = receiptGit(root, ['rev-parse', '--show-object-format']);
160
+ if (!format.ok)
161
+ return format;
162
+ const algorithm = format.value.trim();
163
+ if (algorithm !== 'sha1' && algorithm !== 'sha256')
164
+ return { ok: false, detail: `Unproved Git object format ${algorithm}` };
165
+ const excluded = new Set(outputs.filter((path) => !graphConfiguration(path)));
166
+ const nodes = [];
167
+ const files = [];
168
+ const start = censusStart();
169
+ for (const entry of listed.value.split('\0')) {
170
+ if (entry === '')
171
+ continue;
172
+ const tab = entry.indexOf('\t');
173
+ const [mode, kind, oid] = entry.slice(0, tab).split(' ');
174
+ if (tab < 0 || oid === undefined || mode === undefined)
175
+ return { ok: false, detail: `Unproved HEAD tree entry ${entry}` };
176
+ if (kind !== 'blob')
177
+ return { ok: false, detail: `Unbound tracked source namespace ${entry}` };
178
+ const file = entry.slice(tab + 1);
179
+ if (excluded.has(file))
180
+ continue;
181
+ const path = join(root, file);
182
+ const stats = lstatSync(path, { bigint: true });
183
+ nodes.push({ path, stamp: recordedStamp(stats, start) });
184
+ const actualMode = stats.isSymbolicLink() ? '120000' : (stats.mode & 73n) !== 0n ? '100755' : '100644';
185
+ if (actualMode !== mode)
186
+ return { ok: false, detail: `Tracked source mode differs from HEAD: ${file}` };
187
+ let gitBlob;
188
+ let sha256;
189
+ if (stats.isFile()) {
190
+ const digests = sourceFileDigests(path, Number(stats.size), algorithm);
191
+ gitBlob = digests.gitBlob;
192
+ sha256 = digests.sha256;
193
+ }
194
+ else if (stats.isSymbolicLink()) {
195
+ const text = readlinkSync(path);
196
+ gitBlob = createHash(algorithm)
197
+ .update(`blob ${Buffer.byteLength(text)}\0`)
198
+ .update(text)
199
+ .digest('hex');
200
+ sha256 = createHash('sha256').update(text).digest('hex');
201
+ }
202
+ else
203
+ return { ok: false, detail: `Unbound tracked source node: ${file}` };
204
+ if (gitBlob !== oid)
205
+ return { ok: false, detail: `Tracked source bytes differ from HEAD: ${file}` };
206
+ files.push({ path: file, mode: Number(stats.mode & 4095n), gitBlob, sha256 });
207
+ }
208
+ const status = receiptGit(root, ['status', '--porcelain=v1', '-z', '--untracked-files=no']);
209
+ if (!status.ok)
210
+ return status;
211
+ const dirty = dirtyProviderPaths(status.value).filter((path) => !excluded.has(path));
212
+ if (dirty.length !== 0)
213
+ return { ok: false, detail: `Tracked source/index differs from ${head}: ${dirty.join(', ')}` };
214
+ const moved = movedNodes(nodes, recordedSource(root, files));
215
+ if (moved !== null)
216
+ return { ok: false, detail: `Tracked source moved during producer pre capture: ${moved}` };
217
+ return { ok: true, value: { head, headTree: tree.value.trim(), files, nodes, outputs } };
218
+ }
219
+ catch (error) {
220
+ if (error instanceof Error)
221
+ return { ok: false, detail: `Cannot prove tracked producer tree: ${error.message}` };
222
+ throw error;
223
+ }
224
+ }
225
+ export function producerSourceUnchanged(root, before) {
226
+ const revision = receiptGit(root, ['rev-parse', '--verify', 'HEAD']);
227
+ if (!revision.ok)
228
+ return revision;
229
+ const status = receiptGit(root, ['status', '--porcelain=v1', '-z', '--untracked-files=no']);
230
+ if (!status.ok)
231
+ return status;
232
+ const outputs = new Set(before.outputs.filter((path) => !graphConfiguration(path)));
233
+ const tree = receiptGit(root, ['rev-parse', '--verify', `${revision.value.trim()}^{tree}`]);
234
+ if (!tree.ok)
235
+ return tree;
236
+ const changed = 'Producer HEAD/tracked source nodes changed across actual task execution';
237
+ if (tree.value.trim() !== before.headTree)
238
+ return { ok: false, detail: `${changed}: HEAD's tree is ${tree.value.trim()}, not ${before.headTree}` };
239
+ const dirty = dirtyProviderPaths(status.value).filter((path) => !outputs.has(path));
240
+ if (dirty.length !== 0)
241
+ return { ok: false, detail: `${changed}: ${dirty.join(', ')} differ from HEAD` };
242
+ const moved = movedNodes(before.nodes, recordedSource(root, before.files));
243
+ if (moved !== null)
244
+ return { ok: false, detail: `${changed}: ${moved}` };
245
+ return { ok: true, value: true };
246
+ }
247
+ /** Enumerate exact public nodes; never exempt a broad directory of tracked source. */
248
+ export function producerOutputPaths(root, tasks, expand) {
249
+ const paths = new Set();
250
+ function visit(path) {
251
+ if (isAbsolute(path) || path.split('/').includes('..'))
252
+ throw new Error(`Output escapes provider: ${path}`);
253
+ if (paths.has(path))
254
+ return;
255
+ paths.add(path);
256
+ let stats;
257
+ try {
258
+ stats = lstatSync(join(root, path));
259
+ }
260
+ catch (error) {
261
+ if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
262
+ return;
263
+ throw error;
264
+ }
265
+ if (stats.isDirectory())
266
+ for (const name of readdirSync(join(root, path)))
267
+ visit(join(path, name));
268
+ }
269
+ for (const task of tasks)
270
+ for (const path of expand(root, task.outputs))
271
+ visit(path);
272
+ return [...paths].sort();
273
+ }
274
+ export function providerReceipt(root, taskId, tasks, proof, expand, source, producer) {
49
275
  const failed = (detail) => ({
50
276
  disposition: 'failed',
51
277
  reason: { kind: 'provider-proof', taskId, workspaceRoot: root, detail },
@@ -54,191 +280,103 @@ export function providerReceipt(workspaceRoot, taskId, tasks, proof, expand) {
54
280
  });
55
281
  if (proof.runtimeSource.kind === 'opaque')
56
282
  return failed(proof.runtimeSource.detail);
57
- const revision = git(root, ['rev-parse', '--verify', 'HEAD']);
58
- if (!revision.ok)
59
- return failed(revision.detail);
60
- const head = revision.value.trim();
61
- const tree = git(root, ['rev-parse', '--verify', `${head}^{tree}`]);
62
- if (!tree.ok)
63
- return failed(tree.detail);
64
- const status = git(root, ['status', '--porcelain=v1', '-z', '--untracked-files=all']);
65
- if (!status.ok)
66
- return failed(status.detail);
67
- const listed = git(root, ['ls-tree', '-r', '-z', '--full-tree', head]);
68
- if (!listed.ok)
69
- return failed(listed.detail);
70
- const format = git(root, ['rev-parse', '--show-object-format']);
71
- if (!format.ok)
72
- return failed(format.detail);
73
- const algorithm = format.value.trim();
74
- if (algorithm !== 'sha1' && algorithm !== 'sha256')
75
- return failed(`Unproved Git object format ${algorithm}`);
76
- const tracked = new Map();
77
- for (const entry of listed.value.split('\0')) {
78
- if (entry === '')
79
- continue;
80
- const tab = entry.indexOf('\t');
81
- const [mode, kind, oid] = entry.slice(0, tab).split(' ');
82
- if (tab < 0 || oid === undefined)
83
- return failed(`Unproved HEAD tree entry ${entry}`);
84
- if (kind !== 'blob')
85
- continue;
86
- tracked.set(entry.slice(tab + 1), { mode, oid });
283
+ const stable = producerSourceUnchanged(root, source);
284
+ if (!stable.ok)
285
+ return failed(stable.detail);
286
+ const sourceFiles = new Map(source.files.map((file) => [file.path, file]));
287
+ for (const file of proof.files) {
288
+ const record = sourceFiles.get(file);
289
+ if (record === undefined)
290
+ return failed(`Actual Nx FILE input is not bound to provider HEAD: ${file}`);
291
+ if (!lstatSync(join(root, file)).isFile())
292
+ return failed(`Unbound linked/non-file Nx source: ${file}`);
87
293
  }
88
294
  const observed = [];
89
- const buffer = Buffer.allocUnsafe(1 << 20);
90
- const outputNodes = new Map();
91
- function observe(path) {
92
- const stats = lstatSync(path, { bigint: true });
93
- observed.push({ path, stamp: nodeStamp(stats) });
94
- return stats;
95
- }
96
- function fileDigest(path, size, algorithm, gitBlob) {
97
- const hash = createHash(algorithm);
98
- if (gitBlob)
99
- hash.update(`blob ${size}\0`);
100
- const fd = openSync(path, 'r');
101
- try {
102
- for (let offset = 0; offset < size; offset += buffer.length) {
103
- const count = Math.min(buffer.length, size - offset);
104
- if (readSync(fd, buffer, 0, count, offset) !== count)
105
- throw new Error(`File moved while reading ${path}`);
106
- hash.update(buffer.subarray(0, count));
107
- }
108
- }
109
- finally {
110
- closeSync(fd);
111
- }
112
- return hash.digest('hex');
113
- }
295
+ const census = { start: censusStart(), observed };
296
+ const parents = new Set();
297
+ const outputs = new Map();
114
298
  function visit(path) {
115
- const rel = relative(root, path);
116
- if (rel === '..' || rel.startsWith('../') || isAbsolute(rel))
117
- throw new Error(`Output escapes provider: ${path}`);
118
- const previous = outputNodes.get(rel);
119
- if (previous !== undefined)
120
- return previous;
121
- const stats = observe(path);
122
- const mode = Number(stats.mode & 4095n);
123
- let node;
124
- if (stats.isFile()) {
125
- node = { path: rel, type: 'file', mode, sha256: fileDigest(path, Number(stats.size), 'sha256', false) };
126
- }
127
- else if (stats.isSymbolicLink()) {
128
- node = { path: rel, type: 'symlink', mode, linkText: readlinkSync(path) };
129
- }
130
- else if (stats.isDirectory()) {
131
- const children = readdirSync(path)
132
- .sort()
133
- .map((name) => visit(join(path, name)));
134
- const entries = children.map(({ path: child }) => relative(rel, child));
135
- node = {
136
- path: rel,
137
- type: 'directory',
138
- mode,
139
- entries,
140
- sha256: createHash('sha256').update(JSON.stringify(children)).digest('hex'),
141
- };
299
+ if (outputs.has(path))
300
+ return;
301
+ const absolute = join(root, path);
302
+ let node = receiptNode(absolute, path, census);
303
+ if (node.type === 'directory') {
304
+ for (const entry of node.entries)
305
+ visit(join(path, entry));
306
+ const children = node.entries.map((entry) => outputs.get(join(path, entry)));
307
+ node = { ...node, sha256: createHash('sha256').update(JSON.stringify(children)).digest('hex') };
142
308
  }
143
- else {
144
- throw new Error(`Unsupported public output node ${path}`);
145
- }
146
- outputNodes.set(rel, node);
147
- return node;
309
+ outputs.set(path, node);
148
310
  }
149
311
  try {
150
312
  const receipts = [];
151
313
  for (const task of tasks) {
152
314
  if (task.hash === undefined)
153
- return failed(`No current hash for ${task.id}`);
315
+ return failed(`Actual completion supplied no hash for ${task.id}`);
154
316
  const entries = task.outputs.length === 0 ? [] : expand(root, task.outputs);
155
- if (task.outputs.length > 0 && entries.length === 0)
317
+ if (task.outputs.length !== 0 && entries.length === 0)
156
318
  return failed(`No public outputs for ${task.id}`);
157
- const selected = new Set();
158
319
  for (const entry of entries) {
159
320
  if (isAbsolute(entry) || entry.split('/').includes('..'))
160
- return failed(`Invalid public output ${entry} for ${task.id}`);
161
- // Root-to-entry parent directories must be real; do not follow a
162
- // parent link into an unrelated tree and sign its bytes.
321
+ return failed(`Output escapes provider: ${entry}`);
163
322
  let parent = root;
164
323
  for (const segment of entry.split('/').slice(0, -1)) {
165
324
  parent = join(parent, segment);
166
- if (!observe(parent).isDirectory())
325
+ const stats = lstatSync(parent, { bigint: true });
326
+ observed.push({ path: parent, stamp: recordedStamp(stats, census.start) });
327
+ parents.add(parent);
328
+ if (!stats.isDirectory())
167
329
  return failed(`Symlinked public output parent ${parent}`);
168
330
  }
169
- visit(join(root, entry));
170
- for (const path of outputNodes.keys()) {
171
- if (path === entry || path.startsWith(`${entry}/`))
172
- selected.add(path);
173
- }
331
+ visit(entry);
174
332
  }
175
333
  receipts.push({
176
334
  id: task.id,
177
335
  hash: task.hash,
178
- outputs: [...selected].sort().map((path) => {
179
- const node = outputNodes.get(path);
180
- if (node === undefined)
181
- throw new Error(`Lost output census node ${path}`);
182
- return node;
183
- }),
336
+ outputs: [...outputs]
337
+ .filter(([path]) => entries.some((entry) => path === entry || path.startsWith(`${entry}/`)))
338
+ .sort(([left], [right]) => left.localeCompare(right))
339
+ .map(([, node]) => node),
184
340
  });
185
341
  }
186
- const fileInputs = new Set(proof.files);
187
- const deletedSource = status.value
188
- .split('\0')
189
- .some((entry) => (entry[0] === 'D' || entry[1] === 'D') && !outputNodes.has(entry.slice(3)));
190
- const effectiveKind = deletedSource ? 'conservative-provider-source' : proof.kind;
191
- const dirty = dirtyProviderPaths(status.value).filter((path) => (!outputNodes.has(path) || fileInputs.has(path)) &&
192
- (effectiveKind === 'conservative-provider-source' || fileInputs.has(path)));
193
- if (dirty.length > 0)
194
- return failed(`${effectiveKind}: provider source differs from ${head}: ${dirty.join(', ')}`);
195
- for (const file of fileInputs) {
196
- const expected = tracked.get(file);
197
- if (expected === undefined)
198
- return failed(`Nx file input is not in provider HEAD tree: ${file}`);
199
- const path = join(root, file);
200
- const stats = observe(path);
201
- const mode = stats.isSymbolicLink() ? '120000' : (stats.mode & 73n) !== 0n ? '100755' : '100644';
202
- if (mode !== expected.mode)
203
- return failed(`Nx file input mode differs from provider HEAD: ${file}`);
204
- if (!stats.isFile())
205
- return failed(`Unproved linked or non-file input source closure: ${file}`);
206
- const oid = fileDigest(path, Number(stats.size), algorithm, true);
207
- if (oid !== expected.oid)
208
- return failed(`Nx file input bytes differ from provider HEAD: ${file}`);
209
- }
210
- const finalHead = git(root, ['rev-parse', '--verify', 'HEAD']);
211
- const finalStatus = git(root, ['status', '--porcelain=v1', '-z', '--untracked-files=all']);
212
- if (!finalHead.ok)
213
- return failed(finalHead.detail);
214
- if (!finalStatus.ok)
215
- return failed(finalStatus.detail);
216
- const newlyDirty = dirtyProviderPaths(finalStatus.value).some((path) => (!outputNodes.has(path) || fileInputs.has(path)) &&
217
- (effectiveKind === 'conservative-provider-source' || fileInputs.has(path)));
218
- if (finalHead.value.trim() !== head || newlyDirty || !nodesUnchanged(observed)) {
219
- return failed('Provider source, revision or public output nodes moved during receipt capture');
220
- }
342
+ const final = producerSourceUnchanged(root, source);
343
+ if (!final.ok)
344
+ return failed(final.detail);
345
+ // An output whose stamp does not prove it (its ctime alone moved, or it was read in the tick it changed in, as a
346
+ // task's last writes are) is re-read against its record. A parent directory binds only the real directory the path
347
+ // runs through, which the device, inode and mode its kept stamp still show.
348
+ const moved = movedNodes(observed, (path) => {
349
+ const record = outputs.get(relative(root, path));
350
+ if (record === undefined)
351
+ return parents.has(path);
352
+ const now = receiptNode(path, record.path);
353
+ return record.type === 'directory' && now.type === 'directory'
354
+ ? record.mode === now.mode && JSON.stringify(record.entries) === JSON.stringify(now.entries)
355
+ : JSON.stringify(record) === JSON.stringify(now);
356
+ });
357
+ if (moved !== null)
358
+ return failed(`Public outputs changed during independent census: ${moved}`);
359
+ const outputSha256 = createHash('sha256').update(JSON.stringify(receipts)).digest('hex');
221
360
  return {
222
361
  disposition: 'hit',
223
362
  receipt: {
224
- workspaceRoot: root,
225
- head,
226
- headTree: tree.value.trim(),
227
- tasks: receipts,
228
- fileInputProvenance: effectiveKind,
363
+ workspaceRoot: realpathSync(root),
364
+ head: source.head,
365
+ headTree: source.headTree,
366
+ fileInputProvenance: proof.kind,
229
367
  runtimeEnvironmentProvenance: 'nx-task-hash-only',
368
+ producer: { ...producer, outputSha256 },
369
+ tasks: receipts,
230
370
  },
231
371
  };
232
372
  }
233
373
  catch (error) {
234
374
  if (error instanceof Error)
235
- return failed(`Cannot prove provider source/public outputs: ${error.message}`);
375
+ return failed(`Cannot prove public product census: ${error.message}`);
236
376
  throw error;
237
377
  }
238
378
  }
239
- /** Admit only recipes emitted by the same owning toolchain generator.
240
- * No shell parsing or keyword approximation confers file-source provenance.
241
- */
379
+ /** Admit only version recipes emitted by the owning generator and declared toolchain pins. */
242
380
  export function boundedReceiptRuntimes(inputs, directories, files, installationProved) {
243
381
  const runtimes = Object.values(inputs).flatMap((input) => input.runtime);
244
382
  if (runtimes.length === 0)
@@ -1,10 +1,45 @@
1
1
  import type { BigIntStats } from 'node:fs';
2
2
  import type { NxJsonConfiguration } from 'nx/src/config/nx-json';
3
3
  import type { ProjectGraph } from 'nx/src/config/project-graph';
4
- import type { FileData, WorkspaceContext } from 'nx/src/native';
4
+ import type { expandOutputs, FileData, WorkspaceContext } from 'nx/src/native';
5
5
  import type { readModulePackageJsonWithoutFallbacks } from 'nx/src/utils/package-json';
6
- /** Identity of a previously read node, not a timestamp freshness threshold. */
7
- export declare function nodeStamp(stats: BigIntStats): string;
6
+ import type { GraphInputContractProof } from './graph-input-contract.js';
7
+ /** The stat fields a node's identity is read from. */
8
+ export type StampFields = Pick<BigIntStats, 'dev' | 'ino' | 'mode' | 'size' | 'mtimeNs' | 'ctimeNs'>;
9
+ /** The stamp a node reads as now: device, inode, mode, size, mtime and ctime. What a recorded stamp is compared with. */
10
+ export declare function nodeStamp(stats: StampFields): string;
11
+ /**
12
+ * How an observed stamp compares with the recorded one: `same`; `ctime` when device, inode, mode, size and mtime are
13
+ * kept and only the ctime moved (a same-mode chmod, which Bun's bin linking does to a shared store file on any
14
+ * checkout's install) or was recorded `unproven` ({@link recordedStamp}); otherwise `moved`. A function of the two
15
+ * stamps alone, so no filesystem or clock decides it.
16
+ */
17
+ export declare function stampMove(recorded: string, observed: string): 'same' | 'ctime' | 'moved';
18
+ /**
19
+ * How long after a node's last change a stamp read of it proves nothing about the next change: git's racily clean
20
+ * rule (git's Documentation/technical/racy-git.txt), which the Nx archive repair already applies to Nx's own file
21
+ * hashes (patches/README.md). A filesystem dates a change by the kernel's clock. On Linux, on a filesystem without
22
+ * fine-grained timestamps such as ZFS, that is the coarse clock, which moves once a jiffy: 1 ms at CONFIG_HZ=1000, as
23
+ * on CI's runner, and 10 ms at CONFIG_HZ=100, the slowest. A same-size rewrite in the tick a stamp was read in leaves
24
+ * every field of it as it was. Node can read neither the jiffy nor a filesystem's granularity, and a shorter window
25
+ * reopens the gap on a slower kernel, so this is the slowest tick, and no option.
26
+ */
27
+ export declare const SAME_TICK_NS = 10000000n;
28
+ /** The time a census starts, read before its first stat: what {@link unproven} judges each node's change by. */
29
+ export declare function censusStart(): bigint;
30
+ /**
31
+ * Whether a census that started at `start` read a node within {@link SAME_TICK_NS} of its last change (the later of
32
+ * its ctime and mtime, so a node dated ahead counts). Its stamp is then unproven, not unchanged: a rewrite in the same
33
+ * tick could leave it as it is.
34
+ */
35
+ export declare function unproven(stats: StampFields, start: bigint): boolean;
36
+ /**
37
+ * The stamp a census that started at `start` records for a later reader: its {@link nodeStamp}, or, when that is
38
+ * {@link unproven}, the same with its ctime recorded as `unproven`. No stamp read later equals that, so the reader
39
+ * re-reads the node rather than trust the stamp, as it does a node whose ctime alone moved ({@link stampMove}), or
40
+ * counts it moved when it holds nothing to re-read it against. Only such a node costs a re-read.
41
+ */
42
+ export declare function recordedStamp(stats: StampFields, start: bigint): string;
8
43
  export interface NodeWitness {
9
44
  readonly path: string;
10
45
  readonly stamp: string;
@@ -29,14 +64,35 @@ export declare function writeWitness(path: string, value: GraphWitness | Artifac
29
64
  * Nx's Unix archive uses whole-second mtimes, so allFileData alone cannot
30
65
  * prove an immediate same-second rewrite. An unbound archive hash is never
31
66
  * admitted: on the first capture every file is rehashed through Nx itself.
67
+ * The nodes are recorded for later captures and readers (recordedStamp), so a
68
+ * node this capture read in the tick it changed in is rehashed by the next.
32
69
  */
33
70
  export declare function workspaceSnapshot(workspaceRoot: string, context: WorkspaceContext, previous: WorkspaceSnapshot | undefined): WorkspaceSnapshot;
34
71
  export declare function nodesUnchanged(nodes: readonly NodeWitness[]): boolean;
72
+ /**
73
+ * The witnessed nodes whose stamp is no longer the one read, named for a refusal (the first eight in witness order, a
74
+ * gone one with its error code, and how many more), or null when none moved. A node whose device, inode, mode, size
75
+ * and mtime are unchanged and only its ctime moved (a same-mode chmod, which Bun's bin linking does to a shared store
76
+ * file on any checkout's install), or whose ctime was recorded unproven ({@link recordedStamp}), asks for a comparison,
77
+ * not a verdict: `same` re-reads it, and one it finds as recorded has not changed. Without `same` every move counts.
78
+ */
79
+ export declare function movedNodes(nodes: readonly NodeWitness[], same?: (path: string) => boolean): string | null;
35
80
  /** Membership and content are exact. Outputs do not exempt manifests or
36
81
  * newly created/deleted files; this graph witness has no output exclusions.
37
82
  */
38
83
  export declare function snapshotsEqual(left: WorkspaceSnapshot, right: WorkspaceSnapshot): boolean;
39
84
  export declare function reusableGraph(witness: GraphWitness | null, workspaceRoot: string, environment: string, installation: string | null, snapshot: WorkspaceSnapshot): ProjectGraph | null;
85
+ /** What {@link graphInstallationIdentity} binds: resolution edges `[from, name, physical manifest]`, node stamps and
86
+ * file hashes, read once.
87
+ */
88
+ export interface GraphInstallationCensus {
89
+ readonly resolutions: readonly (readonly [string, string, string | null])[];
90
+ readonly nodes: readonly NodeWitness[];
91
+ readonly files: readonly {
92
+ readonly path: string;
93
+ readonly sha256: string;
94
+ }[];
95
+ }
40
96
  /** Plugins with opaque external graph inputs cannot borrow this proof.
41
97
  * For the repository plugin and Nx, bind the entire owned module/file tree
42
98
  * and its dependency/optional/peer resolution closure, including each alias,
@@ -44,7 +100,12 @@ export declare function reusableGraph(witness: GraphWitness | null, workspaceRoo
44
100
  * bytes, including manifest metadata; pre/post node stamps still reject a
45
101
  * tree that moved while reading. A missing optional dependency is recorded too.
46
102
  */
47
- export declare function graphInstallationIdentity(workspaceRoot: string, nxJson: NxJsonConfiguration, resolvePackage: typeof readModulePackageJsonWithoutFallbacks): string | null;
103
+ export declare function graphInstallationIdentity(workspaceRoot: string, nxJson: NxJsonConfiguration, resolvePackage: typeof readModulePackageJsonWithoutFallbacks, expand: typeof expandOutputs, localInputs: GraphInputContractProof | null, onUnproved?: (detail: string) => void): string | null;
104
+ /** One read of the installation closure {@link graphInstallationIdentity} binds, without its final check that no node
105
+ * moved while it was read: what a caller that needs the closure, not a proof of it, reads. `null`, with `onUnproved`
106
+ * told why, for a closure that cannot be read.
107
+ */
108
+ export declare function graphInstallationCensus(workspaceRoot: string, nxJson: NxJsonConfiguration, resolvePackage: typeof readModulePackageJsonWithoutFallbacks, expand: typeof expandOutputs, localInputs: GraphInputContractProof | null, onUnproved?: (detail: string) => void): GraphInstallationCensus | null;
48
109
  export interface ArtifactWitness {
49
110
  readonly version: 1;
50
111
  readonly workspaceRoot: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ensure-built-witness.d.ts","sourceRoot":"","sources":["../src/ensure-built-witness.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAc3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,YAA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