@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
@@ -1,117 +1,223 @@
1
- import { type ProcessEntry } from '../../testing.js';
2
1
  import { type PhaseShare } from './disk-lease.js';
2
+ import { type CoverageGap, type SignalledProcess, type SubtreeHandle, type SubtreeOwner } from './owned-subtree.js';
3
3
  import type { TempVolumeSpace } from './verdict.js';
4
4
  /**
5
5
  * The volume's ceiling, plus the revision's sectors. Pages are allocated as they are written and
6
6
  * returned when the volume detaches, so this bounds what a runaway suite can take, not what a gate
7
7
  * costs. Measured 2026-10-04: a full parallel smoothbricks `lint test build host-controller-test`
8
8
  * gate peaked at 1.61 GiB used with 18 concurrent leases; 8 GiB is five times that. That
9
- * gate also staged cowshed's real-APFS fixture images on the volume, which now stay under
10
- * /private/tmp, so the peak is an upper bound.
9
+ * gate also staged cowshed's real-APFS fixture images on the volume, which now stay outside it,
10
+ * so the peak is an upper bound.
11
11
  */
12
12
  export declare const RAM_TEMP_CAPACITY_BYTES: number;
13
+ /**
14
+ * The one length rule of the RAM temp layout (specs/cowshed/01_storage.md, "RAM temp path budget"): a lease directory,
15
+ * the TMPDIR its task gets, is at most this many bytes. It is the layout's worst case, a test namespace's at the largest
16
+ * uid and pid: `/private/var/folders/cowshed/` (29), a u32 uid (10), `/<ns>` (8), `/ram3` (5), `/<pid ≤ 99999>-` (7)
17
+ * and the suffix (6). Production's worst case is 57.
18
+ */
19
+ export declare const RAM_TMPDIR_MAX_BYTES = 65;
20
+ /** What the rule leaves below a lease for a socket's `/<names>`: 38 bytes. */
21
+ export declare const RAM_TMPDIR_SOCKET_BUDGET_BYTES: number;
22
+ /** The length in bytes of the lease directory process `pid` makes below `mountpoint`. */
23
+ export declare function leaseDirectoryBytes(mountpoint: string, pid: number): number;
24
+ /**
25
+ * How many archives the volume keeps: the failing run under triage and the one before it, the pair a triage compares to
26
+ * tell a flake from a regression. A stated reason, not a measurement.
27
+ */
28
+ export declare const ARCHIVES_KEPT = 2;
13
29
  export interface CommandOutput {
14
30
  status: number;
15
31
  stdout: string;
16
32
  stderr: string;
33
+ /** A bounded wait or a signalled facade is not a terminal disk-child receipt. */
34
+ readonly pending?: {
35
+ /** Diagnostic only: neither this pid's death nor reuse releases detach authority. */
36
+ readonly pid: number | null;
37
+ /** This exact child object's normal exit; null means native completion could not be proved. */
38
+ readonly completion: Promise<CommandOutput | null>;
39
+ };
17
40
  }
18
41
  /** The host programs the volume lifecycle runs. A seam so the state machine is testable without DiskArbitration. */
19
- export interface HostCommands {
20
- run(file: string, args: readonly string[], deadlineMs?: number): Promise<CommandOutput>;
21
- }
22
42
  /**
23
- * The processes still working in a lease directory once its task is over, and how they end. A
24
- * seam so the volume's state machine is testable without any.
43
+ * Binds an `hdiutil detach <device>` to the I/O Registry entry the caller inventoried the device as: cowshed reads the
44
+ * entry again inside the disk admission and detaches only while it still has the device as its whole disk.
25
45
  */
