@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,141 @@
1
+ /**
2
+ * Lock-wait evidence from open-file tables. Pure: no I/O and no clock. `hang-diagnostics.ts` runs `lsof` and hands its
3
+ * output here, so every decision is a function of the rows it was given.
4
+ *
5
+ * A wait is open-handle evidence, not a kernel lock owner. flock(2) and fcntl(2) name no holder, so a regular file the
6
+ * run holds on a numbered descriptor, and that another process also holds open, is the only candidate for the lock a
7
+ * run blocks on. Nothing here observes the lock call itself.
8
+ */
9
+
10
+ /** One row of an `lsof -nP -p ...` table: a file a process holds open. */
11
+ export interface OpenFile {
12
+ readonly pid: number;
13
+ readonly fd: string;
14
+ readonly type: string;
15
+ readonly path: string;
16
+ }
17
+
18
+ /** A process that holds a file open. */
19
+ export interface Opener {
20
+ readonly pid: number;
21
+ readonly command: string;
22
+ }
23
+
24
+ /** An opener that `lsof -F` named for one path. */
25
+ export interface PathOpener extends Opener {
26
+ readonly path: string;
27
+ }
28
+
29
+ /**
30
+ * A regular file the run holds on a numbered descriptor while processes outside the run also hold it open. `waiters`
31
+ * are the run's pids holding it; `holders` are the outside processes, never a run pid.
32
+ */
33
+ export interface LockWait {
34
+ readonly path: string;
35
+ readonly waiters: readonly number[];
36
+ readonly holders: readonly Opener[];
37
+ }
38
+
39
+ /** COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME; NAME is everything from the ninth column on, spaces included. */
40
+ const TABLE_ROW = /^\S+\s+(?<pid>\d+)\s+\S+\s+(?<fd>\S+)\s+(?<type>\S+)\s+\S+\s+\S+\s+\S+\s+(?<path>.+)$/;
41
+
42
+ /** The rows of an `lsof -nP` table. The header and any row that does not parse are skipped. */
43
+ export function parseLsofTable(text: string): OpenFile[] {
44
+ const rows: OpenFile[] = [];
45
+ for (const line of text.split('\n')) {
46
+ const row = toOpenFile(line);
47
+ if (row !== null) rows.push(row);
48
+ }
49
+ return rows;
50
+ }
51
+
52
+ function toOpenFile(line: string): OpenFile | null {
53
+ const groups: Partial<Record<'pid' | 'fd' | 'type' | 'path', string>> = TABLE_ROW.exec(line)?.groups ?? {};
54
+ const { pid, fd, type, path } = groups;
55
+ if (pid === undefined || fd === undefined || type === undefined || path === undefined) return null;
56
+ return { pid: Number(pid), fd, type, path };
57
+ }
58
+
59
+ /**
60
+ * A regular file on a numbered descriptor: the only kind a blocking flock or fcntl can wait on. `cwd`, `txt`, `rtd`,
61
+ * `mem` and the other unnumbered descriptors name files a process runs or maps, not files it locks.
62
+ */
63
+ function isLockable(row: OpenFile): boolean {
64
+ return row.type === 'REG' && /^\d/.test(row.fd);
65
+ }
66
+
67
+ /** The distinct lockable paths in `tree`, sorted. */
68
+ export function lockCandidates(tree: readonly OpenFile[]): string[] {
69
+ return [...new Set(tree.filter(isLockable).map((row) => row.path))].sort();
70
+ }
71
+
72
+ /**
73
+ * The lock waits in `tree`, the open files of the run's processes. A path is a wait only when some process outside
74
+ * the run (`treePids` excludes the run) also holds it open. Sorted by path; holders deduplicated by pid and sorted.
75
+ */
76
+ export function lockWaits(
77
+ tree: readonly OpenFile[],
78
+ treePids: ReadonlySet<number>,
79
+ openers: readonly PathOpener[],
80
+ ): LockWait[] {
81
+ const waits: LockWait[] = [];
82
+ for (const path of lockCandidates(tree)) {
83
+ const holders = new Map<number, Opener>();
84
+ for (const opener of openers) {
85
+ if (opener.path === path && !treePids.has(opener.pid) && !holders.has(opener.pid)) {
86
+ holders.set(opener.pid, { pid: opener.pid, command: opener.command });
87
+ }
88
+ }
89
+ if (holders.size === 0) continue;
90
+ const waiters = [...new Set(tree.filter((row) => isLockable(row) && row.path === path).map((row) => row.pid))];
91
+ waits.push({
92
+ path,
93
+ waiters: waiters.sort((a, b) => a - b),
94
+ holders: [...holders.values()].sort((a, b) => a.pid - b.pid),
95
+ });
96
+ }
97
+ return waits;
98
+ }
99
+
100
+ /**
101
+ * Parse `lsof -F pcn` output: `p<pid>` opens a process, `c<command>` names it, `f<fd>` opens a file (lsof always
102
+ * emits one), and `n<path>` names the file. `null` for any other shape: the caller must then call the census
103
+ * incomplete, never empty.
104
+ */
105
+ export function parseLsofFields(text: string): PathOpener[] | null {
106
+ const openers: PathOpener[] = [];
107
+ let pid: number | null = null;
108
+ let command: string | null = null;
109
+ for (const line of text.split('\n')) {
110
+ if (line === '') continue;
111
+ const value = line.slice(1);
112
+ switch (line.charAt(0)) {
113
+ case 'p': {
114
+ const next = Number(value);
115
+ if (!Number.isSafeInteger(next) || next <= 0) return null;
116
+ pid = next;
117
+ command = null;
118
+ break;
119
+ }
120
+ case 'c':
121
+ if (pid === null || command !== null) return null;
122
+ command = value;
123
+ break;
124
+ case 'f':
125
+ if (pid === null) return null;
126
+ break;
127
+ case 'n':
128
+ if (pid === null || command === null) return null;
129
+ openers.push({ pid, command, path: value });
130
+ break;
131
+ default:
132
+ return null;
133
+ }
134
+ }
135
+ return openers;
136
+ }
137
+
138
+ /** The holders as a reader names them: `pid 51234 (cargo), pid 9 (rustc)`. */
139
+ export function describeHolders(holders: readonly Opener[]): string {
140
+ return holders.map(({ pid, command }) => `pid ${pid} (${command})`).join(', ');
141
+ }
@@ -0,0 +1,48 @@
1
+ import type { RunnerKind } from './runner-sizing.js';
2
+ import { shellQuote } from './verdict.js';
3
+
4
+ /**
5
+ * mbx's machine-wide pool as a leaf runner meets it (specs/cowshed/05_gateway.md, "Host scheduling", "Parallelism inside
6
+ * a job"). With the mbx capability the canonical environment names the one pool (`MBX_SCHEDULER=1` beside the shared
7
+ * `MBX_CACHE_DIR`) and the job's priority in it; that pool is the host's CPU and memory ledger, so no Nx run or leaf
8
+ * serves a pool of its own beside it.
9
+ */
10
+ export interface MbxPool {
11
+ readonly priority: 'normal' | 'low';
12
+ }
13
+
14
+ /** The pool the environment names, or `null` where the project has no mbx and cowshed's own pools apply unchanged. */
15
+ export function mbxPool(environment: Readonly<NodeJS.ProcessEnv>): MbxPool | null {
16
+ if (environment.MBX_SCHEDULER !== '1' || !environment.MBX_CACHE_DIR) {
17
+ return null;
18
+ }
19
+ return { priority: environment.MBX_SCHEDULER_PRIORITY === 'normal' ? 'normal' : 'low' };
20
+ }
21
+
22
+ /**
23
+ * How a leaf enters the pool once: a Cargo leaf runs through mbx, which admits its compiler and supported test work
24
+ * itself, so wrapping it would charge it twice; any other leaf holds `cpus` of the pool for its whole run through
25
+ * `mbx reserve`, `cpus` being the job's own count.
26
+ */
27
+ export type MbxLeaf =
28
+ | { readonly kind: 'cargo' }
29
+ | { readonly kind: 'reserve'; readonly cpus: number; readonly priority: 'normal' | 'low' };
30
+
31
+ const CARGO_LEAVES: ReadonlySet<RunnerKind> = new Set<RunnerKind>(['cargo', 'cargo-mutants', 'nextest']);
32
+
33
+ export function mbxLeaf(pool: MbxPool, kind: RunnerKind, want: number): MbxLeaf {
34
+ return CARGO_LEAVES.has(kind)
35
+ ? { kind: 'cargo' }
36
+ : { kind: 'reserve', cpus: Math.max(1, want), priority: pool.priority };
37
+ }
38
+
39
+ /**
40
+ * `command` as the shell runs it under its leaf's admission. `mbx` is the canonical environment's, whose realpath
41
+ * cowshed's admission proved to be the host's pinned mbx.
42
+ */
43
+ export function withMbxLeaf(command: string, leaf: MbxLeaf): string {
44
+ if (leaf.kind === 'cargo') {
45
+ return command;
46
+ }
47
+ return `mbx reserve --cpus ${leaf.cpus} --priority ${leaf.priority} -- /bin/sh -c ${shellQuote(command)}`;
48
+ }
@@ -0,0 +1,235 @@
1
+ import { spawn } from 'node:child_process';
2
+ import type { Readable } from 'node:stream';
3
+ import { isRecord } from '../../type-guards.js';
4
+
5
+ /**
6
+ * What a `bounded-exec` command leaves running, owned the way cowshed's supervisor owns a job's processes
7
+ * (specs/cowshed/11_shell.md, "Process identity and signal ownership"): by the tree the supervisor observes from
8
+ * fork, never by who works in a directory. The command runs as `cowshed subtree-root`, which asks its job's
9
+ * supervisor for a handle on itself while it is alive, writes that answer to an inherited descriptor, and execs the
10
+ * command in the same life. At the end, `cowshed retire-descendants` hands the handle back: the supervisor signals
11
+ * the live members its tree records under that root, and nothing else, so a process that merely works in the
12
+ * command's directory is never touched.
13
+ */
14
+
15
+ /** Set by a cowshed runtime for a job only when a supervisor serves that job's socket. */
16
+ export const SUPERVISOR_SOCKET_ENV = 'COWSHED_SUPERVISOR_SOCKET';
17
+
18
+ /**
19
+ * The variable naming the cowshed executable that runs `cowshed disk-command` and `cowshed subtree-root`. Unset, it is
20
+ * the installed `cowshed` on PATH. A repository that tests its own cowshed sets it, on the targets that test it, to that
21
+ * checkout's build: an installed cowshed that predates a command its own checkout added would fail the very code under
22
+ * test. The executor passes the one it resolved to the command, so it is part of what the command runs.
23
+ */
24
+ export const COWSHED_EXECUTABLE_ENV = 'COWSHED_EXECUTABLE';
25
+
26
+ /**
27
+ * The descriptor `cowshed subtree-root` writes its admission to. fd 3 is the runner lifecycle's duplex socket
28
+ * (`runner-hook.ts`), which must reach the command, so the admission takes the next one.
29
+ */
30
+ export const HANDLE_FD = 4;
31
+
32
+ /** The supervisor's opaque capability for one subtree; only `retire-descendants` reads it. */
33
+ export type SubtreeHandle = Readonly<Record<string, unknown>>;
34
+
35
+ /** Why the supervisor answered no, by its own typed reason. */
36
+ export type SubtreeRefusal = 'foldUnavailable' | 'notMember' | 'foreignHandle' | 'jobEnded' | 'spentHandle';
37
+
38
+ const REFUSALS: readonly string[] = ['foldUnavailable', 'notMember', 'foreignHandle', 'jobEnded', 'spentHandle'];
39
+
40
+ /** What `cowshed subtree-root` wrote, or why nothing readable came. */
41
+ export type SubtreeAdmission =
42
+ | { kind: 'admitted'; handle: SubtreeHandle }
43
+ | { kind: 'refused'; reason: SubtreeRefusal }
44
+ | { kind: 'unread'; detail: string };
45
+
46
+ /** A process the retirement signalled: its pid, and its image when the supervisor read one. */
47
+ export interface SignalledProcess {
48
+ readonly pid: number;
49
+ readonly image: string | null;
50
+ readonly signal: number;
51
+ }
52
+
53
+ /** Where the supervisor's observation of the subtree may have missed something. */
54
+ export interface CoverageGap {
55
+ readonly kind: string;
56
+ readonly pid: number | null;
57
+ }
58
+
59
+ export type SubtreeRetirement =
60
+ | {
61
+ kind: 'retired';
62
+ signalled: readonly SignalledProcess[];
63
+ /** True when the supervisor could not list every process it signalled. */
64
+ signalledIncomplete: boolean;
65
+ gaps: readonly CoverageGap[];
66
+ }
67
+ | { kind: 'refused'; reason: SubtreeRefusal }
68
+ | { kind: 'failed'; detail: string };
69
+
70
+ /** The client half: how a command becomes an owned subtree root, and how its subtree ends. */
71
+ export interface SubtreeOwner {
72
+ /** The argv that runs the shell `command` as an owned subtree root, its admission on {@link HANDLE_FD}. */
73
+ rootArgv(command: string): { file: string; args: string[] };
74
+ /** Retire every live member recorded under `handle`'s root: TERM, then KILL after `graceMs`. */
75
+ retire(handle: SubtreeHandle, graceMs: number): Promise<SubtreeRetirement>;
76
+ }
77
+
78
+ function isRefusal(value: unknown): value is SubtreeRefusal {
79
+ return typeof value === 'string' && REFUSALS.includes(value);
80
+ }
81
+
82
+ /** Parse the admission JSON line `cowshed subtree-root` writes. */
83
+ export function parseAdmission(text: string): SubtreeAdmission {
84
+ let value: unknown;
85
+ try {
86
+ value = JSON.parse(text);
87
+ } catch {
88
+ return {
89
+ kind: 'unread',
90
+ detail: `cowshed subtree-root wrote no admission JSON: ${JSON.stringify(text.slice(0, 200))}`,
91
+ };
92
+ }
93
+ if (isRecord(value) && value.kind === 'admitted' && isRecord(value.handle)) {
94
+ return { kind: 'admitted', handle: value.handle };
95
+ }
96
+ if (isRecord(value) && value.kind === 'refused' && isRefusal(value.reason)) {
97
+ return { kind: 'refused', reason: value.reason };
98
+ }
99
+ return {
100
+ kind: 'unread',
101
+ detail: `cowshed subtree-root wrote an admission this client does not know: ${text.trim()}`,
102
+ };
103
+ }
104
+
105
+ /** A handle recorded as JSON, or null when the record holds none: a writer that died mid-write left no handle. */
106
+ export function parseHandle(text: string): SubtreeHandle | null {
107
+ try {
108
+ const value: unknown = JSON.parse(text);
109
+ return isRecord(value) ? value : null;
110
+ } catch {
111
+ return null;
112
+ }
113
+ }
114
+
115
+ /** Read the admission from the command's handle descriptor; it closes before the command execs. */
116
+ export function readAdmission(stream: Readable | null | undefined): Promise<SubtreeAdmission> {
117
+ if (stream === null || stream === undefined) {
118
+ return Promise.resolve({ kind: 'unread', detail: 'the command was started without its handle descriptor' });
119
+ }
120
+ const chunks: Buffer[] = [];
121
+ let settle!: (admission: SubtreeAdmission) => void;
122
+ const answer = new Promise<SubtreeAdmission>((resolve) => {
123
+ settle = resolve;
124
+ });
125
+ stream.on('data', (chunk: Buffer) => chunks.push(chunk));
126
+ stream.once('error', (error: Error) => settle({ kind: 'unread', detail: `handle descriptor: ${error.message}` }));
127
+ stream.once('end', () => {
128
+ const text = Buffer.concat(chunks).toString('utf8');
129
+ settle(
130
+ text.trim() === ''
131
+ ? { kind: 'unread', detail: 'cowshed subtree-root closed its handle descriptor without an admission' }
132
+ : parseAdmission(text),
133
+ );
134
+ });
135
+ return answer;
136
+ }
137
+
138
+ /** Parse the retirement JSON line `cowshed retire-descendants` prints. */
139
+ export function parseRetirement(text: string): SubtreeRetirement {
140
+ let value: unknown;
141
+ try {
142
+ value = JSON.parse(text);
143
+ } catch {
144
+ return {
145
+ kind: 'failed',
146
+ detail: `cowshed retire-descendants printed no JSON: ${JSON.stringify(text.slice(0, 200))}`,
147
+ };
148
+ }
149
+ if (isRecord(value) && value.kind === 'refused' && isRefusal(value.reason)) {
150
+ return { kind: 'refused', reason: value.reason };
151
+ }
152
+ if (isRecord(value) && value.kind === 'retired' && isRecord(value.retirement)) {
153
+ const { containment, outlived, outlivedIncomplete } = value.retirement;
154
+ // `kernel` is a kernel-proven membership (a Linux cgroup), so it carries no gaps; `observed` lists what its fold
155
+ // may have missed (specs/cowshed/07_api.md, `containment`).
156
+ const lost = !isRecord(containment)
157
+ ? null
158
+ : containment.kind === 'kernel'
159
+ ? []
160
+ : containment.kind === 'observed' && Array.isArray(containment.lost)
161
+ ? containment.lost
162
+ : null;
163
+ if (lost !== null && Array.isArray(outlived)) {
164
+ const signalled: SignalledProcess[] = [];
165
+ for (const entry of outlived) {
166
+ if (!isRecord(entry) || typeof entry.pid !== 'number' || typeof entry.signal !== 'number') {
167
+ return {
168
+ kind: 'failed',
169
+ detail: `cowshed retire-descendants named a process this client cannot read: ${JSON.stringify(entry)}`,
170
+ };
171
+ }
172
+ signalled.push({
173
+ pid: entry.pid,
174
+ image: typeof entry.image === 'string' ? entry.image : null,
175
+ signal: entry.signal,
176
+ });
177
+ }
178
+ const gaps: CoverageGap[] = [];
179
+ for (const entry of lost) {
180
+ if (!isRecord(entry) || typeof entry.kind !== 'string') {
181
+ return {
182
+ kind: 'failed',
183
+ detail: `cowshed retire-descendants named a coverage gap this client cannot read: ${JSON.stringify(entry)}`,
184
+ };
185
+ }
186
+ gaps.push({ kind: entry.kind, pid: typeof entry.pid === 'number' ? entry.pid : null });
187
+ }
188
+ return { kind: 'retired', signalled, signalledIncomplete: outlivedIncomplete === true, gaps };
189
+ }
190
+ }
191
+ return {
192
+ kind: 'failed',
193
+ detail: `cowshed retire-descendants printed a retirement this client does not know: ${text.trim()}`,
194
+ };
195
+ }
196
+
197
+ /** The owner a cowshed runtime serves, through the installed `cowshed`'s own native socket client. */
198
+ export function cowshedSubtreeOwner(cowshed: string): SubtreeOwner {
199
+ return {
200
+ rootArgv(command) {
201
+ return {
202
+ file: cowshed,
203
+ args: ['subtree-root', '--handle-fd', String(HANDLE_FD), '--', '/bin/sh', '-c', command],
204
+ };
205
+ },
206
+ retire(handle, graceMs) {
207
+ const child = spawn(cowshed, ['retire-descendants', '--grace-ms', String(graceMs)], {
208
+ stdio: ['pipe', 'pipe', 'pipe'],
209
+ });
210
+ const out: Buffer[] = [];
211
+ const err: Buffer[] = [];
212
+ child.stdout.on('data', (chunk: Buffer) => out.push(chunk));
213
+ child.stderr.on('data', (chunk: Buffer) => err.push(chunk));
214
+ child.stdin.end(`${JSON.stringify(handle)}\n`);
215
+ // eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: the cowshed CLI bounds its own supervisor call (control bound, then the 15 s heartbeat silence; 05_gateway.md, "Deadlines") and exits with the answer or its TIMEOUT/SILENT failure
216
+ return new Promise<SubtreeRetirement>((resolve) => {
217
+ child.once('error', (error) =>
218
+ resolve({ kind: 'failed', detail: `${cowshed} retire-descendants: ${error.message}` }),
219
+ );
220
+ child.once('close', (code, signal) => {
221
+ const stdout = Buffer.concat(out).toString('utf8');
222
+ if (code === 0) {
223
+ resolve(parseRetirement(stdout));
224
+ return;
225
+ }
226
+ const stderr = Buffer.concat(err).toString('utf8').trim();
227
+ resolve({
228
+ kind: 'failed',
229
+ detail: `${cowshed} retire-descendants exited ${code ?? `on ${signal}`}${stderr === '' ? '' : `: ${stderr}`}`,
230
+ });
231
+ });
232
+ });
233
+ },
234
+ };
235
+ }
@@ -1,5 +1,5 @@
1
1
  import typia from 'typia';
