@smoothbricks/nx-plugin 0.4.26 → 0.4.27

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 (343) hide show
  1. package/README.md +994 -117
  2. package/dist/bin/smoo-nx-bound-failures.d.ts +3 -0
  3. package/dist/bin/smoo-nx-bound-failures.d.ts.map +1 -0
  4. package/dist/bin/smoo-nx-bound-failures.js +31 -0
  5. package/dist/bin/smoo-nx-cargo-hash.js +28 -3
  6. package/dist/bin/smoo-nx-exec.js +15 -73
  7. package/dist/bin/smoo-nx-failures.d.ts +3 -0
  8. package/dist/bin/smoo-nx-failures.d.ts.map +1 -0
  9. package/dist/bin/smoo-nx-failures.js +3 -0
  10. package/dist/bin/smoo-nx-nextest-extract.js +3 -2
  11. package/dist/bin/smoo-nx-test-walks.d.ts +3 -0
  12. package/dist/bin/smoo-nx-test-walks.d.ts.map +1 -0
  13. package/dist/bin/smoo-nx-test-walks.js +34 -0
  14. package/dist/bounded-test-policy.d.ts +7 -1
  15. package/dist/bounded-test-policy.d.ts.map +1 -1
  16. package/dist/bounded-test-policy.js +101 -40
  17. package/dist/build-state-output-policy.d.ts +25 -0
  18. package/dist/build-state-output-policy.d.ts.map +1 -0
  19. package/dist/build-state-output-policy.js +64 -0
  20. package/dist/cargo-closure-input.d.ts +3 -2
  21. package/dist/cargo-closure-input.d.ts.map +1 -1
  22. package/dist/cargo-closure-input.js +16 -15
  23. package/dist/cargo-dev-profile.d.ts +37 -0
  24. package/dist/cargo-dev-profile.d.ts.map +1 -0
  25. package/dist/cargo-dev-profile.js +108 -0
  26. package/dist/cargo-source-hash.d.ts +43 -6
  27. package/dist/cargo-source-hash.d.ts.map +1 -1
  28. package/dist/cargo-source-hash.js +309 -73
  29. package/dist/cargo-toolchain-policy.d.ts +4 -0
  30. package/dist/cargo-toolchain-policy.d.ts.map +1 -1
  31. package/dist/cargo-toolchain-policy.js +5 -0
  32. package/dist/cargo-workspace.d.ts +101 -5
  33. package/dist/cargo-workspace.d.ts.map +1 -1
  34. package/dist/cargo-workspace.js +291 -10
  35. package/dist/cross-check-policy.d.ts +21 -3
  36. package/dist/cross-check-policy.d.ts.map +1 -1
  37. package/dist/cross-check-policy.js +24 -6
  38. package/dist/disk-command-policy.d.ts +7 -0
  39. package/dist/disk-command-policy.d.ts.map +1 -0
  40. package/dist/disk-command-policy.js +98 -0
  41. package/dist/ensure-built-receipt.d.ts +25 -0
  42. package/dist/ensure-built-receipt.d.ts.map +1 -0
  43. package/dist/ensure-built-receipt.js +261 -0
  44. package/dist/ensure-built-witness.d.ts +57 -0
  45. package/dist/ensure-built-witness.d.ts.map +1 -0
  46. package/dist/ensure-built-witness.js +412 -0
  47. package/dist/ensure-built.d.ts +207 -12
  48. package/dist/ensure-built.d.ts.map +1 -1
  49. package/dist/ensure-built.js +576 -202
  50. package/dist/eslint-file-set.d.ts +7 -0
  51. package/dist/eslint-file-set.d.ts.map +1 -0
  52. package/dist/eslint-file-set.js +12 -0
  53. package/dist/executors/bounded-exec/cpu-pool.d.ts +63 -0
  54. package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -0
  55. package/dist/executors/bounded-exec/cpu-pool.js +379 -0
  56. package/dist/executors/bounded-exec/cpu-tokens.d.ts +82 -0
  57. package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +1 -0
  58. package/dist/executors/bounded-exec/cpu-tokens.js +114 -0
  59. package/dist/executors/bounded-exec/disk-lease.d.ts +61 -0
  60. package/dist/executors/bounded-exec/disk-lease.d.ts.map +1 -0
  61. package/dist/executors/bounded-exec/disk-lease.js +91 -0
  62. package/dist/executors/bounded-exec/executor.d.ts +45 -2
  63. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  64. package/dist/executors/bounded-exec/executor.js +447 -52
  65. package/dist/executors/bounded-exec/gateway-lease.d.ts +52 -0
  66. package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -0
  67. package/dist/executors/bounded-exec/gateway-lease.js +143 -0
  68. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +35 -0
  69. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -0
  70. package/dist/executors/bounded-exec/hang-diagnostics.js +231 -0
  71. package/dist/executors/bounded-exec/progress.d.ts +35 -0
  72. package/dist/executors/bounded-exec/progress.d.ts.map +1 -0
  73. package/dist/executors/bounded-exec/progress.js +79 -0
  74. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +3 -0
  75. package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -0
  76. package/dist/executors/bounded-exec/ram-temp-fixtures.js +12 -0
  77. package/dist/executors/bounded-exec/ram-temp-held.d.ts +91 -0
  78. package/dist/executors/bounded-exec/ram-temp-held.d.ts.map +1 -0
  79. package/dist/executors/bounded-exec/ram-temp-held.js +152 -0
  80. package/dist/executors/bounded-exec/ram-temp.d.ts +223 -0
  81. package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -0
  82. package/dist/executors/bounded-exec/ram-temp.js +1528 -0
  83. package/dist/executors/bounded-exec/schema.d.ts +29 -11
  84. package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
  85. package/dist/executors/bounded-exec/verdict.d.ts +162 -0
  86. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -0
  87. package/dist/executors/bounded-exec/verdict.js +318 -0
  88. package/dist/executors/shard-timings/executor.d.ts +14 -0
  89. package/dist/executors/shard-timings/executor.d.ts.map +1 -0
  90. package/dist/executors/shard-timings/executor.js +25 -0
  91. package/dist/executors/shard-timings/schema.d.ts +4 -0
  92. package/dist/executors/shard-timings/schema.d.ts.map +1 -0
  93. package/dist/executors/shard-timings/schema.js +1 -0
  94. package/dist/failure-summary.d.ts +5 -0
  95. package/dist/failure-summary.d.ts.map +1 -0
  96. package/dist/failure-summary.js +118 -0
  97. package/dist/generators/create-package/generator.d.ts.map +1 -1
  98. package/dist/generators/create-package/generator.js +6 -2
  99. package/dist/index.d.ts +14 -2
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +370 -138
  102. package/dist/managed-files/ci-workflow.d.ts +13 -0
  103. package/dist/managed-files/ci-workflow.d.ts.map +1 -1
  104. package/dist/managed-files/ci-workflow.js +44 -13
  105. package/dist/managed-files/files.d.ts +7 -1
  106. package/dist/managed-files/files.d.ts.map +1 -1
  107. package/dist/managed-files/files.js +62 -8
  108. package/dist/managed-files/json-edit.d.ts +21 -0
  109. package/dist/managed-files/json-edit.d.ts.map +1 -0
  110. package/dist/managed-files/json-edit.js +295 -0
  111. package/dist/managed-files/managed-format.d.ts +33 -1
  112. package/dist/managed-files/managed-format.d.ts.map +1 -1
  113. package/dist/managed-files/managed-format.js +82 -2
  114. package/dist/managed-files/pr-preview-cleanup-workflow.d.ts +7 -0
  115. package/dist/managed-files/pr-preview-cleanup-workflow.d.ts.map +1 -1
  116. package/dist/managed-files/pr-preview-cleanup-workflow.js +68 -4
  117. package/dist/managed-files/publish-workflow.d.ts.map +1 -1
  118. package/dist/managed-files/publish-workflow.js +231 -48
  119. package/dist/managed-files/tree.d.ts +5 -0
  120. package/dist/managed-files/tree.d.ts.map +1 -1
  121. package/dist/managed-files/tree.js +5 -3
  122. package/dist/manifest-hash.d.ts.map +1 -1
  123. package/dist/manifest-hash.js +2 -5
  124. package/dist/nextest-code-bound.d.ts +62 -0
  125. package/dist/nextest-code-bound.d.ts.map +1 -0
  126. package/dist/nextest-code-bound.js +154 -0
  127. package/dist/nextest-extraction.d.ts +24 -8
  128. package/dist/nextest-extraction.d.ts.map +1 -1
  129. package/dist/nextest-extraction.js +42 -7
  130. package/dist/package-target-policy.d.ts.map +1 -1
  131. package/dist/package-target-policy.js +3 -5
  132. package/dist/release-config-policy.d.ts.map +1 -1
  133. package/dist/release-config-policy.js +3 -5
  134. package/dist/runtime-input.d.ts +14 -0
  135. package/dist/runtime-input.d.ts.map +1 -0
  136. package/dist/runtime-input.js +15 -0
  137. package/dist/rust-tokens.d.ts +11 -0
  138. package/dist/rust-tokens.d.ts.map +1 -0
  139. package/dist/rust-tokens.js +81 -0
  140. package/dist/task-results.d.ts +6 -0
  141. package/dist/task-results.d.ts.map +1 -0
  142. package/dist/task-results.js +61 -0
  143. package/dist/test-program.d.ts +54 -0
  144. package/dist/test-program.d.ts.map +1 -0
  145. package/dist/test-program.js +292 -0
  146. package/dist/test-timings.d.ts +71 -0
  147. package/dist/test-timings.d.ts.map +1 -0
  148. package/dist/test-timings.js +393 -0
  149. package/dist/test-walk-policy.d.ts +103 -0
  150. package/dist/test-walk-policy.d.ts.map +1 -0
  151. package/dist/test-walk-policy.js +657 -0
  152. package/dist/testing.d.ts +177 -0
  153. package/dist/testing.d.ts.map +1 -0
  154. package/dist/testing.js +824 -0
  155. package/dist/type-guards.d.ts +3 -0
  156. package/dist/type-guards.d.ts.map +1 -0
  157. package/dist/type-guards.js +4 -0
  158. package/dist/typecheck-test-policy.d.ts +8 -5
  159. package/dist/typecheck-test-policy.d.ts.map +1 -1
  160. package/dist/typecheck-test-policy.js +113 -100
  161. package/dist/workspace-config-policy.d.ts +8 -0
  162. package/dist/workspace-config-policy.d.ts.map +1 -1
  163. package/dist/workspace-config-policy.js +175 -63
  164. package/dist/workspace-index.d.ts +12 -0
  165. package/dist/workspace-index.d.ts.map +1 -0
  166. package/dist/workspace-index.js +17 -0
  167. package/dist/workspace-manifest.d.ts +37 -0
  168. package/dist/workspace-manifest.d.ts.map +1 -1
  169. package/executors.json +5 -0
  170. package/loader.js +13 -11
  171. package/managed/raw/envrc +33 -67
  172. package/managed/raw/git-format-staged.yml +30 -35
  173. package/managed/raw/patches/nx@23.2.1.patch +3484 -0
  174. package/managed/raw/tooling/direnv/apple-developer.sh +83 -0
  175. package/managed/raw/tooling/direnv/developer-links.ts +569 -11
  176. package/managed/raw/tooling/direnv/devenv.smoo.nix +314 -93
  177. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +20 -11
  178. package/managed/raw/tooling/direnv/linked-snapshots.ts +845 -0
  179. package/managed/raw/tooling/direnv/nx-socket-dir.sh +82 -0
  180. package/managed/raw/tooling/direnv/repo-path +14 -2
  181. package/managed/raw/tooling/direnv/setup-environment.ts +962 -148
  182. package/managed/raw/tooling/direnv/toolchain-stamp.ts +45 -3
  183. package/managed/raw/tooling/direnv/ttsc-env.sh +39 -0
  184. package/managed/raw/tooling/git-hooks/commit-msg.sh +5 -6
  185. package/managed/raw/tooling/git-hooks/pre-commit.sh +7 -6
  186. package/managed/raw/tooling/git-hooks/pre-push.sh +20 -15
  187. package/managed/templates/github/actions/cache-nix-devenv/action.yml +6 -6
  188. package/managed/templates/github/actions/cache-node-modules/action.yml +6 -4
  189. package/managed/templates/github/actions/cache-nx/action.yml +1 -1
  190. package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +1 -1
  191. package/managed/templates/github/actions/forgejo-artifact.cjs +99 -0
  192. package/managed/templates/github/actions/forgejo-download-artifact/action.yml +49 -0
  193. package/managed/templates/github/actions/forgejo-download-artifact/index.cjs +7 -0
  194. package/managed/templates/github/actions/forgejo-upload-artifact/action.yml +65 -0
  195. package/managed/templates/github/actions/forgejo-upload-artifact/index.cjs +7 -0
  196. package/managed/templates/github/actions/setup-devenv/action.yml +21 -3
  197. package/managed/templates/github/workflows/managed-files.yml +1 -2
  198. package/nextest.toml +8 -41
  199. package/package.json +74 -12
  200. package/runtime-input.sh +81 -0
  201. package/src/__tests__/counted-cargo.ts +33 -14
  202. package/src/__tests__/fixture-nx-env.ts +111 -46
  203. package/src/__tests__/progress-clock.ts +43 -0
  204. package/src/__tests__/runtime-input.ts +23 -0
  205. package/src/bin/smoo-nx-bound-failures.test.ts +127 -0
  206. package/src/bin/smoo-nx-bound-failures.ts +33 -0
  207. package/src/bin/smoo-nx-cargo-hash.ts +28 -3
  208. package/src/bin/smoo-nx-exec.ts +16 -74
  209. package/src/bin/smoo-nx-failures.ts +4 -0
  210. package/src/bin/smoo-nx-nextest-extract.ts +3 -2
  211. package/src/bin/smoo-nx-test-walks.ts +42 -0
  212. package/src/bounded-test-policy.test.ts +268 -21
  213. package/src/bounded-test-policy.ts +114 -42
  214. package/src/build-state-output-policy.test.ts +115 -0
  215. package/src/build-state-output-policy.ts +90 -0
  216. package/src/bun-bootstrap.test.ts +57 -3
  217. package/src/bun-file-packages.test.ts +47 -0
  218. package/src/cargo-closure-input.test.ts +138 -66
  219. package/src/cargo-closure-input.ts +17 -15
  220. package/src/cargo-dev-profile.ts +137 -0
  221. package/src/cargo-resolve-cache.test.ts +70 -1
  222. package/src/cargo-source-hash.test.ts +193 -97
  223. package/src/cargo-source-hash.ts +345 -68
  224. package/src/cargo-toolchain-policy.ts +6 -0
  225. package/src/cargo-workspace.test.ts +320 -0
  226. package/src/cargo-workspace.ts +336 -10
  227. package/src/cross-check-policy.test.ts +59 -1
  228. package/src/cross-check-policy.ts +25 -6
  229. package/src/disk-command-policy.test.ts +61 -0
  230. package/src/disk-command-policy.ts +107 -0
  231. package/src/ensure-built-receipt.test.ts +184 -0
  232. package/src/ensure-built-receipt.ts +263 -0
  233. package/src/ensure-built-witness.test.ts +344 -0
  234. package/src/ensure-built-witness.ts +252 -0
  235. package/src/ensure-built.test.ts +1036 -578
  236. package/src/ensure-built.ts +820 -224
  237. package/src/eslint-file-set.ts +9 -0
  238. package/src/executors/bounded-exec/cpu-pool.test.ts +454 -0
  239. package/src/executors/bounded-exec/cpu-pool.ts +417 -0
  240. package/src/executors/bounded-exec/cpu-tokens.test.ts +269 -0
  241. package/src/executors/bounded-exec/cpu-tokens.ts +177 -0
  242. package/src/executors/bounded-exec/disk-lease.test.ts +185 -0
  243. package/src/executors/bounded-exec/disk-lease.ts +139 -0
  244. package/src/executors/bounded-exec/executor-host.test.ts +778 -0
  245. package/src/executors/bounded-exec/executor.test.ts +1116 -63
  246. package/src/executors/bounded-exec/executor.ts +565 -67
  247. package/src/executors/bounded-exec/gateway-lease.ts +176 -0
  248. package/src/executors/bounded-exec/hang-diagnostics.test.ts +285 -0
  249. package/src/executors/bounded-exec/hang-diagnostics.ts +283 -0
  250. package/src/executors/bounded-exec/progress.test.ts +79 -0
  251. package/src/executors/bounded-exec/progress.ts +118 -0
  252. package/src/executors/bounded-exec/ram-temp-fixtures.ts +12 -0
  253. package/src/executors/bounded-exec/ram-temp-held.test.ts +264 -0
  254. package/src/executors/bounded-exec/ram-temp-held.ts +242 -0
  255. package/src/executors/bounded-exec/ram-temp-host.test.ts +605 -0
  256. package/src/executors/bounded-exec/ram-temp.test.ts +674 -0
  257. package/src/executors/bounded-exec/ram-temp.ts +1918 -0
  258. package/src/executors/bounded-exec/schema.json +11 -5
  259. package/src/executors/bounded-exec/schema.ts +27 -11
  260. package/src/executors/bounded-exec/verdict.test.ts +440 -0
  261. package/src/executors/bounded-exec/verdict.ts +433 -0
  262. package/src/executors/shard-timings/executor.ts +36 -0
  263. package/src/executors/shard-timings/schema.json +21 -0
  264. package/src/executors/shard-timings/schema.ts +4 -0
  265. package/src/failure-summary.ts +119 -0
  266. package/src/generators/bounded-test-targets/generator.test.ts +4 -4
  267. package/src/generators/bun-test-tracing/generator.test.ts +2 -2
  268. package/src/generators/create-package/generator.test.ts +6 -0
  269. package/src/generators/create-package/generator.ts +6 -2
  270. package/src/host-controller-wiring.test.ts +31 -0
  271. package/src/index.test.ts +909 -295
  272. package/src/index.ts +441 -143
  273. package/src/linked-snapshots.nx.test.ts +172 -0
  274. package/src/managed-files/ci-workflow.ts +54 -13
  275. package/src/managed-files/files.ts +65 -9
  276. package/src/managed-files/forgejo-artifact.test.ts +395 -0
  277. package/src/managed-files/generator.test.ts +60 -1
  278. package/src/managed-files/json-edit.test.ts +216 -0
  279. package/src/managed-files/json-edit.ts +290 -0
  280. package/src/managed-files/managed-format-json.test.ts +308 -0
  281. package/src/managed-files/managed-format.ts +90 -2
  282. package/src/managed-files/pr-preview-cleanup-workflow.ts +69 -3
  283. package/src/managed-files/publish-workflow.ts +285 -67
  284. package/src/managed-files/repo-path.test.ts +129 -0
  285. package/src/managed-files/trace-db-artifact.test.ts +7 -0
  286. package/src/managed-files/tree.ts +11 -3
  287. package/src/manifest-hash.ts +2 -6
  288. package/src/nextest-code-bound.test.ts +155 -0
  289. package/src/nextest-code-bound.ts +195 -0
  290. package/src/nextest-extraction.test.ts +37 -5
  291. package/src/nextest-extraction.ts +51 -9
  292. package/src/nextest-partitions.test.ts +427 -82
  293. package/src/nx-cache-bound.test.ts +5 -10
  294. package/src/nx-cache-restore-mtime.test.ts +170 -0
  295. package/src/nx-daemon-claim.test.ts +277 -0
  296. package/src/nx-daemon-idle-cpu.test.ts +81 -0
  297. package/src/nx-daemon-idle-policy.test.ts +51 -0
  298. package/src/nx-daemon-ignore-files.test.ts +210 -0
  299. package/src/nx-daemon-root-normalization.test.ts +105 -0
  300. package/src/nx-daemon-validity.test.ts +925 -0
  301. package/src/nx-dot-input-policy.test.ts +353 -0
  302. package/src/nx-failure-life-cycles.test.ts +207 -0
  303. package/src/nx-files-archive-racy.test.ts +97 -0
  304. package/src/nx-foreign-workspace-env.test.ts +329 -0
  305. package/src/nx-incomplete-run-summary.test.ts +70 -0
  306. package/src/nx-plugin-load-errors.test.ts +120 -0
  307. package/src/nx-project-resolution-cache.test.ts +176 -0
  308. package/src/nx-raw-inputs.test.ts +166 -0
  309. package/src/nx-resident-graph-workers.test.ts +7 -16
  310. package/src/nx-run-information.test.ts +118 -0
  311. package/src/nx-skipped-task-exit.test.ts +180 -0
  312. package/src/nx-state-location.test.ts +63 -0
  313. package/src/nx-store-resolution.test.ts +26 -25
  314. package/src/nx-task-graph-cycles.test.ts +148 -0
  315. package/src/nx-task-output-lease.test.ts +414 -0
  316. package/src/nx-use-local.test.ts +103 -0
  317. package/src/package-target-policy.ts +3 -6
  318. package/src/release-config-policy.ts +3 -6
  319. package/src/runtime-input.test.ts +215 -0
  320. package/src/runtime-input.ts +17 -0
  321. package/src/rust-tokens.ts +78 -0
  322. package/src/serial-group-wiring.test.ts +326 -0
  323. package/src/task-history-namespace.test.ts +87 -89
  324. package/src/task-results.test.ts +226 -0
  325. package/src/task-results.ts +75 -0
  326. package/src/test-program.test.ts +303 -0
  327. package/src/test-program.ts +341 -0
  328. package/src/test-timings.test.ts +240 -0
  329. package/src/test-timings.ts +311 -0
  330. package/src/test-walk-policy.test.ts +585 -0
  331. package/src/test-walk-policy.ts +731 -0
  332. package/src/testing.test.ts +509 -0
  333. package/src/testing.ts +922 -0
  334. package/src/type-guards.ts +4 -0
  335. package/src/typecheck-test-policy.test.ts +496 -11
  336. package/src/typecheck-test-policy.ts +137 -103
  337. package/src/workspace-config-policy.test.ts +212 -13
  338. package/src/workspace-config-policy.ts +101 -73
  339. package/src/workspace-index.ts +18 -0
  340. package/src/workspace-manifest.ts +41 -0
  341. package/test-timings.json +85 -30
  342. package/managed/raw/tooling/direnv/inherited-devenv.ts +0 -665
  343. package/managed/raw/tooling/direnv/shared-caches.sh +0 -53
