@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,95 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
|
|
6
|
-
/** The setup action's steps in the order a runner takes them, each as its fields. */
|
|
7
|
-
function actionSteps(yaml: string): Map<string, unknown>[] {
|
|
8
|
-
const action: unknown = Bun.YAML.parse(yaml);
|
|
9
|
-
if (typeof action !== 'object' || action === null || !('runs' in action)) return [];
|
|
10
|
-
const runs = action.runs;
|
|
11
|
-
if (typeof runs !== 'object' || runs === null || !('steps' in runs) || !Array.isArray(runs.steps)) return [];
|
|
12
|
-
return runs.steps.map(
|
|
13
|
-
(step: unknown) => new Map(typeof step === 'object' && step !== null ? Object.entries(step) : []),
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const steps = actionSteps(
|
|
18
|
-
readFileSync(new URL('../../managed/templates/github/actions/setup-devenv/action.yml', import.meta.url), 'utf8'),
|
|
19
|
-
);
|
|
20
|
-
const freeDiskAt = steps.findIndex((step) => String(step.get('run') ?? '').includes('sudo rm -rf'));
|
|
21
|
-
const freeDisk = steps[freeDiskAt];
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Runs the step's script the way GitHub runs a bash step, with df reporting `freeGiB` free on / and sudo exiting with
|
|
25
|
-
* `sudoStatus`. A sudo that succeeds frees 40 GiB; nothing on disk is deleted.
|
|
26
|
-
*/
|
|
27
|
-
function runFreeDisk(freeGiB: number, sudoStatus: number) {
|
|
28
|
-
if (!freeDisk) throw new Error('setup-devenv has no step that frees runner disk');
|
|
29
|
-
const tools = mkdtempSync(join(tmpdir(), 'hostedtoolcache-'));
|
|
30
|
-
try {
|
|
31
|
-
const stubs = [
|
|
32
|
-
'free=$((FREE_GIB * 1024 * 1024))',
|
|
33
|
-
'df() { if [ "$1" = -k ]; then printf "Avail\\n%s\\n" "$free"; else echo "df $*"; fi; }',
|
|
34
|
-
'sudo() { echo "sudo $*"; [ "$SUDO_STATUS" = 0 ] || return "$SUDO_STATUS"; free=$((free + 40 * 1024 * 1024)); }',
|
|
35
|
-
].join('\n');
|
|
36
|
-
const result = Bun.spawnSync(
|
|
37
|
-
['bash', '--noprofile', '--norc', '-eo', 'pipefail', '-c', `${stubs}\n${String(freeDisk.get('run'))}`],
|
|
38
|
-
{
|
|
39
|
-
env: {
|
|
40
|
-
...process.env,
|
|
41
|
-
AGENT_TOOLSDIRECTORY: tools,
|
|
42
|
-
FREE_GIB: String(freeGiB),
|
|
43
|
-
SUDO_STATUS: String(sudoStatus),
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
);
|
|
47
|
-
const stdout = result.stdout.toString();
|
|
48
|
-
return {
|
|
49
|
-
tools,
|
|
50
|
-
status: result.exitCode,
|
|
51
|
-
stdout,
|
|
52
|
-
deletes: stdout.split('\n').filter((line) => line.startsWith('sudo rm -rf ')),
|
|
53
|
-
};
|
|
54
|
-
} finally {
|
|
55
|
-
rmSync(tools, { recursive: true, force: true });
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
describe('freeing GitHub-hosted runner disk in setup-devenv', () => {
|
|
60
|
-
test('runs only on GitHub-hosted Linux runners that take the ephemeral path', () => {
|
|
61
|
-
// A self-hosted machine keeps everything, even one that takes the ephemeral branch.
|
|
62
|
-
expect(String(freeDisk?.get('if')).split(' && ').sort()).toEqual([
|
|
63
|
-
"runner.environment == 'github-hosted'",
|
|
64
|
-
"runner.os == 'Linux'",
|
|
65
|
-
"steps.runner-kind.outputs.host != 'true'",
|
|
66
|
-
]);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('frees the space before any action restores or installs something on the disk', () => {
|
|
70
|
-
expect(freeDisk).toBeDefined();
|
|
71
|
-
// Every action the setup uses restores a cache or installs Nix.
|
|
72
|
-
const actions = steps.flatMap((step, index) => (step.has('uses') ? [index] : []));
|
|
73
|
-
expect(actions.length).toBeGreaterThan(0);
|
|
74
|
-
expect(Math.min(...actions)).toBeGreaterThan(freeDiskAt);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
test('deletes nothing on a runner that already has the space', () => {
|
|
78
|
-
const run = runFreeDisk(90, 0);
|
|
79
|
-
expect(run.status).toBe(0);
|
|
80
|
-
expect(run.deletes).toEqual([]);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
test('stops deleting as soon as / has the space', () => {
|
|
84
|
-
const run = runFreeDisk(10, 0);
|
|
85
|
-
expect(run.status).toBe(0);
|
|
86
|
-
expect(run.deletes).toHaveLength(1);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test('warns and goes on when a delete fails, since freeing space is never a gate', () => {
|
|
90
|
-
const run = runFreeDisk(10, 1);
|
|
91
|
-
expect(run.status).toBe(0);
|
|
92
|
-
expect(run.deletes).toContain(`sudo rm -rf ${run.tools}`);
|
|
93
|
-
expect(run.stdout).toContain(`::warning::could not remove ${run.tools}`);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { expect, it } from 'bun:test';
|
|
2
|
-
import { TRACE_DB_DIRECTORY, TRACE_DB_FILENAME } from '@smoothbricks/lmao/sqlite';
|
|
3
|
-
import { TRACE_DB_ARTIFACT_GLOB } from './ci-workflow.js';
|
|
4
|
-
|
|
5
|
-
it('uploads the trace sink from where lmao writes it, WAL sidecars included', () => {
|
|
6
|
-
expect(TRACE_DB_ARTIFACT_GLOB).toBe(`packages/*/${TRACE_DB_DIRECTORY}/${TRACE_DB_FILENAME}*`);
|
|
7
|
-
});
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it } from 'bun:test';
|
|
2
|
-
import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { dirname, join } from 'node:path';
|
|
5
|
-
import { createTree } from 'nx/src/devkit-testing-exports.js';
|
|
6
|
-
import { FsTree, flushChanges } from 'nx/src/generators/tree.js';
|
|
7
|
-
import { LOCAL_SECTION_MARKER } from './managed-content.js';
|
|
8
|
-
import { type ManagedFile, stageManagedFiles } from './tree.js';
|
|
9
|
-
|
|
10
|
-
const script = {
|
|
11
|
-
target: 'tooling/run',
|
|
12
|
-
content: '#!/bin/sh\necho ready\n',
|
|
13
|
-
executable: true,
|
|
14
|
-
} satisfies ManagedFile;
|
|
15
|
-
const roots: string[] = [];
|
|
16
|
-
|
|
17
|
-
function diskTree(content: string, mode: number): FsTree {
|
|
18
|
-
const root = mkdtempSync(join(tmpdir(), 'smoo-tree-mode-'));
|
|
19
|
-
roots.push(root);
|
|
20
|
-
const target = join(root, script.target);
|
|
21
|
-
mkdirSync(dirname(target), { recursive: true });
|
|
22
|
-
writeFileSync(target, content);
|
|
23
|
-
chmodSync(target, mode);
|
|
24
|
-
return new FsTree(root, false);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
afterEach(() => {
|
|
28
|
-
for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true });
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
describe('managed permissions compose with other Nx generators', () => {
|
|
32
|
-
it('makes an already-staged matching script executable', () => {
|
|
33
|
-
const tree = createTree();
|
|
34
|
-
tree.write(script.target, script.content);
|
|
35
|
-
expect(stageManagedFiles(tree, [script])[0].action).toBe('updated');
|
|
36
|
-
expect(tree.listChanges().find(({ path }) => path === script.target)?.options?.mode).toBe(0o755);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('uses staged permissions rather than stale filesystem metadata', () => {
|
|
40
|
-
const tree = createTree();
|
|
41
|
-
tree.write(script.target, script.content, { mode: 0o644 });
|
|
42
|
-
const paths = new Map([[script.target, { executable: true }]]);
|
|
43
|
-
expect(stageManagedFiles(tree, [script], paths)[0].action).toBe('updated');
|
|
44
|
-
expect(tree.listChanges().find(({ path }) => path === script.target)?.options?.mode).toBe(0o755);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('is unchanged on a second pass even when the disk snapshot predates the repair', () => {
|
|
48
|
-
const tree = createTree();
|
|
49
|
-
tree.write(script.target, script.content);
|
|
50
|
-
const paths = new Map([[script.target, { executable: false }]]);
|
|
51
|
-
stageManagedFiles(tree, [script], paths);
|
|
52
|
-
const before = tree.listChanges();
|
|
53
|
-
expect(stageManagedFiles(tree, [script], paths)[0].action).toBe('unchanged');
|
|
54
|
-
expect(tree.listChanges()).toEqual(before);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('recognizes octal-string modes supported by Nx Tree', () => {
|
|
58
|
-
const tree = createTree();
|
|
59
|
-
tree.write(script.target, script.content, { mode: '755' });
|
|
60
|
-
const before = tree.listChanges();
|
|
61
|
-
expect(stageManagedFiles(tree, [script], new Map([[script.target, { executable: false }]]))[0].action).toBe(
|
|
62
|
-
'unchanged',
|
|
63
|
-
);
|
|
64
|
-
expect(tree.listChanges()).toEqual(before);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('removes a staged executable bit from a non-executable managed file', () => {
|
|
68
|
-
const tree = createTree();
|
|
69
|
-
tree.write(script.target, script.content, { mode: 0o755 });
|
|
70
|
-
expect(stageManagedFiles(tree, [{ ...script, executable: false }])[0].action).toBe('updated');
|
|
71
|
-
expect(tree.listChanges().find(({ path }) => path === script.target)?.options?.mode).toBe(0o644);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('preserves local content during a staged permission-only repair', () => {
|
|
75
|
-
const tree = createTree();
|
|
76
|
-
const current = `${script.content}\n${LOCAL_SECTION_MARKER}\n# local\n`;
|
|
77
|
-
tree.write(script.target, current);
|
|
78
|
-
stageManagedFiles(tree, [script]);
|
|
79
|
-
expect(tree.read(script.target, 'utf8')).toBe(current);
|
|
80
|
-
expect(tree.listChanges().find(({ path }) => path === script.target)?.options?.mode).toBe(0o755);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('retains the required mode when write() elides a reversion to the disk contents', () => {
|
|
84
|
-
const tree = diskTree(script.content, 0o644);
|
|
85
|
-
tree.write(script.target, '#!/bin/sh\necho temporary\n', { mode: 0o755 });
|
|
86
|
-
stageManagedFiles(tree, [script], new Map([[script.target, { executable: false }]]));
|
|
87
|
-
flushChanges(tree.root, tree.listChanges());
|
|
88
|
-
expect(readFileSync(join(tree.root, script.target), 'utf8')).toBe(script.content);
|
|
89
|
-
expect(statSync(join(tree.root, script.target)).mode & 0o777).toBe(0o755);
|
|
90
|
-
|
|
91
|
-
const fresh = new FsTree(tree.root, false);
|
|
92
|
-
expect(stageManagedFiles(fresh, [script], new Map([[script.target, { executable: true }]]))[0].action).toBe(
|
|
93
|
-
'unchanged',
|
|
94
|
-
);
|
|
95
|
-
expect(fresh.listChanges()).toEqual([]);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('inherits the disk mode for a pending update with no explicit mode', () => {
|
|
99
|
-
const tree = diskTree('#!/bin/sh\necho old\n', 0o755);
|
|
100
|
-
tree.write(script.target, script.content);
|
|
101
|
-
const before = tree.listChanges();
|
|
102
|
-
expect(stageManagedFiles(tree, [script], new Map([[script.target, { executable: true }]]))[0].action).toBe(
|
|
103
|
-
'unchanged',
|
|
104
|
-
);
|
|
105
|
-
expect(tree.listChanges()).toEqual(before);
|
|
106
|
-
flushChanges(tree.root, tree.listChanges());
|
|
107
|
-
expect(statSync(join(tree.root, script.target)).mode & 0o777).toBe(0o755);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import fc from 'fast-check';
|
|
3
|
-
import { createTree } from 'nx/src/devkit-testing-exports.js';
|
|
4
|
-
import { INLINE_LOCAL_BEGIN, INLINE_LOCAL_END, LOCAL_SECTION_MARKER } from './managed-content.js';
|
|
5
|
-
import { assertNoManagedConflicts, mergeManagedContent, stageManagedFiles } from './tree.js';
|
|
6
|
-
|
|
7
|
-
const file = { target: 'tooling/config', content: 'managed\n' };
|
|
8
|
-
|
|
9
|
-
describe('managed files in Nx Tree', () => {
|
|
10
|
-
it('stages a missing template with explicit permissions', () => {
|
|
11
|
-
const tree = createTree();
|
|
12
|
-
const initial = tree.listChanges();
|
|
13
|
-
expect(stageManagedFiles(tree, [file])).toEqual([{ target: file.target, action: 'created' }]);
|
|
14
|
-
expect(tree.listChanges()).toEqual([
|
|
15
|
-
...initial,
|
|
16
|
-
{ path: file.target, type: 'CREATE', content: Buffer.from(file.content), options: { mode: 0o644 } },
|
|
17
|
-
]);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('distinguishes an empty file from a missing file', () => {
|
|
21
|
-
const tree = createTree();
|
|
22
|
-
tree.write(file.target, '');
|
|
23
|
-
expect(stageManagedFiles(tree, [file])[0].action).toBe('updated');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('does not delete disabled descriptors or their customizations', () => {
|
|
27
|
-
const tree = createTree();
|
|
28
|
-
tree.write(file.target, 'owned locally');
|
|
29
|
-
expect(stageManagedFiles(tree, [{ ...file, content: null }])[0].action).toBe('skipped');
|
|
30
|
-
expect(tree.read(file.target, 'utf8')).toBe('owned locally');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('preserves tails, adjacent inline blocks, indentation, and their order', () => {
|
|
34
|
-
const tree = createTree();
|
|
35
|
-
const local = [
|
|
36
|
-
'anchor',
|
|
37
|
-
` ${INLINE_LOCAL_BEGIN}`,
|
|
38
|
-
'one',
|
|
39
|
-
` ${INLINE_LOCAL_END}`,
|
|
40
|
-
INLINE_LOCAL_BEGIN,
|
|
41
|
-
'two',
|
|
42
|
-
INLINE_LOCAL_END,
|
|
43
|
-
'old',
|
|
44
|
-
LOCAL_SECTION_MARKER,
|
|
45
|
-
'tail',
|
|
46
|
-
].join('\n');
|
|
47
|
-
tree.write(file.target, local);
|
|
48
|
-
assertNoManagedConflicts(stageManagedFiles(tree, [{ ...file, content: 'anchor\nnew\n' }]));
|
|
49
|
-
const result = tree.read(file.target, 'utf8');
|
|
50
|
-
expect(result).toBe(local.replace('old\n', 'new\n\n'));
|
|
51
|
-
expect(stageManagedFiles(tree, [{ ...file, content: 'anchor\nnew\n' }])[0].action).toBe('unchanged');
|
|
52
|
-
expect(tree.read(file.target, 'utf8')).toBe(result);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('uses Tree for an existing pending edit instead of rereading the disk', () => {
|
|
56
|
-
const tree = createTree();
|
|
57
|
-
tree.write(file.target, `before\n${LOCAL_SECTION_MARKER}\nfirst`);
|
|
58
|
-
tree.write(file.target, `before\n${LOCAL_SECTION_MARKER}\nsecond`);
|
|
59
|
-
stageManagedFiles(tree, [file]);
|
|
60
|
-
expect(tree.read(file.target, 'utf8')).toBe(`${file.content}\n${LOCAL_SECTION_MARKER}\nsecond`);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it.each(['../outside', '/outside', './config', 'a//b', 'C:/config', 'a\\b', 'a\0b'])(
|
|
64
|
-
'rejects non-relative target %s',
|
|
65
|
-
(target) => {
|
|
66
|
-
const tree = createTree();
|
|
67
|
-
const initial = tree.listChanges();
|
|
68
|
-
const results = stageManagedFiles(tree, [{ ...file, target }]);
|
|
69
|
-
expect(() => assertNoManagedConflicts(results)).toThrow('workspace-relative');
|
|
70
|
-
expect(tree.listChanges()).toEqual(initial);
|
|
71
|
-
},
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
it('reports duplicate descriptors and overlapping file/directory targets', () => {
|
|
75
|
-
expect(() => assertNoManagedConflicts(stageManagedFiles(createTree(), [file, file]))).toThrow('duplicate');
|
|
76
|
-
expect(() =>
|
|
77
|
-
assertNoManagedConflicts(stageManagedFiles(createTree(), [{ ...file, target: 'tooling' }, file])),
|
|
78
|
-
).toThrow('parent directory');
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('refuses lost or ambiguous anchors without changing that file', () => {
|
|
82
|
-
for (const content of ['removed\n', 'anchor\nanchor\n']) {
|
|
83
|
-
const tree = createTree();
|
|
84
|
-
const current = ['anchor', INLINE_LOCAL_BEGIN, 'local', INLINE_LOCAL_END, ''].join('\n');
|
|
85
|
-
tree.write(file.target, current);
|
|
86
|
-
expect(() => assertNoManagedConflicts(stageManagedFiles(tree, [{ ...file, content }]))).toThrow('matches');
|
|
87
|
-
expect(tree.read(file.target, 'utf8')).toBe(current);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('keeps matching links and refuses drifted links', () => {
|
|
92
|
-
const tree = createTree();
|
|
93
|
-
tree.write(file.target, file.content);
|
|
94
|
-
const paths = new Map([[file.target, { symlink: true, executable: false }]]);
|
|
95
|
-
expect(stageManagedFiles(tree, [file], paths)[0].action).toBe('ok-symlink');
|
|
96
|
-
expect(() => assertNoManagedConflicts(stageManagedFiles(tree, [{ ...file, content: 'new' }], paths))).toThrow(
|
|
97
|
-
'symlink content',
|
|
98
|
-
);
|
|
99
|
-
expect(tree.read(file.target, 'utf8')).toBe(file.content);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('uses Tree.changePermissions for a permission-only update and preserves the content', () => {
|
|
103
|
-
const tree = createTree();
|
|
104
|
-
const content = `${file.content}${LOCAL_SECTION_MARKER}\nlocal`;
|
|
105
|
-
tree.write(file.target, content);
|
|
106
|
-
const paths = new Map([[file.target, { executable: false }]]);
|
|
107
|
-
expect(stageManagedFiles(tree, [{ ...file, executable: true }], paths)[0].action).toBe('updated');
|
|
108
|
-
expect(tree.listChanges().find((change) => change.path === file.target)?.options?.mode).toBe(0o755);
|
|
109
|
-
expect(tree.read(file.target, 'utf8')).toBe(content);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('preserves arbitrary local tails and converges under repeated rendering', () => {
|
|
113
|
-
fc.assert(
|
|
114
|
-
fc.property(fc.string(), fc.string(), (old, tail) => {
|
|
115
|
-
const current = `${old.replaceAll('# smoo-local', '# ordinary')}\n${LOCAL_SECTION_MARKER}\n${tail}`;
|
|
116
|
-
const next = mergeManagedContent(current, file.content);
|
|
117
|
-
expect(next.endsWith(`${LOCAL_SECTION_MARKER}\n${tail}`)).toBe(true);
|
|
118
|
-
expect(mergeManagedContent(next, file.content)).toBe(next);
|
|
119
|
-
}),
|
|
120
|
-
{ numRuns: 100 },
|
|
121
|
-
);
|
|
122
|
-
});
|
|
123
|
-
});
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import { createHash } from 'node:crypto';
|
|
3
|
-
import { mkdir, mkdtemp, rename, rm, writeFile } from 'node:fs/promises';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { dirname, join, posix } from 'node:path';
|
|
6
|
-
|
|
7
|
-
import { resetWorkspaceContext, updateFilesInContext } from 'nx/src/utils/workspace-context.js';
|
|
8
|
-
import { hashVersionlessCrateManifests, updateVersionlessCrateManifest } from './manifest-hash.js';
|
|
9
|
-
|
|
10
|
-
const CRATE_MANIFEST = `[package]
|
|
11
|
-
name = "acme-core"
|
|
12
|
-
version = "1.2.3"
|
|
13
|
-
edition = "2024"
|
|
14
|
-
|
|
15
|
-
[dependencies]
|
|
16
|
-
serde = { version = "1.0.200", features = ["derive"] }
|
|
17
|
-
acme-sibling = { path = "../sibling", version = "1.2.3" }
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The line a form writes the crate's own version on, and the manifest it sits
|
|
22
|
-
* in. Dropping it must leave the digest exactly where hashing the manifest
|
|
23
|
-
* with it leaves it: that is what "the release cannot move this digest" means.
|
|
24
|
-
*/
|
|
25
|
-
const OWN_VERSION_FORMS: Record<string, [manifest: string, line: string]> = {
|
|
26
|
-
plain: ['[package]\nname = "acme-core"\n@\nedition = "2024"\n', 'version = "1.2.3"'],
|
|
27
|
-
padded: ['[package]\nname = "acme-core"\n@\nedition = "2024"\n', ' version\t= "1.2.3" '],
|
|
28
|
-
commented: ['[package]\nname = "acme-core"\n@\nedition = "2024"\n', 'version = "1.2.3" # bumped by the release'],
|
|
29
|
-
inherited: ['[package]\nname = "acme-core"\n@\nedition = "2024"\n', 'version.workspace = true'],
|
|
30
|
-
'inherited, spaced': ['[package]\nname = "acme-core"\n@\n', 'version . workspace = true'],
|
|
31
|
-
'quoted key': ['[package]\nname = "acme-core"\n@\n', '"version" = "1.2.3"'],
|
|
32
|
-
'literal-quoted key': ['[package]\nname = "acme-core"\n@\n', "'version' = '1.2.3'"],
|
|
33
|
-
'literal-quoted value': ['[package]\nname = "acme-core"\n@\n', "version = '1.2.3'"],
|
|
34
|
-
'padded header': ['[ package ]\nname = "acme-core"\n@\n', 'version = "1.2.3"'],
|
|
35
|
-
'commented header': ['[package] # the crate itself\nname = "acme-core"\n@\n', 'version = "1.2.3"'],
|
|
36
|
-
'quoted header': ['["package"]\nname = "acme-core"\n@\n', 'version = "1.2.3"'],
|
|
37
|
-
'workspace package': [
|
|
38
|
-
'[workspace]\nmembers = ["crates/*"]\n\n[workspace.package]\n@\nedition = "2024"\n',
|
|
39
|
-
'version = "0.0.1"',
|
|
40
|
-
],
|
|
41
|
-
'workspace package, spaced header': ['[workspace . package]\n@\nedition = "2024"\n', 'version = "0.0.1"'],
|
|
42
|
-
'after a multi-line array': [
|
|
43
|
-
'[package]\nname = "acme-core"\nkeywords = [\n "build",\n "cache",\n]\n@\n',
|
|
44
|
-
'version = "1.2.3"',
|
|
45
|
-
],
|
|
46
|
-
crlf: ['[package]\r\nname = "acme-core"\r\n@\r\nedition = "2024"\r\n', 'version = "1.2.3"'],
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* A `version` that names a DIFFERENT crate. Dropping one of these lines must
|
|
51
|
-
* move the digest, or a dependency change serves a stale result.
|
|
52
|
-
*/
|
|
53
|
-
const FOREIGN_VERSION_FORMS: Record<string, [manifest: string, line: string]> = {
|
|
54
|
-
'dependency table': [
|
|
55
|
-
'[package]\nname = "acme-core"\nversion = "1.2.3"\n\n[dependencies.serde]\n@\n',
|
|
56
|
-
'version = "1.0.200"',
|
|
57
|
-
],
|
|
58
|
-
'dev-dependency table': ['[package]\nname = "acme-core"\n\n[dev-dependencies.insta]\n@\n', 'version = "1.39"'],
|
|
59
|
-
'build-dependency table': ['[package]\nname = "acme-core"\n\n[build-dependencies.cc]\n@\n', 'version = "1.0"'],
|
|
60
|
-
'workspace dependency table': ['[workspace]\n\n[workspace.dependencies.serde]\n@\n', 'version = "1.0.200"'],
|
|
61
|
-
'target cfg dependency table': [
|
|
62
|
-
'[package]\nname = "acme-core"\n\n[target.\'cfg(unix)\'.dependencies.libc]\n@\n',
|
|
63
|
-
'version = "0.2.155"',
|
|
64
|
-
],
|
|
65
|
-
'inline table': ['[package]\nname = "acme-core"\n\n[dependencies]\n@\n', 'serde = { version = "1.0.200" }'],
|
|
66
|
-
'package metadata table': ['[package]\nname = "acme-core"\n\n[package.metadata.acme]\n@\n', 'version = "7"'],
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
function digest(manifest: string): string {
|
|
70
|
-
const hash = createHash('sha256');
|
|
71
|
-
updateVersionlessCrateManifest(hash, Buffer.from(manifest));
|
|
72
|
-
return hash.digest('hex');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Whether each form's version line contributes nothing at all to the digest:
|
|
77
|
-
* the manifest carrying it hashes to what the manifest without it hashes to.
|
|
78
|
-
*/
|
|
79
|
-
function elided(forms: Record<string, [manifest: string, line: string]>): Record<string, boolean> {
|
|
80
|
-
const result: Record<string, boolean> = {};
|
|
81
|
-
for (const [name, [manifest, line]] of Object.entries(forms)) {
|
|
82
|
-
result[name] = digest(manifest.replace('@', line)) === digest(manifest.replace(/@\r?\n/, ''));
|
|
83
|
-
}
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
describe('versionless crate manifest hashing', () => {
|
|
88
|
-
it('drops the version a crate declares for itself, in every form a manifest writes it', () => {
|
|
89
|
-
expect(elided(OWN_VERSION_FORMS)).toEqual(Object.fromEntries(Object.keys(OWN_VERSION_FORMS).map((n) => [n, true])));
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('keeps every version that names a different crate', () => {
|
|
93
|
-
expect(elided(FOREIGN_VERSION_FORMS)).toEqual(
|
|
94
|
-
Object.fromEntries(Object.keys(FOREIGN_VERSION_FORMS).map((n) => [n, false])),
|
|
95
|
-
);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it("separates the tables it left, so a later version is not read as the crate's own", () => {
|
|
99
|
-
const own = '[package]\nname = "acme-core"\nversion = "1.2.3"\n';
|
|
100
|
-
// The same bytes under a dependency table must not collapse onto the same
|
|
101
|
-
// digest as the crate's own version: the scanner has to know which table
|
|
102
|
-
// it is standing in, not just which line it is looking at.
|
|
103
|
-
expect(digest(`${own}\n[dependencies.serde]\nversion = "1.0.200"\n`)).not.toBe(
|
|
104
|
-
digest(`${own}\n[dependencies.serde]\nversion = "1.0.201"\n`),
|
|
105
|
-
);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('hashes verbatim from the first construct a line scan cannot read', () => {
|
|
109
|
-
// A multi-line string can spell out a `[package]` header and a version
|
|
110
|
-
// line, and no line scan can tell that text from the document. Everything
|
|
111
|
-
// after one is hashed as written, so the release moves this digest — a
|
|
112
|
-
// miss, never a wrong hit.
|
|
113
|
-
const withNote = (version: string) =>
|
|
114
|
-
`[package]\nname = "acme-core"\ndescription = """\n[package]\nversion = "0.0.0"\n"""\nversion = "${version}"\n`;
|
|
115
|
-
expect(digest(withNote('1.2.3'))).not.toBe(digest(withNote('2.0.0')));
|
|
116
|
-
|
|
117
|
-
// A version the scanner reached BEFORE the string is still dropped.
|
|
118
|
-
const beforeNote = (version: string) =>
|
|
119
|
-
`[package]\nname = "acme-core"\nversion = "${version}"\ndescription = """\nany text\n"""\n`;
|
|
120
|
-
expect(digest(beforeNote('1.2.3'))).toBe(digest(beforeNote('2.0.0')));
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('ignores the version a crate declares for itself and nothing else', async () => {
|
|
124
|
-
await withProject(async (project) => {
|
|
125
|
-
const baseline = await hashVersionlessCrateManifests(project.root, project.workspaceRoot);
|
|
126
|
-
|
|
127
|
-
await project.write('crates/core/Cargo.toml', CRATE_MANIFEST.replace('version = "1.2.3"', 'version = "2.0.0"'));
|
|
128
|
-
expect(await hashVersionlessCrateManifests(project.root, project.workspaceRoot)).toBe(baseline);
|
|
129
|
-
|
|
130
|
-
// Same release, one real change alongside it: the digest must move again.
|
|
131
|
-
await project.write('crates/core/Cargo.toml', CRATE_MANIFEST.replace('1.0.200', '1.0.201'));
|
|
132
|
-
expect(await hashVersionlessCrateManifests(project.root, project.workspaceRoot)).not.toBe(baseline);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('reports a moved crate manifest', async () => {
|
|
137
|
-
await withProject(async (project) => {
|
|
138
|
-
const baseline = await hashVersionlessCrateManifests(project.root, project.workspaceRoot);
|
|
139
|
-
await project.move('crates/core/Cargo.toml', 'crates/renamed/Cargo.toml');
|
|
140
|
-
|
|
141
|
-
expect(await hashVersionlessCrateManifests(project.root, project.workspaceRoot)).not.toBe(baseline);
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('hashes only the manifests Nx indexes, never ones under ignored build output', async () => {
|
|
146
|
-
await withProject(async (project) => {
|
|
147
|
-
const baseline = await hashVersionlessCrateManifests(project.root, project.workspaceRoot);
|
|
148
|
-
// A build that copies crates into ignored output (a vendored dist, a
|
|
149
|
-
// cache restore) must neither move the digest nor be read at all: a
|
|
150
|
-
// restore may delete that tree while the digest is computed.
|
|
151
|
-
await project.write('.gitignore', 'generated/\n');
|
|
152
|
-
await project.write('generated/crate/Cargo.toml', CRATE_MANIFEST.replace('1.0.200', '9.9.9'));
|
|
153
|
-
project.refreshIndex();
|
|
154
|
-
|
|
155
|
-
expect(await hashVersionlessCrateManifests(project.root, project.workspaceRoot)).toBe(baseline);
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('hashes a manifest it cannot read instead of dropping it', async () => {
|
|
160
|
-
await withProject(async (project) => {
|
|
161
|
-
await project.write('crates/core/Cargo.toml', 'this is not toml [[[');
|
|
162
|
-
const broken = await hashVersionlessCrateManifests(project.root, project.workspaceRoot);
|
|
163
|
-
expect(await hashVersionlessCrateManifests(project.root, project.workspaceRoot)).toBe(broken);
|
|
164
|
-
|
|
165
|
-
// An unreadable manifest still contributes its bytes, so a change inside
|
|
166
|
-
// it invalidates. Dropping it would leave a stale cache hit instead.
|
|
167
|
-
await project.write('crates/core/Cargo.toml', 'this is not toml either ]]]');
|
|
168
|
-
expect(await hashVersionlessCrateManifests(project.root, project.workspaceRoot)).not.toBe(broken);
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it('hashes the same tree the same way twice', async () => {
|
|
173
|
-
await withProject(async (project) => {
|
|
174
|
-
expect(await hashVersionlessCrateManifests(project.root, project.workspaceRoot)).toMatch(/^[0-9a-f]{64}$/);
|
|
175
|
-
expect(await hashVersionlessCrateManifests(project.root, project.workspaceRoot)).toBe(
|
|
176
|
-
await hashVersionlessCrateManifests(project.root, project.workspaceRoot),
|
|
177
|
-
);
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
interface ProjectFixture {
|
|
183
|
-
workspaceRoot: string;
|
|
184
|
-
root: string;
|
|
185
|
-
write(path: string, contents: string): Promise<void>;
|
|
186
|
-
move(from: string, to: string): Promise<void>;
|
|
187
|
-
/** Rebuild Nx's file index for the fixture, as a fresh Nx process would. */
|
|
188
|
-
refreshIndex(): void;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
async function withProject(body: (project: ProjectFixture) => Promise<void>): Promise<void> {
|
|
192
|
-
const workspaceRoot = await mkdtemp(join(tmpdir(), 'smoothbricks-manifest-hash-'));
|
|
193
|
-
const root = 'packages/app';
|
|
194
|
-
const write = async (path: string, contents: string): Promise<void> => {
|
|
195
|
-
const absolute = join(workspaceRoot, path);
|
|
196
|
-
await mkdir(dirname(absolute), { recursive: true });
|
|
197
|
-
await writeFile(absolute, contents);
|
|
198
|
-
};
|
|
199
|
-
try {
|
|
200
|
-
await write(join(root, 'package.json'), JSON.stringify({ name: '@acme/app', version: '1.2.3' }));
|
|
201
|
-
await write(join(root, 'crates/core/Cargo.toml'), CRATE_MANIFEST);
|
|
202
|
-
await write(join(root, 'src/index.ts'), 'export const answer = 42;\n');
|
|
203
|
-
await body({
|
|
204
|
-
workspaceRoot,
|
|
205
|
-
root,
|
|
206
|
-
write: async (path, contents) => write(join(root, path), contents),
|
|
207
|
-
move: async (from, to) => {
|
|
208
|
-
const target = join(workspaceRoot, root, to);
|
|
209
|
-
await mkdir(dirname(target), { recursive: true });
|
|
210
|
-
await rename(join(workspaceRoot, root, from), target);
|
|
211
|
-
// What Nx's file watcher reports to the index for a move.
|
|
212
|
-
updateFilesInContext(workspaceRoot, [posix.join(root, to)], [posix.join(root, from)]);
|
|
213
|
-
},
|
|
214
|
-
refreshIndex: resetWorkspaceContext,
|
|
215
|
-
});
|
|
216
|
-
} finally {
|
|
217
|
-
await rm(workspaceRoot, { recursive: true, force: true });
|
|
218
|
-
}
|
|
219
|
-
}
|