26
- export interface LeaseProcesses {
46
+ export interface DetachBinding {
47
+ readonly registryEntry: string;
48
+ }
49
+ /** A RAM disk the gateway attached and holds until this caller keeps or releases it; the gateway detaches it if the caller goes away first. */
50
+ export interface RamDiskLease {
51
+ /** Its whole disk, `/dev/diskN`. */
52
+ readonly device: string;
53
+ /** Its I/O Registry entry, `0x…`, as the gateway read it right after its attach. */
54
+ readonly registryEntry: string;
27
55
  /**
28
- * End every process that works in `directory` — its working directory or the `TMPDIR` it was
29
- * started with is there — and everything those started, and answer each as `<pid> (<command>)`.
30
- * Every one has exited when this settles; one that would not rejects with its name.
56
+ * The caller owns the disk from here. Err: the gateway refused, or no answer came, and then nothing is known: the
57
+ * gateway may have handed the disk over or left it to its next startup scan, so the caller detaches it by its entry.
31
58
  */
32
- stopWorkingIn(directory: string): Promise<string[]>;
59
+ keep(): Promise<Result<void, string>>;
60
+ /** The gateway detaches the disk now. Ok: its detach answer; Err: the lease was lost (no answer), so nothing is known of a detach. */
61
+ release(): Promise<Result<CommandOutput, string>>;
33
62
  }
34
- /** The host reads and signals cleanup uses; a seam for process ordering and signal failures. */
35
- export interface ProcessHost {
36
- /** The processes whose working directory, or the `TMPDIR` they were started with, is `directory` or lies beneath it. */
37
- workingIn(directory: string): Promise<number[]>;
38
- /** Every process on the host. */
39
- table(): Promise<ProcessEntry[]>;
40
- signal(pid: number, signal: NodeJS.Signals): void;
63
+ export interface HostCommands {
64
+ run(file: string, args: readonly string[], deadlineMs?: number, binding?: DetachBinding): Promise<CommandOutput>;
65
+ /**
66
+ * Attach a RAM disk of `sectors` 512-byte sectors through its owner, answering its lease. The owner is the cowshed
67
+ * gateway (`ram-lease`), never this task: a helper the task's own job forked would end with it. The gateway holds the
68
+ * disk until the lease is kept or released, and detaches it if this caller goes away first.
69
+ */
70
+ attachRam(sectors: number): Promise<Result<RamDiskLease, string | RamUnavailable>>;
71
+ /**
72
+ * Exact attach receipts owned by this caller; names and capacity never establish this authority. A disk it owns
73
+ * counts as the volume's even with nothing mounted, which covers an attach whose format never finished; one it holds
74
+ * no receipt for counts only as the volume of its exact name.
75
+ */
76
+ ownsRamDisk?(disk: AttachedRamDisk): boolean;
77
+ detachRam(device: string, registryEntry: string): Promise<CommandOutput>;
41
78
  }
42
79
  /**
43
- * The processes `host` reads. A lease belongs to one task and its command is gone by the time the
44
- * lease ends, so what still works in it is what the command left behind. Most of that works in the
45
- * lease only through `TMPDIR`, never by working directory: a test's ttsc plugin build copies the
46
- * typescript-go sources into `$TMPDIR` from a process working in its project, and a Bun or Node
47
- * process writes its compile cache there as it exits. Neither is known to the task's pid, and
48
- * whichever outlived that pid would write into a lease being removed (measured 2026-10-18: `rm`
49
- * failing ENOTEMPTY under a ttsc copy whose task had died). A fixture's Nx daemon is another: Nx
50
- * detaches it into a session of its own, so the process-group kill that ends a timed-out command
51
- * never reaches it, and a test process that is killed runs no teardown of its own. Deleting the
52
- * lease asks such a daemon to leave only by deleting its record, which it notices within a second
53
- * when it is idle and not at all while it is wedged; a signal does not depend on the daemon
54
- * noticing, and a process left on the volume is what keeps it from detaching.
55
- *
56
- * A leftover keeps running while it is looked for, and a child it starts after the process table
57
- * was read is in no table that was. So each one found is held with SIGSTOP and the table is read
58
- * again, until a read names nothing that the read before did not already show stopped: a stopped
59
- * process starts nothing, and whatever it started before it stopped is in every table read after.
60
- * Discovery waits for stopped-census readiness; the exit grace starts only after SIGTERM.
61
- * Only then does each get SIGTERM, and SIGCONT to act on it. A child whose parent exited before it
62
- * could be held has lost its ancestry, so once the stopped-table barrier holds, the lease is asked
63
- * again what works in it, including when that table names nothing, to recover reparented children.
64
- */
65
- export declare function leaseProcessesOn(host: ProcessHost): LeaseProcesses;
66
- /** What works in `directory` on this host: by working directory, and by the `TMPDIR` it was started with. */
67
- export declare function pidsInLease(directory: string): Promise<number[]>;
68
- export declare const hostLeaseProcesses: LeaseProcesses;
80
+ * How long a process a task left in its subtree gets to exit on SIGTERM before it gets SIGKILL:
81
+ * the time a daemon takes to stop its watcher and its plugin workers, and well under the grace a
82
+ * bounded leg gives its own command.
83
+ */
84
+ export declare const LEFTOVER_GRACE_MS = 5000;
85
+ /** One coverage gap the supervisor reported for a subtree it retired, as text. */
86
+ export declare function describeCoverageGap(gap: CoverageGap): string;
87
+ /** One process a retirement signalled, as `<pid> (<image>)`. */
88
+ export declare function describeSignalled(entry: SignalledProcess): string;
89
+ /**
90
+ * A test run's host namespace: seven lowercase base-36 characters, the pid of the process that minted it in the first
91
+ * five (zero-padded, so the first is a digit, which begins no production name) and that process's ordinal in the last
92
+ * two. The pid tells a later run whether the namespace's owner is gone. Mirrors `cowshed_os::namespace::TestNamespace`.
93
+ */
94
+ export type TestNamespace = {
95
+ readonly kind: 'test';
96
+ readonly name: string;
97
+ };
98
+ /**
99
+ * Whose names a host's RAM temp volume carries: production's, or one test run's own (specs/cowshed/01_storage.md,
100
+ * "Host namespace"). Every path and name the volume takes derives from it (`ramTempPaths`), so no name a test makes can
101
+ * be one production reads, sweeps or reclaims, and no guard compares them. Mirrors
102
+ * `cowshed_os::namespace::HostNamespace`.
103
+ */
104
+ export type HostNamespace = {
105
+ readonly kind: 'production';
106
+ } | TestNamespace;
107
+ /** The namespace of the user's own volume, which no test leases, creates or detaches. */
108
+ export declare const PRODUCTION: HostNamespace;
109
+ /**
110
+ * The namespace process `pid` mints as its `ordinal`th, encoded as `TestNamespace::of` encodes it:
111
+ * `testNamespace(94769, 3)` is `0214h03`. A pid or an ordinal that does not fit its digits throws.
112
+ */
113
+ export declare function testNamespace(pid: number, ordinal: number): TestNamespace;
69
114
  export interface RamTempPaths {
70
- /** Where DiskArbitration mounts the volume: `/Volumes/<volumeName>`. Short for sun_path (104 bytes). */
115
+ /**
116
+ * The root the volume mounts below: a directory of `uid`'s with mode 0700, holding the mountpoint and the staging
117
+ * directory. Production's is the per-user root `cowshed setup` makes, `/private/var/folders/cowshed/<uid>`; a test
118
+ * namespace's is the directory of its name below that root, which its fixture makes. mds admits no volume mounted
119
+ * below `/var/folders/`.
120
+ */
121
+ root: string;
122
+ /** The user that must own `root`. */
123
+ uid: number;
124
+ /**
125
+ * Where the kernel mounts the volume: `<root>/ram<revision>`, so no two revisions stack on one directory. Its length
126
+ * bounds every lease's, which {@link RAM_TMPDIR_MAX_BYTES} caps.
127
+ */
71
128
  mountpoint: string;
129
+ /**
130
+ * The kernel lock, and the ledger beside it: `/private/tmp/<volumeName>.lock` for production,
131
+ * `<root>/ram<revision>.lock` for a test namespace, which keeps its ordinary scratch beside the lock in its own root.
132
+ */
72
133
  lockFile: string;
73
- /** APFS volume name; names the mountpoint. */
134
+ /** APFS volume name; its marker holds it. `smoo-ram<revision>-<uid>`, with `-<ns>` after it for a test namespace. */
74
135
  volumeName: string;
75
- /** Where the volume is mounted to be marked before Disk Arbitration places it at `mountpoint`. */
136
+ /** Where the volume is mounted to be marked before it is mounted at `mountpoint`. */
76
137
  staging: string;
77
- /** Login name `hdiutil info` reports as the attaching user of this module's RAM disks. */
78
- user: string;
138
+ /**
139
+ * The longest lease directory, a task's TMPDIR, this layout admits: {@link RAM_TMPDIR_MAX_BYTES} for every layout
140
+ * `ramTempPaths` makes. A unit fixture that moves the volume into its own scratch makes no TMPDIR and states
141
+ * `Number.MAX_SAFE_INTEGER`, which survives JSON as Infinity does not.
142
+ */
143
+ leaseBytesMax: number;
79
144
  }
145
+ /**
146
+ * Where the volume of `user` in `namespace` lives and what it is called. Production's are the user's own: the per-user
147
+ * root `/private/var/folders/cowshed/<uid>`, the mountpoint `<root>/ram3` and staging directory `<root>/ram3-new` below
148
+ * it, the volume `smoo-ram3-<uid>` and its lock in `/private/tmp`. A test namespace's lie in the directory of its name
149
+ * below that root, `<root>/<ns>`: its mountpoint, staging directory and lock (`ram3.lock`) in it, and its name after
150
+ * the volume's (`smoo-ram3-<uid>-<ns>`), so none of its paths or names is production's.
151
+ */
80
152
  export declare function ramTempPaths(user: {
81
153
  uid: number;
82
- username: string;
83
- }): RamTempPaths;
84
- /** An attached RAM disk, as `hdiutil info` lists it. */
154
+ }, namespace: HostNamespace): RamTempPaths;
155
+ /** An APFS volume of a RAM disk, as the I/O Registry names it and the mount table places it. */
156
+ export interface RamVolume {
157
+ /** Its `FullName`. A volume is made under its final name and never renamed, so the name says whose it is. */
158
+ name: string;
159
+ /** Where it is mounted, if anywhere. */
160
+ mountpoints: string[];
161
+ }
162
+ /** An attached RAM disk, as the I/O Registry and the mount table show it. */
85
163
  export interface RamDisk {
86
- /** The whole disk (`/dev/diskN`): detaching it removes its container and volumes. */
87
- physical: string;
164
+ /** Its `IOHDIXHDDriveOutKernel` node's registry entry ID: no later disk has it, where a BSD name passes to the next. */
165
+ entry: string;
166
+ /**
167
+ * The whole disk (`/dev/diskN`): detaching it removes its container and volumes. Null while the disk has published
168
+ * no media yet, part way through its attach.
169
+ */
170
+ physical: string | null;
88
171
  sectors: number;
89
- /** Login name of the user that attached it. */
90
- user: string;
172
+ /** The uid that attached it. */
173
+ uid: number;
91
174
  /** Where its volumes are mounted, if anywhere. */
92
175
  mountpoints: string[];
176
+ /** Its APFS volumes, by the exact names the I/O Registry gives them: none before it is formatted. */
177
+ volumes: RamVolume[];
178
+ }
179
+ /** A RAM disk with its whole disk published, which a detach can name. */
180
+ export interface AttachedRamDisk extends RamDisk {
181
+ physical: string;
93
182
  }