package/README.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  Local Nx plugin for workspace-standard package setup and missing inferred targets.
4
4
 
5
+ Workspace policy preserves configured plugin entries other than the disabled `@nx/js/typescript`, including their
6
+ options, include/exclude filters and order. It adds the bare `@smoothbricks/nx-plugin` entry only when the plugin is
7
+ absent; repeated updates do not replace an existing configured entry or discard scoped instances. Malformed plugin
8
+ values are reported rather than replaced, and an unchanged Nx Tree configuration is not serialized again.
9
+
10
+ The public plugin entry loads its transformed bootstrap product synchronously, matching Nx's real `handleImport` require
11
+ path in Node and Bun. A missing `dist/index.js` refuses by name and gives the `ttsc` bootstrap command; it never returns
12
+ an empty graph or loads raw development source in place of transformed code.
13
+
5
14
  ## Target Ownership
6
15
 
7
16
  Official `@nx/js/typescript` inference is disabled because it cannot run the workspace's source transformers. A package
@@ -13,6 +22,8 @@ with `tsconfig.lib.json` receives transformer-aware `tsc-js` and native `typeche
13
22
  - `test-watch` from explicit `test` commands for Bun and Vitest packages
14
23
  - Cargo workspace targets from a neighboring workspace-root `Cargo.toml`
15
24
  - aggregate `build` and `lint` targets
25
+ - an uncached `shard-timings` check, which `lint` depends on, beside `bun test` targets sharded with `--shard` and
26
+ balanced with `--timings`
16
27
  - an uncached `deploy` for a PRIVATE project with a wrangler manifest, running
17
28
  `smoo wrangler deploy-stage --stage {args.stage}`
18
29
 
@@ -30,25 +41,85 @@ published package that really is deployed declares `deploy` itself. Whether CI d
30
41
  question, answered only by the deploy tags the CLI reads (`stage-deploy-target` and its three siblings).
31
42
 
32
43
  Lint commands are inferred per project. A workspace Biome configuration enables the project-wide Biome check; an ESLint
33
- flat configuration enables ESLint only for existing JavaScript/TypeScript files under that project's `src`. Rust-only
34
- source trees therefore keep their Cargo validation and manifest checks without invoking ESLint on nonexistent JavaScript
35
- inputs. Adding JavaScript or TypeScript sources adds their lint coverage automatically.
36
-
37
- Keep `targetDefaults.lint` limited to shared cache policy. Smoo's workspace policy removes static lint executors,
38
- commands, dependencies, inputs and outputs because they override source-aware inference for every project. Project-local
39
- `nx.targets.lint` declarations retain normal Nx override precedence.
44
+ flat configuration enables ESLint for existing JavaScript/TypeScript files under that project's `src` and the files its
45
+ `tsconfig.test.json` declares, wherever they live. TypeScript resolves inherited `include`, `files` and `exclude`; the
46
+ same sources, the test declaration and its existing `extends` chain are explicit lint cache inputs. Both lists hold only
47
+ files in Nx's workspace file index (.gitignore and .nxignore applied), so a gitignored generated module that a build
48
+ left on disk is neither linted nor keyed, and the lint target is the same in every checkout of one tree. Rust-only
49
+ source trees keep their Cargo validation and manifest checks without invoking ESLint on nonexistent JavaScript inputs.
50
+ Test-config diagnostics retain TypeScript's parsed-command-line types through bootstrap emit; invalid declarations fail
51
+ with their diagnostic code and message, while an empty test program (TS18003) contributes no test files. Adding
52
+ JavaScript/TypeScript sources or changing the declared test program updates lint coverage automatically. The target's
53
+ `metadata.eslintFileSet` retains that exact command and workspace-relative file list for cache inspectors.
54
+ `@smoothbricks/nx-plugin/eslint-file-set` owns its type and generated validator; an inspector can resolve each file's
55
+ actual ESLint parser program instead of guessing from the project or target name.
56
+
57
+ Lint inputs include dependency production inputs because type-aware ESLint reads dependencies' declarations. This uses
58
+ `^production` unless the workspace opts into the versionless production input described below. Keep
59
+ `targetDefaults.lint` limited to shared cache policy or additive inputs such as `["...", "^production"]`. Smoo's
60
+ workspace policy removes static lint executors, commands, dependencies, outputs and replacement input lists because they
61
+ override source-aware inference for every project. Project-local `nx.targets.lint` declarations retain normal Nx
62
+ override precedence.
63
+
64
+ Smoo's workspace policy also sets `"cacheDirectory": ".nx/cache"` in the root `nx.json`, and `smoo monorepo check` fails
65
+ without it. With no `NX_*_DIRECTORY` variable set, as in a host shell, the pinned Nx otherwise moves the task cache and
66
+ its database to a per-user `~/.nx/<id>` keyed by the repository's remote, which every checkout of the repository shares.
67
+ A configured `cacheDirectory` keeps the cache in the checkout's `.nx/cache` and the task database in its
68
+ `.nx/workspace-data` (nx.json has no key for the database's directory). Cowshed links both into the checkout's build
69
+ volume, and `src/nx-state-location.test.ts` checks where this repository's host Nx resolves them.
40
70
 
41
71
  The plugin's own `nx run nx-plugin:test` aggregates four bounded Bun targets. Each uses Bun's native
42
72
  `--timings=test-timings.json --shard=N/4` partition to balance measured per-file work, while normal discovery still runs
43
73
  every test file (including newly added files) exactly once. A failed shard fails the aggregate. The shard count and
44
- standard 120-second target deadline stay unchanged. Refresh the portable timing manifest from this package directory
45
- with `bun test --timeout=30000 --timings=test-timings.json --update-timings`; it is scheduling data, not a test
46
- allowlist.
74
+ standard 120-second target deadline stay unchanged. Bun cuts the path-sorted files into four contiguous runs and costs a
75
+ file the manifest does not name at the manifest's median, so files added without a refresh cluster into one shard and
76
+ can push it past its deadline. The inferred `shard-timings` target makes that loud instead: for any project whose
77
+ `bun test` targets carry both `--shard=N/M` and `--timings=<file>`, it replays Bun's discovery rules without running a
78
+ test and fails naming every file the shards would run that the manifest does not name, with the refresh command
79
+ `smoo nx refresh-test-timings <project>`. That command runs the suite once without `--shard`, adding `--update-timings`,
80
+ and then repeats the check. Refresh after adding or slowing a test file; the manifest is scheduling data, not a test
81
+ allowlist. The shards of one suite must share one cwd and every argument but `--shard`, pass flag values as
82
+ `--flag=value`, and use no shell syntax beyond quoting; a shard command that breaks this fails graph construction,
83
+ because the files it runs could only be guessed.
47
84
 
48
85
  Real Nx fixtures own their cache and workspace-data directories and stop their daemon before removing the fixture.
49
- Fixtures that intentionally strip caller directory overrides declare `cacheDirectory: ".nx/cache"` in their own
50
- `nx.json`; this keeps the native task database local too, rather than leaving a new `~/.nx/<repoKey>` behind. Offline,
51
- path-only Cargo fixtures likewise own a temporary `CARGO_HOME`; production commands still keep the caller's Cargo home.
86
+ Retirement also drains processes whose working directory is inside the fixture when no daemon record exists: startup may
87
+ not have published its record yet, so an absent record never proves the fixture is empty. Fixtures that intentionally
88
+ strip caller directory overrides declare `cacheDirectory: ".nx/cache"` in their own `nx.json`; this keeps the native
89
+ task database local too, rather than leaving a new `~/.nx/<repoKey>` behind. Offline, path-only Cargo fixtures likewise
90
+ own a temporary `CARGO_HOME`; production commands still keep the caller's Cargo home.
91
+
92
+ Fixture sockets and loopback listeners live where a Cowshed sandbox admits them, never at a literal `/tmp` path or on
93
+ port 0. A fixture's short socket parent alias lives beside the Nx socket directory the job supplies (the parent of
94
+ `NX_SOCKET_DIR`, the workspace's short runtime link), else under `COWSHED_RUNTIME_LINK`, else the temp directory. The
95
+ alias points into the fixture's own physical `.nx/sockets`, outside every checkout; its `nx` socket leaf is a real
96
+ directory. The foreign-workspace guard therefore sees the fixture as its owner, without a new grant or identity rule. A
97
+ shell's variable counts only when it belongs to this checkout, as `nx-socket-dir.sh` decides it; one that leads
98
+ elsewhere or cannot be looked at is passed over, and a refusal names it. The temp fallback admits a user-owned parent or
99
+ the root-owned public sticky directory with mode 1777, not an inaccessible sticky directory. A socket path over 95 UTF-8
100
+ bytes is refused with an error naming it. The shell owner retains a failed socket-directory creation's exit status; the
101
+ foreign-workspace provider refuses before running a target and preserves its complete diagnostic. `fixtureNxEnv` gives
102
+ each fixture its own `NX_SOCKET_DIR`; retirement stops its daemon before unlinking its verified parent alias and
103
+ removing the fixture root. A test whose subject is two daemons names a distinct real leaf for each. A listener another
104
+ process connects to (the counted Cargo broker, a remote-cache server) binds through `bindListener`: a port of the
105
+ workspace's `COWSHED_PORT_BASE`/`COWSHED_PORT_BLOCK_SIZE` block, lowest first, skipping only ports in use, and port 0
106
+ outside a block.
107
+
108
+ On macOS the working-directory holder census invokes `/usr/sbin/lsof` explicitly, independent of a test or devenv
109
+ `PATH`. A missing or inaccessible census tool fails cleanup with its command error; it never means no holders. Only
110
+ lsof's exit-1 process-disappearance race retains the partial inventory it produced.
111
+
112
+ The provider-real-Nx snapshot walk uses asynchronous children so its case timer can run while a producer or capture is
113
+ active. Its 60 s case guard covers one provider, daemon lifecycle and all provenance/refusal checks; it does not split
114
+ those checks into separately rebuilt fixtures.
115
+
116
+ Ignored-lockfile validity uses one daemon-successor walk: first refusal at the request boundary, then the successor's
117
+ request-free safety-poll invalidation. Both boundaries keep their original observations without a second fixture start.
118
+
119
+ Daemon-validity readiness waits for an actual successful PING under its existing 30 s guard, probing every 50 ms;
120
+ socket-directory events are not readiness because a bind/listen or closed-connection transition need not emit another
121
+ one. Expiry reports the expected and current daemon PID, observed process state and descendants, and the daemon log's
122
+ last 60 lines before fixture retirement removes them. The record-change and restart oracles remain event-driven.
52
123
 
53
124
  ## Cargo Workspace Layouts
54
125
 
@@ -56,20 +127,24 @@ The plugin discovers Cargo workspaces beside Nx project manifests at any depth:
56
127
 
57
128
  - **Workspace owner:** the project beside a workspace `Cargo.toml` owns one `cargo-fetch`, `cargo-test-compile`,
58
129
  `cargo-test-archive`, `cargo-lint`, cross-check, mutation, bench, and sweep target. Its `cargo-lint` and `cargo-test`
59
- aggregates reach all workspace crates, including a root `[package]`.
130
+ aggregates reach all workspace crates, including a root `[package]`; `cargo-test` is the ordinary suite, and the
131
+ project's `test` also reaches the serial test groups (below).
60
132
  - **Crate owner:** the deepest Nx project directory containing a crate owns `cargo-test-<crate>` targets. Its
61
133
  `cargo-lint` delegates to the workspace owner's one verdict, and `lint` never depends on the workspace test suite.
62
134
  Projects can own multiple crates. A nested independent workspace has its own prerequisites and does not inherit those
63
135
  of an outer workspace.
64
136
  - **Commands:** validation runs from the governing Cargo workspace directory. One `cargo fmt --all --check` and one
65
- `cargo --frozen clippy --workspace --all-targets -- -D warnings` cover every member. Clippy of a crate is a check
66
- build of its whole closure, so a target directory per crate rebuilt every shared dependency once per crate — 49
67
- closures and 11 GiB on one repository — and no per-crate cache hit repaid it. Clippy writes the workspace's own
68
- `target/`, like every dev build: its check units carry their mode in the unit hash and never collide with build units,
69
- and the host units a dev build compiled (build scripts and their host-only dependencies) are reused instead of
70
- compiled a second time. Cargo's own lock serializes the invocations that share the directory. `cargo-lint-cross` keeps
71
- `target/cargo-lint-cross`: a foreign triple's units are distinct anyway, and its own lock keeps the cross check from
72
- queueing behind host builds.
137
+ `cargo --frozen clippy --workspace --all-targets --config 'build.warnings="deny"'` cover every member. Clippy of a
138
+ crate is a check build of its whole closure, so a target directory per crate rebuilt every shared dependency once per
139
+ crate — 49 closures and 11 GiB on one repository — and no per-crate cache hit repaid it. Clippy writes the workspace's
140
+ own `target/`, like every dev build: its check units carry their mode in the unit hash and never collide with build
141
+ units, and the host units a dev build compiled (build scripts and their host-only dependencies) are reused instead of
142
+ compiled a second time. Warnings are denied by Cargo's `build.warnings`, not `-- -D warnings`: arguments after `--`
143
+ are clippy-driver's `CLIPPY_ARGS`, which enter every member's fingerprint, so the gate and a plain
144
+ `cargo clippy --workspace --all-targets` would re-check each other's units. `build.warnings` also fails on warnings
145
+ replayed from Fresh units, so the two share one unit set and the gate still fails. Cargo's own lock serializes the
146
+ invocations that share the directory. `cargo-lint-cross` keeps `target/cargo-lint-cross`: a foreign triple's units are
147
+ distinct anyway, and its own lock keeps the cross check from queueing behind host builds.
73
148
  - **Scheduling:** inference never throttles Nx. It sets no `parallelism: false` or `parallel: false`, no cap, and no
74
149
  edge whose only purpose is keeping two cargo writers off one `target/`: Cargo owns that lock, and a second process
75
150
  waits inside cargo. An edge states a real consumer — fetch before frozen cargo, the archive before the runners,
@@ -78,7 +153,9 @@ The plugin discovers Cargo workspaces beside Nx project manifests at any depth:
78
153
  per-manifest `cargo fetch`, Biome and ESLint) stay in a `commands` list that Nx runs side by side.
79
154
  - **Overrides:** normal Nx merging applies. Explicit `nx.targets` fields replace inferred fields, while omitted fields
80
155
  retain their inferred base. Use `"dependsOn": ["...", "extra"]` to preserve inferred prerequisites when adding an
81
- edge; replacing the array makes its author responsible for fetching before frozen Cargo commands.
156
+ edge; replacing the array makes its author responsible for fetching before frozen Cargo commands and producing the
157
+ archive before any runner consumes it. This repository also declares the archive producer explicitly in both APFS
158
+ runners' owning project targets, so a cold checkout reaches it before extraction.
82
159
 
83
160
  Member and exclude patterns may use `*` and `?` in any path segment (for example, `packages/*/crates/*`). Unsupported
84
161
  patterns and member patterns that match no directory fail graph construction instead of silently omitting crates.
@@ -96,6 +173,13 @@ test binaries. A package-local target that builds a shipped artifact follows the
96
173
  for an artifact family no other build compiles, such as a size-optimised wasm32 lane; a profile that compiles the same
97
174
  crates for the same target as `dev` or `release` compiles every dependency a second time.
98
175
 
176
+ Rust LMAO's opt-in source-revision contract is defined in
177
+ [01f](../../specs/lmao/01f_arrow_table_structure.md#smoo/lmao!n/arrow-table-module-id.not-git). Its native and Wasm
178
+ targets declare `{ "env": "LMAO_GIT_REVISION" }` as an input. Default dev/test runs leave it unset; publishing jobs set
179
+ it to the dispatch commit, so those builds include the explicit revision in their key without making dev runs
180
+ commit-keyed. The `production` configuration selects the shipping profile; it does not discover a Git revision. The root
181
+ workspace's cached nextest archive hashes that variable too, because it contains the compiled LMAO test binaries.
182
+
99
183
  ### Cargo cache boundaries
100
184
 
101
185
  `cargo-fetch` is uncached because the registry lives outside Nx outputs. `cargo-test-compile` is also uncached: it warms
@@ -103,12 +187,13 @@ Cargo's shared mutable build directory before the bounded runner, even if that d
103
187
  successful run. Cargo's own incremental cache avoids recompiling unchanged code. Nx never restores or collects shared
104
188
  Cargo build directories; lint and test **results**, and dedicated Wasm/N-API **outputs**, remain cacheable.
105
189
 
106
- Validation inputs include the crate's files, local dependency closure, governing manifests and configuration, the
107
- declared toolchain pin, and the toolchain's own reported versions. The pin is `devenv.lock`, hashed as an ordinary file
108
- input at both `{workspaceRoot}/devenv.lock` and `{workspaceRoot}/tooling/direnv/devenv.lock` — devenv resolves it into
109
- the rustc, cargo, linker, C toolchain and SDK every cargo command inherits, so bumping it invalidates every cached cargo
110
- target. Workspace test runners additionally hash all workspace member manifests because those affect unified features,
111
- and the nextest executable/configuration.
190
+ Validation inputs include the crate's files, every file its sources compile in through a literal `include_str!` or
191
+ `include_bytes!` path outside the crate's directory (a shipped skill or a shared corpus beside the crates), local
192
+ dependency closure, governing manifests and configuration, the declared toolchain pin, and the toolchain's own reported
193
+ versions. The pin is `devenv.lock`, hashed as an ordinary file input at both `{workspaceRoot}/devenv.lock` and
194
+ `{workspaceRoot}/tooling/direnv/devenv.lock` — devenv resolves it into the rustc, cargo, linker, C toolchain and SDK
195
+ every cargo command inherits, so bumping it invalidates every cached cargo target. Workspace test runners additionally
196
+ hash all workspace member manifests because those affect unified features, and the nextest executable/configuration.
112
197
 
113
198
  Nothing machine-local takes part. The ambient cargo environment and the global `$CARGO_HOME/config.toml` are
114
199
  deliberately not hashed: their values carry absolute store paths and per-checkout state directories, which would make
@@ -119,6 +204,38 @@ build-script reads or custom environment variables that Cargo metadata cannot na
119
204
  A target whose inputs a repository DECLARES replaces the inferred list, pin included. Name the two `devenv.lock` entries
120
205
  in that declaration, or in the named input it uses, or a toolchain bump will not invalidate it.
121
206
 
207
+ Every cached cargo target names the npm packages its command runs as `externalDependencies`: none for cargo itself, and
208
+ `@smoothbricks/nx-plugin` for a target that runs its executor or reads its installed files (the nextest tool config, the
209
+ archive extractor). Without that input Nx keys a task whose executor is not an `@nx/` one on every package in the
210
+ lockfile, so a lockfile-only commit re-ran every cargo verdict. Inside this repository the plugin is a workspace
211
+ project, which Nx refuses as an external dependency, so the list is empty here.
212
+
213
+ No input declaration removes a project's own configuration from a task's key. Nx 23.2.1 adds `ProjectConfiguration` to
214
+ every task (`hash_planner.rs` `gather_self_inputs`), and `hash_project_config.rs` hashes the executor, outputs, options,
215
+ configurations and parallelism of every target in the project, plus its tags and named inputs (not `inputs`,
216
+ `dependsOn`, `cache` or `//`). An edit to one target's command therefore re-keys every target of that project, including
217
+ each inferred `cargo-test-*` runner. Only the project a target lives in decides that sensitivity.
218
+
219
+ Workspace policy defaults non-production tasks to `["{projectRoot}/**/*", "!{projectRoot}/**/*.md"]`, without a forced
220
+ CI workflow input. It migrates the old CI-only `sharedGlobals` reference out of `default` and never re-injects that
221
+ definition. Custom non-CI named globals and explicit workflow-target inputs remain repository-owned and unchanged;
222
+ workflow checks can still name their own CI inputs.
223
+
224
+ Policy excludes incidental Markdown through `!{projectRoot}/**/*.md` in `default` and `production`. A task that consumes
225
+ Markdown declares it through an input set without a matching negative: Nx exclusions win over positive paths in the same
226
+ fileset, so a later explicit path cannot re-include it. Inferred Cargo package filesets remain broad for arbitrary
227
+ compiled data, headers, schemas and build-script reads; incidental Markdown beneath a crate can therefore still
228
+ invalidate those tasks conservatively. Nx 23.2.1 hashes a cached target that declares no `inputs` over every file under
229
+ its project root and ignores the `default` named input, so `smoo monorepo check` refuses such a target: declare its
230
+ inputs, or give its target name a `targetDefaults` entry with `"inputs": ["default", "^default"]`.
231
+
232
+ TypeScript toolchain inputs exclude Markdown beneath workspace-root `patches/`, but retain every other patch byte and
233
+ pin, including extensionless `PIN` and `VERSION` files. Native content-hash regressions distinguish those inputs from
234
+ README and unrelated-source edits. A task that consumes Markdown declares it through an input set without a matching
235
+ negative: Nx exclusions win over positive paths in the same fileset, so a later explicit path cannot re-include it.
236
+ Inferred Cargo package filesets remain broad for arbitrary compiled data, headers, schemas and build-script reads;
237
+ incidental Markdown beneath a crate can therefore still invalidate those tasks conservatively.
238
+
122
239
  Cargo keeps the caller's `CARGO_HOME`. Moving configuration into an isolated home can change relative paths or lose
