@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.
Files changed (110) hide show
  1. package/README.md +104 -25
  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 +1 -8
  6. package/dist/bounded-test-policy.d.ts.map +1 -1
  7. package/dist/bounded-test-policy.js +2 -8
  8. package/dist/cargo-closure-input.d.ts +11 -0
  9. package/dist/cargo-closure-input.d.ts.map +1 -1
  10. package/dist/cargo-closure-input.js +16 -6
  11. package/dist/ensure-built-receipt.d.ts +8 -2
  12. package/dist/ensure-built-receipt.d.ts.map +1 -1
  13. package/dist/ensure-built-receipt.js +45 -13
  14. package/dist/ensure-built-witness.d.ts +40 -4
  15. package/dist/ensure-built-witness.d.ts.map +1 -1
  16. package/dist/ensure-built-witness.js +68 -15
  17. package/dist/ensure-built.d.ts.map +1 -1
  18. package/dist/ensure-built.js +11 -3
  19. package/dist/executors/bounded-exec/cpu-pool.d.ts +7 -3
  20. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
  21. package/dist/executors/bounded-exec/cpu-pool.js +9 -4
  22. package/dist/executors/bounded-exec/cpu-tokens.d.ts +22 -5
  23. package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +1 -1
  24. package/dist/executors/bounded-exec/cpu-tokens.js +189 -18
  25. package/dist/executors/bounded-exec/executor.d.ts +1 -1
  26. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  27. package/dist/executors/bounded-exec/executor.js +38 -14
  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 +3 -0
  32. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
  33. package/dist/executors/bounded-exec/ram-temp.js +15 -4
  34. package/dist/executors/bounded-exec/run-cpu-pool.d.ts +10 -0
  35. package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -0
  36. package/dist/executors/bounded-exec/run-cpu-pool.js +63 -0
  37. package/dist/executors/bounded-exec/verdict.d.ts +34 -4
  38. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  39. package/dist/executors/bounded-exec/verdict.js +54 -3
  40. package/dist/graph-input-contract.d.ts +4 -0
  41. package/dist/graph-input-contract.d.ts.map +1 -1
  42. package/dist/graph-input-contract.js +17 -4
  43. package/dist/index.d.ts +3 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +13 -3
  46. package/dist/owned-installation.d.ts +14 -0
  47. package/dist/owned-installation.d.ts.map +1 -0
  48. package/dist/owned-installation.js +324 -0
  49. package/dist/producer-receipts.d.ts.map +1 -1
  50. package/dist/producer-receipts.js +15 -10
  51. package/dist/test-backstop.d.ts +9 -0
  52. package/dist/test-backstop.d.ts.map +1 -0
  53. package/dist/test-backstop.js +10 -0
  54. package/dist/test-clock-policy.d.ts +30 -0
  55. package/dist/test-clock-policy.d.ts.map +1 -0
  56. package/dist/test-clock-policy.js +686 -0
  57. package/dist/testing.d.ts.map +1 -1
  58. package/dist/testing.js +8 -1
  59. package/managed/raw/tooling/direnv/developer-links.ts +1 -8
  60. package/managed/raw/tooling/direnv/setup-environment.ts +13 -1
  61. package/package.json +15 -4
  62. package/src/__tests__/cargo-closure-fixture.ts +113 -0
  63. package/src/__tests__/counted-cargo.ts +8 -25
  64. package/src/__tests__/directory-change.ts +27 -0
  65. package/src/__tests__/owned-installation.ts +4 -164
  66. package/src/__tests__/past-tick.ts +12 -0
  67. package/src/bin/smoo-nx-test-clocks.ts +29 -0
  68. package/src/bounded-test-policy.ts +2 -8
  69. package/src/cargo-closure-input.property.test.ts +50 -0
  70. package/src/cargo-closure-input.test.ts +15 -112
  71. package/src/cargo-closure-input.ts +23 -6
  72. package/src/cargo-closure-key.test.ts +240 -0
  73. package/src/cargo-resolve-cache.test.ts +29 -7
  74. package/src/ensure-built-receipt.ts +56 -13
  75. package/src/ensure-built-witness.test.ts +113 -4
  76. package/src/ensure-built-witness.ts +75 -16
  77. package/src/ensure-built.test.ts +74 -2
  78. package/src/ensure-built.ts +13 -2
  79. package/src/executors/bounded-exec/cpu-pool.test.ts +18 -0
  80. package/src/executors/bounded-exec/cpu-pool.ts +10 -4
  81. package/src/executors/bounded-exec/cpu-tokens.test.ts +205 -0
  82. package/src/executors/bounded-exec/cpu-tokens.ts +229 -22
  83. package/src/executors/bounded-exec/disk-lease.test.ts +47 -13
  84. package/src/executors/bounded-exec/executor-host.test.ts +23 -11
  85. package/src/executors/bounded-exec/executor.test.ts +189 -63
  86. package/src/executors/bounded-exec/executor.ts +39 -13
  87. package/src/executors/bounded-exec/hang-diagnostics.test.ts +14 -8
  88. package/src/executors/bounded-exec/no-space.ts +40 -0
  89. package/src/executors/bounded-exec/ram-temp-host.test.ts +9 -8
  90. package/src/executors/bounded-exec/ram-temp.test.ts +32 -18
  91. package/src/executors/bounded-exec/ram-temp.ts +17 -4
  92. package/src/executors/bounded-exec/run-cpu-pool.test.ts +76 -0
  93. package/src/executors/bounded-exec/run-cpu-pool.ts +75 -0
  94. package/src/executors/bounded-exec/verdict.test.ts +125 -25
  95. package/src/executors/bounded-exec/verdict.ts +78 -3
  96. package/src/graph-input-contract.test.ts +8 -0
  97. package/src/graph-input-contract.ts +26 -4
  98. package/src/index.test.ts +12 -2
  99. package/src/index.ts +13 -3
  100. package/src/nextest-extraction.test.ts +114 -4
  101. package/src/nx-daemon-claim.test.ts +5 -3
  102. package/src/nx-daemon-idle-policy.test.ts +22 -18
  103. package/src/nx-daemon-validity.test.ts +5 -13
  104. package/src/owned-installation.ts +174 -0
  105. package/src/producer-receipts.ts +15 -10
  106. package/src/test-backstop.ts +11 -0
  107. package/src/test-clock-policy.test.ts +338 -0
  108. package/src/test-clock-policy.ts +708 -0
  109. package/src/testing.ts +8 -1
  110. package/test-timings.json +4 -0
