@smoothbricks/nx-plugin 0.7.17 → 0.7.19

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 (199) hide show
  1. package/README.md +315 -114
  2. package/dist/.build-inputs.json +47 -38
  3. package/dist/built-output-packages.js +1 -1
  4. package/dist/bun-lock-scope.d.ts +128 -20
  5. package/dist/bun-lock-scope.d.ts.map +1 -1
  6. package/dist/bun-lock-scope.js +267 -44
  7. package/dist/cargo-closure-input.d.ts +8 -6
  8. package/dist/cargo-closure-input.d.ts.map +1 -1
  9. package/dist/cargo-closure-input.js +15 -12
  10. package/dist/cargo-source-hash.d.ts +26 -25
  11. package/dist/cargo-source-hash.d.ts.map +1 -1
  12. package/dist/cargo-source-hash.js +84 -105
  13. package/dist/cargo-toolchain-paths.d.ts +2 -2
  14. package/dist/cargo-toolchain-paths.js +2 -2
  15. package/dist/cargo-workspace.d.ts +20 -2
  16. package/dist/cargo-workspace.d.ts.map +1 -1
  17. package/dist/cargo-workspace.js +43 -22
  18. package/dist/ensure-built-receipt.d.ts +3 -2
  19. package/dist/ensure-built-receipt.d.ts.map +1 -1
  20. package/dist/ensure-built-receipt.js +3 -2
  21. package/dist/eslint-config-closure.d.ts +8 -3
  22. package/dist/eslint-config-closure.d.ts.map +1 -1
  23. package/dist/eslint-config-closure.js +24 -5
  24. package/dist/executors/bounded-exec/admission-queue.d.ts +3 -1
  25. package/dist/executors/bounded-exec/admission-queue.d.ts.map +1 -1
  26. package/dist/executors/bounded-exec/admission-queue.js +9 -10
  27. package/dist/executors/bounded-exec/awake-clock.d.ts +5 -0
  28. package/dist/executors/bounded-exec/awake-clock.d.ts.map +1 -0
  29. package/dist/executors/bounded-exec/awake-clock.js +22 -0
  30. package/dist/executors/bounded-exec/bounds.d.ts +19 -6
  31. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
  32. package/dist/executors/bounded-exec/bounds.js +22 -15
  33. package/dist/executors/bounded-exec/case-gate.d.ts +114 -0
  34. package/dist/executors/bounded-exec/case-gate.d.ts.map +1 -0
  35. package/dist/executors/bounded-exec/case-gate.js +342 -0
  36. package/dist/executors/bounded-exec/cpu-pool-thread.d.ts +1 -0
  37. package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -1
  38. package/dist/executors/bounded-exec/cpu-pool-thread.js +2 -2
  39. package/dist/executors/bounded-exec/cpu-pool.d.ts +28 -1
  40. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
  41. package/dist/executors/bounded-exec/cpu-pool.js +102 -16
  42. package/dist/executors/bounded-exec/cpu-rise.d.ts +73 -0
  43. package/dist/executors/bounded-exec/cpu-rise.d.ts.map +1 -0
  44. package/dist/executors/bounded-exec/cpu-rise.js +111 -0
  45. package/dist/executors/bounded-exec/endpoint-life.d.ts +146 -0
  46. package/dist/executors/bounded-exec/endpoint-life.d.ts.map +1 -0
  47. package/dist/executors/bounded-exec/endpoint-life.js +228 -0
  48. package/dist/executors/bounded-exec/executor.d.ts +1 -1
  49. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  50. package/dist/executors/bounded-exec/executor.js +256 -86
  51. package/dist/executors/bounded-exec/gateway-lease.d.ts +1 -1
  52. package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
  53. package/dist/executors/bounded-exec/gateway-lease.js +8 -1
  54. package/dist/executors/bounded-exec/go-run-summary.d.ts +51 -0
  55. package/dist/executors/bounded-exec/go-run-summary.d.ts.map +1 -0
  56. package/dist/executors/bounded-exec/go-run-summary.js +98 -0
  57. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +11 -3
  58. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
  59. package/dist/executors/bounded-exec/hang-diagnostics.js +125 -47
  60. package/dist/executors/bounded-exec/lease-wait.d.ts +1 -0
  61. package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -1
  62. package/dist/executors/bounded-exec/lease-wait.js +1 -0
  63. package/dist/executors/bounded-exec/mbx-pool.d.ts +42 -7
  64. package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
  65. package/dist/executors/bounded-exec/mbx-pool.js +45 -8
  66. package/dist/executors/bounded-exec/mbx-reservations.d.ts +12 -6
  67. package/dist/executors/bounded-exec/mbx-reservations.d.ts.map +1 -1
  68. package/dist/executors/bounded-exec/mbx-reservations.js +190 -284
  69. package/dist/executors/bounded-exec/parent-grant.d.ts +2 -0
  70. package/dist/executors/bounded-exec/parent-grant.d.ts.map +1 -1
  71. package/dist/executors/bounded-exec/parent-grant.js +1 -0
  72. package/dist/executors/bounded-exec/pool-admission.d.ts +29 -3
  73. package/dist/executors/bounded-exec/pool-admission.d.ts.map +1 -1
  74. package/dist/executors/bounded-exec/pool-admission.js +47 -1
  75. package/dist/executors/bounded-exec/progress-channel.d.ts +38 -0
  76. package/dist/executors/bounded-exec/progress-channel.d.ts.map +1 -0
  77. package/dist/executors/bounded-exec/progress-channel.js +113 -0
  78. package/dist/executors/bounded-exec/progress.d.ts +5 -1
  79. package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
  80. package/dist/executors/bounded-exec/progress.js +31 -1
  81. package/dist/executors/bounded-exec/ram-temp.d.ts +24 -1
  82. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
  83. package/dist/executors/bounded-exec/ram-temp.js +123 -16
  84. package/dist/executors/bounded-exec/reservation-connection.d.ts +90 -0
  85. package/dist/executors/bounded-exec/reservation-connection.d.ts.map +1 -0
  86. package/dist/executors/bounded-exec/reservation-connection.js +248 -0
  87. package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
  88. package/dist/executors/bounded-exec/run-cpu-pool.js +3 -0
  89. package/dist/executors/bounded-exec/runner-sizing.d.ts +9 -5
  90. package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -1
  91. package/dist/executors/bounded-exec/runner-sizing.js +13 -9
  92. package/dist/executors/bounded-exec/schema.d.ts +7 -2
  93. package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
  94. package/dist/executors/bounded-exec/schema.js +17 -1
  95. package/dist/executors/bounded-exec/suite-minimum.d.ts +21 -0
  96. package/dist/executors/bounded-exec/suite-minimum.d.ts.map +1 -0
  97. package/dist/executors/bounded-exec/suite-minimum.js +85 -0
  98. package/dist/executors/bounded-exec/test-result-writer.d.ts +2 -0
  99. package/dist/executors/bounded-exec/test-result-writer.d.ts.map +1 -1
  100. package/dist/executors/bounded-exec/test-result-writer.js +1 -0
  101. package/dist/executors/bounded-exec/test-results.d.ts +5 -0
  102. package/dist/executors/bounded-exec/test-results.d.ts.map +1 -1
  103. package/dist/executors/bounded-exec/test-results.js +2 -2
  104. package/dist/executors/bounded-exec/verdict.d.ts +39 -10
  105. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  106. package/dist/executors/bounded-exec/verdict.js +60 -14
  107. package/dist/executors/cargo-zigbuild/executor.d.ts +10 -8
  108. package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
  109. package/dist/executors/cargo-zigbuild/executor.js +32 -19
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +294 -152
  112. package/dist/managed-files/ci-workflow.d.ts +4 -1
  113. package/dist/managed-files/ci-workflow.d.ts.map +1 -1
  114. package/dist/managed-files/ci-workflow.js +9 -14
  115. package/dist/managed-files/files.d.ts +3 -3
  116. package/dist/managed-files/files.js +3 -3
  117. package/dist/managed-files/generator.d.ts +5 -1
  118. package/dist/managed-files/generator.d.ts.map +1 -1
  119. package/dist/managed-files/generator.js +22 -7
  120. package/dist/managed-files/render-memo.d.ts +13 -0
  121. package/dist/managed-files/render-memo.d.ts.map +1 -0
  122. package/dist/managed-files/render-memo.js +94 -0
  123. package/dist/task-results.js +2 -1
  124. package/dist/test-program.d.ts +11 -6
  125. package/dist/test-program.d.ts.map +1 -1
  126. package/dist/test-program.js +39 -35
  127. package/dist/tool-bins.d.ts +12 -0
  128. package/dist/tool-bins.d.ts.map +1 -1
  129. package/dist/tool-bins.js +31 -6
  130. package/dist/typecheck-test-policy.d.ts +10 -1
  131. package/dist/typecheck-test-policy.d.ts.map +1 -1
  132. package/dist/typecheck-test-policy.js +40 -24
  133. package/dist/workspace-config-policy.d.ts.map +1 -1
  134. package/dist/workspace-config-policy.js +135 -42
  135. package/dist/workspace-index.d.ts +14 -1
  136. package/dist/workspace-index.d.ts.map +1 -1
  137. package/dist/workspace-index.js +36 -4
  138. package/executors.json +2 -0
  139. package/managed/raw/envrc +24 -0
  140. package/managed/raw/patches/nx@24.0.3.patch +1851 -221
  141. package/managed/raw/patches/ttsc@0.37.1.patch +1055 -0
  142. package/managed/raw/tooling/direnv/developer-links.ts +122 -14
  143. package/managed/raw/tooling/direnv/devenv.smoo.nix +20 -19
  144. package/managed/templates/github/actions/save-nix-devenv/action.yml +19 -1
  145. package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
  146. package/package.json +68 -11
  147. package/runtime/nx-publish/.build-inputs.json +2 -2
  148. package/runtime/nx-publish/cache_adapter.js +293 -3
  149. package/runtime/nx-publish/nx_publish.js +36 -14
  150. package/src/built-output-packages.ts +1 -1
  151. package/src/bun-lock-scope.ts +293 -40
  152. package/src/cargo-closure-input.ts +20 -12
  153. package/src/cargo-source-hash.ts +119 -145
  154. package/src/cargo-toolchain-paths.ts +2 -2
  155. package/src/cargo-workspace.ts +59 -21
  156. package/src/ensure-built-receipt.ts +3 -2
  157. package/src/eslint-config-closure.ts +27 -6
  158. package/src/executors/bounded-exec/admission-queue.ts +11 -10
  159. package/src/executors/bounded-exec/awake-clock.ts +20 -0
  160. package/src/executors/bounded-exec/bounds.ts +41 -19
  161. package/src/executors/bounded-exec/case-gate.ts +365 -0
  162. package/src/executors/bounded-exec/cpu-pool-thread.ts +3 -3
  163. package/src/executors/bounded-exec/cpu-pool.ts +139 -12
  164. package/src/executors/bounded-exec/cpu-rise.ts +156 -0
  165. package/src/executors/bounded-exec/endpoint-life.ts +279 -0
  166. package/src/executors/bounded-exec/executor.ts +341 -123
  167. package/src/executors/bounded-exec/gateway-lease.ts +6 -0
  168. package/src/executors/bounded-exec/go-run-summary.ts +137 -0
  169. package/src/executors/bounded-exec/hang-diagnostics.ts +150 -50
  170. package/src/executors/bounded-exec/lease-wait.ts +1 -0
  171. package/src/executors/bounded-exec/mbx-pool.ts +57 -9
  172. package/src/executors/bounded-exec/mbx-reservations.ts +216 -183
  173. package/src/executors/bounded-exec/parent-grant.ts +3 -0
  174. package/src/executors/bounded-exec/pool-admission.ts +59 -2
  175. package/src/executors/bounded-exec/progress-channel.ts +129 -0
  176. package/src/executors/bounded-exec/progress.ts +39 -3
  177. package/src/executors/bounded-exec/ram-temp.ts +137 -17
  178. package/src/executors/bounded-exec/reservation-connection.ts +221 -0
  179. package/src/executors/bounded-exec/run-cpu-pool.ts +2 -0
  180. package/src/executors/bounded-exec/runner-sizing.ts +13 -8
  181. package/src/executors/bounded-exec/schema.json +1 -1
  182. package/src/executors/bounded-exec/schema.ts +21 -2
  183. package/src/executors/bounded-exec/suite-minimum.ts +81 -0
  184. package/src/executors/bounded-exec/test-result-writer.ts +3 -0
  185. package/src/executors/bounded-exec/test-results.ts +5 -0
  186. package/src/executors/bounded-exec/verdict.ts +83 -22
  187. package/src/executors/cargo-zigbuild/executor.ts +30 -19
  188. package/src/index.ts +357 -166
  189. package/src/managed-files/ci-workflow.ts +13 -17
  190. package/src/managed-files/files.ts +3 -3
  191. package/src/managed-files/generator.ts +21 -6
  192. package/src/managed-files/render-memo.ts +135 -0
  193. package/src/test-program.ts +36 -41
  194. package/src/tool-bins.ts +35 -6
  195. package/src/typecheck-test-policy.ts +49 -24
  196. package/src/workspace-config-policy.ts +161 -43
  197. package/src/workspace-index.ts +40 -5
  198. package/test-timings.json +157 -141
  199. package/managed/raw/patches/ttsc@0.36.3.patch +0 -1660
