@smoothbricks/nx-plugin 0.5.7 → 0.6.1

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 (446) hide show
  1. package/README.md +1097 -360
  2. package/dist/.build-inputs.json +141 -0
  3. package/dist/bin/smoo-nx-cargo-toolchain.d.ts +3 -0
  4. package/dist/bin/smoo-nx-cargo-toolchain.d.ts.map +1 -0
  5. package/dist/bin/smoo-nx-cargo-toolchain.js +8 -0
  6. package/dist/bin/smoo-nx-forbidden-spellings.d.ts +3 -0
  7. package/dist/bin/smoo-nx-forbidden-spellings.d.ts.map +1 -0
  8. package/dist/bin/smoo-nx-forbidden-spellings.js +32 -0
  9. package/dist/bin/smoo-nx-nextest-timings.d.ts +3 -0
  10. package/dist/bin/smoo-nx-nextest-timings.d.ts.map +1 -0
  11. package/dist/bin/smoo-nx-nextest-timings.js +28 -0
  12. package/dist/bounded-test-policy.d.ts +1 -1
  13. package/dist/bounded-test-policy.d.ts.map +1 -1
  14. package/dist/bounded-test-policy.js +14 -15
  15. package/dist/build-state-output-policy.d.ts +95 -1
  16. package/dist/build-state-output-policy.d.ts.map +1 -1
  17. package/dist/build-state-output-policy.js +368 -30
  18. package/dist/bun-lock-scope.d.ts +44 -0
  19. package/dist/bun-lock-scope.d.ts.map +1 -0
  20. package/dist/bun-lock-scope.js +97 -0
  21. package/dist/cargo-build-script-env.d.ts +49 -0
  22. package/dist/cargo-build-script-env.d.ts.map +1 -0
  23. package/dist/cargo-build-script-env.js +324 -0
  24. package/dist/cargo-closure-input.d.ts +31 -4
  25. package/dist/cargo-closure-input.d.ts.map +1 -1
  26. package/dist/cargo-closure-input.js +66 -6
  27. package/dist/cargo-retention-hook.d.ts +17 -0
  28. package/dist/cargo-retention-hook.d.ts.map +1 -0
  29. package/dist/cargo-retention-hook.js +85 -0
  30. package/dist/cargo-source-hash.d.ts +25 -7
  31. package/dist/cargo-source-hash.d.ts.map +1 -1
  32. package/dist/cargo-source-hash.js +108 -43
  33. package/dist/cargo-toolchain-paths.d.ts +40 -0
  34. package/dist/cargo-toolchain-paths.d.ts.map +1 -0
  35. package/dist/cargo-toolchain-paths.js +84 -0
  36. package/dist/cargo-toolchain-policy.d.ts +25 -8
  37. package/dist/cargo-toolchain-policy.d.ts.map +1 -1
  38. package/dist/cargo-toolchain-policy.js +39 -5
  39. package/dist/cargo-workspace.d.ts +10 -4
  40. package/dist/cargo-workspace.d.ts.map +1 -1
  41. package/dist/cargo-workspace.js +65 -95
  42. package/dist/cross-check-policy.d.ts +9 -9
  43. package/dist/cross-check-policy.d.ts.map +1 -1
  44. package/dist/cross-check-policy.js +11 -11
  45. package/dist/disk-command-policy.d.ts.map +1 -1
  46. package/dist/disk-command-policy.js +1 -0
  47. package/dist/ensure-built-receipt.d.ts +22 -5
  48. package/dist/ensure-built-receipt.d.ts.map +1 -1
  49. package/dist/ensure-built-receipt.js +168 -48
  50. package/dist/ensure-built-witness.d.ts +27 -8
  51. package/dist/ensure-built-witness.d.ts.map +1 -1
  52. package/dist/ensure-built-witness.js +45 -15
  53. package/dist/ensure-built.d.ts.map +1 -1
  54. package/dist/ensure-built.js +9 -1
  55. package/dist/eslint-config-closure.d.ts +7 -0
  56. package/dist/eslint-config-closure.d.ts.map +1 -0
  57. package/dist/eslint-config-closure.js +346 -0
  58. package/dist/executors/bounded-exec/bounds.d.ts +56 -0
  59. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -0
  60. package/dist/executors/bounded-exec/bounds.js +43 -0
  61. package/dist/executors/bounded-exec/cpu-pool-thread.d.ts +28 -0
  62. package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -0
  63. package/dist/executors/bounded-exec/cpu-pool-thread.js +20 -0
  64. package/dist/executors/bounded-exec/cpu-pool.d.ts +35 -38
  65. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
  66. package/dist/executors/bounded-exec/cpu-pool.js +56 -120
  67. package/dist/executors/bounded-exec/executor.d.ts +19 -12
  68. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  69. package/dist/executors/bounded-exec/executor.js +389 -239
  70. package/dist/executors/bounded-exec/gateway-lease.d.ts +23 -19
  71. package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
  72. package/dist/executors/bounded-exec/gateway-lease.js +102 -29
  73. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
  74. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
  75. package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
  76. package/dist/executors/bounded-exec/lease-wait.d.ts +64 -0
  77. package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
  78. package/dist/executors/bounded-exec/lease-wait.js +72 -0
  79. package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
  80. package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
  81. package/dist/executors/bounded-exec/lock-wait.js +108 -0
  82. package/dist/executors/bounded-exec/mbx-pool.d.ts +31 -0
  83. package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -0
  84. package/dist/executors/bounded-exec/mbx-pool.js +24 -0
  85. package/dist/executors/bounded-exec/owned-subtree.d.ts +84 -0
  86. package/dist/executors/bounded-exec/owned-subtree.d.ts.map +1 -0
  87. package/dist/executors/bounded-exec/owned-subtree.js +178 -0
  88. package/dist/executors/bounded-exec/progress.d.ts +4 -1
  89. package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
  90. package/dist/executors/bounded-exec/progress.js +5 -2
  91. package/dist/executors/bounded-exec/ram-attach.d.ts +19 -0
  92. package/dist/executors/bounded-exec/ram-attach.d.ts.map +1 -0
  93. package/dist/executors/bounded-exec/ram-attach.js +207 -0
  94. package/dist/executors/bounded-exec/ram-detach.d.ts +25 -0
  95. package/dist/executors/bounded-exec/ram-detach.d.ts.map +1 -0
  96. package/dist/executors/bounded-exec/ram-detach.js +207 -0
  97. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +76 -0
  98. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -1
  99. package/dist/executors/bounded-exec/ram-temp-fixtures.js +296 -0
  100. package/dist/executors/bounded-exec/ram-temp.d.ts +388 -88
  101. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
  102. package/dist/executors/bounded-exec/ram-temp.js +1213 -399
  103. package/dist/executors/bounded-exec/run-cpu-pool.d.ts +10 -4
  104. package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
  105. package/dist/executors/bounded-exec/run-cpu-pool.js +122 -35
  106. package/dist/executors/bounded-exec/runner-hook.js +14 -5
  107. package/dist/executors/bounded-exec/runner-lifecycle.d.ts +14 -1
  108. package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
  109. package/dist/executors/bounded-exec/runner-lifecycle.js +27 -6
  110. package/dist/executors/bounded-exec/{cpu-tokens.d.ts → runner-sizing.d.ts} +14 -42
  111. package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -0
  112. package/dist/executors/bounded-exec/{cpu-tokens.js → runner-sizing.js} +5 -35
  113. package/dist/executors/bounded-exec/runtime-pin.d.ts +73 -0
  114. package/dist/executors/bounded-exec/runtime-pin.d.ts.map +1 -0
  115. package/dist/executors/bounded-exec/runtime-pin.js +167 -0
  116. package/dist/executors/bounded-exec/schema.d.ts +18 -1
  117. package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
  118. package/dist/executors/bounded-exec/verdict.d.ts +48 -11
  119. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  120. package/dist/executors/bounded-exec/verdict.js +89 -20
  121. package/dist/executors/cargo-zigbuild/executor.d.ts +21 -0
  122. package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
  123. package/dist/executors/cargo-zigbuild/executor.js +67 -12
  124. package/dist/executors/clean-outputs/executor.js +1 -0
  125. package/dist/executors/scriptc-native/executor.d.ts +79 -0
  126. package/dist/executors/scriptc-native/executor.d.ts.map +1 -0
  127. package/dist/executors/scriptc-native/executor.js +367 -0
  128. package/dist/executors/scriptc-native/ffi-paths.d.ts +9 -0
  129. package/dist/executors/scriptc-native/ffi-paths.d.ts.map +1 -0
  130. package/dist/executors/scriptc-native/ffi-paths.js +25 -0
  131. package/dist/executors/scriptc-native/schema.d.ts +34 -0
  132. package/dist/executors/scriptc-native/schema.d.ts.map +1 -0
  133. package/dist/executors/scriptc-native/schema.js +1 -0
  134. package/dist/executors/typescript-emit/emit-overrides.d.ts +14 -0
  135. package/dist/executors/typescript-emit/emit-overrides.d.ts.map +1 -0
  136. package/dist/executors/typescript-emit/emit-overrides.js +24 -0
  137. package/dist/executors/typescript-emit/executor.d.ts +3 -1
  138. package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
  139. package/dist/executors/typescript-emit/executor.js +146 -33
  140. package/dist/forbidden-spelling-policy.d.ts +56 -0
  141. package/dist/forbidden-spelling-policy.d.ts.map +1 -0
  142. package/dist/forbidden-spelling-policy.js +176 -0
  143. package/dist/generators/create-package/generator.d.ts.map +1 -1
  144. package/dist/generators/create-package/generator.js +3 -4
  145. package/dist/graph-input-contract.d.ts +14 -0
  146. package/dist/graph-input-contract.d.ts.map +1 -1
  147. package/dist/graph-input-contract.js +67 -2
  148. package/dist/index.d.ts +23 -6
  149. package/dist/index.d.ts.map +1 -1
  150. package/dist/index.js +672 -214
  151. package/dist/managed-assets.d.ts +2 -0
  152. package/dist/managed-assets.d.ts.map +1 -1
  153. package/dist/managed-files/files.d.ts +3 -3
  154. package/dist/managed-files/files.d.ts.map +1 -1
  155. package/dist/managed-files/files.js +28 -3
  156. package/dist/managed-files/managed-format.d.ts.map +1 -1
  157. package/dist/managed-files/managed-format.js +1 -0
  158. package/dist/managed-files/publish-workflow.js +14 -11
  159. package/dist/nextest-code-bound.js +1 -0
  160. package/dist/nextest-timings.d.ts +35 -0
  161. package/dist/nextest-timings.d.ts.map +1 -0
  162. package/dist/nextest-timings.js +168 -0
  163. package/dist/owned-installation.d.ts +6 -5
  164. package/dist/owned-installation.d.ts.map +1 -1
  165. package/dist/owned-installation.js +150 -26
  166. package/dist/package-target-policy.d.ts.map +1 -1
  167. package/dist/package-target-policy.js +2 -3
  168. package/dist/process-children.d.ts +7 -0
  169. package/dist/process-children.d.ts.map +1 -0
  170. package/dist/process-children.darwin.d.ts +7 -0
  171. package/dist/process-children.darwin.d.ts.map +1 -0
  172. package/dist/process-children.darwin.js +13 -0
  173. package/dist/process-children.js +14 -0
  174. package/dist/process-children.linux.d.ts +8 -0
  175. package/dist/process-children.linux.d.ts.map +1 -0
  176. package/dist/process-children.linux.js +25 -0
  177. package/dist/process-group.d.ts +108 -0
  178. package/dist/process-group.d.ts.map +1 -0
  179. package/dist/process-group.js +171 -0
  180. package/dist/process-listing.d.ts +7 -0
  181. package/dist/process-listing.d.ts.map +1 -0
  182. package/dist/process-listing.js +51 -0
  183. package/dist/producer-receipts.d.ts +8 -2
  184. package/dist/producer-receipts.d.ts.map +1 -1
  185. package/dist/producer-receipts.js +514 -47
  186. package/dist/task-graph-policy.d.ts +21 -0
  187. package/dist/task-graph-policy.d.ts.map +1 -0
  188. package/dist/task-graph-policy.js +91 -0
  189. package/dist/test-timings.js +4 -4
  190. package/dist/test-walk-policy.d.ts +14 -5
  191. package/dist/test-walk-policy.d.ts.map +1 -1
  192. package/dist/test-walk-policy.js +8 -2
  193. package/dist/testing.d.ts +73 -28
  194. package/dist/testing.d.ts.map +1 -1
  195. package/dist/testing.js +217 -223
  196. package/dist/tool-bins.d.ts +33 -0
  197. package/dist/tool-bins.d.ts.map +1 -0
  198. package/dist/tool-bins.js +72 -0
  199. package/dist/typecheck-test-policy.d.ts.map +1 -1
  200. package/dist/typecheck-test-policy.js +3 -4
  201. package/dist/wait-why-policy.d.ts +28 -0
  202. package/dist/wait-why-policy.d.ts.map +1 -0
  203. package/dist/wait-why-policy.js +223 -0
  204. package/dist/workspace-config-policy.d.ts +14 -8
  205. package/dist/workspace-config-policy.d.ts.map +1 -1
  206. package/dist/workspace-config-policy.js +60 -16
  207. package/dist/workspace-manifest.d.ts +41 -6
  208. package/dist/workspace-manifest.d.ts.map +1 -1
  209. package/dist/workspace-manifest.js +57 -0
  210. package/executors.json +16 -1
  211. package/loader.js +2 -0
  212. package/managed/raw/envrc +11 -0
  213. package/managed/raw/patches/nx@23.2.1.patch +2840 -199
  214. package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
  215. package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
  216. package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
  217. package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
  218. package/managed/raw/tooling/direnv/developer-links.ts +464 -25
  219. package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
  220. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
  221. package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
  222. package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
  223. package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
  224. package/managed/raw/tooling/direnv/repo-path +68 -6
  225. package/managed/raw/tooling/direnv/secret-references.ts +13 -4
  226. package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
  227. package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
  228. package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
  229. package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
  230. package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
  231. package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
  232. package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
  233. package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
  234. package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
  235. package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
  236. package/package.json +95 -14
  237. package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
  238. package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
  239. package/src/bin/smoo-nx-nextest-timings.ts +31 -0
  240. package/src/bounded-test-policy.ts +12 -14
  241. package/src/build-state-output-policy.ts +458 -34
  242. package/src/bun-lock-scope.ts +108 -0
  243. package/src/cargo-build-script-env.ts +265 -0
  244. package/src/cargo-closure-input.ts +74 -7
  245. package/src/cargo-retention-hook.ts +94 -0
  246. package/src/cargo-source-hash.ts +138 -41
  247. package/src/cargo-toolchain-paths.ts +95 -0
  248. package/src/cargo-toolchain-policy.ts +49 -5
  249. package/src/cargo-workspace.ts +72 -123
  250. package/src/cross-check-policy.ts +12 -10
  251. package/src/disk-command-policy.ts +1 -0
  252. package/src/ensure-built-receipt.ts +173 -39
  253. package/src/ensure-built-witness.ts +62 -10
  254. package/src/ensure-built.ts +11 -1
  255. package/src/eslint-config-closure.ts +357 -0
  256. package/src/executors/bounded-exec/bounds.ts +76 -0
  257. package/src/executors/bounded-exec/cpu-pool-thread.ts +43 -0
  258. package/src/executors/bounded-exec/cpu-pool.ts +55 -120
  259. package/src/executors/bounded-exec/executor.ts +442 -260
  260. package/src/executors/bounded-exec/gateway-lease.ts +94 -35
  261. package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
  262. package/src/executors/bounded-exec/lease-wait.ts +116 -0
  263. package/src/executors/bounded-exec/lock-wait.ts +141 -0
  264. package/src/executors/bounded-exec/mbx-pool.ts +48 -0
  265. package/src/executors/bounded-exec/owned-subtree.ts +235 -0
  266. package/src/executors/bounded-exec/progress.ts +9 -3
  267. package/src/executors/bounded-exec/ram-attach.ts +238 -0
  268. package/src/executors/bounded-exec/ram-detach.ts +226 -0
  269. package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
  270. package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
  271. package/src/executors/bounded-exec/ram-temp.ts +1497 -460
  272. package/src/executors/bounded-exec/run-cpu-pool.ts +129 -35
  273. package/src/executors/bounded-exec/runner-hook.ts +14 -6
  274. package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
  275. package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
  276. package/src/executors/bounded-exec/runtime-pin.ts +232 -0
  277. package/src/executors/bounded-exec/schema.json +11 -2
  278. package/src/executors/bounded-exec/schema.ts +19 -1
  279. package/src/executors/bounded-exec/verdict.ts +145 -35
  280. package/src/executors/cargo-zigbuild/executor.ts +82 -8
  281. package/src/executors/clean-outputs/executor.ts +1 -0
  282. package/src/executors/scriptc-native/executor.ts +394 -0
  283. package/src/executors/scriptc-native/ffi-paths.ts +29 -0
  284. package/src/executors/scriptc-native/schema.json +60 -0
  285. package/src/executors/scriptc-native/schema.ts +34 -0
  286. package/src/executors/typescript-emit/emit-overrides.ts +24 -0
  287. package/src/executors/typescript-emit/executor.ts +186 -38
  288. package/src/forbidden-spelling-policy.ts +226 -0
  289. package/src/generators/create-package/generator.ts +7 -7
  290. package/src/graph-input-contract.ts +61 -2
  291. package/src/index.ts +788 -224
  292. package/src/managed-assets.ts +3 -0
  293. package/src/managed-files/files.ts +28 -3
  294. package/src/managed-files/managed-format.ts +1 -0
  295. package/src/managed-files/publish-workflow.ts +20 -15
  296. package/src/nextest-code-bound.ts +1 -0
  297. package/src/nextest-timings.ts +106 -0
  298. package/src/owned-installation.ts +150 -23
  299. package/src/package-target-policy.ts +2 -3
  300. package/src/process-children.darwin.ts +14 -0
  301. package/src/process-children.linux.ts +33 -0
  302. package/src/process-children.ts +22 -0
  303. package/src/process-group.ts +209 -0
  304. package/src/process-listing.ts +54 -0
  305. package/src/producer-receipts.ts +92 -41
  306. package/src/task-graph-policy.ts +98 -0
  307. package/src/test-walk-policy.ts +23 -8
  308. package/src/testing.ts +240 -232
  309. package/src/tool-bins.ts +108 -0
  310. package/src/typecheck-test-policy.ts +2 -3
  311. package/src/wait-why-policy.ts +226 -0
  312. package/src/workspace-config-policy.ts +63 -15
  313. package/src/workspace-manifest.ts +89 -6
  314. package/test-timings.json +124 -99
  315. package/dist/bin/smoo-nx-failures.d.ts +0 -3
  316. package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
  317. package/dist/bin/smoo-nx-failures.js +0 -3
  318. package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
  319. package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
  320. package/dist/bin/smoo-nx-nextest-extract.js +0 -42
  321. package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
  322. package/dist/failure-summary.d.ts +0 -5
  323. package/dist/failure-summary.d.ts.map +0 -1
  324. package/dist/failure-summary.js +0 -118
  325. package/dist/nextest-extraction.d.ts +0 -117
  326. package/dist/nextest-extraction.d.ts.map +0 -1
  327. package/dist/nextest-extraction.js +0 -303
  328. package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
  329. package/src/__tests__/cargo-closure-filesets.ts +0 -94
  330. package/src/__tests__/cargo-closure-fixture.ts +0 -113
  331. package/src/__tests__/counted-cargo-process.ts +0 -286
  332. package/src/__tests__/counted-cargo.ts +0 -713
  333. package/src/__tests__/directory-change.ts +0 -27
  334. package/src/__tests__/fixture-cargo-home.ts +0 -36
  335. package/src/__tests__/fixture-nx-env.ts +0 -193
  336. package/src/__tests__/owned-installation.ts +0 -13
  337. package/src/__tests__/past-tick.ts +0 -12
  338. package/src/__tests__/progress-clock.ts +0 -43
  339. package/src/__tests__/runtime-input.ts +0 -23
  340. package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
  341. package/src/bin/smoo-nx-failures.ts +0 -4
  342. package/src/bin/smoo-nx-nextest-extract.ts +0 -44
  343. package/src/bounded-test-policy.test.ts +0 -1029
  344. package/src/build-state-output-policy.test.ts +0 -115
  345. package/src/bun-bootstrap.test.ts +0 -102
  346. package/src/bun-file-packages.test.ts +0 -47
  347. package/src/cargo-closure-filesets.test.ts +0 -63
  348. package/src/cargo-closure-input.property.test.ts +0 -50
  349. package/src/cargo-closure-input.test.ts +0 -506
  350. package/src/cargo-closure-key.test.ts +0 -240
  351. package/src/cargo-resolve-cache.test.ts +0 -1181
  352. package/src/cargo-source-hash.test.ts +0 -707
  353. package/src/cargo-workspace.test.ts +0 -615
  354. package/src/cross-check-policy.test.ts +0 -316
  355. package/src/disk-command-policy.test.ts +0 -61
  356. package/src/ensure-built-receipt.test.ts +0 -279
  357. package/src/ensure-built-witness.test.ts +0 -688
  358. package/src/ensure-built.test.ts +0 -1462
  359. package/src/executors/all-verdicts/executor.test.ts +0 -135
  360. package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
  361. package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
  362. package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
  363. package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
  364. package/src/executors/bounded-exec/executor-host.test.ts +0 -800
  365. package/src/executors/bounded-exec/executor.test.ts +0 -1819
  366. package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
  367. package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
  368. package/src/executors/bounded-exec/progress.test.ts +0 -139
  369. package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
  370. package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
  371. package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
  372. package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
  373. package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
  374. package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
  375. package/src/executors/bounded-exec/verdict.test.ts +0 -545
  376. package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
  377. package/src/executors/clean-outputs/executor.test.ts +0 -20
  378. package/src/executors/typescript-emit/executor.test.ts +0 -83
  379. package/src/failure-summary.ts +0 -119
  380. package/src/generators/bounded-test-targets/generator.test.ts +0 -138
  381. package/src/generators/bun-test-tracing/generator.test.ts +0 -250
  382. package/src/generators/create-package/generator.test.ts +0 -190
  383. package/src/generators/make-public/generator.test.ts +0 -137
  384. package/src/graph-input-contract.test.ts +0 -379
  385. package/src/host-controller-wiring.test.ts +0 -31
  386. package/src/index.test.ts +0 -3321
  387. package/src/linked-snapshots.nx.test.ts +0 -254
  388. package/src/managed-files/forgejo-artifact.test.ts +0 -395
  389. package/src/managed-files/generator.test.ts +0 -243
  390. package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
  391. package/src/managed-files/json-edit.test.ts +0 -216
  392. package/src/managed-files/managed-content.test.ts +0 -166
  393. package/src/managed-files/managed-format-json.test.ts +0 -308
  394. package/src/managed-files/repo-path.test.ts +0 -172
  395. package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
  396. package/src/managed-files/trace-db-artifact.test.ts +0 -7
  397. package/src/managed-files/tree-permissions.test.ts +0 -109
  398. package/src/managed-files/tree.test.ts +0 -123
  399. package/src/manifest-hash.test.ts +0 -219
  400. package/src/nextest-code-bound.test.ts +0 -161
  401. package/src/nextest-extraction.test.ts +0 -216
  402. package/src/nextest-extraction.ts +0 -371
  403. package/src/nextest-partitions.test.ts +0 -501
  404. package/src/nx-cache-bound.test.ts +0 -109
  405. package/src/nx-cache-restore-mtime.test.ts +0 -170
  406. package/src/nx-daemon-claim.test.ts +0 -279
  407. package/src/nx-daemon-idle-cpu.test.ts +0 -80
  408. package/src/nx-daemon-idle-policy.test.ts +0 -111
  409. package/src/nx-daemon-ignore-files.test.ts +0 -210
  410. package/src/nx-daemon-root-normalization.test.ts +0 -105
  411. package/src/nx-daemon-start-never.test.ts +0 -292
  412. package/src/nx-daemon-validity.test.ts +0 -1055
  413. package/src/nx-dot-input-policy.test.ts +0 -353
  414. package/src/nx-failure-life-cycles.test.ts +0 -207
  415. package/src/nx-files-archive-racy.test.ts +0 -97
  416. package/src/nx-foreign-workspace-env.test.ts +0 -329
  417. package/src/nx-incomplete-run-summary.test.ts +0 -70
  418. package/src/nx-plugin-load-errors.test.ts +0 -120
  419. package/src/nx-project-graph-errors.test.ts +0 -70
  420. package/src/nx-project-resolution-cache.test.ts +0 -176
  421. package/src/nx-raw-inputs.test.ts +0 -166
  422. package/src/nx-resident-graph-workers.test.ts +0 -112
  423. package/src/nx-run-information.test.ts +0 -118
  424. package/src/nx-skipped-task-exit.test.ts +0 -180
  425. package/src/nx-state-location.test.ts +0 -63
  426. package/src/nx-store-resolution.test.ts +0 -81
  427. package/src/nx-task-graph-cycles.test.ts +0 -148
  428. package/src/nx-task-output-lease.test.ts +0 -550
  429. package/src/nx-use-local.test.ts +0 -105
  430. package/src/owned-installation.test.ts +0 -105
  431. package/src/package-target-policy.test.ts +0 -1014
  432. package/src/producer-receipts.test.ts +0 -285
  433. package/src/release-config-policy.test.ts +0 -311
  434. package/src/runtime-input.test.ts +0 -393
  435. package/src/serial-group-wiring.test.ts +0 -326
  436. package/src/task-history-namespace.test.ts +0 -181
  437. package/src/task-results.test.ts +0 -228
  438. package/src/test-clock-policy.test.ts +0 -338
  439. package/src/test-program.test.ts +0 -303
  440. package/src/test-timings.test.ts +0 -240
  441. package/src/test-walk-policy.test.ts +0 -620
  442. package/src/testing.test.ts +0 -509
  443. package/src/typecheck-test-policy.test.ts +0 -1468
  444. package/src/typescript-resolution.test.ts +0 -76
  445. package/src/version-actions.test.ts +0 -80
  446. package/src/workspace-config-policy.test.ts +0 -737
