@smoothbricks/nx-plugin 0.5.6 → 0.6.0

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 (440) hide show
  1. package/README.md +1095 -360
  2. package/dist/.build-inputs.json +138 -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 +13 -5
  48. package/dist/ensure-built-receipt.d.ts.map +1 -1
  49. package/dist/ensure-built-receipt.js +126 -47
  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/all-verdicts/executor.d.ts +35 -0
  59. package/dist/executors/all-verdicts/executor.d.ts.map +1 -0
  60. package/dist/executors/all-verdicts/executor.js +133 -0
  61. package/dist/executors/all-verdicts/schema.d.ts +10 -0
  62. package/dist/executors/all-verdicts/schema.d.ts.map +1 -0
  63. package/dist/executors/all-verdicts/schema.js +2 -0
  64. package/dist/executors/bounded-exec/bounds.d.ts +56 -0
  65. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -0
  66. package/dist/executors/bounded-exec/bounds.js +43 -0
  67. package/dist/executors/bounded-exec/cpu-pool.d.ts +33 -36
  68. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
  69. package/dist/executors/bounded-exec/cpu-pool.js +54 -119
  70. package/dist/executors/bounded-exec/executor.d.ts +19 -12
  71. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  72. package/dist/executors/bounded-exec/executor.js +371 -239
  73. package/dist/executors/bounded-exec/gateway-lease.d.ts +22 -19
  74. package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
  75. package/dist/executors/bounded-exec/gateway-lease.js +81 -28
  76. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
  77. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
  78. package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
  79. package/dist/executors/bounded-exec/lease-wait.d.ts +43 -0
  80. package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
  81. package/dist/executors/bounded-exec/lease-wait.js +68 -0
  82. package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
  83. package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
  84. package/dist/executors/bounded-exec/lock-wait.js +108 -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 +4 -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 +20 -30
  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 +40 -11
  119. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  120. package/dist/executors/bounded-exec/verdict.js +88 -19
  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/executor.d.ts +3 -1
  135. package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
  136. package/dist/executors/typescript-emit/executor.js +164 -33
  137. package/dist/forbidden-spelling-policy.d.ts +56 -0
  138. package/dist/forbidden-spelling-policy.d.ts.map +1 -0
  139. package/dist/forbidden-spelling-policy.js +176 -0
  140. package/dist/generators/create-package/generator.d.ts.map +1 -1
  141. package/dist/generators/create-package/generator.js +3 -4
  142. package/dist/graph-input-contract.d.ts +14 -0
  143. package/dist/graph-input-contract.d.ts.map +1 -1
  144. package/dist/graph-input-contract.js +67 -2
  145. package/dist/index.d.ts +23 -6
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/index.js +676 -215
  148. package/dist/managed-assets.d.ts +2 -0
  149. package/dist/managed-assets.d.ts.map +1 -1
  150. package/dist/managed-files/files.d.ts +3 -3
  151. package/dist/managed-files/files.d.ts.map +1 -1
  152. package/dist/managed-files/files.js +28 -3
  153. package/dist/managed-files/managed-format.d.ts.map +1 -1
  154. package/dist/managed-files/managed-format.js +1 -0
  155. package/dist/nextest-code-bound.js +1 -0
  156. package/dist/nextest-timings.d.ts +35 -0
  157. package/dist/nextest-timings.d.ts.map +1 -0
  158. package/dist/nextest-timings.js +168 -0
  159. package/dist/owned-installation.d.ts +6 -5
  160. package/dist/owned-installation.d.ts.map +1 -1
  161. package/dist/owned-installation.js +150 -26
  162. package/dist/package-target-policy.d.ts.map +1 -1
  163. package/dist/package-target-policy.js +2 -3
  164. package/dist/process-children.d.ts +7 -0
  165. package/dist/process-children.d.ts.map +1 -0
  166. package/dist/process-children.darwin.d.ts +7 -0
  167. package/dist/process-children.darwin.d.ts.map +1 -0
  168. package/dist/process-children.darwin.js +13 -0
  169. package/dist/process-children.js +14 -0
  170. package/dist/process-children.linux.d.ts +8 -0
  171. package/dist/process-children.linux.d.ts.map +1 -0
  172. package/dist/process-children.linux.js +25 -0
  173. package/dist/process-group.d.ts +108 -0
  174. package/dist/process-group.d.ts.map +1 -0
  175. package/dist/process-group.js +171 -0
  176. package/dist/process-listing.d.ts +7 -0
  177. package/dist/process-listing.d.ts.map +1 -0
  178. package/dist/process-listing.js +51 -0
  179. package/dist/producer-receipts.d.ts +8 -2
  180. package/dist/producer-receipts.d.ts.map +1 -1
  181. package/dist/producer-receipts.js +75 -48
  182. package/dist/task-graph-policy.d.ts +21 -0
  183. package/dist/task-graph-policy.d.ts.map +1 -0
  184. package/dist/task-graph-policy.js +91 -0
  185. package/dist/test-timings.js +4 -4
  186. package/dist/test-walk-policy.d.ts +14 -5
  187. package/dist/test-walk-policy.d.ts.map +1 -1
  188. package/dist/test-walk-policy.js +8 -2
  189. package/dist/testing.d.ts +73 -28
  190. package/dist/testing.d.ts.map +1 -1
  191. package/dist/testing.js +217 -223
  192. package/dist/tool-bins.d.ts +33 -0
  193. package/dist/tool-bins.d.ts.map +1 -0
  194. package/dist/tool-bins.js +72 -0
  195. package/dist/typecheck-test-policy.d.ts.map +1 -1
  196. package/dist/typecheck-test-policy.js +3 -4
  197. package/dist/wait-why-policy.d.ts +28 -0
  198. package/dist/wait-why-policy.d.ts.map +1 -0
  199. package/dist/wait-why-policy.js +223 -0
  200. package/dist/workspace-config-policy.d.ts +14 -8
  201. package/dist/workspace-config-policy.d.ts.map +1 -1
  202. package/dist/workspace-config-policy.js +60 -16
  203. package/dist/workspace-manifest.d.ts +41 -6
  204. package/dist/workspace-manifest.d.ts.map +1 -1
  205. package/dist/workspace-manifest.js +57 -0
  206. package/executors.json +21 -1
  207. package/loader.js +2 -0
  208. package/managed/raw/envrc +11 -0
  209. package/managed/raw/patches/nx@23.2.1.patch +2840 -199
  210. package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
  211. package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
  212. package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
  213. package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
  214. package/managed/raw/tooling/direnv/developer-links.ts +464 -25
  215. package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
  216. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
  217. package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
  218. package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
  219. package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
  220. package/managed/raw/tooling/direnv/repo-path +68 -6
  221. package/managed/raw/tooling/direnv/secret-references.ts +13 -4
  222. package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
  223. package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
  224. package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
  225. package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
  226. package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
  227. package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
  228. package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
  229. package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
  230. package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
  231. package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
  232. package/package.json +77 -13
  233. package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
  234. package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
  235. package/src/bin/smoo-nx-nextest-timings.ts +31 -0
  236. package/src/bounded-test-policy.ts +12 -14
  237. package/src/build-state-output-policy.ts +458 -34
  238. package/src/bun-lock-scope.ts +108 -0
  239. package/src/cargo-build-script-env.ts +265 -0
  240. package/src/cargo-closure-input.ts +74 -7
  241. package/src/cargo-retention-hook.ts +94 -0
  242. package/src/cargo-source-hash.ts +138 -41
  243. package/src/cargo-toolchain-paths.ts +95 -0
  244. package/src/cargo-toolchain-policy.ts +49 -5
  245. package/src/cargo-workspace.ts +72 -123
  246. package/src/cross-check-policy.ts +12 -10
  247. package/src/disk-command-policy.ts +1 -0
  248. package/src/ensure-built-receipt.ts +132 -39
  249. package/src/ensure-built-witness.ts +62 -10
  250. package/src/ensure-built.ts +11 -1
  251. package/src/eslint-config-closure.ts +357 -0
  252. package/src/executors/all-verdicts/executor.ts +164 -0
  253. package/src/executors/all-verdicts/schema.json +22 -0
  254. package/src/executors/all-verdicts/schema.ts +10 -0
  255. package/src/executors/bounded-exec/bounds.ts +76 -0
  256. package/src/executors/bounded-exec/cpu-pool.ts +51 -117
  257. package/src/executors/bounded-exec/executor.ts +423 -259
  258. package/src/executors/bounded-exec/gateway-lease.ts +82 -33
  259. package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
  260. package/src/executors/bounded-exec/lease-wait.ts +89 -0
  261. package/src/executors/bounded-exec/lock-wait.ts +141 -0
  262. package/src/executors/bounded-exec/owned-subtree.ts +235 -0
  263. package/src/executors/bounded-exec/progress.ts +9 -3
  264. package/src/executors/bounded-exec/ram-attach.ts +238 -0
  265. package/src/executors/bounded-exec/ram-detach.ts +226 -0
  266. package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
  267. package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
  268. package/src/executors/bounded-exec/ram-temp.ts +1497 -460
  269. package/src/executors/bounded-exec/run-cpu-pool.ts +22 -30
  270. package/src/executors/bounded-exec/runner-hook.ts +14 -6
  271. package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
  272. package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
  273. package/src/executors/bounded-exec/runtime-pin.ts +232 -0
  274. package/src/executors/bounded-exec/schema.json +11 -2
  275. package/src/executors/bounded-exec/schema.ts +19 -1
  276. package/src/executors/bounded-exec/verdict.ts +137 -34
  277. package/src/executors/cargo-zigbuild/executor.ts +82 -8
  278. package/src/executors/clean-outputs/executor.ts +1 -0
  279. package/src/executors/scriptc-native/executor.ts +394 -0
  280. package/src/executors/scriptc-native/ffi-paths.ts +29 -0
  281. package/src/executors/scriptc-native/schema.json +60 -0
  282. package/src/executors/scriptc-native/schema.ts +34 -0
  283. package/src/executors/typescript-emit/executor.ts +205 -38
  284. package/src/forbidden-spelling-policy.ts +226 -0
  285. package/src/generators/create-package/generator.ts +7 -7
  286. package/src/graph-input-contract.ts +61 -2
  287. package/src/index.ts +792 -225
  288. package/src/managed-assets.ts +3 -0
  289. package/src/managed-files/files.ts +28 -3
  290. package/src/managed-files/managed-format.ts +1 -0
  291. package/src/nextest-code-bound.ts +1 -0
  292. package/src/nextest-timings.ts +106 -0
  293. package/src/owned-installation.ts +150 -23
  294. package/src/package-target-policy.ts +2 -3
  295. package/src/process-children.darwin.ts +14 -0
  296. package/src/process-children.linux.ts +33 -0
  297. package/src/process-children.ts +22 -0
  298. package/src/process-group.ts +209 -0
  299. package/src/process-listing.ts +54 -0
  300. package/src/producer-receipts.ts +68 -45
  301. package/src/task-graph-policy.ts +98 -0
  302. package/src/test-walk-policy.ts +23 -8
  303. package/src/testing.ts +240 -232
  304. package/src/tool-bins.ts +108 -0
  305. package/src/typecheck-test-policy.ts +2 -3
  306. package/src/wait-why-policy.ts +226 -0
  307. package/src/workspace-config-policy.ts +63 -15
  308. package/src/workspace-manifest.ts +89 -6
  309. package/test-timings.json +123 -98
  310. package/dist/bin/smoo-nx-failures.d.ts +0 -3
  311. package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
  312. package/dist/bin/smoo-nx-failures.js +0 -3
  313. package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
  314. package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
  315. package/dist/bin/smoo-nx-nextest-extract.js +0 -42
  316. package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
  317. package/dist/failure-summary.d.ts +0 -5
  318. package/dist/failure-summary.d.ts.map +0 -1
  319. package/dist/failure-summary.js +0 -118
  320. package/dist/nextest-extraction.d.ts +0 -117
  321. package/dist/nextest-extraction.d.ts.map +0 -1
  322. package/dist/nextest-extraction.js +0 -303
  323. package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
  324. package/src/__tests__/cargo-closure-filesets.ts +0 -94
  325. package/src/__tests__/cargo-closure-fixture.ts +0 -113
  326. package/src/__tests__/counted-cargo-process.ts +0 -286
  327. package/src/__tests__/counted-cargo.ts +0 -713
  328. package/src/__tests__/directory-change.ts +0 -27
  329. package/src/__tests__/fixture-cargo-home.ts +0 -36
  330. package/src/__tests__/fixture-nx-env.ts +0 -193
  331. package/src/__tests__/owned-installation.ts +0 -13
  332. package/src/__tests__/past-tick.ts +0 -12
  333. package/src/__tests__/progress-clock.ts +0 -43
  334. package/src/__tests__/runtime-input.ts +0 -23
  335. package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
  336. package/src/bin/smoo-nx-failures.ts +0 -4
  337. package/src/bin/smoo-nx-nextest-extract.ts +0 -44
  338. package/src/bounded-test-policy.test.ts +0 -1029
  339. package/src/build-state-output-policy.test.ts +0 -115
  340. package/src/bun-bootstrap.test.ts +0 -102
  341. package/src/bun-file-packages.test.ts +0 -47
  342. package/src/cargo-closure-filesets.test.ts +0 -63
  343. package/src/cargo-closure-input.property.test.ts +0 -50
  344. package/src/cargo-closure-input.test.ts +0 -506
  345. package/src/cargo-closure-key.test.ts +0 -240
  346. package/src/cargo-resolve-cache.test.ts +0 -1181
  347. package/src/cargo-source-hash.test.ts +0 -707
  348. package/src/cargo-workspace.test.ts +0 -615
  349. package/src/cross-check-policy.test.ts +0 -316
  350. package/src/disk-command-policy.test.ts +0 -61
  351. package/src/ensure-built-receipt.test.ts +0 -279
  352. package/src/ensure-built-witness.test.ts +0 -688
  353. package/src/ensure-built.test.ts +0 -1462
  354. package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
  355. package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
  356. package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
  357. package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
  358. package/src/executors/bounded-exec/executor-host.test.ts +0 -800
  359. package/src/executors/bounded-exec/executor.test.ts +0 -1819
  360. package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
  361. package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
  362. package/src/executors/bounded-exec/progress.test.ts +0 -139
  363. package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
  364. package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
  365. package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
  366. package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
  367. package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
  368. package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
  369. package/src/executors/bounded-exec/verdict.test.ts +0 -545
  370. package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
  371. package/src/executors/clean-outputs/executor.test.ts +0 -20
  372. package/src/executors/typescript-emit/executor.test.ts +0 -83
  373. package/src/failure-summary.ts +0 -119
  374. package/src/generators/bounded-test-targets/generator.test.ts +0 -138
  375. package/src/generators/bun-test-tracing/generator.test.ts +0 -250
  376. package/src/generators/create-package/generator.test.ts +0 -190
  377. package/src/generators/make-public/generator.test.ts +0 -137
  378. package/src/graph-input-contract.test.ts +0 -379
  379. package/src/host-controller-wiring.test.ts +0 -31
  380. package/src/index.test.ts +0 -3319
  381. package/src/linked-snapshots.nx.test.ts +0 -254
  382. package/src/managed-files/forgejo-artifact.test.ts +0 -395
  383. package/src/managed-files/generator.test.ts +0 -243
  384. package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
  385. package/src/managed-files/json-edit.test.ts +0 -216
  386. package/src/managed-files/managed-content.test.ts +0 -166
  387. package/src/managed-files/managed-format-json.test.ts +0 -308
  388. package/src/managed-files/repo-path.test.ts +0 -172
  389. package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
  390. package/src/managed-files/trace-db-artifact.test.ts +0 -7
  391. package/src/managed-files/tree-permissions.test.ts +0 -109
  392. package/src/managed-files/tree.test.ts +0 -123
  393. package/src/manifest-hash.test.ts +0 -219
  394. package/src/nextest-code-bound.test.ts +0 -161
  395. package/src/nextest-extraction.test.ts +0 -216
  396. package/src/nextest-extraction.ts +0 -371
  397. package/src/nextest-partitions.test.ts +0 -501
  398. package/src/nx-cache-bound.test.ts +0 -109
  399. package/src/nx-cache-restore-mtime.test.ts +0 -170
  400. package/src/nx-daemon-claim.test.ts +0 -279
  401. package/src/nx-daemon-idle-cpu.test.ts +0 -80
  402. package/src/nx-daemon-idle-policy.test.ts +0 -111
  403. package/src/nx-daemon-ignore-files.test.ts +0 -210
  404. package/src/nx-daemon-root-normalization.test.ts +0 -105
  405. package/src/nx-daemon-start-never.test.ts +0 -292
  406. package/src/nx-daemon-validity.test.ts +0 -1055
  407. package/src/nx-dot-input-policy.test.ts +0 -353
  408. package/src/nx-failure-life-cycles.test.ts +0 -207
  409. package/src/nx-files-archive-racy.test.ts +0 -97
  410. package/src/nx-foreign-workspace-env.test.ts +0 -329
  411. package/src/nx-incomplete-run-summary.test.ts +0 -70
  412. package/src/nx-plugin-load-errors.test.ts +0 -120
  413. package/src/nx-project-graph-errors.test.ts +0 -70
  414. package/src/nx-project-resolution-cache.test.ts +0 -176
  415. package/src/nx-raw-inputs.test.ts +0 -166
  416. package/src/nx-resident-graph-workers.test.ts +0 -112
  417. package/src/nx-run-information.test.ts +0 -118
  418. package/src/nx-skipped-task-exit.test.ts +0 -180
  419. package/src/nx-state-location.test.ts +0 -63
  420. package/src/nx-store-resolution.test.ts +0 -81
  421. package/src/nx-task-graph-cycles.test.ts +0 -148
  422. package/src/nx-task-output-lease.test.ts +0 -550
  423. package/src/nx-use-local.test.ts +0 -105
  424. package/src/owned-installation.test.ts +0 -105
  425. package/src/package-target-policy.test.ts +0 -1014
  426. package/src/producer-receipts.test.ts +0 -285
  427. package/src/release-config-policy.test.ts +0 -311
  428. package/src/runtime-input.test.ts +0 -393
  429. package/src/serial-group-wiring.test.ts +0 -326
  430. package/src/task-history-namespace.test.ts +0 -181
  431. package/src/task-results.test.ts +0 -228
  432. package/src/test-clock-policy.test.ts +0 -338
  433. package/src/test-program.test.ts +0 -303
  434. package/src/test-timings.test.ts +0 -240
  435. package/src/test-walk-policy.test.ts +0 -620
  436. package/src/testing.test.ts +0 -509
  437. package/src/typecheck-test-policy.test.ts +0 -1468
  438. package/src/typescript-resolution.test.ts +0 -76
  439. package/src/version-actions.test.ts +0 -80
  440. package/src/workspace-config-policy.test.ts +0 -737