@@ -1 +1 @@
1
- {"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AA+CA,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,4EAA4E;AAC5E,wBAAsB,YAAY,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAe5D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,EAAE,CAYvG;AAMD,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAc9C;AAED,iEAAiE;AACjE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,OAAmB,GAAG,IAAI,CAQ/E;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,YAAY,EAAE,EAClC,KAAK,EAAE,MAAM,EACb,SAAS,SAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED,uGAAuG;AACvG,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAgDnE;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkDpE;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MA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EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAIrG;AAoBD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAKhE;AAED;;;;;;;;GAQG;AACH,wBAAsB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA8BtF;AAED;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAMvG;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASnF;AA0DD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAqBxF"}
package/dist/testing.js CHANGED
@@ -36,8 +36,15 @@ import { dirname, isAbsolute, join, sep } from 'node:path';
36
36
  import { setTimeout as sleep } from 'node:timers/promises';
37
37
  import { promisify } from 'node:util';
38
38
  import { findNxWorkspaceRoot } from './ensure-built.js';
39
+ import { BOUNDED_TEST_IDLE_TIMEOUT_MS } from './test-backstop.js';
39
40
  const run = promisify(execFile);
40
- const EXIT_TIMEOUT_MS = 10_000;
41
+ /**
42
+ * How long a stopped process may take to exit when no caller names a grace: the leg's no-progress backstop
43
+ * (specs/cowshed/08_testing.md), so the exit itself decides and a hung one is the leg's to report. A smaller literal
44
+ * here was a per-test deadline on the host's load: a fixture Nx daemon and its plugin worker, SIGTERMed, outlived
45
+ * 10 s on a loaded gate host and failed teardown of a test that had passed.
46
+ */
47
+ const EXIT_TIMEOUT_MS = BOUNDED_TEST_IDLE_TIMEOUT_MS;
41
48
  /** Under half of the SIGTERM-to-SIGKILL grace a bounded test leg gives, per round of signals. */
42
49
  const SIGNALLED_GRACE_MS = 3_000;
43
50
  const FIXTURE_HOME = 'smoothbricks-fixtures';
@@ -257,7 +257,7 @@ export function unreadableDeveloperLinks(root: string): string[] {
257
257
  }
258
258
 
259
259
  /** The package a link stands for in its tree: `name` or `@scope/name`. */
260
- function packageName(link: DeveloperLink): string {
260
+ function packageName(link: { readonly path: string }): string {
261
261
  return link.path.slice(link.path.lastIndexOf('node_modules/') + 'node_modules/'.length);
262
262
  }
263
263
 
@@ -638,13 +638,6 @@ export function applyDeclaredLinks(root: string, plan: DeclaredLinksPlan): void
638
638
  }
639
639
  }
640
640
 
