@smoothbricks/nx-plugin 0.5.7 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (432) hide show
  1. package/README.md +1086 -360
  2. package/dist/.build-inputs.json +138 -0
  3. package/dist/bin/smoo-nx-cargo-toolchain.d.ts +3 -0
  4. package/dist/bin/smoo-nx-cargo-toolchain.d.ts.map +1 -0
  5. package/dist/bin/smoo-nx-cargo-toolchain.js +8 -0
  6. package/dist/bin/smoo-nx-forbidden-spellings.d.ts +3 -0
  7. package/dist/bin/smoo-nx-forbidden-spellings.d.ts.map +1 -0
  8. package/dist/bin/smoo-nx-forbidden-spellings.js +32 -0
  9. package/dist/bin/smoo-nx-nextest-timings.d.ts +3 -0
  10. package/dist/bin/smoo-nx-nextest-timings.d.ts.map +1 -0
  11. package/dist/bin/smoo-nx-nextest-timings.js +28 -0
  12. package/dist/bounded-test-policy.d.ts +1 -1
  13. package/dist/bounded-test-policy.d.ts.map +1 -1
  14. package/dist/bounded-test-policy.js +14 -15
  15. package/dist/build-state-output-policy.d.ts +95 -1
  16. package/dist/build-state-output-policy.d.ts.map +1 -1
  17. package/dist/build-state-output-policy.js +368 -30
  18. package/dist/bun-lock-scope.d.ts +44 -0
  19. package/dist/bun-lock-scope.d.ts.map +1 -0
  20. package/dist/bun-lock-scope.js +97 -0
  21. package/dist/cargo-build-script-env.d.ts +49 -0
  22. package/dist/cargo-build-script-env.d.ts.map +1 -0
  23. package/dist/cargo-build-script-env.js +324 -0
  24. package/dist/cargo-closure-input.d.ts +31 -4
  25. package/dist/cargo-closure-input.d.ts.map +1 -1
  26. package/dist/cargo-closure-input.js +66 -6
  27. package/dist/cargo-retention-hook.d.ts +17 -0
  28. package/dist/cargo-retention-hook.d.ts.map +1 -0
  29. package/dist/cargo-retention-hook.js +85 -0
  30. package/dist/cargo-source-hash.d.ts +25 -7
  31. package/dist/cargo-source-hash.d.ts.map +1 -1
  32. package/dist/cargo-source-hash.js +108 -43
  33. package/dist/cargo-toolchain-paths.d.ts +40 -0
  34. package/dist/cargo-toolchain-paths.d.ts.map +1 -0
  35. package/dist/cargo-toolchain-paths.js +84 -0
  36. package/dist/cargo-toolchain-policy.d.ts +25 -8
  37. package/dist/cargo-toolchain-policy.d.ts.map +1 -1
  38. package/dist/cargo-toolchain-policy.js +39 -5
  39. package/dist/cargo-workspace.d.ts +10 -4
  40. package/dist/cargo-workspace.d.ts.map +1 -1
  41. package/dist/cargo-workspace.js +65 -95
  42. package/dist/cross-check-policy.d.ts +9 -9
  43. package/dist/cross-check-policy.d.ts.map +1 -1
  44. package/dist/cross-check-policy.js +11 -11
  45. package/dist/disk-command-policy.d.ts.map +1 -1
  46. package/dist/disk-command-policy.js +1 -0
  47. package/dist/ensure-built-receipt.d.ts +13 -5
  48. package/dist/ensure-built-receipt.d.ts.map +1 -1
  49. package/dist/ensure-built-receipt.js +126 -47
  50. package/dist/ensure-built-witness.d.ts +27 -8
  51. package/dist/ensure-built-witness.d.ts.map +1 -1
  52. package/dist/ensure-built-witness.js +45 -15
  53. package/dist/ensure-built.d.ts.map +1 -1
  54. package/dist/ensure-built.js +9 -1
  55. package/dist/eslint-config-closure.d.ts +7 -0
  56. package/dist/eslint-config-closure.d.ts.map +1 -0
  57. package/dist/eslint-config-closure.js +346 -0
  58. package/dist/executors/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.d.ts +33 -36
  62. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
  63. package/dist/executors/bounded-exec/cpu-pool.js +54 -119
  64. package/dist/executors/bounded-exec/executor.d.ts +19 -12
  65. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  66. package/dist/executors/bounded-exec/executor.js +371 -239
  67. package/dist/executors/bounded-exec/gateway-lease.d.ts +22 -19
  68. package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
  69. package/dist/executors/bounded-exec/gateway-lease.js +81 -28
  70. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
  71. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
  72. package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
  73. package/dist/executors/bounded-exec/lease-wait.d.ts +43 -0
  74. package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
  75. package/dist/executors/bounded-exec/lease-wait.js +68 -0
  76. package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
  77. package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
  78. package/dist/executors/bounded-exec/lock-wait.js +108 -0
  79. package/dist/executors/bounded-exec/owned-subtree.d.ts +84 -0
  80. package/dist/executors/bounded-exec/owned-subtree.d.ts.map +1 -0
  81. package/dist/executors/bounded-exec/owned-subtree.js +178 -0
  82. package/dist/executors/bounded-exec/progress.d.ts +4 -1
  83. package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
  84. package/dist/executors/bounded-exec/progress.js +5 -2
  85. package/dist/executors/bounded-exec/ram-attach.d.ts +19 -0
  86. package/dist/executors/bounded-exec/ram-attach.d.ts.map +1 -0
  87. package/dist/executors/bounded-exec/ram-attach.js +207 -0
  88. package/dist/executors/bounded-exec/ram-detach.d.ts +25 -0
  89. package/dist/executors/bounded-exec/ram-detach.d.ts.map +1 -0
  90. package/dist/executors/bounded-exec/ram-detach.js +207 -0
  91. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +76 -0
  92. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -1
  93. package/dist/executors/bounded-exec/ram-temp-fixtures.js +296 -0
  94. package/dist/executors/bounded-exec/ram-temp.d.ts +388 -88
  95. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
  96. package/dist/executors/bounded-exec/ram-temp.js +1213 -399
  97. package/dist/executors/bounded-exec/run-cpu-pool.d.ts +4 -4
  98. package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
  99. package/dist/executors/bounded-exec/run-cpu-pool.js +20 -30
  100. package/dist/executors/bounded-exec/runner-hook.js +14 -5
  101. package/dist/executors/bounded-exec/runner-lifecycle.d.ts +14 -1
  102. package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
  103. package/dist/executors/bounded-exec/runner-lifecycle.js +27 -6
  104. package/dist/executors/bounded-exec/{cpu-tokens.d.ts → runner-sizing.d.ts} +14 -42
  105. package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -0
  106. package/dist/executors/bounded-exec/{cpu-tokens.js → runner-sizing.js} +5 -35
  107. package/dist/executors/bounded-exec/runtime-pin.d.ts +73 -0
  108. package/dist/executors/bounded-exec/runtime-pin.d.ts.map +1 -0
  109. package/dist/executors/bounded-exec/runtime-pin.js +167 -0
  110. package/dist/executors/bounded-exec/schema.d.ts +18 -1
  111. package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
  112. package/dist/executors/bounded-exec/verdict.d.ts +40 -11
  113. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  114. package/dist/executors/bounded-exec/verdict.js +88 -19
  115. package/dist/executors/cargo-zigbuild/executor.d.ts +21 -0
  116. package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
  117. package/dist/executors/cargo-zigbuild/executor.js +67 -12
  118. package/dist/executors/clean-outputs/executor.js +1 -0
  119. package/dist/executors/scriptc-native/executor.d.ts +79 -0
  120. package/dist/executors/scriptc-native/executor.d.ts.map +1 -0
  121. package/dist/executors/scriptc-native/executor.js +367 -0
  122. package/dist/executors/scriptc-native/ffi-paths.d.ts +9 -0
  123. package/dist/executors/scriptc-native/ffi-paths.d.ts.map +1 -0
  124. package/dist/executors/scriptc-native/ffi-paths.js +25 -0
  125. package/dist/executors/scriptc-native/schema.d.ts +34 -0
  126. package/dist/executors/scriptc-native/schema.d.ts.map +1 -0
  127. package/dist/executors/scriptc-native/schema.js +1 -0
  128. package/dist/executors/typescript-emit/executor.d.ts +3 -1
  129. package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
  130. package/dist/executors/typescript-emit/executor.js +164 -33
  131. package/dist/forbidden-spelling-policy.d.ts +56 -0
  132. package/dist/forbidden-spelling-policy.d.ts.map +1 -0
  133. package/dist/forbidden-spelling-policy.js +176 -0
  134. package/dist/generators/create-package/generator.d.ts.map +1 -1
  135. package/dist/generators/create-package/generator.js +3 -4
  136. package/dist/graph-input-contract.d.ts +14 -0
  137. package/dist/graph-input-contract.d.ts.map +1 -1
  138. package/dist/graph-input-contract.js +67 -2
  139. package/dist/index.d.ts +23 -6
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js +672 -214
  142. package/dist/managed-assets.d.ts +2 -0
  143. package/dist/managed-assets.d.ts.map +1 -1
  144. package/dist/managed-files/files.d.ts +3 -3
  145. package/dist/managed-files/files.d.ts.map +1 -1
  146. package/dist/managed-files/files.js +28 -3
  147. package/dist/managed-files/managed-format.d.ts.map +1 -1
  148. package/dist/managed-files/managed-format.js +1 -0
  149. package/dist/nextest-code-bound.js +1 -0
  150. package/dist/nextest-timings.d.ts +35 -0
  151. package/dist/nextest-timings.d.ts.map +1 -0
  152. package/dist/nextest-timings.js +168 -0
  153. package/dist/owned-installation.d.ts +6 -5
  154. package/dist/owned-installation.d.ts.map +1 -1
  155. package/dist/owned-installation.js +150 -26
  156. package/dist/package-target-policy.d.ts.map +1 -1
  157. package/dist/package-target-policy.js +2 -3
  158. package/dist/process-children.d.ts +7 -0
  159. package/dist/process-children.d.ts.map +1 -0
  160. package/dist/process-children.darwin.d.ts +7 -0
  161. package/dist/process-children.darwin.d.ts.map +1 -0
  162. package/dist/process-children.darwin.js +13 -0
  163. package/dist/process-children.js +14 -0
  164. package/dist/process-children.linux.d.ts +8 -0
  165. package/dist/process-children.linux.d.ts.map +1 -0
  166. package/dist/process-children.linux.js +25 -0
  167. package/dist/process-group.d.ts +108 -0
  168. package/dist/process-group.d.ts.map +1 -0
  169. package/dist/process-group.js +171 -0
  170. package/dist/process-listing.d.ts +7 -0
  171. package/dist/process-listing.d.ts.map +1 -0
  172. package/dist/process-listing.js +51 -0
  173. package/dist/producer-receipts.d.ts +8 -2
  174. package/dist/producer-receipts.d.ts.map +1 -1
  175. package/dist/producer-receipts.js +75 -48
  176. package/dist/task-graph-policy.d.ts +21 -0
  177. package/dist/task-graph-policy.d.ts.map +1 -0
  178. package/dist/task-graph-policy.js +91 -0
  179. package/dist/test-timings.js +4 -4
  180. package/dist/test-walk-policy.d.ts +14 -5
  181. package/dist/test-walk-policy.d.ts.map +1 -1
  182. package/dist/test-walk-policy.js +8 -2
  183. package/dist/testing.d.ts +73 -28
  184. package/dist/testing.d.ts.map +1 -1
  185. package/dist/testing.js +217 -223
  186. package/dist/tool-bins.d.ts +33 -0
  187. package/dist/tool-bins.d.ts.map +1 -0
  188. package/dist/tool-bins.js +72 -0
  189. package/dist/typecheck-test-policy.d.ts.map +1 -1
  190. package/dist/typecheck-test-policy.js +3 -4
  191. package/dist/wait-why-policy.d.ts +28 -0
  192. package/dist/wait-why-policy.d.ts.map +1 -0
  193. package/dist/wait-why-policy.js +223 -0
  194. package/dist/workspace-config-policy.d.ts +14 -8
  195. package/dist/workspace-config-policy.d.ts.map +1 -1
  196. package/dist/workspace-config-policy.js +60 -16
  197. package/dist/workspace-manifest.d.ts +41 -6
  198. package/dist/workspace-manifest.d.ts.map +1 -1
  199. package/dist/workspace-manifest.js +57 -0
  200. package/executors.json +16 -1
  201. package/loader.js +2 -0
  202. package/managed/raw/envrc +11 -0
  203. package/managed/raw/patches/nx@23.2.1.patch +2840 -199
  204. package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
  205. package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
  206. package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
  207. package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
  208. package/managed/raw/tooling/direnv/developer-links.ts +464 -25
  209. package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
  210. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
  211. package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
  212. package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
  213. package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
  214. package/managed/raw/tooling/direnv/repo-path +68 -6
  215. package/managed/raw/tooling/direnv/secret-references.ts +13 -4
  216. package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
  217. package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
  218. package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
  219. package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
  220. package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
  221. package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
  222. package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
  223. package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
  224. package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
  225. package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
  226. package/package.json +77 -13
  227. package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
  228. package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
  229. package/src/bin/smoo-nx-nextest-timings.ts +31 -0
  230. package/src/bounded-test-policy.ts +12 -14
  231. package/src/build-state-output-policy.ts +458 -34
  232. package/src/bun-lock-scope.ts +108 -0
  233. package/src/cargo-build-script-env.ts +265 -0
  234. package/src/cargo-closure-input.ts +74 -7
  235. package/src/cargo-retention-hook.ts +94 -0
  236. package/src/cargo-source-hash.ts +138 -41
  237. package/src/cargo-toolchain-paths.ts +95 -0
  238. package/src/cargo-toolchain-policy.ts +49 -5
  239. package/src/cargo-workspace.ts +72 -123
  240. package/src/cross-check-policy.ts +12 -10
  241. package/src/disk-command-policy.ts +1 -0
  242. package/src/ensure-built-receipt.ts +132 -39
  243. package/src/ensure-built-witness.ts +62 -10
  244. package/src/ensure-built.ts +11 -1
  245. package/src/eslint-config-closure.ts +357 -0
  246. package/src/executors/bounded-exec/bounds.ts +76 -0
  247. package/src/executors/bounded-exec/cpu-pool.ts +51 -117
  248. package/src/executors/bounded-exec/executor.ts +423 -259
  249. package/src/executors/bounded-exec/gateway-lease.ts +82 -33
  250. package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
  251. package/src/executors/bounded-exec/lease-wait.ts +89 -0
  252. package/src/executors/bounded-exec/lock-wait.ts +141 -0
  253. package/src/executors/bounded-exec/owned-subtree.ts +235 -0
  254. package/src/executors/bounded-exec/progress.ts +9 -3
  255. package/src/executors/bounded-exec/ram-attach.ts +238 -0
  256. package/src/executors/bounded-exec/ram-detach.ts +226 -0
  257. package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
  258. package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
  259. package/src/executors/bounded-exec/ram-temp.ts +1497 -460
  260. package/src/executors/bounded-exec/run-cpu-pool.ts +22 -30
  261. package/src/executors/bounded-exec/runner-hook.ts +14 -6
  262. package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
  263. package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
  264. package/src/executors/bounded-exec/runtime-pin.ts +232 -0
  265. package/src/executors/bounded-exec/schema.json +11 -2
  266. package/src/executors/bounded-exec/schema.ts +19 -1
  267. package/src/executors/bounded-exec/verdict.ts +137 -34
  268. package/src/executors/cargo-zigbuild/executor.ts +82 -8
  269. package/src/executors/clean-outputs/executor.ts +1 -0
  270. package/src/executors/scriptc-native/executor.ts +394 -0
  271. package/src/executors/scriptc-native/ffi-paths.ts +29 -0
  272. package/src/executors/scriptc-native/schema.json +60 -0
  273. package/src/executors/scriptc-native/schema.ts +34 -0
  274. package/src/executors/typescript-emit/executor.ts +205 -38
  275. package/src/forbidden-spelling-policy.ts +226 -0
  276. package/src/generators/create-package/generator.ts +7 -7
  277. package/src/graph-input-contract.ts +61 -2
  278. package/src/index.ts +788 -224
  279. package/src/managed-assets.ts +3 -0
  280. package/src/managed-files/files.ts +28 -3
  281. package/src/managed-files/managed-format.ts +1 -0
  282. package/src/nextest-code-bound.ts +1 -0
  283. package/src/nextest-timings.ts +106 -0
  284. package/src/owned-installation.ts +150 -23
  285. package/src/package-target-policy.ts +2 -3
  286. package/src/process-children.darwin.ts +14 -0
  287. package/src/process-children.linux.ts +33 -0
  288. package/src/process-children.ts +22 -0
  289. package/src/process-group.ts +209 -0
  290. package/src/process-listing.ts +54 -0
  291. package/src/producer-receipts.ts +68 -45
  292. package/src/task-graph-policy.ts +98 -0
  293. package/src/test-walk-policy.ts +23 -8
  294. package/src/testing.ts +240 -232
  295. package/src/tool-bins.ts +108 -0
  296. package/src/typecheck-test-policy.ts +2 -3
  297. package/src/wait-why-policy.ts +226 -0
  298. package/src/workspace-config-policy.ts +63 -15
  299. package/src/workspace-manifest.ts +89 -6
  300. package/test-timings.json +122 -98
  301. package/dist/bin/smoo-nx-failures.d.ts +0 -3
  302. package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
  303. package/dist/bin/smoo-nx-failures.js +0 -3
  304. package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
  305. package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
  306. package/dist/bin/smoo-nx-nextest-extract.js +0 -42
  307. package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
  308. package/dist/failure-summary.d.ts +0 -5
  309. package/dist/failure-summary.d.ts.map +0 -1
  310. package/dist/failure-summary.js +0 -118
  311. package/dist/nextest-extraction.d.ts +0 -117
  312. package/dist/nextest-extraction.d.ts.map +0 -1
  313. package/dist/nextest-extraction.js +0 -303
  314. package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
  315. package/src/__tests__/cargo-closure-filesets.ts +0 -94
  316. package/src/__tests__/cargo-closure-fixture.ts +0 -113
  317. package/src/__tests__/counted-cargo-process.ts +0 -286
  318. package/src/__tests__/counted-cargo.ts +0 -713
  319. package/src/__tests__/directory-change.ts +0 -27
  320. package/src/__tests__/fixture-cargo-home.ts +0 -36
  321. package/src/__tests__/fixture-nx-env.ts +0 -193
  322. package/src/__tests__/owned-installation.ts +0 -13
  323. package/src/__tests__/past-tick.ts +0 -12
  324. package/src/__tests__/progress-clock.ts +0 -43
  325. package/src/__tests__/runtime-input.ts +0 -23
  326. package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
  327. package/src/bin/smoo-nx-failures.ts +0 -4
  328. package/src/bin/smoo-nx-nextest-extract.ts +0 -44
  329. package/src/bounded-test-policy.test.ts +0 -1029
  330. package/src/build-state-output-policy.test.ts +0 -115
  331. package/src/bun-bootstrap.test.ts +0 -102
  332. package/src/bun-file-packages.test.ts +0 -47
  333. package/src/cargo-closure-filesets.test.ts +0 -63
  334. package/src/cargo-closure-input.property.test.ts +0 -50
  335. package/src/cargo-closure-input.test.ts +0 -506
  336. package/src/cargo-closure-key.test.ts +0 -240
  337. package/src/cargo-resolve-cache.test.ts +0 -1181
  338. package/src/cargo-source-hash.test.ts +0 -707
  339. package/src/cargo-workspace.test.ts +0 -615
  340. package/src/cross-check-policy.test.ts +0 -316
  341. package/src/disk-command-policy.test.ts +0 -61
  342. package/src/ensure-built-receipt.test.ts +0 -279
  343. package/src/ensure-built-witness.test.ts +0 -688
  344. package/src/ensure-built.test.ts +0 -1462
  345. package/src/executors/all-verdicts/executor.test.ts +0 -135
  346. package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
  347. package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
  348. package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
  349. package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
  350. package/src/executors/bounded-exec/executor-host.test.ts +0 -800
  351. package/src/executors/bounded-exec/executor.test.ts +0 -1819
  352. package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
  353. package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
  354. package/src/executors/bounded-exec/progress.test.ts +0 -139
  355. package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
  356. package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
  357. package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
  358. package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
  359. package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
  360. package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
  361. package/src/executors/bounded-exec/verdict.test.ts +0 -545
  362. package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
  363. package/src/executors/clean-outputs/executor.test.ts +0 -20
  364. package/src/executors/typescript-emit/executor.test.ts +0 -83
  365. package/src/failure-summary.ts +0 -119
  366. package/src/generators/bounded-test-targets/generator.test.ts +0 -138
  367. package/src/generators/bun-test-tracing/generator.test.ts +0 -250
  368. package/src/generators/create-package/generator.test.ts +0 -190
  369. package/src/generators/make-public/generator.test.ts +0 -137
  370. package/src/graph-input-contract.test.ts +0 -379
  371. package/src/host-controller-wiring.test.ts +0 -31
  372. package/src/index.test.ts +0 -3321
  373. package/src/linked-snapshots.nx.test.ts +0 -254
  374. package/src/managed-files/forgejo-artifact.test.ts +0 -395
  375. package/src/managed-files/generator.test.ts +0 -243
  376. package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
  377. package/src/managed-files/json-edit.test.ts +0 -216
  378. package/src/managed-files/managed-content.test.ts +0 -166
  379. package/src/managed-files/managed-format-json.test.ts +0 -308
  380. package/src/managed-files/repo-path.test.ts +0 -172
  381. package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
  382. package/src/managed-files/trace-db-artifact.test.ts +0 -7
  383. package/src/managed-files/tree-permissions.test.ts +0 -109
  384. package/src/managed-files/tree.test.ts +0 -123
  385. package/src/manifest-hash.test.ts +0 -219
  386. package/src/nextest-code-bound.test.ts +0 -161
  387. package/src/nextest-extraction.test.ts +0 -216
  388. package/src/nextest-extraction.ts +0 -371
  389. package/src/nextest-partitions.test.ts +0 -501
  390. package/src/nx-cache-bound.test.ts +0 -109
  391. package/src/nx-cache-restore-mtime.test.ts +0 -170
  392. package/src/nx-daemon-claim.test.ts +0 -279
  393. package/src/nx-daemon-idle-cpu.test.ts +0 -80
  394. package/src/nx-daemon-idle-policy.test.ts +0 -111
  395. package/src/nx-daemon-ignore-files.test.ts +0 -210
  396. package/src/nx-daemon-root-normalization.test.ts +0 -105
  397. package/src/nx-daemon-start-never.test.ts +0 -292
  398. package/src/nx-daemon-validity.test.ts +0 -1055
  399. package/src/nx-dot-input-policy.test.ts +0 -353
  400. package/src/nx-failure-life-cycles.test.ts +0 -207
  401. package/src/nx-files-archive-racy.test.ts +0 -97
  402. package/src/nx-foreign-workspace-env.test.ts +0 -329
  403. package/src/nx-incomplete-run-summary.test.ts +0 -70
  404. package/src/nx-plugin-load-errors.test.ts +0 -120
  405. package/src/nx-project-graph-errors.test.ts +0 -70
  406. package/src/nx-project-resolution-cache.test.ts +0 -176
  407. package/src/nx-raw-inputs.test.ts +0 -166
  408. package/src/nx-resident-graph-workers.test.ts +0 -112
  409. package/src/nx-run-information.test.ts +0 -118
  410. package/src/nx-skipped-task-exit.test.ts +0 -180
  411. package/src/nx-state-location.test.ts +0 -63
  412. package/src/nx-store-resolution.test.ts +0 -81
  413. package/src/nx-task-graph-cycles.test.ts +0 -148
  414. package/src/nx-task-output-lease.test.ts +0 -550
  415. package/src/nx-use-local.test.ts +0 -105
  416. package/src/owned-installation.test.ts +0 -105
  417. package/src/package-target-policy.test.ts +0 -1014
  418. package/src/producer-receipts.test.ts +0 -285
  419. package/src/release-config-policy.test.ts +0 -311
  420. package/src/runtime-input.test.ts +0 -393
  421. package/src/serial-group-wiring.test.ts +0 -326
  422. package/src/task-history-namespace.test.ts +0 -181
  423. package/src/task-results.test.ts +0 -228
  424. package/src/test-clock-policy.test.ts +0 -338
  425. package/src/test-program.test.ts +0 -303
  426. package/src/test-timings.test.ts +0 -240
  427. package/src/test-walk-policy.test.ts +0 -620
  428. package/src/testing.test.ts +0 -509
  429. package/src/typecheck-test-policy.test.ts +0 -1468
  430. package/src/typescript-resolution.test.ts +0 -76
  431. package/src/version-actions.test.ts +0 -80
  432. package/src/workspace-config-policy.test.ts +0 -737
