@smoothbricks/nx-plugin 0.5.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1086 -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/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 +672 -214
- 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 +16 -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/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 +788 -224
- 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 +122 -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/all-verdicts/executor.test.ts +0 -135
- 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 -3321
- 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
|
@@ -1,519 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it } from 'bun:test';
|
|
2
|
-
import { rmSync } from 'node:fs';
|
|
3
|
-
import { createServer, type Server, type Socket } from 'node:net';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { ownedSocketDirectory } from '../../testing.js';
|
|
6
|
-
import { CPU_TOKENS_ENV, gatewayCpuBudget, parseInheritedTokens, runnerDemand, sizeRunner } from './cpu-tokens.js';
|
|
7
|
-
|
|
8
|
-
const servers: Server[] = [];
|
|
9
|
-
const directories: string[] = [];
|
|
10
|
-
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
for (const server of servers.splice(0)) {
|
|
13
|
-
server.close();
|
|
14
|
-
}
|
|
15
|
-
for (const directory of directories.splice(0)) {
|
|
16
|
-
rmSync(directory, { recursive: true, force: true });
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* A socket path in a directory of its own, made in the socket namespace the sandbox admits for Unix
|
|
22
|
-
* sockets: a literal `/tmp` path binds, but no sandboxed process may connect to it, so a client of it
|
|
23
|
-
* would see a refusal in place of the absent socket or the gateway the test means.
|
|
24
|
-
*/
|
|
25
|
-
async function socketPath(name: string): Promise<string> {
|
|
26
|
-
const directory = await ownedSocketDirectory('cpu-', name);
|
|
27
|
-
directories.push(directory);
|
|
28
|
-
return join(directory, name);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** A gateway stand-in on a socket in a directory of its own that runs `serve` per client. */
|
|
32
|
-
async function gateway(serve: (client: Socket) => void): Promise<string> {
|
|
33
|
-
const socket = await socketPath('gw.sock');
|
|
34
|
-
const server = createServer({ allowHalfOpen: true }, serve);
|
|
35
|
-
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
|
36
|
-
server.once('error', reject);
|
|
37
|
-
server.listen(socket, resolve);
|
|
38
|
-
await promise;
|
|
39
|
-
server.off('error', reject);
|
|
40
|
-
servers.push(server);
|
|
41
|
-
return socket;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** The runner command the plugin infers for a nextest piece, as `index.ts` builds it. */
|
|
45
|
-
const NEXTEST_PIECE =
|
|
46
|
-
`extracted="$(node node_modules/@smoothbricks/nx-plugin/dist/bin/smoo-nx-nextest-extract.js .cache/nextest/archive.tar.zst)" && ` +
|
|
47
|
-
`cargo --frozen nextest run --binaries-metadata "$extracted/m.json" --workspace-remap . -E 'package(core)' --partition hash:1/5 --no-tests=pass`;
|
|
48
|
-
|
|
49
|
-
/** The test-thread ceilings of a run whose environment names none. */
|
|
50
|
-
const NO_CEILINGS = { rust: null, nextest: null };
|
|
51
|
-
|
|
52
|
-
describe('cowshed CPU budget client', () => {
|
|
53
|
-
it('asks for what each runner would run at once', () => {
|
|
54
|
-
expect(runnerDemand(NEXTEST_PIECE, undefined, 18, {})).toEqual({ kind: 'nextest', want: 18 });
|
|
55
|
-
expect(runnerDemand('cargo-nextest nextest run --archive-file a.tar.zst', undefined, 12, {})).toEqual({
|
|
56
|
-
kind: 'nextest',
|
|
57
|
-
want: 12,
|
|
58
|
-
});
|
|
59
|
-
expect(runnerDemand('cargo nextest run --test-threads=4', undefined, 18, {})).toEqual({ kind: 'nextest', want: 4 });
|
|
60
|
-
// `--no-capture` runs tests serially and ignores `--test-threads`: a host smoke of one test asks for one
|
|
61
|
-
// token, not one per core it would hold idle while its own scratch jobs queue for the host's tokens.
|
|
62
|
-
const smoke =
|
|
63
|
-
"cargo --frozen nextest run --archive-file a.tar.zst -E 'test(smoke)' --run-ignored only --no-capture";
|
|
64
|
-
expect(runnerDemand(smoke, undefined, 18, {})).toEqual({ kind: 'nextest', want: 1 });
|
|
65
|
-
expect(runnerDemand(`${smoke} --test-threads 4`, undefined, 18, {})).toEqual({ kind: 'nextest', want: 1 });
|
|
66
|
-
expect(runnerDemand('cargo nextest run -E all() -- --nocapture', undefined, 18, {})).toEqual({
|
|
67
|
-
kind: 'nextest',
|
|
68
|
-
want: 1,
|
|
69
|
-
});
|
|
70
|
-
// A flag that only shares the prefix is not it.
|
|
71
|
-
expect(runnerDemand('cargo nextest run --no-capture-x', undefined, 18, {})).toEqual({ kind: 'nextest', want: 18 });
|
|
72
|
-
// The same words in a cargo build are not nextest's.
|
|
73
|
-
expect(runnerDemand('cargo test --workspace -- --nocapture', undefined, 18, {})).toEqual({
|
|
74
|
-
kind: 'cargo',
|
|
75
|
-
want: 18,
|
|
76
|
-
testThreads: NO_CEILINGS,
|
|
77
|
-
});
|
|
78
|
-
expect(runnerDemand('bun test --timeout=0 --parallel=3', undefined, 18, {})).toEqual({
|
|
79
|
-
kind: 'bun-parallel',
|
|
80
|
-
want: 3,
|
|
81
|
-
});
|
|
82
|
-
expect(runnerDemand('bun test --parallel ./a.test.ts', undefined, 18, {})).toEqual({
|
|
83
|
-
kind: 'bun-parallel',
|
|
84
|
-
want: 18,
|
|
85
|
-
});
|
|
86
|
-
// A runtime pinned by path is the same runner.
|
|
87
|
-
expect(runnerDemand('../bun-runtime/.runtime/bun test --parallel=5', undefined, 18, {})).toEqual({
|
|
88
|
-
kind: 'bun-parallel',
|
|
89
|
-
want: 5,
|
|
90
|
-
});
|
|
91
|
-
// One bun process: `test.concurrent` inside it is not another CPU.
|
|
92
|
-
expect(runnerDemand('bun test --timeout=0 native.test.ts', undefined, 18, {})).toEqual({
|
|
93
|
-
kind: 'process',
|
|
94
|
-
want: 1,
|
|
95
|
-
testThreads: NO_CEILINGS,
|
|
96
|
-
});
|
|
97
|
-
expect(runnerDemand('cargo --frozen test --workspace', undefined, 18, {})).toEqual({
|
|
98
|
-
kind: 'cargo',
|
|
99
|
-
want: 18,
|
|
100
|
-
testThreads: NO_CEILINGS,
|
|
101
|
-
});
|
|
102
|
-
expect(runnerDemand('napi build --platform --release', undefined, 8, {})).toEqual({
|
|
103
|
-
kind: 'cargo',
|
|
104
|
-
want: 8,
|
|
105
|
-
testThreads: NO_CEILINGS,
|
|
106
|
-
});
|
|
107
|
-
expect(runnerDemand('bun scripts/test-shard.ts 3', undefined, 18, {})).toEqual({
|
|
108
|
-
kind: 'process',
|
|
109
|
-
want: 1,
|
|
110
|
-
testThreads: NO_CEILINGS,
|
|
111
|
-
});
|
|
112
|
-
// A declared parallelism outranks what the command names, within inherited ceilings.
|
|
113
|
-
expect(runnerDemand('bun scripts/test-shard.ts 3', 2, 18, {})).toEqual({
|
|
114
|
-
kind: 'process',
|
|
115
|
-
want: 2,
|
|
116
|
-
testThreads: NO_CEILINGS,
|
|
117
|
-
});
|
|
118
|
-
expect(runnerDemand('cargo nextest run --test-threads=4', 6, 18, {})).toEqual({ kind: 'nextest', want: 6 });
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it("asks for Stryker's --concurrency, else its own default of one worker per core less one past four cores", () => {
|
|
122
|
-
expect(runnerDemand('bun stryker run --concurrency 4', undefined, 18, {})).toEqual({ kind: 'stryker', want: 4 });
|
|
123
|
-
expect(runnerDemand('bun stryker run -c 6', undefined, 18, {})).toEqual({ kind: 'stryker', want: 6 });
|
|
124
|
-
expect(runnerDemand('npx stryker run --concurrency=3', undefined, 18, {})).toEqual({ kind: 'stryker', want: 3 });
|
|
125
|
-
expect(runnerDemand('../../node_modules/.bin/stryker run -c 2', undefined, 18, {})).toEqual({
|
|
126
|
-
kind: 'stryker',
|
|
127
|
-
want: 2,
|
|
128
|
-
});
|
|
129
|
-
// Stryker takes the last count it is given.
|
|
130
|
-
expect(runnerDemand('bun stryker run -c 8 --concurrency 5', undefined, 18, {})).toEqual({
|
|
131
|
-
kind: 'stryker',
|
|
132
|
-
want: 5,
|
|
133
|
-
});
|
|
134
|
-
// A share is of the cores, and never less than one worker.
|
|
135
|
-
expect(runnerDemand('bun stryker run --concurrency=50%', undefined, 18, {})).toEqual({ kind: 'stryker', want: 9 });
|
|
136
|
-
expect(runnerDemand('bun stryker run --concurrency 0%', undefined, 18, {})).toEqual({ kind: 'stryker', want: 1 });
|
|
137
|
-
// Stryker's default, which sized nightly 477's sweeps to the whole host: n - 1 past four cores, else n.
|
|
138
|
-
expect(runnerDemand('bun stryker run', undefined, 32, {})).toEqual({ kind: 'stryker', want: 31 });
|
|
139
|
-
expect(runnerDemand('bun stryker run', undefined, 18, {})).toEqual({ kind: 'stryker', want: 17 });
|
|
140
|
-
expect(runnerDemand('bun stryker run', undefined, 4, {})).toEqual({ kind: 'stryker', want: 4 });
|
|
141
|
-
// Another command's `-c` in the same line is not Stryker's.
|
|
142
|
-
expect(runnerDemand('ulimit -c 0 && bun stryker run', undefined, 18, {})).toEqual({ kind: 'stryker', want: 17 });
|
|
143
|
-
expect(runnerDemand('bun stryker run && nice -c 3 true', undefined, 18, {})).toEqual({ kind: 'stryker', want: 17 });
|
|
144
|
-
// A declared parallelism outranks the flag.
|
|
145
|
-
expect(runnerDemand('bun stryker run --concurrency 8', 2, 18, {})).toEqual({ kind: 'stryker', want: 2 });
|
|
146
|
-
// A test file named for Stryker is one bun process.
|
|
147
|
-
expect(runnerDemand('bun test stryker.test.ts', undefined, 18, {})).toEqual({
|
|
148
|
-
kind: 'process',
|
|
149
|
-
want: 1,
|
|
150
|
-
testThreads: NO_CEILINGS,
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it("asks for Vitest's --maxWorkers and go test's -p, else each runner's own per-core default", () => {
|
|
155
|
-
// Vitest outside watch mode runs one worker per core less one.
|
|
156
|
-
expect(runnerDemand('bun vitest run', undefined, 18, {})).toEqual({ kind: 'vitest', want: 17 });
|
|
157
|
-
expect(runnerDemand('bun vitest run --config vitest.config.workers.ts', undefined, 18, {})).toEqual({
|
|
158
|
-
kind: 'vitest',
|
|
159
|
-
want: 17,
|
|
160
|
-
});
|
|
161
|
-
expect(runnerDemand('bun vitest run --maxWorkers=4', undefined, 18, {})).toEqual({ kind: 'vitest', want: 4 });
|
|
162
|
-
expect(runnerDemand('vitest run --max-workers 50%', undefined, 18, {})).toEqual({ kind: 'vitest', want: 9 });
|
|
163
|
-
expect(runnerDemand('bun vitest run --no-file-parallelism', undefined, 18, {})).toEqual({
|
|
164
|
-
kind: 'vitest',
|
|
165
|
-
want: 1,
|
|
166
|
-
});
|
|
167
|
-
// `go test -p` defaults to GOMAXPROCS, normally one per core.
|
|
168
|
-
expect(runnerDemand('go test -count=1 ./hts/... ./host/...', undefined, 18, {})).toEqual({
|
|
169
|
-
kind: 'go-test',
|
|
170
|
-
want: 18,
|
|
171
|
-
});
|
|
172
|
-
expect(runnerDemand('cd go/ttscwire && go test ./...', undefined, 18, { GOMAXPROCS: '4' })).toEqual({
|
|
173
|
-
kind: 'go-test',
|
|
174
|
-
want: 4,
|
|
175
|
-
});
|
|
176
|
-
expect(runnerDemand('go test -p 3 -parallel 8 ./...', undefined, 18, {})).toEqual({ kind: 'go-test', want: 3 });
|
|
177
|
-
// A shell word that is no count leaves the runner's default; it is still sized by the grant.
|
|
178
|
-
expect(runnerDemand('bun ../scripts/gen-go-work.mjs && go test ./... -p="$(nproc)"', undefined, 18, {})).toEqual({
|
|
179
|
-
kind: 'go-test',
|
|
180
|
-
want: 18,
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
it("asks for cargo-mutants' own jobserver, one task per core unless --jobserver-tasks names fewer", () => {
|
|
185
|
-
// The plugin's inferred `mutation` command, with no flag: `--jobs` defaults to one cargo process, but its
|
|
186
|
-
// jobserver defaults to one task per core (`n_tasks=<cores>`), shared by every cargo that process starts.
|
|
187
|
-
expect(runnerDemand('cargo --frozen mutants --workspace', undefined, 18, {})).toEqual({
|
|
188
|
-
kind: 'cargo-mutants',
|
|
189
|
-
want: 18,
|
|
190
|
-
jobs: 1,
|
|
191
|
-
});
|
|
192
|
-
// `--jobs` counts cargo processes, which still share that per-core jobserver.
|
|
193
|
-
expect(runnerDemand('cargo mutants --jobs 4', undefined, 18, {})).toEqual({
|
|
194
|
-
kind: 'cargo-mutants',
|
|
195
|
-
want: 18,
|
|
196
|
-
jobs: 4,
|
|
197
|
-
});
|
|
198
|
-
expect(runnerDemand('cargo mutants --jobserver-tasks 4', undefined, 18, {})).toEqual({
|
|
199
|
-
kind: 'cargo-mutants',
|
|
200
|
-
want: 4,
|
|
201
|
-
jobs: 1,
|
|
202
|
-
});
|
|
203
|
-
expect(runnerDemand('cargo mutants -j2 --jobserver-tasks=4', undefined, 18, {})).toEqual({
|
|
204
|
-
kind: 'cargo-mutants',
|
|
205
|
-
want: 4,
|
|
206
|
-
jobs: 2,
|
|
207
|
-
});
|
|
208
|
-
// Each cargo process runs at least one thread, whatever the jobserver allows.
|
|
209
|
-
expect(runnerDemand('cargo mutants --jobs=6 --jobserver-tasks 4', undefined, 18, {})).toEqual({
|
|
210
|
-
kind: 'cargo-mutants',
|
|
211
|
-
want: 6,
|
|
212
|
-
jobs: 6,
|
|
213
|
-
});
|
|
214
|
-
// `CARGO_MUTANTS_JOBS` as the command will see it: the target's own environment over the inherited one.
|
|
215
|
-
expect(runnerDemand('cargo mutants --jobserver-tasks 4', undefined, 18, { CARGO_MUTANTS_JOBS: '3' })).toEqual({
|
|
216
|
-
kind: 'cargo-mutants',
|
|
217
|
-
want: 4,
|
|
218
|
-
jobs: 3,
|
|
219
|
-
});
|
|
220
|
-
expect(
|
|
221
|
-
runnerDemand(
|
|
222
|
-
'cargo mutants --jobserver-tasks 4',
|
|
223
|
-
undefined,
|
|
224
|
-
18,
|
|
225
|
-
{ CARGO_MUTANTS_JOBS: '3' },
|
|
226
|
-
{ CARGO_MUTANTS_JOBS: '2' },
|
|
227
|
-
),
|
|
228
|
-
).toEqual({ kind: 'cargo-mutants', want: 4, jobs: 2 });
|
|
229
|
-
expect(runnerDemand('cargo-mutants mutants --in-diff pr.diff', undefined, 12, {})).toEqual({
|
|
230
|
-
kind: 'cargo-mutants',
|
|
231
|
-
want: 12,
|
|
232
|
-
jobs: 1,
|
|
233
|
-
});
|
|
234
|
-
// Another command's `-j` in the same line is not cargo-mutants'.
|
|
235
|
-
expect(runnerDemand('cargo mutants --jobserver-tasks 4 && make -j 9', undefined, 18, {})).toEqual({
|
|
236
|
-
kind: 'cargo-mutants',
|
|
237
|
-
want: 4,
|
|
238
|
-
jobs: 1,
|
|
239
|
-
});
|
|
240
|
-
expect(runnerDemand('cargo mutants', 3, 18, {})).toEqual({ kind: 'cargo-mutants', want: 3, jobs: 1 });
|
|
241
|
-
// A package named `mutants` is an ordinary cargo build.
|
|
242
|
-
expect(runnerDemand('cargo test -p mutants', undefined, 18, {})).toEqual({
|
|
243
|
-
kind: 'cargo',
|
|
244
|
-
want: 18,
|
|
245
|
-
testThreads: NO_CEILINGS,
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
it('sizes the worker-flag runners and cargo-mutants to their grant', () => {
|
|
250
|
-
expect(sizeRunner({ kind: 'stryker', want: 17 }, 'bun stryker run', 4)).toEqual({
|
|
251
|
-
command: 'bun stryker run --concurrency=4',
|
|
252
|
-
env: { [CPU_TOKENS_ENV]: '4' },
|
|
253
|
-
});
|
|
254
|
-
expect(sizeRunner({ kind: 'stryker', want: 8 }, 'bun stryker run -c 8 --fileLogLevel off', 3).command).toBe(
|
|
255
|
-
'bun stryker run --concurrency=3 --fileLogLevel off',
|
|
256
|
-
);
|
|
257
|
-
expect(
|
|
258
|
-
sizeRunner({ kind: 'stryker', want: 8 }, 'ulimit -c 0 && bun stryker run --concurrency 8 && echo done', 2)
|
|
259
|
-
.command,
|
|
260
|
-
).toBe('ulimit -c 0 && bun stryker run --concurrency=2 && echo done');
|
|
261
|
-
// A grant larger than the ask sizes to the ask.
|
|
262
|
-
expect(sizeRunner({ kind: 'stryker', want: 4 }, 'bun stryker run --concurrency=4', 9).command).toBe(
|
|
263
|
-
'bun stryker run --concurrency=4',
|
|
264
|
-
);
|
|
265
|
-
expect(sizeRunner({ kind: 'cargo-mutants', want: 18, jobs: 1 }, 'cargo --frozen mutants --workspace', 5)).toEqual({
|
|
266
|
-
command: 'cargo --frozen mutants --jobserver-tasks=5 --workspace',
|
|
267
|
-
env: { [CPU_TOKENS_ENV]: '5', CARGO_BUILD_JOBS: '5', RUST_TEST_THREADS: '5', NEXTEST_TEST_THREADS: '5' },
|
|
268
|
-
});
|
|
269
|
-
// Its cargo processes share the grant: each tests on its share, and there are never more of them than tokens.
|
|
270
|
-
expect(
|
|
271
|
-
sizeRunner({ kind: 'cargo-mutants', want: 18, jobs: 4 }, 'cargo mutants --jobs 4 --jobserver-tasks 18', 8),
|
|
272
|
-
).toEqual({
|
|
273
|
-
command: 'cargo mutants --jobs=4 --jobserver-tasks=8',
|
|
274
|
-
env: {
|
|
275
|
-
[CPU_TOKENS_ENV]: '8',
|
|
276
|
-
CARGO_MUTANTS_JOBS: '4',
|
|
277
|
-
CARGO_BUILD_JOBS: '2',
|
|
278
|
-
RUST_TEST_THREADS: '2',
|
|
279
|
-
NEXTEST_TEST_THREADS: '2',
|
|
280
|
-
},
|
|
281
|
-
});
|
|
282
|
-
expect(sizeRunner({ kind: 'cargo-mutants', want: 18, jobs: 4 }, 'cargo mutants -j4', 2)).toEqual({
|
|
283
|
-
command: 'cargo mutants --jobserver-tasks=2 --jobs=2',
|
|
284
|
-
env: {
|
|
285
|
-
[CPU_TOKENS_ENV]: '2',
|
|
286
|
-
CARGO_MUTANTS_JOBS: '2',
|
|
287
|
-
CARGO_BUILD_JOBS: '1',
|
|
288
|
-
RUST_TEST_THREADS: '1',
|
|
289
|
-
NEXTEST_TEST_THREADS: '1',
|
|
290
|
-
},
|
|
291
|
-
});
|
|
292
|
-
// `--jobs` is never added: cargo-mutants refuses it beside `--in-place`.
|
|
293
|
-
expect(sizeRunner({ kind: 'cargo-mutants', want: 18, jobs: 1 }, 'cargo mutants --in-place', 3).command).toBe(
|
|
294
|
-
'cargo mutants --jobserver-tasks=3 --in-place',
|
|
295
|
-
);
|
|
296
|
-
expect(sizeRunner({ kind: 'vitest', want: 17 }, 'bun vitest run --config vitest.config.workers.ts', 3)).toEqual({
|
|
297
|
-
command: 'bun vitest run --maxWorkers=3 --config vitest.config.workers.ts',
|
|
298
|
-
env: { [CPU_TOKENS_ENV]: '3' },
|
|
299
|
-
});
|
|
300
|
-
expect(sizeRunner({ kind: 'vitest', want: 4 }, 'bun vitest run --maxWorkers 4', 2).command).toBe(
|
|
301
|
-
'bun vitest run --maxWorkers=2',
|
|
302
|
-
);
|
|
303
|
-
expect(
|
|
304
|
-
sizeRunner({ kind: 'go-test', want: 18 }, 'bun ../scripts/gen-go-work.mjs && go test ./... -p="$(nproc)"', 4)
|
|
305
|
-
.command,
|
|
306
|
-
).toBe('bun ../scripts/gen-go-work.mjs && go test ./... -p=4');
|
|
307
|
-
expect(sizeRunner({ kind: 'go-test', want: 18 }, 'cd go/ttscwire && go test ./...', 2).command).toBe(
|
|
308
|
-
'cd go/ttscwire && go test -p=2 ./...',
|
|
309
|
-
);
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
it('sizes each runner to its grant', () => {
|
|
313
|
-
expect(sizeRunner({ kind: 'nextest', want: 18 }, NEXTEST_PIECE, 5)).toEqual({
|
|
314
|
-
command: NEXTEST_PIECE,
|
|
315
|
-
env: { [CPU_TOKENS_ENV]: '5', NEXTEST_TEST_THREADS: '5' },
|
|
316
|
-
});
|
|
317
|
-
expect(sizeRunner({ kind: 'nextest', want: 16 }, 'cargo nextest run --test-threads 16 -E all()', 3).command).toBe(
|
|
318
|
-
'cargo nextest run --test-threads=3 -E all()',
|
|
319
|
-
);
|
|
320
|
-
expect(sizeRunner({ kind: 'bun-parallel', want: 3 }, 'bun test --parallel=3 --timeout=1', 2)).toEqual({
|
|
321
|
-
command: 'bun test --parallel=2 --timeout=1',
|
|
322
|
-
env: { [CPU_TOKENS_ENV]: '2' },
|
|
323
|
-
});
|
|
324
|
-
expect(sizeRunner({ kind: 'bun-parallel', want: 18 }, 'bun test --parallel', 7).command).toBe(
|
|
325
|
-
'bun test --parallel=7',
|
|
326
|
-
);
|
|
327
|
-
// Cargo's rustc count is its pool's jobserver fifo, never a `CARGO_BUILD_JOBS` from the grant; its test threads
|
|
328
|
-
// take no token, so they are sized here, libtest's and nextest's alike.
|
|
329
|
-
expect(sizeRunner({ kind: 'cargo', want: 18, testThreads: NO_CEILINGS }, 'cargo test', 4).env).toEqual({
|
|
330
|
-
[CPU_TOKENS_ENV]: '4',
|
|
331
|
-
RUST_TEST_THREADS: '4',
|
|
332
|
-
NEXTEST_TEST_THREADS: '4',
|
|
333
|
-
});
|
|
334
|
-
expect(sizeRunner({ kind: 'process', want: 1, testThreads: NO_CEILINGS }, 'bun scripts/x.ts', 1)).toEqual({
|
|
335
|
-
command: 'bun scripts/x.ts',
|
|
336
|
-
env: { [CPU_TOKENS_ENV]: '1', RUST_TEST_THREADS: '1', NEXTEST_TEST_THREADS: '1' },
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
it("sizes a process's test threads to its held grant, under inherited and configured ceilings", () => {
|
|
341
|
-
// A script's own `cargo test` takes rustc tokens from the executor's jobserver fifo, but its test threads take
|
|
342
|
-
// none, so the executor sets them to the whole grant the process holds.
|
|
343
|
-
const unbounded = runnerDemand('bun scripts/x.ts', 5, 18, {});
|
|
344
|
-
expect(unbounded).toEqual({ kind: 'process', want: 5, testThreads: NO_CEILINGS });
|
|
345
|
-
expect(sizeRunner(unbounded, 'bun scripts/x.ts', 5)).toEqual({
|
|
346
|
-
command: 'bun scripts/x.ts',
|
|
347
|
-
env: { [CPU_TOKENS_ENV]: '5', RUST_TEST_THREADS: '5', NEXTEST_TEST_THREADS: '5' },
|
|
348
|
-
});
|
|
349
|
-
const capped = runnerDemand(
|
|
350
|
-
'bun scripts/x.ts',
|
|
351
|
-
5,
|
|
352
|
-
18,
|
|
353
|
-
{ RUST_TEST_THREADS: '4', NEXTEST_TEST_THREADS: '3' },
|
|
354
|
-
{ RUST_TEST_THREADS: '2', NEXTEST_TEST_THREADS: '64' },
|
|
355
|
-
);
|
|
356
|
-
// A configured count lowers an inherited ceiling and never raises it.
|
|
357
|
-
expect(capped).toEqual({ kind: 'process', want: 5, testThreads: { rust: 2, nextest: 3 } });
|
|
358
|
-
expect(sizeRunner(capped, 'bun scripts/x.ts', 5).env).toEqual({
|
|
359
|
-
[CPU_TOKENS_ENV]: '5',
|
|
360
|
-
RUST_TEST_THREADS: '2',
|
|
361
|
-
NEXTEST_TEST_THREADS: '3',
|
|
362
|
-
});
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
it('treats inherited runner bounds as ceilings even under larger grants', () => {
|
|
366
|
-
const inherited = { NEXTEST_TEST_THREADS: '6', CARGO_BUILD_JOBS: '4', RUST_TEST_THREADS: '2' };
|
|
367
|
-
const configured = { NEXTEST_TEST_THREADS: '64', CARGO_BUILD_JOBS: '64', RUST_TEST_THREADS: '64' };
|
|
368
|
-
const nextest = runnerDemand('cargo nextest run --test-threads=18', 18, 18, inherited, configured);
|
|
369
|
-
const cargo = runnerDemand('cargo test', 18, 18, inherited, configured);
|
|
370
|
-
expect(nextest).toEqual({ kind: 'nextest', want: 6 });
|
|
371
|
-
expect(cargo).toEqual({ kind: 'cargo', want: 4, testThreads: { rust: 2, nextest: 6 } });
|
|
372
|
-
for (const tokens of [15, 18]) {
|
|
373
|
-
expect(sizeRunner(nextest, 'cargo nextest run --test-threads=18', tokens)).toEqual({
|
|
374
|
-
command: 'cargo nextest run --test-threads=6',
|
|
375
|
-
env: { [CPU_TOKENS_ENV]: String(tokens), NEXTEST_TEST_THREADS: '6' },
|
|
376
|
-
});
|
|
377
|
-
expect(sizeRunner(cargo, 'cargo test', tokens).env).toEqual({
|
|
378
|
-
[CPU_TOKENS_ENV]: String(tokens),
|
|
379
|
-
RUST_TEST_THREADS: '2',
|
|
380
|
-
NEXTEST_TEST_THREADS: '4',
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
expect(sizeRunner(nextest, NEXTEST_PIECE, 3).env.NEXTEST_TEST_THREADS).toBe('3');
|
|
384
|
-
expect(sizeRunner(cargo, 'cargo test', 3).env).toEqual({
|
|
385
|
-
[CPU_TOKENS_ENV]: '3',
|
|
386
|
-
RUST_TEST_THREADS: '2',
|
|
387
|
-
NEXTEST_TEST_THREADS: '3',
|
|
388
|
-
});
|
|
389
|
-
expect(runnerDemand(NEXTEST_PIECE, 18, 18, inherited, { NEXTEST_TEST_THREADS: '2' }).want).toBe(2);
|
|
390
|
-
expect(runnerDemand('cargo build', 18, 18, {}, { CARGO_BUILD_JOBS: '4' }).want).toBe(4);
|
|
391
|
-
expect(runnerDemand(NEXTEST_PIECE, 18, 18, { NEXTEST_TEST_THREADS: '0' }).want).toBe(18);
|
|
392
|
-
});
|
|
393
|
-
|
|
394
|
-
it('reads an inherited count only as a positive safe integer', () => {
|
|
395
|
-
expect(parseInheritedTokens(undefined)).toBeNull();
|
|
396
|
-
for (const invalid of ['', '0', '-1', '1.5', '2e3', '0x10', ' 3', '3 ', '03', 'three', '9007199254740993']) {
|
|
397
|
-
expect(parseInheritedTokens(invalid)).toBeNull();
|
|
398
|
-
}
|
|
399
|
-
expect(parseInheritedTokens('1')).toBe(1);
|
|
400
|
-
expect(parseInheritedTokens('16')).toBe(16);
|
|
401
|
-
expect(parseInheritedTokens(String(Number.MAX_SAFE_INTEGER))).toBe(Number.MAX_SAFE_INTEGER);
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
it('reads back the count a runner was sized to', () => {
|
|
405
|
-
expect(
|
|
406
|
-
parseInheritedTokens(
|
|
407
|
-
sizeRunner({ kind: 'process', want: 5, testThreads: NO_CEILINGS }, 'bun scripts/x.ts', 5).env[CPU_TOKENS_ENV],
|
|
408
|
-
),
|
|
409
|
-
).toBe(5);
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
it('asks the gateway with one line, takes the granted count, and holds until released', async () => {
|
|
413
|
-
const { promise: request, resolve: requested } = Promise.withResolvers<string>();
|
|
414
|
-
const { promise: closed, resolve: close } = Promise.withResolvers<void>();
|
|
415
|
-
const socket = await gateway((client) => {
|
|
416
|
-
client.once('data', (chunk) => {
|
|
417
|
-
requested(chunk.toString('utf8'));
|
|
418
|
-
client.write('{"ok":true,"lease":"queued"}\n{"ok":true,"lease":"granted","tokens":6}\n');
|
|
419
|
-
});
|
|
420
|
-
// The gateway takes a lease back when it reads EOF. With allowHalfOpen the socket stays open
|
|
421
|
-
// after the peer closes until the server ends it, so 'close' is not that signal on Linux.
|
|
422
|
-
client.on('end', () => close());
|
|
423
|
-
});
|
|
424
|
-
const grant = await gatewayCpuBudget(socket).take(18, '/w/one', 'cargo nextest run');
|
|
425
|
-
expect(JSON.parse(await request)).toEqual({
|
|
426
|
-
op: 'cpu-tokens',
|
|
427
|
-
want: 18,
|
|
428
|
-
checkout: '/w/one',
|
|
429
|
-
command: 'cargo nextest run',
|
|
430
|
-
});
|
|
431
|
-
expect(grant.granted && grant.tokens).toBe(6);
|
|
432
|
-
if (grant.granted) {
|
|
433
|
-
grant.release();
|
|
434
|
-
// The client's side of the connection really closed, not merely its release call.
|
|
435
|
-
await grant.closed;
|
|
436
|
-
}
|
|
437
|
-
await closed;
|
|
438
|
-
});
|
|
439
|
-
|
|
440
|
-
it('closes a granted lease when the gateway ends the connection', async () => {
|
|
441
|
-
const socket = await gateway((client) => {
|
|
442
|
-
client.once('data', () => {
|
|
443
|
-
client.write('{"ok":true,"lease":"queued"}\n{"ok":true,"lease":"granted","tokens":2}\n');
|
|
444
|
-
client.end();
|
|
445
|
-
});
|
|
446
|
-
});
|
|
447
|
-
const grant = await gatewayCpuBudget(socket).take(2, '/w', 'x');
|
|
448
|
-
if (!grant.granted) {
|
|
449
|
-
throw new Error(grant.reason);
|
|
450
|
-
}
|
|
451
|
-
await grant.closed;
|
|
452
|
-
});
|
|
453
|
-
|
|
454
|
-
it('runs unbudgeted, said as absent, when no gateway listens', async () => {
|
|
455
|
-
const grant = await gatewayCpuBudget(await socketPath('none.sock')).take(4, '/w', 'x');
|
|
456
|
-
expect(grant.granted === false && grant.cause).toBe('absent');
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
it('recognizes a gateway that does not know the operation as predating the budget', async () => {
|
|
460
|
-
const socket = await gateway((client) => {
|
|
461
|
-
client.once('data', () =>
|
|
462
|
-
client.end(
|
|
463
|
-
'{"ok":false,"code":"invalid-request","error":"gateway control encoding failed: unknown gateway control operation"}\n',
|
|
464
|
-
),
|
|
465
|
-
);
|
|
466
|
-
});
|
|
467
|
-
const grant = await gatewayCpuBudget(socket).take(4, '/w', 'x');
|
|
468
|
-
expect(grant).toEqual({
|
|
469
|
-
granted: false,
|
|
470
|
-
cause: 'predates',
|
|
471
|
-
reason:
|
|
472
|
-
'the gateway predates the CPU budget (invalid-request: gateway control encoding failed: unknown gateway control operation); restart it with `cowshed setup`',
|
|
473
|
-
});
|
|
474
|
-
});
|
|
475
|
-
|
|
476
|
-
it('refuses a grant larger than it asked for', async () => {
|
|
477
|
-
const socket = await gateway((client) => {
|
|
478
|
-
client.once('data', () =>
|
|
479
|
-
client.write('{"ok":true,"lease":"queued"}\n{"ok":true,"lease":"granted","tokens":9}\n'),
|
|
480
|
-
);
|
|
481
|
-
});
|
|
482
|
-
const grant = await gatewayCpuBudget(socket).take(4, '/w', 'x');
|
|
483
|
-
expect(grant).toEqual({ granted: false, cause: 'other', reason: 'the gateway granted 9 tokens for 4' });
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
it('returns a grant when the process holding it is killed mid-leg', async () => {
|
|
487
|
-
const { promise: closed, resolve: close } = Promise.withResolvers<void>();
|
|
488
|
-
const { promise: granted, resolve: grant } = Promise.withResolvers<void>();
|
|
489
|
-
const socket = await gateway((client) => {
|
|
490
|
-
client.once('data', () => {
|
|
491
|
-
client.write('{"ok":true,"lease":"queued"}\n{"ok":true,"lease":"granted","tokens":2}\n');
|
|
492
|
-
grant();
|
|
493
|
-
});
|
|
494
|
-
client.on('end', () => close());
|
|
495
|
-
});
|
|
496
|
-
// The holder is its own process so SIGKILL is a real death. Its script imports the module by
|
|
497
|
-
// path because `bun -e` has no module of its own to import from statically; the held lease's
|
|
498
|
-
// open socket is what keeps it alive.
|
|
499
|
-
const holder = Bun.spawn(
|
|
500
|
-
[
|
|
501
|
-
process.execPath,
|
|
502
|
-
'-e',
|
|
503
|
-
`const { gatewayCpuBudget } = await import(${JSON.stringify(new URL('./cpu-tokens.ts', import.meta.url).pathname)});
|
|
504
|
-
const grant = await gatewayCpuBudget(${JSON.stringify(socket)}).take(2, '/w', 'leg');
|
|
505
|
-
if (!grant.granted) process.exit(3);
|
|
506
|
-
console.log('holding');`,
|
|
507
|
-
],
|
|
508
|
-
{ stdout: 'pipe', stderr: 'inherit' },
|
|
509
|
-
);
|
|
510
|
-
await granted;
|
|
511
|
-
const reader = holder.stdout.getReader();
|
|
512
|
-
const { value } = await reader.read();
|
|
513
|
-
expect(new TextDecoder().decode(value)).toContain('holding');
|
|
514
|
-
holder.kill('SIGKILL');
|
|
515
|
-
await holder.exited;
|
|
516
|
-
// The gateway sees the connection close, which is how it takes the tokens back.
|
|
517
|
-
await closed;
|
|
518
|
-
});
|
|
519
|
-
});
|