641
- /** One stderr line per declaration this machine cannot honour; the installed version stays. */
642
- export function reportUnavailableDeclaredLinks(unavailable: readonly UnavailableDeclaredLink[]): void {
643
- for (const { name, target, reason } of unavailable) {
644
- console.error(`! smoo.developerLinks ${name}: ${target} ${reason}; the installed version stays`);
645
- }
646
- }
647
-
648
641
  /**
649
642
  * Whether `current` is a binding this clone inherited from the main checkout its marker names: the
650
643
  * declaration is contained in that checkout and the link's target lies inside it, at whatever relative
@@ -32,7 +32,6 @@ import {
32
32
  keepDeveloperLinks,
33
33
  planDeclaredLinks,
34
34
  reportDeveloperLinks,
35
- reportUnavailableDeclaredLinks,
36
35
  unreadableDeveloperLinks,
37
36
  } from './developer-links.ts';
38
37
  import {
@@ -254,6 +253,19 @@ try {
254
253
  current && !hasStaleDeveloperLinks(projectRoot, ['nx']) && danglingStoreLinks(projectRoot).length === 0 ? 0 : 1,
255
254
  );
256
255
  }
256
+ // Planning reads, apart from a snapshot it may capture, which seals by an atomic rename (linked-snapshots.ts),
257
+ // and applying a plan with no changes only says what this machine cannot honour. So an entry with nothing to
258
+ // write never takes the install lock, and the entries of one checkout do not queue behind each other's probe of
259
+ // a provider checkout: a declaration whose snapshot the provider refuses fails the status on every entry.
260
+ const plan = await planDeclaredLinks(projectRoot);
261
+ if (
262
+ plan.changes.length === 0 &&
263
+ danglingStoreLinks(projectRoot).length === 0 &&
264
+ !hasStaleDeveloperLinks(projectRoot, ['nx'])
265
+ ) {
266
+ applyDeclaredLinks(projectRoot, plan);
267
+ process.exit(0);
268
+ }
257
269
  await withInstallLock(async () => {
258
270
  // Recheck under the install lock: another shell may already have repaired
259
271
  // the aliases. Use the same installer as smoo:install, never a second linker.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smoothbricks/nx-plugin",
3
- "version": "0.4.29",
3
+ "version": "0.4.31",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "./loader.js",
@@ -38,6 +38,11 @@
38
38
  "import": "./dist/build-state-output-policy.js",
39
39
  "default": "./dist/build-state-output-policy.js"
40
40
  },
41
+ "./test-clock-policy": {
42
+ "types": "./dist/test-clock-policy.d.ts",
43
+ "import": "./dist/test-clock-policy.js",
44
+ "default": "./dist/test-clock-policy.js"
45
+ },
41
46
  "./test-walk-policy": {
42
47
  "types": "./dist/test-walk-policy.d.ts",
43
48
  "import": "./dist/test-walk-policy.js",
@@ -83,6 +88,11 @@
83
88
  "import": "./dist/testing.js",
84
89
  "default": "./dist/testing.js"
85
90
  },
91
+ "./owned-installation": {
92
+ "types": "./dist/owned-installation.d.ts",
93
+ "import": "./dist/owned-installation.js",
94
+ "default": "./dist/owned-installation.js"
95
+ },
86
96
  "./cross-check-policy": {
87
97
  "types": "./dist/cross-check-policy.d.ts",
88
98
  "import": "./dist/cross-check-policy.js",
@@ -185,7 +195,8 @@
185
195
  "smoo-nx-nextest-extract": "./dist/bin/smoo-nx-nextest-extract.js",
186
196
  "smoo-nx-bound-failures": "./dist/bin/smoo-nx-bound-failures.js",
187
197
  "smoo-nx-failures": "./dist/bin/smoo-nx-failures.js",
188
- "smoo-nx-test-walks": "./dist/bin/smoo-nx-test-walks.js"
198
+ "smoo-nx-test-walks": "./dist/bin/smoo-nx-test-walks.js",
199
+ "smoo-nx-test-clocks": "./dist/bin/smoo-nx-test-clocks.js"
189
200
  },
190
201
  "generators": "./generators.json",
191
202
  "executors": "./executors.json",
@@ -301,8 +312,8 @@
301
312
  "yaml": "^2.9.0"
302
313
  },
303
314
  "devDependencies": {
304
- "@smoothbricks/lmao": "0.5.4",
305
- "@smoothbricks/validation": "0.1.10",
315
+ "@smoothbricks/lmao": "0.5.5",
316
+ "@smoothbricks/validation": "0.1.11",
306
317
  "fast-check": "^4.4.0"
307
318
  }
308
319
  }
@@ -0,0 +1,113 @@
1
+ import { execFileSync } from 'node:child_process';
2
+ import { mkdir, stat, symlink, utimes, writeFile } from 'node:fs/promises';
3
+ import { dirname, join } from 'node:path';
4
+
5
+ import type { CreateNodesResultV2 } from 'nx/src/devkit-exports.js';
6
+ import { CARGO_CLOSURE_INPUT } from '../cargo-closure-input.js';
7
+ import { createNodesV2 } from '../index.js';
8
+ import type { TestFileInstallation } from '../owned-installation.js';
9
+
10
+ /**
11
+ * An Nx workspace that is also the Cargo workspace. `app` reaches `leaf`
12
+ * through `bridge`, and `external` — outside the Nx workspace — through
13
+ * `bridge` too. `unrelated` is a member nothing depends on. `app` declares a
14
+ * custom cached target keyed on its closure.
15
+ * `extraFiles` (paths relative to `root`) are written with the rest, last.
16
+ * `installation` is the calling test file's own Nx installation.
17
+ */
18
+ export async function closureFixture(
19
+ installation: TestFileInstallation,
20
+ root: string,
21
+ gitignore = 'node_modules/\ntarget/\ndist/\n.nx/\n',
22
+ extraFiles: Record<string, string> = {},
23
+ ) {
24
+ const workspace = join(root, 'workspace');
25
+ const files: Record<string, string> = {
26
+ 'workspace/.gitignore': gitignore,
27
+ 'workspace/package.json':
28
+ '{"name":"cargo-closure-fixture","private":true,"workspaces":["packages/*","crates/*"]}\n',
29
+ 'workspace/nx.json': JSON.stringify({
30
+ plugins: ['@smoothbricks/nx-plugin'],
31
+ namedInputs: { externalRustCrates: [] },
32
+ }),
33
+ 'workspace/Cargo.toml':
34
+ '[workspace]\nmembers=["packages/app","crates/bridge","crates/leaf","crates/unrelated"]\nresolver="2"\n',
35
+ 'workspace/packages/app/package.json': JSON.stringify({
36
+ name: 'app',
37
+ private: true,
38
+ nx: {
39
+ targets: {
40
+ compile: {
41
+ executor: 'nx:run-commands',
42
+ cache: true,
43
+ inputs: [CARGO_CLOSURE_INPUT],
44
+ options: { command: 'cargo build --quiet --locked --offline --manifest-path packages/app/Cargo.toml' },
45
+ },
46
+ },
47
+ },
48
+ }),
49
+ 'workspace/packages/app/Cargo.toml':
50
+ '[package]\nname="app"\nversion="0.1.0"\nedition="2021"\n[dependencies]\nbridge={path="../../crates/bridge"}\n',
51
+ 'workspace/packages/app/src/main.rs': 'fn main() { println!("{}", bridge::answer()); }\n',
52
+ 'workspace/crates/bridge/Cargo.toml':
53
+ '[package]\nname="bridge"\nversion="0.1.0"\nedition="2021"\n[dependencies]\nleaf={path="../leaf"}\nexternal={path="../../../external"}\n',
54
+ 'workspace/crates/bridge/src/lib.rs': 'pub fn answer() -> u8 { leaf::answer() + external::answer() }\n',
55
+ 'workspace/crates/leaf/package.json': '{"name":"leaf","private":true}\n',
56
+ 'workspace/crates/leaf/Cargo.toml': '[package]\nname="leaf"\nversion="0.1.0"\nedition="2021"\n',
57
+ 'workspace/crates/leaf/src/lib.rs': 'pub fn answer() -> u8 { 1 }\n',
58
+ 'workspace/crates/unrelated/Cargo.toml': '[package]\nname="unrelated"\nversion="0.1.0"\nedition="2021"\n',
59
+ 'workspace/crates/unrelated/src/lib.rs': 'pub fn unrelated() -> u8 { 3 }\n',
60
+ 'external/Cargo.toml': '[package]\nname="external"\nversion="0.1.0"\nedition="2021"\n[workspace]\n',
61
+ 'external/src/lib.rs': 'pub fn answer() -> u8 { 10 }\n',
62
+ ...extraFiles,
63
+ };
64
+ for (const [path, text] of Object.entries(files)) {
65
+ await mkdir(dirname(join(root, path)), { recursive: true });
66
+ await writeFile(join(root, path), text);
67
+ }
68
+ execFileSync('git', ['init', '--quiet', workspace], { stdio: 'pipe' });
69
+ await symlink(await installation.nodeModules(), join(workspace, 'node_modules'), 'dir');
70
+ execFileSync('cargo', ['generate-lockfile', '--offline', '--manifest-path', join(workspace, 'Cargo.toml')], {
71
+ stdio: 'pipe',
72
+ });
73
+
74
+ /**
75
+ * Rewrite a fixture file as an edit Nx can see. Nx keeps each file's hash
76
+ * beside its mtime in whole seconds and reuses the hash until that second
77
+ * changes, so a rewrite inside the second the file was last hashed in is
78
+ * invisible to every fileset input. A fast host runs this whole fixture in
79
+ * about a second; the edit is dated at least a second past the old mtime.
80
+ */
81
+ async function edit(path: string, text: string): Promise<void> {
82
+ const file = join(root, path);
83
+ const { mtimeMs } = await stat(file);
84
+ await writeFile(file, text);
85
+ const edited = new Date(Math.max(Date.now(), mtimeMs + 1000));
86
+ await utimes(file, edited, edited);
87
+ }
88
+ return { workspace, edit };
89
+ }
90
+
91
+ /** One project-graph computation over the fixture: the plugin's `createNodes`, as Nx runs it for each recomputation. */
92
+ export function graphComputation(workspace: string) {
93
+ const [, infer] = createNodesV2;
94
+ return async () =>
95
+ infer(['package.json', 'packages/app/package.json', 'crates/leaf/package.json'], undefined, {
96
+ workspaceRoot: workspace,
97
+ nxJsonConfiguration: { namedInputs: { externalRustCrates: [] } },
98
+ });
99
+ }
100
+
101
+ /** The computation's nodes in file order: the plugin pushes them as their projects finish. */
102
+ export function byFile(graph: CreateNodesResultV2): CreateNodesResultV2 {
103
+ return [...graph].sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));
104
+ }
105
+
106
+ /** The `cargoClosure` definition the computation gave the project at `projectRoot`. */
107
+ export function closureOf(graph: CreateNodesResultV2, projectRoot: string) {
108
+ return (
109
+ graph.find(([file]) => dirname(file) === projectRoot)?.[1].projects?.[projectRoot]?.namedInputs?.[
110
+ CARGO_CLOSURE_INPUT
111
+ ] ?? []
112
+ );
113
+ }
@@ -11,6 +11,7 @@ import { type QueryableSpan, querySpan } from '@smoothbricks/lmao/testing';
11
11
  import { useTestSpan } from '@smoothbricks/lmao/testing/bun';