@@ -14,6 +14,11 @@
14
14
  * Recorded declarations follow their current target after a successful install.
15
15
  * A plain `bun install` still relinks an undeclared link: only a wrapper around
16
16
  * bun itself could intercept that. A declared one (below) comes back on its own.
17
+ * A consumer's Nx key never hashes an undeclared link as the installed version:
18
+ * a key that omits a linked package's live files is sound only while every
19
+ * link is a tracked `smoo.developerLinks` declaration, whose edit recomputes
20
+ * the graph, so a consumer's Nx plugin refuses an undeclared link by name,
21
+ * applying the definition below through `developerLinksIn`.
17
22
  *
18
23
  * A developer link is a symlink directly inside a node_modules tree bun
19
24
  * installs (the root's or a workspace member's, scoped names included) whose
@@ -146,14 +151,14 @@ import {
146
151
  snapshotBinding,
147
152
  } from './linked-snapshots.ts';
148
153
 
149
- interface DeveloperLink {
154
+ export interface DeveloperLink {
150
155
  /** Where the link is, relative to the project root. */
151
156
  readonly path: string;
152
157
  /** The link's own text, restored byte for byte. */
153
158
  readonly target: string;
154
159
  }
155
160
 
156
- interface DeveloperLinks {
161
+ export interface DeveloperLinks {
157
162
  /** Links kept across an install: every link whose target is not known to be gone, unreadable ones included. */
158
163
  readonly live: readonly DeveloperLink[];
159
164
  /** Links whose target no longer exists. */
@@ -378,10 +383,19 @@ function describeDeveloperLinks(root: string, { live, unreadable }: Omit<Develop
378
383
  }
379
384
 
380
385
  function findDeveloperLinks(root: string): DeveloperLinks {
386
+ return developerLinksIn(root, nodeModulesTrees(root));
387
+ }
388
+
389
+ /**
390
+ * The developer links directly inside `trees` (node_modules directories relative to `root`), classified as
391
+ * `findDeveloperLinks` classifies them. The caller names the trees, so a process that is not Bun (an Nx plugin
392
+ * worker under Node, which takes them from its project graph) applies the same definition without reading bun.lock.
393
+ */
394
+ export function developerLinksIn(root: string, trees: readonly string[]): DeveloperLinks {
381
395
  const live: DeveloperLink[] = [];
382
396
  const dangling: DeveloperLink[] = [];
383
397
  const unreadable: (DeveloperLink & { readonly code: string })[] = [];
384
- for (const tree of nodeModulesTrees(root)) {
398
+ for (const tree of trees) {
385
399
  for (const entry of packageLinks(root, tree)) {
386
400
  const link: DeveloperLink = { path: entry, target: readlinkSync(path.join(root, entry)) };
387
401
  const target = resolvedTarget(root, link);
@@ -861,7 +875,8 @@ function unavailableReason(target: string): string | null {
861
875
  /**
862
876
  * A build unit of a linked package that does not describe its current sources, or cannot be shown to: what an alias
863
877
  * to the live checkout would actually run. A unit with an input record is judged by content: one of its inputs has
864
- * other bytes than the build read, was removed, or was added since. A unit with outputs but no record is
878
+ * other bytes than the build read, was removed, or was added since, or an entry of the `Cargo.lock` closure the build
879
+ * read is gone or resolves a dependency to another package. A unit with outputs but no record is
865
880
  * `unrecorded`: nothing says which bytes built it, and modification times cannot tell a rewrite with the same bytes (a
866
881
  * rebase, a branch switch, a stash) from a change. A published unit with no outputs was never built.
867
882
  */
@@ -873,15 +888,28 @@ export type StaleBuild = {
873
888
  readonly rebuild: string;
874
889
  readonly workspaceRoot: string;
875
890
  } & (
876
- | { readonly basis: 'recorded'; readonly input: string; readonly change: 'changed' | 'removed' | 'added' }
891
+ | ({ readonly basis: 'recorded' } & RecordedChange)
877
892
  | { readonly basis: 'unrecorded'; readonly output: string }
878
893
  | { readonly basis: 'unbuilt' }
879
894
  );
880
895
 
896
+ /**
897
+ * What a record no longer describes: a file by its path, or an entry of the recorded `Cargo.lock` closure, named as
898
+ * `<lockfile> [[package]] <name version (source)>`, that is gone (`removed`) or whose dependency list no longer
899
+ * resolves to the recorded `dependency` (`relocked`).
900
+ */
901
+ type RecordedChange =
902
+ | { readonly input: string; readonly change: 'changed' | 'removed' | 'added' }
903
+ | { readonly input: string; readonly change: 'relocked'; readonly dependency: string };
904
+
881
905
  /**
882
906
  * The input record a producer writes into each output directory and Nx restores with it (`.build-inputs.json`; the
883
907
  * producer side is the nx-plugin's build-inputs.ts): `files` maps each workspace-relative input to the SHA-256 of the
884
- * bytes the build read, and `complete`, when present, holds Git pathspecs whose every match is an input.
908
+ * bytes the build read, and `complete`, when present, holds Git pathspecs whose every match is an input. A Cargo
909
+ * build's `cargoLock` names its lockfile and the closure it read of it, by the computation its Nx task key uses
910
+ * (build-inputs' cargo-closure.ts): each package as the lockfile spells a dependency in full, to the packages its
911
+ * built dependencies resolved to. The lockfile is never among `files`: an entry of another crate's closure is no
912
+ * input of this build, and its task key does not move for one either.
885
913
  */
886
914
  const BUILD_INPUTS_FILE = '.build-inputs.json';
887
915
 
@@ -889,6 +917,7 @@ interface BuildInputRecord {
889
917
  readonly files: ReadonlyMap<string, string>;
890
918
  readonly complete: readonly string[];
891
919
  readonly producer: BuildInputProducer | undefined;
920
+ readonly cargoLock: CargoLockInputs | undefined;
892
921
  }
893
922
 
894
923
  /** The file boundary parses JSON once, then the pure decoder validates its data and provenance together. */
@@ -919,14 +948,91 @@ export function decodeBuildInputRecord(parsed: unknown, record: string): BuildIn
919
948
  files: new Map(Object.entries(files).map(([file, hash]) => [file, String(hash)])),
920
949
  complete: complete ?? [],
921
950
  producer,
951
+ cargoLock: decodeCargoLock(Reflect.get(parsed, 'cargoLock'), record),
922
952
  };
923
953
  }
924
954
 
955
+ interface CargoLockInputs {
956
+ readonly file: string;
957
+ readonly packages: ReadonlyMap<string, readonly string[]>;
958
+ }
959
+
960
+ function decodeCargoLock(value: unknown, record: string): CargoLockInputs | undefined {
961
+ if (value === undefined) return undefined;
962
+ const file: unknown = isObject(value) ? Reflect.get(value, 'file') : undefined;
963
+ const listed: unknown = isObject(value) ? Reflect.get(value, 'packages') : undefined;
964
+ const refusal = `${record} is not a version 1 build input record: cargoLock`;
965
+ if (typeof file !== 'string' || !isObject(listed) || Array.isArray(listed)) throw new Error(refusal);
966
+ const packages = new Map<string, readonly string[]>();
967
+ for (const [spelling, dependencies] of Object.entries(listed)) {
968
+ if (!Array.isArray(dependencies) || !dependencies.every((entry): entry is string => typeof entry === 'string'))
969
+ throw new Error(refusal);
970
+ packages.set(spelling, dependencies);
971
+ }
972
+ return { file, packages };
973
+ }
974
+
975
+ /**
976
+ * The first package of a recorded lockfile closure that the lockfile no longer resolves as the build read it, or null
977
+ * when every recorded package still has its entry and that entry's dependency list still resolves to each recorded
978
+ * dependency. Read from the lockfile's own text, with no Cargo process: an entry is `name version (source)`, a path
979
+ * package's has no source, and a dependency is spelled as short as stays unambiguous (`name`, `name version`, or in
980
+ * full), so each is resolved to its one entry before it is compared. An entry outside the recorded closure is not
981
+ * read, whatever it says.
982
+ */
983
+ function lockClosureChange(workspaceRoot: string, { file, packages }: CargoLockInputs): RecordedChange | null {
984
+ const at = path.join(workspaceRoot, file);
985
+ if (!existsSync(at)) return { input: file, change: 'removed' };
986
+ const parsed: unknown = Bun.TOML.parse(readFileSync(at, 'utf8'));
987
+ const listed: unknown = isObject(parsed) ? Reflect.get(parsed, 'package') : undefined;
988
+ const text = (entry: unknown, key: string): string | undefined => {
989
+ const value: unknown = isObject(entry) ? Reflect.get(entry, key) : undefined;
990
+ return typeof value === 'string' ? value : undefined;
991
+ };
992
+ const bySpelling = new Map<string, readonly string[]>();
993
+ const byName = new Map<string, { version: string; source: string | undefined; spelling: string }[]>();
994
+ for (const entry of Array.isArray(listed) ? listed : []) {
995
+ const name = text(entry, 'name');
996
+ const version = text(entry, 'version');
997
+ if (name === undefined || version === undefined)
998
+ throw new Error(`${at} holds a [[package]] without a name or version`);
999
+ const source = text(entry, 'source');
1000
+ const spelling = source === undefined ? `${name} ${version}` : `${name} ${version} (${source})`;
1001
+ const dependencies: unknown = Reflect.get(entry, 'dependencies');
1002
+ bySpelling.set(
1003
+ spelling,
1004
+ Array.isArray(dependencies) ? dependencies.filter((each): each is string => typeof each === 'string') : [],
1005
+ );
1006
+ const named = byName.get(name) ?? [];
1007
+ named.push({ version, source, spelling });
1008
+ byName.set(name, named);
1009
+ }
1010
+ const resolved = (reference: string): string | undefined => {
1011
+ const [name, version, source] = reference.split(' ');
1012
+ const candidates = (byName.get(name ?? '') ?? []).filter(
1013
+ (entry) =>
1014
+ (version === undefined || entry.version === version) &&
1015
+ (source === undefined || `(${entry.source})` === source),
1016
+ );
1017
+ return candidates.length === 1 ? candidates[0]?.spelling : undefined;
1018
+ };
1019
+ for (const [spelling, dependencies] of packages) {
1020
+ const entry = bySpelling.get(spelling);
1021
+ const input = `${file} [[package]] ${spelling}`;
1022
+ if (entry === undefined) return { input, change: 'removed' };
1023
+ const current = new Set(entry.map(resolved));
1024
+ for (const dependency of dependencies) {
1025
+ if (!current.has(dependency)) return { input, change: 'relocked', dependency };
1026
+ }
1027
+ }
1028
+ return null;
1029
+ }
1030
+
925
1031
  /** The first input whose bytes differ from what the build recorded, or null when the record describes the sources. */
926
1032
  function recordedChange(
927
1033
  workspaceRoot: string,
928
- { files: recorded, complete }: BuildInputRecord,
929
- ): { readonly input: string; readonly change: 'changed' | 'removed' | 'added' } | null {
1034
+ { files: recorded, complete, cargoLock }: BuildInputRecord,
1035
+ ): RecordedChange | null {
930
1036
  for (const [file, hash] of recorded) {
931
1037
  const at = path.join(workspaceRoot, file);
932
1038
  if (!existsSync(at)) return { input: file, change: 'removed' };
@@ -947,7 +1053,7 @@ function recordedChange(
947
1053
  if (!recorded.has(file) && existsSync(path.join(workspaceRoot, file))) return { input: file, change: 'added' };
948
1054
  }
949
1055
  }
950
- return null;
1056
+ return cargoLock === undefined ? null : lockClosureChange(workspaceRoot, cargoLock);
951
1057
  }
952
1058
 
953
1059
  /** One build of a linked package: the outputs it writes and the files it reads. */
@@ -1252,11 +1358,13 @@ export function staleBuildsRefusal(stale: readonly StaleBuild[]): string {
1252
1358
  const lines = stale.map((build) => {
1253
1359
  if (build.basis === 'recorded') {
1254
1360
  const how =
1255
- build.change === 'changed'
1256
- ? 'has other bytes than the build read'
1257
- : build.change === 'removed'
1258
- ? 'was removed since the build'
1259
- : 'was added since the build';
1361
+ build.change === 'relocked'
1362
+ ? `no longer resolves its dependency ${build.dependency}, which the build read`
1363
+ : build.change === 'changed'
1364
+ ? 'has other bytes than the build read'
1365
+ : build.change === 'removed'
1366
+ ? 'was removed since the build'
1367
+ : 'was added since the build';
1260
1368
  return ` - ${build.packageName}: ${build.unit} is stale: input ${build.input} ${how} (its ${BUILD_INPUTS_FILE})`;
1261
1369
  }
1262
1370
  return build.basis === 'unbuilt'
@@ -96,9 +96,9 @@
96
96
  '';
97
97
 
98
98
  # The Linux rust-std set every Linux Rust artifact ships for except
99
- # x86_64-unknown-linux-gnu, which the base shell already carries; see
100
- # `profiles.linux-cross` below for where it applies and why. zig and
101
- # cargo-zigbuild are in the base shell (see `packages`).
99
+ # x86_64-unknown-linux-gnu. Every host's base shell carries it (see
100
+ # `languages.rust.targets` below and the note above `profiles.linux-cross`).
101
+ # zig and cargo-zigbuild are in the base shell (see `packages`).
102
102
  linuxToolchain = {
103
103
  languages.rust.targets = [
104
104
  "aarch64-unknown-linux-gnu"
@@ -265,7 +265,7 @@ in {
265
265
  "wasm32-unknown-unknown"
266
266
  "x86_64-unknown-linux-gnu"
267
267
  ]
268
- ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux linuxToolchain.languages.rust.targets;
268
+ ++ linuxToolchain.languages.rust.targets;
269
269
  };
270
270
 
271
271
  # The Linux Rust toolchain is cargo-zigbuild driving zig, plus the Linux
@@ -277,26 +277,27 @@ in {
277
277
  # host's glibc floor. cargo-zigbuild supplies the `zig cc` shims and per-triple
278
278
  # compiler variables itself, so this module sets no environment.
279
279
  #
280
- # Every host's base shell carries zig, cargo-zigbuild and the
281
- # x86_64-unknown-linux-gnu rust-std, which is all the cross clippy needs, so
282
- # `cargo-lint-cross` runs in any checkout's shell and in the land gate's one Nx
283
- # graph beside every other gate task. A Linux host also carries the remaining
284
- # Linux rust-std set in the base shell, because its ordinary `build` includes
285
- # its own platform's artifacts. A macOS host opts into that set through the
286
- # `linux-cross` profile, activated by `devenv -P linux-cross`: the three
287
- # rust-std targets are about 0.5 GiB and only a Linux artifact built on Darwin
288
- # needs them. devenv 2.2.3 has first-class profiles, so this is one gated
289
- # module in the shared file rather than a second config directory that would
290
- # re-import and re-pin everything here.
280
+ # Every host's base shell carries zig, cargo-zigbuild and the whole Linux
281
+ # rust-std set, so `cargo-lint-cross` and every Linux artifact build run in
282
+ # any checkout's shell and in the land gate's one Nx graph beside every other
283
+ # gate task. On macOS the three targets beyond x86_64-unknown-linux-gnu are
284
+ # about 0.5 GiB, fetched once per Nix store. They were a `linux-cross`
285
+ # profile, which no fork inherits: cowshed carries the base shell's activation
286
+ # to every fork (cowshed 11_shell.md, "Inherited shells"), while devenv keys a
287
+ # profile's evaluation and its shell on the checkout's path, so the first
288
+ # profile entry in a fresh fork evaluated from scratch (225 s, silent, inside
289
+ # a consumer's land-gate watchdog, 2026-11-11). Cargo keys no unit on rustc's path
290
+ # (cargo-toolchain-paths.ts), so the larger set moves no cargo task's key.
291
291
  #
292
292
  # Neither shell sets CARGO_BUILD_TARGET: the triple belongs to the Nx target
293
293
  # that asks for it (`cargo-lint-cross` passes `--target` explicitly), not to
294
294
  # the ambient environment. An ambient triple would make the check silently
295
295
  # host-local wherever it was missing, reporting green having compiled macOS,
296
296
  # and a host lint can never be mistaken for a cross one.
297
- profiles.linux-cross.module = {
298
- config = lib.mkIf (!pkgs.stdenv.hostPlatform.isLinux) linuxToolchain;
299
- };
297
+ # `linux-cross` adds nothing: it stays declared because devenv refuses a
298
+ # profile the module does not define, and a caller that still passes
299
+ # `-P linux-cross` keeps entering the same shell.
300
+ profiles.linux-cross.module = {};
300
301
 
301
302
  # linux-cross is the only profile here, and the shape of the publish job is
302
303
  # why. A lean publish shell was measured and rejected, so the next reader does
@@ -348,7 +349,7 @@ in {
348
349
  # comment that rots.
349
350
  #
350
351
  # It needs its own input because the fleet's nixpkgs does not carry that patch:
351
- # devenv-nixpkgs rolling has no Go 1.27, while ttsc 0.36.3 vendors go1.27.3.
352
+ # devenv-nixpkgs rolling has no Go 1.27, while ttsc 0.37.1 vendors go1.27.4.
352
353
  # Same idiom, and same reason, for any single-package pin — one leaf package
353
354
  # from a nixpkgs that has it, lock-pinned, prebuilt, rather than a fleet-wide
354
355
  # bump that would move rustc, bun and node too. Not every pairing is
@@ -3,7 +3,7 @@ description: >
3
3
  Save what must outlive the job, after it ends and whatever its result: the devenv/direnv eval-cache segment, on every
4
4
  ephemeral runner where setup missed and build-shell produced nix-eval-cache.db, and the ttsc plugin binaries the job
5
5
  used, when setup's restore was not an exact hit. The Nix store cache saves itself in setup-devenv's post phase
6
- (ephemeral runners only).
6
+ (ephemeral runners only). Release this job's host cache mounts before the runner removes its checkout.
7
7
 
8
8
  inputs:
9
9
  devenv-cache-hit:
@@ -40,3 +40,21 @@ runs:
40
40
  uses: ./.github/actions/cache-ttsc-plugins
41
41
  with:
42
42
  mode: save
43
+
44
+ # Release children before their workspace bind. Lazy detach lets the runner remove its checkout even while a
45
+ # job-local daemon still holds an open path; it does not delete the shared cache backing either mount.
46
+ - name: Release job-owned host cache mounts
47
+ if: always()
48
+ shell: bash
49
+ run: |
50
+ status=0
51
+ for mount_path in "${CI_CARGO_TARGET_MOUNT:-}" "${CI_DEVENV_WORKSPACE_MOUNT:-}"; do
52
+ if [[ -z "$mount_path" ]]; then
53
+ continue
54
+ fi
55
+ echo "detaching this job's cache mount at $mount_path"
56
+ if ! sudo umount --lazy -- "$mount_path"; then
57
+ status=1
58
+ fi
59
+ done
60
+ exit "$status"
@@ -241,6 +241,7 @@ runs:
241
241
  done
242
242
  if mkdir -p "$stable" && sudo mount --bind "$GITHUB_WORKSPACE" "$stable"; then
243
243
  echo "DEVENV_WORKDIR=$stable" >> "$GITHUB_ENV"
244
+ echo "CI_DEVENV_WORKSPACE_MOUNT=$stable" >> "$GITHUB_ENV"
244
245
  echo "devenv state: $root (workspace bind-mounted at $stable)"
245
246
  else
246
247
  echo "DEVENV_WORKDIR=$GITHUB_WORKSPACE" >> "$GITHUB_ENV"
@@ -277,6 +278,7 @@ runs:
277
278
  target="$DEVENV_WORKDIR/target"
278
279
  if mkdir -p "$root" "$target" && sudo mount --bind "$root" "$target"; then
279
280
  echo "CARGO_UNSTABLE_CHECKSUM_FRESHNESS=true" >> "$GITHUB_ENV"
281
+ echo "CI_CARGO_TARGET_MOUNT=$target" >> "$GITHUB_ENV"
280
282
  echo "cargo target: $root (bound at $target)"
281
283
  else
282
284
  echo "::warning::cargo target bind refused; this job builds $target from cold"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smoothbricks/nx-plugin",
3
- "version": "0.7.17",
3
+ "version": "0.7.19",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "./loader.js",
@@ -48,6 +48,11 @@
48
48
  "import": "./dist/executors/bounded-exec/test-result-writer.js",
49
49
  "default": "./dist/executors/bounded-exec/test-result-writer.js"
50
50
  },
51
+ "./bounded-exec-verdict": {
52
+ "types": "./dist/executors/bounded-exec/verdict.d.ts",
53
+ "import": "./dist/executors/bounded-exec/verdict.js",
54
+ "default": "./dist/executors/bounded-exec/verdict.js"
55
+ },
51
56
  "./build-state-output-policy": {
52
57
  "types": "./dist/build-state-output-policy.d.ts",
53
58
  "import": "./dist/build-state-output-policy.js",
@@ -470,6 +475,41 @@
470
475
  "cwd": "{projectRoot}"
471
476
  }
472
477
  },
478
+ "ttsc-plugin-hosts": {
479
+ "executor": "nx:run-commands",
480
+ "cache": true,
481
+ "metadata": {
482
+ "smooTaskKind": "test"
483
+ },
484
+ "inputs": [
485
+ "{projectRoot}/src/__tests__/prepare-ttsc-plugin-hosts.ts",
486
+ "{projectRoot}/src/__tests__/ttsc-cache-dir.ts",
487
+ "{projectRoot}/package.json",
488
+ "{projectRoot}/tsconfig.lib.json",
489
+ "{projectRoot}/tsconfig.test.json",
490
+ "{workspaceRoot}/tsconfig.base.json",
491
+ "{projectRoot}/src/__tests__/typescript-emit-fixtures.ts",
492
+ "{projectRoot}/src/__tests__/dialect-plugin/**/*",
493
+ "{projectRoot}/src/__tests__/side-output-plugin/**/*",
494
+ "{workspaceRoot}/packages/lmao-ttsc/package.json",
495
+ "{workspaceRoot}/packages/lmao-ttsc/plugin.cjs",
496
+ "{workspaceRoot}/packages/lmao-ttsc/plugin/**/*",
497
+ "bunToolchain",
498
+ {
499
+ "runtime": "sh node_modules/@smoothbricks/nx-plugin/runtime-input.sh go version"
500
+ }
501
+ ],
502
+ "outputs": [
503
+ "{projectRoot}/.cache/ttsc-plugin-hosts/plugins/*/plugin"
504
+ ],
505
+ "options": {
506
+ "command": "bun src/__tests__/prepare-ttsc-plugin-hosts.ts",
507
+ "cwd": "{projectRoot}",
508
+ "env": {
509
+ "TTSC_CACHE_DIR": ".cache/ttsc-plugin-hosts"
510
+ }
511
+ }
512
+ },
473
513
  "test-shard1": {
474
514
  "executor": "@smoothbricks/nx-plugin:bounded-exec",
475
515
  "cache": true,
@@ -489,11 +529,15 @@
489
529
  "...",
490
530
  "^build",
491
531
  "build",
492
- "cargo-stream-archive"
532
+ "cargo-stream-archive",
533
+ "ttsc-plugin-hosts"
493
534
  ],
494
535
  "options": {
495
536
  "command": "bun test --timeout=0 --timings=test-timings.json --shard=1/4 --path-ignore-patterns='**/*-host.test.ts'",
496
537
  "cwd": "{projectRoot}",
538
+ "env": {
539
+ "TTSC_CACHE_DIR": ".cache/ttsc-plugin-hosts"
540
+ },
497
541
  "idleTimeoutMs": 180000,
498
542
  "killAfterMs": 10000
499
543
  }
@@ -517,11 +561,15 @@
517
561
  "...",
518
562
  "^build",
519
563
  "build",
520
- "cargo-stream-archive"
564
+ "cargo-stream-archive",
565
+ "ttsc-plugin-hosts"
521
566
  ],
522
567
  "options": {
523
568
  "command": "bun test --timeout=0 --timings=test-timings.json --shard=2/4 --path-ignore-patterns='**/*-host.test.ts'",
524
569
  "cwd": "{projectRoot}",
570
+ "env": {
571
+ "TTSC_CACHE_DIR": ".cache/ttsc-plugin-hosts"
572
+ },
525
573
  "idleTimeoutMs": 180000,
526
574
  "killAfterMs": 10000
527
575
  }
@@ -545,11 +593,15 @@
545
593
  "...",
546
594
  "^build",
547
595
  "build",
548
- "cargo-stream-archive"
596
+ "cargo-stream-archive",
597
+ "ttsc-plugin-hosts"
549
598
  ],
550
599
  "options": {
551
600
  "command": "bun test --timeout=0 --timings=test-timings.json --shard=3/4 --path-ignore-patterns='**/*-host.test.ts'",
552
601
  "cwd": "{projectRoot}",
602
+ "env": {
603
+ "TTSC_CACHE_DIR": ".cache/ttsc-plugin-hosts"
604
+ },
553
605
  "idleTimeoutMs": 180000,
554
606
  "killAfterMs": 10000
555
607
  }
@@ -573,11 +625,15 @@
573
625
  "...",
574
626
  "^build",
575
627
  "build",
576
- "cargo-stream-archive"
628
+ "cargo-stream-archive",
629
+ "ttsc-plugin-hosts"
577
630
  ],
578
631
  "options": {
579
632
  "command": "bun test --timeout=0 --timings=test-timings.json --shard=4/4 --path-ignore-patterns='**/*-host.test.ts'",
580
633
  "cwd": "{projectRoot}",
634
+ "env": {
635
+ "TTSC_CACHE_DIR": ".cache/ttsc-plugin-hosts"
636
+ },
581
637
  "idleTimeoutMs": 180000,
582
638
  "killAfterMs": 10000
583
639
  }
@@ -659,9 +715,9 @@
659
715
  },
660
716
  "dependencies": {
661
717
  "@nx/js": "24.0.3",
662
- "@smoothbricks/build-inputs": "0.0.3",
663
- "@smoothbricks/cargo-retain": "0.0.2",
664
- "@smoothbricks/cowshed": "0.5.1",
718
+ "@smoothbricks/build-inputs": "0.0.4",
719
+ "@smoothbricks/cargo-retain": "0.0.3",
720
+ "@smoothbricks/cowshed": "0.5.3",
665
721
  "@smoothbricks/nextest-extract": "0.0.2",
666
722
  "jsonc-parser": "^3.3.1",
667
723
  "minimatch": "10.2.5",
@@ -670,12 +726,13 @@
670
726
  "smol-toml": "^1.6.1",
671
727
  "tslib": "^2.8.1",
672
728
  "typescript": "^6.0.3",
673
- "typia": "15.2.1",
729
+ "typia": "15.4.1",
674
730
  "yaml": "^2.9.0"
675
731
  },
676
732
  "devDependencies": {
677
- "@smoothbricks/lmao": "0.6.2",
678
- "@smoothbricks/validation": "0.1.14",
733
+ "@smoothbricks/lmao": "0.7.0",
734
+ "@smoothbricks/validation": "0.1.15",
735
+ "@typescript/native": "npm:typescript@^7.0.2",
679
736
  "fast-check": "^4.4.0"
680
737
  }
681
738
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "version": 1,
3
3
  "files": {
4
- "packages/cowshed/crates/cowshed-core/src/build_volume/cache_adapter.js": "e8c05f18787e395d1509daf75bdb521b1a7018dff60daa1c8afe93ca8f585d64",
5
- "packages/cowshed/crates/cowshed-core/src/build_volume/nx_publish.js": "431e05ae1e1a1249a23bf2600101d6e88ca01bc0fc95bd389128e126edca33b9"
4
+ "packages/cowshed/crates/cowshed-core/src/build_volume/cache_adapter.js": "43bda609bb37306a73e831262ba30afb6c58dd20c4700854812cabcd5f2d3c53",
5
+ "packages/cowshed/crates/cowshed-core/src/build_volume/nx_publish.js": "c3261b7c8d45b9acd385fd139b7239c157e58660875bbb77836281f62a58efc7"
6
6
  },
7
7
  "producer": {
8
8
  "project": "nx-plugin",