@@ -1,545 +0,0 @@
1
- import { afterEach, describe, expect, it } from 'bun:test';
2
- import { spawnSync } from 'node:child_process';
3
- import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from 'node:fs/promises';
4
- import { tmpdir } from 'node:os';
5
- import { dirname, join } from 'node:path';
6
- import fc from 'fast-check';
7
-
8
- import { onProgressClock } from '../../__tests__/progress-clock.js';
9
- import { BOUNDED_TEST_IDLE_TIMEOUT_MS } from '../../bounded-test-policy.js';
10
- import {
11
- type BoundedExecContext,
12
- createProcessTreeKiller,
13
- type ProcessTreeKiller,
14
- runBoundedExec,
15
- } from './executor.js';
16
- import type { BoundedExecBounds } from './schema.js';
17
- import {
18
- type BoundedExecVerdict,
19
- describeVerdict,
20
- failedTasksOfRun,
21
- JUNIT_FILE,
22
- judgeOperationalFailure,
23
- judgeRun,
24
- junitFailures,
25
- readRecord,
26
- taskDirectory,
27
- withJunitReport,
28
- writeRecord,
29
- } from './verdict.js';
30
-
31
- const roots: string[] = [];
32
- const ownedProcessGroups = new Set<number>();
33
- const originalStdoutWrite = process.stdout.write;
34
- const originalStderrWrite = process.stderr.write;
35
-
36
- afterEach(async () => {
37
- process.stdout.write = originalStdoutWrite;
38
- process.stderr.write = originalStderrWrite;
39
- for (const pid of ownedProcessGroups) {
40
- try {
41
- process.kill(-pid, 'SIGKILL');
42
- } catch (cause) {
43
- if (!(cause instanceof Error && 'code' in cause && cause.code === 'ESRCH')) {
44
- throw new Error(`cleanup owned abort-report process group pgid=${pid} failed`, { cause });
45
- }
46
- } finally {
47
- ownedProcessGroups.delete(pid);
48
- }
49
- }
50
- await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true })));
51
- });
52
-
53
- async function workspace(): Promise<{ root: string; data: string; context: BoundedExecContext }> {
54
- const root = await mkdtemp(join(tmpdir(), 'smoothbricks-bounded-verdict-'));
55
- roots.push(root);
56
- const data = join(root, '.nx', 'workspace-data');
57
- return {
58
- root,
59
- data,
60
- context: { root, record: { task: { id: 'app:test', hash: '42' }, directory: taskDirectory(data, 'app:test') } },
61
- };
62
- }
63
-
64
- /**
65
- * Run `command` as task app:test and answer the verdict bounded-exec recorded for it. `links` name
66
- * files of the workspace that link to the given targets.
67
- */
68
- async function verdictOf(
69
- command: string,
70
- bounds: BoundedExecBounds & { killAfterMs?: number },
71
- files: Record<string, string> = {},
72
- links: Record<string, string> = {},
73
- prepareKiller?: (root: string) => Promise<ProcessTreeKiller>,
74
- ): Promise<BoundedExecVerdict | undefined> {
75
- const { root, context } = await workspace();
76
- for (const [name, contents] of Object.entries(files)) {
77
- await writeFile(join(root, name), contents);
78
- }
79
- for (const [name, target] of Object.entries(links)) {
80
- await mkdir(dirname(join(root, name)), { recursive: true });
81
- await symlink(target, join(root, name));
82
- }
83
- process.stdout.write = () => true;
84
- process.stderr.write = () => true;
85
- const killer = (await prepareKiller?.(root)) ?? createProcessTreeKiller();
86
- await runBoundedExec({ command, killAfterMs: 0, ...bounds }, context, killer, null, null);
87
- const record = await readRecord(context.record?.directory ?? '');
88
- expect(record?.task).toBe('app:test');
89
- expect(record?.hash).toBe('42');
90
- return record?.verdict;
91
- }
92
-
93
- // The fixtures run in child processes and must really meet their runner's per-test bound: the verdict is about which
94
- // real bound fired. The slow test never finishes, so nothing can beat that bound; the parent's own required ceiling is
95
- // the leg's backstop, so it cannot end the run first however long `bun test` takes to start on a loaded host.
96
- const SLOW_TEST = `import { test } from 'bun:test';\ntest('slow', () => new Promise(() => {}));\n`;
97
- const FAILING_TEST = `import { expect, test } from 'bun:test';\ntest('wrong', () => { expect(1).toBe(2); });\n`;
98
-
99
- describe('bounded-exec verdicts', () => {
100
- it('records a bun run whose only failure is a per-test timeout as a bound', async () => {
101
- expect(
102
- await verdictOf(
103
- 'bun test --timeout=100 ./slow.test.ts',
104
- { timeoutMs: BOUNDED_TEST_IDLE_TIMEOUT_MS },
105
- { 'slow.test.ts': SLOW_TEST },
106
- ),
107
- ).toEqual({
108
- outcome: 'bound',
109
- bound: 'test',
110
- tests: ['slow'],
111
- });
112
- });
113
-
114
- it('records a path-pinned bun run whose only failure is a per-test timeout as a bound', async () => {
115
- expect(
116
- await verdictOf(
117
- '.runtime/bun test --timeout=100 ./slow.test.ts',
118
- { timeoutMs: BOUNDED_TEST_IDLE_TIMEOUT_MS },
119
- { 'slow.test.ts': SLOW_TEST },
120
- { '.runtime/bun': process.execPath },
121
- ),
122
- ).toEqual({ outcome: 'bound', bound: 'test', tests: ['slow'] });
123
- });
124
-
125
- it('records an assertion as a failure even beside a timeout', async () => {
126
- expect(
127
- await verdictOf(
128
- 'bun test --timeout=100 ./slow.test.ts ./failing.test.ts',
129
- { timeoutMs: BOUNDED_TEST_IDLE_TIMEOUT_MS },
130
- { 'slow.test.ts': SLOW_TEST, 'failing.test.ts': FAILING_TEST },
131
- ),
132
- ).toEqual({ outcome: 'failed', exitCode: 1, tests: ['wrong'] });
133
- });
134
-
135
- it('records the total bound as a bound and the progress bound as a wedge', async () => {
136
- // Each command holds on its stdin, which bounded-exec keeps open and never writes: it never exits, so only the
137
- // bound under test can end it.
138
- expect(await verdictOf('node -e "process.stdin.resume()"', { timeoutMs: 200 })).toMatchObject({
139
- outcome: 'bound',
140
- bound: 'total',
141
- limitMs: 200,
142
- });
143
- expect(await verdictOf('node -e "process.stdin.resume()"', { idleTimeoutMs: 100 })).toMatchObject({
144
- outcome: 'wedged',
145
- idleMs: 100,
146
- tests: [],
147
- });
148
- });
149
-
150
- it('records a runner that warns of a slow test but finishes none as a wedge naming that test', async () => {
151
- // nextest's own lines: one test passes, the other only ever says SLOW. A bound on silence would never fire.
152
- const runner = [
153
- "console.error(' PASS [ 0.010s] (1/2) fake tests::quick');",
154
- "setInterval(() => console.error(' SLOW [> 0.050s] (───) fake tests::hangs'), 50);",
155
- '',
156
- ].join('\n');
157
- const { root, context } = await workspace();
158
- await writeFile(join(root, 'runner.js'), runner);
159
- // The window ends only once the runner has said SLOW, however long node takes to start.
160
- await onProgressClock(
161
- (chunk) => chunk.includes('SLOW [>'),
162
- 400,
163
- () =>
164
- runBoundedExec(
165
- { command: 'node runner.js', idleTimeoutMs: 400, killAfterMs: 0 },
166
- context,
167
- createProcessTreeKiller(),
168
- null,
169
- null,
170
- ),
171
- );
172
- expect((await readRecord(context.record?.directory ?? ''))?.verdict).toMatchObject({
173
- outcome: 'wedged',
174
- idleMs: 400,
175
- tests: ['fake tests::hangs'],
176
- });
177
- });
178
-
179
- it('names the tests nextest aborted at the progress bound beside those it said were running, once each', () => {
180
- const report = { timedOut: [], cancelled: ['nt tests::hangs', 'nt tests::young'], failed: [] };
181
- expect(
182
- judgeRun({
183
- exitCode: 100,
184
- elapsedMs: 900,
185
- expiry: { kind: 'idle', limitMs: 400, tests: ['nt tests::hangs'] },
186
- report,
187
- noSpace: null,
188
- }),
189
- ).toEqual({ outcome: 'wedged', idleMs: 400, elapsedMs: 900, tests: ['nt tests::hangs', 'nt tests::young'] });
190
- });
191
-
192
- it('records a failed run whose output said ENOSPC as out of space, ahead of the tests and the bound that followed', () => {
193
- // From a downstream land gate: a 1 KB write into the task's RAM lease failed, and two tests failed on it.
194
- const noSpace = {
195
- line: 'ENOSPC: no space left on device, write',
196
- volume: {
197
- lease: '/Volumes/smoo-ram2-502/37738-AadRCN',
198
- mountpoint: '/Volumes/smoo-ram2-502',
199
- capacityBytes: 8 * 1024 ** 3,
200
- freeBytes: 4096,
201
- },
202
- };
203
- const report = { timedOut: [], cancelled: [], failed: ['lsp-differential hover'] };
204
- const ran = { exitCode: 1, elapsedMs: 11_580, expiry: null, report, noSpace };
205
- expect(judgeRun(ran)).toEqual({ outcome: 'no-space', exitCode: 1, tests: ['lsp-differential hover'], ...noSpace });
206
- // A full disk that then hung the run is still the disk.
207
- const idle = { kind: 'idle', limitMs: 400, tests: ['nt tests::writes'] } as const;
208
- expect(judgeRun({ ...ran, exitCode: 143, expiry: idle, report: null })).toEqual({
209
- outcome: 'no-space',
210
- exitCode: 143,
211
- tests: [],
212
- ...noSpace,
213
- });
214
- // A passing run that printed it, as a test of ENOSPC handling does, passed.
215
- expect(judgeRun({ ...ran, exitCode: 0, report: null })).toEqual({ outcome: 'passed' });
216
- expect(describeVerdict(judgeRun(ran))).toBe(
217
- 'ENOSPC (no space left on device): the command printed "ENOSPC: no space left on device, write"; its TMPDIR ' +
218
- '/Volumes/smoo-ram2-502/37738-AadRCN is on the RAM temp volume /Volumes/smoo-ram2-502, which had 0.0 MiB free ' +
219
- 'of 8192.0 MiB when that line arrived; the tests that then failed: lsp-differential hover',
220
- );
221
- });
222
-
223
- it('records a failing command with no report as a failure, and a passing one as passed', async () => {
224
- // How an exit is classified, not how soon it comes: the required ceiling is the leg's backstop, so it cannot end a
225
- // `node` still starting on a loaded host (a land gate measured 5243 ms for `node -e ""` against 5000 ms).
226
- expect(await verdictOf('node -e "process.exit(3)"', { timeoutMs: BOUNDED_TEST_IDLE_TIMEOUT_MS })).toEqual({
227
- outcome: 'failed',
228
- exitCode: 3,
229
- tests: [],
230
- });
231
- expect(await verdictOf('node -e ""', { timeoutMs: BOUNDED_TEST_IDLE_TIMEOUT_MS })).toEqual({ outcome: 'passed' });
232
- });
233
-
234
- it("reads nextest's typed timeout from its JUnit report", () => {
235
- // A cargo-nextest 0.9.143 report: one test terminated at its slow-timeout, one assertion.
236
- const report = `<?xml version="1.0" encoding="UTF-8"?>
237
- <testsuites name="nextest-run" tests="3" failures="2">
238
- <testsuite name="nt" tests="3" failures="2">
239
- <testcase name="t::ok" classname="nt" time="0.095"/>
240
- <testcase name="t::assert" classname="nt" time="0.095">
241
- <failure message="thread &apos;t::assert&apos; panicked at src/lib.rs:4:27" type="test failure with exit code 101">assertion failed</failure>
242
- <system-out>
243
- test t::assert ... FAILED
244
- </system-out>
245
- </testcase>
246
- <testcase name="t::slow" classname="nt" time="1.003">
247
- <failure type="test timeout"/>
248
- <system-out>
249
- running 1 test
250
- </system-out>
251
- </testcase>
252
- </testsuite>
253
- </testsuites>`;
254
- expect(junitFailures(report)).toEqual({ timedOut: ['nt t::slow'], cancelled: [], failed: ['nt t::assert'] });
255
- });
256
-
257
- it("reads nextest's abort of a test its command was told to stop as neither a failure nor a timeout", () => {
258
- // cargo-nextest 0.9.143, SIGTERM delivered to the run: the tests still running are reported as `test abort`.
259
- // A test that dies of any other signal (here SIGSEGV) is a crash of the test itself.
260
- const abort = (name: string, signal: string) =>
261
- `<testcase name="${name}" classname="nt" time="0.85"><failure message="process aborted with signal ${signal}" type="test abort">process aborted with signal ${signal}</failure><system-out>\nrunning 1 test\n</system-out></testcase>`;
262
- const report = `<testsuites name="nextest-run" tests="4" failures="3"><testsuite name="nt" tests="4" failures="3">
263
- <testcase name="t::ok" classname="nt" time="0.1"/>
264
- ${abort('t::cut', '15 (SIGTERM)')}
265
- ${abort('t::killed', '9 (SIGKILL)')}
266
- ${abort('t::crash', '11 (SIGSEGV)')}
267
- </testsuite></testsuites>`;
268
- expect(junitFailures(report)).toEqual({
269
- timedOut: [],
270
- cancelled: ['nt t::cut', 'nt t::killed'],
271
- failed: ['nt t::crash'],
272
- });
273
- });
274
-
275
- it('records a run its ceiling stopped as a bound when the only failures are the tests the stop aborted', () => {
276
- const total = { kind: 'total', limitMs: 120_000 } as const;
277
- const cut = { timedOut: [], cancelled: ['nt t::cut'], failed: [] };
278
- expect(judgeRun({ exitCode: 143, elapsedMs: 120_850, expiry: total, report: cut, noSpace: null })).toEqual({
279
- outcome: 'bound',
280
- bound: 'total',
281
- limitMs: 120_000,
282
- elapsedMs: 120_850,
283
- });
284
- // An assertion that failed before the ceiling is still a failure, and an abort nobody asked for is one too.
285
- expect(
286
- judgeRun({
287
- exitCode: 143,
288
- elapsedMs: 120_850,
289
- expiry: total,
290
- report: { ...cut, failed: ['nt t::assert'] },
291
- noSpace: null,
292
- }),
293
- ).toEqual({ outcome: 'failed', exitCode: 143, tests: ['nt t::assert'] });
294
- expect(judgeRun({ exitCode: 143, elapsedMs: 850, expiry: null, report: cut, noSpace: null })).toEqual({
295
- outcome: 'failed',
296
- exitCode: 143,
297
- tests: ['nt t::cut'],
298
- });
299
- });
300
-
301
- it('records a test aborted with no total bound to explain it as a failure, whatever the exit or the other tests say', () => {
302
- const cancelled = ['nt t::cut'];
303
- // Exit 0 with an abort in the report: the abort is still not nothing.
304
- expect(
305
- judgeRun({
306
- exitCode: 0,
307
- elapsedMs: 850,
308
- expiry: null,
309
- report: { timedOut: [], cancelled, failed: [] },
310
- noSpace: null,
311
- }),
312
- ).toEqual({
313
- outcome: 'failed',
314
- exitCode: 0,
315
- tests: cancelled,
316
- });
317
- // A per-test timeout beside an abort nobody asked for is not a per-test bound: the abort failed the run.
318
- expect(
319
- judgeRun({
320
- exitCode: 100,
321
- elapsedMs: 850,
322
- expiry: null,
323
- report: { timedOut: ['nt t::slow'], cancelled, failed: [] },
324
- noSpace: null,
325
- }),
326
- ).toEqual({ outcome: 'failed', exitCode: 100, tests: cancelled });
327
- // With the total bound fired, the same report is the bound's own casualties.
328
- expect(
329
- judgeRun({
330
- exitCode: 143,
331
- elapsedMs: 120_850,
332
- expiry: { kind: 'total', limitMs: 120_000 },
333
- report: { timedOut: ['nt t::slow'], cancelled, failed: [] },
334
- noSpace: null,
335
- }),
336
- ).toMatchObject({ outcome: 'bound', bound: 'total' });
337
- });
338
-
339
- it('keeps CPU operational failures ordinary even beside test timeouts or a successful command exit', () => {
340
- expect(
341
- judgeOperationalFailure(0, {
342
- failed: ['nt t::assert'],
343
- timedOut: ['nt t::slow'],
344
- cancelled: ['nt t::cut'],
345
- }),
346
- ).toEqual({
347
- outcome: 'failed',
348
- exitCode: 1,
349
- tests: ['nt t::assert', 'nt t::slow', 'nt t::cut'],
350
- });
351
- expect(judgeOperationalFailure(143, { failed: [], timedOut: ['nt t::slow'], cancelled: [] })).toEqual({
352
- outcome: 'failed',
353
- exitCode: 143,
354
- tests: ['nt t::slow'],
355
- });
356
- expect(judgeOperationalFailure(0, null)).toEqual({ outcome: 'failed', exitCode: 1, tests: [] });
357
- });
358
-
359
- it('records a runner that reports its own abort at the total ceiling as a bound, end to end', async () => {
360
- // A stand-in for nextest: on SIGTERM it writes the JUnit report with the test it was running aborted, exits 143.
361
- const runner = `const fs = require('node:fs');
362
- process.on('SIGTERM', () => {
363
- fs.writeFileSync(process.env.BOUNDED_EXEC_JUNIT, '<testsuites name="nextest-run" tests="2" failures="1"><testsuite name="nt" tests="2" failures="1"><testcase name="t::ok" classname="nt"/><testcase name="t::cut" classname="nt"><failure message="process aborted with signal 15 (SIGTERM)" type="test abort">process aborted with signal 15 (SIGTERM)</failure></testcase></testsuite></testsuites>');
364
- process.exit(143);
365
- });
366
- fs.writeFileSync('runner-ready.fifo', 'ready pid=' + process.pid + '\\n');
367
- process.stdin.resume();
368
- `;
369
- let armed: Promise<void> | undefined;
370
- let report = '';
371
- const verdict = await verdictOf(
372
- 'exec node runner.js',
373
- // The total bound is the subject; the grace after it is the leg's backstop, so the run ends by the runner's own
374
- // exit on SIGTERM, never by a SIGKILL a loaded host's slow handler would have drawn.
375
- { timeoutMs: 300, killAfterMs: BOUNDED_TEST_IDLE_TIMEOUT_MS },
376
- { 'runner.js': runner },
377
- {},
378
- async (root) => {
379
- const ready = join(root, 'runner-ready.fifo');
380
- report = join(taskDirectory(join(root, '.nx', 'workspace-data'), 'app:test'), JUNIT_FILE);
381
- expect(spawnSync('mkfifo', [ready]).status).toBe(0);
382
- const real = createProcessTreeKiller();
383
- return {
384
- async kill(pid, signal) {
385
- ownedProcessGroups.add(pid);
386
- armed ??= readFile(ready, 'utf8').then((text) => {
387
- // Bare `ps` through PATH: NixOS has no /bin/ps, and a failed spawn leaves stdout null.
388
- const observed = spawnSync('ps', ['-o', 'pid=,pgid=,stat=', '-p', String(pid)], {
389
- encoding: 'utf8',
390
- });
391
- const observedStdout = observed.stdout ?? '';
392
- const detail = `abort-report handler pid=${pid} signal=${signal} ready=${JSON.stringify(text)} state=${observedStdout.trim()} status=${observed.status} stderr=${observed.stderr} error=${observed.error}`;
393
- expect(text, detail).toBe(`ready pid=${pid}\n`);
394
- expect(observed.status, detail).toBe(0);
395
- const [seenPid, pgid, state] = observedStdout.trim().split(/\s+/);
396
- expect(Number(seenPid), detail).toBe(pid);
397
- expect(Number(pgid), detail).toBe(pid);
398
- expect(state !== undefined && !state.startsWith('Z'), detail).toBe(true);
399
- });
400
- await armed;
401
- await real.kill(pid, signal);
402
- },
403
- };
404
- },
405
- );
406
- expect(armed, 'abort-report handler readiness must precede the total-bound signal').toBeDefined();
407
- await armed;
408
- expect(verdict).toMatchObject({ outcome: 'bound', bound: 'total', limitMs: 300 });
409
- expect(junitFailures(await readFile(report, 'utf8')), `runner abort report ${report} must name nt t::cut`).toEqual({
410
- timedOut: [],
411
- cancelled: ['nt t::cut'],
412
- failed: [],
413
- });
414
- });
415
-
416
- it('asks the one runner in a command for a report, and leaves two runners alone', async () => {
417
- const { context } = await workspace();
418
- const directory = context.record?.directory ?? '';
419
- await mkdir(directory, { recursive: true });
420
- const report = join(directory, JUNIT_FILE);
421
- expect(await withJunitReport('bun test --timeout=0 src', directory)).toBe(
422
- `bun test --reporter=junit --reporter-outfile='${report}' --timeout=0 src`,
423
- );
424
- const nextest = await withJunitReport('extracted="$(x)" && cargo --frozen nextest run -E all', directory);
425
- expect(nextest).toBe(
426
- `extracted="$(x)" && cargo --frozen nextest run --tool-config-file 'smoo-report:${join(directory, 'nextest-report.toml')}' -E all`,
427
- );
428
- expect(await readFile(join(directory, 'nextest-report.toml'), 'utf8')).toBe(
429
- `[profile.default.junit]\npath = ${JSON.stringify(report)}\n`,
430
- );
431
- expect(await withJunitReport('bun test a && bun test b', directory)).toBe('bun test a && bun test b');
432
- expect(await withJunitReport('bun scripts/test-shard.ts 1', directory)).toBe('bun scripts/test-shard.ts 1');
433
- });
434
-
435
- it('finds bun by its basename, keeps the binary the target chose, and leaves lookalikes alone', async () => {
436
- const { context } = await workspace();
437
- const directory = context.record?.directory ?? '';
438
- await mkdir(directory, { recursive: true });
439
- const flags = `--reporter=junit --reporter-outfile='${join(directory, JUNIT_FILE)}'`;
440
- expect(await withJunitReport('../bun-runtime/.runtime/bun test --timeout=0 --shard=1/4', directory)).toBe(
441
- `../bun-runtime/.runtime/bun test ${flags} --timeout=0 --shard=1/4`,
442
- );
443
- expect(
444
- await withJunitReport(
445
- 'BUN_EXE=../bun-runtime/.runtime/bun ../bun-runtime/.runtime/bun test --timeout=0 tests',
446
- directory,
447
- ),
448
- ).toBe(`BUN_EXE=../bun-runtime/.runtime/bun ../bun-runtime/.runtime/bun test ${flags} --timeout=0 tests`);
449
- expect(await withJunitReport('cd pkg && $RUNTIME/bun test src', directory)).toBe(
450
- `cd pkg && $RUNTIME/bun test ${flags} src`,
451
- );
452
- expect(await withJunitReport('../x/.runtime/bun test a && $HOME/.bun/bin/bun test b', directory)).toBe(
453
- '../x/.runtime/bun test a && $HOME/.bun/bin/bun test b',
454
- );
455
- // The basename must be exactly `bun`, and an assignment is not a command word.
456
- expect(await withJunitReport('../x/debug-bun test src', directory)).toBe('../x/debug-bun test src');
457
- expect(await withJunitReport('../x/bun-test test src', directory)).toBe('../x/bun-test test src');
458
- expect(await withJunitReport('BUN_EXE=../x/bun test', directory)).toBe('BUN_EXE=../x/bun test');
459
- });
460
-
461
- it('calls a failed run bound only when every failed task has a bound verdict for its hash', async () => {
462
- const { data } = await workspace();
463
- const record = async (task: string, hash: string, verdict: BoundedExecVerdict) => {
464
- const directory = taskDirectory(data, task);
465
- await mkdir(directory, { recursive: true });
466
- await writeRecord(directory, { task, hash, verdict });
467
- };
468
- await record('a:test-1', '1', { outcome: 'bound', bound: 'total', limitMs: 120_000, elapsedMs: 120_004 });
469
- await record('b:cargo-test', '2', { outcome: 'bound', bound: 'test', tests: ['b t::slow'] });
470
- await record('c:test', 'old', { outcome: 'bound', bound: 'test', tests: ['c slow'] });
471
- const run = (tasks: { taskId: string; hash: string; status: number }[]) => ({ run: {}, tasks });
472
-
473
- const bound = await failedTasksOfRun(
474
- run([
475
- { taskId: 'a:test-1', hash: '1', status: 1 },
476
- { taskId: 'b:cargo-test', hash: '2', status: 1 },
477
- { taskId: 'c:lint', hash: '3', status: 0 },
478
- ]),
479
- data,
480
- );
481
- expect(bound.map((task) => [task.task, task.bound])).toEqual([
482
- ['a:test-1', true],
483
- ['b:cargo-test', true],
484
- ]);
485
-
486
- const mixed = await failedTasksOfRun(
487
- run([
488
- { taskId: 'a:test-1', hash: '1', status: 1 },
489
- { taskId: 'c:test', hash: 'new', status: 1 },
490
- { taskId: 'd:lint', hash: '4', status: 1 },
491
- ]),
492
- data,
493
- );
494
- expect(mixed).toEqual([
495
- expect.objectContaining({ task: 'a:test-1', bound: true }),
496
- { task: 'c:test', bound: false, reason: "its verdict is from hash old, not this run's new" },
497
- { task: 'd:lint', bound: false, reason: 'no bounded-exec verdict' },
498
- ]);
499
- });
500
-
501
- it('judges a run that exits inside its total bound by its exit alone, however far the injected clock moved', async () => {
502
- // The clock is faked: it moves once, when the command reports, by a generated amount short of the total bound, and
503
- // then the command exits. Below the bound the verdict is a function of the exit, never of how long a loaded host
504
- // took to get there (a land gate measured 5243 ms for `node -e ""` under a 5000 ms bound). The step is at least
505
- // 1 ms: Bun 1.4.3's `advanceTimersByTime(0)` moves the fake clock 1 ms, and a run that never moves it is the case
506
- // above. The command prints its report through `printf`, so the line naming the command never matches it.
507
- const reported = 'bounded-exec-property-reported';
508
- await fc.assert(
509
- fc.asyncProperty(
510
- fc.integer({ min: 2, max: 600_000 }).chain((timeoutMs) =>
511
- fc.record({
512
- timeoutMs: fc.constant(timeoutMs),
513
- elapsedMs: fc.integer({ min: 1, max: timeoutMs - 1 }),
514
- killAfterMs: fc.integer({ min: 0, max: timeoutMs }),
515
- exitCode: fc.integer({ min: 0, max: 125 }),
516
- }),
517
- ),
518
- async ({ timeoutMs, elapsedMs, killAfterMs, exitCode }) => {
519
- const { context } = await workspace();
520
- const { movedMs } = await onProgressClock(
521
- (chunk) => chunk.includes(reported),
522
- elapsedMs,
523
- () =>
524
- runBoundedExec(
525
- {
526
- command: `printf '%s-%s\\n' bounded-exec property-reported; exit ${exitCode}`,
527
- timeoutMs,
528
- killAfterMs,
529
- },
530
- context,
531
- createProcessTreeKiller(),
532
- null,
533
- null,
534
- ),
535
- );
536
- expect(movedMs).toBe(elapsedMs);
537
- expect((await readRecord(context.record?.directory ?? ''))?.verdict).toEqual(
538
- exitCode === 0 ? { outcome: 'passed' } : { outcome: 'failed', exitCode, tests: [] },
539
- );
540
- },
541
- ),
542
- { numRuns: 40 },
543
- );
544
- });
545
- });
@@ -1,129 +0,0 @@
1
- import { describe, expect, it } from 'bun:test';
2
-
3
- import { artifactFile, cargoTriple, zigbuildArgs, zigbuildEnv } from './executor.js';
4
-
5
- const MANIFEST = '/repo/packages/cowshed/crates/cowshed-cli/Cargo.toml';
6
-
7
- /** One `compiler-artifact` line in the shape cargo prints it, trimmed to stable fields. */
8
- function artifactLine(fields: {
9
- manifest: string;
10
- kind: string[];
11
- name: string;
12
- filenames: string[];
13
- executable: string | null;
14
- }): string {
15
- return JSON.stringify({
16
- reason: 'compiler-artifact',
17
- package_id: 'path+file:///repo/packages/cowshed/crates/cowshed-cli#0.0.1',
18
- manifest_path: fields.manifest,
19
- target: { kind: fields.kind, crate_types: fields.kind, name: fields.name, src_path: '/repo/src/main.rs' },
20
- profile: { opt_level: '3', debuginfo: 0, debug_assertions: false, overflow_checks: false, test: false },
21
- features: [],
22
- filenames: fields.filenames,
23
- executable: fields.executable,
24
- fresh: false,
25
- });
26
- }
27
-
28
- describe('cargo-zigbuild executor', () => {
29
- it('runs cargo-zigbuild directly, locked, with the pinned glibc suffix on the target', () => {
30
- expect(
31
- zigbuildArgs(
32
- { target: 'x86_64-unknown-linux-gnu.2.17', manifestPath: 'm', package: 'cowshed-napi', output: 'o' },
33
- MANIFEST,
34
- ),
35
- ).toEqual([
36
- 'zigbuild',
37
- '--locked',
38
- '--message-format=json-render-diagnostics',
39
- '--target',
40
- 'x86_64-unknown-linux-gnu.2.17',
41
- '--manifest-path',
42
- MANIFEST,
43
- '--package',
44
- 'cowshed-napi',
45
- '--lib',
46
- ]);
47
- });
48
-
49
- it('selects the named binary and the release profile when asked', () => {
50
- const args = zigbuildArgs(
51
- {
52
- target: 'aarch64-unknown-linux-musl',
53
- manifestPath: 'm',
54
- package: 'cowshed-cli',
55
- bin: 'cowshed',
56
- output: 'o',
57
- release: true,
58
- },
59
- MANIFEST,
60
- );
61
- expect(args.slice(-3)).toEqual(['--release', '--bin', 'cowshed']);
62
- expect(args).not.toContain('--lib');
63
- });
64
-
65
- it('names the bare triple cargo sees under a glibc suffix', () => {
66
- expect(cargoTriple('x86_64-unknown-linux-gnu.2.17')).toBe('x86_64-unknown-linux-gnu');
67
- expect(cargoTriple('aarch64-unknown-linux-musl')).toBe('aarch64-unknown-linux-musl');
68
- });
69
-
70
- it("drops the shell's compilers for the artifact's triple and keeps everything else", () => {
71
- const env = zigbuildEnv(
72
- {
73
- CC_x86_64_unknown_linux_gnu: '/nix/store/cc-wrapper/bin/cc',
74
- 'CC_x86_64-unknown-linux-gnu': '/nix/store/cc-wrapper/bin/cc',
75
- CXX_x86_64_unknown_linux_gnu: '/nix/store/cc-wrapper/bin/c++',
76
- AR_x86_64_unknown_linux_gnu: 'ar',
77
- RANLIB_x86_64_unknown_linux_gnu: 'ranlib',
78
- CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: 'cc',
79
- CC_aarch64_unknown_linux_gnu: 'kept-other-triple',
80
- CC: 'kept-generic',
81
- PATH: '/bin',
82
- },
83
- 'x86_64-unknown-linux-gnu.2.17',
84
- );
85
- expect(env).toEqual({ CC_aarch64_unknown_linux_gnu: 'kept-other-triple', CC: 'kept-generic', PATH: '/bin' });
86
- });
87
-
88
- it("reads the binary's executable from its artifact message", () => {
89
- const line = artifactLine({
90
- manifest: MANIFEST,
91
- kind: ['bin'],
92
- name: 'cowshed',
93
- filenames: ['/repo/target/x86_64-unknown-linux-musl/release/cowshed'],
94
- executable: '/repo/target/x86_64-unknown-linux-musl/release/cowshed',
95
- });
96
- expect(artifactFile(line, MANIFEST, { kind: 'bin', name: 'cowshed' })).toBe(
97
- '/repo/target/x86_64-unknown-linux-musl/release/cowshed',
98
- );
99
- expect(artifactFile(line, MANIFEST, { kind: 'bin', name: 'other' })).toBeNull();
100
- expect(artifactFile(line, '/repo/elsewhere/Cargo.toml', { kind: 'bin', name: 'cowshed' })).toBeNull();
101
- });
102
-
103
- it("reads the cdylib's shared object, not the rlib beside it", () => {
104
- const line = artifactLine({
105
- manifest: MANIFEST,
106
- kind: ['cdylib', 'rlib'],
107
- name: 'cowshed_napi',
108
- filenames: [
109
- '/repo/target/x86_64-unknown-linux-gnu/debug/libcowshed_napi.rlib',
110
- '/repo/target/x86_64-unknown-linux-gnu/debug/libcowshed_napi.so',
111
- ],
112
- executable: null,
113
- });
114
- expect(artifactFile(line, MANIFEST, { kind: 'cdylib' })).toBe(
115
- '/repo/target/x86_64-unknown-linux-gnu/debug/libcowshed_napi.so',
116
- );
117
- });
118
-
119
- it('ignores the other messages cargo prints', () => {
120
- expect(artifactFile('{"reason":"build-finished","success":true}', MANIFEST, { kind: 'cdylib' })).toBeNull();
121
- expect(artifactFile('', MANIFEST, { kind: 'cdylib' })).toBeNull();
122
- });
123
-
124
- it('refuses an artifact message that breaks the contract instead of skipping it', () => {
125
- expect(() =>
126
- artifactFile('{"reason":"compiler-artifact","manifest_path":7}', MANIFEST, { kind: 'cdylib' }),
127
- ).toThrow('does not match the artifact contract');
128
- });
129
- });