@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
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { tags } from 'typia';
|
|
2
|
+
/** Peer wait classes from specs/cowshed/05_gateway.md, "Deadlines". */
|
|
3
|
+
export declare const CONTROL_MS = 5000;
|
|
4
|
+
export declare const HEARTBEAT_MS = 5000;
|
|
5
|
+
export declare const HEARTBEAT_SILENCE_MS = 15000;
|
|
6
|
+
/** The CPU pool's actor-authored progress, shared by its server and lease client. */
|
|
7
|
+
export interface CpuLeaseProgress {
|
|
8
|
+
ok: true;
|
|
9
|
+
progress: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The CPU pool's queue acknowledgement, shared by its server and lease client. `server` is the pid of the process the
|
|
13
|
+
* pool runs in, so a wait that falls silent names the process to look at.
|
|
14
|
+
*/
|
|
15
|
+
export interface CpuLeaseQueued {
|
|
16
|
+
ok: true;
|
|
17
|
+
lease: 'queued';
|
|
18
|
+
server: number & tags.Type<'uint32'>;
|
|
19
|
+
}
|
|
20
|
+
/** A failed wait, not a failed command: expiry ends this client's admission only. */
|
|
21
|
+
export interface CpuWaitFailure {
|
|
22
|
+
code: 'TIMEOUT' | 'SILENT';
|
|
23
|
+
boundMs: number;
|
|
24
|
+
elapsedMs: number;
|
|
25
|
+
last: string;
|
|
26
|
+
/** The last advancing heartbeat sequence the client read; 0 before the first. */
|
|
27
|
+
sequence: number;
|
|
28
|
+
/** The pool's pid as its queue acknowledgement named it; null before one, or from a pool that names none. */
|
|
29
|
+
server: number | null;
|
|
30
|
+
}
|
|
31
|
+
/** An expired CPU wait as its client keeps it: the failure, and the socket of the pool it waited on. */
|
|
32
|
+
export interface CpuWaitRow extends CpuWaitFailure {
|
|
33
|
+
socket: string;
|
|
34
|
+
}
|
|
35
|
+
/** Pure CPU admission policy; its injected monotonic clock performs no I/O or scheduling. */
|
|
36
|
+
export declare class CpuLeaseWait {
|
|
37
|
+
private readonly now;
|
|
38
|
+
private readonly started;
|
|
39
|
+
private state;
|
|
40
|
+
/** When the client last looked at its wait or read a frame of it. */
|
|
41
|
+
private looked;
|
|
42
|
+
constructor(now?: () => number);
|
|
43
|
+
/** The kernel took the complete request; only peer silence bounds the answer from here. */
|
|
44
|
+
sent(): void;
|
|
45
|
+
/**
|
|
46
|
+
* A queue entry proves actor progress, not a deadline for returning a token. It names the pool's pid when the pool
|
|
47
|
+
* says it.
|
|
48
|
+
*/
|
|
49
|
+
queued(server: number | null): void;
|
|
50
|
+
/** Only an advancing actor sequence renews silence; duplicate or invalid progress proves nothing. */
|
|
51
|
+
heartbeat(sequence: number): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* The client looks at its wait before judging it. A look later than the silence bound plus a heartbeat
|
|
54
|
+
* after its previous look or frame means the client's own event loop did not run (a loaded host), so
|
|
55
|
+
* what the pool sent meanwhile is unread: the pool gets one heartbeat more from now (05_gateway.md
|
|
56
|
+
* "Deadlines"). A client that looks in time judges the pool at the bound.
|
|
57
|
+
*/
|
|
58
|
+
look(): void;
|
|
59
|
+
/** Milliseconds until the current phase's bound, clipped at zero. */
|
|
60
|
+
remainingMs(): number;
|
|
61
|
+
/** No total queue age exists: an advancing heartbeat keeps the wait alive indefinitely. */
|
|
62
|
+
expired(): CpuWaitFailure | null;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=lease-wait.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lease-wait.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/lease-wait.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElC,uEAAuE;AACvE,eAAO,MAAM,UAAU,OAAQ,CAAC;AAChC,eAAO,MAAM,YAAY,OAAQ,CAAC;AAClC,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C,qFAAqF;AACrF,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,IAAI,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;CACtC;AAMD,qFAAqF;AACrF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,6GAA6G;IAC7G,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,wGAAwG;AACxG,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,6FAA6F;AAC7F,qBAAa,YAAY;IAMX,OAAO,CAAC,QAAQ,CAAC,GAAG;IALhC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,KAAK,CAAqC;IAClD,qEAAqE;IACrE,OAAO,CAAC,MAAM,CAAS;IAEvB,YAA6B,GAAG,GAAE,MAAM,MAAgC,EAGvE;IAED,2FAA2F;IAC3F,IAAI,IAAI,IAAI,CAKX;IAED;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAKlC;IAED,qGAAqG;IACrG,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMnC;IAED;;;;;OAKG;IACH,IAAI,IAAI,IAAI,CAMX;IAED,qEAAqE;IACrE,WAAW,IAAI,MAAM,CAGpB;IAED,2FAA2F;IAC3F,OAAO,IAAI,cAAc,GAAG,IAAI,CAS/B;CACF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** Peer wait classes from specs/cowshed/05_gateway.md, "Deadlines". */
|
|
2
|
+
export const CONTROL_MS = 5_000;
|
|
3
|
+
export const HEARTBEAT_MS = 5_000;
|
|
4
|
+
export const HEARTBEAT_SILENCE_MS = 15_000;
|
|
5
|
+
/** Pure CPU admission policy; its injected monotonic clock performs no I/O or scheduling. */
|
|
6
|
+
export class CpuLeaseWait {
|
|
7
|
+
now;
|
|
8
|
+
started;
|
|
9
|
+
state = { kind: 'sending' };
|
|
10
|
+
/** When the client last looked at its wait or read a frame of it. */
|
|
11
|
+
looked;
|
|
12
|
+
constructor(now = () => performance.now()) {
|
|
13
|
+
this.now = now;
|
|
14
|
+
this.started = now();
|
|
15
|
+
this.looked = this.started;
|
|
16
|
+
}
|
|
17
|
+
/** The kernel took the complete request; only peer silence bounds the answer from here. */
|
|
18
|
+
sent() {
|
|
19
|
+
this.looked = this.now();
|
|
20
|
+
if (this.state.kind === 'sending') {
|
|
21
|
+
this.state = { kind: 'waiting', at: this.now(), last: 'request sent', sequence: 0, server: null };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A queue entry proves actor progress, not a deadline for returning a token. It names the pool's pid when the pool
|
|
26
|
+
* says it.
|
|
27
|
+
*/
|
|
28
|
+
queued(server) {
|
|
29
|
+
this.sent();
|
|
30
|
+
if (this.state.kind === 'waiting') {
|
|
31
|
+
this.state = { ...this.state, at: this.now(), last: 'queued', server };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Only an advancing actor sequence renews silence; duplicate or invalid progress proves nothing. */
|
|
35
|
+
heartbeat(sequence) {
|
|
36
|
+
this.sent();
|
|
37
|
+
if (this.state.kind !== 'waiting' || !Number.isSafeInteger(sequence) || sequence <= this.state.sequence)
|
|
38
|
+
return false;
|
|
39
|
+
this.state = { ...this.state, at: this.now(), last: `heartbeat ${sequence}`, sequence };
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The client looks at its wait before judging it. A look later than the silence bound plus a heartbeat
|
|
44
|
+
* after its previous look or frame means the client's own event loop did not run (a loaded host), so
|
|
45
|
+
* what the pool sent meanwhile is unread: the pool gets one heartbeat more from now (05_gateway.md
|
|
46
|
+
* "Deadlines"). A client that looks in time judges the pool at the bound.
|
|
47
|
+
*/
|
|
48
|
+
look() {
|
|
49
|
+
const now = this.now();
|
|
50
|
+
if (this.state.kind === 'waiting' && now - this.looked > HEARTBEAT_SILENCE_MS + HEARTBEAT_MS) {
|
|
51
|
+
this.state = { ...this.state, at: Math.max(this.state.at, now - HEARTBEAT_SILENCE_MS + HEARTBEAT_MS) };
|
|
52
|
+
}
|
|
53
|
+
this.looked = now;
|
|
54
|
+
}
|
|
55
|
+
/** Milliseconds until the current phase's bound, clipped at zero. */
|
|
56
|
+
remainingMs() {
|
|
57
|
+
const due = this.state.kind === 'sending' ? this.started + CONTROL_MS : this.state.at + HEARTBEAT_SILENCE_MS;
|
|
58
|
+
return Math.max(0, due - this.now());
|
|
59
|
+
}
|
|
60
|
+
/** No total queue age exists: an advancing heartbeat keeps the wait alive indefinitely. */
|
|
61
|
+
expired() {
|
|
62
|
+
if (this.remainingMs() > 0)
|
|
63
|
+
return null;
|
|
64
|
+
const elapsedMs = this.now() - this.started;
|
|
65
|
+
if (this.state.kind === 'sending') {
|
|
66
|
+
const last = 'connecting or sending request';
|
|
67
|
+
return { code: 'TIMEOUT', boundMs: CONTROL_MS, elapsedMs, last, sequence: 0, server: null };
|
|
68
|
+
}
|
|
69
|
+
const { last, sequence, server } = this.state;
|
|
70
|
+
return { code: 'SILENT', boundMs: HEARTBEAT_SILENCE_MS, elapsedMs, last, sequence, server };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lock-wait evidence from open-file tables. Pure: no I/O and no clock. `hang-diagnostics.ts` runs `lsof` and hands its
|
|
3
|
+
* output here, so every decision is a function of the rows it was given.
|
|
4
|
+
*
|
|
5
|
+
* A wait is open-handle evidence, not a kernel lock owner. flock(2) and fcntl(2) name no holder, so a regular file the
|
|
6
|
+
* run holds on a numbered descriptor, and that another process also holds open, is the only candidate for the lock a
|
|
7
|
+
* run blocks on. Nothing here observes the lock call itself.
|
|
8
|
+
*/
|
|
9
|
+
/** One row of an `lsof -nP -p ...` table: a file a process holds open. */
|
|
10
|
+
export interface OpenFile {
|
|
11
|
+
readonly pid: number;
|
|
12
|
+
readonly fd: string;
|
|
13
|
+
readonly type: string;
|
|
14
|
+
readonly path: string;
|
|
15
|
+
}
|
|
16
|
+
/** A process that holds a file open. */
|
|
17
|
+
export interface Opener {
|
|
18
|
+
readonly pid: number;
|
|
19
|
+
readonly command: string;
|
|
20
|
+
}
|
|
21
|
+
/** An opener that `lsof -F` named for one path. */
|
|
22
|
+
export interface PathOpener extends Opener {
|
|
23
|
+
readonly path: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A regular file the run holds on a numbered descriptor while processes outside the run also hold it open. `waiters`
|
|
27
|
+
* are the run's pids holding it; `holders` are the outside processes, never a run pid.
|
|
28
|
+
*/
|
|
29
|
+
export interface LockWait {
|
|
30
|
+
readonly path: string;
|
|
31
|
+
readonly waiters: readonly number[];
|
|
32
|
+
readonly holders: readonly Opener[];
|
|
33
|
+
}
|
|
34
|
+
/** The rows of an `lsof -nP` table. The header and any row that does not parse are skipped. */
|
|
35
|
+
export declare function parseLsofTable(text: string): OpenFile[];
|
|
36
|
+
/** The distinct lockable paths in `tree`, sorted. */
|
|
37
|
+
export declare function lockCandidates(tree: readonly OpenFile[]): string[];
|
|
38
|
+
/**
|
|
39
|
+
* The lock waits in `tree`, the open files of the run's processes. A path is a wait only when some process outside
|
|
40
|
+
* the run (`treePids` excludes the run) also holds it open. Sorted by path; holders deduplicated by pid and sorted.
|
|
41
|
+
*/
|
|
42
|
+
export declare function lockWaits(tree: readonly OpenFile[], treePids: ReadonlySet<number>, openers: readonly PathOpener[]): LockWait[];
|
|
43
|
+
/**
|
|
44
|
+
* Parse `lsof -F pcn` output: `p<pid>` opens a process, `c<command>` names it, `f<fd>` opens a file (lsof always
|
|
45
|
+
* emits one), and `n<path>` names the file. `null` for any other shape: the caller must then call the census
|
|
46
|
+
* incomplete, never empty.
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseLsofFields(text: string): PathOpener[] | null;
|
|
49
|
+
/** The holders as a reader names them: `pid 51234 (cargo), pid 9 (rustc)`. */
|
|
50
|
+
export declare function describeHolders(holders: readonly Opener[]): string;
|
|
51
|
+
//# sourceMappingURL=lock-wait.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock-wait.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/lock-wait.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,0EAA0E;AAC1E,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,wCAAwC;AACxC,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,mDAAmD;AACnD,MAAM,WAAW,UAAW,SAAQ,MAAM;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAKD,+FAA+F;AAC/F,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CAOvD;AAiBD,qDAAqD;AACrD,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,QAAQ,EAAE,GAAG,MAAM,EAAE,CAElE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,SAAS,QAAQ,EAAE,EACzB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,EAC7B,OAAO,EAAE,SAAS,UAAU,EAAE,GAC7B,QAAQ,EAAE,CAkBZ;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,GAAG,IAAI,CA+BjE;AAED,8EAA8E;AAC9E,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAElE"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lock-wait evidence from open-file tables. Pure: no I/O and no clock. `hang-diagnostics.ts` runs `lsof` and hands its
|
|
3
|
+
* output here, so every decision is a function of the rows it was given.
|
|
4
|
+
*
|
|
5
|
+
* A wait is open-handle evidence, not a kernel lock owner. flock(2) and fcntl(2) name no holder, so a regular file the
|
|
6
|
+
* run holds on a numbered descriptor, and that another process also holds open, is the only candidate for the lock a
|
|
7
|
+
* run blocks on. Nothing here observes the lock call itself.
|
|
8
|
+
*/
|
|
9
|
+
/** COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME; NAME is everything from the ninth column on, spaces included. */
|
|
10
|
+
const TABLE_ROW = /^\S+\s+(?<pid>\d+)\s+\S+\s+(?<fd>\S+)\s+(?<type>\S+)\s+\S+\s+\S+\s+\S+\s+(?<path>.+)$/;
|
|
11
|
+
/** The rows of an `lsof -nP` table. The header and any row that does not parse are skipped. */
|
|
12
|
+
export function parseLsofTable(text) {
|
|
13
|
+
const rows = [];
|
|
14
|
+
for (const line of text.split('\n')) {
|
|
15
|
+
const row = toOpenFile(line);
|
|
16
|
+
if (row !== null)
|
|
17
|
+
rows.push(row);
|
|
18
|
+
}
|
|
19
|
+
return rows;
|
|
20
|
+
}
|
|
21
|
+
function toOpenFile(line) {
|
|
22
|
+
const groups = TABLE_ROW.exec(line)?.groups ?? {};
|
|
23
|
+
const { pid, fd, type, path } = groups;
|
|
24
|
+
if (pid === undefined || fd === undefined || type === undefined || path === undefined)
|
|
25
|
+
return null;
|
|
26
|
+
return { pid: Number(pid), fd, type, path };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A regular file on a numbered descriptor: the only kind a blocking flock or fcntl can wait on. `cwd`, `txt`, `rtd`,
|
|
30
|
+
* `mem` and the other unnumbered descriptors name files a process runs or maps, not files it locks.
|
|
31
|
+
*/
|
|
32
|
+
function isLockable(row) {
|
|
33
|
+
return row.type === 'REG' && /^\d/.test(row.fd);
|
|
34
|
+
}
|
|
35
|
+
/** The distinct lockable paths in `tree`, sorted. */
|
|
36
|
+
export function lockCandidates(tree) {
|
|
37
|
+
return [...new Set(tree.filter(isLockable).map((row) => row.path))].sort();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The lock waits in `tree`, the open files of the run's processes. A path is a wait only when some process outside
|
|
41
|
+
* the run (`treePids` excludes the run) also holds it open. Sorted by path; holders deduplicated by pid and sorted.
|
|
42
|
+
*/
|
|
43
|
+
export function lockWaits(tree, treePids, openers) {
|
|
44
|
+
const waits = [];
|
|
45
|
+
for (const path of lockCandidates(tree)) {
|
|
46
|
+
const holders = new Map();
|
|
47
|
+
for (const opener of openers) {
|
|
48
|
+
if (opener.path === path && !treePids.has(opener.pid) && !holders.has(opener.pid)) {
|
|
49
|
+
holders.set(opener.pid, { pid: opener.pid, command: opener.command });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (holders.size === 0)
|
|
53
|
+
continue;
|
|
54
|
+
const waiters = [...new Set(tree.filter((row) => isLockable(row) && row.path === path).map((row) => row.pid))];
|
|
55
|
+
waits.push({
|
|
56
|
+
path,
|
|
57
|
+
waiters: waiters.sort((a, b) => a - b),
|
|
58
|
+
holders: [...holders.values()].sort((a, b) => a.pid - b.pid),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return waits;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Parse `lsof -F pcn` output: `p<pid>` opens a process, `c<command>` names it, `f<fd>` opens a file (lsof always
|
|
65
|
+
* emits one), and `n<path>` names the file. `null` for any other shape: the caller must then call the census
|
|
66
|
+
* incomplete, never empty.
|
|
67
|
+
*/
|
|
68
|
+
export function parseLsofFields(text) {
|
|
69
|
+
const openers = [];
|
|
70
|
+
let pid = null;
|
|
71
|
+
let command = null;
|
|
72
|
+
for (const line of text.split('\n')) {
|
|
73
|
+
if (line === '')
|
|
74
|
+
continue;
|
|
75
|
+
const value = line.slice(1);
|
|
76
|
+
switch (line.charAt(0)) {
|
|
77
|
+
case 'p': {
|
|
78
|
+
const next = Number(value);
|
|
79
|
+
if (!Number.isSafeInteger(next) || next <= 0)
|
|
80
|
+
return null;
|
|
81
|
+
pid = next;
|
|
82
|
+
command = null;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case 'c':
|
|
86
|
+
if (pid === null || command !== null)
|
|
87
|
+
return null;
|
|
88
|
+
command = value;
|
|
89
|
+
break;
|
|
90
|
+
case 'f':
|
|
91
|
+
if (pid === null)
|
|
92
|
+
return null;
|
|
93
|
+
break;
|
|
94
|
+
case 'n':
|
|
95
|
+
if (pid === null || command === null)
|
|
96
|
+
return null;
|
|
97
|
+
openers.push({ pid, command, path: value });
|
|
98
|
+
break;
|
|
99
|
+
default:
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return openers;
|
|
104
|
+
}
|
|
105
|
+
/** The holders as a reader names them: `pid 51234 (cargo), pid 9 (rustc)`. */
|
|
106
|
+
export function describeHolders(holders) {
|
|
107
|
+
return holders.map(({ pid, command }) => `pid ${pid} (${command})`).join(', ');
|
|
108
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { RunnerKind } from './runner-sizing.js';
|
|
2
|
+
/**
|
|
3
|
+
* mbx's machine-wide pool as a leaf runner meets it (specs/cowshed/05_gateway.md, "Host scheduling", "Parallelism inside
|
|
4
|
+
* a job"). With the mbx capability the canonical environment names the one pool (`MBX_SCHEDULER=1` beside the shared
|
|
5
|
+
* `MBX_CACHE_DIR`) and the job's priority in it; that pool is the host's CPU and memory ledger, so no Nx run or leaf
|
|
6
|
+
* serves a pool of its own beside it.
|
|
7
|
+
*/
|
|
8
|
+
export interface MbxPool {
|
|
9
|
+
readonly priority: 'normal' | 'low';
|
|
10
|
+
}
|
|
11
|
+
/** The pool the environment names, or `null` where the project has no mbx and cowshed's own pools apply unchanged. */
|
|
12
|
+
export declare function mbxPool(environment: Readonly<NodeJS.ProcessEnv>): MbxPool | null;
|
|
13
|
+
/**
|
|
14
|
+
* How a leaf enters the pool once: a Cargo leaf runs through mbx, which admits its compiler and supported test work
|
|
15
|
+
* itself, so wrapping it would charge it twice; any other leaf holds `cpus` of the pool for its whole run through
|
|
16
|
+
* `mbx reserve`, `cpus` being the job's own count.
|
|
17
|
+
*/
|
|
18
|
+
export type MbxLeaf = {
|
|
19
|
+
readonly kind: 'cargo';
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'reserve';
|
|
22
|
+
readonly cpus: number;
|
|
23
|
+
readonly priority: 'normal' | 'low';
|
|
24
|
+
};
|
|
25
|
+
export declare function mbxLeaf(pool: MbxPool, kind: RunnerKind, want: number): MbxLeaf;
|
|
26
|
+
/**
|
|
27
|
+
* `command` as the shell runs it under its leaf's admission. `mbx` is the canonical environment's, whose realpath
|
|
28
|
+
* cowshed's admission proved to be the host's pinned mbx.
|
|
29
|
+
*/
|
|
30
|
+
export declare function withMbxLeaf(command: string, leaf: MbxLeaf): string;
|
|
31
|
+
//# sourceMappingURL=mbx-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mbx-pool.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/mbx-pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD;;;;;GAKG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAAC;CACrC;AAED,sHAAsH;AACtH,wBAAgB,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,GAAG,IAAI,CAKhF;AAED;;;;GAIG;AACH,MAAM,MAAM,OAAO,GACf;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAAA;CAAE,CAAC;AAI7F,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAI9E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAKlE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { shellQuote } from './verdict.js';
|
|
2
|
+
/** The pool the environment names, or `null` where the project has no mbx and cowshed's own pools apply unchanged. */
|
|
3
|
+
export function mbxPool(environment) {
|
|
4
|
+
if (environment.MBX_SCHEDULER !== '1' || !environment.MBX_CACHE_DIR) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
return { priority: environment.MBX_SCHEDULER_PRIORITY === 'normal' ? 'normal' : 'low' };
|
|
8
|
+
}
|
|
9
|
+
const CARGO_LEAVES = new Set(['cargo', 'cargo-mutants', 'nextest']);
|
|
10
|
+
export function mbxLeaf(pool, kind, want) {
|
|
11
|
+
return CARGO_LEAVES.has(kind)
|
|
12
|
+
? { kind: 'cargo' }
|
|
13
|
+
: { kind: 'reserve', cpus: Math.max(1, want), priority: pool.priority };
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* `command` as the shell runs it under its leaf's admission. `mbx` is the canonical environment's, whose realpath
|
|
17
|
+
* cowshed's admission proved to be the host's pinned mbx.
|
|
18
|
+
*/
|
|
19
|
+
export function withMbxLeaf(command, leaf) {
|
|
20
|
+
if (leaf.kind === 'cargo') {
|
|
21
|
+
return command;
|
|
22
|
+
}
|
|
23
|
+
return `mbx reserve --cpus ${leaf.cpus} --priority ${leaf.priority} -- /bin/sh -c ${shellQuote(command)}`;
|
|
24
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
/**
|
|
3
|
+
* What a `bounded-exec` command leaves running, owned the way cowshed's supervisor owns a job's processes
|
|
4
|
+
* (specs/cowshed/11_shell.md, "Process identity and signal ownership"): by the tree the supervisor observes from
|
|
5
|
+
* fork, never by who works in a directory. The command runs as `cowshed subtree-root`, which asks its job's
|
|
6
|
+
* supervisor for a handle on itself while it is alive, writes that answer to an inherited descriptor, and execs the
|
|
7
|
+
* command in the same life. At the end, `cowshed retire-descendants` hands the handle back: the supervisor signals
|
|
8
|
+
* the live members its tree records under that root, and nothing else, so a process that merely works in the
|
|
9
|
+
* command's directory is never touched.
|
|
10
|
+
*/
|
|
11
|
+
/** Set by a cowshed runtime for a job only when a supervisor serves that job's socket. */
|
|
12
|
+
export declare const SUPERVISOR_SOCKET_ENV = "COWSHED_SUPERVISOR_SOCKET";
|
|
13
|
+
/**
|
|
14
|
+
* The variable naming the cowshed executable that runs `cowshed disk-command` and `cowshed subtree-root`. Unset, it is
|
|
15
|
+
* the installed `cowshed` on PATH. A repository that tests its own cowshed sets it, on the targets that test it, to that
|
|
16
|
+
* checkout's build: an installed cowshed that predates a command its own checkout added would fail the very code under
|
|
17
|
+
* test. The executor passes the one it resolved to the command, so it is part of what the command runs.
|
|
18
|
+
*/
|
|
19
|
+
export declare const COWSHED_EXECUTABLE_ENV = "COWSHED_EXECUTABLE";
|
|
20
|
+
/**
|
|
21
|
+
* The descriptor `cowshed subtree-root` writes its admission to. fd 3 is the runner lifecycle's duplex socket
|
|
22
|
+
* (`runner-hook.ts`), which must reach the command, so the admission takes the next one.
|
|
23
|
+
*/
|
|
24
|
+
export declare const HANDLE_FD = 4;
|
|
25
|
+
/** The supervisor's opaque capability for one subtree; only `retire-descendants` reads it. */
|
|
26
|
+
export type SubtreeHandle = Readonly<Record<string, unknown>>;
|
|
27
|
+
/** Why the supervisor answered no, by its own typed reason. */
|
|
28
|
+
export type SubtreeRefusal = 'foldUnavailable' | 'notMember' | 'foreignHandle' | 'jobEnded' | 'spentHandle';
|
|
29
|
+
/** What `cowshed subtree-root` wrote, or why nothing readable came. */
|
|
30
|
+
export type SubtreeAdmission = {
|
|
31
|
+
kind: 'admitted';
|
|
32
|
+
handle: SubtreeHandle;
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'refused';
|
|
35
|
+
reason: SubtreeRefusal;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'unread';
|
|
38
|
+
detail: string;
|
|
39
|
+
};
|
|
40
|
+
/** A process the retirement signalled: its pid, and its image when the supervisor read one. */
|
|
41
|
+
export interface SignalledProcess {
|
|
42
|
+
readonly pid: number;
|
|
43
|
+
readonly image: string | null;
|
|
44
|
+
readonly signal: number;
|
|
45
|
+
}
|
|
46
|
+
/** Where the supervisor's observation of the subtree may have missed something. */
|
|
47
|
+
export interface CoverageGap {
|
|
48
|
+
readonly kind: string;
|
|
49
|
+
readonly pid: number | null;
|
|
50
|
+
}
|
|
51
|
+
export type SubtreeRetirement = {
|
|
52
|
+
kind: 'retired';
|
|
53
|
+
signalled: readonly SignalledProcess[];
|
|
54
|
+
/** True when the supervisor could not list every process it signalled. */
|
|
55
|
+
signalledIncomplete: boolean;
|
|
56
|
+
gaps: readonly CoverageGap[];
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'refused';
|
|
59
|
+
reason: SubtreeRefusal;
|
|
60
|
+
} | {
|
|
61
|
+
kind: 'failed';
|
|
62
|
+
detail: string;
|
|
63
|
+
};
|
|
64
|
+
/** The client half: how a command becomes an owned subtree root, and how its subtree ends. */
|
|
65
|
+
export interface SubtreeOwner {
|
|
66
|
+
/** The argv that runs the shell `command` as an owned subtree root, its admission on {@link HANDLE_FD}. */
|
|
67
|
+
rootArgv(command: string): {
|
|
68
|
+
file: string;
|
|
69
|
+
args: string[];
|
|
70
|
+
};
|
|
71
|
+
/** Retire every live member recorded under `handle`'s root: TERM, then KILL after `graceMs`. */
|
|
72
|
+
retire(handle: SubtreeHandle, graceMs: number): Promise<SubtreeRetirement>;
|
|
73
|
+
}
|
|
74
|
+
/** Parse the admission JSON line `cowshed subtree-root` writes. */
|
|
75
|
+
export declare function parseAdmission(text: string): SubtreeAdmission;
|
|
76
|
+
/** A handle recorded as JSON, or null when the record holds none: a writer that died mid-write left no handle. */
|
|
77
|
+
export declare function parseHandle(text: string): SubtreeHandle | null;
|
|
78
|
+
/** Read the admission from the command's handle descriptor; it closes before the command execs. */
|
|
79
|
+
export declare function readAdmission(stream: Readable | null | undefined): Promise<SubtreeAdmission>;
|
|
80
|
+
/** Parse the retirement JSON line `cowshed retire-descendants` prints. */
|
|
81
|
+
export declare function parseRetirement(text: string): SubtreeRetirement;
|
|
82
|
+
/** The owner a cowshed runtime serves, through the installed `cowshed`'s own native socket client. */
|
|
83
|
+
export declare function cowshedSubtreeOwner(cowshed: string): SubtreeOwner;
|
|
84
|
+
//# sourceMappingURL=owned-subtree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owned-subtree.d.ts","sourceRoot":"","sources":["../../../src/executors/bounded-exec/owned-subtree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C;;;;;;;;GAQG;AAEH,0FAA0F;AAC1F,eAAO,MAAM,qBAAqB,8BAA8B,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,SAAS,IAAI,CAAC;AAE3B,8FAA8F;AAC9F,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE9D,+DAA+D;AAC/D,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,WAAW,GAAG,eAAe,GAAG,UAAU,GAAG,aAAa,CAAC;AAI5G,uEAAuE;AACvE,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC,+FAA+F;AAC/F,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,mFAAmF;AACnF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,MAAM,iBAAiB,GACzB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACvC,0EAA0E;IAC1E,mBAAmB,EAAE,OAAO,CAAC;IAC7B,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;CAC9B,GACD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC,8FAA8F;AAC9F,MAAM,WAAW,YAAY;IAC3B,2GAA2G;IAC3G,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC5D,gGAAgG;IAChG,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC5E;AAMD,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAoB7D;AAED,kHAAkH;AAClH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAO9D;AAED,mGAAmG;AACnG,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoB5F;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAwD/D;AAED,sGAAsG;AACtG,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAqCjE"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { isRecord } from '../../type-guards.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a `bounded-exec` command leaves running, owned the way cowshed's supervisor owns a job's processes
|
|
5
|
+
* (specs/cowshed/11_shell.md, "Process identity and signal ownership"): by the tree the supervisor observes from
|
|
6
|
+
* fork, never by who works in a directory. The command runs as `cowshed subtree-root`, which asks its job's
|
|
7
|
+
* supervisor for a handle on itself while it is alive, writes that answer to an inherited descriptor, and execs the
|
|
8
|
+
* command in the same life. At the end, `cowshed retire-descendants` hands the handle back: the supervisor signals
|
|
9
|
+
* the live members its tree records under that root, and nothing else, so a process that merely works in the
|
|
10
|
+
* command's directory is never touched.
|
|
11
|
+
*/
|
|
12
|
+
/** Set by a cowshed runtime for a job only when a supervisor serves that job's socket. */
|
|
13
|
+
export const SUPERVISOR_SOCKET_ENV = 'COWSHED_SUPERVISOR_SOCKET';
|
|
14
|
+
/**
|
|
15
|
+
* The variable naming the cowshed executable that runs `cowshed disk-command` and `cowshed subtree-root`. Unset, it is
|
|
16
|
+
* the installed `cowshed` on PATH. A repository that tests its own cowshed sets it, on the targets that test it, to that
|
|
17
|
+
* checkout's build: an installed cowshed that predates a command its own checkout added would fail the very code under
|
|
18
|
+
* test. The executor passes the one it resolved to the command, so it is part of what the command runs.
|
|
19
|
+
*/
|
|
20
|
+
export const COWSHED_EXECUTABLE_ENV = 'COWSHED_EXECUTABLE';
|
|
21
|
+
/**
|
|
22
|
+
* The descriptor `cowshed subtree-root` writes its admission to. fd 3 is the runner lifecycle's duplex socket
|
|
23
|
+
* (`runner-hook.ts`), which must reach the command, so the admission takes the next one.
|
|
24
|
+
*/
|
|
25
|
+
export const HANDLE_FD = 4;
|
|
26
|
+
const REFUSALS = ['foldUnavailable', 'notMember', 'foreignHandle', 'jobEnded', 'spentHandle'];
|
|
27
|
+
function isRefusal(value) {
|
|
28
|
+
return typeof value === 'string' && REFUSALS.includes(value);
|
|
29
|
+
}
|
|
30
|
+
/** Parse the admission JSON line `cowshed subtree-root` writes. */
|
|
31
|
+
export function parseAdmission(text) {
|
|
32
|
+
let value;
|
|
33
|
+
try {
|
|
34
|
+
value = JSON.parse(text);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return {
|
|
38
|
+
kind: 'unread',
|
|
39
|
+
detail: `cowshed subtree-root wrote no admission JSON: ${JSON.stringify(text.slice(0, 200))}`,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (isRecord(value) && value.kind === 'admitted' && isRecord(value.handle)) {
|
|
43
|
+
return { kind: 'admitted', handle: value.handle };
|
|
44
|
+
}
|
|
45
|
+
if (isRecord(value) && value.kind === 'refused' && isRefusal(value.reason)) {
|
|
46
|
+
return { kind: 'refused', reason: value.reason };
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
kind: 'unread',
|
|
50
|
+
detail: `cowshed subtree-root wrote an admission this client does not know: ${text.trim()}`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** A handle recorded as JSON, or null when the record holds none: a writer that died mid-write left no handle. */
|
|
54
|
+
export function parseHandle(text) {
|
|
55
|
+
try {
|
|
56
|
+
const value = JSON.parse(text);
|
|
57
|
+
return isRecord(value) ? value : null;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/** Read the admission from the command's handle descriptor; it closes before the command execs. */
|
|
64
|
+
export function readAdmission(stream) {
|
|
65
|
+
if (stream === null || stream === undefined) {
|
|
66
|
+
return Promise.resolve({ kind: 'unread', detail: 'the command was started without its handle descriptor' });
|
|
67
|
+
}
|
|
68
|
+
const chunks = [];
|
|
69
|
+
let settle;
|
|
70
|
+
const answer = new Promise((resolve) => {
|
|
71
|
+
settle = resolve;
|
|
72
|
+
});
|
|
73
|
+
stream.on('data', (chunk) => chunks.push(chunk));
|
|
74
|
+
stream.once('error', (error) => settle({ kind: 'unread', detail: `handle descriptor: ${error.message}` }));
|
|
75
|
+
stream.once('end', () => {
|
|
76
|
+
const text = Buffer.concat(chunks).toString('utf8');
|
|
77
|
+
settle(text.trim() === ''
|
|
78
|
+
? { kind: 'unread', detail: 'cowshed subtree-root closed its handle descriptor without an admission' }
|
|
79
|
+
: parseAdmission(text));
|
|
80
|
+
});
|
|
81
|
+
return answer;
|
|
82
|
+
}
|
|
83
|
+
/** Parse the retirement JSON line `cowshed retire-descendants` prints. */
|
|
84
|
+
export function parseRetirement(text) {
|
|
85
|
+
let value;
|
|
86
|
+
try {
|
|
87
|
+
value = JSON.parse(text);
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return {
|
|
91
|
+
kind: 'failed',
|
|
92
|
+
detail: `cowshed retire-descendants printed no JSON: ${JSON.stringify(text.slice(0, 200))}`,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (isRecord(value) && value.kind === 'refused' && isRefusal(value.reason)) {
|
|
96
|
+
return { kind: 'refused', reason: value.reason };
|
|
97
|
+
}
|
|
98
|
+
if (isRecord(value) && value.kind === 'retired' && isRecord(value.retirement)) {
|
|
99
|
+
const { containment, outlived, outlivedIncomplete } = value.retirement;
|
|
100
|
+
// `kernel` is a kernel-proven membership (a Linux cgroup), so it carries no gaps; `observed` lists what its fold
|
|
101
|
+
// may have missed (specs/cowshed/07_api.md, `containment`).
|
|
102
|
+
const lost = !isRecord(containment)
|
|
103
|
+
? null
|
|
104
|
+
: containment.kind === 'kernel'
|
|
105
|
+
? []
|
|
106
|
+
: containment.kind === 'observed' && Array.isArray(containment.lost)
|
|
107
|
+
? containment.lost
|
|
108
|
+
: null;
|
|
109
|
+
if (lost !== null && Array.isArray(outlived)) {
|
|
110
|
+
const signalled = [];
|
|
111
|
+
for (const entry of outlived) {
|
|
112
|
+
if (!isRecord(entry) || typeof entry.pid !== 'number' || typeof entry.signal !== 'number') {
|
|
113
|
+
return {
|
|
114
|
+
kind: 'failed',
|
|
115
|
+
detail: `cowshed retire-descendants named a process this client cannot read: ${JSON.stringify(entry)}`,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
signalled.push({
|
|
119
|
+
pid: entry.pid,
|
|
120
|
+
image: typeof entry.image === 'string' ? entry.image : null,
|
|
121
|
+
signal: entry.signal,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const gaps = [];
|
|
125
|
+
for (const entry of lost) {
|
|
126
|
+
if (!isRecord(entry) || typeof entry.kind !== 'string') {
|
|
127
|
+
return {
|
|
128
|
+
kind: 'failed',
|
|
129
|
+
detail: `cowshed retire-descendants named a coverage gap this client cannot read: ${JSON.stringify(entry)}`,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
gaps.push({ kind: entry.kind, pid: typeof entry.pid === 'number' ? entry.pid : null });
|
|
133
|
+
}
|
|
134
|
+
return { kind: 'retired', signalled, signalledIncomplete: outlivedIncomplete === true, gaps };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
kind: 'failed',
|
|
139
|
+
detail: `cowshed retire-descendants printed a retirement this client does not know: ${text.trim()}`,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/** The owner a cowshed runtime serves, through the installed `cowshed`'s own native socket client. */
|
|
143
|
+
export function cowshedSubtreeOwner(cowshed) {
|
|
144
|
+
return {
|
|
145
|
+
rootArgv(command) {
|
|
146
|
+
return {
|
|
147
|
+
file: cowshed,
|
|
148
|
+
args: ['subtree-root', '--handle-fd', String(HANDLE_FD), '--', '/bin/sh', '-c', command],
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
retire(handle, graceMs) {
|
|
152
|
+
const child = spawn(cowshed, ['retire-descendants', '--grace-ms', String(graceMs)], {
|
|
153
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
154
|
+
});
|
|
155
|
+
const out = [];
|
|
156
|
+
const err = [];
|
|
157
|
+
child.stdout.on('data', (chunk) => out.push(chunk));
|
|
158
|
+
child.stderr.on('data', (chunk) => err.push(chunk));
|
|
159
|
+
child.stdin.end(`${JSON.stringify(handle)}\n`);
|
|
160
|
+
// eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: the cowshed CLI bounds its own supervisor call (control bound, then the 15 s heartbeat silence; 05_gateway.md, "Deadlines") and exits with the answer or its TIMEOUT/SILENT failure
|
|
161
|
+
return new Promise((resolve) => {
|
|
162
|
+
child.once('error', (error) => resolve({ kind: 'failed', detail: `${cowshed} retire-descendants: ${error.message}` }));
|
|
163
|
+
child.once('close', (code, signal) => {
|
|
164
|
+
const stdout = Buffer.concat(out).toString('utf8');
|
|
165
|
+
if (code === 0) {
|
|
166
|
+
resolve(parseRetirement(stdout));
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const stderr = Buffer.concat(err).toString('utf8').trim();
|
|
170
|
+
resolve({
|
|
171
|
+
kind: 'failed',
|
|
172
|
+
detail: `${cowshed} retire-descendants exited ${code ?? `on ${signal}`}${stderr === '' ? '' : `: ${stderr}`}`,
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
}
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* spells `classname name`.
|
|
13
13
|
* - libtest (`cargo test`): `test tests::quick ... ok` (or `FAILED`, `ignored`); a test still running is named by
|
|
14
14
|
* `test tests::slow has been running for over 60 seconds`.
|
|
15
|
+
* - vitest: timed ✓/× test results, timed ❯ failed-file results, and ↓ skipped-file results. The default
|
|
16
|
+
* reporter prints a completed file as ✓ file (N tests) Xms, plus slow or failed tests beneath it.
|
|
17
|
+
* Reporter headers, summaries and stack locations report no new completion.
|
|
15
18
|
* - bun: a line of dots, one per test finished (`--dots`, which `withProgressReport` asks for: bun prints nothing
|
|
16
19
|
* per passing test when it believes an agent runs it), or a `(pass)`/`(fail)`/`(skip)`/`(todo)` line. bun names
|
|
17
20
|
* no test before it finishes, so a bun run names nothing in flight.
|
|
@@ -22,7 +25,7 @@
|
|
|
22
25
|
* Execution phases are owned by the private supervisor channel in runner-lifecycle.ts, never these text reports.
|
|
23
26
|
*/
|
|
24
27
|
export interface RunProgress {
|
|
25
|
-
/** One chunk of one
|
|
28
|
+
/** One chunk of one output stream; true when it reports a finished test, file or Go package. */
|
|
26
29
|
scan(stream: OutputStream, chunk: string): boolean;
|
|
27
30
|
/** The tests the runner reported running and has not reported finished, in the order it first named them. */
|
|
28
31
|
inFlight(): string[];
|