12
12
  import { AggregateCreateNodesError } from 'nx/src/project-graph/error-types.js';
13
13
  import { CargoMetadataError } from '../cargo-source-hash.js';
14
+ import { BOUNDED_TEST_IDLE_TIMEOUT_MS } from '../test-backstop.js';
14
15
  import { bindListener } from '../testing.js';
15
16
  import { BROKER_HOST, encodeOrder, type ProcessReport, parseReport, readLines } from './counted-cargo-process.js';
16
17
 
@@ -63,19 +64,6 @@ export function cargoMetadataRuns(events: readonly CargoMetadataEvent[]): CargoM
63
64
  return { spawned: pids.length, read, peak, pids, grandchildren };
64
65
  }
65
66
 
66
- /**
67
- * How long an awaited event may take before its guard says what is still open: inside the tests'
68
- * own 20 s budgets, so the report reaches the test before the runner's timeout does. A guard only
69
- * ever fails a wait; nothing advances on it.
70
- */
71
- const GUARD_MS = 15_000;
72
-
73
- /**
74
- * The guard over the real Cargo: above the slowest real resolution seen behind a contended package
75
- * cache (21 s), below Bun's 30 s default test timeout, which those tests run under or exceed.
76
- */
77
- const REAL_CARGO_GUARD_MS = 25_000;
78
-
79
67
  /** The test spans still open under `span`, itself included: the work a hung test is still inside. */
