@smoothbricks/nx-plugin 0.4.29 → 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 (95) hide show
  1. package/README.md +83 -15
  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/executor.d.ts +1 -1
  23. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  24. package/dist/executors/bounded-exec/executor.js +35 -12
  25. package/dist/executors/bounded-exec/no-space.d.ts +8 -0
  26. package/dist/executors/bounded-exec/no-space.d.ts.map +1 -0
  27. package/dist/executors/bounded-exec/no-space.js +31 -0
  28. package/dist/executors/bounded-exec/ram-temp.d.ts +3 -0
  29. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
  30. package/dist/executors/bounded-exec/ram-temp.js +15 -4
  31. package/dist/executors/bounded-exec/verdict.d.ts +34 -4
  32. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  33. package/dist/executors/bounded-exec/verdict.js +54 -3
  34. package/dist/graph-input-contract.d.ts +4 -0
  35. package/dist/graph-input-contract.d.ts.map +1 -1
  36. package/dist/graph-input-contract.js +17 -4
  37. package/dist/owned-installation.d.ts +14 -0
  38. package/dist/owned-installation.d.ts.map +1 -0
  39. package/dist/owned-installation.js +324 -0
  40. package/dist/producer-receipts.d.ts.map +1 -1
  41. package/dist/producer-receipts.js +15 -10
  42. package/dist/test-backstop.d.ts +9 -0
  43. package/dist/test-backstop.d.ts.map +1 -0
  44. package/dist/test-backstop.js +10 -0
  45. package/dist/test-clock-policy.d.ts +30 -0
  46. package/dist/test-clock-policy.d.ts.map +1 -0
  47. package/dist/test-clock-policy.js +686 -0
  48. package/dist/testing.d.ts.map +1 -1
  49. package/dist/testing.js +8 -1
  50. package/managed/raw/tooling/direnv/developer-links.ts +1 -8
  51. package/managed/raw/tooling/direnv/setup-environment.ts +0 -1
  52. package/package.json +15 -4
  53. package/src/__tests__/cargo-closure-fixture.ts +113 -0
  54. package/src/__tests__/counted-cargo.ts +8 -25
  55. package/src/__tests__/directory-change.ts +27 -0
  56. package/src/__tests__/owned-installation.ts +4 -164
  57. package/src/__tests__/past-tick.ts +12 -0
  58. package/src/bin/smoo-nx-test-clocks.ts +29 -0
  59. package/src/bounded-test-policy.ts +2 -8
  60. package/src/cargo-closure-input.property.test.ts +50 -0
  61. package/src/cargo-closure-input.test.ts +15 -112
  62. package/src/cargo-closure-input.ts +23 -6
  63. package/src/cargo-closure-key.test.ts +239 -0
  64. package/src/cargo-resolve-cache.test.ts +29 -7
  65. package/src/ensure-built-receipt.ts +56 -13
  66. package/src/ensure-built-witness.test.ts +113 -4
  67. package/src/ensure-built-witness.ts +75 -16
  68. package/src/ensure-built.test.ts +74 -2
  69. package/src/ensure-built.ts +13 -2
  70. package/src/executors/bounded-exec/cpu-pool.test.ts +18 -0
  71. package/src/executors/bounded-exec/cpu-pool.ts +10 -4
  72. package/src/executors/bounded-exec/disk-lease.test.ts +47 -13
  73. package/src/executors/bounded-exec/executor-host.test.ts +23 -11
  74. package/src/executors/bounded-exec/executor.test.ts +189 -63
  75. package/src/executors/bounded-exec/executor.ts +36 -11
  76. package/src/executors/bounded-exec/hang-diagnostics.test.ts +14 -8
  77. package/src/executors/bounded-exec/no-space.ts +40 -0
  78. package/src/executors/bounded-exec/ram-temp-host.test.ts +9 -8
  79. package/src/executors/bounded-exec/ram-temp.test.ts +32 -18
  80. package/src/executors/bounded-exec/ram-temp.ts +17 -4
  81. package/src/executors/bounded-exec/verdict.test.ts +125 -25
  82. package/src/executors/bounded-exec/verdict.ts +78 -3
  83. package/src/graph-input-contract.test.ts +8 -0
  84. package/src/graph-input-contract.ts +26 -4
  85. package/src/nextest-extraction.test.ts +114 -4
  86. package/src/nx-daemon-claim.test.ts +5 -3
  87. package/src/nx-daemon-idle-policy.test.ts +22 -18
  88. package/src/nx-daemon-validity.test.ts +5 -13
  89. package/src/owned-installation.ts +174 -0
  90. package/src/producer-receipts.ts +15 -10
  91. package/src/test-backstop.ts +11 -0
  92. package/src/test-clock-policy.test.ts +338 -0
  93. package/src/test-clock-policy.ts +708 -0
  94. package/src/testing.ts +8 -1
  95. package/test-timings.json +3 -0