123
240
  source replacement, credentials, and toolchain settings; forwarding it with `--config` changes precedence. Registry
124
241
  access may consequently wait on Cargo's package-cache lock, which Cargo arbitrates itself; Nx adds no ordering for it.
@@ -137,6 +254,11 @@ atomic rename; failed resolutions are never cached. A corrupt cache is reported
137
254
  during resolution are retried at most three times, then refused with the cause intact. A WASM-only Nx host cannot
138
255
  provide the native lock and receives a typed refusal rather than an unserialized fallback.
139
256
 
257
+ A persisted warm cache is checked before waiting for the cold-fill lock. Each Cargo resolution child and the
258
+ asynchronous wait for a foreign resolution lock have a 300-second bound. A refusal names the child or lock, the
259
+ workspace and elapsed bound; a timed-out child and its owned process group are killed. These bounds do not change the
260
+ native synchronous lock acquisition or Cargo's own package-cache arbitration.
261
+
140
262
  A plugin worker's normal exit, host disconnect, or handled termination kills Cargo children it still owns; on POSIX it
141
263
  kills the whole process group, including wrapper descendants. Standalone callers also forward unhandled termination
142
264
  signals to their owned groups. An uncatchable `SIGKILL` cannot run an exit hook; the kernel still releases its file
@@ -145,11 +267,67 @@ lock.
145
267
  The `@smoothbricks/nx-plugin:cargo-resolve` diagnostics channel reports `{ phase: "join", manifest }` when a caller
146
268
  joins an existing flight. With no subscribers, inference neither allocates nor publishes an event. The cache regressions
147
269
  use this readiness signal and Cargo control-channel events to prove concurrency and child teardown without sleep-based
148
- timing assumptions; their outer hang guards report still-open test spans and process/gate state.
270
+ timing assumptions; their outer hang guards report still-open test spans and process/gate state. The counted Cargo
271
+ fixture delegates to the command selected before its shim was installed, with that original search path. An installed
272
+ jobserver launcher remains in the chain; it must not rediscover the counted shim and recursively enter the broker. The
273
+ real-producer regression covers both counted metadata and forwarded workspace discovery, with one metadata child.
274
+
275
+ Keep workspace-owned runtime state outside Nx's source index. The root `.nxignore` ignores every dot path with `.*` and
276
+ re-includes each tracked dot input by its dot-named prefix, such as `!/.github` or `!/packages/lmao/.cargo`: a dot-named
277
+ directory must be re-included to reach its tracked children. Nx's watcher reads only the root `.gitignore` and
278
+ `.nxignore`, not nested ignore files or Git's `.git/info/exclude`. `tooling:lint-dot-inputs` is an additive lint
279
+ dependency, keyed on the tracked file inventory as well as ignore-file contents. It fails when a tracked dot path lacks
280
+ its `!/` line or Nx's ignore checker excludes it, so a newly tracked dot input cannot silently disappear into `.*`.
281
+ `nx-dot-input-policy.test.ts` guards native index and file-hash parity for existing tracked inputs, unchanged project
282
+ graphs across the policy cutover, and actual daemon graph-pass silence for `.icm*` stores and hidden Bun staging. The
283
+ `.nxignore` file itself intentionally has new bytes. A tracked dot edit still reaches the daemon's watcher and graph
284
+ recomputation. Watching daemon logs, plugin sockets or job records instead turns each graph computation into another
285
+ file event and another graph computation.
286
+
287
+ ### Runtime inputs
288
+
289
+ Every runtime input, inferred or declared, starts with `sh node_modules/@smoothbricks/nx-plugin/runtime-input.sh`.
290
+ Command-specific environment assignments follow the wrapper as `env NAME=value command ...`, so setup failures and
291
+ command failures use the same fail-closed path. For example:
292
+
293
+ ```json
294
+ { "runtime": "sh node_modules/@smoothbricks/nx-plugin/runtime-input.sh bun --version" }
295
+ ```
296
+
297
+ Nx 23.2.1 hashes a runtime input's stdout and stderr and ignores its exit status, so a failed input becomes a valid key:
298
+ its error text, one string for every history, toolchain or file it could not read, and a result cached under it is
299
+ replayed for all of them. The script keys on the command's stdout alone and turns a nonzero exit into an Nx error: it
300
+ ends stdout with the byte 0xFF, and Nx refuses output that is not UTF-8
301
+ (`invalid utf-8 sequence of 1 bytes from index N`, exit 1). Nx drops a runtime input's stderr, so a failure that only
302
+ wrote to stderr would be invisible. The wrapper retains each failure under the checkout's
303
+ `.runtime-input-failures/failure.XXXXXXXXXX/`, outside Nx's state and the temporary directory. These private records
304
+ survive `nx reset`, task-cache cleanup and temporary-directory retirement; they remain until the operator removes them.
305
+ The reliable diagnostic after a daemon or headless gate's decoder error is:
306
+
307
+ ```sh
308
+ cat .runtime-input-failures/*/report
309
+ ```
149
310
 
150
- Keep workspace-owned runtime state outside Nx's source index. In a cowshed workspace, the root `.nxignore` must include
151
- `.cowshed/`: Nx's watcher reads the root ignore files, not Git's `.git/info/exclude`. Watching the daemon's own log,
152
- plugin sockets or job records turns each graph computation into another file event and another graph computation.
311
+ Each readable `report` names the command, its indexed arguments, working directory, exit status and original stderr.
312
+ `argv` retains the exact NUL-delimited argument vector (including empty arguments), `stderr` retains the original bytes
313
+ (including trailing newlines), and `exit-status` retains the decimal status. The wrapper also attempts a stderr summary
314
+ naming the command and report path, and displays the report on `/dev/tty` when it can open a controlling terminal.
315
+ Neither display is guaranteed through Nx's daemon or a headless harness: rely on the retained report, not on Nx
316
+ forwarding stderr. A failed terminal write is retained in the record's `terminal-error`. Records can contain arguments
317
+ or stderr with credentials; keep them private and inspect before sharing. Evidence-storage errors name the problem and
318
+ the surviving stderr capture on stderr; they never remove the refusal byte or replace the command's status.
319
+
320
+ Successful commands still emit only their original stdout bytes, discard stderr and retain no failure record: no
321
+ evidence path, timestamp or diagnostic enters a successful key. `runtime-input.test.ts` compares that byte stream and
322
+ its hash with the previous success path, and plants a failure through real Nx (daemon and daemonless) to prove both
323
+ refusal and retained evidence.
324
+
325
+ An input that runs inside a cowshed workspace's sandboxed daemon gets the client's environment, a host shell's `HOME`
326
+ included, but not the client's filesystem view (cowshed `04_sandbox.md`). An input that reads the operator's home fails
327
+ there, so a runtime input reads only the checkout and its declared environment. A `git` command in one sets
328
+ `GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_NOSYSTEM=1`: the key is a function of the repository, not of the operator's git
329
+ configuration. Git reads the global ignore file (`~/.config/git/ignore`) even then, so `smoo-nx-cargo-hash`, whose git
330
+ queries decide which package sources the key covers, also passes `-c core.excludesFile=/dev/null`.
153
331
 
154
332
  ### Cargo source runtime inputs
155
333
 
@@ -158,7 +336,7 @@ For inferred Cargo targets in a repository-root Cargo workspace, declare the ext
158
336
  ```json
159
337
  {
160
338
  "namedInputs": {
161
- "externalRustCrates": [{ "runtime": "smoo-nx-cargo-hash" }]
339
+ "externalRustCrates": [{ "runtime": "sh node_modules/@smoothbricks/nx-plugin/runtime-input.sh smoo-nx-cargo-hash" }]
162
340
  }
163
341
  }
164
342
  ```
@@ -174,6 +352,14 @@ both the Nx and Cargo workspaces are left to the plugin's inferred file inputs.
174
352
  require maintaining a second list of source roots. The command refuses missing dependencies or an unavailable locked
175
353
  dependency cache instead of emitting a partial digest.
176
354
 
355
+ Each Cargo child and each acquisition of the cross-process resolve lock has a five-minute `CARGO_RESOLVE_BOUND_MS`
356
+ deadline. A warm content-keyed cache read takes no lock and spawns no child. A cold flight acquires the pinned Nx
357
+ binding's blocking kernel lock in one owned child; its parent kills and reaps that child if acquisition exceeds the
358
+ deadline. The named `CargoResolveLockError` reports the lock path, elapsed wait, bound and waiter pid (the holder pid is
359
+ unknown). A successful flight holds the lease until closing the child's stdin releases the lock and the child is reaped.
360
+ A timed-out Cargo command is killed, and resolution refuses instead of hanging graph construction or returning a stale
361
+ closure.
362
+
177
363
  ### Cargo closure input
178
364
 
179
365
  Custom Cargo targets that replace inferred inputs need the source closure of the crates they build. The plugin infers it
@@ -202,21 +388,46 @@ the other directories the hash command skips), target sources outside it, its go
202
388
  `Cargo.lock`. Nx hashes those from the file hashes it already keeps, so hashing these inputs starts no process. A graph
203
389
  with unchanged resolution inputs starts no Cargo process either.
204
390
 
391
+ Literal `include_str!` and `include_bytes!` files also belong to the closure, including data inside a crate and tracked
392
+ files outside its directory (such as a shipped Markdown skill). One Rust lexer excludes comments and example strings;
393
+ computed paths and arbitrary build-script reads still need explicit inputs. External path-package digests include the
394
+ same literal data bytes. Inferred `napi-*` and repository-root `cargo-wasm` builds use this resolved closure rather than
395
+ every Rust file in the workspace, while retaining their toolchain pins, wrapper scripts, N-API configuration and CLI
396
+ version.
397
+
398
+ Runtime file identities are rooted in Cargo package name/version and the declared input role, not in the consuming
399
+ checkout's absolute path or depth. Source paths are package-relative; compiled-in data keeps its declaring source and
400
+ literal path as its identity. Identical main/shed inputs therefore share a key, while changed bytes, module names and
401
+ symlink targets still move it. Shared bytes are read once, and all identities are sorted before hashing. The Cargo
402
+ resolution memo schema retains package names/versions; refreshing that memo does not reset the Nx task database.
403
+
205
404
  Members the file index cannot hold, outside the Nx workspace or under `node_modules`, are hashed by one runtime
206
405
  `smoo-nx-cargo-hash --closure <projectRoot> <Cargo.toml>` entry, present only while such members exist. Its cached