@@ -0,0 +1,232 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { accessSync, constants, readFileSync, statSync } from 'node:fs';
3
+ import { delimiter, join, resolve } from 'node:path';
4
+ import { promisify } from 'node:util';
5
+ import type { Result } from './ram-temp.js';
6
+
7
+ /**
8
+ * A leg that runs `bun` runs the Bun its workspace declares.
9
+ *
10
+ * The root `package.json` names that Bun in `packageManager` (`bun@1.4.3`); the Bun the command gets is the first `bun`
11
+ * on the PATH it runs with. When the two disagree the leg is refused before it asks for anything, naming both versions
12
+ * and the binary. A Bun other than the declared one does not fail at startup: on Bun 1.4.2 `console.log` drops what a
13
+ * full pipe refuses, so a child's JSON document reaches the parent that reads it cut in the middle of a string, the
14
+ * child exits 0, and the leg fails three layers from the cause as `JSON Parse error: Unterminated string`. The refusal
15
+ * is that mismatch, said where it happens.
16
+ */
17
+
18
+ /**
19
+ * `bun --version` answers in milliseconds. The bound is for a `bun` that never answers (a wrapper waiting on a lock):
20
+ * it refuses the leg, which would otherwise hang before its own bounds start.
21
+ */
22
+ const VERSION_DEADLINE_MS = 120_000;
23
+
24
+ /**
25
+ * A word `bun` that the shell resolves through PATH, in command position or in a string a wrapper runs: `bun test`,
26
+ * `cd x && bun run y`, `FOO=1 bun a`, `sh -c 'bun test'`. A path-qualified `../runtime/bun` names its binary itself,
27
+ * so PATH decides nothing for it; `bunx`, `bun-runtime` and `bun.js` are other words.
28
+ */
29
+ const BUN_COMMAND = /(?<=^|[\s;&|()'"`])bun(?=$|[\s;&|()'"`])/;
30
+
31
+ /** `bun@<version>` as corepack spells `packageManager`, with the content hash it may add after `+`. */
32
+ const BUN_DECLARATION = /^bun@(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)(?:\+.+)?$/;
33
+
34
+ const execFileAsync = promisify(execFile);
35
+
36
+ /** What the workspace declares: `bun@<version>` in its root `package.json`'s `packageManager`. */
37
+ export interface DeclaredBun {
38
+ /** The manifest that declares it. */
39
+ readonly manifest: string;
40
+ /** The field as written. */
41
+ readonly declaration: string;
42
+ /** The version it names, without the content hash. */
43
+ readonly version: string;
44
+ }
45
+
46
+ /** Where the command's PATH comes from: the target's own `env`, or the process the executor runs in. */
47
+ export type PathSource = "the target's env" | 'the inherited environment';
48
+
49
+ /** Why a leg that runs `bun` is not run, as the values the message is made of. */
50
+ export type RuntimePinRefusal =
51
+ | {
52
+ readonly code: 'mismatch';
53
+ readonly declared: DeclaredBun;
54
+ /** The first `bun` on the command's PATH. */
55
+ readonly bun: string;
56
+ /** What that `bun --version` printed. */
57
+ readonly version: string;
58
+ readonly pathSource: PathSource;
59
+ }
60
+ | {
61
+ readonly code: 'unreadable-version';
62
+ readonly declared: DeclaredBun;
63
+ readonly bun: string;
64
+ readonly reason: string;
65
+ readonly pathSource: PathSource;
66
+ }
67
+ | { readonly code: 'malformed-declaration'; readonly manifest: string; readonly declaration: string }
68
+ | { readonly code: 'unreadable-manifest'; readonly manifest: string; readonly reason: string };
69
+
70
+ /** What `bun --version` printed for `bun` run in `env` from `cwd`, or why it printed none. */
71
+ export type BunProbe = (bun: string, env: NodeJS.ProcessEnv, cwd: string) => Promise<Result<string, string>>;
72
+
73
+ export interface RuntimePinCheck {
74
+ /** The workspace root: its `package.json` declares the Bun. */
75
+ readonly root: string;
76
+ /** The command line, as the shell will run it. */
77
+ readonly command: string;
78
+ /** The environment the command runs with: its PATH decides which `bun` it gets. */
79
+ readonly env: NodeJS.ProcessEnv;
80
+ /** Where the command starts; a relative PATH entry is relative to it. */
81
+ readonly cwd: string;
82
+ readonly pathSource: PathSource;
83
+ }
84
+
85
+ /** Whether `command` names `bun` for the shell to find on PATH: the legs this guard is for. */
86
+ export function runsBun(command: string): boolean {
87
+ return BUN_COMMAND.test(command);
88
+ }
89
+
90
+ /**
91
+ * The first executable regular file `name` on `pathValue`, as the shell the command runs under finds it. An empty entry
92
+ * is the working directory, like `.`: the command starts in `cwd`, which is not the executor's.
93
+ */
94
+ export function resolveOnPath(name: string, pathValue: string | undefined, cwd: string): string | null {
95
+ for (const entry of (pathValue ?? '').split(delimiter)) {
96
+ const candidate = resolve(cwd, entry === '' ? '.' : entry, name);
97
+ try {
98
+ if (!statSync(candidate).isFile()) {
99
+ continue;
100
+ }
101
+ accessSync(candidate, constants.X_OK);
102
+ } catch {
103
+ continue;
104
+ }
105
+ return candidate;
106
+ }
107
+ return null;
108
+ }
109
+
110
+ /**
111
+ * The Bun the workspace declares, `null` when it declares none: no manifest, no `packageManager`, or another package
112
+ * manager's. A `packageManager` that names `bun` and no version is refused, not read as no declaration: it says a Bun
113
+ * is declared, and a guard that skipped it would be silent exactly where the declaration is wrong.
114
+ */
115
+ export function declaredBun(root: string): Result<DeclaredBun | null, RuntimePinRefusal> {
116
+ const manifest = join(root, 'package.json');
117
+ let parsed: unknown;
118
+ try {
119
+ parsed = JSON.parse(readFileSync(manifest, 'utf8'));
120
+ } catch (error) {
121
+ if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
122
+ return { ok: true, value: null };
123
+ }
124
+ const reason = error instanceof Error ? error.message : String(error);
125
+ return { ok: false, error: { code: 'unreadable-manifest', manifest, reason } };
126
+ }
127
+ const declaration: unknown =
128
+ typeof parsed === 'object' && parsed !== null && 'packageManager' in parsed ? parsed.packageManager : undefined;
129
+ if (typeof declaration !== 'string' || !declaration.startsWith('bun@')) {
130
+ return { ok: true, value: null };
131
+ }
132
+ const version = BUN_DECLARATION.exec(declaration)?.[1];
133
+ if (version === undefined) {
134
+ return { ok: false, error: { code: 'malformed-declaration', manifest, declaration } };
135
+ }
136
+ return { ok: true, value: { manifest, declaration, version } };
137
+ }
138
+
139
+ /** The version `bun --version` prints in the command's own environment, which is what a wrapper reads to route. */
140
+ export const probeBunVersion: BunProbe = async (bun, env, cwd) => {
141
+ try {
142
+ const { stdout } = await execFileAsync(bun, ['--version'], {
143
+ env,
144
+ cwd,
145
+ encoding: 'utf8',
146
+ timeout: VERSION_DEADLINE_MS,
147
+ killSignal: 'SIGKILL',
148
+ maxBuffer: 64 * 1024,
149
+ });
150
+ return { ok: true, value: stdout.trim() };
151
+ } catch (error) {
152
+ if (error instanceof Error && 'killed' in error && error.killed === true) {
153
+ return { ok: false, error: `\`bun --version\` gave no answer within ${VERSION_DEADLINE_MS} ms` };
154
+ }
155
+ const said =
156
+ error instanceof Error && 'stderr' in error && typeof error.stderr === 'string' ? error.stderr.trim() : '';
157
+ const reason = error instanceof Error ? error.message : String(error);
158
+ return { ok: false, error: `\`bun --version\` failed: ${reason}${said === '' ? '' : `: ${said}`}` };
159
+ }
160
+ };
161
+
162
+ /**
163
+ * The refusal that keeps a leg off a Bun its workspace does not declare, or `null` when the leg may run: it names no
164
+ * `bun`, the workspace declares none, PATH finds none (the shell will say so), or the one it finds is the declared
165
+ * version. Not checked on Windows, where the executor starts no lifecycle supervisor either.
166
+ */
167
+ export async function checkRuntimePin(
168
+ check: RuntimePinCheck,
169
+ probe: BunProbe = probeBunVersion,
170
+ ): Promise<RuntimePinRefusal | null> {
171
+ if (process.platform === 'win32' || !runsBun(check.command)) {
172
+ return null;
173
+ }
174
+ const declared = declaredBun(check.root);
175
+ if (!declared.ok) {
176
+ return declared.error;
177
+ }
178
+ if (declared.value === null) {
179
+ return null;
180
+ }
181
+ const bun = resolveOnPath('bun', check.env.PATH, check.cwd);
182
+ if (bun === null) {
183
+ return null;
184
+ }
185
+ const printed = await probe(bun, check.env, check.cwd);
186
+ if (!printed.ok) {
187
+ return {
188
+ code: 'unreadable-version',
189
+ declared: declared.value,
190
+ bun,
191
+ reason: printed.error,
192
+ pathSource: check.pathSource,
193
+ };
194
+ }
195
+ return printed.value === declared.value.version
196
+ ? null
197
+ : { code: 'mismatch', declared: declared.value, bun, version: printed.value, pathSource: check.pathSource };
198
+ }
199
+
200
+ /** What the symptom of running another Bun looks like, so a reader sees what the refusal replaces. */
201
+ const SYMPTOM =
202
+ 'A leg on another Bun can pass its startup and fail far from the cause: on Bun 1.4.2 `console.log` drops what a ' +
203
+ "full pipe refuses, so a child's JSON reaches its parent cut mid-string while the child exits 0.";
204
+
205
+ /** The refusal as the run's stderr says it, one line per fact, naming the task when the run has one. */
206
+ export function describeRuntimePinRefusal(refusal: RuntimePinRefusal, task?: string): string {
207
+ const refused = `${task ?? 'bounded-exec'}: refusing to run the command: `;
208
+ switch (refusal.code) {
209
+ case 'mismatch':
210
+ return `${[
211
+ `${refused}the workspace declares Bun ${refusal.declared.version}, and the \`bun\` it would run is Bun ${refusal.version}.`,
212
+ ` declared by: packageManager "${refusal.declared.declaration}" in ${refusal.declared.manifest}`,
213
+ ` resolved by: PATH from ${refusal.pathSource}; its first \`bun\` is ${refusal.bun}, which prints ${refusal.version}`,
214
+ SYMPTOM,
215
+ "Run the leg from the workspace's own shell, or put the declared Bun first on PATH.",
216
+ ].join('\n')}\n`;
217
+ case 'unreadable-version':
218
+ return `${[
219
+ `${refused}the workspace declares Bun ${refusal.declared.version}, and the \`bun\` it would run did not say which Bun it is.`,
220
+ ` declared by: packageManager "${refusal.declared.declaration}" in ${refusal.declared.manifest}`,
221
+ ` resolved by: PATH from ${refusal.pathSource}; its first \`bun\` is ${refusal.bun}: ${refusal.reason}`,
222
+ SYMPTOM,
223
+ ].join('\n')}\n`;
224
+ case 'malformed-declaration':
225
+ return `${[
226
+ `${refused}${refusal.manifest} declares packageManager "${refusal.declaration}", which names no Bun version to compare.`,
227
+ 'Declare an exact version, `bun@<major>.<minor>.<patch>`.',
228
+ ].join('\n')}\n`;
229
+ case 'unreadable-manifest':
230
+ return `${refused}cannot read the workspace's declaration in ${refusal.manifest}: ${refusal.reason}\n`;
231
+ }
232
+ }
@@ -32,7 +32,7 @@
32
32
  "idleTimeoutMs": {
33
33
  "type": "number",
34
34
  "minimum": 1,
35
- "description": "Kill the process tree when no test has finished for this many milliseconds: a nextest status line with its run counter, a bun result line or dot. Output that reports no finished test (a SLOW warning, a heartbeat) is not progress. A command that reports no tests makes progress only by exiting. Omit for no progress bound."
35
+ "description": "Kill the process tree when no test has finished for this many milliseconds: a runner's finished-test, file or package report, including Vitest reporter results, or a bun dot. Output that reports no finished test (a SLOW warning, a heartbeat) is not progress. A command that reports no tests makes progress only by exiting. Omit for no progress bound."
36
36
  },