2
- import { invocationSpan, withInvocationFlag } from './cpu-tokens.js';
2
+ import { invocationSpan, withInvocationFlag } from './runner-sizing.js';
3
3
  import { BUN_TEST, GO_TEST, NEXTEST_RUN } from './verdict.js';
4
4
 
5
5
  /**
@@ -16,6 +16,9 @@ import { BUN_TEST, GO_TEST, NEXTEST_RUN } from './verdict.js';
16
16
  * spells `classname name`.
17
17
  * - libtest (`cargo test`): `test tests::quick ... ok` (or `FAILED`, `ignored`); a test still running is named by
18
18
  * `test tests::slow has been running for over 60 seconds`.
19
+ * - vitest: timed ✓/× test results, timed ❯ failed-file results, and ↓ skipped-file results. The default
20
+ * reporter prints a completed file as ✓ file (N tests) Xms, plus slow or failed tests beneath it.
21
+ * Reporter headers, summaries and stack locations report no new completion.
19
22
  * - bun: a line of dots, one per test finished (`--dots`, which `withProgressReport` asks for: bun prints nothing
20
23
  * per passing test when it believes an agent runs it), or a `(pass)`/`(fail)`/`(skip)`/`(todo)` line. bun names
21
24
  * no test before it finishes, so a bun run names nothing in flight.
@@ -26,7 +29,7 @@ import { BUN_TEST, GO_TEST, NEXTEST_RUN } from './verdict.js';
26
29
  * Execution phases are owned by the private supervisor channel in runner-lifecycle.ts, never these text reports.
27
30
  */