207
406
  resolution checks external manifests too, so a dependency introduced by an external manifest edit is still covered.
208
407
 
408
+ A runtime input that cannot be computed, whether from a manifest or locked dependency it cannot resolve or from
409
+ arguments it refuses, prints one fixed line (`cargo-input-unavailable`, `cargo-input-invalid-arguments`) and exits
410
+ nonzero, and `runtime-input.sh` turns that into an Nx error. Its stderr names the cause, Cargo's own message included,
411
+ with the checkout's absolute path written as a relative one and Cargo's timing-dependent lock-wait lines dropped;
412
+ refused arguments write nothing. The Cargo target, run by hand, still refuses the missing dependency or manifest with
413
+ Cargo's own cause. Only stdout supplies the cache-key result. Stderr retains the operational cause and may also contain
414
+ native-loader warnings; those diagnostics are not required to be byte-identical across checkouts.
415
+
209
416
  Cargo resolution failures (no `cargo` on PATH, a stale `Cargo.lock`, or an unavailable locked dependency) fail graph
210
417
  inference with `CargoMetadataError`, including the manifest path and Cargo's cause. A member inside the workspace
211
418
  missing from Nx's file index, or another closure Nx cannot express precisely, fails with `CargoClosureInputError`.
212
419
  Neither condition falls back to a whole-workspace runtime hash or silently reuses an older closure.
213
420
 
214
421
  Resolution therefore needs the packages `Cargo.lock` pins already in `CARGO_HOME`, before any task can run: the graph's
215
- own `cargo-fetch` target cannot supply them. The managed shell entry (`tooling/direnv/setup-environment.ts`) runs
216
- `cargo fetch --locked` for every project whose `Cargo.toml` declares `[workspace]`, once per change to that workspace's
217
- `Cargo.toml`, `Cargo.lock` or `.cargo/config[.toml]`, with its stamp in `CARGO_HOME/smoo-fetched`. In CI a failed fetch
218
- fails the shell; locally it prints Cargo's cause, loads the shell, and retries on the next entry, while graph inference
219
- keeps refusing with that same cause.
422
+ own `cargo-fetch` target cannot supply them. The managed shell's devenv task `smoo:cargo-fetch`
423
+ (`tooling/direnv/setup-environment.ts --cargo`, gated by its `--cargo --check` status) runs `cargo fetch --locked` for
424
+ every project whose `Cargo.toml` declares `[workspace]`, once per change to that workspace's `Cargo.toml`, `Cargo.lock`
425
+ or `.cargo/config[.toml]`. Its stamp lives in `$XDG_CACHE_HOME/smoo/cargo-fetched` (`~/.cache/smoo` when that is unset),
426
+ never in `CARGO_HOME`: a sandboxed shell may write only Cargo's own paths there. A stamp outside `CARGO_HOME` outlives
427
+ it, so the stamp also names the directory `CARGO_HOME` was when the fetch finished (device, inode and creation time): a
428
+ deleted and recreated `CARGO_HOME`, or another one, fetches again, while a copied checkout sharing the `CARGO_HOME` does
429
+ not. A failed fetch writes no stamp. In CI (`devenv tasks run`) a failed fetch fails; locally the task prints Cargo's
430
+ cause, the shell loads, and the next entry retries, while graph inference keeps refusing with that same cause.
220
431
 
221
432
  In-workspace members follow Nx's file semantics, which differ from the command's own walk in two places: a symlinked
