@smoothbricks/nx-plugin 0.5.6 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1095 -360
- package/dist/.build-inputs.json +138 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts +3 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts.map +1 -0
- package/dist/bin/smoo-nx-cargo-toolchain.js +8 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts +3 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-forbidden-spellings.js +32 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts +3 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-nextest-timings.js +28 -0
- package/dist/bounded-test-policy.d.ts +1 -1
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +14 -15
- package/dist/build-state-output-policy.d.ts +95 -1
- package/dist/build-state-output-policy.d.ts.map +1 -1
- package/dist/build-state-output-policy.js +368 -30
- package/dist/bun-lock-scope.d.ts +44 -0
- package/dist/bun-lock-scope.d.ts.map +1 -0
- package/dist/bun-lock-scope.js +97 -0
- package/dist/cargo-build-script-env.d.ts +49 -0
- package/dist/cargo-build-script-env.d.ts.map +1 -0
- package/dist/cargo-build-script-env.js +324 -0
- package/dist/cargo-closure-input.d.ts +31 -4
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +66 -6
- package/dist/cargo-retention-hook.d.ts +17 -0
- package/dist/cargo-retention-hook.d.ts.map +1 -0
- package/dist/cargo-retention-hook.js +85 -0
- package/dist/cargo-source-hash.d.ts +25 -7
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +108 -43
- package/dist/cargo-toolchain-paths.d.ts +40 -0
- package/dist/cargo-toolchain-paths.d.ts.map +1 -0
- package/dist/cargo-toolchain-paths.js +84 -0
- package/dist/cargo-toolchain-policy.d.ts +25 -8
- package/dist/cargo-toolchain-policy.d.ts.map +1 -1
- package/dist/cargo-toolchain-policy.js +39 -5
- package/dist/cargo-workspace.d.ts +10 -4
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +65 -95
- package/dist/cross-check-policy.d.ts +9 -9
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +11 -11
- package/dist/disk-command-policy.d.ts.map +1 -1
- package/dist/disk-command-policy.js +1 -0
- package/dist/ensure-built-receipt.d.ts +13 -5
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +126 -47
- package/dist/ensure-built-witness.d.ts +27 -8
- package/dist/ensure-built-witness.d.ts.map +1 -1
- package/dist/ensure-built-witness.js +45 -15
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +9 -1
- package/dist/eslint-config-closure.d.ts +7 -0
- package/dist/eslint-config-closure.d.ts.map +1 -0
- package/dist/eslint-config-closure.js +346 -0
- package/dist/executors/all-verdicts/executor.d.ts +35 -0
- package/dist/executors/all-verdicts/executor.d.ts.map +1 -0
- package/dist/executors/all-verdicts/executor.js +133 -0
- package/dist/executors/all-verdicts/schema.d.ts +10 -0
- package/dist/executors/all-verdicts/schema.d.ts.map +1 -0
- package/dist/executors/all-verdicts/schema.js +2 -0
- package/dist/executors/bounded-exec/bounds.d.ts +56 -0
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -0
- package/dist/executors/bounded-exec/bounds.js +43 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +33 -36
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +54 -119
- package/dist/executors/bounded-exec/executor.d.ts +19 -12
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +371 -239
- package/dist/executors/bounded-exec/gateway-lease.d.ts +22 -19
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +81 -28
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
- package/dist/executors/bounded-exec/lease-wait.d.ts +43 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lease-wait.js +68 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lock-wait.js +108 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts +84 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts.map +1 -0
- package/dist/executors/bounded-exec/owned-subtree.js +178 -0
- package/dist/executors/bounded-exec/progress.d.ts +4 -1
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +5 -2
- package/dist/executors/bounded-exec/ram-attach.d.ts +19 -0
- package/dist/executors/bounded-exec/ram-attach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-attach.js +207 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts +25 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-detach.js +207 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +76 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp-fixtures.js +296 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +388 -88
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +1213 -399
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts +4 -4
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +20 -30
- package/dist/executors/bounded-exec/runner-hook.js +14 -5
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts +14 -1
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-lifecycle.js +27 -6
- package/dist/executors/bounded-exec/{cpu-tokens.d.ts → runner-sizing.d.ts} +14 -42
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -0
- package/dist/executors/bounded-exec/{cpu-tokens.js → runner-sizing.js} +5 -35
- package/dist/executors/bounded-exec/runtime-pin.d.ts +73 -0
- package/dist/executors/bounded-exec/runtime-pin.d.ts.map +1 -0
- package/dist/executors/bounded-exec/runtime-pin.js +167 -0
- package/dist/executors/bounded-exec/schema.d.ts +18 -1
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +40 -11
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +88 -19
- package/dist/executors/cargo-zigbuild/executor.d.ts +21 -0
- package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.js +67 -12
- package/dist/executors/clean-outputs/executor.js +1 -0
- package/dist/executors/scriptc-native/executor.d.ts +79 -0
- package/dist/executors/scriptc-native/executor.d.ts.map +1 -0
- package/dist/executors/scriptc-native/executor.js +367 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts +9 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts.map +1 -0
- package/dist/executors/scriptc-native/ffi-paths.js +25 -0
- package/dist/executors/scriptc-native/schema.d.ts +34 -0
- package/dist/executors/scriptc-native/schema.d.ts.map +1 -0
- package/dist/executors/scriptc-native/schema.js +1 -0
- package/dist/executors/typescript-emit/executor.d.ts +3 -1
- package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
- package/dist/executors/typescript-emit/executor.js +164 -33
- package/dist/forbidden-spelling-policy.d.ts +56 -0
- package/dist/forbidden-spelling-policy.d.ts.map +1 -0
- package/dist/forbidden-spelling-policy.js +176 -0
- package/dist/generators/create-package/generator.d.ts.map +1 -1
- package/dist/generators/create-package/generator.js +3 -4
- package/dist/graph-input-contract.d.ts +14 -0
- package/dist/graph-input-contract.d.ts.map +1 -1
- package/dist/graph-input-contract.js +67 -2
- package/dist/index.d.ts +23 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +676 -215
- package/dist/managed-assets.d.ts +2 -0
- package/dist/managed-assets.d.ts.map +1 -1
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +28 -3
- package/dist/managed-files/managed-format.d.ts.map +1 -1
- package/dist/managed-files/managed-format.js +1 -0
- package/dist/nextest-code-bound.js +1 -0
- package/dist/nextest-timings.d.ts +35 -0
- package/dist/nextest-timings.d.ts.map +1 -0
- package/dist/nextest-timings.js +168 -0
- package/dist/owned-installation.d.ts +6 -5
- package/dist/owned-installation.d.ts.map +1 -1
- package/dist/owned-installation.js +150 -26
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +2 -3
- package/dist/process-children.d.ts +7 -0
- package/dist/process-children.d.ts.map +1 -0
- package/dist/process-children.darwin.d.ts +7 -0
- package/dist/process-children.darwin.d.ts.map +1 -0
- package/dist/process-children.darwin.js +13 -0
- package/dist/process-children.js +14 -0
- package/dist/process-children.linux.d.ts +8 -0
- package/dist/process-children.linux.d.ts.map +1 -0
- package/dist/process-children.linux.js +25 -0
- package/dist/process-group.d.ts +108 -0
- package/dist/process-group.d.ts.map +1 -0
- package/dist/process-group.js +171 -0
- package/dist/process-listing.d.ts +7 -0
- package/dist/process-listing.d.ts.map +1 -0
- package/dist/process-listing.js +51 -0
- package/dist/producer-receipts.d.ts +8 -2
- package/dist/producer-receipts.d.ts.map +1 -1
- package/dist/producer-receipts.js +75 -48
- package/dist/task-graph-policy.d.ts +21 -0
- package/dist/task-graph-policy.d.ts.map +1 -0
- package/dist/task-graph-policy.js +91 -0
- package/dist/test-timings.js +4 -4
- package/dist/test-walk-policy.d.ts +14 -5
- package/dist/test-walk-policy.d.ts.map +1 -1
- package/dist/test-walk-policy.js +8 -2
- package/dist/testing.d.ts +73 -28
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +217 -223
- package/dist/tool-bins.d.ts +33 -0
- package/dist/tool-bins.d.ts.map +1 -0
- package/dist/tool-bins.js +72 -0
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +3 -4
- package/dist/wait-why-policy.d.ts +28 -0
- package/dist/wait-why-policy.d.ts.map +1 -0
- package/dist/wait-why-policy.js +223 -0
- package/dist/workspace-config-policy.d.ts +14 -8
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +60 -16
- package/dist/workspace-manifest.d.ts +41 -6
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/dist/workspace-manifest.js +57 -0
- package/executors.json +21 -1
- package/loader.js +2 -0
- package/managed/raw/envrc +11 -0
- package/managed/raw/patches/nx@23.2.1.patch +2840 -199
- package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
- package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
- package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
- package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
- package/managed/raw/tooling/direnv/developer-links.ts +464 -25
- package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
- package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
- package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
- package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
- package/managed/raw/tooling/direnv/repo-path +68 -6
- package/managed/raw/tooling/direnv/secret-references.ts +13 -4
- package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
- package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
- package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
- package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
- package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
- package/package.json +77 -13
- package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
- package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
- package/src/bin/smoo-nx-nextest-timings.ts +31 -0
- package/src/bounded-test-policy.ts +12 -14
- package/src/build-state-output-policy.ts +458 -34
- package/src/bun-lock-scope.ts +108 -0
- package/src/cargo-build-script-env.ts +265 -0
- package/src/cargo-closure-input.ts +74 -7
- package/src/cargo-retention-hook.ts +94 -0
- package/src/cargo-source-hash.ts +138 -41
- package/src/cargo-toolchain-paths.ts +95 -0
- package/src/cargo-toolchain-policy.ts +49 -5
- package/src/cargo-workspace.ts +72 -123
- package/src/cross-check-policy.ts +12 -10
- package/src/disk-command-policy.ts +1 -0
- package/src/ensure-built-receipt.ts +132 -39
- package/src/ensure-built-witness.ts +62 -10
- package/src/ensure-built.ts +11 -1
- package/src/eslint-config-closure.ts +357 -0
- package/src/executors/all-verdicts/executor.ts +164 -0
- package/src/executors/all-verdicts/schema.json +22 -0
- package/src/executors/all-verdicts/schema.ts +10 -0
- package/src/executors/bounded-exec/bounds.ts +76 -0
- package/src/executors/bounded-exec/cpu-pool.ts +51 -117
- package/src/executors/bounded-exec/executor.ts +423 -259
- package/src/executors/bounded-exec/gateway-lease.ts +82 -33
- package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
- package/src/executors/bounded-exec/lease-wait.ts +89 -0
- package/src/executors/bounded-exec/lock-wait.ts +141 -0
- package/src/executors/bounded-exec/owned-subtree.ts +235 -0
- package/src/executors/bounded-exec/progress.ts +9 -3
- package/src/executors/bounded-exec/ram-attach.ts +238 -0
- package/src/executors/bounded-exec/ram-detach.ts +226 -0
- package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
- package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
- package/src/executors/bounded-exec/ram-temp.ts +1497 -460
- package/src/executors/bounded-exec/run-cpu-pool.ts +22 -30
- package/src/executors/bounded-exec/runner-hook.ts +14 -6
- package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
- package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
- package/src/executors/bounded-exec/runtime-pin.ts +232 -0
- package/src/executors/bounded-exec/schema.json +11 -2
- package/src/executors/bounded-exec/schema.ts +19 -1
- package/src/executors/bounded-exec/verdict.ts +137 -34
- package/src/executors/cargo-zigbuild/executor.ts +82 -8
- package/src/executors/clean-outputs/executor.ts +1 -0
- package/src/executors/scriptc-native/executor.ts +394 -0
- package/src/executors/scriptc-native/ffi-paths.ts +29 -0
- package/src/executors/scriptc-native/schema.json +60 -0
- package/src/executors/scriptc-native/schema.ts +34 -0
- package/src/executors/typescript-emit/executor.ts +205 -38
- package/src/forbidden-spelling-policy.ts +226 -0
- package/src/generators/create-package/generator.ts +7 -7
- package/src/graph-input-contract.ts +61 -2
- package/src/index.ts +792 -225
- package/src/managed-assets.ts +3 -0
- package/src/managed-files/files.ts +28 -3
- package/src/managed-files/managed-format.ts +1 -0
- package/src/nextest-code-bound.ts +1 -0
- package/src/nextest-timings.ts +106 -0
- package/src/owned-installation.ts +150 -23
- package/src/package-target-policy.ts +2 -3
- package/src/process-children.darwin.ts +14 -0
- package/src/process-children.linux.ts +33 -0
- package/src/process-children.ts +22 -0
- package/src/process-group.ts +209 -0
- package/src/process-listing.ts +54 -0
- package/src/producer-receipts.ts +68 -45
- package/src/task-graph-policy.ts +98 -0
- package/src/test-walk-policy.ts +23 -8
- package/src/testing.ts +240 -232
- package/src/tool-bins.ts +108 -0
- package/src/typecheck-test-policy.ts +2 -3
- package/src/wait-why-policy.ts +226 -0
- package/src/workspace-config-policy.ts +63 -15
- package/src/workspace-manifest.ts +89 -6
- package/test-timings.json +123 -98
- package/dist/bin/smoo-nx-failures.d.ts +0 -3
- package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
- package/dist/bin/smoo-nx-failures.js +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
- package/dist/bin/smoo-nx-nextest-extract.js +0 -42
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
- package/dist/failure-summary.d.ts +0 -5
- package/dist/failure-summary.d.ts.map +0 -1
- package/dist/failure-summary.js +0 -118
- package/dist/nextest-extraction.d.ts +0 -117
- package/dist/nextest-extraction.d.ts.map +0 -1
- package/dist/nextest-extraction.js +0 -303
- package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
- package/src/__tests__/cargo-closure-filesets.ts +0 -94
- package/src/__tests__/cargo-closure-fixture.ts +0 -113
- package/src/__tests__/counted-cargo-process.ts +0 -286
- package/src/__tests__/counted-cargo.ts +0 -713
- package/src/__tests__/directory-change.ts +0 -27
- package/src/__tests__/fixture-cargo-home.ts +0 -36
- package/src/__tests__/fixture-nx-env.ts +0 -193
- package/src/__tests__/owned-installation.ts +0 -13
- package/src/__tests__/past-tick.ts +0 -12
- package/src/__tests__/progress-clock.ts +0 -43
- package/src/__tests__/runtime-input.ts +0 -23
- package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
- package/src/bin/smoo-nx-failures.ts +0 -4
- package/src/bin/smoo-nx-nextest-extract.ts +0 -44
- package/src/bounded-test-policy.test.ts +0 -1029
- package/src/build-state-output-policy.test.ts +0 -115
- package/src/bun-bootstrap.test.ts +0 -102
- package/src/bun-file-packages.test.ts +0 -47
- package/src/cargo-closure-filesets.test.ts +0 -63
- package/src/cargo-closure-input.property.test.ts +0 -50
- package/src/cargo-closure-input.test.ts +0 -506
- package/src/cargo-closure-key.test.ts +0 -240
- package/src/cargo-resolve-cache.test.ts +0 -1181
- package/src/cargo-source-hash.test.ts +0 -707
- package/src/cargo-workspace.test.ts +0 -615
- package/src/cross-check-policy.test.ts +0 -316
- package/src/disk-command-policy.test.ts +0 -61
- package/src/ensure-built-receipt.test.ts +0 -279
- package/src/ensure-built-witness.test.ts +0 -688
- package/src/ensure-built.test.ts +0 -1462
- package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
- package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
- package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
- package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
- package/src/executors/bounded-exec/executor-host.test.ts +0 -800
- package/src/executors/bounded-exec/executor.test.ts +0 -1819
- package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
- package/src/executors/bounded-exec/progress.test.ts +0 -139
- package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
- package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
- package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
- package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
- package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
- package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
- package/src/executors/bounded-exec/verdict.test.ts +0 -545
- package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
- package/src/executors/clean-outputs/executor.test.ts +0 -20
- package/src/executors/typescript-emit/executor.test.ts +0 -83
- package/src/failure-summary.ts +0 -119
- package/src/generators/bounded-test-targets/generator.test.ts +0 -138
- package/src/generators/bun-test-tracing/generator.test.ts +0 -250
- package/src/generators/create-package/generator.test.ts +0 -190
- package/src/generators/make-public/generator.test.ts +0 -137
- package/src/graph-input-contract.test.ts +0 -379
- package/src/host-controller-wiring.test.ts +0 -31
- package/src/index.test.ts +0 -3319
- package/src/linked-snapshots.nx.test.ts +0 -254
- package/src/managed-files/forgejo-artifact.test.ts +0 -395
- package/src/managed-files/generator.test.ts +0 -243
- package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
- package/src/managed-files/json-edit.test.ts +0 -216
- package/src/managed-files/managed-content.test.ts +0 -166
- package/src/managed-files/managed-format-json.test.ts +0 -308
- package/src/managed-files/repo-path.test.ts +0 -172
- package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
- package/src/managed-files/trace-db-artifact.test.ts +0 -7
- package/src/managed-files/tree-permissions.test.ts +0 -109
- package/src/managed-files/tree.test.ts +0 -123
- package/src/manifest-hash.test.ts +0 -219
- package/src/nextest-code-bound.test.ts +0 -161
- package/src/nextest-extraction.test.ts +0 -216
- package/src/nextest-extraction.ts +0 -371
- package/src/nextest-partitions.test.ts +0 -501
- package/src/nx-cache-bound.test.ts +0 -109
- package/src/nx-cache-restore-mtime.test.ts +0 -170
- package/src/nx-daemon-claim.test.ts +0 -279
- package/src/nx-daemon-idle-cpu.test.ts +0 -80
- package/src/nx-daemon-idle-policy.test.ts +0 -111
- package/src/nx-daemon-ignore-files.test.ts +0 -210
- package/src/nx-daemon-root-normalization.test.ts +0 -105
- package/src/nx-daemon-start-never.test.ts +0 -292
- package/src/nx-daemon-validity.test.ts +0 -1055
- package/src/nx-dot-input-policy.test.ts +0 -353
- package/src/nx-failure-life-cycles.test.ts +0 -207
- package/src/nx-files-archive-racy.test.ts +0 -97
- package/src/nx-foreign-workspace-env.test.ts +0 -329
- package/src/nx-incomplete-run-summary.test.ts +0 -70
- package/src/nx-plugin-load-errors.test.ts +0 -120
- package/src/nx-project-graph-errors.test.ts +0 -70
- package/src/nx-project-resolution-cache.test.ts +0 -176
- package/src/nx-raw-inputs.test.ts +0 -166
- package/src/nx-resident-graph-workers.test.ts +0 -112
- package/src/nx-run-information.test.ts +0 -118
- package/src/nx-skipped-task-exit.test.ts +0 -180
- package/src/nx-state-location.test.ts +0 -63
- package/src/nx-store-resolution.test.ts +0 -81
- package/src/nx-task-graph-cycles.test.ts +0 -148
- package/src/nx-task-output-lease.test.ts +0 -550
- package/src/nx-use-local.test.ts +0 -105
- package/src/owned-installation.test.ts +0 -105
- package/src/package-target-policy.test.ts +0 -1014
- package/src/producer-receipts.test.ts +0 -285
- package/src/release-config-policy.test.ts +0 -311
- package/src/runtime-input.test.ts +0 -393
- package/src/serial-group-wiring.test.ts +0 -326
- package/src/task-history-namespace.test.ts +0 -181
- package/src/task-results.test.ts +0 -228
- package/src/test-clock-policy.test.ts +0 -338
- package/src/test-program.test.ts +0 -303
- package/src/test-timings.test.ts +0 -240
- package/src/test-walk-policy.test.ts +0 -620
- package/src/testing.test.ts +0 -509
- package/src/typecheck-test-policy.test.ts +0 -1468
- package/src/typescript-resolution.test.ts +0 -76
- package/src/version-actions.test.ts +0 -80
- package/src/workspace-config-policy.test.ts +0 -737
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import { spawnSync } from 'node:child_process';
|
|
3
|
-
import { mkdtemp, readdir, readFile, rm } from 'node:fs/promises';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { join, sep } from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import type { ProjectGraph } from 'nx/src/config/project-graph';
|
|
8
|
-
import { createTaskGraph } from 'nx/src/tasks-runner/create-task-graph.js';
|
|
9
|
-
import { parse as parseToml } from 'smol-toml';
|
|
10
|
-
import typia from 'typia';
|
|
11
|
-
import {
|
|
12
|
-
type CargoWorkspacePackage,
|
|
13
|
-
cargoPackageTestInputs,
|
|
14
|
-
listCargoWorkspacePackages,
|
|
15
|
-
NEXTEST_REPO_CONFIG_PATH,
|
|
16
|
-
SERIAL_TEST_GROUP_PLATFORM,
|
|
17
|
-
serialTestGroups,
|
|
18
|
-
} from './cargo-workspace.js';
|
|
19
|
-
import { COWSHED_EXECUTABLE_ENV } from './executors/bounded-exec/ram-temp.js';
|
|
20
|
-
import { isRecord } from './type-guards.js';
|
|
21
|
-
|
|
22
|
-
/** The repository this package is built in: its own nextest config, nx.json and manifests are what these pin. */
|
|
23
|
-
const REPOSITORY = fileURLToPath(new URL('../../..', import.meta.url));
|
|
24
|
-
const ROOT_PROJECT = '@smoothbricks/codebase';
|
|
25
|
-
const DEVICE_GROUP = 'cargo-test-group-real-apfs';
|
|
26
|
-
const HOST_GROUP = 'cargo-test-group-real-apfs-host';
|
|
27
|
-
/** cowshed's build, which leaves the host's own CLI where the package's launcher finds it. */
|
|
28
|
-
const CHECKOUT_COWSHED_BUILD = { projects: ['cowshed'], target: 'build' };
|
|
29
|
-
|
|
30
|
-
describe('the real-APFS serial groups of this repository', () => {
|
|
31
|
-
it('are exactly the device group and the host group, each scoped to the packages it holds', () => {
|
|
32
|
-
const groups = serialTestGroups(join(REPOSITORY, NEXTEST_REPO_CONFIG_PATH));
|
|
33
|
-
// A third group is a decision about ordering against these two, test-host and the explicit tests below.
|
|
34
|
-
expect(groups.map(({ group, scope }) => ({ group, scope }))).toEqual([
|
|
35
|
-
{ group: 'real-apfs', scope: { kind: 'packages', packages: ['cowshed-apfs-tests'] } },
|
|
36
|
-
{ group: 'real-apfs-host', scope: { kind: 'packages', packages: ['cowshed-cli', 'cowshed-core'] } },
|
|
37
|
-
]);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('hash a scenario edit for the device group alone, and the production substrate they share for both', async () => {
|
|
41
|
-
const groups = serialTestGroups(join(REPOSITORY, NEXTEST_REPO_CONFIG_PATH));
|
|
42
|
-
const members = listCargoWorkspacePackages(REPOSITORY);
|
|
43
|
-
// The inputs Nx hashes for a group's runner: the closure of every package its filter names, as the plugin derives it.
|
|
44
|
-
const inputsOf = async (group: string): Promise<string[]> => {
|
|
45
|
-
const scope = groups.find((candidate) => candidate.group === group)?.scope;
|
|
46
|
-
if (scope?.kind !== 'packages') throw new Error(`${group} is not scoped to packages`);
|
|
47
|
-
const hashed = await Promise.all(
|
|
48
|
-
scope.packages.map((name) => {
|
|
49
|
-
const member = members.find((candidate) => candidate.name === name);
|
|
50
|
-
if (member === undefined) throw new Error(`${name} is not a member of the Cargo workspace`);
|
|
51
|
-
return cargoPackageTestInputs({
|
|
52
|
-
workspaceRoot: REPOSITORY,
|
|
53
|
-
absoluteProjectRoot: REPOSITORY,
|
|
54
|
-
memberDir: member.dir,
|
|
55
|
-
});
|
|
56
|
-
}),
|
|
57
|
-
);
|
|
58
|
-
return hashed.flat();
|
|
59
|
-
};
|
|
60
|
-
const device = await inputsOf('real-apfs');
|
|
61
|
-
const host = await inputsOf('real-apfs-host');
|
|
62
|
-
const reruns = (path: string) => ({ device: hashes(device, path), host: hashes(host, path) });
|
|
63
|
-
const crates = 'packages/cowshed/crates';
|
|
64
|
-
|
|
65
|
-
// The three cases. An unrelated crate reruns neither group. A scenario edit reruns the device group alone,
|
|
66
|
-
// because no host crate depends on the crate the scenarios live in. A change to the production substrate, or to
|
|
67
|
-
// what it links, reruns both, because the host crates link it too.
|
|
68
|
-
expect(reruns('packages/columine/crates/columine-vm/src/lib.rs')).toEqual({ device: false, host: false });
|
|
69
|
-
expect(reruns(`${crates}/cowshed-apfs-tests/src/tests.rs`)).toEqual({ device: true, host: false });
|
|
70
|
-
expect(reruns(`${crates}/cowshed-apfs/src/lib.rs`)).toEqual({ device: true, host: true });
|
|
71
|
-
expect(reruns(`${crates}/cowshed-os/src/lib.rs`)).toEqual({ device: true, host: true });
|
|
72
|
-
expect(reruns(`${crates}/cowshed-core/src/lib.rs`)).toEqual({ device: false, host: true });
|
|
73
|
-
expect(reruns(`${crates}/cowshed-cli/src/main.rs`)).toEqual({ device: false, host: true });
|
|
74
|
-
// The test support every real-image binary compiles in stays hashed for both, and no tests tree is excluded.
|
|
75
|
-
for (const support of [
|
|
76
|
-
`${crates}/cowshed-apfs/tests/support/scratch_apfs.rs`,
|
|
77
|
-
`${crates}/cowshed-os/tests/support/scratch_processes.rs`,
|
|
78
|
-
]) {
|
|
79
|
-
expect(reruns(support), support).toEqual({ device: true, host: true });
|
|
80
|
-
}
|
|
81
|
-
for (const inputs of [device, host]) {
|
|
82
|
-
expect(inputs.filter((input) => input.startsWith('!') && /\btests?\b/.test(input))).toEqual([]);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('run the host group after the device group, so two real-image runners never overlap', async () => {
|
|
87
|
-
const nx = await readRecord('nx.json', JSON.parse);
|
|
88
|
-
const host = child(child(nx, 'targetDefaults'), HOST_GROUP);
|
|
89
|
-
// `...` keeps the inferred archive and fetch edges ahead of the explicit ones.
|
|
90
|
-
expect(host.dependsOn).toEqual(['...', CHECKOUT_COWSHED_BUILD, DEVICE_GROUP]);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("run this checkout's cowshed, built first, for every disk command the code under test makes", async () => {
|
|
94
|
-
const nx = await readRecord('nx.json', JSON.parse);
|
|
95
|
-
const plugin = await readRecord('packages/nx-plugin/package.json', JSON.parse);
|
|
96
|
-
// The groups and the RAM-volume host tests exercise the disk-command facade. An installed cowshed that predates a
|
|
97
|
-
// command this checkout added would fail them, so each names the checkout's launcher, after cowshed's build.
|
|
98
|
-
const targets = [
|
|
99
|
-
child(child(nx, 'targetDefaults'), DEVICE_GROUP),
|
|
100
|
-
child(child(nx, 'targetDefaults'), HOST_GROUP),
|
|
101
|
-
child(child(child(plugin, 'nx'), 'targets'), 'test-host'),
|
|
102
|
-
];
|
|
103
|
-
for (const target of targets) {
|
|
104
|
-
expect(target.dependsOn).toContainEqual(CHECKOUT_COWSHED_BUILD);
|
|
105
|
-
expect(child(child(target, 'options'), 'env')).toEqual({
|
|
106
|
-
[COWSHED_EXECUTABLE_ENV]: '{workspaceRoot}/packages/cowshed/bin/cowshed',
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('reaches host groups only through the explicit host and land gates, preserving the old land task set', async () => {
|
|
112
|
-
const graph = await repositoryProjectGraph();
|
|
113
|
-
const projects = Object.keys(graph.nodes);
|
|
114
|
-
const targets = [...new Set(projects.flatMap((name) => Object.keys(graph.nodes[name]?.data.targets ?? {})))];
|
|
115
|
-
const tasks = createTaskGraph(graph, {}, projects, targets, undefined, {});
|
|
116
|
-
const device = `${ROOT_PROJECT}:${DEVICE_GROUP}`;
|
|
117
|
-
const host = `${ROOT_PROJECT}:${HOST_GROUP}`;
|
|
118
|
-
const hostGate = `${ROOT_PROJECT}:host-e2e`;
|
|
119
|
-
const gate = `${ROOT_PROJECT}:gate`;
|
|
120
|
-
// Package-declared nodes and explicit edges exist on every host; only macOS inference supplies a runner.
|
|
121
|
-
expect(Object.keys(tasks.tasks)).toEqual(expect.arrayContaining([device, host, hostGate, gate]));
|
|
122
|
-
for (const name of [DEVICE_GROUP, HOST_GROUP]) {
|
|
123
|
-
const target = graph.nodes[ROOT_PROJECT]?.data.targets?.[name];
|
|
124
|
-
expect(target, name).toBeDefined();
|
|
125
|
-
if (process.platform === 'darwin') {
|
|
126
|
-
expect(target?.executor, name).toBe('@smoothbricks/nx-plugin:bounded-exec');
|
|
127
|
-
expect(target?.options?.command, name).toContain('nextest run');
|
|
128
|
-
} else {
|
|
129
|
-
// Nx normalizes the package-declared placeholder to a no-op, never an APFS runner.
|
|
130
|
-
expect(target?.executor, name).toBe('nx:noop');
|
|
131
|
-
expect(target?.options?.command, name).toBeUndefined();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
const edges = (id: string): string[] => [
|
|
135
|
-
...(tasks.dependencies[id] ?? []),
|
|
136
|
-
...(tasks.continuousDependencies?.[id] ?? []),
|
|
137
|
-
];
|
|
138
|
-
const groupsReached: Record<string, string[]> = {};
|
|
139
|
-
for (const id of Object.keys(tasks.tasks)) {
|
|
140
|
-
const seen = new Set<string>();
|
|
141
|
-
const pending = edges(id);
|
|
142
|
-
for (let next = pending.pop(); next !== undefined; next = pending.pop()) {
|
|
143
|
-
if (seen.has(next)) continue;
|
|
144
|
-
seen.add(next);
|
|
145
|
-
pending.push(...edges(next));
|
|
146
|
-
}
|
|
147
|
-
const groups = [...seen].filter((reached) => reached === device || reached === host).sort();
|
|
148
|
-
if (groups.length > 0) groupsReached[id] = groups;
|
|
149
|
-
}
|
|
150
|
-
// Ordinary tests must not pull expensive images into the inner loop. Only these explicit aggregates may.
|
|
151
|
-
expect(groupsReached).toEqual({ [host]: [device], [hostGate]: [device, host], [gate]: [device, host] });
|
|
152
|
-
const planned = (selected: string[]): string[] => {
|
|
153
|
-
const runnable = projects.filter((name) =>
|
|
154
|
-
selected.some((target) => graph.nodes[name]?.data.targets?.[target] !== undefined),
|
|
155
|
-
);
|
|
156
|
-
return Object.keys(createTaskGraph(graph, {}, runnable, selected, undefined, {}).tasks).sort();
|
|
157
|
-
};
|
|
158
|
-
const oldGate = planned(['lint', 'test', 'build', DEVICE_GROUP, HOST_GROUP]);
|
|
159
|
-
expect(planned(['gate']).filter((id) => id !== gate && id !== hostGate)).toEqual(oldGate);
|
|
160
|
-
expect(planned(['host-e2e']).filter((id) => id !== hostGate)).toEqual(planned([DEVICE_GROUP, HOST_GROUP]));
|
|
161
|
-
expect(planned(['test'])).not.toContain(device);
|
|
162
|
-
expect(planned(['test'])).not.toContain(host);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('wrap exactly their tests in the 30s code-bound class, behind the 60s class that wins first', async () => {
|
|
166
|
-
const config = await readRecord(NEXTEST_REPO_CONFIG_PATH, parseToml);
|
|
167
|
-
const profile = child(child(config, 'profile'), 'default');
|
|
168
|
-
const overrides = records(profile.overrides);
|
|
169
|
-
const scripts = records(profile.scripts);
|
|
170
|
-
const grouped = overrides.filter(
|
|
171
|
-
(override) => override['test-group'] === 'real-apfs' || override['test-group'] === 'real-apfs-host',
|
|
172
|
-
);
|
|
173
|
-
const thirtySecond = scripts.filter((script) => script['run-wrapper'] === 'real-apfs-code-30s');
|
|
174
|
-
|
|
175
|
-
// A config file has no `group()` predicate, so the 30s rules repeat the groups' filters verbatim, one for one:
|
|
176
|
-
// together they are exactly the tests the groups hold, and no ordinary test is bound to a real-image class.
|
|
177
|
-
expect(thirtySecond.map((script) => script.filter).sort()).toEqual(
|
|
178
|
-
grouped.map((override) => override.filter).sort(),
|
|
179
|
-
);
|
|
180
|
-
expect(scripts.map((script) => script['run-wrapper'])).toEqual([
|
|
181
|
-
'real-apfs-code-60s',
|
|
182
|
-
...grouped.map(() => 'real-apfs-code-30s'),
|
|
183
|
-
]);
|
|
184
|
-
// Everything here, groups and wrappers alike, applies on the one platform a serial group runs on.
|
|
185
|
-
for (const rule of [...grouped, ...scripts]) {
|
|
186
|
-
expect(rule.platform, JSON.stringify(rule.filter)).toBe(SERIAL_TEST_GROUP_PLATFORM);
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it('hold every real_apfs_ test: none sits in a package no group is scoped to', async () => {
|
|
191
|
-
const groups = serialTestGroups(join(REPOSITORY, NEXTEST_REPO_CONFIG_PATH));
|
|
192
|
-
const scoped = new Set(groups.flatMap(({ scope }) => (scope.kind === 'packages' ? scope.packages : [])));
|
|
193
|
-
const owners = new Set<string>();
|
|
194
|
-
for (const source of await rustSources(listCargoWorkspacePackages(REPOSITORY))) {
|
|
195
|
-
if (/\bfn real_apfs_\w+/.test(source.text)) owners.add(source.owner);
|
|
196
|
-
}
|
|
197
|
-
// Scoping a group to packages made this a rule to keep: a `real_apfs_` test in any other crate would run in an
|
|
198
|
-
// ordinary shard beside every other test, not in a serial group.
|
|
199
|
-
expect([...owners].filter((name) => !scoped.has(name))).toEqual([]);
|
|
200
|
-
expect([...owners].sort()).toEqual(['cowshed-apfs-tests', 'cowshed-cli', 'cowshed-core']);
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
it('pin each exact test by a function that exists at that module path', async () => {
|
|
204
|
-
const groups = serialTestGroups(join(REPOSITORY, NEXTEST_REPO_CONFIG_PATH));
|
|
205
|
-
const scoped = new Set(groups.flatMap(({ scope }) => (scope.kind === 'packages' ? scope.packages : [])));
|
|
206
|
-
const sources = await rustSources(listCargoWorkspacePackages(REPOSITORY), scoped);
|
|
207
|
-
// A group with no exact-name clause pins nothing, so there is nothing that can go stale.
|
|
208
|
-
const pinned = groups.flatMap(({ filter }) => [...filter.matchAll(/test\(=([^),]+)\)/g)].map((match) => match[1]));
|
|
209
|
-
for (const exactName of pinned) {
|
|
210
|
-
// `a::b::tests::name`: a module path, the `tests` module, then the function. A name that moved with its
|
|
211
|
-
// module matches no test and silently leaves the group, so each must still resolve to one function.
|
|
212
|
-
const segments = (exactName ?? '').split('::');
|
|
213
|
-
const name = segments[segments.length - 1];
|
|
214
|
-
const modulePath = segments.slice(0, -2).join('/');
|
|
215
|
-
const holders = sources.filter(({ text }) => text.includes(`fn ${name}(`));
|
|
216
|
-
expect(holders, exactName).toHaveLength(1);
|
|
217
|
-
expect(holders[0]?.path, exactName).toMatch(new RegExp(`/src/${modulePath}(?:/mod)?\\.rs$`));
|
|
218
|
-
expect(holders[0]?.text, exactName).toContain('mod tests');
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
/** `path` of the repository, parsed by `parse`, which must be an object. */
|
|
224
|
-
async function readRecord(path: string, parse: (text: string) => unknown): Promise<Record<string, unknown>> {
|
|
225
|
-
const parsed = parse(await readFile(join(REPOSITORY, path), 'utf8'));
|
|
226
|
-
if (!isRecord(parsed)) throw new Error(`${path} is not an object`);
|
|
227
|
-
return parsed;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function child(parent: Record<string, unknown>, key: string): Record<string, unknown> {
|
|
231
|
-
const value = parent[key];
|
|
232
|
-
if (!isRecord(value)) throw new Error(`${key} is not an object`);
|
|
233
|
-
return value;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function records(value: unknown): Record<string, unknown>[] {
|
|
237
|
-
if (!Array.isArray(value)) throw new Error('expected an array of tables');
|
|
238
|
-
return value.map((entry) => {
|
|
239
|
-
if (!isRecord(entry)) throw new Error('expected a table');
|
|
240
|
-
return entry;
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
const parseProjectGraph = typia.json.createAssertParse<ProjectGraph>();
|
|
245
|
-
// The child computes the graph outside this package's bunfig; it takes the same transform preload as the test runner.
|
|
246
|
-
const VALIDATION_PRELOAD = fileURLToPath(import.meta.resolve('@smoothbricks/validation/bun/preload'));
|
|
247
|
-
const GRAPH_SCRIPT = `const { createProjectGraphAsync } = await import('nx/src/project-graph/project-graph.js');
|
|
248
|
-
const graph = await createProjectGraphAsync({ exitOnError: false });
|
|
249
|
-
process.stdout.write(JSON.stringify({ nodes: graph.nodes, dependencies: graph.dependencies }));`;
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* The repository's own project graph, as Nx builds it with this plugin: computed daemonless, in a child that exits when
|
|
253
|
-
* it is done, with plugins in its own process and workspace data of its own, so it neither starts a daemon nor writes
|
|
254
|
-
* the checkout's graph cache.
|
|
255
|
-
*/
|
|
256
|
-
async function repositoryProjectGraph(): Promise<ProjectGraph> {
|
|
257
|
-
const data = await mkdtemp(join(tmpdir(), 'serial-group-graph-'));
|
|
258
|
-
try {
|
|
259
|
-
const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.startsWith('NX_')));
|
|
260
|
-
const run = spawnSync(process.execPath, ['--preload', VALIDATION_PRELOAD, '-e', GRAPH_SCRIPT], {
|
|
261
|
-
cwd: REPOSITORY,
|
|
262
|
-
encoding: 'utf8',
|
|
263
|
-
maxBuffer: 256 * 1024 * 1024,
|
|
264
|
-
env: {
|
|
265
|
-
...env,
|
|
266
|
-
NX_DAEMON: 'false',
|
|
267
|
-
NX_ISOLATE_PLUGINS: 'false',
|
|
268
|
-
NX_CACHE_PROJECT_GRAPH: 'false',
|
|
269
|
-
NX_WORKSPACE_DATA_DIRECTORY: data,
|
|
270
|
-
},
|
|
271
|
-
});
|
|
272
|
-
if (run.status !== 0) throw new Error(`the project graph child exited ${run.status}: ${run.stderr}`);
|
|
273
|
-
return parseProjectGraph(run.stdout);
|
|
274
|
-
} finally {
|
|
275
|
-
await rm(data, { recursive: true, force: true });
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
interface RustSource {
|
|
280
|
-
/** The Cargo package whose tree holds the file. */
|
|
281
|
-
readonly owner: string;
|
|
282
|
-
/** The file, relative to the repository. */
|
|
283
|
-
readonly path: string;
|
|
284
|
-
readonly text: string;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Every Rust source of `members` (of only the packages `only` names, when given), each credited to the deepest
|
|
289
|
-
* member whose directory holds it: a crate nested inside another is its own owner's.
|
|
290
|
-
*/
|
|
291
|
-
async function rustSources(
|
|
292
|
-
members: readonly CargoWorkspacePackage[],
|
|
293
|
-
only?: ReadonlySet<string>,
|
|
294
|
-
): Promise<RustSource[]> {
|
|
295
|
-
const sources: RustSource[] = [];
|
|
296
|
-
for (const member of members.filter(({ name }) => only?.has(name) ?? true)) {
|
|
297
|
-
const nested = members
|
|
298
|
-
.filter(({ dir }) => dir.startsWith(`${member.dir}/`))
|
|
299
|
-
.map(({ dir }) => dir.slice(member.dir.length + 1));
|
|
300
|
-
const files = (await readdir(join(REPOSITORY, member.dir), { recursive: true })).filter(
|
|
301
|
-
(file) =>
|
|
302
|
-
file.endsWith('.rs') &&
|
|
303
|
-
!file.split(sep).some((part) => part === 'target' || part === 'node_modules') &&
|
|
304
|
-
!nested.some((dir) => file.startsWith(`${dir}${sep}`)),
|
|
305
|
-
);
|
|
306
|
-
const read = await Promise.all(
|
|
307
|
-
files.map(async (file) => ({
|
|
308
|
-
owner: member.name,
|
|
309
|
-
path: join(member.dir, file),
|
|
310
|
-
text: await readFile(join(REPOSITORY, member.dir, file), 'utf8'),
|
|
311
|
-
})),
|
|
312
|
-
);
|
|
313
|
-
sources.push(...read);
|
|
314
|
-
}
|
|
315
|
-
return sources;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/** Whether Nx would hash `path` (workspace-relative) under the `{workspaceRoot}` filesets of `inputs`. */
|
|
319
|
-
function hashes(inputs: readonly string[], path: string): boolean {
|
|
320
|
-
const filesets = inputs.filter((input) => input.includes('{workspaceRoot}'));
|
|
321
|
-
const matches = (fileset: string): boolean => new Bun.Glob(fileset.replace('{workspaceRoot}/', '')).match(path);
|
|
322
|
-
return (
|
|
323
|
-
filesets.some((input) => !input.startsWith('!') && matches(input)) &&
|
|
324
|
-
!filesets.some((input) => input.startsWith('!') && matches(input.slice(1)))
|
|
325
|
-
);
|
|
326
|
-
}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { Database } from 'bun:sqlite';
|
|
2
|
-
import { expect, it } from 'bun:test';
|
|
3
|
-
import { execFileSync, spawn } from 'node:child_process';
|
|
4
|
-
import { mkdir, readdir, readFile, symlink, writeFile } from 'node:fs/promises';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
|
-
import { guardEvent } from './__tests__/counted-cargo.js';
|
|
7
|
-
import { fixtureNxEnv, stopFixtureNxDaemon, withNxFixture } from './__tests__/fixture-nx-env.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Guards `patches/nx@23.2.1.patch`, the local build of nrwl/nx#37268 (issue
|
|
11
|
-
* nrwl/nx#37118): Nx 23.2.1 forwards task history to its daemon, whose database
|
|
12
|
-
* scope can differ from the client's, and a run then exits 1 with SQLite
|
|
13
|
-
* FOREIGN KEY 787 after its tasks succeed. Drop the patch, and keep this test,
|
|
14
|
-
* once the Nx version in use contains that fix.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const repositoryRoot = join(import.meta.dir, '../../..');
|
|
18
|
-
|
|
19
|
-
async function runNx(root: string, env: Record<string, string>, configuration: string): Promise<string> {
|
|
20
|
-
const child = spawn(
|
|
21
|
-
'node',
|
|
22
|
-
[join(repositoryRoot, 'node_modules/.bin/nx'), 'run', `app:build:${configuration}`, '--outputStyle=static'],
|
|
23
|
-
{
|
|
24
|
-
cwd: root,
|
|
25
|
-
env,
|
|
26
|
-
detached: process.platform !== 'win32',
|
|
27
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
28
|
-
},
|
|
29
|
-
);
|
|
30
|
-
let output = '';
|
|
31
|
-
child.stdout?.setEncoding('utf8').on('data', (text: string) => {
|
|
32
|
-
output += text;
|
|
33
|
-
});
|
|
34
|
-
child.stderr?.setEncoding('utf8').on('data', (text: string) => {
|
|
35
|
-
output += text;
|
|
36
|
-
});
|
|
37
|
-
const { promise: ended, resolve, reject } = Promise.withResolvers<number | null>();
|
|
38
|
-
child.once('error', reject);
|
|
39
|
-
child.once('close', resolve);
|
|
40
|
-
try {
|
|
41
|
-
const code = await guardEvent(
|
|
42
|
-
ended,
|
|
43
|
-
`Nx app:build:${configuration} to close`,
|
|
44
|
-
() => `pid ${child.pid}, exit ${child.exitCode}, signal ${child.signalCode}\n${output}`,
|
|
45
|
-
);
|
|
46
|
-
expect(code, output).toBe(0);
|
|
47
|
-
return output;
|
|
48
|
-
} catch (error) {
|
|
49
|
-
if (child.pid !== undefined && child.exitCode === null && child.signalCode === null) {
|
|
50
|
-
try {
|
|
51
|
-
process.kill(process.platform === 'win32' ? child.pid : -child.pid, 'SIGKILL');
|
|
52
|
-
} catch (killError) {
|
|
53
|
-
if (!(killError instanceof Error && 'code' in killError && killError.code === 'ESRCH')) {
|
|
54
|
-
throw new AggregateError([error, killError], 'could not retire the failed fixture Nx command');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
await ended.catch(() => undefined);
|
|
59
|
-
throw error;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async function recordedRuns(directory: string) {
|
|
64
|
-
const files = (await readdir(directory)).filter((file) => file.endsWith('.db'));
|
|
65
|
-
expect(files).toHaveLength(1);
|
|
66
|
-
const file = files[0];
|
|
67
|
-
if (file === undefined) throw new Error(`no Nx database in ${directory}`);
|
|
68
|
-
// Nx keeps this database in WAL mode, and its last connection deletes the
|
|
69
|
-
// -wal/-shm pair on close. A SQLITE_OPEN_READONLY connection cannot recreate
|
|
70
|
-
// the -shm index and fails with SQLITE_CANTOPEN, so read through an ordinary
|
|
71
|
-
// read-write (never create) connection, which also sees any un-checkpointed
|
|
72
|
-
// WAL frames. The query below only reads.
|
|
73
|
-
const database = new Database(join(directory, file), { readwrite: true });
|
|
74
|
-
try {
|
|
75
|
-
return database
|
|
76
|
-
.query<{ configuration: string; status: string; code: number; cacheCode: number }, []>(`
|
|
77
|
-
SELECT details.configuration, history.status, history.code, cache.code AS cacheCode
|
|
78
|
-
FROM task_history history
|
|
79
|
-
JOIN task_details details ON details.hash = history.hash
|
|
80
|
-
JOIN cache_outputs cache ON cache.hash = history.hash
|
|
81
|
-
WHERE history.status = 'success'
|
|
82
|
-
ORDER BY history.id
|
|
83
|
-
`)
|
|
84
|
-
.all();
|
|
85
|
-
} finally {
|
|
86
|
-
database.close();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
it('records task history in the client database when the running daemon resolved the shared one', async () => {
|
|
91
|
-
await withNxFixture(
|
|
92
|
-
'nx-history-owner-',
|
|
93
|
-
async ({ root: base, socketDirectory, workspace: root }) => {
|
|
94
|
-
// Nx shares its DB and cache across a repository's checkouts under ~/.nx/<id>;
|
|
95
|
-
// a private HOME keeps that shared scope inside the fixture.
|
|
96
|
-
const home = join(base, 'home');
|
|
97
|
-
const {
|
|
98
|
-
NX_WORKSPACE_DATA_DIRECTORY: _data,
|
|
99
|
-
NX_CACHE_DIRECTORY: _cache,
|
|
100
|
-
...defaultScope
|
|
101
|
-
} = fixtureNxEnv(root, socketDirectory);
|
|
102
|
-
// NX_DAEMON: this regression needs the daemon, which fixtureNxEnv turns off.
|
|
103
|
-
const sharedEnv = { ...defaultScope, HOME: home, NX_DAEMON: 'true' };
|
|
104
|
-
// Naming the checkout's default workspace-data directory explicitly keeps the
|
|
105
|
-
// same daemon record, but any explicit data/cache directory turns Nx's sharing
|
|
106
|
-
// off: this client's task details and cache rows land in the checkout DB.
|
|
107
|
-
const localEnv = { ...fixtureNxEnv(root, socketDirectory), HOME: home, NX_DAEMON: 'true' };
|
|
108
|
-
const localData = join(root, '.nx/workspace-data');
|
|
109
|
-
await mkdir(join(root, 'app'), { recursive: true });
|
|
110
|
-
await mkdir(home);
|
|
111
|
-
await symlink(join(repositoryRoot, 'node_modules'), join(root, 'node_modules'), 'dir');
|
|
112
|
-
await writeFile(join(root, '.gitignore'), 'node_modules\n.nx\nexecutions.log\napp/result.txt\n');
|
|
113
|
-
await writeFile(join(root, 'package.json'), JSON.stringify({ name: 'history-owner-fixture', private: true }));
|
|
114
|
-
await writeFile(join(root, 'nx.json'), '{}\n');
|
|
115
|
-
await writeFile(
|
|
116
|
-
join(root, 'app/project.json'),
|
|
117
|
-
JSON.stringify({
|
|
118
|
-
name: 'app',
|
|
119
|
-
targets: {
|
|
120
|
-
build: {
|
|
121
|
-
executor: 'nx:run-commands',
|
|
122
|
-
cache: true,
|
|
123
|
-
inputs: ['{projectRoot}/build.cjs'],
|
|
124
|
-
outputs: ['{projectRoot}/result.txt'],
|
|
125
|
-
options: { cwd: 'app' },
|
|
126
|
-
configurations: {
|
|
127
|
-
first: { command: 'node build.cjs first' },
|
|
128
|
-
second: { command: 'node build.cjs second' },
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
}),
|
|
133
|
-
);
|
|
134
|
-
await writeFile(
|
|
135
|
-
join(root, 'app/build.cjs'),
|
|
136
|
-
`const fs = require('node:fs');\nconst value = process.argv[2];\nfs.writeFileSync('result.txt', value);\nfs.appendFileSync('../executions.log', value + '\\n');\n`,
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
execFileSync('git', ['init', '--quiet', root], { stdio: 'pipe' });
|
|
140
|
-
// A remote is what gives the checkout the repository identity Nx shares by.
|
|
141
|
-
execFileSync('git', ['-C', root, 'remote', 'add', 'origin', 'https://github.com/example/history-owner.git'], {
|
|
142
|
-
stdio: 'pipe',
|
|
143
|
-
});
|
|
144
|
-
const firstOutput = await runNx(root, sharedEnv, 'first');
|
|
145
|
-
const daemonRecord = join(localData, 'd/server-process.json');
|
|
146
|
-
const initialDaemon = await readFile(daemonRecord, 'utf8').catch(async (error: unknown) => {
|
|
147
|
-
const log = await readFile(join(localData, 'd/daemon.log'), 'utf8').catch(
|
|
148
|
-
(readError: unknown) => `daemon log unreadable: ${String(readError)}`,
|
|
149
|
-
);
|
|
150
|
-
throw new Error(`fixture Nx did not retain its normal daemon record\n${firstOutput}\n${log}`, { cause: error });
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
// Same daemon, but this client's TaskDetails select the checkout DB. Unpatched
|
|
154
|
-
// Nx 23.2.1 forwards RECORD_TASK_RUNS to the daemon, whose DB scope was frozen
|
|
155
|
-
// shared at startup and lacks the new hash: after the successful task footer
|
|
156
|
-
// it prints "DB transaction error ... extended_code: 787" and exits 1.
|
|
157
|
-
await runNx(root, localEnv, 'second');
|
|
158
|
-
expect(await readFile(daemonRecord, 'utf8')).toBe(initialDaemon);
|
|
159
|
-
expect(await readFile(join(root, 'executions.log'), 'utf8')).toBe('first\nsecond\n');
|
|
160
|
-
|
|
161
|
-
// The checkout cache answers the repeat: the recorded hash is usable.
|
|
162
|
-
await runNx(root, localEnv, 'second');
|
|
163
|
-
expect(await readFile(join(root, 'executions.log'), 'utf8')).toBe('first\nsecond\n');
|
|
164
|
-
expect(await readFile(join(root, 'app/result.txt'), 'utf8')).toBe('second');
|
|
165
|
-
expect(await readFile(daemonRecord, 'utf8')).toBe(initialDaemon);
|
|
166
|
-
// Stop the fixture's daemon so no Nx process still holds either database
|
|
167
|
-
// when the independent SQLite reader inspects them.
|
|
168
|
-
await stopFixtureNxDaemon(root, fixtureNxEnv(root, socketDirectory));
|
|
169
|
-
const [sharedId, ...otherShared] = await readdir(join(home, '.nx'));
|
|
170
|
-
expect(otherShared).toEqual([]);
|
|
171
|
-
if (sharedId === undefined) throw new Error(`no shared Nx scope under ${home}/.nx`);
|
|
172
|
-
expect(await recordedRuns(join(home, '.nx', sharedId, 'databases'))).toEqual([
|
|
173
|
-
{ configuration: 'first', status: 'success', code: 0, cacheCode: 0 },
|
|
174
|
-
]);
|
|
175
|
-
expect(await recordedRuns(localData)).toEqual([
|
|
176
|
-
{ configuration: 'second', status: 'success', code: 0, cacheCode: 0 },
|
|
177
|
-
]);
|
|
178
|
-
},
|
|
179
|
-
'workspace',
|
|
180
|
-
);
|
|
181
|
-
});
|