@smoothbricks/nx-plugin 0.5.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1086 -360
- package/dist/.build-inputs.json +138 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts +3 -0
- package/dist/bin/smoo-nx-cargo-toolchain.d.ts.map +1 -0
- package/dist/bin/smoo-nx-cargo-toolchain.js +8 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts +3 -0
- package/dist/bin/smoo-nx-forbidden-spellings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-forbidden-spellings.js +32 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts +3 -0
- package/dist/bin/smoo-nx-nextest-timings.d.ts.map +1 -0
- package/dist/bin/smoo-nx-nextest-timings.js +28 -0
- package/dist/bounded-test-policy.d.ts +1 -1
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +14 -15
- package/dist/build-state-output-policy.d.ts +95 -1
- package/dist/build-state-output-policy.d.ts.map +1 -1
- package/dist/build-state-output-policy.js +368 -30
- package/dist/bun-lock-scope.d.ts +44 -0
- package/dist/bun-lock-scope.d.ts.map +1 -0
- package/dist/bun-lock-scope.js +97 -0
- package/dist/cargo-build-script-env.d.ts +49 -0
- package/dist/cargo-build-script-env.d.ts.map +1 -0
- package/dist/cargo-build-script-env.js +324 -0
- package/dist/cargo-closure-input.d.ts +31 -4
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +66 -6
- package/dist/cargo-retention-hook.d.ts +17 -0
- package/dist/cargo-retention-hook.d.ts.map +1 -0
- package/dist/cargo-retention-hook.js +85 -0
- package/dist/cargo-source-hash.d.ts +25 -7
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +108 -43
- package/dist/cargo-toolchain-paths.d.ts +40 -0
- package/dist/cargo-toolchain-paths.d.ts.map +1 -0
- package/dist/cargo-toolchain-paths.js +84 -0
- package/dist/cargo-toolchain-policy.d.ts +25 -8
- package/dist/cargo-toolchain-policy.d.ts.map +1 -1
- package/dist/cargo-toolchain-policy.js +39 -5
- package/dist/cargo-workspace.d.ts +10 -4
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +65 -95
- package/dist/cross-check-policy.d.ts +9 -9
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +11 -11
- package/dist/disk-command-policy.d.ts.map +1 -1
- package/dist/disk-command-policy.js +1 -0
- package/dist/ensure-built-receipt.d.ts +13 -5
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +126 -47
- package/dist/ensure-built-witness.d.ts +27 -8
- package/dist/ensure-built-witness.d.ts.map +1 -1
- package/dist/ensure-built-witness.js +45 -15
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +9 -1
- package/dist/eslint-config-closure.d.ts +7 -0
- package/dist/eslint-config-closure.d.ts.map +1 -0
- package/dist/eslint-config-closure.js +346 -0
- package/dist/executors/bounded-exec/bounds.d.ts +56 -0
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -0
- package/dist/executors/bounded-exec/bounds.js +43 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +33 -36
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +54 -119
- package/dist/executors/bounded-exec/executor.d.ts +19 -12
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +371 -239
- package/dist/executors/bounded-exec/gateway-lease.d.ts +22 -19
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +81 -28
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +18 -1
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +148 -30
- package/dist/executors/bounded-exec/lease-wait.d.ts +43 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lease-wait.js +68 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts +51 -0
- package/dist/executors/bounded-exec/lock-wait.d.ts.map +1 -0
- package/dist/executors/bounded-exec/lock-wait.js +108 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts +84 -0
- package/dist/executors/bounded-exec/owned-subtree.d.ts.map +1 -0
- package/dist/executors/bounded-exec/owned-subtree.js +178 -0
- package/dist/executors/bounded-exec/progress.d.ts +4 -1
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +5 -2
- package/dist/executors/bounded-exec/ram-attach.d.ts +19 -0
- package/dist/executors/bounded-exec/ram-attach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-attach.js +207 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts +25 -0
- package/dist/executors/bounded-exec/ram-detach.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-detach.js +207 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +76 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp-fixtures.js +296 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +388 -88
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +1213 -399
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts +4 -4
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +20 -30
- package/dist/executors/bounded-exec/runner-hook.js +14 -5
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts +14 -1
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-lifecycle.js +27 -6
- package/dist/executors/bounded-exec/{cpu-tokens.d.ts → runner-sizing.d.ts} +14 -42
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -0
- package/dist/executors/bounded-exec/{cpu-tokens.js → runner-sizing.js} +5 -35
- package/dist/executors/bounded-exec/runtime-pin.d.ts +73 -0
- package/dist/executors/bounded-exec/runtime-pin.d.ts.map +1 -0
- package/dist/executors/bounded-exec/runtime-pin.js +167 -0
- package/dist/executors/bounded-exec/schema.d.ts +18 -1
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +40 -11
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +88 -19
- package/dist/executors/cargo-zigbuild/executor.d.ts +21 -0
- package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.js +67 -12
- package/dist/executors/clean-outputs/executor.js +1 -0
- package/dist/executors/scriptc-native/executor.d.ts +79 -0
- package/dist/executors/scriptc-native/executor.d.ts.map +1 -0
- package/dist/executors/scriptc-native/executor.js +367 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts +9 -0
- package/dist/executors/scriptc-native/ffi-paths.d.ts.map +1 -0
- package/dist/executors/scriptc-native/ffi-paths.js +25 -0
- package/dist/executors/scriptc-native/schema.d.ts +34 -0
- package/dist/executors/scriptc-native/schema.d.ts.map +1 -0
- package/dist/executors/scriptc-native/schema.js +1 -0
- package/dist/executors/typescript-emit/executor.d.ts +3 -1
- package/dist/executors/typescript-emit/executor.d.ts.map +1 -1
- package/dist/executors/typescript-emit/executor.js +164 -33
- package/dist/forbidden-spelling-policy.d.ts +56 -0
- package/dist/forbidden-spelling-policy.d.ts.map +1 -0
- package/dist/forbidden-spelling-policy.js +176 -0
- package/dist/generators/create-package/generator.d.ts.map +1 -1
- package/dist/generators/create-package/generator.js +3 -4
- package/dist/graph-input-contract.d.ts +14 -0
- package/dist/graph-input-contract.d.ts.map +1 -1
- package/dist/graph-input-contract.js +67 -2
- package/dist/index.d.ts +23 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +672 -214
- package/dist/managed-assets.d.ts +2 -0
- package/dist/managed-assets.d.ts.map +1 -1
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +28 -3
- package/dist/managed-files/managed-format.d.ts.map +1 -1
- package/dist/managed-files/managed-format.js +1 -0
- package/dist/nextest-code-bound.js +1 -0
- package/dist/nextest-timings.d.ts +35 -0
- package/dist/nextest-timings.d.ts.map +1 -0
- package/dist/nextest-timings.js +168 -0
- package/dist/owned-installation.d.ts +6 -5
- package/dist/owned-installation.d.ts.map +1 -1
- package/dist/owned-installation.js +150 -26
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +2 -3
- package/dist/process-children.d.ts +7 -0
- package/dist/process-children.d.ts.map +1 -0
- package/dist/process-children.darwin.d.ts +7 -0
- package/dist/process-children.darwin.d.ts.map +1 -0
- package/dist/process-children.darwin.js +13 -0
- package/dist/process-children.js +14 -0
- package/dist/process-children.linux.d.ts +8 -0
- package/dist/process-children.linux.d.ts.map +1 -0
- package/dist/process-children.linux.js +25 -0
- package/dist/process-group.d.ts +108 -0
- package/dist/process-group.d.ts.map +1 -0
- package/dist/process-group.js +171 -0
- package/dist/process-listing.d.ts +7 -0
- package/dist/process-listing.d.ts.map +1 -0
- package/dist/process-listing.js +51 -0
- package/dist/producer-receipts.d.ts +8 -2
- package/dist/producer-receipts.d.ts.map +1 -1
- package/dist/producer-receipts.js +75 -48
- package/dist/task-graph-policy.d.ts +21 -0
- package/dist/task-graph-policy.d.ts.map +1 -0
- package/dist/task-graph-policy.js +91 -0
- package/dist/test-timings.js +4 -4
- package/dist/test-walk-policy.d.ts +14 -5
- package/dist/test-walk-policy.d.ts.map +1 -1
- package/dist/test-walk-policy.js +8 -2
- package/dist/testing.d.ts +73 -28
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +217 -223
- package/dist/tool-bins.d.ts +33 -0
- package/dist/tool-bins.d.ts.map +1 -0
- package/dist/tool-bins.js +72 -0
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +3 -4
- package/dist/wait-why-policy.d.ts +28 -0
- package/dist/wait-why-policy.d.ts.map +1 -0
- package/dist/wait-why-policy.js +223 -0
- package/dist/workspace-config-policy.d.ts +14 -8
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +60 -16
- package/dist/workspace-manifest.d.ts +41 -6
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/dist/workspace-manifest.js +57 -0
- package/executors.json +16 -1
- package/loader.js +2 -0
- package/managed/raw/envrc +11 -0
- package/managed/raw/patches/nx@23.2.1.patch +2840 -199
- package/managed/raw/patches/ttsc@0.34.1.patch +119 -0
- package/managed/raw/tooling/direnv/cargo-fetch-bound.ts +245 -0
- package/managed/raw/tooling/direnv/cargo-fetch-run.ts +299 -0
- package/managed/raw/tooling/direnv/compiler-variables.sh +42 -0
- package/managed/raw/tooling/direnv/developer-links.ts +464 -25
- package/managed/raw/tooling/direnv/devenv.smoo.nix +78 -38
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +14 -12
- package/managed/raw/tooling/direnv/installed-bun-links.ts +308 -0
- package/managed/raw/tooling/direnv/linked-snapshots.ts +62 -3
- package/managed/raw/tooling/direnv/nx-socket-dir.sh +56 -17
- package/managed/raw/tooling/direnv/repo-path +68 -6
- package/managed/raw/tooling/direnv/secret-references.ts +13 -4
- package/managed/raw/tooling/direnv/setup-environment.ts +128 -537
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +4 -2
- package/managed/raw/tooling/direnv/ttsc-env.sh +9 -0
- package/managed/raw/tooling/direnv/uv-relocation.ts +227 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-commit.sh +2 -1
- package/managed/raw/tooling/git-hooks/pre-push.sh +2 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +85 -7
- package/managed/templates/github/actions/save-nix-devenv/action.yml +12 -2
- package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
- package/package.json +77 -13
- package/src/bin/smoo-nx-cargo-toolchain.ts +11 -0
- package/src/bin/smoo-nx-forbidden-spellings.ts +33 -0
- package/src/bin/smoo-nx-nextest-timings.ts +31 -0
- package/src/bounded-test-policy.ts +12 -14
- package/src/build-state-output-policy.ts +458 -34
- package/src/bun-lock-scope.ts +108 -0
- package/src/cargo-build-script-env.ts +265 -0
- package/src/cargo-closure-input.ts +74 -7
- package/src/cargo-retention-hook.ts +94 -0
- package/src/cargo-source-hash.ts +138 -41
- package/src/cargo-toolchain-paths.ts +95 -0
- package/src/cargo-toolchain-policy.ts +49 -5
- package/src/cargo-workspace.ts +72 -123
- package/src/cross-check-policy.ts +12 -10
- package/src/disk-command-policy.ts +1 -0
- package/src/ensure-built-receipt.ts +132 -39
- package/src/ensure-built-witness.ts +62 -10
- package/src/ensure-built.ts +11 -1
- package/src/eslint-config-closure.ts +357 -0
- package/src/executors/bounded-exec/bounds.ts +76 -0
- package/src/executors/bounded-exec/cpu-pool.ts +51 -117
- package/src/executors/bounded-exec/executor.ts +423 -259
- package/src/executors/bounded-exec/gateway-lease.ts +82 -33
- package/src/executors/bounded-exec/hang-diagnostics.ts +173 -31
- package/src/executors/bounded-exec/lease-wait.ts +89 -0
- package/src/executors/bounded-exec/lock-wait.ts +141 -0
- package/src/executors/bounded-exec/owned-subtree.ts +235 -0
- package/src/executors/bounded-exec/progress.ts +9 -3
- package/src/executors/bounded-exec/ram-attach.ts +238 -0
- package/src/executors/bounded-exec/ram-detach.ts +226 -0
- package/src/executors/bounded-exec/ram-temp-fixtures.ts +358 -0
- package/src/executors/bounded-exec/ram-temp-registry.txt +440 -0
- package/src/executors/bounded-exec/ram-temp.ts +1497 -460
- package/src/executors/bounded-exec/run-cpu-pool.ts +22 -30
- package/src/executors/bounded-exec/runner-hook.ts +14 -6
- package/src/executors/bounded-exec/runner-lifecycle.ts +31 -8
- package/src/executors/bounded-exec/{cpu-tokens.ts → runner-sizing.ts} +13 -59
- package/src/executors/bounded-exec/runtime-pin.ts +232 -0
- package/src/executors/bounded-exec/schema.json +11 -2
- package/src/executors/bounded-exec/schema.ts +19 -1
- package/src/executors/bounded-exec/verdict.ts +137 -34
- package/src/executors/cargo-zigbuild/executor.ts +82 -8
- package/src/executors/clean-outputs/executor.ts +1 -0
- package/src/executors/scriptc-native/executor.ts +394 -0
- package/src/executors/scriptc-native/ffi-paths.ts +29 -0
- package/src/executors/scriptc-native/schema.json +60 -0
- package/src/executors/scriptc-native/schema.ts +34 -0
- package/src/executors/typescript-emit/executor.ts +205 -38
- package/src/forbidden-spelling-policy.ts +226 -0
- package/src/generators/create-package/generator.ts +7 -7
- package/src/graph-input-contract.ts +61 -2
- package/src/index.ts +788 -224
- package/src/managed-assets.ts +3 -0
- package/src/managed-files/files.ts +28 -3
- package/src/managed-files/managed-format.ts +1 -0
- package/src/nextest-code-bound.ts +1 -0
- package/src/nextest-timings.ts +106 -0
- package/src/owned-installation.ts +150 -23
- package/src/package-target-policy.ts +2 -3
- package/src/process-children.darwin.ts +14 -0
- package/src/process-children.linux.ts +33 -0
- package/src/process-children.ts +22 -0
- package/src/process-group.ts +209 -0
- package/src/process-listing.ts +54 -0
- package/src/producer-receipts.ts +68 -45
- package/src/task-graph-policy.ts +98 -0
- package/src/test-walk-policy.ts +23 -8
- package/src/testing.ts +240 -232
- package/src/tool-bins.ts +108 -0
- package/src/typecheck-test-policy.ts +2 -3
- package/src/wait-why-policy.ts +226 -0
- package/src/workspace-config-policy.ts +63 -15
- package/src/workspace-manifest.ts +89 -6
- package/test-timings.json +122 -98
- package/dist/bin/smoo-nx-failures.d.ts +0 -3
- package/dist/bin/smoo-nx-failures.d.ts.map +0 -1
- package/dist/bin/smoo-nx-failures.js +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts +0 -3
- package/dist/bin/smoo-nx-nextest-extract.d.ts.map +0 -1
- package/dist/bin/smoo-nx-nextest-extract.js +0 -42
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +0 -1
- package/dist/failure-summary.d.ts +0 -5
- package/dist/failure-summary.d.ts.map +0 -1
- package/dist/failure-summary.js +0 -118
- package/dist/nextest-extraction.d.ts +0 -117
- package/dist/nextest-extraction.d.ts.map +0 -1
- package/dist/nextest-extraction.js +0 -303
- package/managed/raw/patches/ttsc@0.30.4.patch +0 -2255
- package/src/__tests__/cargo-closure-filesets.ts +0 -94
- package/src/__tests__/cargo-closure-fixture.ts +0 -113
- package/src/__tests__/counted-cargo-process.ts +0 -286
- package/src/__tests__/counted-cargo.ts +0 -713
- package/src/__tests__/directory-change.ts +0 -27
- package/src/__tests__/fixture-cargo-home.ts +0 -36
- package/src/__tests__/fixture-nx-env.ts +0 -193
- package/src/__tests__/owned-installation.ts +0 -13
- package/src/__tests__/past-tick.ts +0 -12
- package/src/__tests__/progress-clock.ts +0 -43
- package/src/__tests__/runtime-input.ts +0 -23
- package/src/bin/smoo-nx-bound-failures.test.ts +0 -127
- package/src/bin/smoo-nx-failures.ts +0 -4
- package/src/bin/smoo-nx-nextest-extract.ts +0 -44
- package/src/bounded-test-policy.test.ts +0 -1029
- package/src/build-state-output-policy.test.ts +0 -115
- package/src/bun-bootstrap.test.ts +0 -102
- package/src/bun-file-packages.test.ts +0 -47
- package/src/cargo-closure-filesets.test.ts +0 -63
- package/src/cargo-closure-input.property.test.ts +0 -50
- package/src/cargo-closure-input.test.ts +0 -506
- package/src/cargo-closure-key.test.ts +0 -240
- package/src/cargo-resolve-cache.test.ts +0 -1181
- package/src/cargo-source-hash.test.ts +0 -707
- package/src/cargo-workspace.test.ts +0 -615
- package/src/cross-check-policy.test.ts +0 -316
- package/src/disk-command-policy.test.ts +0 -61
- package/src/ensure-built-receipt.test.ts +0 -279
- package/src/ensure-built-witness.test.ts +0 -688
- package/src/ensure-built.test.ts +0 -1462
- package/src/executors/all-verdicts/executor.test.ts +0 -135
- package/src/executors/bounded-exec/cargo-progress-host.test.ts +0 -332
- package/src/executors/bounded-exec/cpu-pool.test.ts +0 -684
- package/src/executors/bounded-exec/cpu-tokens.test.ts +0 -519
- package/src/executors/bounded-exec/disk-lease.test.ts +0 -219
- package/src/executors/bounded-exec/executor-host.test.ts +0 -800
- package/src/executors/bounded-exec/executor.test.ts +0 -1819
- package/src/executors/bounded-exec/go-progress-host.test.ts +0 -171
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +0 -291
- package/src/executors/bounded-exec/progress.test.ts +0 -139
- package/src/executors/bounded-exec/ram-temp-held.test.ts +0 -264
- package/src/executors/bounded-exec/ram-temp-host.test.ts +0 -635
- package/src/executors/bounded-exec/ram-temp.test.ts +0 -750
- package/src/executors/bounded-exec/run-cpu-pool.test.ts +0 -79
- package/src/executors/bounded-exec/runner-hook.test.ts +0 -193
- package/src/executors/bounded-exec/runner-lifecycle.test.ts +0 -82
- package/src/executors/bounded-exec/verdict.test.ts +0 -545
- package/src/executors/cargo-zigbuild/executor.test.ts +0 -129
- package/src/executors/clean-outputs/executor.test.ts +0 -20
- package/src/executors/typescript-emit/executor.test.ts +0 -83
- package/src/failure-summary.ts +0 -119
- package/src/generators/bounded-test-targets/generator.test.ts +0 -138
- package/src/generators/bun-test-tracing/generator.test.ts +0 -250
- package/src/generators/create-package/generator.test.ts +0 -190
- package/src/generators/make-public/generator.test.ts +0 -137
- package/src/graph-input-contract.test.ts +0 -379
- package/src/host-controller-wiring.test.ts +0 -31
- package/src/index.test.ts +0 -3321
- package/src/linked-snapshots.nx.test.ts +0 -254
- package/src/managed-files/forgejo-artifact.test.ts +0 -395
- package/src/managed-files/generator.test.ts +0 -243
- package/src/managed-files/github-host-cache-isolation.test.ts +0 -86
- package/src/managed-files/json-edit.test.ts +0 -216
- package/src/managed-files/managed-content.test.ts +0 -166
- package/src/managed-files/managed-format-json.test.ts +0 -308
- package/src/managed-files/repo-path.test.ts +0 -172
- package/src/managed-files/setup-devenv-free-disk.test.ts +0 -95
- package/src/managed-files/trace-db-artifact.test.ts +0 -7
- package/src/managed-files/tree-permissions.test.ts +0 -109
- package/src/managed-files/tree.test.ts +0 -123
- package/src/manifest-hash.test.ts +0 -219
- package/src/nextest-code-bound.test.ts +0 -161
- package/src/nextest-extraction.test.ts +0 -216
- package/src/nextest-extraction.ts +0 -371
- package/src/nextest-partitions.test.ts +0 -501
- package/src/nx-cache-bound.test.ts +0 -109
- package/src/nx-cache-restore-mtime.test.ts +0 -170
- package/src/nx-daemon-claim.test.ts +0 -279
- package/src/nx-daemon-idle-cpu.test.ts +0 -80
- package/src/nx-daemon-idle-policy.test.ts +0 -111
- package/src/nx-daemon-ignore-files.test.ts +0 -210
- package/src/nx-daemon-root-normalization.test.ts +0 -105
- package/src/nx-daemon-start-never.test.ts +0 -292
- package/src/nx-daemon-validity.test.ts +0 -1055
- package/src/nx-dot-input-policy.test.ts +0 -353
- package/src/nx-failure-life-cycles.test.ts +0 -207
- package/src/nx-files-archive-racy.test.ts +0 -97
- package/src/nx-foreign-workspace-env.test.ts +0 -329
- package/src/nx-incomplete-run-summary.test.ts +0 -70
- package/src/nx-plugin-load-errors.test.ts +0 -120
- package/src/nx-project-graph-errors.test.ts +0 -70
- package/src/nx-project-resolution-cache.test.ts +0 -176
- package/src/nx-raw-inputs.test.ts +0 -166
- package/src/nx-resident-graph-workers.test.ts +0 -112
- package/src/nx-run-information.test.ts +0 -118
- package/src/nx-skipped-task-exit.test.ts +0 -180
- package/src/nx-state-location.test.ts +0 -63
- package/src/nx-store-resolution.test.ts +0 -81
- package/src/nx-task-graph-cycles.test.ts +0 -148
- package/src/nx-task-output-lease.test.ts +0 -550
- package/src/nx-use-local.test.ts +0 -105
- package/src/owned-installation.test.ts +0 -105
- package/src/package-target-policy.test.ts +0 -1014
- package/src/producer-receipts.test.ts +0 -285
- package/src/release-config-policy.test.ts +0 -311
- package/src/runtime-input.test.ts +0 -393
- package/src/serial-group-wiring.test.ts +0 -326
- package/src/task-history-namespace.test.ts +0 -181
- package/src/task-results.test.ts +0 -228
- package/src/test-clock-policy.test.ts +0 -338
- package/src/test-program.test.ts +0 -303
- package/src/test-timings.test.ts +0 -240
- package/src/test-walk-policy.test.ts +0 -620
- package/src/testing.test.ts +0 -509
- package/src/typecheck-test-policy.test.ts +0 -1468
- package/src/typescript-resolution.test.ts +0 -76
- package/src/version-actions.test.ts +0 -80
- package/src/workspace-config-policy.test.ts +0 -737
package/src/cargo-workspace.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { readFile } from 'node:fs/promises';
|
|
3
|
-
import { dirname, isAbsolute, join,
|
|
2
|
+
import { readFile, realpath } from 'node:fs/promises';
|
|
3
|
+
import { dirname, isAbsolute, join, posix, relative, resolve, sep } from 'node:path';
|
|
4
4
|
import { readNxJson } from 'nx/src/config/nx-json.js';
|
|
5
5
|
import { parse as parseToml, type TomlTable } from 'smol-toml';
|
|
6
6
|
|
|
7
|
-
import { type CompiledCargoInput, compiledInFiles } from './cargo-source-hash.js';
|
|
7
|
+
import { buildClosure, type CargoResolve, type CompiledCargoInput, compiledInFiles } from './cargo-source-hash.js';
|
|
8
8
|
|
|
9
9
|
export interface CargoWorkspacePackage {
|
|
10
10
|
name: string;
|
|
@@ -223,6 +223,8 @@ export interface CargoPackageTestInputsOptions {
|
|
|
223
223
|
/** The cargo workspace root holding the top-level `Cargo.toml`. */
|
|
224
224
|
absoluteProjectRoot: string;
|
|
225
225
|
memberDir: string;
|
|
226
|
+
/** Cargo's locked resolve of that workspace, which decides the crates the member's tests build. */
|
|
227
|
+
cargo: CargoResolve;
|
|
226
228
|
/** Shared across every call of one graph computation; see {@link createCargoInputsCache}. */
|
|
227
229
|
cache?: CargoInputsCache;
|
|
228
230
|
}
|
|
@@ -258,7 +260,7 @@ export function cargoPackageTestInputs(options: CargoPackageTestInputsOptions):
|
|
|
258
260
|
}
|
|
259
261
|
|
|
260
262
|
async function deriveCargoPackageTestInputs(
|
|
261
|
-
{ workspaceRoot, absoluteProjectRoot, memberDir }: CargoPackageTestInputsOptions,
|
|
263
|
+
{ workspaceRoot, absoluteProjectRoot, memberDir, cargo }: CargoPackageTestInputsOptions,
|
|
262
264
|
cache: CargoInputsCache,
|
|
263
265
|
): Promise<string[]> {
|
|
264
266
|
// Every fileset is anchored at `{workspaceRoot}`, never `{projectRoot}`: Nx
|
|
@@ -276,121 +278,58 @@ async function deriveCargoPackageTestInputs(
|
|
|
276
278
|
cache.manifests.set(normalized, parsed);
|
|
277
279
|
return parsed;
|
|
278
280
|
};
|
|
279
|
-
|
|
280
|
-
|
|
281
|
+
// Cargo reports canonical paths, so every path below is related to the canonical roots.
|
|
282
|
+
const [nxRoot, cargoRoot, crateDirectory] = await Promise.all([
|
|
283
|
+
realpath(workspaceRoot),
|
|
284
|
+
realpath(absoluteProjectRoot),
|
|
285
|
+
realpath(join(absoluteProjectRoot, memberDir)),
|
|
286
|
+
]);
|
|
287
|
+
const crate = cargo.local.find((pkg) => pkg.directory === crateDirectory);
|
|
288
|
+
if (crate === undefined) {
|
|
289
|
+
throw new Error(`Cargo's resolve of ${join(absoluteProjectRoot, 'Cargo.toml')} holds no package at ${memberDir}`);
|
|
290
|
+
}
|
|
291
|
+
// Exactly the crates Cargo builds for this crate's tests, read from Cargo's
|
|
292
|
+
// own resolve: the crate's normal, build and dev dependencies, and below it
|
|
293
|
+
// only normal and build ones (`buildClosure`), with the workspace's patches
|
|
294
|
+
// and replacements already applied. The closure, not the direct edge set: a
|
|
281
295
|
// test binary links every crate beneath it, and the chained cargo-test
|
|
282
|
-
// targets order runs without contributing to each other's hash
|
|
283
|
-
// dependency
|
|
284
|
-
//
|
|
296
|
+
// targets order runs without contributing to each other's hash. A
|
|
297
|
+
// dependency's own dev-dependencies never compile into this crate's test
|
|
298
|
+
// binaries, so an edit to one leaves this key alone.
|
|
299
|
+
const closure = buildClosure(cargo, [crate.id]);
|
|
285
300
|
const dirs = new Set<string>();
|
|
286
301
|
const external = new Map<string, string>();
|
|
287
|
-
const pending = [normalize(memberDir).split(sep).join('/')];
|
|
288
302
|
const declaredSources = new Set<string>();
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
new Map(),
|
|
296
|
-
pending,
|
|
297
|
-
external,
|
|
298
|
-
absoluteProjectRoot,
|
|
299
|
-
workspaceRoot,
|
|
300
|
-
);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
if (isRecord(rootManifest.replace)) {
|
|
304
|
-
enqueuePathDependencies(
|
|
305
|
-
{ dependencies: rootManifest.replace },
|
|
306
|
-
'.',
|
|
307
|
-
new Map(),
|
|
308
|
-
pending,
|
|
309
|
-
external,
|
|
310
|
-
absoluteProjectRoot,
|
|
311
|
-
workspaceRoot,
|
|
312
|
-
);
|
|
313
|
-
}
|
|
314
|
-
while (pending.length > 0) {
|
|
315
|
-
const dir = pending.pop();
|
|
316
|
-
if (dir === undefined || dirs.has(dir)) {
|
|
317
|
-
continue;
|
|
318
|
-
}
|
|
319
|
-
dirs.add(dir);
|
|
320
|
-
const crateTomlPath = join(absoluteProjectRoot, dir, 'Cargo.toml');
|
|
321
|
-
if (!existsSync(crateTomlPath)) {
|
|
322
|
-
continue;
|
|
323
|
-
}
|
|
324
|
-
const crateParsed = await loadManifest(crateTomlPath);
|
|
325
|
-
if (!isRecord(crateParsed)) {
|
|
326
|
-
continue;
|
|
327
|
-
}
|
|
328
|
-
let owner = resolve(absoluteProjectRoot, dir);
|
|
329
|
-
if (isRecord(crateParsed.package) && typeof crateParsed.package.workspace === 'string') {
|
|
330
|
-
owner = resolve(owner, crateParsed.package.workspace);
|
|
331
|
-
if (isOutsideRoot(relative(workspaceRoot, owner))) {
|
|
332
|
-
external.set(`${dir} workspace`, owner);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
let workspacePathDeps = new Map<string, string>();
|
|
336
|
-
while (!isOutsideRoot(relative(workspaceRoot, owner))) {
|
|
337
|
-
const manifestPath = join(owner, 'Cargo.toml');
|
|
338
|
-
if (existsSync(manifestPath)) {
|
|
339
|
-
const manifest = await loadManifest(manifestPath);
|
|
340
|
-
if (isRecord(manifest.workspace)) {
|
|
341
|
-
workspacePathDeps = workspacePathDependencies(manifest, owner);
|
|
342
|
-
declaredSources.add(manifestPath);
|
|
343
|
-
break;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
const parent = dirname(owner);
|
|
347
|
-
if (parent === owner) break;
|
|
348
|
-
owner = parent;
|
|
349
|
-
}
|
|
350
|
-
enqueuePathDependencies(crateParsed, dir, workspacePathDeps, pending, external, absoluteProjectRoot, workspaceRoot);
|
|
351
|
-
// All cfg variants can affect a compiled target; do not evaluate Cargo cfg here.
|
|
352
|
-
if (isRecord(crateParsed.target)) {
|
|
353
|
-
for (const target of Object.values(crateParsed.target)) {
|
|
354
|
-
if (isRecord(target)) {
|
|
355
|
-
enqueuePathDependencies(
|
|
356
|
-
target,
|
|
357
|
-
dir,
|
|
358
|
-
workspacePathDeps,
|
|
359
|
-
pending,
|
|
360
|
-
external,
|
|
361
|
-
absoluteProjectRoot,
|
|
362
|
-
workspaceRoot,
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
if (isRecord(crateParsed.package) && typeof crateParsed.package.build === 'string') {
|
|
368
|
-
declaredSources.add(resolve(absoluteProjectRoot, dir, crateParsed.package.build));
|
|
303
|
+
for (const pkg of cargo.local) {
|
|
304
|
+
if (!closure.has(pkg.id)) continue;
|
|
305
|
+
if (isOutsideRoot(relative(nxRoot, pkg.directory))) {
|
|
306
|
+
external.set(pkg.name, pkg.directory);
|
|
307
|
+
} else {
|
|
308
|
+
dirs.add(relative(cargoRoot, pkg.directory).split(sep).join('/') || '.');
|
|
369
309
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
declaredSources.add(resolve(absoluteProjectRoot, dir, target.path));
|
|
375
|
-
}
|
|
376
|
-
}
|
|
310
|
+
// Target sources outside the package's directory (a shared build script, a `[lib] path`), and its governing
|
|
311
|
+
// manifest.
|
|
312
|
+
for (const source of [...pkg.sources, pkg.governingManifest]) {
|
|
313
|
+
if (isOutsideRoot(relative(pkg.directory, source))) declaredSources.add(source);
|
|
377
314
|
}
|
|
378
315
|
}
|
|
379
316
|
const inputPath = (absolutePath: string): string => {
|
|
380
|
-
const cargoRelative = relative(
|
|
317
|
+
const cargoRelative = relative(cargoRoot, absolutePath).split(sep).join('/');
|
|
381
318
|
return isOutsideRoot(cargoRelative)
|
|
382
|
-
? posix.join('{workspaceRoot}', relative(
|
|
319
|
+
? posix.join('{workspaceRoot}', relative(nxRoot, absolutePath).split(sep).join('/'))
|
|
383
320
|
: posix.join(inputRoot, cargoRelative);
|
|
384
321
|
};
|
|
385
|
-
|
|
322
|
+
// Cargo.lock is not a fileset here: the runner names the crate's lock-scope
|
|
323
|
+
// node, the lock entries its closure reaches (cargo-closure-input.ts).
|
|
324
|
+
const inputs = new Set<string>([`${inputRoot}/Cargo.toml`]);
|
|
386
325
|
const exclusions = new Set<string>();
|
|
387
326
|
for (const dir of [...dirs].sort()) {
|
|
388
|
-
const absoluteDir = resolve(
|
|
327
|
+
const absoluteDir = resolve(cargoRoot, dir);
|
|
389
328
|
// Cargo packages can compile include_bytes!, headers, schemas and build.rs,
|
|
390
329
|
// not only Rust sources. Nested packages are separate source owners.
|
|
391
330
|
inputs.add(`${inputPath(absoluteDir)}/**/*`);
|
|
392
331
|
for (const child of nestedCrateDirs(absoluteDir, cache)) {
|
|
393
|
-
const childDir = relative(
|
|
332
|
+
const childDir = relative(cargoRoot, child).split(sep).join('/');
|
|
394
333
|
if (!dirs.has(childDir)) exclusions.add(`!${inputPath(child)}/**`);
|
|
395
334
|
}
|
|
396
335
|
// `include_str!("../../../skills/SKILL.md")` compiles a file the package's own
|
|
@@ -401,7 +340,7 @@ async function deriveCargoPackageTestInputs(
|
|
|
401
340
|
}
|
|
402
341
|
}
|
|
403
342
|
for (const source of [...declaredSources].sort()) {
|
|
404
|
-
const sourceRelative = relative(
|
|
343
|
+
const sourceRelative = relative(nxRoot, source);
|
|
405
344
|
if (isOutsideRoot(sourceRelative)) {
|
|
406
345
|
external.set(source, source);
|
|
407
346
|
} else {
|
|
@@ -410,7 +349,7 @@ async function deriveCargoPackageTestInputs(
|
|
|
410
349
|
}
|
|
411
350
|
// Cargo/rustup search from the command's working directory upwards. Do not
|
|
412
351
|
// hash unrelated descendant configuration or generated Cargo target caches.
|
|
413
|
-
for (let current =
|
|
352
|
+
for (let current = cargoRoot; ; current = dirname(current)) {
|
|
414
353
|
for (const config of [
|
|
415
354
|
'.cargo/config',
|
|
416
355
|
'.cargo/config.toml',
|
|
@@ -428,14 +367,14 @@ async function deriveCargoPackageTestInputs(
|
|
|
428
367
|
const cargoConfig = await loadManifest(configPath);
|
|
429
368
|
if (isRecord(cargoConfig.build) && typeof cargoConfig.build['target-dir'] === 'string') {
|
|
430
369
|
const targetDir = resolve(current, cargoConfig.build['target-dir']);
|
|
431
|
-
if (!isOutsideRoot(relative(
|
|
370
|
+
if (!isOutsideRoot(relative(nxRoot, targetDir))) {
|
|
432
371
|
exclusions.add(`!${inputPath(targetDir)}/**`);
|
|
433
372
|
}
|
|
434
373
|
}
|
|
435
374
|
}
|
|
436
375
|
}
|
|
437
376
|
}
|
|
438
|
-
if (current ===
|
|
377
|
+
if (current === nxRoot || dirname(current) === current) break;
|
|
439
378
|
}
|
|
440
379
|
inputs.add(`${inputRoot}/.config/nextest.toml`);
|
|
441
380
|
for (const generated of ['.git', 'node_modules', '.nx']) {
|
|
@@ -447,22 +386,34 @@ async function deriveCargoPackageTestInputs(
|
|
|
447
386
|
// Arbitrary build-script reads outside package trees, custom output trees,
|
|
448
387
|
// and ambient tools/environment require explicit target or named inputs.
|
|
449
388
|
if (external.size > 0) {
|
|
450
|
-
|
|
451
|
-
const listed = [...external]
|
|
452
|
-
.sort(([left], [right]) => left.localeCompare(right))
|
|
453
|
-
.map(([name, dir]) => `${name} -> ${dir}`)
|
|
454
|
-
.join(', ');
|
|
455
|
-
throw new Error(
|
|
456
|
-
`${memberDir}/Cargo.toml references inputs outside the Nx workspace (${listed}) that no fileset can hash; ` +
|
|
457
|
-
`declare namedInputs.${EXTERNAL_RUST_CRATES_INPUT} in ${join(workspaceRoot, 'nx.json')} ` +
|
|
458
|
-
'with runtime inputs that hash those external sources and configuration',
|
|
459
|
-
);
|
|
460
|
-
}
|
|
389
|
+
requireExternalRustCratesInput(workspaceRoot, `${memberDir}/Cargo.toml`, external);
|
|
461
390
|
inputs.add(EXTERNAL_RUST_CRATES_INPUT);
|
|
462
391
|
}
|
|
463
392
|
return [...inputs];
|
|
464
393
|
}
|
|
465
394
|
|
|
395
|
+
/**
|
|
396
|
+
* Refuses inputs outside the Nx workspace that `nx.json` gives no `externalRustCrates` runtime hash for: no fileset
|
|
397
|
+
* can hash them, and a key without them would replay a verdict across their edits. `external` maps each input's name
|
|
398
|
+
* to its path.
|
|
399
|
+
*/
|
|
400
|
+
export function requireExternalRustCratesInput(
|
|
401
|
+
workspaceRoot: string,
|
|
402
|
+
manifest: string,
|
|
403
|
+
external: ReadonlyMap<string, string>,
|
|
404
|
+
): void {
|
|
405
|
+
if (readNxJson(workspaceRoot).namedInputs?.[EXTERNAL_RUST_CRATES_INPUT] !== undefined) return;
|
|
406
|
+
const listed = [...external]
|
|
407
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
408
|
+
.map(([name, dir]) => `${name} -> ${dir}`)
|
|
409
|
+
.join(', ');
|
|
410
|
+
throw new Error(
|
|
411
|
+
`${manifest} references inputs outside the Nx workspace (${listed}) that no fileset can hash; ` +
|
|
412
|
+
`declare namedInputs.${EXTERNAL_RUST_CRATES_INPUT} in ${join(workspaceRoot, 'nx.json')} ` +
|
|
413
|
+
'with runtime inputs that hash those external sources and configuration',
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
|
|
466
417
|
/** Every directory beneath `root` that holds its own `Cargo.toml`, the walk stopping at each. */
|
|
467
418
|
function nestedCrateDirs(root: string, cache: CargoInputsCache): string[] {
|
|
468
419
|
const cached = cache.nestedCrateDirs.get(root);
|
|
@@ -600,7 +551,9 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
600
551
|
* exact partition of whatever the crate currently contains.
|
|
601
552
|
*
|
|
602
553
|
* It is declared rather than inferred because the only honest input is how long
|
|
603
|
-
* the suite takes, which target inference cannot measure.
|
|
554
|
+
* the suite takes, which target inference cannot measure. Measured time places a
|
|
555
|
+
* crate's slow tests instead of the hash once `.config/nextest-timings.json` names
|
|
556
|
+
* them (nextest-timings.ts). Defaulting to 1 keeps
|
|
604
557
|
* small crates on a single target without paying another Cargo freshness check.
|
|
605
558
|
*/
|
|
606
559
|
function readTestShards(cratePackage: Record<string, unknown>, crateTomlPath: string): number {
|
|
@@ -624,9 +577,6 @@ function readTestShards(cratePackage: Record<string, unknown>, crateTomlPath: st
|
|
|
624
577
|
*/
|
|
625
578
|
export const CARGO_TEST_TARGET = 'cargo-test';
|
|
626
579
|
|
|
627
|
-
/** Prerequisite that compiles the workspace; not a per-crate runner. */
|
|
628
|
-
export const CARGO_TEST_COMPILE_TARGET = 'cargo-test-compile';
|
|
629
|
-
|
|
630
580
|
/**
|
|
631
581
|
* The one workspace-wide `cargo nextest archive` every per-crate runner
|
|
632
582
|
* executes from. Named here beside the other cargo target names so the policy
|
|
@@ -774,7 +724,6 @@ export function cargoTestGroupTargetName(group: string): string {
|
|
|
774
724
|
export function packageNameFromCargoTestTarget(targetName: string): string | null {
|
|
775
725
|
if (
|
|
776
726
|
!targetName.startsWith('cargo-test-') ||
|
|
777
|
-
targetName === CARGO_TEST_COMPILE_TARGET ||
|
|
778
727
|
targetName === CARGO_TEST_ARCHIVE_TARGET ||
|
|
779
728
|
targetName.startsWith(CARGO_TEST_GROUP_PREFIX)
|
|
780
729
|
) {
|
|
@@ -1130,7 +1079,7 @@ export const PLUGIN_NEXTEST_CONFIG_PATH = 'node_modules/@smoothbricks/nx-plugin/
|
|
|
1130
1079
|
* contain spaces.
|
|
1131
1080
|
*
|
|
1132
1081
|
* The file is named through the workspace root's `node_modules` link, as
|
|
1133
|
-
*
|
|
1082
|
+
* tool package CLIs are (tool-bins.ts), never through where the plugin really lives: a
|
|
1134
1083
|
* plugin linked from a checkout outside the workspace sits a different number
|
|
1135
1084
|
* of `../` away from each workspace depending on how deep that workspace is,
|
|
1136
1085
|
* and that count re-keyed every target of every Cargo project — and every
|
|
@@ -173,17 +173,19 @@ export const CARGO_DENY_WARNINGS = `--config 'build.warnings="deny"'`;
|
|
|
173
173
|
export const CARGO_CROSS_LINT_COMMAND = `${CARGO_CROSS_LINT_GUARD}; ${CARGO_ZIGBUILD_CLIPPY_FROZEN_PREFIX}--workspace --all-targets --target ${CARGO_LINUX_TRIPLE} --target-dir target/cargo-lint-cross ${CARGO_DENY_WARNINGS}`;
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
176
|
+
* `target/cargo-lint`: clippy writes a directory of its own, as the cross lint
|
|
177
|
+
* does. Cargo flocks one build directory per invocation, and a workspace-wide
|
|
178
|
+
* check is the longest Cargo invocation in a gate, so in the dev build's
|
|
179
|
+
* `target/` it would queue the test archive and every dev build behind its lock.
|
|
180
|
+
* The price is that clippy compiles its own host units (build scripts,
|
|
181
|
+
* proc-macros) once per directory; cargo retention passes it as a nested root of
|
|
182
|
+
* the target directory, reclaiming its superseded generations but not its
|
|
183
|
+
* `incremental/`. A plain `cargo clippy --workspace --all-targets
|
|
184
|
+
* --target-dir target/cargo-lint` checks exactly these units.
|
|
185
185
|
*/
|
|
186
|
-
export const CARGO_LINT_CLIPPY_COMMAND = cargoFrozen(
|
|
186
|
+
export const CARGO_LINT_CLIPPY_COMMAND = cargoFrozen(
|
|
187
|
+
`clippy --workspace --all-targets --target-dir target/cargo-lint ${CARGO_DENY_WARNINGS}`,
|
|
188
|
+
);
|
|
187
189
|
|
|
188
190
|
/** Root `package.json` script name, in the repo's `verb:qualifier` style. */
|
|
189
191
|
export const CROSS_CHECK_SCRIPT_NAME = 'check:linux';
|
|
@@ -57,6 +57,7 @@ export function directDiskCommands(source: string, path = ''): number[] {
|
|
|
57
57
|
|
|
58
58
|
/** Scan tracked code, tests and scripts, never build output, prose or recorded benchmark data. */
|
|
59
59
|
export function checkDiskCommandBoundary(root: string): string[] {
|
|
60
|
+
// eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: a local git file listing whose length is its own read of this repository: it asks no remote, and a held index.lock fails it at once rather than waiting, so only the operator's interrupt ends a hung one
|
|
60
61
|
const files = execFileSync('git', ['ls-files', '-z', '--cached', '--others', '--exclude-standard'], {
|
|
61
62
|
cwd: root,
|
|
62
63
|
encoding: 'utf8',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import {
|
|
4
|
+
type BigIntStats,
|
|
4
5
|
closeSync,
|
|
5
6
|
lstatSync,
|
|
6
7
|
openSync,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
import { isAbsolute, join, relative } from 'node:path';
|
|
14
15
|
import type { Task } from 'nx/src/config/task-graph';
|
|
15
16
|
import type { expandOutputs, HashInputs } from 'nx/src/native';
|
|
16
|
-
import { CARGO_TOOLCHAIN_PIN_INPUTS, cargoRuntimeInput } from './cargo-toolchain-policy.js';
|
|
17
|
+
import { CARGO_TOOLCHAIN_PIN_INPUTS, cargoRuntimeInput, cargoToolchainPathsInput } from './cargo-toolchain-policy.js';
|
|
17
18
|
import type {
|
|
18
19
|
EnsureBuiltOutputReceipt,
|
|
19
20
|
EnsureBuiltProbeFailure,
|
|
@@ -21,7 +22,15 @@ import type {
|
|
|
21
22
|
EnsureBuiltProducerReceipt,
|
|
22
23
|
EnsureBuiltReceipt,
|
|
23
24
|
} from './ensure-built.js';
|
|
24
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
type CensusRead,
|
|
27
|
+
censusStart,
|
|
28
|
+
directoryMembers,
|
|
29
|
+
movedNodes,
|
|
30
|
+
type NodeWitness,
|
|
31
|
+
recordedStamp,
|
|
32
|
+
type StampFields,
|
|
33
|
+
} from './ensure-built-witness.js';
|
|
25
34
|
|
|
26
35
|
export type ReceiptEvidence<T> =
|
|
27
36
|
| { readonly ok: true; readonly value: T }
|
|
@@ -58,6 +67,7 @@ export function receiptGit(root: string, args: string[]): ReceiptEvidence<string
|
|
|
58
67
|
'GIT_NAMESPACE',
|
|
59
68
|
])
|
|
60
69
|
delete env[key];
|
|
70
|
+
// eslint-disable-next-line deadline/no-unbounded-wait -- WHY unbounded: a local git query: it asks no remote, and a held index.lock fails it at once rather than waiting, so only the operator's interrupt ends a hung one
|
|
61
71
|
const child = spawnSync('git', ['-C', root, ...args], { env, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
62
72
|
return child.status === 0 && child.error === undefined
|
|
63
73
|
? { ok: true, value: child.stdout }
|
|
@@ -141,16 +151,19 @@ function sourceFileDigests(
|
|
|
141
151
|
}
|
|
142
152
|
/**
|
|
143
153
|
* One independently read node; absolute paths also serve tool/package closures. A census records the node's stamp as
|
|
144
|
-
* of its `start` (recordedStamp); a re-read against a record records none.
|
|
154
|
+
* of its `start` (recordedStamp); a re-read against a record records none. `known` is what a census of the same capture
|
|
155
|
+
* already read of the node ({@link CensusRead}): its stat, listing and start stand for this read, so a capture stats a
|
|
156
|
+
* node once; the stability check after execution reads it again.
|
|
145
157
|
*/
|
|
146
158
|
export function receiptNode(
|
|
147
159
|
path: string,
|
|
148
160
|
name: string,
|
|
149
161
|
census?: { readonly start: bigint; readonly observed: NodeWitness[] },
|
|
150
162
|
recorded?: (path: string, stats: StampFields) => string | undefined,
|
|
163
|
+
known?: CensusRead,
|
|
151
164
|
): EnsureBuiltOutputReceipt {
|
|
152
|
-
const stats = lstatSync(path, { bigint: true });
|
|
153
|
-
census?.observed.push({ path, stamp: recordedStamp(stats, census.start) });
|
|
165
|
+
const stats = known?.stats ?? lstatSync(path, { bigint: true });
|
|
166
|
+
census?.observed.push({ path, stamp: recordedStamp(stats, known?.start ?? census.start) });
|
|
154
167
|
const mode = Number(stats.mode & 0o7777n);
|
|
155
168
|
if (stats.isFile())
|
|
156
169
|
return {
|
|
@@ -161,7 +174,7 @@ export function receiptNode(
|
|
|
161
174
|
};
|
|
162
175
|
if (stats.isSymbolicLink()) return { path: name, type: 'symlink', mode, linkText: readlinkSync(path) };
|
|
163
176
|
if (stats.isDirectory()) {
|
|
164
|
-
const entries =
|
|
177
|
+
const entries = known?.entries ?? directoryMembers(path);
|
|
165
178
|
return {
|
|
166
179
|
path: name,
|
|
167
180
|
type: 'directory',
|
|
@@ -174,17 +187,74 @@ export function receiptNode(
|
|
|
174
187
|
}
|
|
175
188
|
/**
|
|
176
189
|
* Whether a tracked source node whose stamp does not prove it (its ctime alone moved, or it was read in the tick it
|
|
177
|
-
* changed in) still holds the bytes or link text `files` recorded for it.
|
|
190
|
+
* changed in) still holds the bytes or link text `files` recorded for it. A node that is gone, or no longer a file, does not.
|
|
178
191
|
*/
|
|
179
192
|
function recordedSource(root: string, files: readonly EnsureBuiltProducerFileInput[]): (path: string) => boolean {
|
|
180
193
|
const recorded = new Map(files.map((file) => [join(root, file.path), file.sha256]));
|
|
181
|
-
return (path) =>
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
194
|
+
return (path) => {
|
|
195
|
+
try {
|
|
196
|
+
return (
|
|
197
|
+
recorded.get(path) ===
|
|
198
|
+
createHash('sha256')
|
|
199
|
+
.update(lstatSync(path).isSymbolicLink() ? readlinkSync(path) : readFileSync(path))
|
|
200
|
+
.digest('hex')
|
|
201
|
+
);
|
|
202
|
+
} catch (error) {
|
|
203
|
+
if (error instanceof Error && 'code' in error && (error.code === 'ENOENT' || error.code === 'EISDIR'))
|
|
204
|
+
return false;
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* One tracked file as it stands against HEAD's entry for it (`head.mode`, `head.oid`): the witness a receipt binds it
|
|
211
|
+
* by and the stamp it was read at, or how it differs.
|
|
212
|
+
*/
|
|
213
|
+
function trackedSource(
|
|
214
|
+
root: string,
|
|
215
|
+
file: string,
|
|
216
|
+
head: { readonly mode: string; readonly oid: string; readonly algorithm: 'sha1' | 'sha256' },
|
|
217
|
+
start: bigint,
|
|
218
|
+
): ReceiptEvidence<{ readonly node: NodeWitness; readonly input: EnsureBuiltProducerFileInput }> {
|
|
219
|
+
const path = join(root, file);
|
|
220
|
+
let stats: BigIntStats;
|
|
221
|
+
try {
|
|
222
|
+
stats = lstatSync(path, { bigint: true });
|
|
223
|
+
} catch (error) {
|
|
224
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
225
|
+
return { ok: false, detail: `Tracked source is missing: ${file}` };
|
|
226
|
+
throw error;
|
|
227
|
+
}
|
|
228
|
+
const actualMode = stats.isSymbolicLink() ? '120000' : (stats.mode & 0o111n) !== 0n ? '100755' : '100644';
|
|
229
|
+
if (actualMode !== head.mode) return { ok: false, detail: `Tracked source mode differs from HEAD: ${file}` };
|
|
230
|
+
let gitBlob: string;
|
|
231
|
+
let sha256: string;
|
|
232
|
+
if (stats.isFile()) {
|
|
233
|
+
const digests = sourceFileDigests(path, Number(stats.size), head.algorithm);
|
|
234
|
+
gitBlob = digests.gitBlob;
|
|
235
|
+
sha256 = digests.sha256;
|
|
236
|
+
} else if (stats.isSymbolicLink()) {
|
|
237
|
+
const text = readlinkSync(path);
|
|
238
|
+
gitBlob = createHash(head.algorithm)
|
|
239
|
+
.update(`blob ${Buffer.byteLength(text)}\0`)
|
|
240
|
+
.update(text)
|
|
185
241
|
.digest('hex');
|
|
242
|
+
sha256 = createHash('sha256').update(text).digest('hex');
|
|
243
|
+
} else return { ok: false, detail: `Unbound tracked source node: ${file}` };
|
|
244
|
+
if (gitBlob !== head.oid) return { ok: false, detail: `Tracked source bytes differ from HEAD: ${file}` };
|
|
245
|
+
return {
|
|
246
|
+
ok: true,
|
|
247
|
+
value: {
|
|
248
|
+
node: { path, stamp: recordedStamp(stats, start) },
|
|
249
|
+
input: { path: file, mode: Number(stats.mode & 0o7777n), gitBlob, sha256 },
|
|
250
|
+
},
|
|
251
|
+
};
|
|
186
252
|
}
|
|
187
|
-
/**
|
|
253
|
+
/**
|
|
254
|
+
* Capture every tracked source byte at pre. Unrelated untracked files are not source basis. A tracked public output is
|
|
255
|
+
* source while it holds HEAD's bytes, so a later task can read it as a FILE input; one that differs from HEAD is the
|
|
256
|
+
* run's to write, and no input binds to it.
|
|
257
|
+
*/
|
|
188
258
|
export function captureProducerSource(
|
|
189
259
|
root: string,
|
|
190
260
|
outputs: readonly string[],
|
|
@@ -214,28 +284,15 @@ export function captureProducerSource(
|
|
|
214
284
|
return { ok: false, detail: `Unproved HEAD tree entry ${entry}` };
|
|
215
285
|
if (kind !== 'blob') return { ok: false, detail: `Unbound tracked source namespace ${entry}` };
|
|
216
286
|
const file = entry.slice(tab + 1);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
const digests = sourceFileDigests(path, Number(stats.size), algorithm);
|
|
227
|
-
gitBlob = digests.gitBlob;
|
|
228
|
-
sha256 = digests.sha256;
|
|
229
|
-
} else if (stats.isSymbolicLink()) {
|
|
230
|
-
const text = readlinkSync(path);
|
|
231
|
-
gitBlob = createHash(algorithm)
|
|
232
|
-
.update(`blob ${Buffer.byteLength(text)}\0`)
|
|
233
|
-
.update(text)
|
|
234
|
-
.digest('hex');
|
|
235
|
-
sha256 = createHash('sha256').update(text).digest('hex');
|
|
236
|
-
} else return { ok: false, detail: `Unbound tracked source node: ${file}` };
|
|
237
|
-
if (gitBlob !== oid) return { ok: false, detail: `Tracked source bytes differ from HEAD: ${file}` };
|
|
238
|
-
files.push({ path: file, mode: Number(stats.mode & 0o7777n), gitBlob, sha256 });
|
|
287
|
+
const witnessed = trackedSource(root, file, { mode, oid, algorithm }, start);
|
|
288
|
+
if (!witnessed.ok) {
|
|
289
|
+
if (excluded.has(file)) continue;
|
|
290
|
+
return witnessed;
|
|
291
|
+
}
|
|
292
|
+
// A public output's stamp is the run's to move (a cache restore or a regeneration does), so only its bytes are
|
|
293
|
+
// held.
|
|
294
|
+
if (!excluded.has(file)) nodes.push(witnessed.value.node);
|
|
295
|
+
files.push(witnessed.value.input);
|
|
239
296
|
}
|
|
240
297
|
const status = receiptGit(root, ['status', '--porcelain=v1', '-z', '--untracked-files=no']);
|
|
241
298
|
if (!status.ok) return status;
|
|
@@ -250,6 +307,34 @@ export function captureProducerSource(
|
|
|
250
307
|
throw error;
|
|
251
308
|
}
|
|
252
309
|
}
|
|
310
|
+
/** Share Git and tracked-byte acquisition, never one target's output exemption with another. */
|
|
311
|
+
export function captureProducerSources(
|
|
312
|
+
root: string,
|
|
313
|
+
targets: ReadonlyMap<string, readonly string[]>,
|
|
314
|
+
): ReceiptEvidence<ReadonlyMap<string, ProducerSourceWitness>> {
|
|
315
|
+
if (targets.size === 0) return { ok: true, value: new Map() };
|
|
316
|
+
const plans = [...targets].map(([target, outputs]) => ({
|
|
317
|
+
target,
|
|
318
|
+
outputs,
|
|
319
|
+
excluded: new Set(outputs.filter((path) => !graphConfiguration(path))),
|
|
320
|
+
}));
|
|
321
|
+
const common = [...(plans[0]?.excluded ?? [])].filter((path) => plans.every(({ excluded }) => excluded.has(path)));
|
|
322
|
+
const source = captureProducerSource(root, common);
|
|
323
|
+
if (!source.ok) return source;
|
|
324
|
+
return {
|
|
325
|
+
ok: true,
|
|
326
|
+
value: new Map(
|
|
327
|
+
plans.map(({ target, outputs, excluded }) => [
|
|
328
|
+
target,
|
|
329
|
+
{
|
|
330
|
+
...source.value,
|
|
331
|
+
outputs,
|
|
332
|
+
nodes: source.value.nodes.filter(({ path }) => !excluded.has(relative(root, path))),
|
|
333
|
+
},
|
|
334
|
+
]),
|
|
335
|
+
),
|
|
336
|
+
};
|
|
337
|
+
}
|
|
253
338
|
export function producerSourceUnchanged(root: string, before: ProducerSourceWitness): ReceiptEvidence<true> {
|
|
254
339
|
const revision = receiptGit(root, ['rev-parse', '--verify', 'HEAD']);
|
|
255
340
|
if (!revision.ok) return revision;
|
|
@@ -263,8 +348,15 @@ export function producerSourceUnchanged(root: string, before: ProducerSourceWitn
|
|
|
263
348
|
return { ok: false, detail: `${changed}: HEAD's tree is ${tree.value.trim()}, not ${before.headTree}` };
|
|
264
349
|
const dirty = dirtyProviderPaths(status.value).filter((path) => !outputs.has(path));
|
|
265
350
|
if (dirty.length !== 0) return { ok: false, detail: `${changed}: ${dirty.join(', ')} differ from HEAD` };
|
|
266
|
-
const
|
|
351
|
+
const holds = recordedSource(root, before.files);
|
|
352
|
+
const moved = movedNodes(before.nodes, holds);
|
|
267
353
|
if (moved !== null) return { ok: false, detail: `${changed}: ${moved}` };
|
|
354
|
+
const rewritten = before.files.filter(({ path }) => outputs.has(path) && !holds(join(root, path)));
|
|
355
|
+
if (rewritten.length !== 0)
|
|
356
|
+
return {
|
|
357
|
+
ok: false,
|
|
358
|
+
detail: `${changed}: tracked public output ${rewritten.map(({ path }) => path).join(', ')} no longer holds HEAD's bytes`,
|
|
359
|
+
};
|
|
268
360
|
return { ok: true, value: true };
|
|
269
361
|
}
|
|
270
362
|
/** Enumerate exact public nodes; never exempt a broad directory of tracked source. */
|
|
@@ -384,7 +476,7 @@ export function providerReceipt(
|
|
|
384
476
|
throw error;
|
|
385
477
|
}
|
|
386
478
|
}
|
|
387
|
-
/** Admit only
|
|
479
|
+
/** Admit only the recipes emitted by the owning generator: the version recipes, the declared-programs one, and declared toolchain pins. */
|
|
388
480
|
export function boundedReceiptRuntimes(
|
|
389
481
|
inputs: Readonly<Record<string, HashInputs>>,
|
|
390
482
|
directories: readonly string[],
|
|
@@ -397,8 +489,8 @@ export function boundedReceiptRuntimes(
|
|
|
397
489
|
const pins = CARGO_TOOLCHAIN_PIN_INPUTS.map((path) => path.replace('{workspaceRoot}/', ''));
|
|
398
490
|
if (!pins.some((pin) => files.includes(pin)))
|
|
399
491
|
return { kind: 'opaque', detail: 'Version runtime input has no declared toolchain FILE pin' };
|
|
400
|
-
const allowed = new Set(
|
|
401
|
-
directories.flatMap((directory) =>
|
|
492
|
+
const allowed = new Set([
|
|
493
|
+
...directories.flatMap((directory) =>
|
|
402
494
|
[
|
|
403
495
|
'rustc -vV && cargo -V',
|
|
404
496
|
'rustc -vV && cargo -V && cargo clippy -V',
|
|
@@ -406,7 +498,8 @@ export function boundedReceiptRuntimes(
|
|
|
406
498
|
'rustc -vV && cargo -V && cargo nextest --version',
|
|
407
499
|
].map((command) => cargoRuntimeInput(directory, command).runtime),
|
|
408
500
|
),
|
|
409
|
-
|
|
501
|
+
cargoToolchainPathsInput().runtime,
|
|
502
|
+
]);
|
|
410
503
|
const opaque = runtimes.filter((runtime) => !allowed.has(runtime));
|
|
411
504
|
return opaque.length === 0
|
|
412
505
|
? { kind: 'bounded' }
|