37
37
  "killAfterMs": {
38
38
  "type": "number",
@@ -40,10 +40,19 @@
40
40
  "default": 10000,
41
41
  "description": "Most milliseconds a timed-out or CPU-grant-revoked command gets after graceful termination before its process group is force-killed. The grace ends early when the command exits; whatever it leaves in its process group is force-killed then."
42
42
  },
43
+ "fixtureCommand": {
44
+ "type": "string",
45
+ "description": "A compiler-fixture producer for command: a shell command run first, in the same cwd, environment and CPU grant, as a lifecycle build interval the progress bound does not run during. Its failure fails the run and command starts only after it exits 0. For warmth outside Nx outputs (a compiler plugin cache, a Cargo target directory): inside the consumer's task a cache hit restores the verdict and warms nothing, an execution warms first. Requires fixtureTimeoutMs."
46
+ },
47
+ "fixtureTimeoutMs": {
48
+ "type": "number",
49
+ "minimum": 1,
50
+ "description": "The fixture segment's own wall-clock ceiling in milliseconds: a build budget bounding only the fixture interval, never the command it prepares. Required with fixtureCommand."
51
+ },
43
52
  "parallelism": {
44
53
  "type": "integer",
45
54
  "minimum": 1,
46
- "description": "Requested threads or processes before inherited runner ceilings: positive NEXTEST_TEST_THREADS and CARGO_BUILD_JOBS cap their respective runners, and configured counts may only lower an inherited ceiling. Omit to let the command decide (nextest and cargo one per core, `bun test --parallel=N` N, anything else one). Runner concurrency is min(bounded request, granted tokens); the actual held grant reaches the command as BOUNDED_EXEC_CPU_TOKENS, with its sub-pool in BOUNDED_EXEC_CPU_POOL."
55
+ "description": "Requested threads or processes before inherited runner ceilings: positive NEXTEST_TEST_THREADS and CARGO_BUILD_JOBS cap their respective runners, and configured counts may only lower an inherited ceiling. Omit to let the command decide (nextest and cargo one per core, `bun test --parallel=N` N, anything else one). Runner concurrency is min(bounded request, tokens its parent CPU pool grants); the actual held grant reaches the command as BOUNDED_EXEC_CPU_TOKENS, with its sub-pool in BOUNDED_EXEC_CPU_POOL."
47
56
  },