80
68
  function openSpans<T extends LogSchema>(span: QueryableSpan<T>, open: string[]): string[] {
81
69
  // Row 1 holds a span's completion; its timestamp stays 0 until the span ends.
@@ -88,14 +76,17 @@ function openSpans<T extends LogSchema>(span: QueryableSpan<T>, open: string[]):
88
76
  * `operation`, settling exactly as it does, unless no event settles it within `timeoutMs`: then it
89
77
  * rejects with `what`, the test spans still open and `diagnostics()`. The test span is taken now, so
90
78
  * call this from the test's own async context. `signal` disarms the guard; the result still follows
91
- * `operation`.
79
+ * `operation`. The default is the leg's no-progress backstop: a guard that fires sooner races a
80
+ * loaded host (a 15 s and a 30 s guard failed slow but healthy daemon and Cargo waits), so it only
81
+ * names what was still open when a wait truly hangs. A guard only ever fails a wait; nothing advances
82
+ * on it.
92
83
  */
93
84
  export function guardEvent<T>(
94
85
  operation: Promise<T>,
95
86
  what: string,
96
87
  diagnostics: () => string | Promise<string>,
97
88
  signal?: AbortSignal,
98
- timeoutMs = GUARD_MS,
89
+ timeoutMs = BOUNDED_TEST_IDLE_TIMEOUT_MS,
99
90
  ): Promise<T> {
100
91
  let spans: () => string;
101
92
  try {
@@ -324,8 +315,6 @@ async function shim(
324
315
  root: string,
325
316
  forward: string,
326
317
  initial: string | null,
327
- /** How long the fixture's waits may take: longer over the real Cargo. */
328
- guardMs: number,
329
318
  ): Promise<{ cargo: CountedCargo; answer(text: string): void }> {
330
319
  const path = process.env.PATH ?? '';
331
320
  const real = Bun.which('cargo', { PATH: path });
@@ -542,8 +531,6 @@ async function shim(
542
531
  verdict(() => (connections.size === 0 ? true : null)),
543
532
  'releasing the counted Cargo',
544
533
  describe,
545
- undefined,
546
- guardMs,
547
534
  );
548
535
  } catch (error) {
549
536
  // A process still connected is still running, so its pid is still its own: kill it and, for a
@@ -616,8 +603,6 @@ async function shim(
616
603
  }),
617
604
  `waiting for ${what}`,
618
605
  describe,
619
- undefined,
620
- guardMs,
621
606
  ),
622
607
  waitForDisconnects: async (pids) => {
623
608
  await guardEvent(
@@ -634,8 +619,6 @@ async function shim(
634
619
  }),
635
620
  `waiting for ${pids.join(', ')} to die`,
636
621
  describe,
637
- undefined,
638
- guardMs,
639
622
  );
640
623
  },
641
624
  release: () => {
@@ -653,7 +636,7 @@ async function shim(
653
636
 
654
637
  /** The real Cargo, counted: `metadata` prints what the real `cargo metadata` prints. */
655
638
  export async function countedCargo(root: string): Promise<CountedCargo> {
656
- const { cargo } = await shim(root, 'exec "$real" "$@"', null, REAL_CARGO_GUARD_MS);
639
+ const { cargo } = await shim(root, 'exec "$real" "$@"', null);
657
640
  return cargo;
658
641
  }
659
642
 
@@ -663,7 +646,7 @@ export async function countedCargo(root: string): Promise<CountedCargo> {
663
646
  * not depend on.
664
647
  */
665
648
  export async function cannedCargo(root: string): Promise<CannedCargo> {
666
- const { cargo, answer } = await shim(root, 'exec env -u RUSTUP_TOOLCHAIN -u RUSTUP_HOME "$real" "$@"', '', GUARD_MS);
649
+ const { cargo, answer } = await shim(root, 'exec env -u RUSTUP_TOOLCHAIN -u RUSTUP_HOME "$real" "$@"', '');
667
650
  return {
668
651
  ...cargo,
669
652
  answerWith: async (document) => answer(JSON.stringify(document)),
@@ -0,0 +1,27 @@
1
+ import { watch } from 'node:fs';
2
+
3
+ /**
4
+ * Resolves once `ready` holds: checked when the watch is armed and again on every change in `directory`, so a change
5
+ * made before the watch exists is still seen. The wait ends on a filesystem event, never on a timer; one that never
6
+ * comes is the leg's no-progress bound to report.
7
+ */
8
+ export function whenChanged(directory: string, ready: () => boolean): Promise<void> {
9
+ const { promise, resolve, reject } = Promise.withResolvers<void>();
10
+ const watcher = watch(directory, () => check());
11
+ function check(): void {
12
+ try {
13
+ if (!ready()) return;
14
+ watcher.close();
15
+ resolve();
16
+ } catch (error) {
17
+ watcher.close();
18
+ reject(error);
19
+ }
20
+ }
21
+ watcher.once('error', (error) => {
22
+ watcher.close();
23
+ reject(error);
24
+ });
25
+ check();
26
+ return promise;
27
+ }
@@ -1,174 +1,14 @@
1
- /**
2
- * A fixture's own copy of the repository's Nx installation, and the check that nothing wrote into it.
3
- *
4
- * The graph witness binds node stamps (ctime included) of every file in the closure of Nx, this plugin and
5
- * TypeScript (README "Ancestor directories bind..."). Linked from the repository, that closure is the host's: on CI
6
- * its files are hardlinks in the shared Bun store, and any other task that installs, restores or cleans changes their
7
- * link count, so their ctime, so a fixture's installation identity, between two calls of one test. A fixture must not
8
- * take an input it does not own.
9
- *
10
- * So the closure is copied, exactly as the witness's own census resolves it in the repository: each package once,
11
- * with the census's own exclusions (`node_modules`, `.git`, `.nx`), each dependency edge relinked beside its copy as
12
- * Bun's isolated layout does, the top-level packages' bins in `.bin`. Every copy is a new inode, cloned where the
13
- * volume allows and written otherwise, so no link count is shared with anything outside its owner.
14
- *
15
- * A test file makes one copy, on first use, shared by its fixtures; its `afterAll` retires it, failing the suite and
16
- * naming the changed nodes if any fixture wrote into it.
17
- */
18
- import { constants } from 'node:fs';
19
- import { cp, mkdir, readFile, rm, symlink } from 'node:fs/promises';
20
- import { basename, dirname, join, relative } from 'node:path';
21
- import { expandOutputs } from 'nx/src/native';
22
- import { readModulePackageJson } from 'nx/src/utils/package-json';
23
- import typia from 'typia';
24
- import {
25
- type GraphInstallationCensus,
26
- graphInstallationCensus,
27
- graphInstallationIdentity,
28
- } from '../ensure-built-witness.js';
1
+ /** This repository's fixtures own a copy of its Nx installation (`../owned-installation.ts`) in an Nx fixture root. */
2
+ import { join } from 'node:path';
3
+ import { ownedInstallation, type TestFileInstallation } from '../owned-installation.js';
29
4
  import { nxFixtureRoot } from './fixture-nx-env.js';
30
5
 
31
6
  const repositoryRoot = join(import.meta.dir, '../../../..');
32
7
 
33
- /** The configuration the census resolves: Nx, this plugin and TypeScript. */
34
- const CENSUS_NX_JSON = { plugins: ['@smoothbricks/nx-plugin'] };
35
-
36
- /** An installation made under `root`, and its identity when the copy was made. */
37
- interface OwnedInstallation {
38
- readonly root: string;
39
- readonly identity: string;
40
- }
41
-
42
- /** The graph witness's installation identity resolved from `root`; an unproved installation fails loudly. */
43
- function installationIdentity(root: string): string {
44
- let unproved = 'no detail';
45
- const identity = graphInstallationIdentity(
46
- root,
47
- CENSUS_NX_JSON,
48
- readModulePackageJson,
49
- expandOutputs,
50
- null,
51
- (detail) => {
52
- unproved = detail;
53
- },
54
- );
55
- if (identity === null) throw new Error(`the Nx installation resolved from ${root} is unproved: ${unproved}`);
56
- return identity;
57
- }
58
-
59
- /** Copy the repository's installation closure into `root/node_modules`; `root` is an empty directory the caller owns.
60
- *
61
- * Only the closure is read from the repository, never its proof: the repository's installation is the host's, whose
62
- * shared store other tasks relink while the census reads it, which changes node stamps and would make every test that
63
- * copies it fail for the host's work rather than its own. The copy, which the fixture owns, is what gets proved.
64
- */
65
- async function makeOwnedInstallation(root: string): Promise<OwnedInstallation> {
66
- let unread = 'no detail';
67
- const census = graphInstallationCensus(
68
- repositoryRoot,
69
- CENSUS_NX_JSON,
70
- readModulePackageJson,
71
- expandOutputs,
72
- null,
73
- (detail) => {
74
- unread = detail;
75
- },
76
- );
77
- if (census === null) throw new Error(`the Nx installation closure of ${repositoryRoot} cannot be read: ${unread}`);
78
- const { resolutions } = census;
79
- const modules = join(root, 'node_modules');
80
- // Each source package root's copy, inside a store directory whose node_modules also holds its dependency links.
81
- const copies = new Map<
82
- string,
83
- { readonly store: string; readonly copy: string; readonly bin: string | Record<string, string> | undefined }
84
- >();
85
- for (const [, , manifest] of resolutions) {
86
- if (manifest === null || copies.has(dirname(manifest))) continue;
87
- const { name, bin } = typia.json.assertParse<{ name: string; bin?: string | Record<string, string> }>(
88
- await readFile(manifest, 'utf8'),
89
- );
90
- const store = join(modules, '.store', String(copies.size), 'node_modules');
91
- copies.set(dirname(manifest), { store, copy: join(store, name), bin });
92
- }
93
- const copyOf = (source: string) => {
94
- const copied = copies.get(source);
95
- if (copied === undefined) throw new Error(`${source} resolves dependencies but is not in the census`);
96
- return copied;
97
- };
98
- await Promise.all(
99
- [...copies].map(([source, { copy }]) =>
100
- cp(source, copy, {
101
- recursive: true,
102
- verbatimSymlinks: true,
103
- mode: constants.COPYFILE_FICLONE,
104
- filter: (path) => path === source || !['node_modules', '.git', '.nx'].includes(basename(path)),
105
- }),
106
- ),
107
- );
108
- for (const [from, name, manifest] of resolutions) {
109
- if (manifest === null) continue;
110
- const link = join(from === repositoryRoot ? modules : copyOf(from).store, name);
111
- await mkdir(dirname(link), { recursive: true });
112
- await symlink(relative(dirname(link), copyOf(dirname(manifest)).copy), link, 'dir');
113
- if (from !== repositoryRoot) continue;
114
- const { bin } = copyOf(dirname(manifest));
115
- const commands = typeof bin === 'string' ? { [basename(name)]: bin } : (bin ?? {});
116
- for (const [command, path] of Object.entries(commands)) {
117
- await mkdir(join(modules, '.bin'), { recursive: true });
118
- await symlink(relative(join(modules, '.bin'), join(link, path)), join(modules, '.bin', command));
119
- }
120
- }
121
- return { root, identity: installationIdentity(root) };
122
- }
123
-
124
- /**
125
- * Remove an installation, failing, with the changed nodes named, if its identity is no longer the one it was made
126
- * with: the proof that its sharers only read it.
127
- */
128
- async function retireOwnedInstallation({ root, identity }: OwnedInstallation): Promise<void> {
129
- try {
130
- const retired = installationIdentity(root);
131
- if (retired === identity) return;
132
- const entries = (census: string) => {
133
- const { nodes, files } = typia.json.assertParse<GraphInstallationCensus>(census);
134
- return new Set([
135
- ...nodes.map(({ path, stamp }) => `${path} ${stamp}`),
136
- ...files.map(({ path, sha256 }) => `${path} ${sha256}`),
137
- ]);
138
- };
139
- const made = entries(identity);
140
- const now = entries(retired);
141
- const changed = [
142
- ...[...made].filter((entry) => !now.has(entry)).map((entry) => `- ${entry}`),
143
- ...[...now].filter((entry) => !made.has(entry)).map((entry) => `+ ${entry}`),
144
- ];
145
- throw new Error(`a fixture changed the installation it shares, in ${root}:\n${changed.slice(0, 20).join('\n')}`);
146
- } finally {
147
- await rm(root, { recursive: true, force: true });
148
- }
149
- }
150
-
151
- /** One test file's installation: made on first use and shared by its fixtures, retired by the file's `afterAll`. */
152
- export interface TestFileInstallation {
153
- /** The `node_modules` a fixture workspace links. */
154
- readonly nodeModules: () => Promise<string>;
155
- /** Fails if a fixture wrote into the copy; a file that never used it has nothing to retire. */
156
- readonly retire: () => Promise<void>;
157
- }
158
-
159
8
  /**
160
9
  * The installation one test file owns, in a fixture root named by `prefix`. Call once per file, at module scope:
161
10
  * Bun runs many test files in one process, and each must own its copy.
162
11
  */
163
12
  export function testFileInstallation(prefix: string): TestFileInstallation {
164
- let made: Promise<OwnedInstallation> | undefined;
165
- return {
166
- nodeModules: async () => {
167
- made ??= nxFixtureRoot(prefix).then(makeOwnedInstallation);
168
- return join((await made).root, 'node_modules');
169
- },
170
- retire: async () => {
171
- if (made !== undefined) await retireOwnedInstallation(await made);
172
- },
173
- };
13
+ return ownedInstallation(repositoryRoot, () => nxFixtureRoot(prefix));
174
14
  }
@@ -0,0 +1,12 @@
1
+ import { censusStart, SAME_TICK_NS } from '../ensure-built-witness.js';
2
+
3
+ /**
4
+ * Returns once a census started from then on proves every node that changed before the call: until then such a census
5
+ * records it unproven (ensure-built-witness.ts, `unproven`), and a reader distrusts its stamp. A node's change time is
6
+ * at most the wall clock at the call, which `censusStart` reads to the millisecond below, so the wait ends one
7
+ * millisecond and {@link SAME_TICK_NS} past that reading. It waits on the clock the rule reads, not a guessed delay.
8
+ */
9
+ export async function pastTick(): Promise<void> {
10
+ const proven = censusStart() + 1_000_000n + SAME_TICK_NS;
11
+ while (censusStart() < proven) await Bun.sleep(1);
12
+ }
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import { findClockOracles, formatClockOracle, TEST_CLOCK_ORACLE } from '../test-clock-policy.js';
3
+ import { diffScope, upstreamBase } from '../test-walk-policy.js';
4
+
5
+ // TEST-CLOCK-ORACLE over the current directory's repository, judged on the cases changed since the upstream merge base
6
+ // (`upstreamBase`, the base `smoo-nx-test-walks --base` prints for the lint target's runtime input). Every finding
7
+ // prints `error[…]` and exits 1. Exit 2 when git cannot answer.
8
+ if (process.argv.length > 2) {
9
+ process.stderr.write('usage: smoo-nx-test-clocks\n');
10
+ process.exit(2);
11
+ }
12
+ const root = process.cwd();
13
+ const base = upstreamBase(root);
14
+ if (!base.ok) {
15
+ process.stderr.write(`${TEST_CLOCK_ORACLE.id} cannot find the upstream base: ${base.reason}\n`);
16
+ process.exit(2);
17
+ }
18
+ const scope = diffScope(root, base.value);
19
+ if (!scope.ok) {
20
+ process.stderr.write(`${TEST_CLOCK_ORACLE.id} cannot read the changes since ${base.value}: ${scope.reason}\n`);
21
+ process.exit(2);
22
+ }
23
+ const oracles = findClockOracles(root, scope.value.files, scope.value.changes);
24
+ for (const oracle of oracles) process.stderr.write(`${formatClockOracle(oracle)}\n`);
25
+ if (oracles.length > 0) process.exit(1);
26
+ process.stdout.write(
27
+ `${TEST_CLOCK_ORACLE.id} passed: no changed test case carries a runner deadline, bounds elapsed host time or races ` +
28
+ `a configured bound against a timer (base ${base.value}).\n`,
29
+ );
@@ -10,17 +10,11 @@ import {
10
10
  } from './cargo-workspace.js';
11
11
  import { writeJsonFile } from './managed-files/managed-format.js';
12
12
  import type { PackageTargetPolicyOptions, ResolvedProjectTargets } from './package-target-policy.js';
13
+ import { BOUNDED_TEST_IDLE_TIMEOUT_MS, BOUNDED_TEST_KILL_AFTER_MS } from './test-backstop.js';
13
14
  import { isTestRunnerTargetName } from './workspace-config-policy.js';
14
15
 
16
+ export { BOUNDED_TEST_IDLE_TIMEOUT_MS, BOUNDED_TEST_KILL_AFTER_MS } from './test-backstop.js';
15
17
  export const BOUNDED_TEST_EXECUTOR = '@smoothbricks/nx-plugin:bounded-exec';
16
- /**
17
- * A test target's one bound: the `idleTimeoutMs` with which no test may go unfinished, the hang backstop of
18
- * specs/cowshed/08_testing.md. It is no wall-clock ceiling: a suite that keeps finishing tests runs as long as it
19
- * needs. It is the longest any single test may run, so it stays above every slow-timeout class in the plugin's
20
- * nextest.toml; a bun leg has no per-test deadline of its own (`BUN_TEST_TIMEOUT_FLAG`).
21
- */
22
- export const BOUNDED_TEST_IDLE_TIMEOUT_MS = 180_000;
23
- export const BOUNDED_TEST_KILL_AFTER_MS = 10_000;
24
18
  /**
25
19
  * Deletes Bun's per-test deadline: 5000 ms unless the command sets one, and Bun ignores a bunfig `[test] timeout`, so
26
20
  * the flag is the one place to set it. `0` means no deadline (measured on the pinned Bun 1.4.2: a test blocked 12 s in