94
183
  export interface RamTempLease {
95
184
  /** The task's TMPDIR: a directory on the volume that only this task uses. */
96
185
  directory: string;
97
186
  mountpoint: string;
98
- capacityBytes: number;
187
+ /**
188
+ * The attach of the volume the lease was taken on ({@link MountedVolume.attach}). A read of the mountpoint that finds
189
+ * another attach, or none, is not this lease's volume: its free space is some other filesystem's.
190
+ */
191
+ attach: string;
192
+ }
193
+ export interface RamUnavailable {
194
+ readonly kind: 'ram-unavailable';
195
+ readonly reason: 'gateway-unsupported' | 'gateway-absent' | 'unproven-owner';
196
+ readonly detail: string;
99
197
  }
100
198
  export type RamTempAcquisition =
101
199
  /**
102
200
  * `held`: dead leases that could not be reclaimed, each with what still holds it. `reaped`: the
103
- * processes of dead leases that were still working there and were stopped before the lease went.
201
+ * processes the supervisor retired from dead leases' recorded subtrees before those leases went,
202
+ * as `<pid> (<image>)`. `gaps`: where the supervisor's view of those subtrees may have missed one.
104
203
  */
105
204
  {
106
205
  kind: 'leased';
107
206
  lease: RamTempLease;
108
207
  held: string[];
109
208
  reaped: string[];
209
+ gaps: string[];
210
+ /** What became of each dead lease's scratch this acquire reclaimed: archived and kept, or deleted and why. */
211
+ retained: string[];
110
212
  }