package/README.md CHANGED
@@ -11,6 +11,41 @@ The public plugin entry loads its transformed bootstrap product synchronously, m
11
11
  path in Node and Bun. A missing `dist/index.js` refuses by name and gives the `ttsc` bootstrap command; it never returns
12
12
  an empty graph or loads raw development source in place of transformed code.
13
13
 
14
+ ## Writing plugin code
15
+
16
+ These rules govern every Nx plugin written in this repository or in a consuming repository, a plugin local to one
17
+ workspace included. [Target Ownership](#target-ownership) lists what this plugin already infers; read it before adding
18
+ inference.
19
+
20
+ 1. **Reuse Nx; never re-implement it.** Graph and target shapes (devkit's `ProjectGraph` and `TargetConfiguration`),
21
+ `dependsOn` normalization (`normalizeDependencyConfigDefinition`) and task-graph expansion (`createTaskGraph`) come
22
+ from Nx, imported from `nx/src/…` as this package's sources import them (`nx/src/devkit-exports.js` is the module
23
+ `@nx/devkit` publishes). A plugin carries no traversal of its own and no second `dependsOn` parser, and checks what
24
+ Nx already ships before adding a dependency. `dependsOn` takes `^`, wildcards such as `^*-js`, `project:target` and
25
+ object forms; a copy answers for the spellings its author thought of and drifts from the Nx that schedules the task,
26
+ and it never receives a repair of the pinned Nx ([Nx 23.2.1 Runtime Patch](#nx-2321-runtime-patch)).
27
+ 2. **Put each decision in the hook that sees its data.** `createNodesV2` infers targets for each project file it
28
+ matches, before any graph exists. `createDependencies` adds project edges and has no dependency graph yet.
29
+ `createMetadata` runs after both, with every project's merged targets and the edges the plugins added (Nx adds a
30
+ project's own `implicitDependencies` edges after it), so whole-graph validation belongs there, where a throw fails
31
+ graph construction. A check in an earlier hook judges a graph that is not built.
32
+ 3. **Derive inputs and outputs from the source of truth.** A target hashes exactly what determines its result and
33
+ declares every output a cache hit must restore. Where the plugin can compute a set, it reads it from the file that
34
+ owns it and keeps no hand list beside it (AGENTS.md, Done): a missing entry replays a stale result, and an extra one
35
+ misses the cache. Mutable tool state is never an output
36
+ ([Cowshed Build-State Output Policy](#cowshed-build-state-output-policy)).
37
+ 4. **Decide in a pure core.** A hook is a thin shell: it reads Nx's context and the files, calls a pure function over
38
+ plain values (a `ProjectGraph`, a `TargetConfiguration`, parsed manifest text) and returns the answer. Table-driven
39
+ tests call the function with in-memory devkit values, so its verdict is the same in every checkout and reproduces
40
+ without a workspace (AGENTS.md, Proof).
41
+ 5. **Refuse at graph time.** When a project, target or edge is wrong, or the plugin cannot tell, graph construction
42
+ fails with a typed error that names the project, the target, the edge and the fix. The plugin never warns and
43
+ continues, and never leaves the case to a gate or CI: a warning scrolls past while tasks run and cache results on a
44
+ graph the plugin could not judge, and a gate or CI finds the problem only after those results exist.
45
+ 6. **Test through devkit values, never an Nx process.** The plugin's contract is the value its hook returns; Nx's
46
+ behavior is Nx's to test (AGENTS.md, Proof). A wiring gets at most one `nx show project` smoke.
47
+ [Test Fixtures That Run Nx](#test-fixtures-that-run-nx) owns the rule and its fixtures.
48
+
14
49
  ## Target Ownership
15
50
 
16
51
  Official `@nx/js/typescript` inference is disabled because it cannot run the workspace's source transformers. A package
@@ -70,6 +105,27 @@ workspace policy removes static lint executors, commands, dependencies, outputs
70
105
  override source-aware inference for every project. Project-local `nx.targets.lint` declarations retain normal Nx
71
106
  override precedence.
72
107
 
108
+ The workspace ESLint configuration keys every lint target with the config files and exactly the workspace files they
109
+ load, read the way ESLint loads them (`src/eslint-config-closure.ts`). Under Node, ESLint loads a TypeScript config
110
+ through jiti and any other config with a native `import()`, and every module a config reaches loads the same way. For a
111
+ jiti config the walk runs jiti's own transform, so an import that only types use is erased exactly as jiti erases it,
112
+ and jiti's own resolver picks each file under the `require` or `import` conditions of the call. The walk runs in
113
+ whichever process builds the graph (the Nx CLI, its daemon, smoo), so it restores `Error.prepareStackTrace` and
114
+ `Error.stackTraceLimit` after each transform: jiti's Babel replaces both for the life of the process, and under Bun the
115
+ wrapper it leaves makes every later `Error.captureStackTrace` onto a non-Error object throw (oven-sh/bun#46393), as
116
+ follow-redirects' error types do when axios loads. For a native config `import type` and `export type` are erased, and
117
+ the `node` that runs ESLint resolves each load with `createRequire(module).resolve` or
118
+ `import.meta.resolve(specifier, module)`, one process per walk layer. A builtin, or a package installed outside the
119
+ workspace's own files, adds nothing: the project's bun lock-scope node among the check inputs already keys what is
120
+ installed. A package that resolves into the workspace (a member linked into `node_modules`) is keyed and walked like a
121
+ relative module. Every loaded file also keys the package.json files that decide how it loads: the nearest one (its
122
+ module format), a member's own (its entry) and that of a directory a relative specifier enters (its `main`). A load
123
+ whose specifier the source does not spell (`require(name)`, `import(path)`, `module.require`, `module['require']`,
124
+ `require.call`/`apply`/`bind`, an alias of `require`, `createRequire`), a specifier that is neither relative nor a
125
+ package name, one the loader cannot resolve, and a workspace file outside Nx's index fail graph construction with the
126
+ config, the loading module and the load: lint cannot cache a verdict its key does not cover. A file beside the config's
127
+ modules that no config loads keys no lint target.
128
+
73
129
  Smoo's workspace policy also sets `"cacheDirectory": ".nx/cache"` in the root `nx.json`, and `smoo monorepo check` fails
74
130
  without it. With no `NX_*_DIRECTORY` variable set, as in a host shell, the pinned Nx otherwise moves the task cache and
75
131
  its database to a per-user `~/.nx/<id>` keyed by the repository's remote, which every checkout of the repository shares.
@@ -79,24 +135,38 @@ volume, and `src/nx-state-location.test.ts` checks where this repository's host
79
135
 
80
136
  The plugin's own `nx run nx-plugin:test` aggregates four bounded Bun targets. Each uses Bun's native
81
137
  `--timings=test-timings.json --shard=N/4` partition to balance measured per-file work, while normal discovery still runs
82
- every test file (including newly added files) exactly once. A failed shard fails the aggregate. The shard count and
83
- standard 120-second target deadline stay unchanged. Bun cuts the path-sorted files into four contiguous runs and costs a
84
- file the manifest does not name at the manifest's median, so files added without a refresh cluster into one shard and
85
- can push it past its deadline. The inferred `shard-timings` target makes that loud instead: for any project whose
86
- `bun test` targets carry both `--shard=N/M` and `--timings=<file>`, it replays Bun's discovery rules without running a
87
- test and fails naming every file the shards would run that the manifest does not name, with the refresh command
138
+ every test file (including newly added files) exactly once. A failed shard fails the aggregate. Each shard, and
139
+ `test-host`, is cached the way the unsharded `test` was: `targetDefaults.test` keys only the target named `test`, so a
140
+ target split from it states `"cache": true` and its inputs itself (`test-host` also hashes the cowshed build it runs).
141
+ `smoo monorepo validate` refuses a member of a cached aggregate that states no `cache`, since Nx then never caches it:
142
+ the shards ran on every gate from 10-02 to 10-22 for that reason. The shard count and standard 120-second target
143
+ deadline stay unchanged. Bun cuts the path-sorted files into four contiguous runs and costs a file the manifest does not
144
+ name at the manifest's median, so files added without a refresh cluster into one shard and can push it past its
145
+ deadline. The inferred `shard-timings` target makes that loud instead: for any project whose `bun test` targets carry
146
+ both `--shard=N/M` and `--timings=<file>`, it replays Bun's discovery rules without running a test and fails naming
147
+ every file the shards would run that the manifest does not name, with the refresh command
88
148
  `smoo nx refresh-test-timings <project>`. That command runs the suite once without `--shard`, adding `--update-timings`,
89
149
  and then repeats the check. Refresh after adding or slowing a test file; the manifest is scheduling data, not a test
90
150
  allowlist. The shards of one suite must share one cwd and every argument but `--shard`, pass flag values as
91
151
  `--flag=value`, and use no shell syntax beyond quoting; a shard command that breaks this fails graph construction,
92
152
  because the files it runs could only be guessed.
93
153
 
94
- Real Nx fixtures own their cache and workspace-data directories and stop their daemon before removing the fixture.
95
- Retirement also drains processes whose working directory is inside the fixture when no daemon record exists: startup may
96
- not have published its record yet, so an absent record never proves the fixture is empty. Fixtures that intentionally
97
- strip caller directory overrides declare `cacheDirectory: ".nx/cache"` in their own `nx.json`; this keeps the native
98
- task database local too, rather than leaving a new `~/.nx/<repoKey>` behind. Offline, path-only Cargo fixtures likewise
99
- own a temporary `CARGO_HOME`; production commands still keep the caller's Cargo home.
154
+ Real Nx fixtures own their cache and workspace-data directories and stop their daemon before removing the fixture. The
155
+ daemon is the process its workspace record names, and its descendants, found by walking down its children; those get
156
+ SIGTERM and are awaited. Nothing is signalled because it works in the fixture: where a process works says nothing about
157
+ whose it is (`specs/cowshed/11_shell.md`, "Process identity and signal ownership"). A process that left the daemon's
158
+ tree (a child its last act started, reparented when it exited) stays in the tree the job's supervisor observes, and is
159
+ retired with the test command's subtree when that command ends (`bounded-exec`, below). No fixture helper reads a
160
+ process it was not given: each starts from pids its caller holds (a child it spawned, a daemon's record, the test
161
+ process itself) and walks down their children (`pgrep -P` on macOS, each parent's `/proc/<pid>/task/*/children` on
162
+ Linux), then lists exactly those with `ps -p`, each under a deadline. A census of the user's processes by working
163
+ directory or `TMPDIR` (`lsof -d cwd`, `ps -E`) asked every one of them, and one caught in an uninterruptible kernel wait
164
+ held the census with it: measured 2026-10-25, `lsof -d cwd` slept 77.8 s on a `cowshed fork`'s first write to its build
165
+ image. What a signalled test process still runs of its own tree is named on stderr (`descendantsDiagnostic`) when it
166
+ deletes its runs. Fixtures that intentionally strip caller directory overrides declare `cacheDirectory: ".nx/cache"` in
167
+ their own `nx.json`; this keeps the native task database local too, rather than leaving a new `~/.nx/<repoKey>` behind.
168
+ Offline, path-only Cargo fixtures likewise own a temporary `CARGO_HOME`; production commands still keep the caller's
169
+ Cargo home.
100
170
 
101
171
  Fixture sockets and loopback listeners live where a Cowshed sandbox admits them, never at a literal `/tmp` path or on
102
172
  port 0. A fixture's short socket parent alias lives beside the Nx socket directory the job supplies (the parent of
@@ -110,13 +180,15 @@ bytes is refused with an error naming it. The shell owner retains a failed socke
110
180
  foreign-workspace provider refuses before running a target and preserves its complete diagnostic. `fixtureNxEnv` gives
111
181
  each fixture its own `NX_SOCKET_DIR`; retirement stops its daemon before unlinking its verified parent alias and
112
182
  removing the fixture root. A test whose subject is two daemons names a distinct real leaf for each. A listener another
113
- process connects to (the counted Cargo broker, a remote-cache server) binds through `bindListener`: a port of the
114
- workspace's `COWSHED_PORT_BASE`/`COWSHED_PORT_BLOCK_SIZE` block, lowest first, skipping only ports in use, and port 0
115
- outside a block.
183
+ process connects to (the counted Cargo broker, a remote-cache server) binds through `bindListener`: an odd-offset
184
+ service port of the workspace's `COWSHED_PORT_BASE`/`COWSHED_PORT_BLOCK_SIZE` block, lowest first, skipping only ports
185
+ in use, and port 0 outside a block. A client that must be refused gets `claimRefusingPort`: the even session port of a
186
+ service port the test holds, which nothing binds (`specs/cowshed/08_testing.md`), never a port bound and closed, which
187
+ the next allocator in the block binds.
116
188
 
117
- On macOS the working-directory holder census invokes `/usr/sbin/lsof` explicitly, independent of a test or devenv
118
- `PATH`. A missing or inaccessible census tool fails cleanup with its command error; it never means no holders. Only
119
- lsof's exit-1 process-disappearance race retains the partial inventory it produced.
189
+ On macOS the working-directory census invokes `/usr/sbin/lsof` explicitly, independent of a test or devenv `PATH`. A
190
+ census that cannot be read says so in its diagnostic instead of naming no process; it never fails cleanup, since it
191
+ decides nothing. Only lsof's exit-1 process-disappearance race retains the partial inventory it produced.
120
192
 
121
193
  The provider-real-Nx snapshot walk uses asynchronous children so its case timer can run while a producer or capture is
122
194
  active. Its 60 s case guard covers one provider, daemon lifecycle and all provenance/refusal checks; it does not split
@@ -134,26 +206,85 @@ last 60 lines before fixture retirement removes them. The record-change and rest
134
206
 
135
207
  The plugin discovers Cargo workspaces beside Nx project manifests at any depth:
136
208
 
137
- - **Workspace owner:** the project beside a workspace `Cargo.toml` owns one `cargo-fetch`, `cargo-test-compile`,
138
- `cargo-test-archive`, `cargo-lint`, cross-check, mutation, bench, and sweep target. Its `cargo-lint` and `cargo-test`
139
- aggregates reach all workspace crates, including a root `[package]`; `cargo-test` is the ordinary suite, and the
140
- project's `test` also reaches the serial test groups (below).
209
+ - **Workspace owner:** the project beside a workspace `Cargo.toml` owns one `cargo-fetch`, `cargo-test-archive`,
210
+ `cargo-lint`, cross-check, mutation, bench, and `cargo-retention` target. Its `cargo-lint` and `cargo-test` aggregates
211
+ reach all workspace crates, including a root `[package]`; `cargo-test` is the ordinary suite, and the project's `test`
212
+ also reaches the serial test groups (below).
141
213
  - **Crate owner:** the deepest Nx project directory containing a crate owns `cargo-test-<crate>` targets. Its
142
214
  `cargo-lint` delegates to the workspace owner's one verdict, and `lint` never depends on the workspace test suite.
143
215
  Projects can own multiple crates. A nested independent workspace has its own prerequisites and does not inherit those
144
216
  of an outer workspace.
145
217
  - **Commands:** validation runs from the governing Cargo workspace directory. One `cargo fmt --all --check` and one
146
- `cargo --frozen clippy --workspace --all-targets --config 'build.warnings="deny"'` cover every member. Clippy of a
147
- crate is a check build of its whole closure, so a target directory per crate rebuilt every shared dependency once per
148
- crate — 49 closures and 11 GiB on one repository — and no per-crate cache hit repaid it. Clippy writes the workspace's
149
- own `target/`, like every dev build: its check units carry their mode in the unit hash and never collide with build
150
- units, and the host units a dev build compiled (build scripts and their host-only dependencies) are reused instead of
151
- compiled a second time. Warnings are denied by Cargo's `build.warnings`, not `-- -D warnings`: arguments after `--`
152
- are clippy-driver's `CLIPPY_ARGS`, which enter every member's fingerprint, so the gate and a plain
153
- `cargo clippy --workspace --all-targets` would re-check each other's units. `build.warnings` also fails on warnings
154
- replayed from Fresh units, so the two share one unit set and the gate still fails. Cargo's own lock serializes the
155
- invocations that share the directory. `cargo-lint-cross` keeps `target/cargo-lint-cross`: a foreign triple's units are
156
- distinct anyway, and its own lock keeps the cross check from queueing behind host builds.
218
+ `cargo --frozen clippy --workspace --all-targets --target-dir target/cargo-lint --config 'build.warnings="deny"'`
219
+ cover every member. Clippy of a crate is a check build of its whole closure, so a target directory per crate rebuilt
220
+ every shared dependency once per crate — 49 closures and 11 GiB on one repository — and no per-crate cache hit repaid
221
+ it. Clippy writes its own `target/cargo-lint`, so the archive, the Wasm and N-API builds and every other dev build
222
+ never queue behind a workspace-wide check on Cargo's build-directory lock. The price is that clippy compiles its own
223
+ host units (build scripts, proc-macros) once per directory. `cargo-lint-cross` keeps `target/cargo-lint-cross` for the
224
+ same lock reason: a foreign triple's units are distinct anyway, and its own lock keeps the cross check from queueing
225
+ behind host builds. Warnings are denied by Cargo's `build.warnings`, not `-- -D warnings`: arguments after `--` are
226
+ clippy-driver's `CLIPPY_ARGS`, which enter every member's fingerprint, so a `-- -D warnings` gate would fingerprint
227
+ every member differently from a plain `cargo clippy --workspace --all-targets`. `build.warnings` also fails on
228
+ warnings replayed from Fresh units, so the gate still fails when a warning replays instead of recompiling. Cargo's own
229
+ lock serializes the invocations that share a directory.
230
+ - **Retention:** Cargo never deletes a unit generation a later build superseded, so a busy checkout's target directory
231
+ only grows. After each Nx run that executed a Cargo producer (an inferred target that builds, checks or tests into the
232
+ target directory, marked by its `cargoProducer` metadata: `cargo-test-archive`, `cargo-test`, `cargo-lint`,
233
+ `cargo-lint-cross`, mutation, bench, and the napi and wasm builds), the plugin's `postTasksExecution` runs its Cargo
234
+ retention hook, which calls `@smoothbricks/cargo-retain` for each Cargo workspace that is due for maintenance.
235
+ Automatic passes run at most once per 24 hours after a successful completed pass, one that reclaimed in every root;
236
+ its existing receipt records completion time and configuration/workspace/target identity. A not-due hook reports that
237
+ scheduling decision without locks, a fingerprint scan, cleanup or receipt replacement. It does not claim newer outputs
238
+ were inspected or the graph is unchanged. Busy, refused, invalid, foreign or backward-clock receipt evidence never
239
+ postpones the next attempt. The first executed producer after the interval runs a current pass; cache replays, fetch
240
+ and noop tasks start none. Manual preview and apply always run fresh. Due passes reclaim superseded generations under
241
+ `<profile>/build/<package>/<META>/`. They keep the newest generation, by last use, of each unit identity of a
242
+ workspace member (identity is every fingerprint field but its edges, source state and toolchain, which is `rustc` and
243
+ the `--sysroot` flag; integers read exactly, so a newer toolchain supersedes an older one), every unit used in the
244
+ last 24 hours (`-Zmtime-on-use` stamps each use; cowshed exports `CARGO_UNSTABLE_MTIME_ON_USE=true` to every host
245
+ shell and job of a Cargo project, and a repository outside cowshed sets `[unstable] mtime-on-use = true`), and the
246
+ transitive dependency closure of those across every profile, host and cross alike. A root whose hash files show no
247
+ stamp (none newer than its compile by more than 24 hours) reports `recency-unknown: mtime-on-use off`: its last use is
248
+ then only its last compile. A profile that holds a legacy layout beside the current one is read for the current one,
249
+ and its legacy entries are retained as `legacy-layout`. A pass holds every profile's Cargo locks without waiting: one
250
+ held lock skips the pass as `busy`, and a profile it cannot read (unreadable fingerprint, missing `build/` or lock, or
251
+ a legacy layout's records alone) refuses the whole pass, as does a lock it cannot attempt at all, with the reason
252
+ named: under Node, macOS takes its `flock(2)`s in-process (`open(2)` with `O_EXLOCK | O_NONBLOCK`) and starts no
253
+ helper, and other platforms hold them in a perl child, so a sandbox that refuses to exec perl, like a lock file that
254
+ cannot be opened, refuses the pass instead of failing the run. The compiled CLI opens and locks through a small C
255
+ wrapper (`native/flock.c`) that captures `errno` immediately. Each provider's canonical refusal retains the operation,
256
+ exact lock path, actual host errno and OS cause: only contention is `busy`; any other failure refuses the pass. The
257
+ hook only reports outcomes and never fails the run it follows: whatever escapes a pass is logged as a warning, and the
258
+ next workspace is still tried. It moves each reclaimed generation into the profile's `.smoo-retention-trash/` under
259
+ that hold, recording its inode first, and unlinks it after letting go. Each proven generation gets a synchronous,
260
+ non-symlink-following inode census and one native recursive removal, not an awaited lstat/unlink for every artifact.
261
+ The census counts internal hardlinks once; the pass ledger drops an inode only when its last link is removed, so bytes
262
+ freed and bytes still linked outside the removed generations remain distinct. The manifest's root identity is
263
+ rechecked immediately before removal. A failed removal is an I/O failure, not a successful reclaim or a new completed
264
+ maintenance receipt. It writes its last report to `<target>/.smoo-cargo-retention.json`. Cargo's root-relative
265
+ fingerprint paths distinguish cross profiles from nested target roots under the lock; mixed, foreign or unprovable
266
+ cross-profile roots refuse the pass rather than silently dropping their dependency edges. That scan finds a nested
267
+ target root (`target/cargo-lint`, `target/cargo-lint-cross`) by locking and reading its depth-two profile like the
268
+ target's own, so a pass held or refused there reaches no nested root. Each nested root then gets the same pass over
269
+ its own profiles, host and cross, under only their Cargo locks and the target's one retention lock, one root after
270
+ another: units never depend across roots, so a nested root that is held (a lint running into it) or refused is skipped
271
+ and reported in the receipt's `nestedRoots` without holding up the others, and the receipt schedules the next
272
+ automatic pass only when every root reclaimed. Only generations are reclaimed, never a root or a profile, and a nested
273
+ root holding no unit of a workspace member is retained whole as `foreign-root`. A pre-created target need not carry
274
+ Cargo's optional backup tag; a present but invalid tag still refuses the pass. Every pass still reads the current
275
+ fingerprint graph. The locked scan reuses directory-entry types and reads its small metadata files synchronously,
276
+ avoiding duplicate stats and one asynchronous dispatch per tiny file; it does not walk retained artifact contents or
277
+ reuse an earlier graph that could miss in-place recompiles. `cargo-retention` runs that package's native
278
+ `smoo-nx-cargo-retain` executable to preview the same selection, nested roots included, without changing anything.
279
+ Each profile's `incremental/<crate>-<id>/` directories go in the same pass: rustc keeps one per build variant and
280
+ never removes the one a feature, profile or flag change superseded. One is kept while its newest finished session
281
+ started inside the compile window (`invoked.timestamp` to the hash file's last write) of a kept unit of the same
282
+ crate, while it started within the recent-use window, or while the directory holds an unfinished or unreadable
283
+ session. The split-debuginfo objects rustc keeps inside current generations (rust-lang/rust#161824) are not reclaimed,
284
+ so a target directory is not bounded by them. Empty fingerprint hashes are kept as unfinished compilations. The
285
+ preservation proof covers Cargo's current unit and dependency records, not every debug reference in copied binaries or
286
+ other checkouts. In particular, a binary copied up before a failed link can outlive the generation its debug map
287
+ names; this pass does not establish that machine-wide debug closure.
157
288
  - **Scheduling:** inference never throttles Nx. It sets no `parallelism: false` or `parallel: false`, no cap, and no
158
289
  edge whose only purpose is keeping two cargo writers off one `target/`: Cargo owns that lock, and a second process
159
290
  waits inside cargo. An edge states a real consumer — fetch before frozen cargo, the archive before the runners,
@@ -171,16 +302,39 @@ patterns and member patterns that match no directory fail graph construction ins
171
302
 
172
303
  ### Cargo profiles
173
304
 
174
- The default configuration of every cargo target compiles cargo's `dev` profile: every local build and test, gates, CI
175
- validation and `nx build` share one `target/` and one set of units, so cargo recompiles only what changed. The
176
- `production` configuration adds `--release` to the targets that build shipped artifacts (`cargo-napi`,
177
- `napi-<arch>-<os>`, `cargo-wasm`) and is selected only where an artifact ships: the generated publish workflow's build
178
- and platform-leg steps, the `smoo release` commands it runs, and the build and deploy runs of a production
179
- `smoo github-ci nx-deploy`. Test targets have no `production` configuration, so a release build never compiles release
180
- test binaries. A package-local target that builds a shipped artifact follows the same rule: its default options compile
181
- `dev` and its `production` configuration compiles a shipping profile. A shipping profile other than `release` is only
182
- for an artifact family no other build compiles, such as a size-optimised wasm32 lane; a profile that compiles the same
183
- crates for the same target as `dev` or `release` compiles every dependency a second time.
305
+ The default configuration of every cargo target compiles cargo's `dev` profile: every local build and test, CI
306
+ validation and `nx build` share one `target/` and one set of units, so cargo recompiles only what changed. The clippy
307
+ gate and the cross check keep their own `target/cargo-lint` and `target/cargo-lint-cross` (see Cargo Workspace Layouts).
308
+ The `production` configuration adds `--release` to the targets that build shipped artifacts (`cargo-napi`,
309
+ `napi-<arch>-<os>`, `cargo-wasm`) and is selected for shipping: the generated publish workflow's build and platform-leg
310
+ steps, the `smoo release` commands it runs, and the build and deploy runs of a production `smoo github-ci nx-deploy`.
311
+ The land seam also builds the host production CLI before its shipping-byte guard; ordinary build and test graphs never
312
+ reach that seam. Test targets have no `production` configuration, so a release build never compiles release test
313
+ binaries. A package-local target that builds a shipped artifact follows the same rule: its default options compile `dev`
314
+ and its `production` configuration compiles a shipping profile. A shipping profile other than `release` is only for an
315
+ artifact family no other build compiles, such as a size-optimised wasm32 lane; a profile that compiles the same crates
316
+ for the same target as `dev` or `release` compiles every dependency a second time.
317
+
318
+ Native profiles have disjoint output trees: development CLIs live under `.cache/bin/<platform>/` and development
319
+ platform addons under `.cache/native-dev/<platform>/`; production retains the shipping `dist/bin/` and `dist/native/`
320
+ layout. Declarations interpolate the same options the commands use, so their outputs and restored input receipts move
321
+ together. The host-resolved `cli-native` and `napi-native` aggregates delegate to the existing platform producers and
322
+ declare no outputs of their own. Their `production` configuration forwards that same selection to the host producer. A
323
+ test that executes the CLI or loads the ordinary platform addon names those producers; tests using the explicit test
324
+ addon still name `napi-debug`. The land host runs `cowshed:cli-native:production` then the uncached, dependency-free
325
+ `cowshed:release-check`; the guard inspects the produced shipping bytes, not a development output or a cache replay.
326
+
327
+ After the fast-forward, main's output restoration explicitly requests `build`, `cli-native`, and `napi-native`. The
328
+ normal build remains JS/dependency-only; this post-land seam restores the source-selected host CLI/addon and their input
329
+ receipts for linked consumers. Each concrete producer remains cacheable and recompiles only changed inputs.
330
+
331
+ Artifact loaders select the profile from package source authority, never from which artifact happens to exist. A
332
+ checkout contains a tracked source entry that the package never publishes and loads the development artifact, even when
333
+ its JavaScript runs from `dist/ts`. A published package or sealed snapshot omits that authority entry and loads the
334
+ shipping `dist/` artifact. A missing selected development artifact fails loudly with its cached Nx producer remedy; it
335
+ never falls back to an older shipping artifact. Developer-link input-receipt checks run once at shell entry and cover
336
+ the selected development outputs, not once per CLI execution. Snapshots without that authority entry request the
337
+ producer's `production` configuration so their artifact bytes and public paths agree.
184
338
 
185
339
  Rust LMAO's opt-in source-revision contract is defined in
186
340
  [01f](../../specs/lmao/01f_arrow_table_structure.md#smoo/lmao!n/arrow-table-module-id.not-git). Its native and Wasm
@@ -191,35 +345,76 @@ workspace's cached nextest archive hashes that variable too, because it contains
191
345
 
192
346
  ### Cargo cache boundaries
193
347
 
194
- `cargo-fetch` is uncached because the registry lives outside Nx outputs. `cargo-test-compile` is also uncached: it warms
195
- Cargo's shared mutable build directory before the bounded runner, even if that directory was deleted after an earlier
196
- successful run. Cargo's own incremental cache avoids recompiling unchanged code. Nx never restores or collects shared
197
- Cargo build directories; lint and test **results**, and dedicated Wasm/N-API **outputs**, remain cacheable.
348
+ `cargo-fetch` is uncached because the registry lives outside Nx outputs. `cargo-test-archive` is the one cached cargo
349
+ build, and it is the step that compiles the test binaries ahead of the bounded runners; there is no separate uncached
350
+ `cargo test --no-run` warm-up, since it compiled the same units the archive does. Cargo's own incremental cache avoids
351
+ recompiling unchanged code. Nx never restores or collects shared Cargo build directories; lint and test **results**, and
352
+ dedicated Wasm/N-API **outputs**, remain cacheable. Being uncached, `cargo-fetch` keys nothing, and it names what it
353
+ reads (the manifests, the lock and the Cargo configuration) so that a producer receipt binds those and not every file of
354
+ its project, a repository-root project's symlinked managed files among them.
198
355
 
199
356
  Validation inputs include the crate's files, every file its sources compile in through a literal `include_str!` or
200
- `include_bytes!` path outside the crate's directory (a shipped skill or a shared corpus beside the crates), local
201
- dependency closure, governing manifests and configuration, the declared toolchain pin, and the toolchain's own reported
202
- versions. The pin is `devenv.lock`, hashed as an ordinary file input at both `{workspaceRoot}/devenv.lock` and
203
- `{workspaceRoot}/tooling/direnv/devenv.lock` — devenv resolves it into the rustc, cargo, linker, C toolchain and SDK
204
- every cargo command inherits, so bumping it invalidates every cached cargo target. Workspace test runners additionally
205
- hash all workspace member manifests because those affect unified features, and the nextest executable/configuration.
206
-
207
- Nothing machine-local takes part. The ambient cargo environment and the global `$CARGO_HOME/config.toml` are
208
- deliberately not hashed: their values carry absolute store paths and per-checkout state directories, which would make
209
- every cache entry private to the machine that wrote it and make one target hash differently inside a devenv profile than
210
- outside it — enough to make a pre-push cross-compile probe unsatisfiable. Keep explicit inputs for arbitrary
211
- build-script reads or custom environment variables that Cargo metadata cannot name.
212
-
213
- A target whose inputs a repository DECLARES replaces the inferred list, pin included. Name the two `devenv.lock` entries
214
- in that declaration, or in the named input it uses, or a toolchain bump will not invalidate it. The replaced list also
215
- held the target's `externalDependencies` entry described below; restate it (`[]` for a target that runs only cargo), or
216
- every lockfile change re-keys the target.
357
+ `include_bytes!` path outside the crate's directory (a shipped skill or a shared corpus beside the crates), the crates
358
+ Cargo builds for its tests, governing manifests and configuration, the declared toolchain identity, and the toolchain's
359
+ own reported versions. The identity has two halves. The pin is `devenv.lock`, hashed as an ordinary file input at both
360
+ `{workspaceRoot}/devenv.lock` and `{workspaceRoot}/tooling/direnv/devenv.lock` — devenv resolves it into the rustc,
361
+ cargo, linker, C toolchain and SDK every cargo command inherits, so bumping it invalidates every cached cargo target.
362
+ The lock names inputs, not what the shell builds from them: a patch to the linker moves no byte of the lock and no line
363
+ of `rustc -vV`, yet it changes what links every unit. The other half is a runtime input, `smoo-nx-cargo-toolchain`, that
364
+ names the Nix store object of each program the shell declares for Cargo to compile and link with: the linker of each
365
+ target (`CARGO_TARGET_<TRIPLE>_LINKER`, which Cargo hashes into every unit) and the programs cc-rs runs for build
366
+ scripts (`CC`, `CXX`, `AR` and `RANLIB`: generic, per target and in their `HOST_` and `TARGET_` forms, each declared
367
+ `rerun-if-env-changed`). The wrapper devenv builds for a Linux linker names its clang and its lld, so one entry covers
368
+ all three. The object moves when the toolchain moves, once, and nothing else in the shell moves it. The shell's Nix
369
+ sources are not hashed instead: the managed module alone changed 43 times in the 30 days to 2026-10-26, and each edit
370
+ would have rekeyed every cargo verdict; evaluated at those commits on Linux x86_64, the observed store objects did not
371
+ change. rustc and cargo are not in the list on purpose. Cargo keys units on the output of rustc's version command, which
372
+ is hashed beside this input, never on rustc's path. On a non-Linux host the default shell and its linux-cross profile
373
+ carry different rust-std sets, so that path would split the pre-push probe from the cached cross-check verdict. Only a
374
+ path in the Nix store counts; a path elsewhere is ignored. A linker named only by Cargo configuration is outside this
375
+ environment probe: a target that runs one must name the script itself as an input. Workspace test runners additionally
376
+ hash the manifest of every package the workspace build compiles inside the Nx workspace (a member's, and a path
377
+ package's that reaches the build only as some crate's dev-dependency), because those affect unified features, and the
378
+ nextest executable/configuration. While the build compiles a path package outside the Nx workspace, every runner also
379
+ names externalRustCrates, which then must be declared: a runner's key does not follow archive outputs.
380
+
381
+ Nothing machine-local takes part. The ambient cargo environment as a whole and the global `$CARGO_HOME/config.toml` are
382
+ deliberately not hashed: their values carry per-checkout state directories (`CARGO_INSTALL_ROOT` moves under the active
383
+ profile) and the home directory's configuration, which would make every cache entry private to the machine that wrote it
384
+ and make one target hash differently inside a devenv profile than outside it — enough to make a pre-push cross-compile
385
+ probe unsatisfiable. The one thing read from the environment is the Nix store objects of the shell's declared programs,
386
+ above: an object agrees on every machine of a platform, and a path outside the store is ignored. Keep explicit inputs
387
+ for arbitrary build-script reads or custom environment variables that Cargo metadata cannot name.
388
+
389
+ Cargo itself keys a build script's run on every variable the script names with `rerun-if-env-changed` (cc-rs names
390
+ `CC_<target>` and its kin), so an ambient value Nx does not hash still reruns the script and rebuilds everything that
391
+ depends on it. The `@smoothbricks/nx-plugin/cargo-build-script-env` export reads those records:
392
+ `buildScriptEnvironmentDrift(profile, sees)` returns each variable whose recorded value differs from what Cargo would
393
+ see now, with both values and the packages whose scripts read it; `cargoSees(files, environment)` is that view over the
394
+ configuration chain `cargoConfigFiles(directory, cargoHome)` lists (the deepest `[env]` entry decides: forced, else the
395
+ environment's value, else the entry's), and `runBuildScriptEnvironmentDrift([checkout])` prints the drift of
396
+ `<checkout>/target/debug`. Variables Cargo sets for the processes it runs (`CARGO_*`, `OUT_DIR` and the other documented
397
+ build-script names) are not compared: a run that recorded one was started by a `cargo` a Cargo-run process spawned.
398
+ `tooling/land-host.sh` calls it through `tooling/land-cargo-env.ts` before each gate (cowshed
399
+ `specs/cowshed/16_build_volumes.md`, "One Cargo environment on every path").
400
+
401
+ A target whose inputs a repository DECLARES replaces the inferred list, toolchain identity included. Name
402
+ `cargoToolchain` in that declaration, or in the named input it uses: inference defines it, in every project that has
403
+ cargo targets, as the whole identity. A restated lock is not enough, because the identity also holds the runtime input
404
+ no fileset can state, and `smoo monorepo check` refuses a cached cargo target that does not reach the name. The replaced
405
+ list also held the target's `externalDependencies` entries described below; restate them (`[]` for a target that runs
406
+ only cargo, and the lock-scope node of its crates), or every lockfile change re-keys the target.
217
407
 
218
408
  Every cached cargo target names the npm packages its command runs as `externalDependencies`: none for cargo itself, and
219
409
  `@smoothbricks/nx-plugin` for a target that runs its executor or reads its installed files (the nextest tool config, the
220
410
  archive extractor). Without that input Nx keys a task whose executor is not an `@nx/` one on every package in the
221
411
  lockfile, so a lockfile-only commit re-ran every cargo verdict. Inside this repository the plugin is a workspace
222
- project, which Nx refuses as an external dependency, so the list is empty here.
412
+ project, which Nx refuses as an external dependency, so the list is empty here. The plugin tells the two apart by the
413
+ workspace's own `node_modules/@smoothbricks/nx-plugin`: one that resolves inside the workspace and outside every
414
+ `node_modules` is a workspace project, whatever path the running process loaded the plugin's code through (a daemon of
415
+ this repository once loaded it through one, and the land gate refused the graph). A second entry names the Cargo
416
+ lock-scope node of the crates the target builds (`cargoClosure` carries it; a target that names neither gets the node of
417
+ the directory it runs in). An entry naming only `cargo-lock:` nodes does not count as naming npm packages.
223
418
 
224
419
  No input declaration removes a project's own configuration from a task's key. Nx 23.2.1 adds `ProjectConfiguration` to
225
420
  every task (`hash_planner.rs` `gather_self_inputs`), and `hash_project_config.rs` hashes the executor, outputs, options,
@@ -232,6 +427,13 @@ CI workflow input. It migrates the old CI-only `sharedGlobals` reference out of
232
427
  definition. Custom non-CI named globals and explicit workflow-target inputs remain repository-owned and unchanged;
233
428
  workflow checks can still name their own CI inputs.
234
429
 
430
+ Policy keeps Rust crate sources out of `production`: `smoo monorepo validate` refuses a positive entry beneath
431
+ `{projectRoot}/crates`, ending in `.rs` or naming a `Cargo.toml`, and `smoo monorepo update` removes it. TypeScript
432
+ targets see Rust only as the producer target's outputs, through `dependsOn` and `dependentTasksOutputFiles`; a target
433
+ that reads crate source as text names it in its own inputs; cargo targets are keyed by `cargoClosure`. Update removes
434
+ the entry rather than keeping it, as it rewrites a broad `production` to the default: whatever reads crate source
435
+ declares it on its own target.
436
+
235
437
  Policy excludes incidental Markdown through `!{projectRoot}/**/*.md` in `default` and `production`. A task that consumes
236
438
  Markdown declares it through an input set without a matching negative: Nx exclusions win over positive paths in the same
237
439
  fileset, so a later explicit path cannot re-include it. Inferred Cargo package filesets remain broad for arbitrary
@@ -244,8 +446,12 @@ TypeScript toolchain inputs exclude Markdown beneath workspace-root `patches/`,
244
446
  pin, including extensionless `PIN` and `VERSION` files. Native content-hash regressions distinguish those inputs from
245
447
  README and unrelated-source edits. A task that consumes Markdown declares it through an input set without a matching
246
448
  negative: Nx exclusions win over positive paths in the same fileset, so a later explicit path cannot re-include it.
247
- Inferred Cargo package filesets remain broad for arbitrary compiled data, headers, schemas and build-script reads;
248
- incidental Markdown beneath a crate can therefore still invalidate those tasks conservatively.
449
+ Inference adds that fileset only to the targets it infers. A declared cached target that runs an installed patched
450
+ package (a bun or node command, the patched compiler binary, a bundled or site build over a patched dependency) names
451
+ the same fileset in its own inputs: patches are applied to `node_modules` at install, which no fileset reaches, and the
452
+ lockfile records the patch path, not its bytes, so without the fileset a patch edit replays the previous verdict or
453
+ output from cache. Inferred Cargo package filesets remain broad for arbitrary compiled data, headers, schemas and
454
+ build-script reads; incidental Markdown beneath a crate can therefore still invalidate those tasks conservatively.
249
455
 
250
456
  Cargo keeps the caller's `CARGO_HOME`. Moving configuration into an isolated home can change relative paths or lose
251
457
  source replacement, credentials, and toolchain settings; forwarding it with `--config` changes precedence. Registry
@@ -425,13 +631,15 @@ it in each custom Cargo target's `inputs`, alongside `cargoToolchain`, the targe
425
631
  ```
426
632
 
427
633
  Cargo decides the closure. Graph inference checks the content-keyed locked offline resolution of the local packages
428
- under the project's root and every mutable local package they reach through normal, build or dev dependencies; an edit
429
- to a workspace member outside that closure leaves the task key alone. The members Nx's file index holds become filesets:
430
- each package's `.rs` files, `Cargo.toml` files and `.cargo/config[.toml]` below its directory (skipping `target/` and
431
- the other directories the hash command skips), target sources outside it, its governing workspace manifest, the
432
- `Cargo.toml` and `.cargo/config[.toml]` of every directory from the package up to the Nx root, and the workspace's
433
- `Cargo.lock`. Nx hashes those from the file hashes it already keeps, so hashing these inputs starts no process. A graph
434
- with unchanged resolution inputs starts no Cargo process either.
634
+ under the project's root and every mutable local package Cargo builds for them: their normal, build and dev
635
+ dependencies, and below them only normal and build dependencies, since Cargo builds a dependency for its library and
636
+ build script alone and never for its own tests. An edit to a workspace member outside that closure, a dependency's test
637
+ helper included, leaves the task key alone. The members Nx's file index holds become filesets: each package's `.rs`
638
+ files, `Cargo.toml` files and `.cargo/config[.toml]` below its directory (skipping `target/` and the other directories
639
+ the hash command skips), target sources outside it, its governing workspace manifest, the `Cargo.toml` and
640
+ `.cargo/config[.toml]` of every directory from the package up to the Nx root, and the lock-scope node for the Cargo.lock
641
+ entries the closure reaches (see below). Nx hashes those from the file hashes and node hashes it already keeps, so
642
+ hashing these inputs starts no process. A graph with unchanged resolution inputs starts no Cargo process either.
435
643
 
436
644
  Fileset reduction works from the set of package directories: a path is covered exactly when it or one of its ancestors
437
645
  is a member. Nested packages therefore need no extra subtree pattern, and shared ancestors are visited once. Sibling
@@ -507,6 +715,28 @@ deleted and recreated `CARGO_HOME`, or another one, fetches again, while a copie
507
715
  not. A failed fetch writes no stamp. In CI (`devenv tasks run`) a failed fetch fails; locally the task prints Cargo's
508
716
  cause, the shell loads, and the next entry retries, while graph inference keeps refusing with that same cause.
509
717
 
718
+ The fetch is bounded, because it holds Cargo's global package-cache lock (`$CARGO_HOME/.package-cache`) while it runs
719
+ and every other cargo that shares the `CARGO_HOME` waits behind it. Each `cargo fetch --locked` runs in a process group
720
+ of its own under a 300 s deadline (`CARGO_FETCH_DEADLINE_MS` in `tooling/direnv/cargo-fetch-bound.ts`, the bound the
721
+ project graph puts on each of its own Cargo children). At the deadline the whole group is killed and the task fails,
722
+ naming the command and the lock it held and printing Cargo's output up to the kill; `SMOO_CARGO_FETCH_DEADLINE_MS` gives
723
+ a shorter deadline in whole milliseconds and never a longer one. A signal that ends the step (SIGINT, SIGTERM, SIGHUP)
724
+ or the step's exit ends the group with it, since the group no longer shares the terminal's signals. A group signal
725
+ reaches only the members that exist when it goes out, and macOS does not hold a fork back while it does, so the kill is
726
+ repeated while the kernel still lists members of the group (`judgeReap` in `tooling/direnv/cargo-fetch-bound.ts`): every
727
+ 5 ms for up to two seconds at the deadline, and every millisecond for up to thirty when the step is ending, which can
728
+ wait for nothing. If members are left at the deadline, the failure names the group and says so. When the step is ending,
729
+ a line on stderr says the group was still listed and that whether anything in it still runs is unconfirmed, because its
730
+ leader is listed until the step has gone. Neither claims the kill reached every process.
731
+
732
+ The step also gives the fetch `GIT_HTTP_LOW_SPEED_LIMIT=1` and `GIT_HTTP_LOW_SPEED_TIME=60`, over any value the shell
733
+ already holds. Git has no low-speed limit unless one is set, and Cargo runs the `git` executable for git dependencies
734
+ unless `net.git-fetch-with-cli = false` (its default detects `git`), so a `git fetch` over HTTP(S) whose connection
735
+ stalls fails 60 to 67 s after its last byte instead of holding the lock until the deadline. The limit reaches only those
736
+ transfers: a git dependency over ssh or the git protocol, and Cargo's own git library
737
+ (`net.git-fetch-with-cli = false`), are bounded by the deadline alone. Cargo's registry downloads carry limits of their
738
+ own (`http.timeout`, `http.low-speed-limit`).
739
+
510
740
  In-workspace members follow Nx's file semantics, which differ from the command's own walk in two places: a symlinked
511
741
  directory inside a package is not followed, and manifests and Cargo configuration above the Nx root (a
512
742
  `~/.cargo/config.toml` above a checkout in the home directory) are machine-local and not hashed, as for every other
@@ -524,17 +754,34 @@ project declares its own named input and names its directory:
524
754
  "runtime": "sh node_modules/@smoothbricks/nx-plugin/runtime-input.sh smoo-nx-cargo-hash --include-workspace --closure packages/example"
525
755
  },
526
756
  "{workspaceRoot}/Cargo.lock",
757
+ "cargoToolchain"
758
+ ]
759
+ }
760
+ }
761
+ ```
762
+
763
+ Such a project has no inferred `cargoToolchain`, so the workspace's `nx.json` defines the name (Nx resolves a named
764
+ input from the project first, so an inferred project keeps the plugin's definition):
765
+
766
+ ```json
767
+ {
768
+ "namedInputs": {
769
+ "cargoToolchain": [
527
770
  "{workspaceRoot}/devenv.lock",
528
- "{workspaceRoot}/tooling/direnv/devenv.lock"
771
+ "{workspaceRoot}/tooling/direnv/devenv.lock",
772
+ {
773
+ "runtime": "sh node_modules/@smoothbricks/nx-plugin/runtime-input.sh node node_modules/@smoothbricks/nx-plugin/dist/bin/smoo-nx-cargo-toolchain.js"
774
+ }
529
775
  ]
530
776
  }
531
777
  }
532
778
  ```
533
779
 
534
780
  Without `--closure`, `--include-workspace` hashes every mutable local package in the Cargo workspace. For a package-root
535
- workspace, pass its manifest last and name that workspace's `Cargo.lock`. Keep `externalRustCrates` for the plugin's
536
- external-source inference contract; unrelated TypeScript targets need neither input. An Nx `^production` input only
537
- follows existing project graph edges; it cannot replace a missing Cargo dependency closure.
781
+ workspace, pass its manifest last and name that workspace's `Cargo.lock`: lock-scope nodes exist only for workspaces
782
+ whose root is a project the plugin infers. Keep `externalRustCrates` for the plugin's external-source inference
783
+ contract; unrelated TypeScript targets need neither input. An Nx `^production` input only follows existing project graph
784
+ edges; it cannot replace a missing Cargo dependency closure.
538
785
 
539
786
  Files git ignores beneath a package directory are not hashed, matching Nx's own file inputs. A generated source is its
540
787
  producer's output: the consuming target depends on the producer and hashes the source through
@@ -551,15 +798,49 @@ Git and registry dependencies are identified by `Cargo.lock`; uncommitted change
551
798
  a pinned Git dependency. Local `path` dependencies stay live and their source edits change the digest. Build-script data
552
799
  and environment inputs outside the Rust/Cargo inputs above still require explicit Nx inputs.
553
800
 
801
+ ### Lockfile scope
802
+
803
+ No inferred target hashes `bun.lock` or `Cargo.lock` as a file. Each names the external project-graph nodes that stand
804
+ for the part of a lockfile it can reach, and Nx hashes those nodes into only the targets that name them, so a dependency
805
+ change re-keys the tasks that can load what changed and no other.
806
+
807
+ - `bun-lock:<projectRoot>`, one per `package.json` project (`bun-lock:.` for the root manifest). Its edges, added by the
808
+ plugin's `createDependencies`, go to the npm nodes the manifest's dependencies resolve to (resolved exactly as Nx
809
+ resolves a project's own package edges); a member's also go to the node of each workspace member it depends on and to
810
+ `bun-lock:.`, since a member's `node_modules` lookup ends in the root's. The root's node has no member edges: every
811
+ member reaches it, and a member loads another only through its own declaration. Nx's lockfile parser links every npm
812
+ node to the packages it depends on and hashes each by the integrity bun.lock records, so the node keys a target on the
813
+ closure its manifest reaches. Every inferred TypeScript target (`tsc-js`, `typecheck`, `typecheck-tests`, `lint`)
814
+ names its project's node.
815
+ - `cargo-lock:<directory>`, for the crates under a directory: its hash digests, per Cargo workspace, every package of
816
+ the locked resolve closure of those crates (a locked package by Cargo package id and source, a path package by name,
817
+ each with what its dependencies resolved to). `cargoClosure` names its project's node; each `cargo-test-*` runner
818
+ names its crates' nodes; workspace-wide cargo targets name the workspace root's.
819
+
820
+ A hand-written target names the same nodes in its `externalDependencies`:
821
+
822
+ ```json
823
+ { "inputs": ["default", "^dependencyDefault", { "externalDependencies": ["bun-lock:packages/example"] }] }
824
+ ```
825
+
826
+ A `cargo-lock:` node exists when an input of a `package.json` project names it (inferred or declared), computed from the
827
+ Cargo resolves the plugin already holds. `externalDependencies` takes no `{projectRoot}` token, so a workspace-wide
828
+ named input or target default can name only `bun-lock:.`; with a `^` input the project's own npm edges come from Nx. A
829
+ target that names no `externalDependencies` at all is still keyed on every package in every lockfile
830
+ (`AllExternalDependencies`), the Cargo nodes included.
831
+
832
+ The root project owns the lockfiles, so its `default` fileset holds them. Its versionless check inputs exclude
833
+ `bun.lock`, `bun.lockb` and `Cargo.lock`; the nodes key what they decide.
834
+
554
835
  ### Manifest versions and validation inputs
555
836
 
556
837
  A release rewrites `version` in every package manifest it publishes and in the lockfile entries mirroring them. Those
557
838
  files are inputs of `lint`, `typecheck` and `typecheck-tests`, so a publish run misses the cache for the whole gate set
558
839
  over a change that alters no code. Those three targets therefore leave the raw manifests out of their filesets and hash
559
- them by field instead: a `json` input with `excludeFields` for `package.json#version`, and one dropping the lockfile's
560
- `workspaces` section, which is only the mirror of each member's own manifest. Nx hashes both in its native hasher, so
561
- this costs no process. Everything else still counts: a dependency range, an export map, and the lockfile's resolution
562
- table.
840
+ them by field instead: a `json` input with `excludeFields` for `package.json#version`. The lockfile is no file input
841
+ (see Lockfile scope), so the release's rewrite of its `workspaces` mirror re-keys nothing. Nx hashes the field input in
842
+ its native hasher, so this costs no process. Everything else still counts: a dependency range, an export map, and every
843
+ locked package the project reaches.
563
844
 
564
845
  The workspace root manifest also drops `scripts`, `smoo` and `nx` from these three targets' hash. No check reads them:
565
846
  scripts are commands a developer runs, `smoo.developerLinks` names links whose linked bytes reach a hash only through
@@ -597,6 +878,23 @@ installed. Every fallback costs cache hits and never trades away invalidation, b
597
878
  reporting a failing one — a fileset that excluded a manifest with no digest replacing it would serve stale results
598
879
  silently.
599
880
 
881
+ ## Build/Test Graph Boundary
882
+
883
+ The final-graph `createMetadata` hook also calls `refuseBuildTestDependencies(graph, workspaceRoot)` from
884
+ `@smoothbricks/nx-plugin/task-graph-policy`. A `build` aggregate, an inferred build family, or any non-test target with
885
+ outputs must not reach test work through `dependsOn`, directly or transitively. Inference publishes its semantic kind in
886
+ target metadata; declared targets use the same test naming policy, including `test`, `test-*`, `cargo-test-*` and
887
+ `*-test`. The archive is test work even though it compiles rather than executes.
888
+
889
+ Nx's metadata hook precedes its implicit-project-edge pass. The decision first completes any declared implicit edges
890
+ with Nx's own `applyImplicitDependencies` and `ProjectGraphBuilder` over an isolated dependency map, leaving the
891
+ supplied graph unchanged. Nx then constructs each build's task graph itself, resolving string/object declarations,
892
+ project selectors, wildcards, caret dependencies and configurations. The pure decision inspects only those reachable
893
+ edges. A typed `BuildTestDependencyError.findings` names the originating build and the offending `source -> test` edge.
894
+ Tests may consume build outputs; builds never consume test binaries or results. The graph rule has no name denylist in
895
+ `nx.json` and needs no filesystem access. Its decision tables use in-memory Nx graphs; one wiring smoke exercises the
896
+ installed hook through `nx show project`.
897
+
600
898
  ## Cowshed Build-State Output Policy
601
899
 
602
900
  Consuming repositories enforce build-volume safety in their Nx lint, using the graph that lint already resolved:
@@ -610,6 +908,42 @@ are resolved against the caller's workspace root. `BuildStateOutputError.finding
610
908
  configuration, output, and contributed path. Keep cacheable artifacts under source-tree paths such as `dist/` and
611
909
  `.cache/nextest/`; restoring an output under `target/` or `.nx/` can replace a build-volume link with a real directory.
612
910
 
911
+ `refuseOverlappingOutputs(graph, workspaceRoot)` from the same module gives each output path one producing task. The
912
+ plugin calls it during its final-graph `createMetadata` hook, so every Nx command, including `nx show project`, refuses
913
+ an overlap without additional workspace configuration. Two configurations of one target are distinct producers too. It
914
+ refuses an output at, under or above another task's output: Nx restores a directory output as one tree, so a second
915
+ target writing inside it leaves the first target's tree unlike its cache artifact after every build, and the two restore
916
+ over each other without either ever being a cache hit. Each declaration states its kind: one ending in `/` names a
917
+ directory, any other a file (`{projectRoot}/dist/`, `{options.out}/`). A pattern conflicts with a path at or above its
918
+ static prefix (it writes beneath that path, so a file there collides by kind), a path it matches, or a directory it can
919
+ reach inside under Nx's own minimatch, which expands brace alternatives before splitting segments; a file below its
920
+ prefix that it does not match is not written by it. Identical patterns from distinct producing tasks are the same claim
921
+ and are refused; different patterns are not judged, since only a file both match collides. `OutputOverlapError.overlaps`
922
+ names both task/configuration identities and outputs. Both validators interpolate the declarations themselves, so a
923
+ declaration Nx refuses to interpolate raises `OutputDeclarationError` naming its target.
924
+
925
+ Raw project output declarations, including collect/apply fixtures, retain the directory suffix. Already-resolved Nx
926
+ `Task.outputs` paths are normalized paths, not declarations, and need no trailing `/`.
927
+
928
+ `refuseMisdeclaredOutputKinds(graph, workspaceRoot)` holds those declarations to the built tree: a literal output
929
+ declared a file that is a directory on disk, or declared a directory that is a file, raises `OutputKindError`, whose
930
+ `findings` name the target, output, declared kind and on-disk kind. Call it where the outputs exist after a build; an
931
+ output absent on disk is not judged, and patterns state no kind. The overlap policy reads only the declarations, so its
932
+ verdict is the same in every checkout.
933
+
934
+ `existingOutputFiles(graph, workspaceRoot, expandOutputs)` lists every existing regular file that a task's declared
935
+ outputs name, for every target and configuration of the resolved graph, fallback outputs included, whether or not a run
936
+ selected the task. Each task's outputs are expanded on their own with stock Nx's `expandOutputs`, the native expansion
937
+ Nx's cache uses, so one task's negation never drops another task's claim. An expanded directory contributes every
938
+ regular file beneath it, read without descending a symbolic link at, above or below it; symbolic links and other
939
+ non-regular entries are not listed, and an absent output contributes nothing. A read failure other than absence while
940
+ listing such a directory throws, naming the operation and the path, so an unreadable directory under a literal directory
941
+ output does not pass for an absent one. Stock expansion silently drops entries it cannot read while matching a glob;
942
+ that is Nx's behaviour, and it is accepted here. An output naming the workspace root or a path outside it raises
943
+ `OutputEscapeError` naming every such task, before any disk access. A land enumerates these files before it freezes the
944
+ target's seed (cowshed `source_paths.js`). An undeclared generated build input is outside this contract: only a
945
+ generated input some task declares as an Nx output is listed, and so carried.
946
+
613
947
  ## Test Walk Policy
614
948
 
615
949
  A test pays its setup once and asserts after each step; two cases that test one path are one test. Consuming
@@ -698,6 +1032,45 @@ case; a stand-in in another file; a bound below the backstop beside untimed real
698
1032
  `findClockOracles(root, files, changes)` and `formatClockOracle` are exported from
699
1033
  `@smoothbricks/nx-plugin/test-clock-policy`.
700
1034
 
1035
+ ## Forbidden Spelling Policy
1036
+
1037
+ Three workarounds that AGENTS.md forbids by rule name have a single spelling. Consuming repositories refuse new ones
1038
+ with the `smoo-nx-forbidden-spellings` bin, which prints one `error[…]` per site, names the AGENTS.md rule it enforces,
1039
+ and exits 1:
1040
+
1041
+ - **NO-SKIP-NX-CACHE** (Diagnosis): the Nx cache-bypass flag in any of its spellings, or its environment switch set to
1042
+ `true` in a shell assignment, a property write or an object, YAML or JSON key. A task that passes only uncached has a
1043
+ broken input, output or dependency declaration; repair it at its owner.
1044
+ - **NO-HOST-CENSUS** (Proof): `ps`, `lsof` or `pgrep` in command position (line start, a YAML `- ` item or `key: `, a
1045
+ shell separator, `sudo`/`env`/`exec` with their options and assignments, or a quote) that reads every process. An
1046
+ unquoted shell command does so unless it names a pid scope (`-p`, `-P`, `-g`, `--pid`): bare `lsof` and `pgrep node`
1047
+ select the whole host. A quoted program may take its arguments from a variable, so it is refused only with a visible
1048
+ selecting option and no scoping one. A signal sent by process name and a listing of `/proc` (`readdir`, `scandir`,
1049
+ `ls`, `find`) are refused too. Start from pids the caller holds and read exactly those.
1050
+ - **NO-WAIVER-LEDGER** (Workarounds): a file the change adds whose name makes it a list of known-broken sites
1051
+ (`*.ledger.*`, `known-broken*`, `known-failures*`). Fix the sites; only an existing ledger may shrink.
1052
+
1053
+ Like `smoo-nx-test-walks`, the bin judges only what changed since `upstreamBase`. The line rules read the new-side lines
1054
+ of each change and the path rule reads only the files the change adds, which `diffScope` reports as `added` (every path
1055
+ absent at the base, tracked or untracked, with rename detection off). The check stops new sites and removes none, so
1056
+ existing sites need no allowance table. Comment-only lines (`//`, `/*`, `* `, `# `, `<!--`), Markdown, plain text, lock
1057
+ files, logs, patches, JSONL and binary files are not read: prose and recorded data quote the forbidden forms as policy
1058
+ or history. The policy's tests build each spelling at runtime from parts, so no file needs an exemption.
1059
+
1060
+ The check reads every changed file in the tree, so it runs as the root project's own cached `forbidden-spellings`
1061
+ target, keyed by `{workspaceRoot}/**/*` and run before `lint`. Inside `lint` it would either key lint's other commands
1062
+ by the whole tree or, keyed as narrowly as they are, replay a cached pass after a new site landed outside that key.
1063
+
1064
+ It reads one line at a time, so an argv list split across lines is judged by its first line only. A quoted program whose
1065
+ arguments live in a variable (`probe('lsof', args)`) shows no option to judge and passes. A spelling assembled at
1066
+ runtime or passed through a variable is invisible, and a ledger kept inside a file with another name is not seen. A
1067
+ trailing comment is part of its code line, and prose in a string literal that sits in command position reads as a
1068
+ command. A pure deletion adds no line, so `diffScope` marks its range `deleted` and no line rule judges the line it
1069
+ names. A deleted file is inactive; any other read failure stops the check with
1070
+ `Cannot inspect FORBIDDEN-SPELLING input <file>: <detail>` and exit 2. `findForbiddenSpellings(root, scope)`,
1071
+ `findLineSpellings`, `findAddedPathSpelling` and `formatSpellingFinding` are exported from
1072
+ `@smoothbricks/nx-plugin/forbidden-spelling-policy`.
1073
+
701
1074
  ## Nx Target Naming
702
1075
 
703
1076
  Target names are `{tool}-{output}` names. Use names like `tsc-js`, `tsdown-js`, and `cargo-wasm`; `build` and `lint` are
@@ -705,9 +1078,71 @@ aggregates.
705
1078
 
706
1079
  Concrete targets come from concrete files:
707
1080
 
708
- - `tsc-js` emits transformed JavaScript through a temporary JS-only `ttsc` config, restores execute bits on outputs
709
- declared by `package.json#bin`, then emits declarations and declaration maps from the original project with native
710
- `tsc`. Direct project references and every cached output lane are preserved.
1081
+ - `tsc-js` runs `ttsc -p tsconfig.lib.json --emit` with flags that make it emit transformed JavaScript, declarations and
1082
+ declaration maps from one non-incremental program, then restores execute bits on outputs declared by
1083
+ `package.json#bin`. It writes no file beside the tsconfig, whose directory a consumer's ttsc transform lists while it
1084
+ compiles. Direct project references and every cached output lane are preserved. The config's `outDir` is the target's
1085
+ only output and holds exactly what this emit wrote: the compiler rewrites every output it produces in place, so after
1086
+ a successful emit the executor removes each file under `outDir` whose inode, ctime and mtime are unchanged since
1087
+ before the emit, and each directory that leaves empty. A file an earlier build wrote and this one no longer does (a
1088
+ bin moved to another package, a deleted module) is gone before Nx captures the output, so no cache artifact carries
1089
+ it. A failed emit removes nothing, and an `outDir` that holds a TypeScript source is refused before the compiler runs.
1090
+ It writes `.build-inputs.json` into the `outDir`: the SHA-256 of every file the config's `include` matches less its
1091
+ `exclude`, taken before the emit, and those globs as Git pathspecs. Native targets write the same record from rustc's
1092
+ dep-info through `@smoothbricks/build-inputs`: macOS uses its `smoo-nx-build-inputs` CLI and Linux's `cargo-zigbuild`
1093
+ executor calls that same collector. A record produced under Nx also carries its producer's project, target and
1094
+ optional configuration, taken from the actual task environment. Shell entry uses that identity to judge the selected
1095
+ development receipts, including inferred targets absent from package manifests, and name their actual cached rebuild.
1096
+ It constructs no Nx graph, shadow output registry or second interpolation policy. The record is inside the target's
1097
+ outputs, so a cache hit restores it with them; a live developer link (`@smoothbricks/cli`, "Declared Links") checks it
1098
+ to tell a current build from a stale one by content. The shell entry that bootstraps the plugin
1099
+ (`tooling/direnv/enter-shell.ts`) keeps its build marker under `node_modules/.cache`, not under `outDir`, where the
1100
+ executor would remove it as a file its emit did not write.
1101
+ - `scriptc-<arch>-<family>` (`scriptc-arm64-macos`, `scriptc-x64-macos`, `scriptc-arm64-linux`, `scriptc-x64-linux`) are
1102
+ inferred for a package that lists `scriptc` in `devDependencies` (that pin is the compiler the targets run; the
1103
+ workspace root lists `scriptc` in `trustedDependencies` so its install links the platform compiler) together with each
1104
+ platform's runtime pack at the same version (`@scriptc/runtime-darwin-arm64`, `-darwin-x64`, `-linux-arm64-musl`,
1105
+ `-linux-x64-musl`); inference refuses a missing or mismatched pack by name. Each run emits the package's transformed
1106
+ JavaScript from `tsconfig.lib.json` with ttsc into private staging under `.cache/scriptc/` (removed when it ends) and
1107
+ compiles every executable declared in `package.json#bin` with `scriptc build --strip --no-keep-llvm` into
1108
+ `dist/bin/<platform>/<name>` (`darwin-arm64`, `darwin-x64`, `linux-arm64`, `linux-x64`, the directories
1109
+ `@smoothbricks/cowshed`'s launcher reads); a failed run removes the executables it wrote. Bin names, coverage and
1110
+ output paths always come from `bin`. By default each native executable compiles its public bin module. Optional
1111
+ `package.json#scriptc.entries` maps an already-declared bin name to a different emitted JavaScript module, for example
1112
+ `{ "tool": "./dist/ts/native-cli.js" }` when `bin.tool` names `./dist/ts/node-cli.js`. Values use the same
1113
+ package-root-relative spelling as `bin` and must name `.js` modules under the same declared `outDir`; inference
1114
+ converts them to paths relative to the emitted JavaScript's root for every platform. Unlisted bins keep their default
1115
+ module. Unknown names, malformed maps or values, and paths outside that root or not ending in `.js` are refused. Entry
1116
+ overrides require no FFI declaration; when `scriptc.ffi` is present, staging and native inputs are unchanged. Every
1117
+ host builds every platform the same way, `SCRIPTC_TARGET=<triple>` with `SCRIPTC_CC=zigcc` (zig from the devenv
1118
+ shell): the triples are `aarch64-macos`, `x86_64-macos`, `aarch64-linux-musl` and `x86_64-linux-musl`, so the Linux
1119
+ executables are static musl, as cowshed's CLI is. Like every platform target, the host's own joins `build` and the
1120
+ publish legs build and collect the others by family (`*-linux` on the Linux runner, `*-<arch>-macos` on each macOS
1121
+ leg), so a published tarball carries all four. A platform target's closure stays in its family and the four are
1122
+ collected on different hosts, so each emits on its own rather than depending on `tsc-js` or sharing its output;
1123
+ scriptc type-checks the staged JavaScript under a strict `tsconfig.json` the run writes beside it, with a
1124
+ `package.json` naming it ES modules. Such a package still emits its `tsc-js` JavaScript into `dist/ts` (`outDir`;
1125
+ inference refuses `dist` itself or `dist/bin`), so that JavaScript and the executables are disjoint outputs. Before
1126
+ compiling, a run fails on any call through a `typia` import binding (default, namespace, named, or destructured from
1127
+ one; the `typia/lib/internal/` helpers the transform itself emits calls to are not such imports) left in the staged
1128
+ JavaScript (`file:line:column` and the call): ttsc emits a typia call untransformed, without an error, when the
1129
+ emitting package does not list `typia` itself, and such a call throws at run time. A package whose executables call C
1130
+ through scriptc's FFI declares it in `package.json#scriptc.ffi` (`manifest`, the FFI manifest; `declarations`, each
1131
+ ambient `.d.ts` mapped to where it is staged beside the emitted JavaScript; `sources`, the C files): every run copies
1132
+ the declarations there, compiles the sources for its triple with zig
1133
+ (`zig cc -target <triple> -O2 -fno-sanitize=undefined`, since zig's Debug default calls UBSan handlers only a zig link
1134
+ carries, then `zig ar`) into one archive, and hands scriptc (`--ffi`) a staged copy of the manifest that keeps its
1135
+ fields and links that archive. The manifest lists no `libraries` (every platform builds it, and a prebuilt archive
1136
+ holds one triple's code), and every path stays beneath its root (the project; for a declaration's staged path, the
1137
+ emitted JavaScript's root) or inference and the run refuse it by name. The manifest, declarations and sources are
1138
+ inputs of every platform target (a header a source includes is not one, so keep the C self-contained), and a failed
1139
+ compile writes no executable.
1140
+ - Commands this plugin infers run the tool packages' executables for the inferring host,
1141
+ `node_modules/@smoothbricks/nx-plugin/../<tool>/dist/bin/<platform>/<bin>`: `smoo-nx-build-inputs` after a napi build.
1142
+ When the tool package is a project of the workspace being inferred, the command's target depends on that tool's
1143
+ `scriptc-<arch>-<family>` for the host, so the executable exists before it runs; an installed tool package carries
1144
+ every platform's executable already. A host no scriptc platform covers has no executable to run, and inference names
1145
+ it.
711
1146
  - `typecheck` is inferred from `tsconfig.lib.json` and runs the native compiler `SMOO_TYPECHECK_TSC` names (built by
712
1147
  `devenv.smoo.nix` from a pinned TypeScript revision) as `-p tsconfig.lib.json --noEmit`, directly rather than through
713
1148
  `ttsc`. Transform plugins' diagnostics are enforced by `tsc-js`, which runs them.
@@ -718,38 +1153,45 @@ Concrete targets come from concrete files:
718
1153
  - `typecheck-tests:watch` is inferred from `tsconfig.test.json` and runs the same typecheck in watch mode.
719
1154
  - `test-watch` is inferred when the package already defines an explicit Bun or Vitest `test` command. The plugin derives
720
1155
  the corresponding watch command and makes it depend on `typecheck-tests`.
721
- - A workspace-root `Cargo.toml` provides `cargo-test`, `test`, `cargo-lint`, `mutation`, and `bench`.
722
- `cargo-test-compile` warms one workspace `cargo test --no-run`. `cargo-test-archive` runs one
723
- `cargo --frozen nextest archive --workspace` into `.cache/nextest/archive.tar.zst` and is the only cached cargo BUILD:
724
- it produces a file outside the build-volume links rather than a mutable build tree. Nx cache restoration must never
725
- replace Cargo's `target` link. Its inputs, like every cargo-derived fileset, are anchored at `{workspaceRoot}`: Nx
726
- resolves a `{projectRoot}` glob against only the files its project owns, and a nested package owns the crates under
727
- it, so a root workspace's archive spelled that way hashes none of its members and replays stale binaries against
728
- edited crates. Each member crate gets a cached `cargo-test-<package>` run (30s slow-test warning, no per-test kill)
729
- whose inputs include that crate and its path dependencies, and whose command runs
1156
+ - A workspace-root `Cargo.toml` provides `cargo-test`, `test`, `cargo-lint`, `mutation`, and `bench`. Build targets
1157
+ compile build outputs only: compiling every test binary makes every build a test build. Test runners depend on their
1158
+ workspace's `cargo-test-archive` themselves, and a test that executes a CLI or loads an addon names its producer.
1159
+ `cargo-test-archive` runs one `cargo --frozen nextest archive --workspace` into `.cache/nextest/archive.tar.zst` and
1160
+ is the only cached Cargo compilation of test binaries: it produces a file outside the build-volume links rather than a
1161
+ mutable build tree. Nx cache restoration must never replace Cargo's `target` link. Its inputs, like every
1162
+ cargo-derived fileset, are anchored at `{workspaceRoot}`: Nx resolves a `{projectRoot}` glob against only the files
1163
+ its project owns, and a nested package owns the crates under it, so a root workspace's archive spelled that way hashes
1164
+ none of its members and replays stale binaries against edited crates. Each member crate gets a cached
1165
+ `cargo-test-<package>` run (30s slow-test warning, no per-test kill) whose inputs include the crates Cargo builds for
1166
+ that crate's tests (from Cargo's locked resolve: its dependencies and its own dev-dependencies, never the
1167
+ dev-dependencies of the crates below it), and whose command runs
730
1168
  `cargo --frozen nextest run --binaries-metadata … --cargo-metadata … --target-dir-remap … --workspace-remap . -E 'package(<crate>)'`
731
1169
  from the archive's one extraction. Runners therefore execute rather than build: they compile nothing in cargo's build
732
- tree, and fan out instead of chaining. They do not unpack the archive each: before the run, `smoo-nx-nextest-extract`
733
- hashes it and extracts it into `<target_directory>/nextest-extracted/<sha256>` unless a runner already did — one
734
- extracts, the others wait — so a workspace with ~200 test binaries and ~25 crates unpacks them once per archive
735
- instead of once per crate. The directory is keyed by the archive's bytes, so a rebuilt or cache-restored archive never
736
- runs an older extraction's binaries, and publishing one removes the others. The target directory is the one
737
- `cargo metadata` reports for the runner's Cargo workspace, so a `build.target-dir` setting moves the extractions with
738
- the build tree. An extraction is per-checkout tool state like the rest of that tree, never an Nx output: it lives in
739
- Cargo's build tree, which a checkout with a build volume keeps off its source tree, and it never sits under a declared
740
- output such as `.cache/nextest`. `cargo clean` removes it. A repository's own target that runs tests from the
741
- workspace archive calls the same helper and passes the same reuse flags: `nextest run --archive-file` unpacks the
742
- whole archive into a fresh directory under its `TMPDIR`, which for a `bounded-exec` task on macOS is a lease on the
743
- shared RAM volume (measured: a 548 MB archive unpacks to 1.97 GiB, and four such tasks filled the 8 GiB volume). The
744
- RAM lease holds what tests write, never the binaries they run. `--workspace-remap` is required — an archive records
745
- the producing tree's absolute paths, and without it a restored archive hands tests another checkout's
746
- `CARGO_MANIFEST_DIR`. With it the archive is relocatable, so one cache entry serves every checkout of the same commit;
747
- nextest re-points `CARGO_BIN_EXE_<name>`/`NEXTEST_BIN_EXE_<name>` at the extracted binaries at runtime, but a test
748
- that reads them through the compile-time `env!` macro keeps the producing tree's path. Per-crate runners accept an
749
- empty nextest selection because a valid workspace member may have no tests and a hash partition may legitimately be
750
- empty. A crate in the project that builds the debug cdylib runs after `napi-debug`, because its tests load that addon
751
- from `target/debug`. A crate declaring `[package.metadata.smoothbricks.wasm-bindgen]` also receives the cacheable
752
- `cargo-wasm` output target in its owning project.
1170
+ tree, and fan out instead of chaining. They do not unpack the archive each: before the run, the host's native
1171
+ `smoo-nx-nextest-extract` (`@smoothbricks/nextest-extract`) reads the archive's key and extracts it into
1172
+ `<target_directory>/nextest-extracted/<key>` unless a runner already did — one extracts, the others wait — so a
1173
+ workspace with ~200 test binaries and ~25 crates unpacks them once per archive instead of once per crate. The key is
1174
+ the hash of the `cargo-test-archive` task that produced the archive, which that task writes beside it
1175
+ (`.cache/nextest/archive.tar.zst.key`, a declared output Nx restores with the archive), so nothing reads the archive's
1176
+ bytes to identify it, a rebuilt or cache-restored archive of other inputs never runs an older extraction's binaries,
1177
+ and publishing one removes the others. An archive without a key, or one rewritten while it is being extracted, is
1178
+ refused. The target directory is the one `cargo metadata` reports for the runner's Cargo workspace, so a
1179
+ `build.target-dir` setting moves the extractions with the build tree. An extraction is per-checkout tool state like
1180
+ the rest of that tree, never an Nx output: it lives in Cargo's build tree, which a checkout with a build volume keeps
1181
+ off its source tree, and it never sits under a declared output such as `.cache/nextest`. `cargo clean` removes it. A
1182
+ repository's own target that runs tests from the workspace archive calls the same helper and passes the same reuse
1183
+ flags: `nextest run --archive-file` unpacks the whole archive into a fresh directory under its `TMPDIR`, which for a
1184
+ `bounded-exec` task on macOS is a lease on the shared RAM volume (measured: a 548 MB archive unpacks to 1.97 GiB, and
1185
+ four such tasks filled the 8 GiB volume). The RAM lease holds what tests write, never the binaries they run.
1186
+ `--workspace-remap` is required — an archive records the producing tree's absolute paths, and without it a restored
1187
+ archive hands tests another checkout's `CARGO_MANIFEST_DIR`. With it the archive is relocatable, so one cache entry
1188
+ serves every checkout of the same commit; nextest re-points `CARGO_BIN_EXE_<name>`/`NEXTEST_BIN_EXE_<name>` at the
1189
+ extracted binaries at runtime, but a test that reads them through the compile-time `env!` macro keeps the producing
1190
+ tree's path. Per-crate runners accept an empty nextest selection because a valid workspace member may have no tests
1191
+ and a hash partition may legitimately be empty. A crate in the project that builds the debug cdylib runs after
1192
+ `napi-debug`, because its tests load that addon from `target/debug`. A crate declaring
1193
+ `[package.metadata.smoothbricks.wasm-bindgen]` also receives the cacheable `cargo-wasm` output target in its owning
1194
+ project.
753
1195
  - The plugin's own `nextest.toml` is passed as
754
1196
  `--tool-config-file "smoo:$PWD/<to workspace root>/node_modules/@smoothbricks/nx-plugin/nextest.toml"`, so it is a
755
1197
  layer BENEATH the repository's `<cargo-workspace>/.config/nextest.toml` rather than a replacement for it: a repository
@@ -787,6 +1229,19 @@ Concrete targets come from concrete files:
787
1229
  independently. Drivers run the built production Node executor, supplied by the test target's build dependency, rather
788
1230
  than starting a native TypeScript compiler for every case inside the shard's progress bound. Each case settles its
789
1231
  owned processes before the next case starts; the fixture is removed only after the final settlement.
1232
+ - A sharded crate can name its slow tests with their measured milliseconds in
1233
+ `<cargo-workspace>/.config/nextest-timings.json` (`{ "<crate>": { "<test path>": <ms> } }`). Those tests leave the
1234
+ hash: the crate's exception shards run them, dealt longest first onto the shard with the least time so far, and its
1235
+ ordinary shards hash only what the manifest does not name. The last exception shard also runs the exceptional tests
1236
+ the manifest does not name, so the targets stay an exact partition however stale the manifest is: a renamed test
1237
+ selects nothing and a new slow test is hashed until the next refresh. A hash spreads many short tests evenly but drops
1238
+ a few long ones wherever their names fall: one cowshed-core gate's eight hash shards held 83 to 276 s of test time
1239
+ around a 168 s mean, because its 51, 38 and 18 s tests shared buckets; dealt by time, the same reports put at most 101
1240
+ s on any of the crate's sixteen targets. `smoo-nx-nextest-timings <crate> <report.xml>...`, run from the cargo
1241
+ workspace root, rewrites one crate's entry from the JUnit reports bounded-exec keeps for the crate's targets
1242
+ (`.nx/workspace-data/bounded-exec/<project>%3A<target>/report.xml`), naming each test of at least 3 s. The manifest
1243
+ may time only a member that declares `shards`, by test paths a `test(=…)` filter matches literally; anything else
1244
+ fails graph construction.
790
1245
  - A repository's serial test groups each run in one runner, `cargo-test-group-<group>`, owned by the cargo workspace
791
1246
  root beside `cargo-test-archive`. A group is declared once, in `<cargo-workspace>/.config/nextest.toml`: a
792
1247
  `[test-groups.<group>]` table with `max-threads = 1`, and default-profile overrides that name it with `test-group` and
@@ -794,7 +1249,7 @@ Concrete targets come from concrete files:
794
1249
  per-crate exclusions cannot drift; every crate piece excludes it with `not (…)`, so each test is selected by exactly
795
1250
  one target. The runner is not inferred off macOS, where nextest applies the group nowhere and no piece excludes its
796
1251
  tests. It is a `bounded-exec` run of the group's selection under the same progress bound as every test target, and
797
- asks for one CPU token, matching the group's one runnable test process instead of reserving idle host capacity. The
1252
+ asks for one CPU token, matching the group's one runnable test process instead of holding tokens it cannot use. The
798
1253
  run carries `--no-fail-fast`: an ordinary test failure does not stop the group's remaining tests, and a failed verdict
799
1254
  lists the failed ones. It carries `--no-tests=fail`, so a filter that selects no test fails the group. Ignored tests
800
1255
  keep their explicit lane. A crate named `group-*` is refused, since its runner name would collide. A repository's
@@ -805,9 +1260,9 @@ Concrete targets come from concrete files:
805
1260
  - `cargo-test` is the ordinary suite alone: it depends on the crate pieces and never on a serial group, so a run of it
806
1261
  never reaches a group's real-image tests. The inferred `test` of the cargo workspace root and of every project that
807
1262
  owns crates depends on `cargo-test` alone. Explicit repository config owns host coverage: this repository's root
808
- `host-e2e` depends on both real-APFS groups, and `gate` depends on `host-e2e` plus every project's `lint`, `test` and
809
- `build`. `nx run-many -t gate` therefore covers the host boundary without pulling it into ordinary `test`; each group
810
- replays from cache unless its own inputs changed.
1263
+ `host-e2e` depends on both real-APFS groups and on cowshed's `host-napi-test`, and `gate` depends on `host-e2e` plus
1264
+ every project's `lint`, `test` and `build`. `nx run-many -t gate` therefore covers the host boundary without pulling
1265
+ it into ordinary `test`; each proof replays from cache unless its own inputs changed.
811
1266
  - A group's runner hashes only the crates its filter can select tests from, with everything they link, every member
812
1267
  manifest and the repository's nextest config, so a change to an unrelated crate leaves it cached. The filter is read
813
1268
  as nextest reads it (its precedence, blanks and predicate arguments; `filterScope`): a plain `package(<name>)` or
@@ -927,10 +1382,15 @@ actual callback. A complete witness binds its contract, native file/hash/namespa
927
1382
  callback, read file/directory stamps, missing paths, physical package resolutions, tools and environment. TypeScript
928
1383
  extends and reference scans retain their existing results while recording the outside inputs they really read, including
929
1384
  Git configuration origins and relevant namespace inventories. Installed Nx owns daemon/worker environment normalization;
930
- loader/preload settings are not silently dropped. Missing or changed declarations, missing traces, stale read evidence
931
- and unknown loaders, dynamic configuration or unbounded reads make the proof unproved and require the ordinary
932
- authoritative graph RPC. A declared kind alone is never admission, and this witness never replaces current Nx task
933
- hashing or artifact comparison.
1385
+ loader/preload settings are not silently dropped. A preload's own bytes are not its whole input, since it can load more
1386
+ code and read more files, so only an audited preload is bounded. A loader environment made only of preload clauses,
1387
+ `--require <file>` or `--require=<file>` in `NODE_OPTIONS` and `--preload <file>` or `--preload=<file>` in
1388
+ `BUN_OPTIONS`, whose every file's SHA-256 is in `AUDITED_PRELOADS`, is bounded, and each file is a witnessed read like
1389
+ any other input. That set holds cowshed's port-0 preload alone, which every cowshed job loads. Any other preload, any
1390
+ other text in those variables, and any `LD_PRELOAD` or `DYLD_INSERT_LIBRARIES` is an unknown loader. Missing or changed
1391
+ declarations, missing traces, stale read evidence and unknown loaders, dynamic configuration or unbounded reads make the
1392
+ proof unproved and require the ordinary authoritative graph RPC. A declared kind alone is never admission, and this
1393
+ witness never replaces current Nx task hashing or artifact comparison.
934
1394
 
935
1395
  The installed-package census expands each declared `files` set and relative export targets through that workspace's Nx
936
1396
  native output authority, always retaining the manifest, directory/alias namespace evidence and every resolution edge;
@@ -988,19 +1448,23 @@ working tree, parent symlink replacement, and directory membership changes canno
988
1448
  `probeBuilt({ target, cwd })` is the distinct typed read-only product operation. Its `hit` is an actual published
989
1449
  `EnsureBuiltReceipt`, not a cache hit re-probed under the consumer's environment. The producer opts into publication in
990
1450
  its own Nx plugin options as
991
- `producerReceipts: { targets: ["lmao:rust-dist", "lmao:cargo-wasm", "lmao:cargo-thread-ffi"] }`, naming every target a
992
- consumer's snapshot declaration names. The pre-task hook captures the committed HEAD/tree and tracked-source/tool basis;
993
- the post-task hook uses Nx's actual successful `TaskResults`, hashes/hash details, argv and start/end times, including
994
- successful uncacheable prerequisites, and atomically publishes the receipt in that checkout's
995
- `.cache/producer-receipts`. That is its source tree, not Nx's workspace-data: under cowshed workspace-data is build
996
- state on the checkout's build volume, which a consumer's read grant of the provider checkout does not reach, so the
997
- consumer could not read the receipt it validates. The directory ignores itself with a `.gitignore` of `*`, so no
998
- checkout tracks a record and Nx never hashes one. A missing receipt refuses naming the path it was looked for at; a
999
- receipt the consumer cannot read refuses with the read error (EPERM under a sandbox). Disabled publication performs no
1000
- source prepass, so an ordinary consumer CLI pays none of that producer work. No file permission, path, daemon state or
1001
- cached row can invent a completion receipt. Nx takes one pre/post task-hook pair per plugin, so the plugin's pair runs
1002
- the controller's `COWSHED_NX_TASK_RECEIPT_ID` task-results hint first and these producer hooks second, each with the
1003
- same options and run context and neither reading the other's output.
1451
+ `producerReceipts: { targets: ["lmao:rust-dist", "lmao:cargo-wasm:production", "lmao:cargo-thread-ffi"] }`, naming every
1452
+ target a consumer's snapshot declaration names. The pre-task hook uses Nx's supplied project/task graphs and captures
1453
+ only configured roots scheduled in that invocation, including roots reached as dependencies. An invocation that runs
1454
+ none performs no source or tool census; a read-only wrapper probe likewise executes no producer tasks. Selected roots
1455
+ share one Git/tracked-source acquisition, with each root's precise public-output exclusions kept separate. The hook
1456
+ captures the committed HEAD/tree and tracked-source/tool basis; the post-task hook uses Nx's actual successful
1457
+ `TaskResults`, hashes/hash details, argv and start/end times, including successful uncacheable prerequisites, and
1458
+ atomically publishes the receipt in that checkout's `.cache/producer-receipts`. That is its source tree, not Nx's
1459
+ workspace-data: under cowshed workspace-data is build state on the checkout's build volume, which a consumer's read
1460
+ grant of the provider checkout does not reach, so the consumer could not read the receipt it validates. The directory
1461
+ ignores itself with a `.gitignore` of `*`, so no checkout tracks a record and Nx never hashes one. A missing receipt
1462
+ refuses naming the path it was looked for at; a receipt the consumer cannot read refuses with the read error (EPERM
1463
+ under a sandbox). Disabled publication performs no source prepass, so an ordinary consumer CLI pays none of that
1464
+ producer work. No file permission, path, daemon state or cached row can invent a completion receipt. Nx takes one
1465
+ pre/post task-hook pair per plugin, so the plugin's pair runs the controller's `COWSHED_NX_TASK_RECEIPT_ID` task-results
1466
+ hint first and these producer hooks second, each with the same options and run context and neither reading the other's
1467
+ output.
1004
1468
 
1005
1469
  The receipt binds the selected target, basis commit SHA and committed tree SHA, actual argv, declared producer
1006
1470
  environment identity and bound tool/module inputs, independent product output SHA-256, measured wall time, and an
@@ -1011,30 +1475,35 @@ stable through publication, and every refusal that one moved names the first nod
1011
1475
  node whose device, inode, mode, size and mtime are unchanged and only its ctime moved is re-read and compared with its
1012
1476
  recorded bytes, link text and membership, as any moved stamp requires a full comparison: under `globalStore` the closure
1013
1477
  lives in Bun's install cache, which every checkout on the machine shares, and linking a package's bin on any of their
1014
- installs re-chmods the store file to the mode it already has. A source, tool or output node the census read in the tick
1015
- it changed in, as a task's last writes are, is recorded unproven and re-read the same way. The command's stdout/stderr
1016
- digest is not a product digest. The bound tool/module inputs are the installed closures of Nx, this plugin, TypeScript
1017
- and local graph plugins, and the producer executables. A task's npm external inputs (`AllExternalDependencies` and the
1018
- npm nodes of its project's dependency closure) are Nx's lockfile identities: the task's hash details and the committed
1019
- `bun.lock` bind them, and no installed closure is resolved for them, since under Bun's isolated linker most of them do
1020
- not resolve from the task's project.
1021
-
1022
- The pre-task hook stats every node of that installed closure on every run, and that is what lets it skip reading bytes.
1023
- The census is a function of the nodes' stamps (device, inode, mode, size, and mtime and ctime in nanoseconds), not of
1024
- the moment it runs: the hook records the census it took in Nx's workspace-data (`producer-installation-census.json`, a
1025
- hash source, never a proof), and the next run takes the hash of every file whose stamp has not moved and that the record
1026
- did not read in the tick it changed in. An unchanged closure reads no file bytes; a developer-linked package whose
1027
- `dist` a rebuild rewrites in place, with no lockfile or `node_modules` change, moves those files' ctimes and they are
1028
- read again. No cheaper generation (a lockfile, a manifest, an install marker) keys it, since such a rebuild moves none
1029
- of those. The tool's nodes take the hash the census read instead of reading each file a second time: a write landing
1030
- between two reads could make them disagree. Nor does the census take a stat pass of its own to prove itself: the tool's
1031
- nodes stat each of its nodes again, a file whose stamp moved since the census read it is read again, and the capture's
1032
- stability check refuses a tool node that moves before publication. For a consumer that links this plugin from a checkout
1033
- (about 28,000 closure nodes) the hook took 9-17 s of synchronous I/O on the plugin worker before, with every file read
1034
- twice, and 6-9 s after, almost all of it stats; on a host whose disk-image layer is saturated the reads ran for minutes,
1035
- while the worker's event loop could neither answer Nx nor reap its exited children. The hook's phases are performance
1036
- measures (`producerReceipts:graph`, `producerReceipts:source`, `producerReceipts:tools`, `producerReceipts:census`),
1037
- which Nx reports under `NX_PERF_LOGGING=true`.
1478
+ installs re-chmods the store file to the mode it already has. A directory whose size or mtime moved while its device,
1479
+ inode and mode stayed is compared with its recorded membership: an entry came or went in it. The membership a receipt
1480
+ records of a `node_modules` leaves out the patched Nx daemon's macOS watcher probe, `nx-watch-probe-<pid>-<n>`
1481
+ (`patches/README.md`, "A stopped watcher stream is never served from"), which any nx command's first daemon request
1482
+ creates there and removes at any moment of another command's run; since the stability check spans the whole run, from
1483
+ capture to the post-execution census, a probe counted as a member refused producer runs that changed no tool. A source,
1484
+ tool or output node the census read in the tick it changed in, as a task's last writes are, is recorded unproven and
1485
+ re-read the same way. The command's stdout/stderr digest is not a product digest. The bound tool/module inputs are the
1486
+ installed closures of Nx, this plugin, TypeScript and local graph plugins, and the producer executables. A task's npm
1487
+ external inputs (`AllExternalDependencies` and the npm nodes of its project's dependency closure) are Nx's lockfile
1488
+ identities: the task's hash details and the committed `bun.lock` bind them, and no installed closure is resolved for
1489
+ them, since under Bun's isolated linker most of them do not resolve from the task's project.
1490
+
1491
+ For an invocation with selected producers, the pre-task hook stats every node of that installed closure, and that is
1492
+ what lets it skip reading bytes. The census is a function of the nodes' stamps (device, inode, mode, size, and mtime and
1493
+ ctime in nanoseconds), not of the moment it runs: the hook records the census it took in Nx's workspace-data
1494
+ (`producer-installation-census.json`, a hash source, never a proof), and the next run takes the hash of every file whose
1495
+ stamp has not moved and that the record did not read in the tick it changed in. An unchanged closure reads no file
1496
+ bytes; a developer-linked package whose `dist` a rebuild rewrites in place, with no lockfile or `node_modules` change,
1497
+ moves those files' ctimes and they are read again. No cheaper generation (a lockfile, a manifest, an install marker)
1498
+ keys it, since such a rebuild moves none of those. The tool's nodes take the hash the census read instead of reading
1499
+ each file a second time: a write landing between two reads could make them disagree. Nor does the census take a stat
1500
+ pass of its own to prove itself: the tool's nodes stat each of its nodes again, a file whose stamp moved since the
1501
+ census read it is read again, and the capture's stability check refuses a tool node that moves before publication. For a
1502
+ consumer that links this plugin from a checkout (about 28,000 closure nodes) the hook took 9-17 s of synchronous I/O on
1503
+ the plugin worker before, with every file read twice, and 6-9 s after, almost all of it stats; on a host whose
1504
+ disk-image layer is saturated the reads ran for minutes, while the worker's event loop could neither answer Nx nor reap
1505
+ its exited children. The hook's phases are performance measures (`producerReceipts:source`, once per selected
1506
+ invocation, `producerReceipts:tools`, `producerReceipts:census`), which Nx reports under `NX_PERF_LOGGING=true`.
1038
1507
 
1039
1508
  Validity compares the committed tree, not the current HEAD spelling. An empty commit with an identical tree keeps the
1040
1509
  receipt valid and its original basis SHA unchanged; the consumer never rewrites that provenance. A genuinely changed
@@ -1063,7 +1532,21 @@ runs them in the workspace's Nx daemon, which runs inside the cowshed sandbox un
1063
1532
  sandbox denies the operator's global git configuration (specs/cowshed/04_sandbox.md, the runtime-input contract).
1064
1533
 
1065
1534
  A FILE-only source plan does not perform a redundant installation census for absent runtime recipes; the complete
1066
- producer tool/module and output SHA evidence is still captured and independently revalidated on every product probe.
1535
+ producer tool/module and output SHA evidence is still captured and independently revalidated on every product probe. A
1536
+ plan with runtime recipes takes its installation census with the graph witness's census (`ensure-built-graph.json`,
1537
+ which the same probe wrote) as its hash source, as the graph reuse does: an unchanged closure reads no file bytes, where
1538
+ every probe once re-read all of Nx, this plugin and TypeScript (about 21,000 files), minutes of reads on a loaded host.
1539
+
1540
+ A declared target names `cargoToolchain` for its toolchain identity and spells no version command of its own: a bare
1541
+ `rustc -vV` through the wrapper is no generator recipe, so a receipt target whose task graph reaches one is refused as
1542
+ an unbounded runtime source closure. `ensure-built-receipt.test.ts` judges this repository's receipt targets on its own
1543
+ graph.
1544
+
1545
+ A tracked public output stays in the source basis while it holds HEAD's bytes, so a later task can read it as a FILE
1546
+ input: the root `cargo-test-archive` reads the corpus `cowshed:wire-fixtures` regenerates, a tracked file that is both.
1547
+ Only its stamp is the run's to move (a cache restore or a regeneration moves it). A run that leaves it other bytes
1548
+ refuses the receipt, and one that differs from HEAD when the run starts binds no input, so a task that reads it is
1549
+ unbound.
1067
1550
 
1068
1551
  Git source provenance is the committed tree and the producer's clean tracked source basis, not an unrelated untracked
1069
1552
  user file in its working directory. An actual FILE input outside HEAD, a modified tracked input, changed membership,
@@ -1073,9 +1556,10 @@ cwd/toolchain FILE pins and proved installed closure. Public outputs are exclude
1073
1556
  with broad exclusions that can hide manifests or configuration. A caller probing multiple targets requires the same
1074
1557
  provider committed-tree identity, retaining each original producer basis, before publishing its sealed snapshot. A
1075
1558
  caller from another workspace never lends its socket, database or cache overrides to the provider. Inside a managed
1076
- shell (`DEVENV_RUNTIME`), `ensureBuilt` asks the packaged `nx-socket-dir.sh` owner for the provider's binding: the
1077
- root's verified cowshed runtime link when present, otherwise its canonical checkout spelling under that shell runtime.
1078
- Outside a managed shell, Nx retains its normal defaults. A socket-owner refusal returns `disposition: 'failed'` with
1559
+ shell (`DEVENV_RUNTIME`), `ensureBuilt` asks the packaged `nx-socket-dir.sh` owner for the provider's binding. A cowshed
1560
+ workspace root gets its verified runtime link; the owner refuses one its `.cowshed/env` names no link for, or whose link
1561
+ leads elsewhere. Any other root gets its canonical checkout spelling under that shell runtime. Outside a managed shell,
1562
+ Nx retains its normal defaults. A socket-owner refusal returns `disposition: 'failed'` with
1079
1563
  `reason.kind: 'workspace-socket'`, the selected `taskId`, `workspaceRoot` and operational `detail`, before any task or
1080
1564
  daemon client starts. The owner's actual exit or signal is preserved; the wrapper must not report that the target ran.
1081
1565
 
@@ -1308,6 +1792,15 @@ The Nx patch repairs upstream Nx runtime behavior, separately from this plugin's
1308
1792
  real daemon whose resident worker globs through it and requires zero open connections after the only client exits.
1309
1793
  Stock Nx keeps a worker until its last registered phase, so a plugin with task hooks keeps the same connection open
1310
1794
  there after a graph-only request; this hunk does not retire with the worker-retention hunk.
1795
+ - **The daemon is its own client only while it waits on a reply.** Code the daemon runs, such as a sync generator, that
1796
+ reaches Nx through another copy of the nx package finds no graph in that copy's project graph module, so it asks the
1797
+ daemon over the daemon's own socket, and that client kept the connection after the reply. Measured 2026-10-22: two
1798
+ shed daemons that ran `@smoothbricks/nx-plugin:managed-files` from a plugin linked outside the shed each held one
1799
+ socket pair to itself, logged one open connection with no client left, reset their idle timer every five minutes for
1800
+ half an hour until they were signalled by hand, and kept seven plugin workers each. The rule that releases a worker's
1801
+ connection once its request queue drains now covers the daemon process too. A bounded regression runs a real daemon
1802
+ whose global sync generator globs through the daemon's own client and requires zero open connections once the
1803
+ generator finishes.
1311
1804
  - **A daemon whose workspace has gone stops instead of reading it.** Nx 23.2.1's native file worker reads an empty file
1312
1805
  map as one it has not filled yet and waits on its condition variable for files (`FilesWorker::get_files`,
1313
1806
  `while guard.len() == 0`). Once every file of a workspace is deleted under a running daemon, as when a checkout is
@@ -1373,21 +1866,38 @@ What it wires:
1373
1866
  force-kill grace period. Test targets use this executor so hung test processes fail predictably instead of blocking Nx
1374
1867
  indefinitely.
1375
1868
 
1869
+ A run that ends at its bound ends with its whole process group, not its leader: SIGTERM, then SIGKILL after the grace. A
1870
+ group signal reaches only the members that exist when it goes out, and macOS does not hold a fork back while it does, so
1871
+ each force-kill is repeated while the kernel still lists members of the group. One module, `src/process-group.ts`,
1872
+ decides that (`judgeReap`) and does it for this executor, the RAM temp volume's deadline, the hang-diagnostics probes
1873
+ and the Cargo children of `cargo-source-hash`: every 5 ms for up to two seconds at a bound, and every millisecond for up
1874
+ to thirty where a process is ending and can wait for nothing. What a kill that waits on the event loop cannot end is
1875
+ named with its process group on stderr, or in the capture or error that reports the bound, and never called killed. A
1876
+ kill that blocks (the Cargo children's, the probe stop's) cannot reap the group's leader, which the kernel lists as a
1877
+ member until it is reaped, so what it leaves is told as listed and unconfirmed, not as running. A signal or probe that
1878
+ fails is told too, and never thrown past the cleanup that follows it. A process that left the group is beyond a group
1879
+ kill, and one that exited and has not been reaped yet is listed like a live one. The managed script
1880
+ `tooling/direnv/cargo-fetch-run.ts` makes the same decision with its own copy, since it runs before anything is
1881
+ installed.
1882
+
1376
1883
  A test target is bounded by progress alone: `idleTimeoutMs`, 180 s (`BOUNDED_TEST_IDLE_TIMEOUT_MS`, the hang backstop of
1377
1884
  `specs/cowshed/08_testing.md`), with no `timeoutMs`. The bound re-arms whenever the runner reports a finished test: a
1378
- nextest status line carrying its run counter (`PASS [ 0.438s] (1/4) …`), a libtest `test … ... ok` line, or a bun
1379
- result line or dot. Output that finishes no test is not progress: nextest's `SLOW` warning, repeated every slow-timeout
1380
- period for a test still running, and a hung test's heartbeat both keep printing. A suite that keeps finishing tests
1381
- therefore runs as long as it needs, however slow the host, and a test that never returns ends the run 180 s after the
1382
- last test that finished. bun prints nothing per passing test when it believes an agent runs it, so the executor asks a
1383
- lone `bun test` for `--dots`, one dot per finished test. Without a recognised execution lifecycle, the clock starts at
1384
- command spawn; a command that reports no tests makes progress only by exiting. nextest's slow-timeout and the serial
1385
- groups' code-time classes only warn; no per-test bound kills a test or fails one that passed. Bun has a per-test
1386
- deadline of its own, 5000 ms unless the command sets one, and it reads no bunfig for it, so every bun leg deletes it
1387
- with `bun test --timeout=0` (`BUN_TEST_TIMEOUT_FLAG`; `0` means no deadline, measured on the pinned Bun 1.4.2). A test
1388
- waits for the event it is waiting for, however long a loaded host makes the work take; one that never returns still ends
1389
- the run through `idleTimeoutMs`. `timeoutMs`, an absolute ceiling, is for commands that report no tests; a target names
1390
- at least one of the two.
1885
+ nextest status line carrying its run counter (`PASS [ 0.438s] (1/4) …`), a libtest `test … ... ok` line, a bun result
1886
+ line or dot, or a Vitest default-reporter file/test result. Timed Vitest `✓` and `×` lines count, as does a failed-file
1887
+ `❯ file (N tests | M failed) Xms` result or skipped-file `↓ file (N tests | M skipped)` result, with an optional
1888
+ duration for skipped files. Reporter headers, failure stack locations and final summary counts do not count. Output that
1889
+ finishes no test is not progress: the nextest `SLOW` warning, repeated every slow-timeout period for a test still
1890
+ running, and a hung test heartbeat both keep printing. A suite that keeps finishing tests therefore runs as long as it
1891
+ needs, however slow the host, and a test that never returns ends the run 180 s after the last test that finished. bun
1892
+ prints nothing per passing test when it believes an agent runs it, so the executor asks a lone `bun test` for `--dots`,
1893
+ one dot per finished test. Without a recognised execution lifecycle, the clock starts at command spawn; a command that
1894
+ reports no tests makes progress only by exiting. nextest's slow-timeout and the serial groups' code-time classes only
1895
+ warn; no per-test bound kills a test or fails one that passed. Bun has a per-test deadline of its own, 5000 ms unless
1896
+ the command sets one, and it reads no bunfig for it, so every bun leg deletes it with `bun test --timeout=0`
1897
+ (`BUN_TEST_TIMEOUT_FLAG`; `0` means no deadline, measured on the pinned Bun 1.4.2). A test waits for the event it is
1898
+ waiting for, however long a loaded host makes the work take; one that never returns still ends the run through
1899
+ `idleTimeoutMs`. `timeoutMs`, an absolute ceiling, is for commands that report no tests; a target names at least one of
1900
+ the two.
1391
1901
 
1392
1902
  On POSIX hosts, direct Go and Cargo test commands (including chains joined by `&&`, `||`, or `;`) share one private
1393
1903
  runner lifecycle: `build`, `active`, and `terminal`. A per-command Node supervisor reports phases over an acknowledged
@@ -1405,56 +1915,174 @@ watchdog.
1405
1915
 
1406
1916
  The unchanged 180 s interval re-arms on finished tests/packages. Initial Go linking, inter-package Go compilation, and
1407
1917
  initial or inter-command Cargo compilation spend no test idle budget. **Compiler-process activity is deliberately not a
1408
- signal:** Go linking and Rust compilation before execution are build work; Bun's cold-compiler fixture (and a Rust test
1409
- compiling a fixture) is active-test work and must still expire. Build output and heartbeats never reset the bound. Cargo
1410
- uses its native build declaration without replacing configured target runners; a nested `test result` or
1411
- `build-finished` line cannot retire the owned process or exempt its teardown. Absolute `timeoutMs`, when supplied, is
1412
- unchanged.
1918
+ signal:** Go linking and Rust compilation before execution are build work; Bun's cold-compiler load inside `bun test`
1919
+ (and a Rust test compiling a fixture) is active-test work and must still expire; only a declared fixture segment
1920
+ (below), finished before the runner starts, is build work. Build output and heartbeats never reset the bound. Cargo uses
1921
+ its native build declaration without replacing configured target runners; a nested `test result` or `build-finished`
1922
+ line cannot retire the owned process or exempt its teardown. Absolute `timeoutMs`, when supplied, is unchanged.
1413
1923
 
1414
1924
  Separately building test binaries and then executing them under the unchanged bound is a **workaround** for callers
1415
1925
  without a native lifecycle hook, not evidence that their combined cold-build command is safe. Direct Go/Cargo commands
1416
1926
  use the lifecycle channel instead; unknown wrappers retain conservative spawn accounting.
1417
1927
 
1928
+ A target may name a `fixtureCommand` with its `fixtureTimeoutMs`: a compiler-fixture producer the executor runs first,
1929
+ in the same cwd, environment and CPU grant, as segment 0 of the same lifecycle — a build interval for its whole life,
1930
+ under its own supervisor and acknowledged like a runner's phases. The command follows under `&&` (a direct Go/Cargo
1931
+ chain keeps its phases behind a brace group; any other command runs as one segment active from its spawn), so a fixture
1932
+ failure ends the run before a test starts, and fixture output earns no progress. `fixtureTimeoutMs` is the segment's own
1933
+ wall-clock ceiling, a build budget; the segment's terminal retires it, and expiring it records a `fixture` bound, since
1934
+ no test was running. The pair is refused unpaired, and a run that names it names no shadow record of warmth. This exists
1935
+ for warmth that lives outside Nx outputs — a compiler plugin cache, a Cargo `target/`: it cannot be a cacheable output,
1936
+ and as a `cache: false` prerequisite it executed even when every consumer then restored its verdict from cache, because
1937
+ Nx runs an uncached dependency before reaching its cached consumer. Inside the consumer's own task the cache decides: a
1938
+ hit restores the verdict and warms nothing; an execution warms first. Without the lifecycle channel (Windows) the
1939
+ fixture is plain shell text ahead of the command, bounded from spawn like any wrapper, and its ceiling does not apply.
1940
+
1418
1941
  Process-group timeout fixtures retain cleanup authority only until the command leader exits and every descendant closes
1419
1942
  its inherited lifetime FIFO. EOF is the terminal ownership event; a later `afterEach` must not signal the retired PGID
1420
1943
  again. Darwin can answer `EPERM` for an unreaped zombie-only group, and an ambient `ps` scan is not an ownership proof.
1421
1944
  Failed fixtures retain their cleanup obligation rather than suppressing signal errors.
1422
1945
 
1423
- A job waiting for a CPU token is queued, not idle. A descendant whose own work waits in the host's CPU queue (a test's
1424
- scratch cowshed project, say) writes `{"op":"host-wait"}` on the `BOUNDED_EXEC_CPU_POOL` it inherited and holds the
1425
- connection while the work waits; while any such wait is held, the idle clock is stopped and keeps the time it had left,
1426
- and it runs on from there when the last wait closes. stderr says `bounded-exec: idle clock stopped` and `… restarted`,
1427
- and an expiry names the queued time it did not count (`specs/cowshed/05_gateway.md`, "A queued descendant is not idle").
1428
- `timeoutMs` is never stopped.
1429
-
1430
- The final-five-second pre-signal snapshot attributes the runner's process tree and observed resources, with explicit
1431
- incomplete/raced results and no delay to termination. Its timing, visibility and evidence contract is defined in
1432
- `specs/cowshed/08_testing.md`, "Integration tests (real substrate)".
1946
+ The final-ten-second pre-signal snapshot attributes the runner's process tree, its leader and leaf call stacks and
1947
+ observed resources, with explicit incomplete/raced results and no delay to termination. Its timing, visibility and
1948
+ evidence contract is defined in `specs/cowshed/08_testing.md`, "Integration tests (real substrate)".
1433
1949
 
1434
1950
  The snapshot-reset regression orders capture, test completion, and expiry through IPC, not heartbeat cadence. It
1435
1951
  deliberately holds the first capture's progress publication while another heartbeat arrives; only the observed PASS
1436
- advances the next capture interval. Its 10 s virtual idle bound remains unchanged.
1437
-
1438
- On a macOS host, every `bounded-exec` task runs with its own `TMPDIR` lease: a directory on one RAM-backed APFS volume
1439
- per user, so test temp files never reach the SSD. The volume is created lazily by the first task that needs it and
1440
- detached when the last live lease ends, since its pages return only on detach. It is a legacy DiskImages RAM disk, so it
1441
- spends none of the AppleDiskImages2 attach budget cowshed counts (`specs/cowshed/01a_apfs.md`, "How the APFS host
1442
- degrades"). A lease whose task died is reclaimed by the next task, unless an image is still attached from a file below
1443
- it or a mount sits below it: those belong to whoever attached them, so the lease and the volume are kept and every new
1444
- task names them. The task's pid dying does not end what its command started, so before a lease is removed every process
1445
- working in it is stopped, with everything it started: a process counts when its working directory or the `TMPDIR` it was
1446
- started with lies in the lease. Most leftovers write there only through `TMPDIR` (a ttsc plugin build copying its Go
1447
- sources, a Bun or Node compile cache written at exit), and a working-directory census alone let them write into a lease
1448
- while it was removed, failing the next task's lease with `ENOTEMPTY`. A target's own `env.TMPDIR` wins over the lease.
1449
- Inside a cowshed sandbox, which cannot write the lock in `/private/tmp`, the task keeps its inherited `TMPDIR` and says
1450
- so once. A failed task whose output said ENOSPC (`ENOSPC`, or `strerror`'s `No space left on device`) names it, the
1451
- writer's task and lease, and the volume's free space read when that line arrived, and records the `no-space` verdict:
1452
- the writer usually removes what it half-wrote before it exits, so the volume no longer looks full by then. A failed task
1453
- that printed no such line but left the volume nearly full names the volume.
1952
+ advances the next capture interval. Its virtual idle bound is twice the capture window.
1953
+
1954
+ A leg that runs `bun` runs the Bun its workspace declares. Before it asks for a RAM lease or CPU tokens, the executor
1955
+ reads `packageManager` in the workspace root's `package.json` and, when that names `bun@<version>`, finds the first
1956
+ `bun` on the PATH the command runs with (the target's `env.PATH`, else the executor's own) and asks it `--version`, in
1957
+ the command's own environment, which is what a wrapper that routes `bun` reads. A command with no `bun` word in it
1958
+ (`bun test`, `cd x && bun run y`, `sh -c 'bun test'`), a workspace that declares no Bun and a PATH that holds none are
1959
+ not checked: the first runs none, the second declares none and the third leaves the shell to say so. A path-qualified
1960
+ `../runtime/bun test` names its binary itself, so PATH decides nothing for it. When the printed version is not the
1961
+ declared one the run is refused with a `failed` verdict, like every refusal before its command starts, and stderr names
1962
+ both versions, the binary and the setting each came from: `packageManager "bun@1.4.3"` in the manifest against
1963
+ `PATH from the target's env`, whose first `bun` prints 1.4.2. A `packageManager` that names `bun` and no exact version,
1964
+ or a `bun` that gives no answer to `--version` within 120 s, is refused the same way: a guard that skipped what it
1965
+ cannot read would be silent exactly where the declaration or the binary is wrong. The refusal replaces a failure far
1966
+ from its cause. A Bun other than the declared one passes startup, and on Bun 1.4.2 `console.log` drops what a full pipe
1967
+ refuses, so a child's JSON document reaches the parent that reads it cut mid-string while the child exits 0: the leg
1968
+ fails three layers from the cause as `JSON Parse error: Unterminated string`. The check is not made on Windows.
1969
+
1970
+ On a macOS host, a `bounded-exec` task whose processes a cowshed supervisor owns attempts its own `TMPDIR` lease on a
1971
+ RAM-backed APFS volume per user. RAM is acceleration, not a guarantee that temporary bytes never reach ordinary storage.
1972
+ The volume is created lazily by the first task that needs it and detached when the last live lease ends, since its pages
1973
+ return only on detach. It is a legacy DiskImages RAM disk, so it spends none of the AppleDiskImages2 attach budget
1974
+ cowshed counts (`specs/cowshed/01a_apfs.md`, "How the APFS host degrades"). The task never attaches the disk itself: the
1975
+ cowshed gateway does (`ram-lease`, `specs/cowshed/05_gateway.md`, "RAM disks"). The disk lives in a `diskimages-helper`
1976
+ process, and a helper the task's own job forked would be retired when that job ends, taking the volume from under every
1977
+ other job's lease, whose open files then read EIO. The helper belongs to the gateway; no job's retirement reaches it.
1978
+ The gateway holds the disk until the creating task keeps it, once the volume is mounted and marked at its mountpoint, or
1979
+ releases it, which detaches it. A task that dies, fails or misses its deadline first leaves the detach to the gateway,
1980
+ and a gateway restart leaves it to the next gateway's startup scan. A target's own `env.TMPDIR` wins over the lease.
1981
+ Inside a cowshed sandbox, which refuses the volume's own paths (its mountpoint and marker, and the lock in
1982
+ `/private/tmp`), the task keeps its inherited `TMPDIR` and says so once, whichever refusal it meets first.
1983
+
1984
+ Every owned `bounded-exec` target attempts the lease, test targets included. Explicit RAM unavailability uses a unique
1985
+ owned ordinary directory beside the RAM lock that answer was taken under, in the system temp directory `/private/tmp`.
1986
+ It lies outside every checkout, so no Git or Cargo walk from the command's temp files finds the workspace it builds; the
1987
+ workspace's runtime alias is not, since it resolves into `<mount>/.cowshed/run` inside the checkout. It never reuses
1988
+ inherited RAM as its fallback. The report names the actual medium/path and typed reason once; an explicit target
1989
+ `env.TMPDIR` wins, is labelled target-provided, and is never cleaned by the executor. Successful ordinary scratch is
1990
+ removed only after subtree retirement; failed or unretired scratch remains at its reported path. Reclamation never
1991
+ deletes the scratch of a run that did not pass: a lease whose task died, or whose own run failed, timed out or was
1992
+ signalled, is renamed whole into `/private/var/folders/cowshed/<uid>/ram3/.archive/<archived at, epoch ms>-<lease>`, on
1993
+ the same volume, so the move is one `rename(2)` and copies nothing (the build-volume trash does the same,
1994
+ `specs/cowshed/16_build_volumes.md`, "Garbage collection"). The task that reclaims it says where on stderr
1995
+ (`RAM temp volume: dead lease <lease> archived at <archive>: kept until …`). A passing run's lease is deleted. The
1996
+ volume keeps the newest two archives, the failing run under triage and the one before it, which a triage compares to
1997
+ tell a flake from a regression; that bound is a stated reason, not a measurement. It keeps none when less than half the
1998
+ volume is free as an archive arrives: half of 8 GiB is 2.5 times the 1.61 GiB a full parallel gate peaked at, and live
1999
+ leases need the space more than evidence does. Every other archive is renamed into
2000
+ `.archive/.deleting/<deleter pid>-<archive>` at once and deleted by that task in the background, one at a time, with
2001
+ nothing waiting on it; a dead deleter's entries are claimed and deleted by the next retention, and a failed deletion is
2002
+ said on stderr and retried then. What is retained is therefore bounded by the volume's life: the volume detaches with
2003
+ its last live lease, and its archives go with it, which that release says. A test whose value depends on its raw traces
2004
+ after the run must name a store-backed `env.TMPDIR`.
2005
+
2006
+ A failed task whose output said ENOSPC (`ENOSPC`, or `strerror`'s `No space left on device`) names it, the writer's task
2007
+ and lease, and the volume's free space read when that line arrived, and records the `no-space` verdict: the writer
2008
+ usually removes what it half-wrote before it exits, so the volume no longer looks full by then. A failed task that
2009
+ printed no such line but left the volume nearly full names the volume.
2010
+
2011
+ A lease names the attach of the volume it was taken on, and its space is read only while the mountpoint still holds that
2012
+ attach and the lease is still on it. Once the attach is gone the mountpoint is a bare directory on the host's Data
2013
+ volume, where a write through `TMPDIR` can make the lease path again, and that free space is not the lease's: the ENOSPC
2014
+ line then says the lease was lost and why, or that the volume could not be read. Its release says it the same way
2015
+ (`RAM temp volume: lease <lease> was lost while its task held it: …`) and is never taken as a release of a lease that
2016
+ was there.
2017
+
2018
+ What a command leaves running is ended by its owner, never chosen by where it works (`specs/cowshed/11_shell.md`,
2019
+ "Process identity and signal ownership"; `specs/cowshed/07_api.md`, `JobSubtreeHandle`). When the job's supervisor
2020
+ serves `COWSHED_SUPERVISOR_SOCKET`, the command runs as `cowshed subtree-root --handle-fd 4 -- /bin/sh -c <command>`:
2021
+ the wrapper asks the supervisor for a handle on itself while it is alive, writes the answer to descriptor 4, and execs
2022
+ the shell in the same process, so the command's pid, process group and life are unchanged; descriptor 3, the runner
2023
+ lifecycle's socket, reaches the shell as it would without the wrapper. When the command ends, however it ended, the
2024
+ executor pipes the handle to `cowshed retire-descendants --grace-ms 5000`: the supervisor sends TERM to every live
2025
+ member its observed tree records under that root (a fixture's Nx daemon in a session of its own and a ttsc build writing
2026
+ through `TMPDIR` included), KILL after the grace, and joins their exits. Each is named on stderr
2027
+ (`cowshed: the supervisor stopped <pid> (<image>), which the command left running`), as are the supervisor's coverage
2028
+ gaps (`… has a gap: <kind> (pid <pid>)`) and a receipt that may have ended processes it could not name: the line is the
2029
+ leak check, and a suite that prints it has a fixture to fix. A process that only works in the command's directory or
2030
+ lease, and that the command did not start, is in no such tree and is never signalled. A typed refusal of the admission
2031
+ (`foldUnavailable`, `notMember`, `foreignHandle`, `jobEnded`, `spentHandle`) still runs the command, unowned, and says
2032
+ nothing will retire what it leaves; a client that cannot reach the supervisor at retirement fails the run, naming why,
2033
+ and its lease is archived. Only then does the lease go. Without a supervisor socket nothing could end what the command
2034
+ leaves in a lease before it is reclaimed, so no lease is taken and the run says so
2035
+ (`RAM temp volume not leased: no cowshed supervisor owns this command's processes`). A lease that cannot be released is
2036
+ reported with its error alone; no census of the user's processes names what works there.
2037
+
2038
+ A task records its handle beside its lease (`<lease>.subtree`, on the volume, outside the command's reach) once the
2039
+ supervisor admits the command. A lease whose task died is reclaimed by the next task: it hands the recorded handle back
2040
+ to its own supervisor first and archives the lease once that retirement is joined. An ended job's supervisor retired the
2041
+ whole job as it ended (`jobEnded`), and a spent handle was already retired: either way the lease is reclaimed. A handle
2042
+ of a job that is still another task's (`foreignHandle`, `notMember`, `foldUnavailable`) keeps the lease, named on every
2043
+ new task's stderr, until that job ends. A lease with no readable handle recorded none: its task died before its command
2044
+ was admitted, or the admission was refused. An image still attached from a file below a dead lease, or a mount below it,
2045
+ belongs to whoever attached it, so the lease and the volume are kept and every new task names them.
1454
2046
 
1455
2047
  Outside macOS, the executor never provisions an APFS RAM disk: it keeps the inherited `TMPDIR`, or uses the target's
1456
- `env.TMPDIR` override, without reclaiming either directory. The host temp-directory proof runs the real default executor
1457
- for that contract on Linux; on macOS it exercises RAM-volume recovery, shared leases and final detach.
2048
+ `env.TMPDIR` override, without reclaiming either directory; a supervisor that serves the socket still owns and retires
2049
+ the command's subtree. On Linux the supervisor admits a subtree only with an observed fold, and refuses with
2050
+ `foldUnavailable` otherwise. In CI the same rule decides: a job that runs `nx` outside a cowshed job (`ubuntu-latest`
2051
+ for a fork's pull request, a GitHub macOS runner) has no `COWSHED_SUPERVISOR_SOCKET`, so its commands run directly,
2052
+ nothing retires what they leave beyond the runner's own job teardown, and on macOS no RAM lease is taken, which every
2053
+ run says. The self-hosted NixOS runner gets ownership exactly when its `nx` runs inside a cowshed job whose supervisor
2054
+ serves the socket. The host temp-directory proof runs the real default executor for that contract on Linux; on macOS it
2055
+ exercises RAM-volume recovery, shared leases and final detach. No test leases, creates or detaches the user's volume:
2056
+ every macOS host proof runs the executor on a fixture volume of its own (`runBoundedExecWith` with `fixtureRamVolume`),
2057
+ in a test namespace of its own: `testNamespace(<pid>, <index>)`, seven base-36 characters, the pid in five and the index
2058
+ in two, as `cowshed_os::namespace::TestNamespace` encodes them (`specs/cowshed/01_storage.md`, "Host namespace"). The
2059
+ fixture makes the namespace's root, `/private/var/folders/cowshed/<uid>/<ns>`, with mode 0700 and refuses one that
2060
+ exists. Every path derives from the namespace (`ramTempPaths(user, namespace)`): the volume `smoo-ram3-<uid>-<ns>` at
2061
+ `<root>/ram3`, its staging directory `<root>/ram3-new`, its lock `<root>/ram3.lock`, its record of attached disks and
2062
+ its gateway's control socket `<root>/gateway.sock`. None of them can be a name production uses, so no guard compares a
2063
+ fixture's paths or gateway socket with production's. The size is the one name a namespace does not derive: no other
2064
+ process's, and `fixtureRamVolume` refuses the user's own. Its real fixture gateway (`ram_fixture <ns>`) attaches the
2065
+ disk; every facade and non-facade disk command goes through that gateway's own socket. The proof names it:
2066
+ `createHostCommands` takes its gateway socket from its caller with no default, `runBoundedExecWith` takes the volume its
2067
+ caller makes, and the Nx executor passes the host's own. Teardown detaches only exact registry identities its attaches
2068
+ recorded, never disks selected by UID or size alone, then removes the root, unless a volume is still mounted below it.
2069
+ The host target depends on `cowshed:ram-fixture`, which builds the native helper before any test; no test compiles or
2070
+ installs a gateway.
2071
+
2072
+ RAM is optional acceleration for the production executor, not a correctness prerequisite. Gateway absence, an
2073
+ unsupported RAM operation, or unproven legacy ownership yields a typed unavailable reason and one report of the actual
2074
+ owned ordinary temporary medium used instead. It never falls back to a job-owned attach or inherits a potentially unsafe
2075
+ shared RAM directory. Required fixture RAM remains required. I/O errors, malformed new markers, unknown ledgers and
2076
+ unresolved mutation custody fail closed.
2077
+
2078
+ The volume marker is version 1 JSON containing `volumeName`, `owner: "gateway"` and the exact `registryEntry` captured
2079
+ immediately after this gateway attach. Before leasing, a fresh registry/mount snapshot proves that entry still names
2080
+ this mounted volume; the root and marker identities are revalidated under the ledger lock. A changed identity refuses
2081
+ instead of silently following a replacement. The last release detaches outside the lock, so the volume can go between
2082
+ these reads: a volume gone part way is no volume, as when its marker is absent, and the caller looks again, proving
2083
+ whatever it then finds afresh; only a volume still mounted under the same identity is refused. A legacy name-only marker
2084
+ or an unmarked disk with no exact creation receipt is unproven: it is not leased, rewritten, reclaimed or detached.
2085
+ Fixture debris reclamation consumes only the exact identities its own real attaches recorded, never UID or size alone.
1458
2086
 
1459
2087
  The volume's kernel `O_EXLOCK` admits ledger mutations and releases on process death. It is held only for cheap lease
1460
2088
  and operation claims and their publication: host-wide process and disk-inventory probes, directory cleanup, provisioning
@@ -1463,40 +2091,58 @@ before publishing a mutation; another caller can take a lease while a dead lease
1463
2091
  fails after taking its lease directory gives it back, and detaches the volume if that was the last lease, as the last
1464
2092
  release would have.
1465
2093
 
1466
- Checkouts of this plugin from before the ledger lease under the kernel lock alone and never read the claims, so the two
1467
- protocols must never share a volume. The protocol's revision (2) names the volume, its lock and its ledger, and adds as
1468
- many sectors to the RAM disk: the creator's stray reclaim matches user and size, so neither revision detaches the
1469
- other's disk, mounted or still attaching. On a host running both, each revision has its own volume.
1470
-
1471
- A creation or detach claim is void once its owner's pid is gone. A crashed owner whose pid was reused holds every caller
1472
- waiting on the volume, and macOS gives no cheap way to tell the new process from the old without running `ps` under the
1473
- lock. So every 15 s that a caller waits on the same claim, stderr names its kind, owner pid, token, ledger and the wait
1474
- so far.
2094
+ Checkouts of this plugin from before the ledger lease under the kernel lock alone and never read the claims, and
2095
+ checkouts from before the move below the cowshed root mount the volume at `/Volumes`, so no two protocols may share a
2096
+ volume. The protocol's revision (3) names the volume, its mountpoint, its lock and its ledger, and adds as many sectors
2097
+ to the RAM disk: inventory distinguishes revisions by uid and size, while exact creation identity alone authorizes
2098
+ reclamation, so no revision detaches another's disk, mounted or still attaching. On a host running several, each
2099
+ revision has its own volume; a revision-2 volume, still under `/Volumes`, is detached by revision 2's own last release,
2100
+ never by revision 3.
2101
+
2102
+ An ordinary operation claim is void once its owner's pid is gone. A pending protected detach differs: caller timeout or
2103
+ death does not finish the child or release its authority over the volume. Its custody is published before the spawn, as
2104
+ `waiting` while its caller still awaits the facade: other callers queue behind it as behind any claim. Once that caller
2105
+ stops waiting, or its run throws without an answer, the custody is `reported`: the existing ledger retains that exact
2106
+ operation token and disk identity, and refuses every other caller by name, until the gateway proves its native child
2107
+ reaped, proves nothing started, or a fresh registry read proves the exact entry gone. A broken requester connection or
2108
+ an unknown native outcome proves none of these and retains authority. A dead caller's `waiting` custody is reconciled
2109
+ the same way; its liveness only chooses queueing over reporting. A PID is diagnostic, never the proof that a pending
2110
+ detach ended. While a pending detach exists, ledger version 2 makes older readers refuse rather than discard the claim;
2111
+ normal version 1 returns only after the pending authority clears, preserving every lease entry. Unknown versions refuse
2112
+ by name without rewriting them. Every 15 s a caller waiting on a claim names its kind, owner pid, token, ledger and wait
2113
+ so far; another volume's ledger remains independent.
1475
2114
 
1476
2115
  Each reclaim pass reads at most one I/O Registry and mount-table snapshot, not one per lease. A dead lease held only by
1477
2116
  mounted filesystems keeps a positive verdict with stable mount and lease identities. A valid positive still names and
1478
2117
  retains it without another host-wide probe; an unmount exposes the underlying RAM device and triggers a fresh probe.
1479
2118
  Image-backed and otherwise unkeyable holds stay uncached: device-node reuse has no proven cheap incarnation key. Every
1480
- pass that claims such a lease probes it again, with a process census and the pass's inventory, which take seconds on a
1481
- busy host; that latency falls on the claiming task, outside the lock. A negative verdict is never cached, probe errors
1482
- never stand in for an empty holder set, and held directories stay unchanged.
2119
+ pass that claims such a lease probes it again, with the pass's inventory, which takes seconds on a busy host; that
2120
+ latency falls on the claiming task, outside the lock. A negative verdict is never cached, probe errors never stand in
2121
+ for an empty holder set, and held directories stay unchanged.
1483
2122
 
1484
2123
  Contended lock opens also use `O_NONBLOCK` and yield for 50 ms, avoiding a separate latent filesystem-worker deadlock
1485
2124
  when one Node process makes five concurrent requests with four workers. The observed gate failures instead came from
1486
2125
  cross-process waits behind long host-wide probes under the RAM lock. Real nested and sibling default-executor proofs run
1487
2126
  with background single-lease processes to cover that shape. No case or target timeout is raised.
1488
2127
 
1489
- Once the process and holder checks permit removal, cleanup restores owner read/write/search permission on directories
1490
- through no-follow directory handles before deleting the lease. Read-only fixture directories cannot strand a dead lease
1491
- and block later tasks. File modes and symlink targets stay untouched; a directory on another device refuses cleanup
1492
- instead of changing an attached volume. Held leases undergo no permission changes.
2128
+ Once the retirement and holder checks permit removal, a lease to delete, and an archive being deleted, has owner
2129
+ read/write/search permission restored on its directories through no-follow directory handles first. Read-only fixture
2130
+ directories cannot strand a dead lease and block later tasks. File modes and symlink targets stay untouched; a directory
2131
+ on another device refuses cleanup instead of changing an attached volume. Held leases undergo no permission changes.
1493
2132
 
1494
2133
  The real RAM-volume regression walks one volume's lifecycle in a single test: unmarked debris and a live-lease refusal,
1495
2134
  recovery over the debris, concurrent leases, failed-acquire lease/claim rollback, read-only cleanup, a held dead lease,
1496
- owner detach and reclaim of that lease while a writer the dead task left still writes into it through `TMPDIR` (stopped,
1497
- then removed) beside a dead lease nothing works in, and the final detach. External symlink targets and held directory
1498
- modes stay unchanged, without duplicate provision and teardown; its 60 s case bound is unchanged and its target has the
1499
- progress bound.
2135
+ owner detach and reclaim of that lease while a writer the dead task left still writes into it through `TMPDIR` (retired
2136
+ through its recorded handle, then archived whole, readonly tree and modes included) and a bystander works in it (never
2137
+ signalled), beside a dead lease that recorded no handle and one whose handle another live job holds (kept, then
2138
+ reclaimed once that job ends), a later dead lease whose archive rotates the oldest out and is deleted in the background,
2139
+ a failed run's own lease archived below the half-volume floor and so deleted with every other archive, and the final
2140
+ detach. Its supervisor is a stand-in speaking the subtree verbs' wire shapes, whose tree is the root's process group
2141
+ (`src/__tests__/stand-in-cowshed.ts`). Its volume uses a real private gateway served by `ram_fixture <ns>` on its
2142
+ namespace's socket, with `recordedRamAttach` capturing every attached identity and `disk-command --gateway-socket`
2143
+ routing native admission. The helper is closed only after exact-owned teardown, which then removes the namespace root;
2144
+ no test asks the installed gateway. External symlink targets and held directory modes stay unchanged, without duplicate
2145
+ provision and teardown; its 60 s case bound is unchanged and its target has the progress bound.
1500
2146
 
1501
2147
  The host target names both owned files with `./` paths: Bun otherwise interprets a bare path as a filter over recursive
1502
2148
  test discovery. This changes no selected case or timeout. The failed-provisioning regression keeps its exact injected
@@ -1509,51 +2155,65 @@ A refused rollback also records the kernel mount and read-only filesystem/device
1509
2155
  Each observation has a one-second wait bound and retains its status and stderr; an incomplete probe is not an empty
1510
2156
  holder set. These observations do not prove which holder caused `EBUSY`, and change no case or target bound.
1511
2157
 
1512
- The native lifecycle walk also observes its real working-directory census through the existing process-host seam,
1513
- retaining start/end times and the original error's exit code, signal and killed flag before rethrowing it unchanged.
1514
- This locates whether a census was outstanding at a case timeout without substituting a fake process inventory. Its real
1515
- host-command delegate records the same timestamps from case entry, retaining the actual argv, requested deadline and
1516
- result without changing them; this covers the work before the first process census. Observation before delegation is
1517
- timed separately from the delegate's wait, so logging cost is never presented as child execution time.
1518
-
1519
- Whatever still works in a lease when its task ends is a leak, and is stopped before the lease goes. The usual one is a
1520
- fixture's Nx daemon: Nx detaches it into a session of its own, so the process-group kill that ends a timed-out command
1521
- never reaches it, and a test process that is killed runs no teardown. Deleting its root asks the daemon to leave only by
1522
- deleting its record, which an idle daemon notices within a second and a wedged one never does, and a process left on the
1523
- volume keeps it from detaching. So the task's own release, and the next task's reclaim of a dead lease, first hold
1524
- discovered processes with SIGSTOP and rescan their descendants and lease working directories until a stopped census is
1525
- stable. A process can fork after a table read but before its signal; only a table read after it is stopped closes that
1526
- gap. Discovery failures attempt to resume every held process; one denied SIGCONT cannot strand the rest. Errors retain
1527
- the original discovery failure and name any denied continuation with its PID and command. The settled census gets
1528
- SIGTERM then SIGCONT, SIGKILL if anything has not exited five seconds later, and names each PID once on stderr
1529
- (`stopped <pid> (<command>), which the command left working in its lease`). A lease with nothing in it costs no scan.
1530
- Discovery follows stopped-census readiness under the enclosing operation's existing bound; the five-second exit grace
1531
- does not include discovery or fixture readiness. The lease's working directories are read again only after the same
1532
- census is stopped in consecutive process tables, including an empty one, which recovers children reparented out of the
1533
- tree. This avoids host-wide cwd scans while stopped-table quiescence is still being established. The line is the leak
1534
- check: a suite that prints it has a fixture to fix.
1535
-
1536
- The volume mounts at `/Volumes/smoo-ram2-<uid>`, where DiskArbitration puts it: asking for any other mountpoint
1537
- escalates to an administrator dialog that blocks every `diskutil` on the host. That mount is `noowners`, and launchd
1538
- refuses a plist from it, so a test that bootstraps a launchd job keeps the plist outside `TMPDIR`.
1539
-
1540
- The volume is created under its final name, `smoo-ram2-<uid>`, and is never renamed. It is mounted and marked at a
1541
- private staging directory, then unmounted and placed at `/Volumes/smoo-ram2-<uid>` by DiskArbitration, so a creator that
1542
- dies part way never leaves an unmarked volume at that mountpoint for the next one to dodge as `smoo-ram2-<uid> 1`.
1543
- Before creating, a task detaches every RAM disk of the same user and size that is mounted nowhere but at those two
1544
- paths: the debris of a creator that was killed or ran into its deadline. One that still carries a lease directory, or
1545
- has something attached below it, is named in the task's error instead.
1546
-
1547
- Every `hdiutil` and `diskutil` execution goes through `cowshed disk-command`, including host-test inventory and cleanup.
1548
- The cowshed is the installed one on `PATH`, which must provide this command, unless `COWSHED_EXECUTABLE` names another.
1549
- Where `PATH` provides no cowshed, a workspace that itself provides a launcher — its own cowshed package's
1550
- `packages/cowshed/bin/cowshed`, or a linked one's `node_modules/@smoothbricks/cowshed/bin/cowshed` — names that launcher
1551
- for the run and its command instead; an environment with no cowshed anywhere keeps the bare name, so its spawn failure
1552
- names the missing installed tool. A target may set it in its `env`, workspace-relative or absolute: the task's own RAM
1553
- volume work and its command then both run that cowshed, given to the command as an absolute path. This repository sets
1554
- it to `packages/cowshed/bin/cowshed`, after `cowshed:build`, on the targets that exercise the facade (both real-APFS
1555
- groups and `nx-plugin:test-host`), so they test this checkout's cowshed, not an installed one that may predate a command
1556
- the checkout added. Cowshed alone owns disk-lifecycle leasing. Safe disk commands use
2158
+ The native lifecycle walk's real host-command delegate records start/end timestamps from case entry, retaining the
2159
+ actual argv, requested deadline and result without changing them. Observation before delegation is timed separately from
2160
+ the delegate's wait, so logging cost is never presented as child execution time.
2161
+
2162
+ The volume mounts at `/private/var/folders/cowshed/<uid>/ram3`. The parent is the per-user root `cowshed setup` makes,
2163
+ `/private/var/folders/cowshed/<uid>`, a 0700 directory of the user's; the leaf carries the protocol's revision, so two
2164
+ revisions never mount on one directory. A test namespace's volume mounts at
2165
+ `/private/var/folders/cowshed/<uid>/<ns>/ram3`, in the 0700 directory of its name that its fixture makes in that root,
2166
+ so it is below `/var/folders/` too. Every lease below either is at most 65 bytes, leaving 38 for a socket's names, and a
2167
+ longer one is refused before it is made (`specs/cowshed/01_storage.md`, "RAM temp path budget"). Spotlight's `mds`
2168
+ admits no volume whose kernel-resolved mount path contains `/var/folders/`, and keeps one IOKit right for every volume
2169
+ it admits for as long as it runs, with no way to release it (`specs/cowshed/01a_apfs.md`, "Spotlight media references").
2170
+ Measured 2026-10-22: a RAM volume mounted at `/Volumes` or `/private/tmp` left `mds` one right; the same mount under
2171
+ `/private/var/folders` left none. A task refuses to create the volume while that root is missing, is a link, or is not a
2172
+ 0700 directory the user owns, and its error says to run `cowshed setup`. The kernel mounts the volume there:
2173
+ `mount_apfs` needs no administrator, where `diskutil mount -mountPoint` escalated to an administrator dialog that
2174
+ blocked every `diskutil` on the host. The mount is `noowners`, and launchd refuses a plist from it, so a test that
2175
+ bootstraps a launchd job keeps the plist outside `TMPDIR`.
2176
+
2177
+ The volume is created under its final name, `smoo-ram3-<uid>` (a test namespace's is `smoo-ram3-<uid>-<ns>`), and is
2178
+ never renamed. It is mounted and marked at a private staging directory, `/private/var/folders/cowshed/<uid>/ram3-new`
2179
+ (`<root>/ram3-new` in a test namespace), then unmounted and mounted again at its mountpoint, so a creator that dies part
2180
+ way never leaves an unmarked volume there. No DiskArbitration call makes either directory, so none removes them: the
2181
+ task that detaches the volume, or whose provisioning step failed, removes both. Before creating, a task inventories the
2182
+ RAM disks that are this volume's and no other: of its uid and exact size, mounting nowhere but at its mountpoint or
2183
+ staging directory, and either mounted there as a volume called exactly its name, or recorded by the exact registry entry
2184
+ its owner holds a receipt or its ledger holds custody for, which covers an attach whose format never finished, or
2185
+ records as the disk a creator kept. A creator records its disk's registry entry in the ledger before it keeps the disk:
2186
+ the volume's marker names that entry only while the volume is mounted, and a volume an operator's unmount took from its
2187
+ mountpoint leaves its disk attached and mounted nowhere, which the record still names (measured 2026-10-28: such a disk
2188
+ held 8 GiB beside the next creator's). Size and owner alone make no disk its own: another volume's, a test's or an
2189
+ unformatted disk nothing recorded is ignored, however it is mounted. Only an exact creation receipt or the ledger's
2190
+ record of the kept disk permits debris reclamation; a disk of its name with neither makes the RAM optimization
2191
+ unavailable and is left untouched. One that still carries a lease directory, or has something attached below it, is
2192
+ named in the task's error instead. The task finds these disks, and the one it detaches with the last lease, in the I/O
2193
+ Registry (an `IOHDIXHDDriveOutKernel` entry per RAM disk, with its size, its owner uid and the `FullName` of each of its
2194
+ volumes) and their mounts in the mount table, never in `hdiutil info`: measured 2026-10-22, `hdiutil info` left an
2195
+ attached RAM disk out of 2 of 10 listings while other images attached and detached, and a disk left out would read as
2196
+ absent. A registry read that does not parse whole fails the task instead. A BSD name passes to the next disk once its
2197
+ disk goes, so every RAM detach is gateway-owned and bound to an exact device and registry entry: a provisioning rollback
2198
+ releases its `ram-lease`, or, when a gateway restart lost that lease, sends the typed `ram-detach` every other detach is
2199
+ (specs/cowshed/05_gateway.md, "RAM disks"). The gateway revalidates that identity inside its own lease before spawning
2200
+ the native tool. It uses no force; a busy owned staging volume stays in place with its named refusal. A requester or its
2201
+ job ending cannot kill this protected mutation. Authoritative terminal, proven not-started and unknown outcomes remain
2202
+ distinct; only the first two or exact entry disappearance release pending authority. A gateway that predates
2203
+ `ram-lease`, or has no control listener, makes optional RAM unavailable with its typed reason, not a task failure.
2204
+ Required RAM fixtures still fail. No task ever attaches the disk itself.
2205
+
2206
+ RAM attach and detach go through their typed gateway operations; every other `hdiutil` and `diskutil` execution goes
2207
+ through `cowshed disk-command`, including host-test inventory. The cowshed is the installed one on `PATH`, which must
2208
+ provide this command, unless `COWSHED_EXECUTABLE` names another. Where `PATH` provides no cowshed, a workspace that
2209
+ itself provides a launcher — its own cowshed package's `packages/cowshed/bin/cowshed`, or a linked one's
2210
+ `node_modules/@smoothbricks/cowshed/bin/cowshed` — names that launcher for the run and its command instead; an
2211
+ environment with no cowshed anywhere keeps the bare name, so its spawn failure names the missing installed tool. A
2212
+ target may set it in its `env`, workspace-relative or absolute: the task's own RAM volume work and its command then both
2213
+ run that cowshed, given to the command as an absolute path. This repository sets it to `packages/cowshed/bin/cowshed`,
2214
+ after `cowshed:cli-native`, on the targets that exercise the facade (both real-APFS groups and `nx-plugin:test-host`),
2215
+ so they test this checkout's cowshed, not an installed one that may predate a command the checkout added. Cowshed alone
2216
+ owns disk-lifecycle leasing. Safe disk commands use
1557
2217
  `cowshed disk-command diskutil --deadline-ms <positive integer> -- <args>`: the CLI owns that total monotonic budget
1558
2218
  across lease admission and child execution, never starts a child after it expires, and kills and reaps an overrun safe
1559
2219
  child before returning. Node waits for the facade's actual terminal exit without a second timer or lease. Only protected
@@ -1572,85 +2232,98 @@ source, tests and scripts for direct disk-tool process calls. SmoothBricks runs
1572
2232
  consumers wire the same guard into their root lint. Rust callers use `SystemCommandRunner` and `CommandRequest`; script
1573
2233
  callers use the CLI facade rather than introducing another disk-command runner.
1574
2234
 
1575
- Without an inherited parent pool, a `bounded-exec` command takes CPU tokens from cowshed's host budget before it starts,
1576
- when the gateway answers on the same socket (`specs/cowshed/05_gateway.md`, "Host CPU budget"), so concurrent gates on
1577
- one host keep their runnable work near the core count instead of each sizing its runners to the whole machine. It asks
1578
- for the runner's requested parallelism, read from the runner's own flag rather than the core count — nextest's
1579
- `--test-threads` or one per core (one for `--no-capture`, which runs tests serially), `bun test --parallel=N` N,
1580
- Stryker's `--concurrency` N or N% (default one per core less one past four cores), Vitest's `--maxWorkers` N or N%
1581
- (default one per core less one), `go test -p` (default `GOMAXPROCS`), cargo-mutants' `--jobserver-tasks` (default one
1582
- per core, whatever `--jobs` says), a cargo build one per core, anything else one, or the target's `parallelism` option —
1583
- bounded by positive inherited `NEXTEST_TEST_THREADS`/`CARGO_BUILD_JOBS` ceilings. A configured count can lower an
1584
- inherited ceiling, never raise it. The runner uses `min(bounded request, granted tokens)`: nextest's environment and
1585
- named flag, Bun's parallel flag, Stryker's, Vitest's and go's worker flag (added when the command names none),
1586
- cargo-mutants' jobserver tasks, `--jobs` and per-process test threads, and a cargo build's libtest and nextest test
1587
- threads are sized to that limit. Cargo's rustc count needs no flag: the run's sub-pool is a GNU make jobserver fifo that
1588
- `CARGO_MAKEFLAGS` and `MAKEFLAGS` name, so Cargo, its build scripts and every nested `cargo` share the grant's count
1589
- with the sub-pool's socket children, and no grant sets `CARGO_BUILD_JOBS`. A command whose runner the executor cannot
1590
- see (a script) gets `RUST_TEST_THREADS` and `NEXTEST_TEST_THREADS` set to its whole held grant, since test threads take
1591
- no jobserver token. A runner that starts its own workers or jobserver (cargo-mutants, Stryker, Vitest, `go test`)
1592
- ignores that fifo, so it must run under `bounded-exec`, whose runner kinds size its own flag; the inferred `mutation`
1593
- target does. Test threads retain their independent inherited/configured ceilings. `BOUNDED_EXEC_CPU_TOKENS`, the
1594
- sub-ledger and telemetry still name the actual held grant. The gateway shares tokens fairly between checkouts (Nx
1595
- workspace roots). `timeoutMs` and `idleTimeoutMs` start at the grant. The tokens go back when the command exits, or with
1596
- the executor's socket when it is killed. The wait prints one
1597
- `cowshed: cpu-tokens wait done elapsed=… tokens=<granted>/<asked>` line. On a host whose gateway socket does not exist
1598
- (a CI runner, a machine without cowshed), the plugin's `preTasksExecution` serves each Nx run that inherits no pool its
1599
- own `BOUNDED_EXEC_CPU_POOL` of one token per core, with its jobserver fifo in `CARGO_MAKEFLAGS` for the Cargo that
1600
- `nx:run-commands` starts, and `postTasksExecution` closes it: the run's targets, started side by side under
1601
- `NX_PARALLEL=100%`, queue for its cores instead of each sizing its runner to the whole host
1602
- (`specs/cowshed/05_gateway.md`, "A run without a gateway budgets itself"). Its scope is one run. A command no pool and
1603
- no gateway answers runs exactly as configured and nothing is said; a gateway from before the budget runs it unbudgeted
1604
- and stderr says so.
2235
+ `bun node_modules/@smoothbricks/nx-plugin/src/wait-why-policy.ts <crates-directory...>` is WAIT-WHY
2236
+ (`specs/cowshed/05_gateway.md`, "Deadlines", Enforcement). Each crate's `clippy.toml` disallows every wait on another
2237
+ process (`WAIT_METHODS`: child waits and reaps, `Command::output`/`status`, `output_locked`/`status_locked`, unix
2238
+ connects, `flock`, `waitpid`), so clippy refuses one that is not bounded through `cowshed_os::deadline`. A site kept
2239
+ unbounded suppresses `clippy::disallowed_methods` for its one item or statement, and WAIT-WHY refuses the suppression
2240
+ unless an adjacent `// WHY unbounded: <what ends the wait>` says why: on the comment lines directly above the attribute,
2241
+ on the attribute, or on the first line it covers. A reason that records `debt:` names a stall the site leaves, not an
2242
+ end, and is refused too. It also refuses a crate whose `clippy.toml` lacks one of the waits. Test code waits through
2243
+ `cowshed_os::test_backstop`'s helpers, each bounded by the no-progress backstop; a test keeps a raw wait, with its WHY,
2244
+ only where a helper thread would change what it measures. SmoothBricks runs it from `cowshed:wait-why`, which
2245
+ `cowshed:lint` depends on.
2246
+
2247
+ A `bounded-exec` command takes its CPU tokens from the CPU pool it inherits before it starts
2248
+ (`specs/cowshed/05_gateway.md`, "Host scheduling", "Parallelism inside a job"), so the runners of one build tree keep
2249
+ their runnable work within that tree's count instead of each sizing its runners to the whole machine. It asks for the
2250
+ runner's requested parallelism, read from the runner's own flag rather than the core count — nextest's `--test-threads`
2251
+ or one per core (one for `--no-capture`, which runs tests serially), `bun test --parallel=N` N, Stryker's
2252
+ `--concurrency` N or N% (default one per core less one past four cores), Vitest's `--maxWorkers` N or N% (default one
2253
+ per core less one), `go test -p` (default `GOMAXPROCS`), cargo-mutants' `--jobserver-tasks` (default one per core,
2254
+ whatever `--jobs` says), a cargo build one per core, anything else one, or the target's `parallelism` option — bounded
2255
+ by positive inherited `NEXTEST_TEST_THREADS`/`CARGO_BUILD_JOBS` ceilings. A configured count can lower an inherited
2256
+ ceiling, never raise it. The runner uses `min(bounded request, granted tokens)`: nextest's environment and named flag,
2257
+ Bun's parallel flag, Stryker's, Vitest's and go's worker flag (added when the command names none), cargo-mutants'
2258
+ jobserver tasks, `--jobs` and per-process test threads, and a cargo build's libtest and nextest test threads are sized
2259
+ to that limit. Cargo's rustc count needs no flag: the run's sub-pool is a GNU make jobserver fifo that `CARGO_MAKEFLAGS`
2260
+ and `MAKEFLAGS` name, so Cargo, its build scripts and every nested `cargo` share the grant's count with the sub-pool's
2261
+ socket children, and no grant sets `CARGO_BUILD_JOBS`. A command whose runner the executor cannot see (a script) gets
2262
+ `RUST_TEST_THREADS` and `NEXTEST_TEST_THREADS` set to its whole held grant, since test threads take no jobserver token.
2263
+ A runner that starts its own workers or jobserver (cargo-mutants, Stryker, Vitest, `go test`) ignores that fifo, so it
2264
+ must run under `bounded-exec`, whose runner kinds size its own flag; the inferred `mutation` target does. Test threads
2265
+ retain their independent inherited/configured ceilings. `BOUNDED_EXEC_CPU_TOKENS`, the sub-pool and telemetry still name
2266
+ the actual held grant. `timeoutMs` and `idleTimeoutMs` start at the grant. The tokens go back when the command exits, or
2267
+ with the executor's socket when it is killed. The wait prints one
2268
+ `cowshed: cpu-pool wait done elapsed=… tokens=<granted>/<asked>` line.
2269
+
2270
+ The plugin's `preTasksExecution` serves each Nx run that inherits no pool its own `BOUNDED_EXEC_CPU_POOL`, and
2271
+ `postTasksExecution` closes it (`specs/cowshed/05_gateway.md`, "Every Nx run budgets itself"). It holds one token per
2272
+ core, or the run's inherited positive `BOUNDED_EXEC_CPU_TOKENS` when that is fewer: inside a `cowshed exec` job that
2273
+ count is the job's own, so the job's `--want` bounds the run. Its jobserver fifo is in `CARGO_MAKEFLAGS` for the Cargo
2274
+ that `nx:run-commands` starts, so the run's targets, started side by side under `NX_PARALLEL=100%`, queue for its tokens
2275
+ instead of each sizing its runner to the whole host. Its scope is one run. A command that inherits no pool runs exactly
2276
+ as configured, sized only by the ceilings it inherits, and nothing is said; a cowshed job's own jobserver fifo still
2277
+ reaches it by Cargo's own rule ("Cargo reads its holder's jobserver").
2278
+
2279
+ CPU admission connects and sends within the 5 s control bound, then waits for the queue acknowledgement and grant under
2280
+ 15 s of actor silence, not a total queue deadline (`specs/cowshed/05_gateway.md`, "Deadlines"). A queued reply past 2 s
2281
+ is accepted; the disk gateway's old-protocol half-close is not CPU admission policy. While tokens are held, the pool
2282
+ actor sends an advancing heartbeat every 5 s, so a live queue waits until tokens return. A silent actor fails admission
2283
+ as `SILENT` with its endpoint, bound, waited time and last progress; the command never runs outside the pool.
1605
2284
 
1606
2285
  A granted executor serves a private `BOUNDED_EXEC_CPU_POOL` with its actual token count, and the same count as a make
1607
2286
  jobserver fifo beside it: `g − 1` token bytes, the command holding the implicit first, which the pool lends a socket
1608
2287
  child only once the fifo is empty. A socket grant takes fifo bytes first and that slot last, and its release writes the
1609
2288
  bytes back; the pool waits for a fifo byte on the event loop, so a token Cargo writes back wakes the queued child. Its
1610
- close drains and removes the fifo. A nested default executor asks that immediate parent pool for its own demand, instead
1611
- of taking from the host while the parent holds its grant; the pool grants at most what it can. A lent pool accounts for
1612
- siblings together; each admitted child serves only its own allocation to grandchildren. Closing a child's connection
1613
- returns its local allocation, never the parent's upstream grant. Upstream loss revokes the downstream pool, so a dead
1614
- parent grants nothing more; a command whose grant closes while it runs (a gateway restart, or the lending parent's exit)
1615
- runs on over budget to its own exit, and stderr says `cowshed: cpu-tokens grant ended`. A bare count or absent endpoint
1616
- follows normal host admission. A connected parent pool's refusal or protocol failure instead fails admission: taking
1617
- from the host then could wait on the parent's own grant. `options.env` cannot inject either marker, nor a jobserver
1618
- (`CARGO_MAKEFLAGS`, `MAKEFLAGS`, `MFLAGS`); a parent make's jobserver the executor inherits still reaches an ungranted
1619
- command. Parent-pool grants record `cpu.inherited: true` and their actual local wait; the span also says
1620
- `inherited=true`. Pool setup, listener and cleanup errors fail rather than bypassing accounting. Command bounds stay
1621
- unchanged.
1622
-
1623
- The absent-parent fixture uses the executor's injectable budget with a real, controlled outer pool as its backing. It
1624
- proves a positive allocation and re-acquires it after the command ends, rather than depending on free tokens in the
1625
- host-wide gateway while the test runner itself holds an allocation. A bare count or unbudgeted success is not proof. A
1626
- land gate (`tooling/land-host.sh`) enters the existing task server with
1627
- `cowshed exec <workspace> --class gate --host [--want N] -- COMMAND [ARGS...]` after daemon-stop. It requires a real
1628
- gateway jobserver `class: "gate"` grant for its own orchestrator; its live pool lends nothing of its own and relays
1629
- every child's ask to the host as a gate-class request, so each task the gate starts is served FIFO ahead of every other
1630
- exec's queued work. No environment-only class or unbudgeted fallback is accepted. The gate waits for its grant with no
1631
- deadline, ahead of queued background work. Running background tests/FIFOs are never shrunk, frozen or killed to
1632
- manufacture tokens. Requested/granted count and actual queue wait are logged, and a child's nonzero exit is preserved
1633
- exactly. Compiling Cargo under the live pool takes a local allocation and receives its own private child pool, so
1634
- grandchildren never compete with their occupied ancestor. See `specs/cowshed/05_gateway.md`, "Gate admission: FIFO ahead
1635
- of background, never starving it", for the guarantee and its deliberate limits.
2289
+ close drains and removes the fifo. A nested default executor asks that immediate parent pool for its own demand; the
2290
+ pool grants at most what it can. A lent pool accounts for siblings together; each admitted child serves only its own
2291
+ allocation to grandchildren. Closing a child's connection returns its local allocation, never the parent's upstream
2292
+ grant. Upstream loss revokes the downstream pool, so a dead parent grants nothing more; a command whose grant closes
2293
+ while it runs (the lending parent's exit) runs on over budget to its own exit, and stderr says
2294
+ `cowshed: cpu-pool grant ended`. A bare count proves no pool. An absent endpoint lends nothing: the command runs as
2295
+ configured, and stderr says so. A connected parent pool's refusal or protocol failure instead fails admission: running
2296
+ beside it would count the command twice. `options.env` cannot inject either marker, nor a jobserver (`CARGO_MAKEFLAGS`,
2297
+ `MAKEFLAGS`, `MFLAGS`); a parent make's jobserver the executor inherits still reaches an ungranted command. The verdict
2298
+ records the grant and its actual local wait as `cpu`. Pool setup, listener and cleanup errors fail rather than bypassing
2299
+ accounting. Command bounds stay unchanged.
2300
+
2301
+ A land gate (`tooling/land-host.sh`) runs as `cowshed exec <workspace> --class gate --host -- COMMAND [ARGS...]` after
2302
+ daemon-stop. It is never CPU-limited: its class sets the priority the kernel schedules it at, and its Nx run serves its
2303
+ own pool like any other (`specs/cowshed/05_gateway.md`, "Host scheduling", "Classes").
1636
2304
 
1637
2305
  Every `bounded-exec` task records why it ended in `.nx/workspace-data/bounded-exec/<task>/verdict.json`, keyed by the
1638
2306
  task id and the hash it ran at:
1639
2307
 
1640
- - `bound`: nothing failed but a wall-clock bound. Either the command outlived `timeoutMs`, or every failing test in the
1641
- runner's JUnit report failed on its runner's per-test timeout (`cargo-nextest` writes `type="test timeout"` where a
1642
- configuration still sets `terminate-after`, `bun test` writes `type="TimeoutError"`). A loaded host produces exactly
1643
- these. When `timeoutMs` fires, the tests `cargo-nextest` was still running are reported as failures of
1644
- `type="test abort"`, `process aborted with signal 15 (SIGTERM)` (SIGKILL once the force-kill follows); they are the
1645
- bound's casualties and do not make the run `failed`. A test that dies of any other signal, or that is aborted with no
1646
- bound to explain it, does.
2308
+ - `bound`: nothing failed but a wall-clock bound. Either the command outlived `timeoutMs`, its fixture segment outlived
2309
+ `fixtureTimeoutMs` (`bound: "fixture"`; the command never started), or every failing test in the runner's JUnit report
2310
+ failed on its runner's per-test timeout (`cargo-nextest` writes `type="test timeout"` where a configuration still sets
2311
+ `terminate-after`, `bun test` writes `type="TimeoutError"`). A loaded host produces exactly these. When `timeoutMs`
2312
+ fires, the tests `cargo-nextest` was still running are reported as failures of `type="test abort"`,
2313
+ `process aborted with signal 15 (SIGTERM)` (SIGKILL once the force-kill follows); they are the bound's casualties and
2314
+ do not make the run `failed`. A test that dies of any other signal, or that is aborted with no bound to explain it,
2315
+ does.
1647
2316
  - `wedged`: `idleTimeoutMs` fired: no test finished during that much active test time. This proves the completion
1648
2317
  interval was exceeded, not that every process stopped: an oversized fixture can exceed it too. Its `tests` name those
1649
2318
  the runner reported running (nextest's `SLOW`, libtest's `has been running for over`) and never finished, and those
1650
- the JUnit report says it aborted when the bound stopped it.
2319
+ the JUnit report says it aborted when the bound stopped it. Its `lockWaits` lists only regular files the run holds on
2320
+ numbered descriptors that processes outside the run also hold open, naming those holders' pids and commands. This is
2321
+ open-handle evidence, not kernel lock-owner proof. The open-file census runs only on macOS, so on every other platform
2322
+ `lockWaits` is always empty. An incomplete or raced capture records none.
1651
2323
  - `no-space`: the command failed after its output said a write found no space (`ENOSPC` or `No space left on device`).
1652
2324
  Its tests failed on the disk, not on their own, whatever bound or hang followed: it records that line and, when the
1653
- task held a RAM lease, the lease, the volume and its free bytes when the line arrived. A passing run that printed such
2325
+ task held a RAM lease, the lease, the volume and its free bytes when the line arrived, or why none were read: the
2326
+ lease was no longer on its volume (`lost`) or the volume could not be read (`unread`). A passing run that printed such
1654
2327
  a line passed.
1655
2328
  - `failed`: a test failed on its own, or the command exited non-zero with no report naming a timeout.
1656
2329
  - `passed`.
@@ -1666,12 +2339,12 @@ runner, or with two (they would write one report), is judged by its exit alone.
1666
2339
  `smoo-nx-bound-failures` reads the workspace's last Nx run (`run.json` in Nx's `cacheDir`, the directory
1667
2340
  `StoreRunInformationLifeCycle` writes: the checkout's own `.nx/cache` under smoo's workspace policy) against those
1668
2341
  records and prints one line per failed task. It exits 0 only when the run failed and every failed task's record, for
1669
- that task's hash, is a `bound`; a failed task without one is not. This diagnostic is not land acceptance. The land
1670
- wrapper, `tooling/land-host.sh`, requires `nx run-many -t gate` to exit zero: bounds, assertions and infrastructure
1671
- failures all stop the land without a retry or waiver. `smoo-nx-failures OUTPUT` reports unique failing tasks and
1672
- deduplicated exact diagnostics from that invocation's retained output, not a shared last-run record. The portable
1673
- `@smoothbricks/nx-plugin/failure-summary` export owns `summarizeFailures(output)` and `runFailureSummary(args)`;
1674
- repository entrypoints such as `tooling/land-summary.ts` call that owner without copying the parser. Its zero exit means
2342
+ that task's hash, is a `bound`; a failed task without one is not. This diagnostic is not land acceptance. The land gate,
2343
+ `tooling/land-host.sh --gate`, requires `nx run-many -t gate` to exit zero: bounds, assertions and infrastructure
2344
+ failures all stop the land without a retry or waiver. `smoo-nx-failures OUTPUT`, from `@smoothbricks/failure-summary`,
2345
+ reports unique failing tasks and deduplicated exact diagnostics from that invocation's retained output, not a shared
2346
+ last-run record. That package's `summarizeFailures(output)` and `runFailureSummary(args)` are the one parser;
2347
+ `tooling/land-host.sh` runs main's native build of its bin (`dist/bin/<platform>/smoo-nx-failures`). Its zero exit means
1675
2348
  reporting succeeded, never that the failed gate may land. Known diagnostic sections omit fixture progress and daemon
1676
2349
  debug dumps while preserving multiline assertions and source locations; unknown formats retain their output.
1677
2350
 
@@ -1701,6 +2374,40 @@ time, which is the host's, rather than its progress. Only a leg that runs `bun t
1701
2374
  its `src/`, where Bun's test-file discovery is cheap; any other command (a cargo workspace's per-crate nextest legs run
1702
2375
  from the workspace root, a gate may run a script that lives in another project) may use any `cwd`.
1703
2376
 
2377
+ ### Bounded exec key
2378
+
2379
+ A workspace that runs this plugin from a linked checkout, where no lockfile sees its bytes, can key each bounded-exec
2380
+ task by the executor's module closure. The executor's `executors.json` record names, under `outputNeutral`, the modules
2381
+ that closure may stop at: their bytes and their imports are not keyed, while the bytes of every module that imports them
2382
+ are. A module is output-neutral when everything it hands the executor is either a failure or one of the values that
2383
+ already differ between runs of one task key: the CPU grant a pool gives and whether a gateway answers at all, the volume
2384
+ and path of the run's `TMPDIR`, the directory a CPU pool's socket binds in, and timing. No key holds any of those, and
2385
+ Nx caches only passing runs, so a cached pass is sound only if the command's result holds whichever of them a run gets.
2386
+ A change to such a module moves which of them a run gets, or fails more runs; it never changes what a given value does
2387
+ to the command, which the keyed modules decide. Each entry, and what the executor takes from it:
2388
+
2389
+ - `ram-temp.js`, with `ram-temp-held.js`, `ram-attach.js`, `ram-detach.js` and `disk-lease.js`: the RAM temp lease. The
2390
+ command sees the lease's directory as its `TMPDIR`, on a volume of the lease's capacity. Off macOS, without a
2391
+ supervisor, or with no RAM left, the same task runs on the inherited or an ordinary temp directory instead. A lease
2392
+ that cannot be taken, released or recorded, or leftovers the supervisor cannot retire within the lease's grace, fail
2393
+ the run or are said on stderr. The variable naming the cowshed executable, which the command does see, lives in the
2394
+ core `owned-subtree.ts`.
2395
+ - `gateway-lease.js`: the lease protocol the gateway's disk lease and a parent CPU pool speak, the gateway's socket path
2396
+ and the grant it reads from an answer. A CPU grant reaches the command only through `cpu-pool.js` and
2397
+ `runner-sizing.js`, as a token count; an absent endpoint leaves the command unsized, and a refusal fails the run.
2398
+ - `hang-diagnostics.js`: the snapshot taken shortly before the no-progress bound fires. It probes with `ps`, `lsof` and
2399
+ `sample`, which suspends the runner for about a second, and signals nothing but its own probes. Its text and lock
2400
+ waits are read only once the bound has expired the run, which fails it.
2401
+ - `testing.js` (and `ensure-built`, whose workspace-root finder it uses, and the producer receipt modules it imports):
2402
+ the host census the executor quotes when a lease release fails, and the directory a CPU pool binds its socket in. A
2403
+ directory that cannot be made refuses the run.
2404
+
2405
+ `runner-sizing.js`, `cpu-pool.js` and `progress.js` are not output-neutral although they schedule: `sizeRunner` decides
2406
+ what a token count does to the command's parallelism flags and test-thread variables, `cpu-pool.js` writes the jobserver
2407
+ flags into `MAKEFLAGS` and `CARGO_MAKEFLAGS`, and `withProgressReport` adds `--dots` to `bun test` and `-json` to
2408
+ `go test`. They stay keyed until those functions move into modules of their own. A module that comes to decide what a
2409
+ value does to the command, its environment or a passing verdict leaves `outputNeutral` in the same commit.
2410
+
1704
2411
  ## Test Fixtures That Run Nx
1705
2412
 
1706
2413
  The executor's real-process tests acknowledge handler installation and process-group membership before delivering a
@@ -1729,15 +2436,16 @@ tests) owns those roots:
1729
2436
  it, `<parentDirectory>/smoothbricks-fixtures/<suite>/run-<pid>`. The caller always names the parent: `tmpdir()`, or
1730
2437
  the directory of the volume a fixture has to lie on. The parent is resolved through every link first, so one spelled
1731
2438
  two ways is one run, and a process holds one run for each parent and suite. The first root a process creates for a
1732
- suite under a parent first reclaims every run of that suite there whose owner pid is gone: each process working in it
1733
- gets SIGTERM (SIGKILL if it outlives 10 s); once all have exited, every socket alias naming a workspace of that run
1734
- (see `publishFixtureSocketDirectory`) is unlinked, whether that workspace still exists or not, then the run is
1735
- deleted. A run whose owner is alive is never touched by another process, and other entries of the socket namespace are
1736
- left alone. A killed process therefore leaves what it owned in a `run-<pid>` of its own, inside that parent's
2439
+ suite under a parent first reclaims every run of that suite there whose owner pid is gone: nothing in it is signalled
2440
+ (what its owner left running is its supervisor's to retire); every socket alias naming a workspace of that run (see
2441
+ `publishFixtureSocketDirectory`) is unlinked, whether that workspace still exists or not, then the run is deleted. A
2442
+ run whose owner is alive is never touched by another process, and other entries of the socket namespace are left
2443
+ alone. A killed process therefore leaves what it owned in a `run-<pid>` of its own, inside that parent's
1737
2444
  `smoothbricks-fixtures` directory, never as a bare prefix among whatever else the parent holds, and the next process
1738
2445
  to use that parent and suite reclaims it. The owner itself, on SIGTERM, SIGINT or SIGHUP (a bounded test leg's timeout
1739
- sends SIGTERM, then SIGKILL 10 s later), first stops whatever still works in every run it holds, all at once, and
1740
- makes no new root meanwhile; a repeated signal waits for that. Then it dies of the first signal it got.
2446
+ sends SIGTERM, then SIGKILL 10 s later), first names on stderr its own descendants that still run, then deletes every
2447
+ run it holds, all at once, and makes no new root meanwhile; a repeated signal waits for that. Then it dies of the
2448
+ first signal it got.
1741
2449
  - `reclaimDeadFixtureRuns(parentDirectory, suite)` runs that sweep on demand, for a test that has just watched a
1742
2450
  fixture-owning process die.
1743
2451
  - `fixtureSocketDirectory(workspace)` names, without creating anything, the `nx` socket leaf below a short parent alias
@@ -1756,8 +2464,12 @@ tests) owns those roots:
1756
2464
  the workspace's path alone, so a deleted workspace retires too. A colliding non-symlink or retargeted alias refuses
1757
2465
  instead of removing another owner's entry; removing the fixture root reclaims its physical socket directories.
1758
2466
  - `stopNxDaemon(workspace, stop)` runs the caller's `nx daemon --stop` and waits until the daemon recorded in
1759
- `<workspace>/.nx/workspace-data/d/server-process.json`, and its descendants, has exited, then ends every process still
1760
- working in the workspace. That final census also catches editor probes reparented when the daemon exits.
2467
+ `<workspace>/.nx/workspace-data/d/server-process.json`, and its descendants, has exited. A workspace with no live
2468
+ record has nothing of a daemon to stop here.
2469
+ - `processesOf(pids)` lists exactly the named processes that still exist (`ps -p`); `processTree(roots)` adds every
2470
+ process descending from them, roots first, by walking down their children (`process-children.ts`; the walk itself is
2471
+ `walkTree`). `descendantsDiagnostic(subject)` names the test process's own running descendants for a failure report.
2472
+ Each listing waits at most the leg's no-progress backstop and then fails naming its command rather than answer empty.
1761
2473
 
1762
2474
  A fixture retires on every exit path, a throwing body included: stop its daemon, unlink its socket alias, then delete
1763
2475
  its root. A daemon that outlives the stop keeps the alias and the root, so the next run's sweep still finds both.
@@ -1779,9 +2491,17 @@ ones recorded beside the copy, so a run that changes nothing reads no file bytes
1779
2491
  nodes, if a fixture wrote into the copy, and leaves it for the next run to prove. The host's closure moves under a
1780
2492
  fixture that reads it: a shared Bun store relinked by another install, or, in a workspace that developer-links this
1781
2493
  plugin, the checkout its author is editing and rebuilding. Either fails the producer receipt's installation proof for
1782
- work that is not the test's. Each test file names its own copy; two runs of one file at once share it, and a copy one of
1783
- them makes again fails the other. This package's tests bind `censusRoot` to this repository; a consumer binds it to its
1784
- own workspace root.
2494
+ work that is not the test's.
2495
+
2496
+ Test files that name one copy share it. Bun runs many test files in one process, which takes the copy once, on the first
2497
+ `nodeModules()` of any of them, and each file's `retire()` proves that no fixture wrote into it since that take.
2498
+ Concurrent test processes, such as the shards of one run, share the copy too: an exclusive flock(2) on `lock` beside the
2499
+ record admits one take at a time, held by a perl child the kernel releases however its holder ends, and each taker names
2500
+ the copy it took in `holders/<pid>`. A copy that another live process holds is never changed in place: one that no
2501
+ longer holds what the host closure holds is made again, whole, in a new `installation-<uuid>`, and a copy that neither
2502
+ the record nor a live holder names is removed by the next take. A changed host closure is therefore copied once per run,
2503
+ not once per test file. This package's tests share one copy, `nx-plugin-tests`, and bind `censusRoot` to this
2504
+ repository; a consumer binds it to its own workspace root.
1785
2505
 
1786
2506
  The copy lies beneath `censusRoot`'s `node_modules`. Where `node_modules/.cache` is a real directory, as on a fresh CI
1787
2507
  checkout (a cowshed build volume links it elsewhere), Node's ancestor lookup from the copy reaches the host's own
@@ -1809,6 +2529,12 @@ Files with a `# smoo-local` tail or `# smoo-local-begin` / `# smoo-local-end` bl
1809
2529
  source symlinks are preserved; conflicting local blocks and broken or external links are reported instead of
1810
2530
  overwritten. The generator does not remove a repository-owned file when a capability is disabled.
1811
2531
 
2532
+ `tooling/direnv/repo-path` writes the `PATH` every managed shell entry and git hook uses. In a cowshed workspace whose
2533
+ `.cowshed/env` lacks `TMPDIR` or `COWSHED_RUNTIME_LINK`, a fork interrupted before its first supervisor start, it says
2534
+ so on stderr, runs `cowshed exec <ws> -- true` once through the installed cowshed, and continues on the file that start
2535
+ served. It refuses, naming the workspace and the start's exit status and error, only when that start fails or leaves the
2536
+ file unserved (cowshed `specs/cowshed/02_workspaces.md`, "Workspace environment").
2537
+
1812
2538
  ### Workflow security and bounded execution
1813
2539
 
1814
2540
  Managed action references use full commit SHAs with their release tags in comments. Read-only jobs explicitly set