@@ -5,7 +5,7 @@ import { delimiter, dirname, join, resolve } from 'node:path';
5
5
  import typia from 'typia';
6
6
  import { createWorkspaceNxRequire, parseTargetSelector, providerInputProof, selectorTaskId, } from './ensure-built.js';
7
7
  import { captureProducerSource, producerOutputPaths, providerReceipt, receiptNode, } from './ensure-built-receipt.js';
8
- import { graphInstallationIdentity, movedNodes, nodesUnchanged, workspaceSnapshot, } from './ensure-built-witness.js';
8
+ import { censusStart, graphInstallationIdentity, movedNodes, workspaceSnapshot, } from './ensure-built-witness.js';
9
9
  import { graphInputContractIdentity } from './graph-input-contract.js';
10
10
  const runs = new Map();
11
11
  function sha(value) {
@@ -49,7 +49,8 @@ function same(left, right) {
49
49
  return JSON.stringify(left) === JSON.stringify(right);
50
50
  }
51
51
  /**
52
- * Whether a tool node whose ctime alone moved still reads as `tools` recorded it: the same bytes, link text,
52
+ * Whether a tool node whose stamp does not prove it (its ctime alone moved, or it was read in the tick it changed in,
53
+ * recordedStamp) still reads as `tools` recorded it: the same bytes, link text,
53
54
  * membership and mode. Bun's global store is shared by every checkout, and linking a package's bin on any of their
54
55
  * installs re-chmods the store file to the mode it already has; that moves the ctime of a node these tools witness
55
56
  * without changing it, and is no reason to refuse the run.
@@ -58,7 +59,7 @@ function recordedTool(tools) {
58
59
  const recorded = new Map(tools.flatMap((tool) => tool.nodes.map((node) => [node.path, node])));
59
60
  return (path) => {
60
61
  const node = recorded.get(path);
61
- return node !== undefined && same(receiptNode(path, path, []), node);
62
+ return node !== undefined && same(receiptNode(path, path), node);
62
63
  };
63
64
  }
64
65
  function missing(paths) {
@@ -117,6 +118,7 @@ function toolsFor(root, nxJson, projectGraph, bases) {
117
118
  if (installation === null)
118
119
  return { ok: false, detail: 'Invalid installed module closure evidence' };
119
120
  const observed = [];
121
+ const census = { start: censusStart(), observed };
120
122
  const paths = new Set(installation.nodes.map(({ path }) => path));
121
123
  const absent = new Set();
122
124
  function namespace(path) {
@@ -150,7 +152,7 @@ function toolsFor(root, nxJson, projectGraph, bases) {
150
152
  absent.add(candidate);
151
153
  }
152
154
  }
153
- const nodes = [...paths].sort().map((path) => receiptNode(path, path, observed));
155
+ const nodes = [...paths].sort().map((path) => receiptNode(path, path, census));
154
156
  const module = {
155
157
  kind: 'module',
156
158
  name: 'installed-nx-plugin-closure',
@@ -180,7 +182,7 @@ function toolsFor(root, nxJson, projectGraph, bases) {
180
182
  if (path === undefined)
181
183
  return { ok: false, detail: `Unbound producer executable ${name}` };
182
184
  const physicalPath = realpathSync(path);
183
- const entries = [...new Set([path, physicalPath])].map((entry) => receiptNode(entry, entry, observed));
185
+ const entries = [...new Set([path, physicalPath])].map((entry) => receiptNode(entry, entry, census));
184
186
  tools.push({
185
187
  kind: 'executable',
186
188
  name,
@@ -209,16 +211,18 @@ function toolsFor(root, nxJson, projectGraph, bases) {
209
211
  function verifyTools(tools) {
210
212
  try {
211
213
  const observed = [];
214
+ const census = { start: censusStart(), observed };
212
215
  for (const tool of tools) {
213
216
  if (realpathSync(tool.path) !== tool.physicalPath || !missing(tool.missing))
214
217
  return { ok: false, detail: `Producer tool alias/namespace changed: ${tool.name}` };
215
- const nodes = tool.nodes.map((node) => receiptNode(node.path, node.path, observed));
218
+ const nodes = tool.nodes.map((node) => receiptNode(node.path, node.path, census));
216
219
  if (!same(nodes, tool.nodes) || sha(nodes) !== tool.sha256)
217
220
  return { ok: false, detail: `Producer tool/module bytes changed: ${tool.name}` };
218
221
  }
219
- return nodesUnchanged(observed)
222
+ const moved = movedNodes(observed, recordedTool(tools));
223
+ return moved === null
220
224
  ? { ok: true, value: observed }
221
- : { ok: false, detail: 'Producer tool nodes changed during readonly validation' };
225
+ : { ok: false, detail: `Producer tool nodes changed during readonly validation: ${moved}` };
222
226
  }
223
227
  catch (error) {
224
228
  if (error instanceof Error)
@@ -909,8 +913,9 @@ function validatedReceipt(root, target) {
909
913
  ? 'Public product bytes differ from actual producer receipt'
910
914
  : census.reason.detail,
911
915
  };
912
- if (!nodesUnchanged(tools.value))
913
- return { ok: false, detail: 'Producer tool namespace changed during independent product validation' };
916
+ const moved = movedNodes(tools.value, recordedTool(receipt.producer.tools));
917
+ if (moved !== null)
918
+ return { ok: false, detail: `Producer tool namespace changed during independent product validation: ${moved}` };
914
919
  return { ok: true, value: receipt };
915
920
  }
916
921
  catch (error) {
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A test target's one bound: the `idleTimeoutMs` with which no test may go unfinished, the hang backstop of
3
+ * specs/cowshed/08_testing.md. It is no wall-clock ceiling: a suite that keeps finishing tests runs as long as it
4
+ * needs. It is the longest any single test may run, so it stays above every slow-timeout class in the plugin's
5
+ * nextest.toml; a bun leg has no per-test deadline of its own (`BUN_TEST_TIMEOUT_FLAG`).
6
+ */
7
+ export declare const BOUNDED_TEST_IDLE_TIMEOUT_MS = 180000;
8
+ export declare const BOUNDED_TEST_KILL_AFTER_MS = 10000;
9
+ //# sourceMappingURL=test-backstop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-backstop.d.ts","sourceRoot":"","sources":["../src/test-backstop.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,SAAU,CAAC;AACpD,eAAO,MAAM,0BAA0B,QAAS,CAAC"}
@@ -0,0 +1,10 @@
1
+ // A leaf module with no imports: tests' child processes on plain bun load testing.ts, which reads this bound, so
2
+ // nothing here may pull in a module that needs the typia transform (bounded-test-policy.ts does).
3
+ /**
4
+ * A test target's one bound: the `idleTimeoutMs` with which no test may go unfinished, the hang backstop of
5
+ * specs/cowshed/08_testing.md. It is no wall-clock ceiling: a suite that keeps finishing tests runs as long as it
6
+ * needs. It is the longest any single test may run, so it stays above every slow-timeout class in the plugin's
7
+ * nextest.toml; a bun leg has no per-test deadline of its own (`BUN_TEST_TIMEOUT_FLAG`).
8
+ */
9
+ export const BOUNDED_TEST_IDLE_TIMEOUT_MS = 180_000;
10
+ export const BOUNDED_TEST_KILL_AFTER_MS = 10_000;
@@ -0,0 +1,30 @@
1
+ import { type ChangeRange } from './test-walk-policy.js';
2
+ export type ClockOracleKind = 'runner-deadline' | 'test-deadline' | 'clock-delta' | 'clocked-bound';
3
+ export declare const TEST_CLOCK_ORACLE: {
4
+ id: string;
5
+ /** The leg's no-progress backstop: a bound at or above it, or 0 (disabled), cannot decide a case. */
6
+ backstopMs: number;
7
+ message: {
8
+ 'runner-deadline': string;
9
+ 'test-deadline': string;
10
+ 'clock-delta': string;
11
+ 'clocked-bound': string;
12
+ };
13
+ help: {
14
+ 'runner-deadline': string;
15
+ 'test-deadline': string;
16
+ 'clock-delta': string;
17
+ 'clocked-bound': string;
18
+ };
19
+ };
20
+ export interface ClockOracle {
21
+ readonly kind: ClockOracleKind;
22
+ readonly file: string;
23
+ readonly line: number;
24
+ /** The 1-based column of the site's first character. */
25
+ readonly column: number;
26
+ readonly text: string;
27
+ }
28
+ export declare function findClockOracles(root: string, files: readonly string[], changes?: ReadonlyMap<string, readonly ChangeRange[]>): ClockOracle[];
29
+ export declare function formatClockOracle(oracle: ClockOracle): string;
30
+ //# sourceMappingURL=test-clock-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-clock-policy.d.ts","sourceRoot":"","sources":["../src/test-clock-policy.ts"],"names":[],"mappings":"AAoCA,OAAO,EAAE,KAAK,WAAW,EAAwB,MAAM,uBAAuB,CAAC;AAE/E,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG,eAAe,GAAG,aAAa,GAAG,eAAe,CAAC;AAEpG,eAAO,MAAM,iBAAiB;;IAE5B,qGAAqG;;;;;;;;;;;;;;CAwBtG,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAslBD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAC,GACpD,WAAW,EAAE,CAsBf;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAM7D"}