111
213
  /** Inside a cowshed sandbox: /private/tmp is not writable and no image can attach. */
112
214
  | {
113
215
  kind: 'sandboxed';
114
216
  detail: string;
217
+ } | {
218
+ kind: 'unavailable';
219
+ reason: RamUnavailable['reason'];
220
+ detail: string;
115
221
  };
116
222
  /** A host command or filesystem step failed while the volume was being created, mounted or detached. */
117
223
  type ProvisionFailed = {
@@ -119,13 +225,37 @@ type ProvisionFailed = {
119
225
  step: string;
120
226
  detail: string;
121
227
  };
122
- export type RamTempError = ProvisionFailed
228
+ export type RamTempError = RamUnavailable | ProvisionFailed
123
229
  /** A failed task left the volume (nearly) full: the likely cause of its failure. */
124
230
  | {
125
231
  kind: 'volume-full';
126
232
  mountpoint: string;
127
233
  capacityBytes: number;
128
234
  freeBytes: number;
235
+ }
236
+ /** The lease went while its task held it: its volume was detached or replaced, or its directory removed. */
237
+ | {
238
+ kind: 'lease-lost';
239
+ lease: string;
240
+ mountpoint: string;
241
+ detail: string;
242
+ }
243
+ /**
244
+ * The root the volume mounts below, the per-user root or a test namespace's directory, is missing or is not the
245
+ * user's 0700 directory.
246
+ */
247
+ | {
248
+ kind: 'root-unready';
249
+ root: string;
250
+ detail: string;
251
+ }
252
+ /** The lease this caller would make is longer than its layout admits: refused before anything is made. */
253
+ | {
254
+ kind: 'lease-path-budget';
255
+ mountpoint: string;
256
+ pid: number;
257
+ bytes: number;
258
+ most: number;
129
259
  };
130
260
  export type Result<T, E> = {
131
261
  ok: true;
@@ -135,54 +265,203 @@ export type Result<T, E> = {
135
265
  error: E;
136
266
  };
137
267
  export declare function describeRamTempError(error: RamTempError): string;
268
+ /** Settles once every archive deletion this process has queued so far has finished; a test seam, and the detach's wait. */
269
+ export declare function archiveDeletions(): Promise<void>;
138
270
  export declare class RamTempVolume {
139
271
  private readonly paths;
140
- private readonly capacityBytes;
141
272
  private readonly commands;
142
273
  private readonly pid;
143
274
  private readonly isAlive;
144
- private readonly processes;
275
+ private readonly policy;
145
276
  /** The RAM disk's size, which with the attaching user identifies this module's disks on the host. */
146
277
  private readonly sectors;
147
278
  /** The claims and held verdicts the lock admits changes to, beside the lock file. */
148
279
  private readonly ledgerPath;
149
- constructor(paths: RamTempPaths, capacityBytes: number, commands: HostCommands, pid?: number, isAlive?: (pid: number) => boolean, processes?: LeaseProcesses);
150
- /** Take a lease: create the volume if no task holds one, and a private directory on it. */
151
- acquire(): Promise<Result<RamTempAcquisition, RamTempError>>;
280
+ /**
281
+ * Where optional RAM's ordinary fallback makes its owned scratch: the lock's own directory, which an unavailable answer
282
+ * has just written. For the user's volume that is `/private/tmp`, outside every checkout, so no Git or Cargo walk from
283
+ * the command's temp files finds the workspace it builds; the workspace's runtime alias resolves into
284
+ * `<mount>/.cowshed/run`, inside the checkout, and the inherited TMPDIR may be RAM. A test namespace's lock lies in
285
+ * its own root, so its ordinary scratch does too.
286
+ */
287
+ readonly ordinaryParent: string;
288
+ constructor(paths: RamTempPaths, capacityBytes: number, commands: HostCommands, pid?: number, isAlive?: (pid: number) => boolean, policy?: 'required' | 'optional');
289
+ /**
290
+ * Take a lease: create the volume if no task holds one, and a private directory on it. A dead
291
+ * lease found on the way is settled through `subtrees`, the supervisor that owns the caller.
292
+ */
293
+ acquire(subtrees: SubtreeOwner): Promise<Result<RamTempAcquisition, RamTempError>>;
294
+ /** Make a lease directory for `op`'s caller, recorded so a failed acquire takes it back. */
152
295
  private make;
296
+ /**
297
+ * Undo a failed acquire: take back the lease made for it, which may have been the volume's last
298
+ * with every release already past it, so then detach the volume as the last release would have.
299
+ * Answers what failed on the way.
300
+ */
153
301
  private undo;
302
+ /**
303
+ * Take back the lease made for a caller that never got it. No task has used it, so it is empty:
304
+ * `rmdir` removes only that, follows no link, and refuses a directory with a mount on it. A
305
+ * directory that is no longer the one made, by identity, is left where it is and named.
306
+ */
154
307
  private unmake;
155
308
  private lease;
309
+ /** With this caller's creation claim published: provision the volume, then take the first lease on it. */
156
310
  private create;
157
311
  /**
158
- * Stop what the task left working in its lease, before the lease ends: the processes whose
159
- * working directory is in it and everything they started, answered as `<pid> (<command>)`.
160
- * Runs outside the volume's lock, which one lease's leftovers must not hold up the others
161
- * behind, and costs a scan of every process only when the lease still holds anything.
312
+ * Record the supervisor's handle on the subtree whose command uses `lease`, beside the lease, so
313
+ * that if this task dies before it retires that subtree, whoever settles the dead lease can hand
314
+ * the handle back to the supervisor instead of guessing from a census who worked there.
162
315
  */
163
- reap(lease: RamTempLease): Promise<Result<string[], RamTempError>>;
164
- /** End a lease; the last lease detaches the volume, returning its RAM. */
165
- release(lease: RamTempLease): Promise<Result<void, RamTempError>>;
316
+ record(lease: RamTempLease, handle: SubtreeHandle): Promise<Result<void, RamTempError>>;
317
+ /**
318
+ * End a lease; the last lease detaches the volume, returning its RAM. `keep` archives the lease's scratch instead of
319
+ * deleting it: its run did not pass. A dead lease found on the way is settled through `subtrees`. Answers what became
320
+ * of every scratch this release reclaimed, its own included.
321
+ */
322
+ release(lease: RamTempLease, keep: boolean, subtrees: SubtreeOwner): Promise<Result<string[], RamTempError>>;
166
323
  private releaseLease;
324
+ /**
325
+ * Wait out another caller's creation or detach. Liveness of its owner is its pid's, so a crashed
326
+ * owner whose pid was reused holds every caller here; past each `CLAIM_WAIT_NOTICE_MS` on the same
327
+ * claim, stderr names it with the wait so far.
328
+ */
167
329
  private waitOut;
168
- /** After a failed task: whether the volume ran out of space, which is then the error to report. */
330
+ /**
331
+ * After a failed task: whether the volume ran out of space, which is then the error to report. A lease no longer on
332
+ * its volume is said by its release, and a volume that cannot be read has no space to report.
333
+ */
169
334
  fullness(lease: RamTempLease): Promise<RamTempError | null>;
170
- /** The lease's volume and the space left on it now; `null` when the volume cannot be read. */
171
- space(lease: RamTempLease): Promise<TempVolumeSpace | null>;
335
+ /**
336
+ * The lease's volume and the space left on it now, measured only while the mountpoint holds the attach the lease was
337
+ * taken on and the lease is still on it: a bare mountpoint's statfs reads the host's Data volume, whose free space is
338
+ * not the lease's. A lease that went with its volume, or from it, is `lost`; a read that failed is `unread`.
339
+ */
340
+ space(lease: RamTempLease): Promise<TempVolumeSpace>;
172
341
  private lock;
342
+ /**
343
+ * Yield to another caller's lifecycle claim. Every claim is queued behind, a detach whose live caller still waits on
344
+ * its facade included. Reported custody, or waiting custody whose caller died, admits nothing until its exact
345
+ * registry entry is gone: the caller's liveness only chooses between queueing and reporting, never clears custody.
346
+ */
347
+ private yieldTo;
348
+ /** A detach nobody waits on any more can be reconciled only against its exact registry identity, outside the lock. */
349
+ private reconcileDetach;
350
+ /** Publish authority before spawn: a crash anywhere after this point must not admit a lease past the detach. */
351
+ private runDetach;
352
+ /** Only this operation's exact terminal receipt can clear its pending authority; a late receipt cannot clear a successor. */
353
+ private finishDetach;
354
+ /** Its caller stops waiting on the detach: the exact custody becomes reported, its facade pid kept for diagnosis. */
355
+ private reportDetach;
356
+ /** Drop finished claims, never the authority of a detach whose caller merely stopped waiting. */
173
357
  private end;
358
+ /**
359
+ * One step under the lock: read the ledger, void the claims of dead owners and the verdicts of
360
+ * another volume or a lease that is gone, observe the volume, and publish what `change` returns.
361
+ * `change` reads metadata and takes or names directories; it runs no host command.
362
+ */
174
363
  private locked;
364
+ /** The ledger as published, and its text; none yet is an empty one. Only this module writes it, whole. */
175
365
  private readLedger;
366
+ /**
367
+ * The volume when it is mounted at the mountpoint, identified by its marker; else null. Its key
368
+ * names this attach: the root's and the marker's identity and birth, and the marker's change
369
+ * time, which nothing changes once it is written. The root's own times change with every lease.
370
+ */
176
371
  private observe;
372
+ /** Prove this immutable marker belongs to the exact live attachment, outside the lock. */
373
+ private validateProvenance;
374
+ /** Capture only the exact whole disk this attach answered, before any filesystem mutation. */
375
+ private attachedIdentity;
376
+ /**
377
+ * Under the lock: claim `own`, the caller's ending lease if any, and every dead lease no other
378
+ * caller is settling. A dead lease whose cached verdict still validates is named held and left
379
+ * unclaimed: that proof costs `lstat` calls, not a host-wide probe, so no caller waits on it.
380
+ */
177
381
  private claim;
382
+ /**
383
+ * Outside the lock: settle the leases this caller claimed. Every dead one's recorded subtree is
384
+ * handed back to the supervisor first, and only then is the pass's one inventory read, so no
385
+ * inventory older than a lease's retirement approves its removal. Anything attached from below a
386
+ * lease keeps it: an image backed by a file there would be left pinned to a deleted file, and
387
+ * detaching it here would race the owner that releases it under its own lease; a mount there is
388
+ * backed elsewhere — a cowshed workspace adopted from a fixture checkout, say — and `rm -r` would
389
+ * delete its contents through the mount. A kept lease gets a verdict to publish, when its
390
+ * holders have cheap lifetime keys. A lease nothing holds is reclaimed once the lock confirms it
391
+ * is as claimed: a kept one's scratch is renamed into the archive (`retain`), any other deleted.
392
+ */
178
393
  private settle;
394
+ /**
395
+ * Keep the newest {@link ARCHIVES_KEPT} archives while at least {@link ARCHIVE_FLOOR_SHARE} of the volume is free, and
396
+ * none below that; rename every other one out of the archive and delete it in the background. Answers, for each lease
397
+ * just archived, where its scratch is kept or why it was not. The floor is read once, here, as an archive arrives.
398
+ */
399
+ private retain;
400
+ /**
401
+ * Queue the deletion of the archives this process renamed out, and of any a dead deleter left, behind this process's
402
+ * earlier ones. Nothing waits for it. A failure is said on stderr and leaves its entry for the next deleter.
403
+ */
404
+ private deleteArchives;
405
+ private emptyDeleting;
406
+ /**
407
+ * Under the lock: the claimed leases still as claimed — this caller's claim on the same
408
+ * directory, and a task still gone. Any other is left for a fresh look, never removed.
409
+ */
179
410
  private unchanged;
411
+ /** Check the root the volume mounts below, detach what earlier creators left, then attach and provision the volume. */
180
412
  private provisionVolume;
413
+ /**
414
+ * Provision the leased disk, record it in the ledger as the kept volume's disk, and keep it once its volume is mounted
415
+ * and marked at its mountpoint. A record whose keep then fails names a disk the rollback detaches.
416
+ */
417
+ private provisionAndKeep;
418
+ /**
419
+ * End the lease of a volume that failed. The gateway detaches the disk on release, by its registry entry and without
420
+ * force, so a busy owned staging volume is retained. A lease lost to a gateway restart answers no release: this caller
421
+ * then detaches the exact disk itself, under its ledger's custody, so no later lease is admitted on a disk the next
422
+ * gateway's startup scan removes.
423
+ */
424
+ private rollBack;
425
+ /**
426
+ * Create the volume under its final name, mount it with `mount_apfs` at the private staging
427
+ * directory, and mark it there. Then `umount` that private mount and mount the volume with
428
+ * `mount_apfs` again at the mountpoint, after the marker, so the volume never reaches the
429
+ * mountpoint unmarked. Nothing is renamed (see the module comment). The staging mount is the
430
+ * kernel's, so the kernel releases it: a Disk Arbitration unmount waits in its one queue behind
431
+ * its own probe of the fresh RAM disk (5.1 s for the `zfs` probe alone in `log stream`;
432
+ * 6.5–6.7 s per unmount against 64–69 ms for `umount`, measured 2026-10-15). A crash before
433
+ * the final mount leaves the volume attached at the staging directory or unmounted; the next
434
+ * creator's reclaim detaches either.
435
+ */
181
436
  private provision;
182
437
  private expectMounted;
438
+ /**
439
+ * This volume's RAM disks attached on the host, read from the I/O Registry, which omits no attached disk: the ones
440
+ * `volumeDisks` names. A RAM disk of this user and size that is not this volume's, another volume's, a test's, or an
441
+ * unformatted one nothing recorded, is not its to inventory or detach, and is ignored. One of its own still
442
+ * publishing its media is named, never passed over.
443
+ */
183
444
  private attached;
445
+ /**
446
+ * The registry entries the ledger records: the one it keeps pending detach custody of, exact and published before the
447
+ * spawn, and the disk whose volume a creator last kept.
448
+ */
449
+ private custody;
450
+ /**
451
+ * Detach what earlier creators left attached: no marked volume is mounted, so every RAM disk of this volume
452
+ * (`attached`: by its exact name or its exact record) is debris — unformatted and recorded, staged, mounted
453
+ * without its marker, or the kept volume's disk an operator's unmount left mounted nowhere. One carrying a lease, or
454
+ * with anything attached below it, is still in use and stops the creation instead, and so does one its owner holds no
455
+ * receipt for and its ledger does not record as kept: it is named, never detached.
456
+ */
184
457
  private reclaimStrays;
458
+ /**
459
+ * With this caller's detach claim published, which no caller takes a lease past. Every lease is
460
+ * gone, so nothing below the volume should be attached; whatever is would lose its backing file
461
+ * to the detach. The lock confirms the volume, still empty, and the claim before it goes.
462
+ */
185
463
  private detach;
464
+ /** The host's attachments as one pass reads them: one `ioreg` run and one `mount` run. */
186
465
  private readInventory;
187
466
  /**
188
467
  * The holder check of one creation pass. The first check reads the attachments and every later
@@ -203,22 +482,38 @@ export declare function mountsBelow(table: string, prefix: string): string[];
203
482
  /** The disk `diskutil apfs` reports it created: "Disk from APFS operation: disk271". */
204
483
  export declare function operationDisk(stdout: string): string | null;
205
484
  /**
206
- * The RAM disks in `hdiutil info` output. Images are separated by a row of `=`; a RAM disk's
207
- * `image-path` is `ram://<sectors>`, and its entity rows are `<dev>\t<content hint>\t<mountpoint>`,
208
- * the whole disk first.
485
+ * The RAM disks in `ioreg -r -c IOHDIXHDDriveOutKernel -l -w0` output, with the mounts `mount` output gives them. A RAM
486
+ * disk is a legacy DiskImages device served by a diskimages-helper: each starts a `+-o IOHDIXHDDriveOutKernel` entry
487
+ * whose own properties carry `image-path` <"ram://<sectors>"> and `owner-uid`, and the `BSD Name`s below it are its
488
+ * whole disk first, then its APFS container and volumes; each volume node carries its `FullName` beside its `BSD Name`,
489
+ * which is how a volume's name reaches its mounts. The registry is the kernel's record, and unlike `hdiutil info`,
490
+ * which drops images while another attaches or detaches, it leaves out no attached disk. So an entry this cannot read
491
+ * is an error, never a disk left out: a partial read must not stand for an absent disk.
209
492
  */
210
- export declare function ramDisksIn(info: string): RamDisk[];
493
+ export declare function ramDisksIn(registry: string, table: string): Result<RamDisk[], string>;
494
+ /**
495
+ * The RAM disks of `disks` that are this volume's, and no others. A disk is the volume's only when it has its user and
496
+ * its exact size, mounts nowhere but at its mountpoint or staging directory, and either carries a volume called exactly
497
+ * its name that is mounted, or is recorded: `recorded` says the disk's exact registry entry is one this volume's owner
498
+ * holds a receipt or its ledger holds custody for, which covers an attach whose format never finished, or records as
499
+ * the disk a creator kept, which covers a volume unmounted from under it. A disk's size and owner establish nothing, so
500
+ * an unmounted disk of the same size that nothing recorded is not the volume's.
501
+ */
502
+ export declare function volumeDisks(disks: readonly RamDisk[], paths: Pick<RamTempPaths, 'uid' | 'mountpoint' | 'staging' | 'volumeName'>, sectors: number, recorded: (disk: RamDisk) => boolean): RamDisk[];
503
+ /**
504
+ * Detach a RAM disk an inventory found, by its whole-disk name, bound to the registry entry the inventory read it as.
505
+ * A BSD name passes to the next disk once its disk goes, and a detach can queue for the disk admission meanwhile, so
506
+ * the gateway reads the entry again inside its own admission, immediately before it spawns `hdiutil`, and
507
+ * refuses, detaching nothing, unless the entry still names this whole disk (specs/cowshed/06_cli.md, `--registry-entry`).
508
+ * That refusal is this detach's failure, named, and never retried with `-force`: this process did not just attach the
509
+ * disk. The window that remains is cowshed's, from its read to hdiutil's own open of the name.
510
+ */
511
+ export declare function detachRamDisk(commands: Pick<HostCommands, 'detachRam'>, disk: AttachedRamDisk, step: string): Promise<Result<void, ProvisionFailed>>;
211
512
  /** Disk tools delegate their lease and process lifetime to cowshed, with one image policy. */
212
- export declare function diskCommand(file: string, args: readonly string[], deadlineMs: number): {
513
+ export declare function diskCommand(file: string, args: readonly string[], deadlineMs: number, binding?: DetachBinding, gatewaySocket?: string): {
213
514
  args: string[];
214
515
  lifetime: 'stop-wait' | 'facade-owned';
215
516
  } | null;
216
- /**
217
- * The variable naming the cowshed executable that runs `cowshed disk-command`. Unset, it is the installed `cowshed`
218
- * on PATH. A repository that tests its own cowshed sets it, on the targets that test it, to that checkout's build:
219
- * an installed cowshed that predates a command its own checkout added would fail the very code under test.
220
- */
221
- export declare const COWSHED_EXECUTABLE_ENV = "COWSHED_EXECUTABLE";
222
517
  /**
223
518
  * hdiutil and diskutil delegate process lifetime and disk leasing to cowshed: safe commands
224
519
  * pass their total budget and wait for the facade's actual exit after child reap. Only image
@@ -226,7 +521,12 @@ export declare const COWSHED_EXECUTABLE_ENV = "COWSHED_EXECUTABLE";
226
521
  * device until reboot. Never acquire a second lease around the facade. Other leased helpers
227
522
  * take their lease here. Recorded lease waits ask for `alone`; an older gateway is asked
228
523
  * shared at once, and for a minute after.
524
+ *
525
+ * `gatewaySocket` is the gateway every disk lease, facade admission and RAM attach and detach goes through. It has no
526
+ * default: the caller names it. The Nx executor names the host's own, `GATEWAY_SOCKET`, which `disk-command` defaults
527
+ * to, so the facade is not told of it and a cowshed that predates `--gateway-socket` still serves it. A host proof
528
+ * names its fixture's, which the facade is told of.
229
529
  */
230
- export declare function createHostCommands(defaultDeadlineMs?: number, gatewaySocket?: string, wantedShare?: PhaseShare, cowshed?: string): HostCommands;
530
+ export declare function createHostCommands(gatewaySocket: string, defaultDeadlineMs?: number, wantedShare?: PhaseShare, cowshed?: string): HostCommands;
231
531
  export {};
232
532
  //# sourceMappingURL=ram-temp.d.ts.map