222
433
  directory inside a package is not followed, and manifests and Cargo configuration above the Nx root (a
@@ -231,7 +442,9 @@ project declares its own named input and names its directory:
231
442
  {
232
443
  "namedInputs": {
233
444
  "cargoSources": [
234
- { "runtime": "smoo-nx-cargo-hash --include-workspace --closure packages/example" },
445
+ {
446
+ "runtime": "sh node_modules/@smoothbricks/nx-plugin/runtime-input.sh smoo-nx-cargo-hash --include-workspace --closure packages/example"
447
+ },
235
448
  "{workspaceRoot}/Cargo.lock",
236
449
  "{workspaceRoot}/devenv.lock",
237
450
  "{workspaceRoot}/tooling/direnv/devenv.lock"
@@ -270,6 +483,11 @@ them by field instead: a `json` input with `excludeFields` for `package.json#ver
270
483
  this costs no process. Everything else still counts: a dependency range, an export map, and the lockfile's resolution
271
484
  table.
272
485
 
486
+ The workspace root manifest also drops `scripts`, `smoo` and `nx` from these three targets' hash. No check reads them:
487
+ scripts are commands a developer runs, `smoo.developerLinks` names links whose linked bytes reach a hash only through
488
+ their own inputs, and the root project's `nx` configuration is hashed as that project's configuration. Hashing them made
489
+ a root `postinstall` or developer-link edit re-key every lint and typecheck in the workspace.
490
+
273
491
  Crate manifests are the one kind Nx cannot hash by field, because TOML has no such input. The plugin hashes them itself,
274
492
  in the process that builds the graph and is already reading them: a single forward scan over the bytes feeds the hasher
275
493
  every run it keeps, dropping `[package].version` and the `[workspace.package].version` members inherit and nothing else
@@ -301,6 +519,76 @@ installed. Every fallback costs cache hits and never trades away invalidation, b
301
519
  reporting a failing one — a fileset that excluded a manifest with no digest replacing it would serve stale results
302
520
  silently.
303
521
 
522
+ ## Cowshed Build-State Output Policy
523
+
524
+ Consuming repositories enforce build-volume safety in their Nx lint, using the graph that lint already resolved:
525
+ `refuseOutputsUnderBuildState(graph, buildState.paths, workspaceRoot)` from
526
+ `@smoothbricks/nx-plugin/build-state-output-policy`. Obtain `buildState` from `cowshed build-state --json` in that
527
+ checkout; no graph is constructed by cowshed job admission or doctor.
528
+
529
+ The validator uses Nx output interpolation for every target and configuration, including resolved project overrides. It
530
+ refuses outputs at, beneath, or above a contributed path, and globs whose static prefix can cover one. Absolute outputs
531
+ are resolved against the caller's workspace root. `BuildStateOutputError.findings` names each project, target,
532
+ configuration, output, and contributed path. Keep cacheable artifacts under source-tree paths such as `dist/` and
533
+ `.cache/nextest/`; restoring an output under `target/` or `.nx/` can replace a build-volume link with a real directory.
534
+
535
+ ## Test Walk Policy
536
+
537
+ A test pays its setup once and asserts after each step; two cases that test one path are one test. Consuming
538
+ repositories enforce this in their root Nx lint with the `smoo-nx-test-walks` bin. The bin judges only pairs with a case
539
+ changed since the upstream merge base. Among those pairs it reports each case's nearest refusing partner and its nearest
540
+ advisory partner separately, so an advisory pair never hides a refusal. Existing pairs therefore need no allowance
541
+ table. `smoo-nx-test-walks --base` prints that base for the target's runtime input, because the verdict depends on it
542
+ and no file hash names it. `upstreamBase` picks the upstream in this order: `NX_BASE` (refused when it names no commit),
543
+ `refs/remotes/main/main`, the local main's upstream branch, `refs/remotes/origin/main`, then `main`.
544
+ `findDuplicateScenarios(root, files, changes)`, `formatDuplicateScenario`, `diffScope` and `upstreamBase` are exported
545
+ from `@smoothbricks/nx-plugin/test-walk-policy`, and git failures come back as `GitAnswer` values.
546
+
547
+ The policy reads bun:test `test`/`it` cases in test files and `#[test]`-family fns in any Rust file. A body that is one
548
+ wrapper call, `await withHarness(memoryBackend, async (h) => { … })` or `runtime().block_on(async { … })`, walks the
549
+ call itself as its first step, with its body replaced by `$body`. It then walks the wrapper's statements, so a different
550
+ backend or runtime still tells two cases apart. A case's identity is part of the comparison, and only cases of one
551
+ identity are compared. Identity covers `test.failing` in TypeScript, and `#[should_panic]`, `#[ignore]`, `#[cfg(…)]` and
552
+ `#[cfg_attr(…)]` in Rust. It also covers the `before*`/`after*` hooks and the declarations of the enclosing `describe`
553
+ chain.
554
+
555
+ Each top-level statement of a case body is normalized several ways:
556
+
557
+ - `exact` renames the names the case declares to their declaration index.
558
+ - `shape` also abstracts every literal.
559
+ - `skeleton` also collapses the declared names.
560
+ - `flow` is `exact` with the declared names collapsed.
561
+
562
+ Field, method, key, struct-literal key, tuple-index and path names are never renamed. A pure assertion reads only what
563
+ earlier steps built. It is one of:
564
+
565
+ - an `expect`/`assert…` call that calls only methods and runs no closure, constructor, rejection or throw matcher;
566
+ - an `if (…) throw` guard;
567
+ - an `assert*!` that borrows nothing mutably and calls no method on a `let mut` local.
568
+
569
+ Whether a method reads or acts is not statically decidable. A method that acts inside an assertion, such as
570
+ `expect(await queue.drain())`, is treated as a read, and review decides. `TEST-ONE-WALK` refuses two shapes with
571
+ `error[TEST-ONE-WALK]` (exit 1):
572
+
573
+ - **same-path:** the cases share at least two leading statements exactly, and one of them only purely asserts beyond
574
+ them. Move its assertions into the other walk at the statement the diagnostic names.
575
+ - **literal-twin:** two or more statements equal once literals are abstracted; identical bodies are reported as verbatim
576
+ repeats. Make one table or property over the values. Keep each original case's label in its table row and include it
577
+ in assertion diagnostics; when rows need different numbers of checks, store all expected values per row and assert
578
+ every one in the common walk.
579
+
580
+ It advises on a third with `warning[TEST-ONE-WALK]`, which never fails the run. The warning is for the writer and the
581
+ reviewer, who decide whether the variants share one walk:
582
+
583
+ - **same-scenario:** one case's skeleton is the other's head (at least one statement) and tail around exactly one
584
+ statement of its own. The tail is the action and its outcome: at least three statements equal in flow, with at least
585
+ one action among them. The injected step differs, for example which crash window or precondition. Extra trailing pure
586
+ assertions on either side are more checks on the same outcome. Its precision is too low to refuse. Walk the variants
587
+ over one fixture, or make one table over the injected step.
588
+
589
+ A separate case stays only for a distinct boundary or edge: its setup or path diverges, or it needs a state the walk's
590
+ earlier steps destroy. Each diagnostic names the file, both cases, the shared statement count and that remedy.
591
+
304
592
  ## Nx Target Naming
305
593
 
306
594
  Target names are `{tool}-{output}` names. Use names like `tsc-js`, `tsdown-js`, and `cargo-wasm`; `build` and `lint` are
@@ -311,58 +599,117 @@ Concrete targets come from concrete files:
311
599
  - `tsc-js` emits transformed JavaScript through a temporary JS-only `ttsc` config, restores execute bits on outputs
312
600
  declared by `package.json#bin`, then emits declarations and declaration maps from the original project with native
313
601
  `tsc`. Direct project references and every cached output lane are preserved.
314
- - `typecheck` is inferred from `tsconfig.lib.json` and runs native `tsc -p tsconfig.lib.json --noEmit`.
315
- - `typecheck-tests` is inferred from `tsconfig.test.json` and runs `tsc -p tsconfig.test.json --noEmit`. It first
316
- rebuilds the current package's `tsc-js` output (or its non-TypeScript `build`) so self-imports resolve after `clean`.
602
+ - `typecheck` is inferred from `tsconfig.lib.json` and runs the native compiler `SMOO_TYPECHECK_TSC` names (built by
603
+ `devenv.smoo.nix` from a pinned TypeScript revision) as `-p tsconfig.lib.json --noEmit`, directly rather than through
604
+ `ttsc`. Transform plugins' diagnostics are enforced by `tsc-js`, which runs them.
605
+ - `typecheck-tests` is inferred from `tsconfig.test.json` and runs the same compiler on
606
+ `-p tsconfig.test.json --noEmit`. It first rebuilds the current package's `tsc-js` output (or its non-TypeScript
607
+ `build`) so self-imports resolve after `clean`. Transform calls in test files are checked when the test runner
608
+ transforms them.
317
609
  - `typecheck-tests:watch` is inferred from `tsconfig.test.json` and runs the same typecheck in watch mode.
318
610
  - `test-watch` is inferred when the package already defines an explicit Bun or Vitest `test` command. The plugin derives
319
611
  the corresponding watch command and makes it depend on `typecheck-tests`.
320
612
  - A workspace-root `Cargo.toml` provides `cargo-test`, `test`, `cargo-lint`, `mutation`, and `bench`.
321
613
  `cargo-test-compile` warms one workspace `cargo test --no-run`. `cargo-test-archive` runs one
322
- `cargo --frozen nextest archive --workspace` into `target/nextest/archive.tar.zst` and is the only cached cargo BUILD:
323
- it produces a file rather than a mutable build tree. Its inputs, like every cargo-derived fileset, are anchored at
324
- `{workspaceRoot}`: Nx resolves a `{projectRoot}` glob against only the files its project owns, and a nested package
325
- owns the crates under it, so a root workspace's archive spelled that way hashes none of its members and replays stale
326
- binaries against edited crates. Each member crate gets a cached `cargo-test-<package>` run (30s per-test timeout like
327
- `bun test --timeout=30000`) whose inputs include that crate and its path dependencies, and whose command runs
614
+ `cargo --frozen nextest archive --workspace` into `.cache/nextest/archive.tar.zst` and is the only cached cargo BUILD:
615
+ it produces a file outside the build-volume links rather than a mutable build tree. Nx cache restoration must never
616
+ replace Cargo's `target` link. Its inputs, like every cargo-derived fileset, are anchored at `{workspaceRoot}`: Nx
617
+ resolves a `{projectRoot}` glob against only the files its project owns, and a nested package owns the crates under
618
+ it, so a root workspace's archive spelled that way hashes none of its members and replays stale binaries against
619
+ edited crates. Each member crate gets a cached `cargo-test-<package>` run (30s slow-test warning like
620
+ `bun test --timeout=30000`, no per-test kill) whose inputs include that crate and its path dependencies, and whose
621
+ command runs
328
622
  `cargo --frozen nextest run --binaries-metadata … --cargo-metadata … --target-dir-remap … --workspace-remap . -E 'package(<crate>)'`
329
- from the archive's one extraction. Runners therefore execute rather than build: they write nothing to cargo's build
623
+ from the archive's one extraction. Runners therefore execute rather than build: they compile nothing in cargo's build
330
624
  tree, and fan out instead of chaining. They do not unpack the archive each: before the run, `smoo-nx-nextest-extract`
331
- hashes it and extracts it into `target/nextest/archive.tar.zst.extracted/<sha256>` unless a runner already did — one
625
+ hashes it and extracts it into `<target_directory>/nextest-extracted/<sha256>` unless a runner already did — one
332
626
  extracts, the others wait — so a workspace with ~200 test binaries and ~25 crates unpacks them once per archive
333
627
  instead of once per crate. The directory is keyed by the archive's bytes, so a rebuilt or cache-restored archive never
334
- runs an older extraction's binaries, and publishing one removes the others; it is never an Nx output.
335
- `--workspace-remap` is required — an archive records the producing tree's absolute paths, and without it a restored
336
- archive hands tests another checkout's `CARGO_MANIFEST_DIR`. With it the archive is relocatable, so one cache entry
337
- serves every checkout of the same commit; nextest re-points `CARGO_BIN_EXE_<name>`/`NEXTEST_BIN_EXE_<name>` at the
338
- extracted binaries at runtime, but a test that reads them through the compile-time `env!` macro keeps the producing
339
- tree's path. Per-crate runners accept an empty nextest selection because a valid workspace member may have no tests
340
- and a hash partition may legitimately be empty. A crate in the project that builds the debug cdylib runs after
341
- `napi-debug`, because its tests load that addon from `target/debug`. A crate declaring
342
- `[package.metadata.smoothbricks.wasm-bindgen]` also receives the cacheable `cargo-wasm` output target in its owning
343
- project.
344
- - The plugin's own `nextest.toml` is passed as `--tool-config-file "smoo:$PWD/<path>"`, so it is a layer BENEATH the
345
- repository's `<cargo-workspace>/.config/nextest.toml` rather than a replacement for it: a repository can raise a
346
- timeout or declare `archive.include` for a cdylib or fixture the archived test binaries need, and its settings win.
347
- That file is an input of both the archive and every runner, so changing it invalidates the verdicts it governs. `$PWD`
348
- keeps the command text identical across checkouts while satisfying nextest's requirement that a tool config path be
349
- absolute; `--user-config-file none` still holds, because a developer's `~/.config/nextest` must not decide a cached
350
- verdict.
351
- - A crate whose suite outgrows one bounded window declares `[package.metadata.smoothbricks.test] shards = N`, and gets
352
- `cargo-test-<package>-shard1..N`, each running `--partition hash:i/N` with the full bound. nextest assigns a test to a
353
- shard by hashing its name, so the shards stay an exact partition of the crate as tests and test binaries are added,
354
- and a stale `N` can only make a target slow — never drop a test. Omitting the key means one target, as before.
628
+ runs an older extraction's binaries, and publishing one removes the others. The target directory is the one
629
+ `cargo metadata` reports for the runner's Cargo workspace, so a `build.target-dir` setting moves the extractions with
630
+ the build tree. An extraction is per-checkout tool state like the rest of that tree, never an Nx output: it lives in
631
+ Cargo's build tree, which a checkout with a build volume keeps off its source tree, and it never sits under a declared
632
+ output such as `.cache/nextest`. `cargo clean` removes it. `--workspace-remap` is required — an archive records the
633
+ producing tree's absolute paths, and without it a restored archive hands tests another checkout's
634
+ `CARGO_MANIFEST_DIR`. With it the archive is relocatable, so one cache entry serves every checkout of the same commit;
635
+ nextest re-points `CARGO_BIN_EXE_<name>`/`NEXTEST_BIN_EXE_<name>` at the extracted binaries at runtime, but a test
636
+ that reads them through the compile-time `env!` macro keeps the producing tree's path. Per-crate runners accept an
637
+ empty nextest selection because a valid workspace member may have no tests and a hash partition may legitimately be
638
+ empty. A crate in the project that builds the debug cdylib runs after `napi-debug`, because its tests load that addon
639
+ from `target/debug`. A crate declaring `[package.metadata.smoothbricks.wasm-bindgen]` also receives the cacheable
640
+ `cargo-wasm` output target in its owning project.
641
+ - The plugin's own `nextest.toml` is passed as
642
+ `--tool-config-file "smoo:$PWD/<to workspace root>/node_modules/@smoothbricks/nx-plugin/nextest.toml"`, so it is a
643
+ layer BENEATH the repository's `<cargo-workspace>/.config/nextest.toml` rather than a replacement for it: a repository
644
+ can raise a timeout or declare `archive.include` for a cdylib or fixture the archived test binaries need, and its
645
+ settings win. That file is an input of both the archive and every runner, so changing it invalidates the verdicts it
646
+ governs. `$PWD` keeps the command text identical across checkouts while satisfying nextest's requirement that a tool
647
+ config path be absolute, and naming the file through the workspace root's `node_modules` link — never the plugin's
648
+ real location — keeps it identical for a plugin linked from a checkout outside the workspace, whatever depth each
649
+ workspace sits at; `--user-config-file none` still holds, because a developer's `~/.config/nextest` must not decide a
650
+ cached verdict. Runtime hash inputs use that same workspace-relative installed path, never the physical plugin
651
+ checkout. Both the runtime output and the owning target's command declaration therefore remain portable.
652
+ - A crate whose suite is better spread over several runners declares `[package.metadata.smoothbricks.test] shards = N`,
653
+ and gets `cargo-test-<package>-shard1..N`, each running `--partition hash:i/N` under the same progress bound. nextest
654
+ assigns a test to a shard by hashing its name, so the shards stay an exact partition of the crate as tests and test
655
+ binaries are added, and a stale `N` can only make a target slow — never drop a test. Omitting the key means one
656
+ target, as before.
355
657
  - Tests that a `nextest.toml` override singles out run separately in `cargo-test-<package>-exceptions-shard1..N`, using
356
- the same declared partition count. Ordinary shards run the complement, so the union still covers every test exactly
357
- once. The plugin's own overrides raise `slow-timeout` for compile-fail tests and for the real-APFS full-lifecycle
358
- tests; lifting them out keeps their raised bound from delaying an ordinary shard, and partitioning the class keeps
359
- every target inside its deadline without relaxing it. Exceptional shards are scheduled like the ordinary ones: nothing
360
- is exclusive, and isolation between concurrent real-APFS fixtures is the production backend's per-image lease, not Nx
361
- scheduling. The exceptional filter is derived from the overrides in `nextest.toml`, so adding an override is the whole
362
- classification change. Only sharded crates need these targets; an unsharded crate already runs its whole suite in one
363
- process. Empty partitions pass, including platforms where the tests are `cfg`-ed out. `nextest-partitions.test.ts`
364
- executes the inferred archive and shard commands over 26 tests and asserts that the ordinary shards ran exactly the 13
365
- ordinary tests once and the exceptional shards exactly the 13 exceptional ones.
658
+ the same declared partition count. Ordinary shards run the complement of that class and of every declared serial group
659
+ (below), so the union still covers every test exactly once. The plugin's own override raises the `slow-timeout`
660
+ warning period for compile-fail tests; lifting them out keeps their long bodies from delaying an ordinary shard, and
661
+ partitioning the class keeps every target inside its progress bound without relaxing it. The remaining non-group
662
+ exceptional tests stay normally schedulable. Every piece runs `--no-fail-fast`, so a failing test does not stop the
663
+ rest of its piece. The exceptional filter is the union of the overrides in the plugin's own `nextest.toml`, so adding
664
+ one there is the whole change to that class. Serial groups are classified separately, by `test-group` overrides in the
665
+ workspace's `.config/nextest.toml`; the plugin's file declares none. Only sharded crates need these targets; an
666
+ unsharded crate already runs all its non-group tests in one process. Empty partitions pass, including platforms where
667
+ the tests are `cfg`-ed out. `nextest-partitions.test.ts` executes the inferred archive and shard commands over 29
668
+ tests and asserts that the ordinary shards ran exactly the 13 ordinary tests once and the exceptional shards exactly
669
+ the 12 exceptional ones. The suite builds one shared fixture and archive, then runs separate bounded cases through the
670
+ real default serial-group executor: a successful count and run with the group's probes exactly once each, three
671
+ refusals that run nothing and clear the task's previous verdict, and a failing run whose ordinary failures still run
672
+ the group's remaining probes. The shared fixture first produces one real passing verdict, before any case runs. Each
673
+ refusal copies that seed and removes its own marker log, so neither a timed-out success case nor a prior refusal that
674
+ wrongly ran can become another case's precondition. The success case still runs and verifies the real executor
675
+ independently. Drivers run the built production Node executor, supplied by the test target's build dependency, rather
676
+ than starting a native TypeScript compiler for every case inside the shard's progress bound. Each case settles its
677
+ owned processes before the next case starts; the fixture is removed only after the final settlement.
678
+ - A repository's serial test groups each run in one runner, `cargo-test-group-<group>`, owned by the cargo workspace
679
+ root beside `cargo-test-archive`. A group is declared once, in `<cargo-workspace>/.config/nextest.toml`: a
680
+ `[test-groups.<group>]` table with `max-threads = 1`, and default-profile overrides that name it with `test-group` and
681
+ `platform = 'cfg(target_os="macos")'`. The runner's filter is the union of those overrides, so the runner and the
682
+ per-crate exclusions cannot drift; every crate piece excludes it with `not (…)`, so each test is selected by exactly
683
+ one target. The runner is not inferred off macOS, where nextest applies the group nowhere and no piece excludes its
684
+ tests. It is a `bounded-exec` run of the group's selection under the same progress bound as every test target, and
685
+ asks for one CPU token, matching the group's one runnable test process instead of reserving idle host capacity. The
686
+ run carries `--no-fail-fast`: an ordinary test failure does not stop the group's remaining tests, and a failed verdict
687
+ lists the failed ones. It carries `--no-tests=fail`, so a filter that selects no test fails the group. Ignored tests
688
+ keep their explicit lane. A crate named `group-*` is refused, since its runner name would collide. A repository's
689
+ serial group may measure each test's code time against a class with a nextest run-wrapper from the plugin's source
690
+ (`src/nextest-code-bound.ts`), which warns of a test over its class and never fails or kills it; the group's target
691
+ hashes that file as an input, so changing it reruns the group (`specs/cowshed/08_testing.md`, "Integration tests (real
692
+ substrate)").
693
+ - `cargo-test` is the ordinary suite alone: it depends on the crate pieces and never on a serial group, so a run of it
694
+ never reaches a group's real-image tests. The inferred `test` of the cargo workspace root and of every project that
695
+ owns crates depends on `cargo-test` alone. Explicit repository config owns host coverage: this repository's root
696
+ `host-e2e` depends on both real-APFS groups, and `gate` depends on `host-e2e` plus every project's `lint`, `test` and
697
+ `build`. `nx run-many -t gate` therefore covers the host boundary without pulling it into ordinary `test`; each group
698
+ replays from cache unless its own inputs changed.
699
+ - A group's runner hashes only the crates its filter can select tests from, with everything they link, every member
700
+ manifest and the repository's nextest config, so a change to an unrelated crate leaves it cached. The filter is read
701
+ as nextest reads it (its precedence, blanks and predicate arguments; `filterScope`): a plain `package(<name>)` or
702
+ `package(=<name>)` bounds a clause to that package, `and`, `&` and `-` keep the narrower side or the left side, and
703
+ `or`, `|` and `+` take every clause. Anything that bounds nothing scopes the group to every member, as the archive is
704
+ hashed: a clause with no package, a glob, substring or regex name, `not`, `deps` or `rdeps`, an argument with a
705
+ backslash or a comma, a filter nextest refuses, or packages that exclude each other. A scope that names a package
706
+ which is not a member of the Cargo workspace is refused when the graph is built.
707
+ - Inference orders nothing between two serial groups: each is serial only within its own runner. A repository that needs
708
+ two never concurrent states the edge as explicit target config, `"dependsOn": ["...", "cargo-test-group-<other>"]`
709
+ under `nx.json` `targetDefaults` or the owning project's `nx.targets`, and Nx starts the later group once the earlier
710
+ one has finished. Explicit target declarations are not platform-conditional: dependency-only target nodes and their
711
+ ordering edges remain off macOS even though no executable group runner is inferred. The ordinary `test` and
712
+ `cargo-test` aggregates must still reach neither group.
366
713
  - Canonical `napi` package metadata provides a host `cargo-napi` target and named release targets for each configured
367
714
  triple. Linux `--use-napi-cross` targets compile C/C++ dependencies with Clang; the NAPI CLI supplies its downloaded
368
715
  GNU sysroot and toolchain flags. This avoids the bundled GCC's unsupported diagnostics-color flag without disabling
@@ -428,15 +775,28 @@ the tasks it aggregates answer in its place, and any outputs it declares are ver
428
775
  uncacheable task is a miss on every call, because only running it can say whether its side effects are current.
429
776
 
430
777
  The probe and runner use the workspace's installed Nx and its normal cache configuration. A build performed by the Nx
431
- CLI can satisfy the next wrapper invocation without re-executing tasks; changed inputs still go through Nx's runner.
778
+ CLI can satisfy the next wrapper invocation without re-executing tasks; uncached current inputs go through Nx's runner.
432
779
  Both invocations must use the same cache location. Relative `NX_CACHE_DIRECTORY` and `NX_WORKSPACE_DATA_DIRECTORY`
433
780
  values resolve against the Nx workspace root, so they remain checkout-local when inherited by another shell. Absolute
434
781
  paths remain caller-controlled, including deliberately shared CI locations; an absolute path inherited from another
435
782
  checkout does not become local merely because the working directory changed.
436
783
 
437
- Before hashing, it compares a native snapshot of the workspace with the daemon's file table. A write the daemon's
438
- watcher has not delivered yet counts as a miss unless every changed path is a declared output of a task in the graph, so
439
- a build's own artifacts never turn the next call noisy, and an edit made moments before the call never hits stale.
784
+ Before hashing, it compares a fresh native workspace snapshot with the daemon's file table and sends writes the watcher
785
+ has not delivered. It can reuse the exact previously awaited daemon graph only through a witness in the same Nx
786
+ workspace-data directory: filesystem-to-daemon reconciliation, an awaited authoritative graph generation, and identical
787
+ pre/post native file hashes and membership establish the witness. Every new or changed node is rehashed through Nx,
788
+ using device, inode, mode, length and nanosecond modification/change times to reject the native archive's whole-second
789
+ mtime ambiguity. The witness also binds the environment and installed Nx/configured plugin package resolution and owned
790
+ dependency-module/file closure (physical targets, aliases, package manifests and public outputs), plus the
791
+ workspace-resolved TypeScript analyzer. A package-declared dist directory link is proved by its physical tree, including
792
+ every node and the link itself; unreadable required module bytes fail loudly. Unknown plugin input contracts, unresolved
793
+ required packages, directory links whose external graph inputs are unproved, missing or unreadable witnesses, and any
794
+ mismatch require the authoritative graph RPC. An RPC need not publish a replacement witness when its required pre/post
795
+ evidence is unavailable or changed. No cache-file age or existence decides currentness. Workspace file membership,
796
+ nx.json, project/package manifests and lockfiles have no output exclusions; output writes can therefore refresh this
797
+ conservative graph witness too. Only Nx's current task hashes and matching artifacts decide whether anything runs: an
798
+ unrelated edit does not force cached-log replay, and an actual input edit cannot hit an old source snapshot. Argument
799
+ normalization, per-task environments and plugin pre/post hooks still run.
440
800
 
441
801
  The daemon's output records are lossy: they are held in memory, tracked per collapsed directory, and erased by writes it
442
802
  processes more than two seconds late — including, on a busy daemon, a restore's own writes. When it cannot vouch for a
@@ -446,6 +806,45 @@ text (never followed), file permission bits and bytes. A tree the restore would
446
806
  daemon's record is re-armed as Nx's runner does after a restore. A missing or empty artifact, any difference, a read
447
807
  error, or a write observed during the comparison is a miss.
448
808
 
809
+ A successful byte comparison may retain a cache-bound node inventory in that same Nx workspace-data directory. It binds
810
+ the exact task hashes, declared outputs and artifact paths to every compared working-tree/cache node and both sets of
811
+ real parent directories. Reuse requires the same device, inode, type/permission mode, length and nanosecond mtime/ctime
812
+ for all those nodes. It is evidence of the same previously compared bytes, never source identity or an mtime freshness
813
+ rule. Missing/unreadable evidence or moved nodes require a full comparison; mutations to either the cache or working
814
+ tree, parent symlink replacement, and directory membership changes cannot borrow an old equality verdict.
815
+
816
+ `probeBuilt({ target, cwd })` is the distinct typed read-only provider operation. It returns `EnsureBuiltProbeResult`: a
817
+ `miss` with its `MissReason` without starting Nx's runner or writing producer outputs; the existing operational socket
818
+ failure; a loud `provider-proof` failure; or a `hit` with `EnsureBuiltReceipt`. `ensureBuilt` is build/stream-only and
819
+ its CLI callers retain the existing hit/built/failed result. With the daemon disabled, `probeBuilt` returns a no-daemon
820
+ miss instead of running the target. Both operations preserve Nx argument normalization, hooks, per-task environments and
821
+ local cache parity; the read-only operation additionally requires exact-cache artifact equality. A managed consumer
822
+ requires the installed module's `probeBuilt` function before making any producer call; a missing operation refuses
823
+ loudly without falling back to `ensureBuilt` or writing provider outputs.
824
+
825
+ A probe receipt names the real provider workspace, Git HEAD and HEAD's tree, every task id/current Nx hash in the
826
+ selected target's dependency graph, and an independently read census of every Nx-expanded public output. Files carry
827
+ SHA-256; symlinks carry their text and mode without following them; directories carry mode, ordered membership and a
828
+ child-census digest, including empty directories. Source/revision/output nodes must remain unchanged across capture.
829
+ Missing, unreadable or stale output evidence refuses, never starts a build and never signs daemon-state identity.
830
+
831
+ Git provenance covers Nx's planned FILE inputs and the owning project/dependency manifests and root graph configuration.
832
+ Dirty matched inputs (including new or index-only changes) refuse. The native inspector cannot prove deleted membership
833
+ or a custom hasher's opaque reads: a deleted provider source or a bounded runtime/env input therefore uses conservative
834
+ any-dirty-provider-source refusal, excluding public outputs rather than treating them as committed source. Runtime/env
835
+ values remain explicitly labelled `nx-task-hash-only`, not Git provenance. Only the existing toolchain generator's exact
836
+ version-only recipe with declared cwd, a declared toolchain FILE pin and proved installed-module closure is bounded;
837
+ arbitrary shell/file/runtime commands and unavailable custom/native input proofs categorically refuse receipts. A caller
838
+ probing multiple targets uses the existing single-target API and rejects differing provider HEAD/tree identities before
839
+ publishing its immutable snapshot. This producer evidence binds a managed linked-package snapshot to one current build;
840
+ Nx alone decides whether its current keys and cache/output bytes match. A caller from another workspace never lends its
841
+ socket, database or cache overrides to the provider. Inside a managed shell (`DEVENV_RUNTIME`), `ensureBuilt` asks the
842
+ packaged `nx-socket-dir.sh` owner for the provider's binding: the root's verified cowshed runtime link when present,
843
+ otherwise its canonical checkout spelling under that shell runtime. Outside a managed shell, Nx retains its normal
844
+ defaults. A socket-owner refusal returns `disposition: 'failed'` with `reason.kind: 'workspace-socket'`, the selected
845
+ `taskId`, `workspaceRoot` and operational `detail`, before any task or daemon client starts. The owner's actual exit or
846
+ signal is preserved; the wrapper must not report that the target ran.
847
+
449
848
  ```typescript
450
849
  import { ensureBuilt } from '@smoothbricks/nx-plugin/ensure-built';
451
850
 
@@ -466,7 +865,8 @@ smoo-nx-exec my-cli:build -- ./packages/my-cli/dist/my-cli argument
466
865
 
467
866
  It is deliberately not `nx run <target> && exec`:
468
867
 
469
- - A hit costs one daemon round-trip and a local cache read, not an Nx CLI start.
868
+ - An unchanged witnessed graph avoids graph reconstruction/transfer; current task hashing, daemon file/output probes and
869
+ local cache reads remain. This is not a measured end-to-end latency guarantee and does not start an Nx CLI.
470
870
  - A hit is silent. `nx run` replays the cached log and prints its `[local cache]` banner, which a CLI wrapper must not
471
871
  print.
472
872
  - It execs the binary, preserving its argv, exit status, and signals. `nx run` has no notion of handing the process over
@@ -496,20 +896,40 @@ stderr.
496
896
 
497
897
  ## Nx 23.2.1 Runtime Patch
498
898
 
499
- The repository installs Nx 23.2.1 with [`patches/nx@23.2.1.patch`](../../patches/nx@23.2.1.patch) applied, from an
500
- immutable release tarball: the root `package.json` keeps `devDependencies.nx` at `23.2.1` and sets `overrides.nx` to the
501
- release asset's URL, and `bun.lock` pins its sha512. `tooling/patched-nx.ts` builds the tarball reproducibly from the
502
- registry tarball and the patch; the `Patched Nx` workflow publishes it once from `main`, under a tag named for the
503
- uncompressed tar's sha256, and verifies the served asset on every later run. A tarball, unlike a `patchedDependencies`
504
- entry, stays in Bun's read-only global store (`~/.bun/install/cache/links`), so a sandbox can run Nx without being able
505
- to write it.
899
+ The repository installs Nx 23.2.1 as an ordinary Bun `patchedDependencies` entry: the root `package.json` lists
900
+ `nx@23.2.1` and `@nx/js@23.2.1`, and applies [`patches/nx@23.2.1.patch`](../../patches/nx@23.2.1.patch) to the registry
901
+ `nx` package. Bun installs a patched package project-local under `node_modules/.bun/`, so the `nx` the repository runs
902
+ is the patched one.
506
903
 
507
904
  `@nx/js` imports `nx` (`nx/release`, `nx/src/…`) without declaring it
508
- ([nrwl/nx#34087](https://github.com/nrwl/nx/issues/34087)), and a global-store entry links only declared dependencies,
509
- so `@nx/js` in that store cannot find Nx: its version actions, and this plugin's that extend them, would fail.
510
- `patches/@nx%2Fjs@23.2.1.patch` declares the peer. Being patched, `@nx/js` installs project-local under
511
- `node_modules/.bun/`, where `nx` resolves through the hoisted `node_modules/.bun/node_modules/nx` link to the same
512
- tarball entry; Bun's lock still records only the registry peers, so the placement is what makes the import resolve.
905
+ ([nrwl/nx#34087](https://github.com/nrwl/nx/issues/34087)). `patches/@nx%2Fjs@23.2.1.patch` declares the peer, so Bun
906
+ binds the same pinned Nx through the package's normal dependency namespace.
907
+
908
+ Native APFS fixtures install this same pinned package and patch offline into their own checkout, using Bun's local
909
+ cache, and report each installation's elapsed time. They do not borrow another checkout's `node_modules`: a patched
910
+ package's dependency links can traverse lexical `.bun` symlinks outside an explicit sandbox read grant even when the
911
+ resolved payload is granted. The workspace's own read authority covers those local links; only shared dependency
912
+ payloads receive additional bounded store grants. Grants are derived from the fixture's installed package namespace, not
913
+ the repository's different private patched namespace. Installation runs once per suite template, which fixtures clone.
914
+ Installer-restoration witnesses clone that real installed product into `packages/nx` of a distinct private developer
915
+ checkout, outside every consumer `node_modules`. Its root declares `workspaces: ["packages/nx"]` and the dependency
916
+ `nx: "workspace:*"`, following the ordinary in-repo workspace binding pattern. Pinned offline Bun produces that root's
917
+ lock and production namespace; no hand-made self alias substitutes for the install. The unchanged Nx CLI's global
918
+ resolution must resolve `nx/bin/nx.js` from that producer-owned checkout, not from `/private/tmp`. Ordinary pinned Bun
919
+ first generates this package's own lock offline with the existing `--lockfile-only` producer, then installs its
920
+ manifest-owned production dependencies offline into its own `node_modules`, without changing its manifest or maintained
921
+ program bytes. The fixture records the actual install, lock and product digests. The process launcher keeps `PWD` equal
922
+ to its actual `current_dir`, as the supervisor launcher does; the fixture observes Bun's real root before installation
923
+ and requires the lock at that root. Production mode implies a frozen lock and does not write a missing one, so a
924
+ production-only run is not lock-production evidence. Private lexical dependency aliases therefore stay inside the owned
925
+ developer checkout; reached namespaces and canonical shared targets use the same single closure traversal, bounded by
926
+ the exact caller-owned developer checkout and the actual shared store. Only reached package and namespace paths become
927
+ grants, never the whole checkout or `.bun` root. Traversal deduplicates exact package identities, not read-grant
928
+ prefixes: a covered local `@nx` scope can still contain a binding to the pinned native platform package in the shared
929
+ store. A normal Bun store entry is never presented as a developer binding. Local file providers are checkout-relative
930
+ directories that travel with the clone.
931
+ Foreign-daemon retirement witnesses retain the daemon's own standalone root, state and short socket throughout the
932
+ landing; its actual produced record is only a nomination, and its owner performs cleanup after the identity proof.
513
933
 
514
934
  The Nx patch repairs upstream Nx runtime behavior, separately from this plugin's workspace-owner checks:
515
935
 
@@ -517,10 +937,17 @@ The Nx patch repairs upstream Nx runtime behavior, separately from this plugin's
517
937
  daemon can have frozen a different database namespace before a later client supplies workspace-data overrides. The
518
938
  patch removes the obsolete history RPCs and retains native errors, including post-run failures. See
519
939
  [upstream Nx #37268](https://github.com/nrwl/nx/pull/37268).
940
+ - **A raw-input query resolves only its requested task's plan.** Nx still builds the full dependency graph to plan
941
+ dependent outputs, but does not walk every producer's own inputs and then discard those results. The plural inspector
942
+ keeps its full-closure default. The installed-product regression compares all root input buckets and configurations
943
+ against closure inspection and rejects the old all-plan selection. See
944
+ [root-only raw-input inspection](../../patches/README.md#root-only-raw-input-inspection).
520
945
  - **The default cache limit uses the cache's own filesystem.** It takes ten percent of `statfs(cacheDir)` capacity, or
521
946
  its nearest existing ancestor when the directory has not been created. This avoids synchronously inventorying every
522
947
  mounted disk. Explicit `NX_MAX_CACHE_SIZE` and `nx.json.maxCacheSize` retain their precedence; filesystem errors other
523
948
  than a missing directory still fail the operation. See [upstream Nx #37269](https://github.com/nrwl/nx/pull/37269).
949
+ Cowshed exports an explicit caller-overridable default of configured build-volume capacity divided by ten for host
950
+ shells and jobs. The hosted setup action keeps its existing separate `20GB` ceiling.
524
951
  - **The daemon keeps graph plugin workers running.** Nx stops an isolated plugin worker after the last phase it has
525
952
  hooks for, which for a graph-only plugin is every graph; the daemon recomputes the graph on every tracked file change,
526
953
  so each change spawned and loaded every graph plugin's worker again (median 199 ms against 63 ms from edit to graph in
@@ -528,21 +955,141 @@ The Nx patch repairs upstream Nx runtime behavior, separately from this plugin's
528
955
  long as the daemon; one-shot clients and task-only plugins keep the eager shutdown. See
529
956
  [upstream Nx #37271](https://github.com/nrwl/nx/pull/37271).
530
957
  - **Nx resolves typescript and release version actions from the workspace.** Nx 23.2.1 loads both with a plain `require`
531
- from its own location, which in Bun's global store holds only Nx's own dependencies. There it finds no `typescript`,
532
- so its dependency analysis skips every source import without a warning (this repository lost 12 of 44 graph edges),
533
- and `release version` cannot resolve `@nx/js`'s version actions. The patch resolves both through `getNxRequirePaths`
534
- (the workspace first), falling back to Nx's own location. See
535
- [upstream Nx #37272](https://github.com/nrwl/nx/pull/37272).
536
-
537
- Publishing or installing `@smoothbricks/nx-plugin` does **not** change a consumer's Nx. A consumer needing these repairs
538
- sets the same `overrides.nx` URL in its root `package.json`, registers the same `@nx/js` patch in its
539
- `patchedDependencies`, regenerates its lockfile, and proves a frozen install and its affected normal Nx gates. Do not
540
- replace the registry dependency with a local link or hide a failure by resetting the database or disabling the daemon.
541
-
542
- The patch is version-specific. A changed patch publishes a new release, and consumers move to its URL. On an Nx upgrade,
543
- remove each hunk only when the installed upstream release contains that repair and the task-history namespace,
544
- cache-bound, resident-worker and store-resolution regressions pass; preserve any repair not yet released. When every
545
- hunk is upstream, drop the override, the patch, `tooling/patched-nx.ts` and the workflow together.
958
+ from its own location. Where that location cannot see `typescript`, its dependency analysis skips every source import
959
+ without a warning (the first install that exposed this lost 12 of 44 graph edges), and `release version` cannot
960
+ resolve `@nx/js`'s version actions. The patch resolves both through `getNxRequirePaths` (the workspace first), falling
961
+ back to Nx's own location. See [upstream Nx #37272](https://github.com/nrwl/nx/pull/37272).
962
+ - **A task's dependencies do not depend on which other tasks the run asks for.** A target that depends on `^build`
963
+ through a project with no `build` target gets a dummy task for it, and Nx flattens each dummy into the real tasks
964
+ behind it except a dummy it believes sits in a cycle. `findCycles` reported every task on the depth-first path that
965
+ first reached a cycle, and only the cycles reached before another traversal marked their tasks visited, so the answer
966
+ followed the order of the graph's keys. In a workspace whose projects import each other, a shard requested alone
967
+ (`nx run app:test-4`) and the same shard requested through its aggregate (`nx run-many -t test`) got different
968
+ dependencies and, because `dependentTasksOutputFiles` keys on the dependency tasks' outputs, different hashes: a
969
+ pre-run of one never hit the cache of the other. The patch answers with the tasks that lie on a cycle (Tarjan's
970
+ strongly connected components), so a task's dependencies are a property of the graph behind it. Not yet proposed
971
+ upstream: Nx `master` carries the same `findCycles`.
972
+ - **A target's output has one owner across clients of the checkout.** A per-project/target lease spans cache lookup and
973
+ restore, execution, output publication, output-hash recording and cache capture. A producer replacing and retiring a
974
+ directory cannot invalidate a concurrent cache walk, and same-hash clients cannot remove one another's artifact while
975
+ publishing it. Waiting clients recheck the cache under ownership; independent targets retain concurrency. See
976
+ [`patches/README.md` §Cross-client task output ownership](../../patches/README.md#cross-client-task-output-ownership)
977
+ for the kernel lock, worker lifecycle and real-client regression.
978
+ - **A restored output is newer than the output it replaces.** Nx restores a cached output with `std::fs::copy`, which on
979
+ macOS clones the file and keeps its timestamps, so a restored output carried the mtime it had when its cache entry was
980
+ written. Build from input A, rebuild from B, return to A, and the restored A was older than the B output it replaced:
981
+ every consumer that judges freshness by mtime (a Cargo build script's `rerun-if-changed`, make, a file watcher) kept
982
+ what it built from B. The patch stamps each restored file with the time of the restore, as running the task would
983
+ have: after `copyFilesFromCache` for a local hit, and after the native `applyRemoteCacheResults` for a remote hit,
984
+ which untars the artifact with its stored mtimes and restores it with the same copy. Restoring one directory output of
985
+ 10,000 1 KiB files took a median 3.4 s for the native remove and copy and 0.79 s more for the stamp, on a machine at
986
+ load average 70–120. Not yet proposed upstream.
987
+ - **A file rewritten within the second it was hashed in is hashed again.** Every Nx context (each run without the
988
+ daemon, and the daemon when it starts) hashes the workspace's files through `<workspace-data>/nx_files.nxt`, which on
989
+ Unix keeps each file's hash beside its mtime in whole seconds, and reuses an archived hash while that second is
990
+ unchanged; size and nanoseconds are not compared. A file written again within the second it was hashed in keeps its
991
+ mtime and hashes as the bytes it replaced: a revert replays the cache entry of the edit it reverts. The patch applies
992
+ Git's racy-index rule before the native context reads the archive: when the archive holds an mtime from ten seconds
993
+ before its own write (the longest a hashing pass is assumed to run) or later, it is removed and every file is hashed
994
+ again. A full pass over 6,370 files measured 288–753 ms at load average 70–110. The check reads each entry's mtime
995
+ from the archive's rkyv layout as Nx 23.2.1's binary writes it (the root's entry count and entry pointer in the last
996
+ 12 bytes, 24-byte entries with the i64 mtime at +8), in under 1 ms for 6,396 files. In 134 synthetic workspaces of 1
997
+ to 400 files dated 2001 it kept every archive, and it removed every one once a file was written in the pass. An
998
+ archive whose root does not fit is removed. A file dated ahead of the archive keeps it distrusted, so every run hashes
999
+ everything until the clock passes that date. The check cannot see a pass longer than ten seconds, nor an archive
1000
+ another Nx process rewrites between the check and the native read; on Windows, whose native mtime is a FILETIME, it
1001
+ does nothing. The native fix records every entry dated from the second its pass started on as racy and has none of
1002
+ these limits. Not yet proposed upstream.
1003
+ - **A failed run exits 1, not 130, when it skips the tasks behind a failure.** Nx skips every task that depends on a
1004
+ failed one, and tells no life cycle about a skipped task, so the results `nx` reads its exit status from had none for
1005
+ it; `didCommandComplete` takes a discrete task without a result for one the run never finished, and `nx` exited 130,
1006
+ the status of an interrupted run. A gate then reported `Failed to run "nx" due to exit code 130` for an ordinary test
1007
+ failure. The patch has `didCommandComplete` also accept a task the runner reports skipped, so the exit status is 1.
1008
+ With `--nx-bail=true`, pending tasks have no status and active tasks can be stopped by bailout cleanup; the CLI uses
1009
+ the orchestrator's actual bailout and interruption flags, so a known failure still exits 1, but a signal or forced TUI
1010
+ stop wins and exits 130. The terminal output's "Tasks not run" list is unchanged. Only that check sees the runner's
1011
+ skipped tasks: `invokeTasksRunner` and the plugins' `postTasksExecution` hooks still get Nx's own results, with none
1012
+ for a skipped task, so a caller that replays Nx's skip rule over them counts it once. (An earlier version of this hunk
1013
+ added a skipped result to those results, and such a caller counted no task as skipped.) Not yet proposed upstream: Nx
1014
+ `master` reports skipped tasks the same way.
1015
+ - **A workspace has one daemon, and a second one leaves it alone.** Every daemon overwrote `server-process.json` with
1016
+ its own pid, so two clients that each found no daemon started two, and the later one displaced the earlier. A client
1017
+ of the displaced daemon lost its socket mid-request (`EPIPE` on `RECORD_OUTPUTS_HASH_BATCH`) after the run had printed
1018
+ its summary. Under a configured `NX_SOCKET_DIR`, every daemon binds the same path, and closing a listening Unix socket
1019
+ unlinks its path. The displaced daemon's shutdown therefore removed its successor's socket, the next client found no
1020
+ daemon and started another, and one workspace saw a new daemon every five seconds. Before it does anything else, the
1021
+ patched daemon creates the record with link(2), which never replaces a file. If a live daemon of the same Nx version
1022
+ that serves the same root holds the record, the new one waits for that daemon to answer and then exits. A record whose
1023
+ holder is dead, runs another Nx version, or serves another root (a copied workspace) is replaced. A daemon whose
1024
+ socket, at the path it bound, has been removed or rebound exits within 20 ms, since no client can reach it. It leaves
1025
+ a path another daemon has bound alone, so that daemon's socket is not unlinked. A holder starts when it claims, so a
1026
+ live one that has not answered by the time its record is a minute old (a pid reused after a crash) is stale and
1027
+ replaced. On a filesystem without hard links the record is created exclusively instead. Not yet proposed upstream.
1028
+ - **A run that throws part way through does not report success.** The default tasks runner ends its life cycle in a
1029
+ `finally`, so the static summary also prints when the orchestrator throws mid-run. It printed "Successfully ran"
1030
+ whenever no task had failed or stopped, and counted each task the run never reported as skipped: a focused `run-many`
1031
+ whose daemon socket died while recording output hashes printed success with "10 skipped", then `Error: write EPIPE`.
1032
+ The orchestrator reports every task it finishes except one it skips, and it skips a task only behind a failed or
1033
+ stopped one, so the patch prints success only when every task was reported. Otherwise the summary says the run did not
1034
+ complete and names the unreported tasks: under "Tasks not run" after a failure, as before, and under "Tasks the run
1035
+ ended without finishing" when none failed. Nx `master` prints the same summary. Not yet proposed upstream.
1036
+ - **Nx refuses an environment set up for another workspace.** A shell that moves into another checkout keeps the
1037
+ `NX_WORKSPACE_ROOT_PATH`, `NX_WORKSPACE_DATA_DIRECTORY`, `NX_CACHE_DIRECTORY` and `NX_SOCKET_DIR` of the workspace it
1038
+ was set up for, and Nx takes `NX_WORKSPACE_ROOT_PATH` verbatim as its root: `nx daemon --stop` run in the second
1039
+ checkout stopped the first one's daemon and deleted its socket directory. The `nx` CLI now finds the current
1040
+ directory's workspace by its `nx.json`, `nx` or `nx.bat` alone, ignoring the override, and refuses any command, before
1041
+ it reaches a daemon, socket or file, when one of those variables, `NX_DAEMON_SOCKET_DIR` or
1042
+ `NX_PROJECT_GRAPH_CACHE_DIRECTORY` names another workspace. The error names each such variable with its value and both
1043
+ workspaces, and says to run under the current workspace's own environment (`direnv exec <workspace> nx ...`).
1044
+ `NX_WORKSPACE_ROOT_PATH` names the directory it holds; a data, cache or socket directory belongs to the workspace
1045
+ whose root contains it, found by walking the directory's ancestors to a workspace marker (`nx.json`, `nx` or
1046
+ `nx.bat`). Workspaces are compared by the device and inode of their root directory, not by path, so every path to the
1047
+ current workspace is that workspace: a symlink, a bind mount or a firmlink. CI depends on it: `setup-devenv`
1048
+ bind-mounts the checkout at `/work/...` for devenv's evaluation cache, the environment names that mount, and the steps
1049
+ run in the checkout. Compared as resolved paths the two were different workspaces, and every `nx` of the job refused.
1050
+ A current directory inside no workspace is not refused. A directory outside every workspace, such as a socket
1051
+ directory under `/tmp`, is left unchecked: only the daemon behind it could say whose it is, and reaching that daemon
1052
+ is what the check prevents. The daemon, plugin workers and tasks do not start through the CLI and are not checked; an
1053
+ `nx` a task runs from a project directory resolves to the task's own workspace and passes. A cache or data directory
1054
+ that several checkouts share on purpose has to lie outside every workspace, or it is refused. Not yet proposed
1055
+ upstream.
1056
+ - **An idle daemon releases its workers after five minutes.** The patched `SERVER_INACTIVITY_TIMEOUT_MS` is 300000 ms,
1057
+ not stock Nx's three hours. Normal requests and watched source changes reset that timer; an open request connection,
1058
+ file watcher or graph listener retains the daemon even when silent. The last request connection's close starts a fresh
1059
+ five-minute idle interval. Cowshed's existing usage-aware keeper remains authoritative for sheds whose tree changes
1060
+ without a job, session or task-database holder. No daemon is disabled and the next normal client starts one again. The
1061
+ non-default, uncached host proof is `bun nx run tooling:nx-daemon-idle-proof` from the checkout root. Its declared
1062
+ compile dependency emits the Typia-transformed product before Bun runs it. The proof holds a real silent client beyond
1063
+ five minutes, disconnects, and records the kernel and daemon-log evidence of the next five-minute departure. It stays
1064
+ outside the bounded Bun shards; their fast regression checks the actual installed policy export.
1065
+ - **The daemon stops for an ignore file only when its watcher's rules may be stale.** Nx's native watcher reads its
1066
+ ignore files once, in `watch()`, and the daemon stopped itself on every watcher event for a `.gitignore` or
1067
+ `.nxignore`, whatever the file then held. A rewrite with the same bytes (a checkout, a formatter) reports one, and so
1068
+ does FSEvents for a write made shortly before the daemon's stream started, when fseventsd numbers it after that start.
1069
+ The stop destroys every client socket at once, so a file-watcher client lost the notification of the batch that
1070
+ carried the event, and a watcher waiting to judge an edit in that batch waited forever. The patch keeps the content
1071
+ hash of each ignore file the workspace context read, but only where neither the file nor its directory changed since
1072
+ just before the watcher's read (judged on the filesystem's own clock, by stamping a probe in the workspace data
1073
+ directory): those are the bytes the watcher's rules came from. An event stops the daemon unless its file is one of
1074
+ those and still hashes the same; a file changed between the watcher's read and the context's, or one the context never
1075
+ held, stops it as before.
1076
+ - **A failure before execution does not crash a completion lifecycle.** The
1077
+ [run-information repair](../../patches/README.md#run-information-after-a-pre-start-failure) owns the completion,
1078
+ history and timing contract.
1079
+
1080
+ Publishing or installing `@smoothbricks/nx-plugin` alone does **not** change a consumer's Nx. `smoo monorepo update`
1081
+ distributes the managed `patches/nx@23.2.1.patch` and maintains the root registry override `nx = "23.2.1"` plus its
1082
+ matching `patchedDependencies` entry. Run ordinary `bun install`, commit its lock changes, then prove a frozen install
1083
+ and the affected normal Nx gates. Do not replace the registry dependency with a local link or hide a failure by
1084
+ resetting the database or disabling the daemon.
1085
+
1086
+ The patch is keyed to `nx@23.2.1`; a different Nx version needs its own patch file. On an Nx upgrade, remove each hunk
1087
+ only when the installed upstream release contains that repair and the task-history namespace, cache-bound,
1088
+ resident-worker, store-resolution, task-graph, restore-time, racy-archive, skipped-task exit, daemon-claim,
1089
+ incomplete-run summary, foreign-environment, ignore-file and run-information regressions pass; preserve any repair not
1090
+ yet released. The restore-time regression fails without its hunk only on macOS, where the copy clones (on Linux
1091
+ `std::fs::copy` writes a fresh mtime), so run it on macOS before dropping the hunk. When every hunk is upstream, remove
1092
+ the `nx@23.2.1` and `@nx/js@23.2.1` entries from `patchedDependencies` and delete their patch files.
546
1093
 
547
1094
  ## Bun Test Tracing Generator
548
1095
 
@@ -566,8 +1113,227 @@ What it wires:
566
1113
 
567
1114
  ## Bounded Test Targets
568
1115
 
569
- `@smoothbricks/nx-plugin:bounded-exec` runs a shell command with a timeout and force-kill grace period. Test targets use
570
- this executor so hung test processes fail predictably instead of blocking Nx indefinitely.
1116
+ `@smoothbricks/nx-plugin:bounded-exec` runs a shell command under a no-progress bound or a wall-clock ceiling, with a
1117
+ force-kill grace period. Test targets use this executor so hung test processes fail predictably instead of blocking Nx
1118
+ indefinitely.
1119
+
1120
+ A test target is bounded by progress alone: `idleTimeoutMs`, 180 s (`BOUNDED_TEST_IDLE_TIMEOUT_MS`, the hang backstop of
1121
+ `specs/cowshed/08_testing.md`), with no `timeoutMs`. The bound re-arms whenever the runner reports a finished test: a
1122
+ nextest status line carrying its run counter (`PASS [ 0.438s] (1/4) …`), a libtest `test … ... ok` line, or a bun
1123
+ result line or dot. Output that finishes no test is not progress: nextest's `SLOW` warning, repeated every slow-timeout
1124
+ period for a test still running, and a hung test's heartbeat both keep printing. A suite that keeps finishing tests
1125
+ therefore runs as long as it needs, however slow the host, and a test that never returns ends the run 180 s after the
1126
+ last test that finished. bun prints nothing per passing test when it believes an agent runs it, so the executor asks a
1127
+ lone `bun test` for `--dots`, one dot per finished test. A command that reports no tests makes progress only by exiting.
1128
+ nextest's slow-timeout and the serial groups' code-time classes only warn; no per-test bound kills a test or fails one
1129
+ that passed. `timeoutMs`, an absolute ceiling, is for commands that report no tests; a target names at least one of the
1130
+ two.
1131
+
1132
+ The final-five-second pre-signal snapshot attributes the runner's process tree and observed resources, with explicit
1133
+ incomplete/raced results and no delay to termination. Its timing, visibility and evidence contract is defined in
1134
+ `specs/cowshed/08_testing.md`, "Integration tests (real substrate)".
1135
+
1136
+ On a macOS host, every `bounded-exec` task runs with its own `TMPDIR` lease: a directory on one RAM-backed APFS volume
1137
+ per user, so test temp files never reach the SSD. The volume is created lazily by the first task that needs it and
1138
+ detached when the last live lease ends, since its pages return only on detach. It is a legacy DiskImages RAM disk, so it
1139
+ spends none of the AppleDiskImages2 attach budget cowshed counts (`specs/cowshed/01a_apfs.md`, "How the APFS host
1140
+ degrades"). A lease whose task died is reclaimed by the next task, unless an image is still attached from a file below
1141
+ it or a mount sits below it: those belong to whoever attached them, so the lease and the volume are kept and every new
1142
+ task names them. A target's own `env.TMPDIR` wins over the lease. Inside a cowshed sandbox, which cannot write the lock
1143
+ in `/private/tmp`, the task keeps its inherited `TMPDIR` and says so once. A failed task that left the volume nearly
1144
+ full names the volume.
1145
+
1146
+ Outside macOS, the executor never provisions an APFS RAM disk: it keeps the inherited `TMPDIR`, or uses the target's
1147
+ `env.TMPDIR` override, without reclaiming either directory. The host temp-directory proof runs the real default executor
1148
+ for that contract on Linux; on macOS it exercises RAM-volume recovery, shared leases and final detach.
1149
+
1150
+ The volume's kernel `O_EXLOCK` admits ledger mutations and releases on process death. It is held only for cheap lease
1151
+ and operation claims and their publication: host-wide process and disk-inventory probes, directory cleanup, provisioning
1152
+ and detach run outside it. A caller re-takes the lock and revalidates the volume, lease identity and its owned claim
1153
+ before publishing a mutation; another caller can take a lease while a dead lease is being inspected. An acquire that
1154
+ fails after taking its lease directory gives it back, and detaches the volume if that was the last lease, as the last
1155
+ release would have.
1156
+
1157
+ Checkouts of this plugin from before the ledger lease under the kernel lock alone and never read the claims, so the two
1158
+ protocols must never share a volume. The protocol's revision (2) names the volume, its lock and its ledger, and adds as
1159
+ many sectors to the RAM disk: the creator's stray reclaim matches user and size, so neither revision detaches the
1160
+ other's disk, mounted or still attaching. On a host running both, each revision has its own volume.
1161
+
1162
+ A creation or detach claim is void once its owner's pid is gone. A crashed owner whose pid was reused holds every caller
1163
+ waiting on the volume, and macOS gives no cheap way to tell the new process from the old without running `ps` under the
1164
+ lock. So every 15 s that a caller waits on the same claim, stderr names its kind, owner pid, token, ledger and the wait
1165
+ so far.
1166
+
1167
+ Each reclaim pass reads at most one I/O Registry and mount-table snapshot, not one per lease. A dead lease held only by
1168
+ mounted filesystems keeps a positive verdict with stable mount and lease identities. A valid positive still names and
1169
+ retains it without another host-wide probe; an unmount exposes the underlying RAM device and triggers a fresh probe.
1170
+ Image-backed and otherwise unkeyable holds stay uncached: device-node reuse has no proven cheap incarnation key. Every
1171
+ pass that claims such a lease probes it again, with a process census and the pass's inventory, which take seconds on a
1172
+ busy host; that latency falls on the claiming task, outside the lock. A negative verdict is never cached, probe errors
1173
+ never stand in for an empty holder set, and held directories stay unchanged.
1174
+
1175
+ Contended lock opens also use `O_NONBLOCK` and yield for 50 ms, avoiding a separate latent filesystem-worker deadlock
1176
+ when one Node process makes five concurrent requests with four workers. The observed gate failures instead came from
1177
+ cross-process waits behind long host-wide probes under the RAM lock. Real nested and sibling default-executor proofs run
1178
+ with background single-lease processes to cover that shape. No case or target timeout is raised.
1179
+
1180
+ Once the process and holder checks permit removal, cleanup restores owner read/write/search permission on directories
1181
+ through no-follow directory handles before deleting the lease. Read-only fixture directories cannot strand a dead lease
1182
+ and block later tasks. File modes and symlink targets stay untouched; a directory on another device refuses cleanup
1183
+ instead of changing an attached volume. Held leases undergo no permission changes.
1184
+
1185
+ The real RAM-volume regression walks one volume's lifecycle in a single test: unmarked debris and a live-lease refusal,
1186
+ recovery over the debris, concurrent leases, failed-acquire lease/claim rollback, read-only cleanup, a held dead lease,
1187
+ owner detach and reclaim, and the final detach. External symlink targets and held directory modes stay unchanged,
1188
+ without duplicate provision and teardown; its 60 s case bound is unchanged and its target has the progress bound.
1189
+
1190
+ The host target names both owned files with `./` paths: Bun otherwise interprets a bare path as a filter over recursive
1191
+ test discovery. This changes no selected case or timeout. The failed-provisioning regression keeps its exact injected
1192
+ refusal and rollback exit-status assertions, then checks the named volume and both mountpoints before test teardown. Its
1193
+ trace records command start/end times, refusal, inventory and separate teardown. Commands, refusal and inventory are
1194
+ also written to stderr immediately, because a runner timeout can end the process before the harness flushes its trace. A
1195
+ reported rollback failure must not be mistaken for a successful detach that left a volume behind.
1196
+
1197
+ A refused rollback also records the kernel mount and read-only filesystem/device `lsof` observations before teardown.
1198
+ Each observation has a one-second wait bound and retains its status and stderr; an incomplete probe is not an empty
1199
+ holder set. These observations do not prove which holder caused `EBUSY`, and change no case or target bound.
1200
+
1201
+ The native lifecycle walk also observes its real working-directory census through the existing process-host seam,
1202
+ retaining start/end times and the original error's exit code, signal and killed flag before rethrowing it unchanged.
1203
+ This locates whether a census was outstanding at a case timeout without substituting a fake process inventory. Its real
1204
+ host-command delegate records the same timestamps from case entry, retaining the actual argv, requested deadline and
1205
+ result without changing them; this covers the work before the first process census. Observation before delegation is
1206
+ timed separately from the delegate's wait, so logging cost is never presented as child execution time.
1207
+
1208
+ 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
1209
+ fixture's Nx daemon: Nx detaches it into a session of its own, so the process-group kill that ends a timed-out command
1210
+ never reaches it, and a test process that is killed runs no teardown. Deleting its root asks the daemon to leave only by
1211
+ deleting its record, which an idle daemon notices within a second and a wedged one never does, and a process left on the
1212
+ volume keeps it from detaching. So the task's own release, and the next task's reclaim of a dead lease, first hold
1213
+ discovered processes with SIGSTOP and rescan their descendants and lease working directories until a stopped census is
1214
+ stable. A process can fork after a table read but before its signal; only a table read after it is stopped closes that
1215
+ gap. Discovery failures attempt to resume every held process; one denied SIGCONT cannot strand the rest. Errors retain
1216
+ the original discovery failure and name any denied continuation with its PID and command. The settled census gets
1217
+ SIGTERM then SIGCONT, SIGKILL if anything has not exited five seconds later, and names each PID once on stderr
1218
+ (`stopped <pid> (<command>), which the command left working in its lease`). A lease with nothing in it costs no scan.
1219
+ Discovery follows stopped-census readiness under the enclosing operation's existing bound; the five-second exit grace
1220
+ does not include discovery or fixture readiness. The lease's working directories are read again only after the same
1221
+ census is stopped in consecutive process tables, including an empty one, which recovers children reparented out of the
1222
+ tree. This avoids host-wide cwd scans while stopped-table quiescence is still being established. The line is the leak
1223
+ check: a suite that prints it has a fixture to fix.
1224
+
1225
+ The volume mounts at `/Volumes/smoo-ram2-<uid>`, where DiskArbitration puts it: asking for any other mountpoint
1226
+ escalates to an administrator dialog that blocks every `diskutil` on the host. That mount is `noowners`, and launchd
1227
+ refuses a plist from it, so a test that bootstraps a launchd job keeps the plist outside `TMPDIR`.
1228
+
1229
+ The volume is created under its final name, `smoo-ram2-<uid>`, and is never renamed. It is mounted and marked at a
1230
+ private staging directory, then unmounted and placed at `/Volumes/smoo-ram2-<uid>` by DiskArbitration, so a creator that
1231
+ dies part way never leaves an unmarked volume at that mountpoint for the next one to dodge as `smoo-ram2-<uid> 1`.
1232
+ Before creating, a task detaches every RAM disk of the same user and size that is mounted nowhere but at those two
1233
+ paths: the debris of a creator that was killed or ran into its deadline. One that still carries a lease directory, or
1234
+ has something attached below it, is named in the task's error instead.
1235
+
1236
+ Every `hdiutil` and `diskutil` execution goes through `cowshed disk-command`, including host-test inventory and cleanup.
1237
+ The cowshed is the installed one on `PATH`, which must provide this command, unless `COWSHED_EXECUTABLE` names another.
1238
+ A target may set it in its `env`, workspace-relative or absolute: the task's own RAM volume work and its command then
1239
+ both run that cowshed, given to the command as an absolute path. This repository sets it to
1240
+ `packages/cowshed/bin/cowshed`, after `cowshed:build`, on the targets that exercise the facade (both real-APFS groups
1241
+ and `nx-plugin:test-host`), so they test this checkout's cowshed, not an installed one that may predate a command the
1242
+ checkout added. Cowshed alone owns disk-lifecycle leasing. Safe disk commands use
1243
+ `cowshed disk-command diskutil --deadline-ms <positive integer> -- <args>`: the CLI owns that total monotonic budget
1244
+ across lease admission and child execution, never starts a child after it expires, and kills and reaps an overrun safe
1245
+ child before returning. Node waits for the facade's actual terminal exit without a second timer or lease. Only protected
1246
+ image commands (any `hdiutil`, `diskutil image`, and `diskutil eject`) use `cowshed disk-command <tool> -- <args>` and a
1247
+ caller-bounded stop-wait: cowshed starts them detached from caller signals, with file-backed output, and never kills
1248
+ them, because killing an attach or detach can leak its kernel device until reboot. A still-running protected command
1249
+ retains its lease and is named in the timeout error. That timeout status is the wrapper's stop-wait outcome, not an
1250
+ actual disk-child exit or signal; native termination diagnostics come from the CLI's owned child wait. Other helpers
1251
+ retain their process-group deadline. The shared default remains 120 s. A process whose lease waits are recorded
1252
+ (`COWSHED_LEASE_WAIT_RECORD`) asks for its phase `alone`; a gateway from before `alone` refuses the field at once and is
1253
+ asked shared instead, for a minute. Cowshed's runner refuses `diskutil rename` and `renameVolume` for every caller; the
1254
+ RAM volume is created under its final name and never renamed.
1255
+
1256
+ `bun node_modules/@smoothbricks/nx-plugin/src/disk-command-policy.ts <repository...>` checks tracked and nonignored
1257
+ source, tests and scripts for direct disk-tool process calls. SmoothBricks runs it from `tooling:lint-disk-commands`;
1258
+ consumers wire the same guard into their root lint. Rust callers use `SystemCommandRunner` and `CommandRequest`; script
1259
+ callers use the CLI facade rather than introducing another disk-command runner.
1260
+
1261
+ Without an inherited parent pool, a `bounded-exec` command takes CPU tokens from cowshed's host budget before it starts,
1262
+ when the gateway answers on the same socket (`specs/cowshed/05_gateway.md`, "Host CPU budget"), so concurrent gates on
1263
+ one host keep their runnable work near the core count instead of each sizing its runners to the whole machine. It asks
1264
+ for the runner's requested parallelism — nextest's `--test-threads` or one per core, `bun test --parallel=N` N, a cargo
1265
+ build one per core, anything else one, or the target's `parallelism` option — bounded by positive inherited
1266
+ `NEXTEST_TEST_THREADS`/`CARGO_BUILD_JOBS` ceilings. A configured count can lower an inherited ceiling, never raise it.
1267
+ The runner uses `min(bounded request, granted tokens)`: nextest's environment and named flag, Bun's parallel flag, and
1268
+ Cargo's jobs are sized to that limit. Cargo's `RUST_TEST_THREADS` retains its independent inherited/configured ceiling.
1269
+ `BOUNDED_EXEC_CPU_TOKENS`, the sub-ledger and telemetry still name the actual held grant. The gateway shares tokens
1270
+ fairly between checkouts (Nx workspace roots). `timeoutMs` and `idleTimeoutMs` start at the grant. The tokens go back
1271
+ when the command exits, or with the executor's socket when it is killed. The wait prints one
1272
+ `cowshed: cpu-tokens wait done elapsed=… tokens=<granted>/<asked>` line. With no gateway listening, the command runs
1273
+ exactly as configured and nothing is said; a gateway from before the budget runs it unbudgeted and stderr says so.
1274
+
1275
+ A granted executor serves a private `BOUNDED_EXEC_CPU_POOL` with its actual token count. A nested default executor takes
1276
+ from that immediate parent pool, capped at `min(asked, inherited, ceil(cores/2))`, instead of taking from the host while
1277
+ the parent holds its grant. The pool accounts for siblings together; each admitted child serves only its own allocation
1278
+ to grandchildren. Closing a child's connection returns its local allocation, never the parent's upstream grant. Upstream
1279
+ loss revokes the downstream pool; losing a borrowed grant stops the command and records an ordinary failure, not a
1280
+ timeout. A bare count or absent endpoint follows normal host admission. A connected parent pool's refusal or protocol
1281
+ failure instead fails admission: taking from the host then could wait on the parent's own grant. `options.env` cannot
1282
+ inject either marker. Parent-pool grants record `cpu.inherited: true` and their actual local wait; the span also says
1283
+ `inherited=true`. Pool setup, listener and cleanup errors fail rather than bypassing accounting. Command bounds stay
1284
+ unchanged.
1285
+
1286
+ The absent-parent fixture uses the executor's injectable budget with a real, controlled outer pool as its backing. It
1287
+ proves a positive allocation and re-acquires it after the command ends, rather than depending on free tokens in the
1288
+ host-wide gateway while the test runner itself holds an allocation. A bare count or unbudgeted success is not proof. A
1289
+ land gate enters the existing task server with
1290
+ `cowshed exec <workspace> --class gate --host --want N [--wait-ms N] -- COMMAND [ARGS...]` before daemon-stop and Nx
1291
+ gate work. It requires a real gateway jobserver `class: "gate"` grant and serves that exact count as an existing live
1292
+ parent CPU pool; no environment-only class or unbudgeted fallback is accepted. The default **120000 ms** admission wait
1293
+ is explicitly overridable per invocation. A queued gate stops new background root admissions and takes whole tokens as
1294
+ in-flight grants end. Running background tests/FIFOs are never shrunk, frozen or killed to manufacture tokens. An
1295
+ expired wait returns `gate-admission-timeout` naming the wait and current checkout holders; it changes no task wall/idle
1296
+ bound. Requested/granted count and actual queue wait are logged, and a child's nonzero exit is preserved exactly.
1297
+ Compiling Cargo under the live pool borrows a sibling-accounted local allocation and receives its own private child
1298
+ pool, so grandchildren never compete with their occupied ancestor. See `specs/cowshed/05_gateway.md`, "Gate admission by
1299
+ whole-grant drain", for the guarantee and its deliberate limits.
1300
+
1301
+ Every `bounded-exec` task records why it ended in `.nx/workspace-data/bounded-exec/<task>/verdict.json`, keyed by the
1302
+ task id and the hash it ran at:
1303
+
1304
+ - `bound`: nothing failed but a wall-clock bound. Either the command outlived `timeoutMs`, or every failing test in the
1305
+ runner's JUnit report failed on its runner's per-test timeout (`cargo-nextest` writes `type="test timeout"` where a
1306
+ configuration still sets `terminate-after`, `bun test` writes `type="TimeoutError"`). A loaded host produces exactly
1307
+ these. When `timeoutMs` fires, the tests `cargo-nextest` was still running are reported as failures of
1308
+ `type="test abort"`, `process aborted with signal 15 (SIGTERM)` (SIGKILL once the force-kill follows); they are the
1309
+ bound's casualties and do not make the run `failed`. A test that dies of any other signal, or that is aborted with no
1310
+ bound to explain it, does.
1311
+ - `wedged`: `idleTimeoutMs` fired: no test finished for that long. A host that is only slow still finishes tests, so
1312
+ this is a hang, never load. Its `tests` name the tests still running: those the runner said were running (nextest's
1313
+ `SLOW`, libtest's `has been running for over`) and never said finished, and those the JUnit report says it aborted
1314
+ when the bound stopped it.
1315
+ - `failed`: a test failed on its own, or the command exited non-zero with no report naming a timeout.
1316
+ - `passed`.
1317
+
1318
+ The report needs no target configuration. When the command runs exactly one `bun test` or `nextest run`, the executor
1319
+ asks that runner for a JUnit report in the task's directory: `bun test` through `--reporter=junit --reporter-outfile`,
1320
+ nextest through a one-key tool config (nextest takes the report path only from configuration). A `bun` is any unquoted
1321
+ command word whose basename is `bun`, so `../bun-runtime/.runtime/bun test` is the runner too, and the rewrite keeps the
1322
+ binary the target named. A script that spawns the runner itself passes
1323
+ `--reporter=junit --reporter-outfile="$BOUNDED_EXEC_JUNIT"` on; the variable is set for every task. A command with no
1324
+ runner, or with two (they would write one report), is judged by its exit alone.
1325
+
1326
+ `smoo-nx-bound-failures` reads the workspace's last Nx run (`run.json` in Nx's `cacheDir`, the directory
1327
+ `StoreRunInformationLifeCycle` writes: the checkout's own `.nx/cache` under smoo's workspace policy) against those
1328
+ records and prints one line per failed task. It exits 0 only when the run failed and every failed task's record, for
1329
+ that task's hash, is a `bound`; a failed task without one is not. This diagnostic is not land acceptance. The land
1330
+ wrapper, `tooling/land-host.sh`, requires `nx run-many -t gate` to exit zero: bounds, assertions and infrastructure
1331
+ failures all stop the land without a retry or waiver. `smoo-nx-failures OUTPUT` reports unique failing tasks and
1332
+ deduplicated exact diagnostics from that invocation's retained output, not a shared last-run record. The portable
1333
+ `@smoothbricks/nx-plugin/failure-summary` export owns `summarizeFailures(output)` and `runFailureSummary(args)`;
1334
+ repository entrypoints such as `tooling/land-summary.ts` call that owner without copying the parser. Its zero exit means
1335
+ reporting succeeded, never that the failed gate may land. Known diagnostic sections omit fixture progress and daemon
1336
+ debug dumps while preserving multiline assertions and source locations; unknown formats retain their output.
571
1337
 
572
1338
  The shared policy API is exported from `@smoothbricks/nx-plugin/bounded-test-policy` for generators or other workspace
573
1339
  tools that need to normalize package JSON consistently.
@@ -581,10 +1347,81 @@ The generator rewrites `package.json` so `nx.targets.test` uses:
581
1347
  - executor `@smoothbricks/nx-plugin:bounded-exec`
582
1348
  - command preserved from an existing `nx:run-commands` test target or direct `scripts.test`
583
1349
  - `cwd: "{projectRoot}"`
584
- - `timeoutMs: 600000`
1350
+ - `idleTimeoutMs: 180000`
585
1351
  - `killAfterMs: 10000`
586
1352
  - package script alias `nx run <project>:test --outputStyle=stream`
587
1353
 
1354
+ Workspace updates preserve no-op test targets rather than adding a second test runner. A no-op `test` aggregate passes
1355
+ the check when it reaches at least one local test execution leg and every such leg is bounded, including through nested
1356
+ no-op aggregates: `bounded-exec` with a command, a `cwd`, a positive `idleTimeoutMs` and `killAfterMs`, and no
1357
+ `timeoutMs`. Upstream and non-test prerequisites such as `^build`, `build`, `typecheck-tests`, and Cargo
1358
+ compilation/archive targets are ignored by this test-leg check. Each bounded Bun leg must declare a positive per-test
1359
+ `--timeout` no greater than its own `idleTimeoutMs`; the migration's 30-second default is not a limit on explicitly
1360
+ bounded lanes. Only a leg that runs `bun test` must start in the project root or its `src/`, where Bun's test-file
1361
+ discovery is cheap; any other command (a cargo workspace's per-crate nextest legs run from the workspace root, a gate
1362
+ may run a script that lives in another project) may use any `cwd`.
1363
+
1364
+ ## Test Fixtures That Run Nx
1365
+
1366
+ The executor's real-process tests acknowledge handler installation and process-group membership before delivering a
1367
+ timeout signal. Cooperative termination requires its handler receipt and no force kill; descendant lifetime pipes prove
1368
+ actual closure. The abort-report walk requires the runner's named cancellation record as well as total-bound
1369
+ classification, so an executor-only expiry cannot stand in for a report the runner never wrote.
1370
+
1371
+ Most tests never start Nx. Plugin behaviour is the value `createNodesV2` returns, so a test asserts on that value, and
1372
+ where it needs Nx's verdict on it, it calls the Nx function that gives the verdict, in process: `createTaskGraph` for
1373
+ the order a run-many runs tasks in, `getOutputsForTargetAndConfiguration` for what a cache hit restores,
1374
+ `globWithWorkspaceContextSync` for the files a fileset input hashes, and a `runtime` input's command under `sh -c` from
1375
+ the workspace root for the value Nx keys on. `smoo-nx-exec`'s decisions are functions of Nx-shaped data — selector and
1376
+ arguments, the environment it hands Nx, the daemon's file table and output verdicts, the cache records, the artifact
1377
+ tree a restore would leave — and are called directly; its process handling (stdio, exit status, signals, cwd, `execve`)
1378
+ runs against a stand-in `nx` script with the daemon off, which loads no Nx at all. A test starts `nx` only when that
1379
+ process is the subject: a fresh daemon serving `smoo-nx-exec`'s probe (outputs it holds no record of, and the socket it
1380
+ binds for a root entered from another workspace's shell), daemon-hosted plugin workers, task history, a hunk of the
1381
+ repository's Nx patch, and fixture teardown.
1382
+
1383
+ A test that runs real Nx in a temp workspace runs it daemonless unless the daemon is the behaviour under test: a
1384
+ daemonless Nx leaves nothing running once it exits. A daemon a fixture does start works in the fixture root, idling and
1385
+ watching files until something stops it, so `@smoothbricks/nx-plugin/testing` (used by this package's and the CLI's
1386
+ tests) owns those roots:
1387
+
1388
+ - `ownedFixtureRoot(parentDirectory, suite, prefix)` creates a root in the run directory of the test process that owns
1389
+ it, `<parentDirectory>/smoothbricks-fixtures/<suite>/run-<pid>`. The caller always names the parent: `tmpdir()`, or
1390
+ the directory of the volume a fixture has to lie on. The parent is resolved through every link first, so one spelled
1391
+ two ways is one run, and a process holds one run for each parent and suite. The first root a process creates for a
1392
+ suite under a parent first reclaims every run of that suite there whose owner pid is gone: each process working in it
1393
+ gets SIGTERM (SIGKILL if it outlives 10 s); once all have exited, every socket alias naming a workspace of that run
1394
+ (see `publishFixtureSocketDirectory`) is unlinked, whether that workspace still exists or not, then the run is
1395
+ deleted. A run whose owner is alive is never touched by another process, and other entries of the socket namespace are
1396
+ left alone. A killed process therefore leaves what it owned in a `run-<pid>` of its own, inside that parent's
1397
+ `smoothbricks-fixtures` directory, never as a bare prefix among whatever else the parent holds, and the next process
1398
+ to use that parent and suite reclaims it. The owner itself, on SIGTERM, SIGINT or SIGHUP (a bounded test leg's timeout
1399
+ sends SIGTERM, then SIGKILL 10 s later), first stops whatever still works in every run it holds, all at once, and
1400
+ makes no new root meanwhile; a repeated signal waits for that. Then it dies of the first signal it got.
1401
+ - `reclaimDeadFixtureRuns(parentDirectory, suite)` runs that sweep on demand, for a test that has just watched a
1402
+ fixture-owning process die.
1403
+ - `fixtureSocketDirectory(workspace)` names, without creating anything, the `nx` socket leaf below a short parent alias
1404
+ in the sandbox's socket namespace (`socketNamespace`). The alias is named for a hash of the workspace's physical path,
1405
+ so every client and daemon stop of a workspace names the same leaf, and no two fixtures share one. A namespace too
1406
+ small for Nx's longest socket name is refused here, before anything is published.
1407
+ - `publishFixtureSocketDirectory(workspace)` makes that alias and returns the leaf. The workspace must be a physical
1408
+ directory in a run this process holds (`ownedFixtureRoot`), so the run's sweep can reclaim the alias if the process
1409
+ dies; anything else is refused. The alias points at the fixture's own `.nx/sockets` (mode 0700, never through a
1410
+ symlinked `.nx`); Nx makes the real `nx` leaf. This package's `withNxFixture` publishes its workspace and passes the
1411
+ directory to the body, and the CLI's `runFixtureNx` publishes each root it runs in. Both `fixtureNxEnv`s take the
1412
+ directory as an argument and publish nothing.
1413
+ - `ownedWorkspaceSocketDirectory(workspace, slot)` creates the real leaf `a` or `b` beside `nx` below a published alias,
1414
+ for tests of multiple daemon socket directories. Its caller stops the daemon before removing the leaf.
1415
+ - `retireFixtureSocketDirectory(workspace)` unlinks only the verified parent alias after the daemon exits, named from
1416
+ the workspace's path alone, so a deleted workspace retires too. A colliding non-symlink or retargeted alias refuses
1417
+ instead of removing another owner's entry; removing the fixture root reclaims its physical socket directories.
1418
+ - `stopNxDaemon(workspace, stop)` runs the caller's `nx daemon --stop` and waits until the daemon recorded in
1419
+ `<workspace>/.nx/workspace-data/d/server-process.json`, and its descendants, has exited, then ends every process still
1420
+ working in the workspace. That final census also catches editor probes reparented when the daemon exits.
1421
+
1422
+ A fixture retires on every exit path, a throwing body included: stop its daemon, unlink its socket alias, then delete
1423
+ its root. A daemon that outlives the stop keeps the alias and the root, so the next run's sweep still finds both.
1424
+
588
1425
  ## Managed workspace files
589
1426
 
590
1427
  `nx generate @smoothbricks/nx-plugin:managed-files` stages the same managed files as `smoo monorepo update`, without
@@ -595,6 +1432,46 @@ The plugin owns the packaged templates, pure rendering and content-preservation
595
1432
  files through Nx `Tree` and uses Nx's resolved project graph for inferred targets. The CLI only supplies the filesystem
596
1433
  and process boundary. There is no separate serialized change plan.
597
1434
 
1435
+ The idempotence witness compares the second pass's managed-target roster with the populated first pass before checking
1436
+ unchanged actions, an empty staged diff and retained bytes. An empty result is not evidence that generation inspected
1437
+ the managed files.
1438
+
598
1439
  Files with a `# smoo-local` tail or `# smoo-local-begin` / `# smoo-local-end` blocks retain those sections. Matching
599
1440
  source symlinks are preserved; conflicting local blocks and broken or external links are reported instead of
600
1441
  overwritten. The generator does not remove a repository-owned file when a capability is disabled.
1442
+
1443
+ ### Workflow security and bounded execution
1444
+
1445
+ Managed action references use full commit SHAs with their release tags in comments. Read-only jobs explicitly set
1446
+ `persist-credentials: false`; checkout includes the required history and blobs so later private historical reads do not
1447
+ need credentials left in Git configuration. Jobs that push release or managed-file refs retain credentials explicitly,
1448
+ with their reason beside checkout. A platform producer that fetches a private release-candidate ref also requires
1449
+ authenticated Git transport; its checkout names that reason.
1450
+
1451
+ | Job | Persist checkout credentials | Reason |
1452
+ | ----------------------------------------------------------------- | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1453
+ | Validate, E2E, cross-test execution, deploy-only, preview cleanup | No | Complete history and blobs make historical reads local; these jobs do not push or fetch later private refs. |
1454
+ | Linux release candidate | No | The candidate is versioned locally and transferred as a Git bundle, not pushed. |
1455
+ | macOS / cross-platform release producer | Yes | `releaseCollectPlatformOutputs` fetches private candidate/repair refs after checkout (`packages/cli/src/release/index.ts:335`); a full initial clone cannot contain refs created later. |
1456
+ | Release publisher and pending-release healer | Yes | Publishing and repair fetch and push release refs. |
1457
+ | Managed-file healer | Yes | It pushes the regenerated review branch. |
1458
+
1459
+ Job timeouts remain generous and finite: Validate and compact release jobs use 45 minutes; Apple/cross-platform
1460
+ production and combined platform releases use 90 minutes to accommodate cold native builds; production deployment and
1461
+ managed-file healing use 30 minutes; deployed E2E and preview cleanup use 15 minutes. Cross-target test execution uses
1462
+ 30 minutes. These are job hang bounds, not replacements for package test deadlines.
1463
+
1464
+ Forgejo artifact steps use managed local JavaScript actions, not GitHub clients or absolute `uses:` URLs. They fetch and
1465
+ verify the pinned GHES-gate-free upstream commit before running its original bundled entry point under the runner's Node
1466
+ runtime. This preserves artifact inputs, outputs and execution conditions while allowing the unchanged jactionlint
1467
+ default rules to validate the same workflow grammar for both providers.
1468
+
1469
+ A configured flattened producer runs its preflight even when no platform family matches. Its declared environment is
1470
+ merged directly into every emitted step of its producer job; step-local fields take precedence. Producer names are
1471
+ encoded as YAML strings so identifiers such as `TRUE` and `NULL` retain their exact spelling, not scalar coercions.
1472
+ Runner-dependent values are evaluated in the valid step-level context, not job env. No producer value is exported
1473
+ through `GITHUB_ENV`: GitHub
1474
+ [forbids setting `NODE_OPTIONS` through that environment file](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#setting-an-environment-variable).
1475
+ If a declaration name cannot be carried, generation fails with that name in the diagnostic instead of silently dropping
1476
+ it. Conditional preflight and platform-build steps are numbered from the actual emitted job sequence, so every following
1477
+ step anchor remains exact.