@smoothbricks/nx-plugin 0.5.7 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1097 -360
- package/dist/.build-inputs.json +141 -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 +22 -5
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +168 -48
- 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-thread.d.ts +28 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.js +20 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +35 -38
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +56 -120
- 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 +389 -239
- package/dist/executors/bounded-exec/gateway-lease.d.ts +23 -19
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +102 -29
- 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 +64 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lease-wait.js +72 -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/mbx-pool.d.ts +31 -0
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -0
- package/dist/executors/bounded-exec/mbx-pool.js +24 -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 +10 -4
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +122 -35
- 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 +48 -11
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +89 -20
- 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/emit-overrides.d.ts +14 -0
- package/dist/executors/typescript-emit/emit-overrides.d.ts.map +1 -0
- package/dist/executors/typescript-emit/emit-overrides.js +24 -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 +146 -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/managed-files/publish-workflow.js +14 -11
- 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 +514 -47
- 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 +95 -14
- 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 +173 -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-thread.ts +43 -0
- package/src/executors/bounded-exec/cpu-pool.ts +55 -120
- package/src/executors/bounded-exec/executor.ts +442 -260
- package/src/executors/bounded-exec/gateway-lease.ts +94 -35
- package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
- package/src/executors/bounded-exec/lease-wait.ts +116 -0
- package/src/executors/bounded-exec/lock-wait.ts +141 -0
- package/src/executors/bounded-exec/mbx-pool.ts +48 -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 +129 -35
- 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 +145 -35
- 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/emit-overrides.ts +24 -0
- package/src/executors/typescript-emit/executor.ts +186 -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/managed-files/publish-workflow.ts +20 -15
- 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 +92 -41
- 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 +124 -99
- 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
package/dist/testing.js
CHANGED
|
@@ -10,13 +10,19 @@
|
|
|
10
10
|
* `<parent>/smoothbricks-fixtures/<suite>/run-<pid>`, where the caller names
|
|
11
11
|
* the parent: the temp directory, or the directory of a volume the fixture has
|
|
12
12
|
* to lie on. A process that gets SIGTERM, SIGINT or SIGHUP (a bounded test
|
|
13
|
-
* leg's timeout sends SIGTERM, and SIGKILL 10 s later) first
|
|
14
|
-
* still
|
|
15
|
-
* outright cannot, so the first fixture a process creates
|
|
16
|
-
* parent
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
13
|
+
* leg's timeout sends SIGTERM, and SIGKILL 10 s later) first names its own
|
|
14
|
+
* descendants that still run and deletes every run it holds, then dies of that
|
|
15
|
+
* signal. One killed outright cannot, so the first fixture a process creates
|
|
16
|
+
* for a suite under a parent deletes every run of that suite there whose owner
|
|
17
|
+
* is gone. A run whose owner still exists is never touched by another process.
|
|
18
|
+
* Nothing is signalled for working in a run: what a fixture left running is
|
|
19
|
+
* ended by the job's supervisor with the test command's subtree (bounded-exec).
|
|
20
|
+
*
|
|
21
|
+
* No helper here reads a process it was not given. Each starts from pids its
|
|
22
|
+
* caller holds (a child it spawned, a daemon's record, this process) and walks
|
|
23
|
+
* down their children, never across the host's process table: any process of
|
|
24
|
+
* the user caught in an uninterruptible kernel wait holds a reader of its
|
|
25
|
+
* files or arguments there with it.
|
|
20
26
|
*
|
|
21
27
|
* The module also says where a fixture's sockets and loopback listeners may
|
|
22
28
|
* live, because a Cowshed sandbox admits only its own: a Unix socket under its
|
|
@@ -24,20 +30,20 @@
|
|
|
24
30
|
* literal `/tmp/x.sock` or a port-0 listener still binds there, and then no
|
|
25
31
|
* process of the workspace can reach it (specs/cowshed/04_sandbox.md).
|
|
26
32
|
*
|
|
27
|
-
* Node APIs and the library's
|
|
28
|
-
*
|
|
33
|
+
* Node APIs and the library's own modules only: this module is built with the
|
|
34
|
+
* library and imported by Bun tests in other packages.
|
|
29
35
|
*/
|
|
30
|
-
import { execFile } from 'node:child_process';
|
|
31
36
|
import { createHash } from 'node:crypto';
|
|
32
37
|
import { lstatSync, readlinkSync, realpathSync, statSync } from 'node:fs';
|
|
33
38
|
import { lstat, mkdir, mkdtemp, readdir, readFile, readlink, realpath, rm, symlink, writeFile } from 'node:fs/promises';
|
|
34
|
-
import {
|
|
39
|
+
import { createServer } from 'node:net';
|
|
40
|
+
import { tmpdir } from 'node:os';
|
|
35
41
|
import { dirname, isAbsolute, join, sep } from 'node:path';
|
|
36
42
|
import { setTimeout as sleep } from 'node:timers/promises';
|
|
37
|
-
import { promisify } from 'node:util';
|
|
38
43
|
import { findNxWorkspaceRoot } from './ensure-built.js';
|
|
44
|
+
import { childPids } from './process-children.js';
|
|
45
|
+
import { listing } from './process-listing.js';
|
|
39
46
|
import { BOUNDED_TEST_IDLE_TIMEOUT_MS } from './test-backstop.js';
|
|
40
|
-
const run = promisify(execFile);
|
|
41
47
|
/**
|
|
42
48
|
* How long a stopped process may take to exit when no caller names a grace: the leg's no-progress backstop
|
|
43
49
|
* (specs/cowshed/08_testing.md), so the exit itself decides and a hung one is the leg's to report. A smaller literal
|
|
@@ -45,21 +51,34 @@ const run = promisify(execFile);
|
|
|
45
51
|
* 10 s on a loaded gate host and failed teardown of a test that had passed.
|
|
46
52
|
*/
|
|
47
53
|
const EXIT_TIMEOUT_MS = BOUNDED_TEST_IDLE_TIMEOUT_MS;
|
|
48
|
-
/** Under half of the SIGTERM-to-SIGKILL grace a bounded test leg gives, per round of signals. */
|
|
49
|
-
const SIGNALLED_GRACE_MS = 3_000;
|
|
50
54
|
const FIXTURE_HOME = 'smoothbricks-fixtures';
|
|
51
55
|
const RUN_NAME = /^run-(\d+)$/;
|
|
52
56
|
const SWEEP_LOCK = 'sweep.lock';
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
/**
|
|
58
|
+
* The processes among `pids` that still exist, zombies included, as `ps -p` lists them on macOS and Linux alike, in
|
|
59
|
+
* `ps`'s order. Only the named processes are read.
|
|
60
|
+
*/
|
|
61
|
+
export async function processesOf(pids) {
|
|
62
|
+
if (pids.length === 0) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
const stdout = await listing('ps', [
|
|
66
|
+
'-o',
|
|
67
|
+
'pid=',
|
|
68
|
+
'-o',
|
|
69
|
+
'ppid=',
|
|
70
|
+
'-o',
|
|
71
|
+
'stat=',
|
|
72
|
+
'-o',
|
|
73
|
+
'command=',
|
|
74
|
+
'-p',
|
|
75
|
+
pids.join(','),
|
|
76
|
+
]);
|
|
58
77
|
return stdout
|
|
59
78
|
.split('\n')
|
|
60
79
|
.filter((line) => line.trim() !== '')
|
|
61
80
|
.map((line) => {
|
|
62
|
-
const match = /^\s*(\d+)\s+(\d+)\s+(\S+)\s
|
|
81
|
+
const match = /^\s*(\d+)\s+(\d+)\s+(\S+)\s*(.*)$/.exec(line);
|
|
63
82
|
if (match === null) {
|
|
64
83
|
throw new Error(`Unable to parse ps line: ${line}`);
|
|
65
84
|
}
|
|
@@ -67,6 +86,34 @@ export async function processTable() {
|
|
|
67
86
|
return { pid: Number(pid), ppid: Number(ppid), stat: stat ?? '', command: command ?? '' };
|
|
68
87
|
});
|
|
69
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
/**
|
|
91
|
+
* `roots` and every process descending from one, each once, in the order found: generation by generation, each the
|
|
92
|
+
* children `children` lists for the pids the one before added. A pid already found is not walked again, so a reused
|
|
93
|
+
* pid listed as a child of its own descendant ends the walk instead of looping it. The walk reads nothing but
|
|
94
|
+
* `children`, and keeps a root that no longer runs: whoever reads the processes drops it.
|
|
95
|
+
*/
|
|
96
|
+
export async function walkTree(roots, children) {
|
|
97
|
+
const found = new Set();
|
|
98
|
+
for (let generation = roots; generation.length > 0;) {
|
|
99
|
+
const added = [...new Set(generation)].filter((pid) => !found.has(pid));
|
|
100
|
+
for (const pid of added) {
|
|
101
|
+
found.add(pid);
|
|
102
|
+
}
|
|
103
|
+
generation = added.length === 0 ? [] : await children(added);
|
|
104
|
+
}
|
|
105
|
+
return [...found];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The processes of `roots` that still exist and every process descending from one, roots first, in the order
|
|
109
|
+
* {@link walkTree} found them. Only those processes are read. A child forked after its parent's children were listed,
|
|
110
|
+
* or reparented away before, is not in it.
|
|
111
|
+
*/
|
|
112
|
+
export async function processTree(roots) {
|
|
113
|
+
const order = await walkTree(roots, childPids);
|
|
114
|
+
const listed = new Map((await processesOf(order)).map((entry) => [entry.pid, entry]));
|
|
115
|
+
return order.flatMap((pid) => listed.get(pid) ?? []);
|
|
116
|
+
}
|
|
70
117
|
/**
|
|
71
118
|
* The listed processes among `pids`, and every process descending from one, each once: a pid that
|
|
72
119
|
* descends from another in `pids` is not listed twice.
|
|
@@ -125,7 +172,9 @@ export async function awaitExit(processes, owner, timeoutMs = EXIT_TIMEOUT_MS) {
|
|
|
125
172
|
for (let waiting = processes.filter((entry) => isRunning(entry.pid)); waiting.length > 0;) {
|
|
126
173
|
if (performance.now() > deadline) {
|
|
127
174
|
// A signal probe also answers for a zombie, which has already exited.
|
|
128
|
-
const live = new Set((await
|
|
175
|
+
const live = new Set((await processesOf(waiting.map((entry) => entry.pid)))
|
|
176
|
+
.filter((entry) => !entry.stat.startsWith('Z'))
|
|
177
|
+
.map((entry) => entry.pid));
|
|
129
178
|
const survivors = waiting.filter((entry) => live.has(entry.pid));
|
|
130
179
|
if (survivors.length === 0) {
|
|
131
180
|
return;
|
|
@@ -136,110 +185,24 @@ export async function awaitExit(processes, owner, timeoutMs = EXIT_TIMEOUT_MS) {
|
|
|
136
185
|
waiting = waiting.filter((entry) => isRunning(entry.pid));
|
|
137
186
|
}
|
|
138
187
|
}
|
|
139
|
-
/** Every process of this user whose working directory is `root` or lies beneath it, deleted or not. */
|
|
140
|
-
export async function pidsWorkingIn(root) {
|
|
141
|
-
const under = (cwd) => cwd === root || cwd.startsWith(`${root}/`);
|
|
142
|
-
switch (process.platform) {
|
|
143
|
-
case 'linux': {
|
|
144
|
-
const found = [];
|
|
145
|
-
for (const pid of (await readdir('/proc')).filter((name) => /^\d+$/.test(name))) {
|
|
146
|
-
const cwd = await readlink(`/proc/${pid}/cwd`).catch((error) => {
|
|
147
|
-
// Another user's process, or one that exited since the listing.
|
|
148
|
-
if (errorCode(error) === 'EACCES' || errorCode(error) === 'ENOENT' || errorCode(error) === 'ESRCH') {
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
throw error;
|
|
152
|
-
});
|
|
153
|
-
if (cwd !== null && under(cwd.replace(/ \(deleted\)$/, ''))) {
|
|
154
|
-
found.push(Number(pid));
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return found;
|
|
158
|
-
}
|
|
159
|
-
case 'darwin': {
|
|
160
|
-
// lsof keeps naming a working directory after it has been deleted. It
|
|
161
|
-
// exits 1 when a listed process vanished before it was read; what it
|
|
162
|
-
// printed for the rest is still the answer.
|
|
163
|
-
const fields = await run('/usr/sbin/lsof', ['-nP', '-a', '-d', 'cwd', '-u', String(userInfo().uid), '-Fpn'], {
|
|
164
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
165
|
-
}).then(({ stdout }) => stdout, (error) => {
|
|
166
|
-
if (error instanceof Error && 'code' in error && error.code === 1 && 'stdout' in error) {
|
|
167
|
-
return String(error.stdout);
|
|
168
|
-
}
|
|
169
|
-
throw error;
|
|
170
|
-
});
|
|
171
|
-
const found = [];
|
|
172
|
-
let pid = 0;
|
|
173
|
-
for (const line of fields.split('\n')) {
|
|
174
|
-
if (line.startsWith('p')) {
|
|
175
|
-
pid = Number(line.slice(1));
|
|
176
|
-
}
|
|
177
|
-
else if (line.startsWith('n') && under(line.slice(1))) {
|
|
178
|
-
found.push(pid);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return found;
|
|
182
|
-
}
|
|
183
|
-
default:
|
|
184
|
-
throw new Error(`No working-directory scan for ${process.platform}`);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
188
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
189
|
+
* This process's descendants that still run, as text for a failure report about `subject`, or null when none does.
|
|
190
|
+
* A process is named as this process's own, never for where it works, and no caller signals anything on its word: a
|
|
191
|
+
* process is ended by the owner that started it, the supervisor's observed tree (specs/cowshed/11_shell.md, "Process
|
|
192
|
+
* identity and signal ownership"). One reparented away when its parent exited is no longer this process's to see. A
|
|
193
|
+
* listing that cannot be read says so instead of failing the report it serves.
|
|
193
194
|
*/
|
|
194
|
-
export async function
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
throw error;
|
|
207
|
-
});
|
|
208
|
-
const entry = environ?.split('\0').find((variable) => variable.startsWith('TMPDIR='));
|
|
209
|
-
if (entry !== undefined && names(entry.slice('TMPDIR='.length))) {
|
|
210
|
-
found.push(Number(pid));
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return found;
|
|
214
|
-
}
|
|
215
|
-
case 'darwin': {
|
|
216
|
-
// `ps -E` follows each command line with the environment it was started with, as words
|
|
217
|
-
// separated by spaces, and only for this user's processes. A word `TMPDIR=<root>` is matched
|
|
218
|
-
// with what follows it in that word, so a root containing a space is still found whole. An
|
|
219
|
-
// argument spelled `TMPDIR=<root>` names the same directory and counts too: an `env` that
|
|
220
|
-
// sets it is about to run something there. `/bin/ps` by path: a procps `ps` has no `-E`.
|
|
221
|
-
const { stdout } = await run('/bin/ps', ['-E', '-ww', '-U', String(userInfo().uid), '-o', 'pid=,command='], {
|
|
222
|
-
maxBuffer: 256 * 1024 * 1024,
|
|
223
|
-
});
|
|
224
|
-
const token = ` TMPDIR=${root}`;
|
|
225
|
-
const found = [];
|
|
226
|
-
for (const line of stdout.split('\n')) {
|
|
227
|
-
const row = /^\s*(\d+) (.*)$/.exec(line);
|
|
228
|
-
if (row === null) {
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
const words = ` ${row[2]}`;
|
|
232
|
-
for (let at = words.indexOf(token); at !== -1; at = words.indexOf(token, at + 1)) {
|
|
233
|
-
if (names(words.slice(at + ' TMPDIR='.length))) {
|
|
234
|
-
found.push(Number(row[1]));
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return found;
|
|
240
|
-
}
|
|
241
|
-
default:
|
|
242
|
-
throw new Error(`No TMPDIR scan for ${process.platform}`);
|
|
195
|
+
export async function descendantsDiagnostic(subject) {
|
|
196
|
+
try {
|
|
197
|
+
const named = (await processTree([process.pid]))
|
|
198
|
+
.filter((entry) => entry.pid !== process.pid && !entry.stat.startsWith('Z'))
|
|
199
|
+
.map((entry) => `${entry.pid} (${entry.command.slice(0, 160)})`);
|
|
200
|
+
return named.length === 0
|
|
201
|
+
? null
|
|
202
|
+
: `descendants of this process still run at ${subject}: ${named.join(', ')} (diagnostic only: nothing was signalled)`;
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
return `descendants of this process at ${subject} could not be listed: ${error instanceof Error ? error.message : String(error)}`;
|
|
243
206
|
}
|
|
244
207
|
}
|
|
245
208
|
/**
|
|
@@ -267,7 +230,7 @@ export async function nxDaemonProcesses(workspace) {
|
|
|
267
230
|
!Number.isSafeInteger(parsed.processId)) {
|
|
268
231
|
throw new Error(`Nx daemon record ${record} names no process id`);
|
|
269
232
|
}
|
|
270
|
-
return
|
|
233
|
+
return processTree([parsed.processId]);
|
|
271
234
|
}
|
|
272
235
|
/**
|
|
273
236
|
* Release the Nx daemon `workspace` started and wait until the daemon and
|
|
@@ -277,45 +240,26 @@ export async function nxDaemonProcesses(workspace) {
|
|
|
277
240
|
* is free to delete; the processes can. The daemon also leaves what it
|
|
278
241
|
* spawned to end on its own: plugin workers once they see it gone, the editor
|
|
279
242
|
* extension probe it starts at launch never. Those get SIGTERM with it, the
|
|
280
|
-
* ones it started while it was stopping included
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
243
|
+
* ones it started while it was stopping included: the daemon's own record
|
|
244
|
+
* names the root, and the walk down its children the rest. A child that
|
|
245
|
+
* outlives the daemon is reparented and leaves that tree; it stays in the
|
|
246
|
+
* tree the job's supervisor observes, which ends it with the test command's
|
|
247
|
+
* subtree (bounded-exec). A missing record can mean startup has not published
|
|
248
|
+
* it yet: then nothing is stopped here.
|
|
285
249
|
*/
|
|
286
250
|
export async function stopNxDaemon(workspace, stop) {
|
|
287
251
|
const [daemon, ...before] = await nxDaemonProcesses(workspace);
|
|
288
|
-
if (daemon
|
|
289
|
-
|
|
290
|
-
const known = new Set([daemon.pid, ...before.map((entry) => entry.pid)]);
|
|
291
|
-
const after = withDescendants(await processTable(), [daemon.pid]).filter((entry) => !known.has(entry.pid));
|
|
292
|
-
const spawned = [...before, ...after];
|
|
293
|
-
for (const entry of spawned) {
|
|
294
|
-
terminate(entry.pid);
|
|
295
|
-
}
|
|
296
|
-
await awaitExit([daemon, ...spawned], `Nx daemon of ${workspace}`);
|
|
252
|
+
if (daemon === undefined) {
|
|
253
|
+
return;
|
|
297
254
|
}
|
|
298
|
-
await
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
* just before its parent was ended is in the next census. A zombie has
|
|
305
|
-
* exited already, and this process never ends itself.
|
|
306
|
-
*/
|
|
307
|
-
async function endWorkspaceProcesses(workspace, owner) {
|
|
308
|
-
for (;;) {
|
|
309
|
-
const working = new Set(await pidsWorkingIn(workspace));
|
|
310
|
-
const leftovers = (await processTable()).filter((entry) => working.has(entry.pid) && entry.pid !== process.pid && !entry.stat.startsWith('Z'));
|
|
311
|
-
if (leftovers.length === 0) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
for (const entry of leftovers) {
|
|
315
|
-
terminate(entry.pid);
|
|
316
|
-
}
|
|
317
|
-
await awaitExit(leftovers, owner);
|
|
255
|
+
await stop();
|
|
256
|
+
const known = new Set([daemon.pid, ...before.map((entry) => entry.pid)]);
|
|
257
|
+
const after = (await processTree([daemon.pid])).filter((entry) => !known.has(entry.pid));
|
|
258
|
+
const spawned = [...before, ...after];
|
|
259
|
+
for (const entry of spawned) {
|
|
260
|
+
terminate(entry.pid);
|
|
318
261
|
}
|
|
262
|
+
await awaitExit([daemon, ...spawned], `Nx daemon of ${workspace}`);
|
|
319
263
|
}
|
|
320
264
|
/**
|
|
321
265
|
* The run this process holds in each suite directory, opened or still opening,
|
|
@@ -387,15 +331,20 @@ function ownRunSignals() {
|
|
|
387
331
|
* open failed included, and one failing cuts no other short; each failure is
|
|
388
332
|
* written to stderr with the suite directory of its run. A repeated signal
|
|
389
333
|
* meets a handler, not the default, so it waits for this and neither starts a
|
|
390
|
-
* second reclaim nor kills the first. That wait is the reclaim's own:
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
334
|
+
* second reclaim nor kills the first. That wait is the reclaim's own: the
|
|
335
|
+
* report of this process's descendants still running, then for each run, after
|
|
336
|
+
* any sweep it was still opening with, the delete. What a fixture left running
|
|
337
|
+
* is ended by the job's supervisor with the test command's subtree
|
|
338
|
+
* (bounded-exec), not here. A bounded test leg's SIGKILL ends this whatever it
|
|
339
|
+
* is.
|
|
394
340
|
*/
|
|
395
341
|
async function retireRuns(signal) {
|
|
342
|
+
const left = await descendantsDiagnostic(`its ${signal}`);
|
|
343
|
+
if (left !== null) {
|
|
344
|
+
process.stderr.write(`reclaiming this process's fixture runs: ${left}\n`);
|
|
345
|
+
}
|
|
396
346
|
const runs = [...runDirectories];
|
|
397
|
-
|
|
398
|
-
const outcomes = await Promise.allSettled(runs.map(async ([, opened]) => reclaimRun(await opened, 'signalled fixture run', SIGNALLED_GRACE_MS)));
|
|
347
|
+
const outcomes = await Promise.allSettled(runs.map(async ([, opened]) => reclaimRun(await opened)));
|
|
399
348
|
for (const [index, outcome] of outcomes.entries()) {
|
|
400
349
|
if (outcome.status === 'rejected') {
|
|
401
350
|
const reason = outcome.reason instanceof Error ? outcome.reason.message : String(outcome.reason);
|
|
@@ -413,12 +362,13 @@ function refuseWhileRetiring() {
|
|
|
413
362
|
}
|
|
414
363
|
}
|
|
415
364
|
/**
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
365
|
+
* Delete every run of `suite` under `parentDirectory` whose owner is gone, and
|
|
366
|
+
* return the suite's directory there. The first fixture root of a suite under a
|
|
367
|
+
* parent in a process does this; a test that just watched a fixture-owning
|
|
368
|
+
* process die may too. An owner's pid reused by an unrelated process makes its
|
|
369
|
+
* run look alive; it is reclaimed once that process is gone too, never early.
|
|
370
|
+
* Nothing still working in a dead run is signalled here: whatever its owner
|
|
371
|
+
* left running belongs to that owner's subtree, which its supervisor retires.
|
|
422
372
|
*/
|
|
423
373
|
export async function reclaimDeadFixtureRuns(parentDirectory, suite) {
|
|
424
374
|
const suiteDirectory = join(await realpath(parentDirectory), FIXTURE_HOME, suite);
|
|
@@ -448,45 +398,14 @@ async function reclaimDeadRuns(suiteDirectory) {
|
|
|
448
398
|
}
|
|
449
399
|
try {
|
|
450
400
|
for (const directory of dead) {
|
|
451
|
-
await reclaimRun(directory
|
|
401
|
+
await reclaimRun(directory);
|
|
452
402
|
}
|
|
453
403
|
}
|
|
454
404
|
finally {
|
|
455
405
|
await rm(lock, { force: true });
|
|
456
406
|
}
|
|
457
407
|
}
|
|
458
|
-
async function reclaimRun(directory
|
|
459
|
-
const roots = await readdir(directory).catch((error) => {
|
|
460
|
-
if (errorCode(error) === 'ENOENT') {
|
|
461
|
-
return null;
|
|
462
|
-
}
|
|
463
|
-
throw error;
|
|
464
|
-
});
|
|
465
|
-
if (roots === null) {
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
// A fixture deletes its root only once nothing runs in it, so an emptied
|
|
469
|
-
// run holds no process and needs no scan.
|
|
470
|
-
if (roots.length > 0) {
|
|
471
|
-
const working = await pidsWorkingIn(directory);
|
|
472
|
-
const processes = (await processTable()).filter((entry) => working.includes(entry.pid));
|
|
473
|
-
if (processes.length > 0) {
|
|
474
|
-
process.stderr.write(`reclaiming ${owner} ${directory}: ${processes.map((entry) => `${entry.pid} (${entry.command})`).join(', ')}\n`);
|
|
475
|
-
for (const entry of processes) {
|
|
476
|
-
terminate(entry.pid);
|
|
477
|
-
}
|
|
478
|
-
try {
|
|
479
|
-
await awaitExit(processes, `processes of ${owner} ${directory}`, graceMs);
|
|
480
|
-
}
|
|
481
|
-
catch (error) {
|
|
482
|
-
process.stderr.write(`${error instanceof Error ? error.message : String(error)}; sending SIGKILL\n`);
|
|
483
|
-
for (const entry of processes) {
|
|
484
|
-
terminate(entry.pid, 'SIGKILL');
|
|
485
|
-
}
|
|
486
|
-
await awaitExit(processes, `processes of ${owner} ${directory} after SIGKILL`, graceMs);
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
}
|
|
408
|
+
async function reclaimRun(directory) {
|
|
490
409
|
// A killed fixture may never have reached its own alias retirement, and its
|
|
491
410
|
// workspace may be gone. The alias is its own record: one whose target is the
|
|
492
411
|
// socket state of a workspace in this reclaimed run, and whose name is that
|
|
@@ -849,15 +768,47 @@ function portBlockEnvironment(env) {
|
|
|
849
768
|
}
|
|
850
769
|
return { kind: 'block', base, size };
|
|
851
770
|
}
|
|
771
|
+
/** The block's service ports from `base+first` on, lowest first: its odd offsets (08_testing.md). */
|
|
772
|
+
function servicePorts(block, first) {
|
|
773
|
+
const ports = [];
|
|
774
|
+
for (let offset = first; offset < block.size; offset += 2)
|
|
775
|
+
ports.push(block.base + offset);
|
|
776
|
+
return ports;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* `bind` on each of `candidates` in turn, and the first that binds. Only `EADDRINUSE` (by `code`) moves on to
|
|
780
|
+
* the next; any other failure is that bind's own and surfaces as is, and so does the last candidate's, so an exhausted
|
|
781
|
+
* block reports `EADDRINUSE`, never a silent port 0.
|
|
782
|
+
*/
|
|
783
|
+
async function bindFirstFree(block, candidates, bind) {
|
|
784
|
+
const last = candidates.at(-1);
|
|
785
|
+
if (last === undefined) {
|
|
786
|
+
throw new Error(`the Cowshed port block ${block.base}+${block.size} has no service port to bind`);
|
|
787
|
+
}
|
|
788
|
+
for (const port of candidates.slice(0, -1)) {
|
|
789
|
+
try {
|
|
790
|
+
return await bind(port);
|
|
791
|
+
}
|
|
792
|
+
catch (error) {
|
|
793
|
+
if (errorCode(error) !== 'EADDRINUSE') {
|
|
794
|
+
throw error;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
return bind(last);
|
|
799
|
+
}
|
|
852
800
|
/**
|
|
853
801
|
* Bind a real listener where a Cowshed job's other processes can connect to
|
|
854
|
-
* it. In a block, `bind` is called with each
|
|
855
|
-
* lowest first (a long-lived test listener scans from the
|
|
856
|
-
* first that binds is kept: only a real bind claims a port, so
|
|
857
|
-
* and closes.
|
|
858
|
-
*
|
|
859
|
-
*
|
|
860
|
-
*
|
|
802
|
+
* it. In a block, `bind` is called with each service port `base+1, base+3, …
|
|
803
|
+
* base+size-1`, lowest first (a long-lived test listener scans from the
|
|
804
|
+
* bottom), and the first that binds is kept: only a real bind claims a port, so
|
|
805
|
+
* nothing probes and closes. Even offsets are never candidates: each is the
|
|
806
|
+
* session port of the service port above it, bound by that port's holder or by
|
|
807
|
+
* nobody (08_testing.md), which is what `claimRefusingPort` relies on. Only
|
|
808
|
+
* `EADDRINUSE` (by `code`) moves on to the next candidate; any other failure
|
|
809
|
+
* is that bind's own and surfaces as is, and so does the last candidate's, so an
|
|
810
|
+
* exhausted block reports `EADDRINUSE`, never a silent port 0. Outside a block
|
|
811
|
+
* `bind` is called with 0, and the kernel picks.
|
|
861
812
|
*
|
|
862
813
|
* `bind` creates and binds one listener per call and returns it, and a failed
|
|
863
814
|
* bind leaves nothing behind. It may throw (`Bun.serve` does) or reject (a
|
|
@@ -872,19 +823,62 @@ export async function bindListener(bind) {
|
|
|
872
823
|
return bind(0);
|
|
873
824
|
case 'broken':
|
|
874
825
|
throw new Error(`a listener cannot bind in a broken Cowshed port-block environment: ${block.reason}`);
|
|
826
|
+
case 'block':
|
|
827
|
+
return bindFirstFree(block, servicePorts(block, 1), bind);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
/** A `net` server on 127.0.0.1:`port` that hangs up on whoever connects; rejects with the bind's own error. */
|
|
831
|
+
function listenHangingUp(port) {
|
|
832
|
+
return new Promise((resolve, reject) => {
|
|
833
|
+
const server = createServer((socket) => socket.destroy());
|
|
834
|
+
server.once('error', reject);
|
|
835
|
+
server.listen(port, '127.0.0.1', () => {
|
|
836
|
+
server.off('error', reject);
|
|
837
|
+
resolve(server);
|
|
838
|
+
});
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
function closeServer(server) {
|
|
842
|
+
return new Promise((resolve, reject) => server.close((error) => (error ? reject(error) : resolve())));
|
|
843
|
+
}
|
|
844
|
+
/** The TCP port `server` listens on. */
|
|
845
|
+
function listeningPort(server) {
|
|
846
|
+
const address = server.address();
|
|
847
|
+
if (address === null || typeof address === 'string')
|
|
848
|
+
throw new Error(`not a TCP listener: ${String(address)}`);
|
|
849
|
+
return address.port;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* A port where nothing listens, for a client that must be refused (a cache
|
|
853
|
+
* server that is down). In a block it is the session port of a service port
|
|
854
|
+
* this process holds for as long as the claim is held: no allocator binds a
|
|
855
|
+
* session port but its service port's holder (08_testing.md), so a connect to
|
|
856
|
+
* it is refused at once, and no other test's listener takes it while the client
|
|
857
|
+
* is still asking. A port bound and closed would be the next lowest-first
|
|
858
|
+
* allocator's to bind; a socket bound and never listening is no refusal either,
|
|
859
|
+
* since macOS drops the SYNs it gets and the connect times out. The service
|
|
860
|
+
* ports start at `base+3`, because the session port of `base+1` is the
|
|
861
|
+
* gateway's own `base`; a block of two ports has no session port to give.
|
|
862
|
+
*
|
|
863
|
+
* Outside a block (Linux, or no Cowshed) there is no shared allocator to claim
|
|
864
|
+
* against, so there is no claim: the port is one the kernel picked for a
|
|
865
|
+
* listener this process then closed, and another process's port-0 listener may
|
|
866
|
+
* be given it before the client connects.
|
|
867
|
+
*/
|
|
868
|
+
export async function claimRefusingPort() {
|
|
869
|
+
const block = portBlockEnvironment(process.env);
|
|
870
|
+
switch (block.kind) {
|
|
871
|
+
case 'none': {
|
|
872
|
+
const server = await listenHangingUp(0);
|
|
873
|
+
const port = listeningPort(server);
|
|
874
|
+
await closeServer(server);
|
|
875
|
+
return { port, [Symbol.asyncDispose]: async () => { } };
|
|
876
|
+
}
|
|
877
|
+
case 'broken':
|
|
878
|
+
throw new Error(`a refusing port cannot be claimed in a broken Cowshed port-block environment: ${block.reason}`);
|
|
875
879
|
case 'block': {
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
try {
|
|
879
|
-
return await bind(port);
|
|
880
|
-
}
|
|
881
|
-
catch (error) {
|
|
882
|
-
if (errorCode(error) !== 'EADDRINUSE') {
|
|
883
|
-
throw error;
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
return bind(last);
|
|
880
|
+
const service = await bindFirstFree(block, servicePorts(block, 3), listenHangingUp);
|
|
881
|
+
return { port: listeningPort(service) - 1, [Symbol.asyncDispose]: () => closeServer(service) };
|
|
888
882
|
}
|
|
889
883
|
}
|
|
890
884
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TargetConfiguration } from 'nx/src/devkit-exports.js';
|
|
2
|
+
/** The tool packages whose executables inferred commands run. */
|
|
3
|
+
declare const NATIVE_TOOL_PACKAGES: readonly ['build-inputs', 'cargo-retain', 'nextest-extract'];
|
|
4
|
+
export type NativeToolPackage = (typeof NATIVE_TOOL_PACKAGES)[number];
|
|
5
|
+
type TargetDependency = NonNullable<TargetConfiguration['dependsOn']>[number];
|
|
6
|
+
/**
|
|
7
|
+
* The tool packages' executables as the inferring host runs them. Every scriptc package ships each platform's
|
|
8
|
+
* executable under `dist/bin/<platform>/`, so an installed tool package already carries this host's. A tool package
|
|
9
|
+
* that is a project of the workspace being inferred (a checkout of the repository that builds it) has only what its
|
|
10
|
+
* `scriptc-<arch>-<family>` target last wrote, so a command running it depends on that target.
|
|
11
|
+
*/
|
|
12
|
+
export interface NativeTools {
|
|
13
|
+
/** The host's directory under a tool package's `dist/bin`. */
|
|
14
|
+
readonly platform: string;
|
|
15
|
+
/** The host's scriptc target, the one that writes `dist/bin/<platform>/`. */
|
|
16
|
+
readonly target: string;
|
|
17
|
+
/** Each tool package that is a project of this workspace, to its project name. */
|
|
18
|
+
readonly projects: ReadonlyMap<NativeToolPackage, string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The tools of the workspace at `workspaceRoot`, whose project manifests are `projectManifests` (workspace-relative):
|
|
22
|
+
* a tool package is a project when the plugin's link resolves beside one of them.
|
|
23
|
+
*/
|
|
24
|
+
export declare function resolveNativeTools(workspaceRoot: string, projectManifests: readonly string[], platform: string, target: string): Promise<NativeTools>;
|
|
25
|
+
/**
|
|
26
|
+
* The command running `tool`'s executable `bin` from `cwd`. `tools` is null on a host no scriptc platform covers,
|
|
27
|
+
* where no tool package carries an executable to run.
|
|
28
|
+
*/
|
|
29
|
+
export declare function nativeToolCommand(tools: Pick<NativeTools, 'platform'> | null, cwd: string, tool: NativeToolPackage, bin: string): string;
|
|
30
|
+
/** The task that builds `tool`'s executables for this host, when this workspace builds them. */
|
|
31
|
+
export declare function nativeToolDependsOn(tools: NativeTools | null, tool: NativeToolPackage): TargetDependency[];
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=tool-bins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-bins.d.ts","sourceRoot":"","sources":["../src/tool-bins.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAsBpE,iEAAiE;AACjE,QAAA,MAAM,oBAAoB,YAAI,cAAc,EAAE,cAAc,EAAE,iBAAiB,CAAU,CAAC;AAE1F,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,KAAK,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;CAC3D;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,SAAS,MAAM,EAAE,EACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,CAmBtB;AAUD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,IAAI,EAC3C,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,iBAAiB,EACvB,GAAG,EAAE,MAAM,GACV,MAAM,CAOR;AAED,gGAAgG;AAChG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,EAAE,IAAI,EAAE,iBAAiB,GAAG,gBAAgB,EAAE,CAG1G"}
|