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