28
31
  export interface RunProgress {
29
- /** One chunk of one of the command's output streams; true when it reports a finished test or Go package. */
32
+ /** One chunk of one output stream; true when it reports a finished test, file or Go package. */
30
33
  scan(stream: OutputStream, chunk: string): boolean;
31
34
  /** The tests the runner reported running and has not reported finished, in the order it first named them. */
32
35
  inFlight(): string[];
@@ -35,11 +38,14 @@ export interface RunProgress {
35
38
  export type OutputStream = 'stdout' | 'stderr';
36
39
 
37
40
  const ANSI = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*[A-Za-z]`, 'g');
38
- /** Lines naming a test that finished; group 1 is its name. */
41
+ /** Lines naming a test or file that finished; group 1 is its name. */
39
42
  const FINISHED = [
40
43
  /^\s*(?:[A-Z0-9][A-Z0-9-]*\s+)+\[\s*[0-9.]+s\]\s+\(\s*\d+\/\d+\)\s+(\S.*)$/,
41
44
  /^test (\S+) \.\.\. (?:ok|FAILED|ignored)\b/,
42
45
  /^\((?:pass|fail|skip|todo)\) (.+)$/,
46
+ /^\s*[✓×]\s+(\S.*?)\s+\d+ms\b/,
47
+ /^\s*❯\s+(\S.*?)\s+\(\d+ tests?(?: \| \d+ (?:failed|skipped|todo))*\)\s+\d+ms\b/,
48
+ /^\s*↓\s+(\S.*?)\s+\(\d+ tests?(?: \| \d+ (?:skipped|todo))+\)(?:\s+\d+ms\b|$)/,
43
49
  ];
44
50
  /** Lines naming a test still running; group 1 is its name. */
45
51
  const RUNNING = [