48
57
  "forwardAllArgs": {
49
58
  "type": "boolean",
@@ -26,9 +26,27 @@ export interface BoundedExecCommand {
26
26
  */
27
27
  idleTimeoutMs?: number;
28
28
  killAfterMs?: number;
29
+
30
+ /**
31
+ * A compiler-fixture producer for `command`: a shell command run first, in the same cwd, environment and CPU
32
+ * grant, whose whole life is a lifecycle build interval — the progress bound does not run during it, as it does
33
+ * not run during a `cargo test` build. Its failure fails the run; `command` starts only after it exits 0.
34
+ *
35
+ * It exists for warmth that lives outside Nx outputs (a compiler plugin cache, a Cargo target directory). As a
36
+ * separate `cache: false` prerequisite that warmth was paid even when every consumer then hit the cache, since
37
+ * Nx reaches a cached consumer only after its uncached dependencies; as plain text at the head of `command`
38
+ * its cold minutes would spend the progress bound. Inside the consumer's own task the cache decides: a hit
39
+ * restores the verdict and warms nothing, an execution warms first.
40
+ */
41
+ fixtureCommand?: string;
42
+ /**
43
+ * The fixture segment's own wall-clock ceiling: a build budget, required with `fixtureCommand`. It bounds
44
+ * only the fixture interval, never the command it prepares.
45
+ */
46
+ fixtureTimeoutMs?: number;
29
47
  /**
30
48
  * The most threads or processes the command runs at once, which is how many CPU tokens it asks
31
- * its live parent pool or the cowshed host budget for. Absent, the runner in the command decides:
49
+ * its live parent pool for. Absent, the runner in the command decides:
32
50
  * nextest and cargo one per core, `bun test --parallel=N` N, anything else one. The actual grant
33
51
  * reaches the command as `BOUNDED_EXEC_CPU_TOKENS`, with its sub-pool in `BOUNDED_EXEC_CPU_POOL`.
34
52
  */
@@ -1,17 +1,23 @@
1
1
  import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
+ import type { CpuWaitRow } from './lease-wait.js';
4
+ import { describeHolders, type LockWait, type Opener } from './lock-wait.js';
3
5
 
4
6
  /**
5
7
  * Why one bounded run ended, recorded per Nx task so a caller can tell a load-sensitive bound
6
8
  * from a real failure without reading the run's output.
7
9
  *
10
+
8
11
  * - `bound`: the run hit a wall-clock bound and nothing else failed. Either the command
9
- * outlived `timeoutMs` (`total`), or every failing test in the runner's report failed on
12
+ * outlived `timeoutMs` (`total`), its fixture segment outlived `fixtureTimeoutMs`
13
+ * (`fixture`), or every failing test in the runner's report failed on
10
14
  * its runner's per-test timeout (`test`). A loaded host produces exactly these.
11
15
  * - `wedged`: `idleTimeoutMs` fired: no test finished for that long during a chargeable test interval. This proves
12
16
  * the suite's completion bound was exceeded, not that every process stopped: an expensive active fixture can
13
17
  * exceed it too. The verdict names tests reported running but never finished and tests the report says were
14
18
  * aborted; diagnostics distinguish a stalled wait from a progressing but oversized lifecycle.
19
+ * When the snapshot named a lock wait, `lockWaits` names the file the run holds on a numbered descriptor and the
20
+ * processes outside the run that also hold it open: open-handle evidence, not a kernel lock owner.
15
21
  * - `no-space`: the run failed and its output said a write found no space (ENOSPC). Whatever its tests then reported,
16
22
  * they failed on the disk, not on their own: the verdict names the line that said so and, when the task held one,
17
23
  * its RAM temp volume as it stood when that line arrived.
@@ -20,24 +26,38 @@ import { join } from 'node:path';
20
26
  */
21
27
  export type BoundedExecVerdict =
22
28
  | { readonly outcome: 'passed' }
23
- | { readonly outcome: 'bound'; readonly bound: 'total'; readonly limitMs: number; readonly elapsedMs: number }
29
+ | {
30
+ readonly outcome: 'bound';
31
+ readonly bound: 'total' | 'fixture';
32
+ readonly limitMs: number;
33
+ readonly elapsedMs: number;
34
+ }
24
35
  | { readonly outcome: 'bound'; readonly bound: 'test'; readonly tests: readonly string[] }
25
36
  | {
26
37
  readonly outcome: 'wedged';
27
38
  readonly idleMs: number;
28
39
  readonly elapsedMs: number;
29
40
  readonly tests: readonly string[];
41
+ /** Lock waits the snapshot named: holder evidence (open handles), not a kernel lock owner. */
42
+ readonly lockWaits: readonly LockWait[];
30
43
  }
31
44
  | ({ readonly outcome: 'no-space'; readonly exitCode: number; readonly tests: readonly string[] } & NoSpaceSighting)
32
45
  | { readonly outcome: 'failed'; readonly exitCode: number; readonly tests: readonly string[] };
33
46
 
34
- /** The task's RAM temp volume, read when a line saying ENOSPC arrived: the writer's own lease, and the space left. */
35
- export interface TempVolumeSpace {
36
- readonly lease: string;
37
- readonly mountpoint: string;
38
- readonly capacityBytes: number;
39
- readonly freeBytes: number;
40
- }
47
+ /**
48
+ * The task's RAM temp volume, read when a line saying ENOSPC arrived: the writer's own lease and the space left on the
49
+ * volume it was taken on (`measured`), or why there was none to measure: the lease was no longer on that volume
50
+ * (`lost`), or the volume could not be read (`unread`).
51
+ */
52
+ export type TempVolumeSpace =
53
+ | {
54
+ readonly kind: 'measured';
55
+ readonly lease: string;
56
+ readonly mountpoint: string;
57
+ readonly capacityBytes: number;
58
+ readonly freeBytes: number;
59
+ }
60
+ | { readonly kind: 'lost' | 'unread'; readonly lease: string; readonly mountpoint: string; readonly detail: string };
41
61
 
42
62
  /** The first output line that said a write found no space, and the task's RAM temp volume then; `null` without one. */
43
63
  export interface NoSpaceSighting {
@@ -51,17 +71,21 @@ export interface BoundedExecRecord {
51
71
  readonly hash: string | null;
52
72
  readonly verdict: BoundedExecVerdict;
53
73
  /**
54
- * The host CPU budget's grant the run started under: tokens granted of those asked for, and
55
- * how long it waited. Absent when it ran unbudgeted; written for the reader of a slow run,
56
- * never read back.
74
+ * The parent CPU pool's grant the run started under: tokens granted of those asked for, and
75
+ * how long it waited for the pool. Absent when it ran ungranted; written for the reader of a slow
76
+ * run, never read back.
57
77
  */
58
78
  readonly cpu?: {
59
79
  readonly tokens: number;
60
80
  readonly want: number;
61
81
  readonly waitedMs: number;
62
- /** Set when the tokens came from an ancestor's CPU pool, not the host budget; `waitedMs` is the wait for that pool. */
63
- readonly inherited?: true;
64
82
  };
83
+ /**
84
+ * The parent CPU pool's wait that expired and refused the run: its code, bound and elapsed time, the last heartbeat
85
+ * sequence it read, and the pool's socket and pid (specs/cowshed/05_gateway.md, "Deadlines"). Absent when no wait
86
+ * expired; written for the reader of a refused run, never read back.
87
+ */
88
+ readonly cpuWait?: CpuWaitRow;
65
89
  }
66
90
 
67
91
  /** The Nx task a run executes as. Nx gives an executor no task id, only its parts. */
@@ -154,6 +178,29 @@ export function junitFailures(xml: string): JunitFailures {
154
178
  return { timedOut, cancelled, failed };
155
179
  }
156
180
 
181
+ /** One test case of a JUnit report: nextest's binary id (its `classname`), the test's name and its seconds. */
182
+ export interface JunitCaseTime {
183
+ readonly binary: string;
184
+ readonly name: string;
185
+ readonly seconds: number;
186
+ }
187
+
188
+ /** Every test case of a JUnit document with the `time` it ran for; a case without one is not timed and not listed. */
189
+ export function junitCaseTimes(xml: string): JunitCaseTime[] {
190
+ const text = xml.replace(/<!\[CDATA\[[\s\S]*?\]\]>/g, '').replace(/<!--[\s\S]*?-->/g, '');
191
+ const cases: JunitCaseTime[] = [];
192
+ for (const [, attributes = ''] of text.matchAll(/<testcase\b((?:[^>"']|"[^"]*"|'[^']*')*?)\/?>/g)) {
193
+ const time = attribute(attributes, 'time');
194
+ const seconds = time === null ? Number.NaN : Number(time);
195
+ const name = attribute(attributes, 'name');
196
+ if (name === null || !Number.isFinite(seconds)) {
197
+ continue;
198
+ }
199
+ cases.push({ binary: attribute(attributes, 'classname') ?? '', name, seconds });
200
+ }
201
+ return cases;
202
+ }
203
+
157
204
  function attribute(attributes: string, name: string): string | null {
158
205
  const match = new RegExp(`(?:^|\\s)${name}\\s*=\\s*("([^"]*)"|'([^']*)')`).exec(attributes);
159
206
  if (match === null) {
@@ -184,7 +231,8 @@ function decodeEntities(value: string): string {
184
231
  }
185
232
 
186
233
  /**
187
- * The bound that ended a run. `total` is a wall-clock ceiling: it answers "is this run unbounded?". `idle` is the
234
+ * The bound that ended a run. `total` is a wall-clock ceiling: it answers "is this run unbounded?". `fixture` is
235
+ * that ceiling over the run's fixture segment alone: the command it prepares never started. `idle` is the
188
236
  * no-progress bound: it answers "is this run hung?", and carries the tests the runner reported still running.
189
237
  *
190
238
  * These are different questions and one number cannot answer both. A ceiling tight enough to catch a hang promptly
@@ -193,6 +241,7 @@ function decodeEntities(value: string): string {
193
241
  */
194
242
  export type ExpiredBound =
195
243
  | { readonly kind: 'total'; readonly limitMs: number }
244
+ | { readonly kind: 'fixture'; readonly limitMs: number }
196
245
  | { readonly kind: 'idle'; readonly limitMs: number; readonly tests: readonly string[] };
197
246
 
198
247
  /** How a run ended, as the executor saw it. */
@@ -204,6 +253,8 @@ export interface RunEnd {
204
253
  readonly report: JunitFailures | null;
205
254
  /** The first output line that said ENOSPC, or `null` when none did. */
206
255
  readonly noSpace: NoSpaceSighting | null;
256
+ /** The lock waits the expiry's snapshot named; empty when none, or when that capture did not complete. */
257
+ readonly lockWaits: readonly LockWait[];
207
258
  }
208
259
 
209
260
  /**
@@ -221,7 +272,7 @@ export function judgeRun(run: RunEnd): BoundedExecVerdict {
221
272
  }
222
273
  if (run.expiry?.kind === 'idle') {
223
274
  const tests = [...new Set([...run.expiry.tests, ...(run.report?.cancelled ?? [])])];
224
- return { outcome: 'wedged', idleMs: run.expiry.limitMs, elapsedMs: run.elapsedMs, tests };
275
+ return { outcome: 'wedged', idleMs: run.expiry.limitMs, elapsedMs: run.elapsedMs, tests, lockWaits: run.lockWaits };
225
276
  }
226
277
  if (run.report !== null && run.report.failed.length > 0) {
227
278
  return { outcome: 'failed', exitCode: run.exitCode, tests: run.report.failed };
@@ -229,8 +280,9 @@ export function judgeRun(run: RunEnd): BoundedExecVerdict {
229
280
  // The tests the runner aborted when the ceiling's SIGTERM reached it are the bound's casualties: they are in the
230
281
  // report as failures, but nothing about them failed. Aborted with no total bound to explain it, they are failures,
231
282
  // whatever else the run shows: a zero exit or a per-test timeout does not excuse a test someone else stopped.
232
- if (run.expiry?.kind === 'total') {
233
- return { outcome: 'bound', bound: 'total', limitMs: run.expiry.limitMs, elapsedMs: run.elapsedMs };
283
+
284
+ if (run.expiry?.kind === 'total' || run.expiry?.kind === 'fixture') {
285
+ return { outcome: 'bound', bound: run.expiry.kind, limitMs: run.expiry.limitMs, elapsedMs: run.elapsedMs };
234
286
  }
235
287
  if (run.report !== null && run.report.cancelled.length > 0) {
236
288
  return { outcome: 'failed', exitCode: run.exitCode, tests: run.report.cancelled };
@@ -305,7 +357,7 @@ export async function withJunitReport(command: string, directory: string): Promi
305
357
  return command.replace(NEXTEST_RUN, () => `nextest run --tool-config-file ${shellQuote(`smoo-report:${config}`)}`);
306
358
  }
307
359
 
308
- function shellQuote(value: string): string {
360
+ export function shellQuote(value: string): string {
309
361
  return `'${value.replaceAll("'", "'\\''")}'`;
310
362
  }
311
363
 
@@ -368,18 +420,30 @@ function parseVerdict(value: unknown): BoundedExecVerdict {
368
420
  case 'passed':
369
421
  return { outcome: 'passed' };
370
422
  case 'bound':
371
- if (value.bound === 'total' && typeof value.limitMs === 'number' && typeof value.elapsedMs === 'number') {
372
- return { outcome: 'bound', bound: 'total', limitMs: value.limitMs, elapsedMs: value.elapsedMs };
423
+ if (
424
+ (value.bound === 'total' || value.bound === 'fixture') &&
425
+ typeof value.limitMs === 'number' &&
426
+ typeof value.elapsedMs === 'number'
427
+ ) {
428
+ return { outcome: 'bound', bound: value.bound, limitMs: value.limitMs, elapsedMs: value.elapsedMs };
373
429
  }
374
430
  if (value.bound === 'test' && isStrings(value.tests)) {
375
431
  return { outcome: 'bound', bound: 'test', tests: value.tests };
376
432
  }
377
433
  break;
378
- case 'wedged':
379
- if (typeof value.idleMs === 'number' && typeof value.elapsedMs === 'number' && isStrings(value.tests)) {
380
- return { outcome: 'wedged', idleMs: value.idleMs, elapsedMs: value.elapsedMs, tests: value.tests };
434
+ case 'wedged': {
435
+ // A record written before lock waits were named carries none.
436
+ const lockWaits = value.lockWaits === undefined ? [] : parseLockWaits(value.lockWaits);
437
+ if (
438
+ typeof value.idleMs === 'number' &&
439
+ typeof value.elapsedMs === 'number' &&
440
+ isStrings(value.tests) &&
441
+ lockWaits !== null
442
+ ) {
443
+ return { outcome: 'wedged', idleMs: value.idleMs, elapsedMs: value.elapsedMs, tests: value.tests, lockWaits };
381
444
  }
382
445
  break;
446
+ }
383
447
  case 'no-space': {
384
448
  const volume = parseTempVolumeSpace(value.volume);
385
449
  if (typeof value.exitCode === 'number' && isStrings(value.tests) && typeof value.line === 'string' && volume) {
@@ -403,20 +467,54 @@ function parseVerdict(value: unknown): BoundedExecVerdict {
403
467
  throw new Error(`not a bounded-exec verdict: ${JSON.stringify(value)}`);
404
468
  }
405
469
 
470
+ /** A process id as the census writes it: a positive safe integer. */
471
+ function isPid(value: unknown): value is number {
472
+ return typeof value === 'number' && Number.isSafeInteger(value) && value > 0;
473
+ }
474
+
475
+ function isPids(value: unknown): value is number[] {
476
+ return Array.isArray(value) && value.every(isPid);
477
+ }
478
+
479
+ /** Lock waits as recorded, or `null` when any part of them is malformed. */
480
+ function parseLockWaits(value: unknown): LockWait[] | null {
481
+ if (!Array.isArray(value)) return null;
482
+ const waits: LockWait[] = [];
483
+ for (const wait of value) {
484
+ if (!isObject(wait) || typeof wait.path !== 'string' || !isPids(wait.waiters) || !Array.isArray(wait.holders)) {
485
+ return null;
486
+ }
487
+ const holders: Opener[] = [];
488
+ for (const holder of wait.holders) {
489
+ if (!isObject(holder) || !isPid(holder.pid) || typeof holder.command !== 'string') return null;
490
+ holders.push({ pid: holder.pid, command: holder.command });
491
+ }
492
+ waits.push({ path: wait.path, waiters: wait.waiters, holders });
493
+ }
494
+ return waits;
495
+ }
496
+
406
497
  /** A recorded volume, wrapped so a well-formed `null` (no RAM volume) differs from a malformed one (`undefined`). */
407
498
  function parseTempVolumeSpace(value: unknown): { value: TempVolumeSpace | null } | undefined {
408
499
  if (value === null) {
409
500
  return { value: null };
410
501
  }
502
+ if (!isObject(value) || typeof value.lease !== 'string' || typeof value.mountpoint !== 'string') {
503
+ return undefined;
504
+ }
505
+ const { lease, mountpoint } = value;
506
+ // A record written before the kinds were named measured whatever filesystem held the mountpoint then.
411
507
  if (
412
- isObject(value) &&
413
- typeof value.lease === 'string' &&
414
- typeof value.mountpoint === 'string' &&
508
+ (value.kind === 'measured' || value.kind === undefined) &&
415
509
  typeof value.capacityBytes === 'number' &&
416
510
  typeof value.freeBytes === 'number'
417
511
  ) {
418
- const { lease, mountpoint, capacityBytes, freeBytes } = value;
419
- return { value: { lease, mountpoint, capacityBytes, freeBytes } };
512
+ return {
513
+ value: { kind: 'measured', lease, mountpoint, capacityBytes: value.capacityBytes, freeBytes: value.freeBytes },
514
+ };
515
+ }
516
+ if ((value.kind === 'lost' || value.kind === 'unread') && typeof value.detail === 'string') {
517
+ return { value: { kind: value.kind, lease, mountpoint, detail: value.detail } };
420
518
  }
421
519
  return undefined;
422
520
  }
@@ -475,15 +573,19 @@ export function describeVerdict(verdict: BoundedExecVerdict): string {
475
573
  case 'passed':
476
574
  return 'passed';
477
575
  case 'bound':
478
- return verdict.bound === 'total'
479
- ? `outlived its ${verdict.limitMs}ms bound (${verdict.elapsedMs}ms)`
480
- : `per-test timeout only: ${verdict.tests.join(', ')}`;
576
+ return verdict.bound === 'test'
577
+ ? `per-test timeout only: ${verdict.tests.join(', ')}`
578
+ : verdict.bound === 'fixture'
579
+ ? `its fixture outlived its ${verdict.limitMs}ms bound (${verdict.elapsedMs}ms)`
580
+ : `outlived its ${verdict.limitMs}ms bound (${verdict.elapsedMs}ms)`;
481
581
  case 'wedged':
482
582
  return `wedged: no test finished for ${verdict.idleMs}ms after ${verdict.elapsedMs}ms; ${
483
583
  verdict.tests.length > 0
484
584
  ? `still running: ${verdict.tests.join(', ')}`
485
585
  : 'the runner named no test still running'
486
- }`;
586
+ }${verdict.lockWaits
587
+ .map((wait) => `; waiting on a lock: ${wait.path} held open by ${describeHolders(wait.holders)}`)
588
+ .join('')}`;
487
589
  case 'no-space':
488
590
  return `${describeNoSpace(verdict)}${verdict.tests.length > 0 ? `; the tests that then failed: ${verdict.tests.join(', ')}` : ''}`;
489
591
  case 'failed':
@@ -504,6 +606,14 @@ export function describeNoSpace(sighting: NoSpaceSighting): string {
504
606
  if (volume === null) {
505
607
  return `${said}; it held no RAM temp volume, so the full disk is the one that line's writer wrote to`;
506
608
  }
507
- const mib = (bytes: number) => (bytes / (1024 * 1024)).toFixed(1);
508
- return `${said}; its TMPDIR ${volume.lease} is on the RAM temp volume ${volume.mountpoint}, which had ${mib(volume.freeBytes)} MiB free of ${mib(volume.capacityBytes)} MiB when that line arrived`;
609
+ switch (volume.kind) {
610
+ case 'measured': {
611
+ const mib = (bytes: number) => (bytes / (1024 * 1024)).toFixed(1);
612
+ return `${said}; its TMPDIR ${volume.lease} is on the RAM temp volume ${volume.mountpoint}, which had ${mib(volume.freeBytes)} MiB free of ${mib(volume.capacityBytes)} MiB when that line arrived`;
613
+ }
614
+ case 'lost':
615
+ return `${said}; its TMPDIR ${volume.lease} was no longer on the RAM temp volume at ${volume.mountpoint} when that line arrived, so no free space of that volume was read: ${volume.detail}`;
616
+ case 'unread':
617
+ return `${said}; its TMPDIR ${volume.lease} is on the RAM temp volume ${volume.mountpoint}, whose space could not be read when that line arrived: ${volume.detail}`;
618
+ }
509
619
  }