@smoothbricks/nx-plugin 0.4.25 → 0.4.27
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 +1078 -98
- package/dist/bin/smoo-nx-bound-failures.d.ts +3 -0
- package/dist/bin/smoo-nx-bound-failures.d.ts.map +1 -0
- package/dist/bin/smoo-nx-bound-failures.js +31 -0
- package/dist/bin/smoo-nx-cargo-hash.js +28 -3
- package/dist/bin/smoo-nx-exec.js +16 -85
- package/dist/bin/smoo-nx-failures.d.ts +3 -0
- package/dist/bin/smoo-nx-failures.d.ts.map +1 -0
- package/dist/bin/smoo-nx-failures.js +3 -0
- package/dist/bin/smoo-nx-nextest-extract.js +3 -2
- package/dist/bin/smoo-nx-test-walks.d.ts +3 -0
- package/dist/bin/smoo-nx-test-walks.d.ts.map +1 -0
- package/dist/bin/smoo-nx-test-walks.js +34 -0
- package/dist/bounded-test-policy.d.ts +7 -1
- package/dist/bounded-test-policy.d.ts.map +1 -1
- package/dist/bounded-test-policy.js +101 -40
- package/dist/build-state-output-policy.d.ts +25 -0
- package/dist/build-state-output-policy.d.ts.map +1 -0
- package/dist/build-state-output-policy.js +64 -0
- package/dist/cargo-closure-input.d.ts +16 -17
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +37 -44
- package/dist/cargo-dev-profile.d.ts +37 -0
- package/dist/cargo-dev-profile.d.ts.map +1 -0
- package/dist/cargo-dev-profile.js +108 -0
- package/dist/cargo-source-hash.d.ts +50 -8
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +691 -71
- package/dist/cargo-toolchain-policy.d.ts +4 -0
- package/dist/cargo-toolchain-policy.d.ts.map +1 -1
- package/dist/cargo-toolchain-policy.js +5 -0
- package/dist/cargo-workspace.d.ts +108 -12
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +299 -18
- package/dist/cross-check-policy.d.ts +21 -3
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +24 -6
- package/dist/disk-command-policy.d.ts +7 -0
- package/dist/disk-command-policy.d.ts.map +1 -0
- package/dist/disk-command-policy.js +98 -0
- package/dist/ensure-built-receipt.d.ts +25 -0
- package/dist/ensure-built-receipt.d.ts.map +1 -0
- package/dist/ensure-built-receipt.js +261 -0
- package/dist/ensure-built-witness.d.ts +57 -0
- package/dist/ensure-built-witness.d.ts.map +1 -0
- package/dist/ensure-built-witness.js +412 -0
- package/dist/ensure-built.d.ts +213 -12
- package/dist/ensure-built.d.ts.map +1 -1
- package/dist/ensure-built.js +624 -177
- package/dist/eslint-file-set.d.ts +7 -0
- package/dist/eslint-file-set.d.ts.map +1 -0
- package/dist/eslint-file-set.js +12 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts +63 -0
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-pool.js +379 -0
- package/dist/executors/bounded-exec/cpu-tokens.d.ts +82 -0
- package/dist/executors/bounded-exec/cpu-tokens.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-tokens.js +114 -0
- package/dist/executors/bounded-exec/disk-lease.d.ts +61 -0
- package/dist/executors/bounded-exec/disk-lease.d.ts.map +1 -0
- package/dist/executors/bounded-exec/disk-lease.js +91 -0
- package/dist/executors/bounded-exec/executor.d.ts +45 -2
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +447 -52
- package/dist/executors/bounded-exec/gateway-lease.d.ts +52 -0
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -0
- package/dist/executors/bounded-exec/gateway-lease.js +143 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +35 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -0
- package/dist/executors/bounded-exec/hang-diagnostics.js +231 -0
- package/dist/executors/bounded-exec/progress.d.ts +35 -0
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -0
- package/dist/executors/bounded-exec/progress.js +79 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts +3 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp-fixtures.js +12 -0
- package/dist/executors/bounded-exec/ram-temp-held.d.ts +91 -0
- package/dist/executors/bounded-exec/ram-temp-held.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp-held.js +152 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts +223 -0
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -0
- package/dist/executors/bounded-exec/ram-temp.js +1528 -0
- package/dist/executors/bounded-exec/schema.d.ts +29 -11
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.d.ts +162 -0
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -0
- package/dist/executors/bounded-exec/verdict.js +318 -0
- package/dist/executors/shard-timings/executor.d.ts +14 -0
- package/dist/executors/shard-timings/executor.d.ts.map +1 -0
- package/dist/executors/shard-timings/executor.js +25 -0
- package/dist/executors/shard-timings/schema.d.ts +4 -0
- package/dist/executors/shard-timings/schema.d.ts.map +1 -0
- package/dist/executors/shard-timings/schema.js +1 -0
- package/dist/failure-summary.d.ts +5 -0
- package/dist/failure-summary.d.ts.map +1 -0
- package/dist/failure-summary.js +118 -0
- package/dist/generators/create-package/generator.d.ts.map +1 -1
- package/dist/generators/create-package/generator.js +6 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +435 -230
- package/dist/managed-assets.d.ts +6 -0
- package/dist/managed-assets.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.d.ts +13 -0
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +44 -13
- package/dist/managed-files/files.d.ts +7 -1
- package/dist/managed-files/files.d.ts.map +1 -1
- package/dist/managed-files/files.js +62 -8
- package/dist/managed-files/json-edit.d.ts +21 -0
- package/dist/managed-files/json-edit.d.ts.map +1 -0
- package/dist/managed-files/json-edit.js +295 -0
- package/dist/managed-files/managed-format.d.ts +33 -1
- package/dist/managed-files/managed-format.d.ts.map +1 -1
- package/dist/managed-files/managed-format.js +82 -2
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts +7 -0
- package/dist/managed-files/pr-preview-cleanup-workflow.d.ts.map +1 -1
- package/dist/managed-files/pr-preview-cleanup-workflow.js +68 -4
- package/dist/managed-files/publish-workflow.d.ts.map +1 -1
- package/dist/managed-files/publish-workflow.js +231 -48
- package/dist/managed-files/tree.d.ts +5 -0
- package/dist/managed-files/tree.d.ts.map +1 -1
- package/dist/managed-files/tree.js +5 -3
- package/dist/manifest-hash.js +3 -2
- package/dist/nextest-code-bound.d.ts +62 -0
- package/dist/nextest-code-bound.d.ts.map +1 -0
- package/dist/nextest-code-bound.js +154 -0
- package/dist/nextest-extraction.d.ts +24 -8
- package/dist/nextest-extraction.d.ts.map +1 -1
- package/dist/nextest-extraction.js +42 -7
- package/dist/package-target-policy.d.ts.map +1 -1
- package/dist/package-target-policy.js +3 -5
- package/dist/release-config-policy.d.ts.map +1 -1
- package/dist/release-config-policy.js +3 -5
- package/dist/runtime-input.d.ts +14 -0
- package/dist/runtime-input.d.ts.map +1 -0
- package/dist/runtime-input.js +15 -0
- package/dist/rust-tokens.d.ts +11 -0
- package/dist/rust-tokens.d.ts.map +1 -0
- package/dist/rust-tokens.js +81 -0
- package/dist/task-results.d.ts +6 -0
- package/dist/task-results.d.ts.map +1 -0
- package/dist/task-results.js +61 -0
- package/dist/test-program.d.ts +54 -0
- package/dist/test-program.d.ts.map +1 -0
- package/dist/test-program.js +292 -0
- package/dist/test-timings.d.ts +71 -0
- package/dist/test-timings.d.ts.map +1 -0
- package/dist/test-timings.js +393 -0
- package/dist/test-walk-policy.d.ts +103 -0
- package/dist/test-walk-policy.d.ts.map +1 -0
- package/dist/test-walk-policy.js +657 -0
- package/dist/testing.d.ts +177 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +824 -0
- package/dist/type-guards.d.ts +3 -0
- package/dist/type-guards.d.ts.map +1 -0
- package/dist/type-guards.js +4 -0
- package/dist/typecheck-test-policy.d.ts +8 -5
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +113 -100
- package/dist/workspace-config-policy.d.ts +8 -0
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +175 -63
- package/dist/workspace-index.d.ts +12 -0
- package/dist/workspace-index.d.ts.map +1 -0
- package/dist/workspace-index.js +17 -0
- package/dist/workspace-manifest.d.ts +37 -1
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/executors.json +5 -0
- package/loader.js +13 -11
- package/managed/raw/envrc +33 -62
- package/managed/raw/git-format-staged.yml +30 -35
- package/managed/raw/patches/nx@23.2.1.patch +3484 -0
- package/managed/raw/tooling/direnv/apple-developer.sh +83 -0
- package/managed/raw/tooling/direnv/developer-links.ts +607 -17
- package/managed/raw/tooling/direnv/devenv.smoo.nix +314 -92
- package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +20 -11
- package/managed/raw/tooling/direnv/linked-snapshots.ts +845 -0
- package/managed/raw/tooling/direnv/nx-socket-dir.sh +82 -0
- package/managed/raw/tooling/direnv/repo-path +14 -2
- package/managed/raw/tooling/direnv/setup-environment.ts +1009 -118
- package/managed/raw/tooling/direnv/toolchain-stamp.ts +45 -3
- package/managed/raw/tooling/direnv/ttsc-env.sh +39 -0
- package/managed/raw/tooling/git-hooks/commit-msg.sh +5 -6
- package/managed/raw/tooling/git-hooks/pre-commit.sh +7 -6
- package/managed/raw/tooling/git-hooks/pre-push.sh +20 -15
- package/managed/templates/github/actions/cache-nix-devenv/action.yml +6 -6
- package/managed/templates/github/actions/cache-node-modules/action.yml +6 -4
- package/managed/templates/github/actions/cache-nx/action.yml +1 -1
- package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +1 -1
- package/managed/templates/github/actions/forgejo-artifact.cjs +99 -0
- package/managed/templates/github/actions/forgejo-download-artifact/action.yml +49 -0
- package/managed/templates/github/actions/forgejo-download-artifact/index.cjs +7 -0
- package/managed/templates/github/actions/forgejo-upload-artifact/action.yml +65 -0
- package/managed/templates/github/actions/forgejo-upload-artifact/index.cjs +7 -0
- package/managed/templates/github/actions/setup-devenv/action.yml +21 -3
- package/managed/templates/github/workflows/managed-files.yml +1 -2
- package/nextest.toml +8 -75
- package/package.json +75 -13
- package/runtime-input.sh +81 -0
- package/src/__tests__/counted-cargo-process.ts +286 -0
- package/src/__tests__/counted-cargo.ts +730 -0
- package/src/__tests__/fixture-cargo-home.ts +36 -0
- package/src/__tests__/fixture-nx-env.ts +157 -2
- package/src/__tests__/progress-clock.ts +43 -0
- package/src/__tests__/runtime-input.ts +23 -0
- package/src/bin/smoo-nx-bound-failures.test.ts +127 -0
- package/src/bin/smoo-nx-bound-failures.ts +33 -0
- package/src/bin/smoo-nx-cargo-hash.ts +28 -3
- package/src/bin/smoo-nx-exec.ts +17 -86
- package/src/bin/smoo-nx-failures.ts +4 -0
- package/src/bin/smoo-nx-nextest-extract.ts +3 -2
- package/src/bin/smoo-nx-test-walks.ts +42 -0
- package/src/bounded-test-policy.test.ts +268 -22
- package/src/bounded-test-policy.ts +114 -42
- package/src/build-state-output-policy.test.ts +115 -0
- package/src/build-state-output-policy.ts +90 -0
- package/src/bun-bootstrap.test.ts +57 -3
- package/src/bun-file-packages.test.ts +47 -0
- package/src/cargo-closure-input.test.ts +432 -62
- package/src/cargo-closure-input.ts +51 -57
- package/src/cargo-dev-profile.ts +137 -0
- package/src/cargo-resolve-cache.test.ts +1044 -0
- package/src/cargo-source-hash.test.ts +203 -93
- package/src/cargo-source-hash.ts +762 -75
- package/src/cargo-toolchain-policy.ts +6 -0
- package/src/cargo-workspace.test.ts +320 -0
- package/src/cargo-workspace.ts +344 -18
- package/src/cross-check-policy.test.ts +59 -1
- package/src/cross-check-policy.ts +25 -6
- package/src/disk-command-policy.test.ts +61 -0
- package/src/disk-command-policy.ts +107 -0
- package/src/ensure-built-receipt.test.ts +184 -0
- package/src/ensure-built-receipt.ts +263 -0
- package/src/ensure-built-witness.test.ts +344 -0
- package/src/ensure-built-witness.ts +252 -0
- package/src/ensure-built.test.ts +1043 -483
- package/src/ensure-built.ts +870 -197
- package/src/eslint-file-set.ts +9 -0
- package/src/executors/bounded-exec/cpu-pool.test.ts +454 -0
- package/src/executors/bounded-exec/cpu-pool.ts +417 -0
- package/src/executors/bounded-exec/cpu-tokens.test.ts +269 -0
- package/src/executors/bounded-exec/cpu-tokens.ts +177 -0
- package/src/executors/bounded-exec/disk-lease.test.ts +185 -0
- package/src/executors/bounded-exec/disk-lease.ts +139 -0
- package/src/executors/bounded-exec/executor-host.test.ts +778 -0
- package/src/executors/bounded-exec/executor.test.ts +1116 -63
- package/src/executors/bounded-exec/executor.ts +565 -67
- package/src/executors/bounded-exec/gateway-lease.ts +176 -0
- package/src/executors/bounded-exec/hang-diagnostics.test.ts +285 -0
- package/src/executors/bounded-exec/hang-diagnostics.ts +283 -0
- package/src/executors/bounded-exec/progress.test.ts +79 -0
- package/src/executors/bounded-exec/progress.ts +118 -0
- package/src/executors/bounded-exec/ram-temp-fixtures.ts +12 -0
- package/src/executors/bounded-exec/ram-temp-held.test.ts +264 -0
- package/src/executors/bounded-exec/ram-temp-held.ts +242 -0
- package/src/executors/bounded-exec/ram-temp-host.test.ts +605 -0
- package/src/executors/bounded-exec/ram-temp.test.ts +674 -0
- package/src/executors/bounded-exec/ram-temp.ts +1918 -0
- package/src/executors/bounded-exec/schema.json +11 -5
- package/src/executors/bounded-exec/schema.ts +27 -11
- package/src/executors/bounded-exec/verdict.test.ts +440 -0
- package/src/executors/bounded-exec/verdict.ts +433 -0
- package/src/executors/shard-timings/executor.ts +36 -0
- package/src/executors/shard-timings/schema.json +21 -0
- package/src/executors/shard-timings/schema.ts +4 -0
- package/src/failure-summary.ts +119 -0
- package/src/generators/bounded-test-targets/generator.test.ts +4 -4
- package/src/generators/bun-test-tracing/generator.test.ts +2 -2
- package/src/generators/create-package/generator.test.ts +6 -0
- package/src/generators/create-package/generator.ts +6 -2
- package/src/host-controller-wiring.test.ts +31 -0
- package/src/index.test.ts +1070 -360
- package/src/index.ts +524 -255
- package/src/linked-snapshots.nx.test.ts +172 -0
- package/src/managed-assets.ts +12 -0
- package/src/managed-files/ci-workflow.ts +54 -13
- package/src/managed-files/files.ts +65 -9
- package/src/managed-files/forgejo-artifact.test.ts +395 -0
- package/src/managed-files/generator.test.ts +60 -1
- package/src/managed-files/json-edit.test.ts +216 -0
- package/src/managed-files/json-edit.ts +290 -0
- package/src/managed-files/managed-format-json.test.ts +308 -0
- package/src/managed-files/managed-format.ts +90 -2
- package/src/managed-files/pr-preview-cleanup-workflow.ts +69 -3
- package/src/managed-files/publish-workflow.ts +285 -67
- package/src/managed-files/repo-path.test.ts +129 -0
- package/src/managed-files/trace-db-artifact.test.ts +7 -0
- package/src/managed-files/tree.ts +11 -3
- package/src/manifest-hash.ts +3 -2
- package/src/nextest-code-bound.test.ts +155 -0
- package/src/nextest-code-bound.ts +195 -0
- package/src/nextest-extraction.test.ts +37 -5
- package/src/nextest-extraction.ts +51 -9
- package/src/nextest-partitions.test.ts +495 -0
- package/src/nx-cache-bound.test.ts +109 -0
- package/src/nx-cache-restore-mtime.test.ts +170 -0
- package/src/nx-daemon-claim.test.ts +277 -0
- package/src/nx-daemon-idle-cpu.test.ts +81 -0
- package/src/nx-daemon-idle-policy.test.ts +51 -0
- package/src/nx-daemon-ignore-files.test.ts +210 -0
- package/src/nx-daemon-root-normalization.test.ts +105 -0
- package/src/nx-daemon-validity.test.ts +925 -0
- package/src/nx-dot-input-policy.test.ts +353 -0
- package/src/nx-failure-life-cycles.test.ts +207 -0
- package/src/nx-files-archive-racy.test.ts +97 -0
- package/src/nx-foreign-workspace-env.test.ts +329 -0
- package/src/nx-incomplete-run-summary.test.ts +70 -0
- package/src/nx-plugin-load-errors.test.ts +120 -0
- package/src/nx-project-resolution-cache.test.ts +176 -0
- package/src/nx-raw-inputs.test.ts +166 -0
- package/src/nx-resident-graph-workers.test.ts +112 -0
- package/src/nx-run-information.test.ts +118 -0
- package/src/nx-skipped-task-exit.test.ts +180 -0
- package/src/nx-state-location.test.ts +63 -0
- package/src/nx-store-resolution.test.ts +99 -0
- package/src/nx-task-graph-cycles.test.ts +148 -0
- package/src/nx-task-output-lease.test.ts +414 -0
- package/src/nx-use-local.test.ts +103 -0
- package/src/package-target-policy.ts +3 -6
- package/src/release-config-policy.ts +3 -6
- package/src/runtime-input.test.ts +215 -0
- package/src/runtime-input.ts +17 -0
- package/src/rust-tokens.ts +78 -0
- package/src/serial-group-wiring.test.ts +326 -0
- package/src/task-history-namespace.test.ts +181 -0
- package/src/task-results.test.ts +226 -0
- package/src/task-results.ts +75 -0
- package/src/test-program.test.ts +303 -0
- package/src/test-program.ts +341 -0
- package/src/test-timings.test.ts +240 -0
- package/src/test-timings.ts +311 -0
- package/src/test-walk-policy.test.ts +585 -0
- package/src/test-walk-policy.ts +731 -0
- package/src/testing.test.ts +509 -0
- package/src/testing.ts +922 -0
- package/src/type-guards.ts +4 -0
- package/src/typecheck-test-policy.test.ts +496 -11
- package/src/typecheck-test-policy.ts +137 -103
- package/src/workspace-config-policy.test.ts +212 -13
- package/src/workspace-config-policy.ts +101 -73
- package/src/workspace-index.ts +18 -0
- package/src/workspace-manifest.ts +41 -1
- package/test-timings.json +85 -28
- package/managed/raw/tooling/direnv/inherited-devenv.ts +0 -615
- package/managed/raw/tooling/direnv/shared-caches.sh +0 -53
- package/src/__tests__/in-process-nx-index.ts +0 -9
|
@@ -82,8 +82,24 @@ export declare const CARGO_FETCH_TARGET = "cargo-fetch";
|
|
|
82
82
|
*/
|
|
83
83
|
export declare const CARGO_FETCH_COMMAND = "cargo fetch --locked";
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
85
|
+
* Deny warnings through Cargo's `build.warnings`, never `-- -D warnings`.
|
|
86
|
+
*
|
|
87
|
+
* Arguments after `--` reach clippy-driver through `CLIPPY_ARGS`, which Cargo
|
|
88
|
+
* hashes into every member unit's fingerprint. A gate that passes
|
|
89
|
+
* `-D warnings` therefore owns a unit set of its own: it and a plain
|
|
90
|
+
* `cargo clippy` invalidate each other, re-checking every member each time.
|
|
91
|
+
* `build.warnings` is Cargo's own verdict over the diagnostics it collected,
|
|
92
|
+
* including those it replays from Fresh units, and it reaches no compiler
|
|
93
|
+
* invocation, so every caller shares one unit set while the gate still fails.
|
|
94
|
+
*
|
|
95
|
+
* On the command line rather than in a config file: the gate's verdict is not
|
|
96
|
+
* a repository's local choice, and `--config` outranks every config file.
|
|
97
|
+
*/
|
|
98
|
+
export declare const CARGO_DENY_WARNINGS = "--config 'build.warnings=\"deny\"'";
|
|
99
|
+
/**
|
|
100
|
+
* Clippy rather than `cargo check`, and warnings denied, because that is
|
|
101
|
+
* exactly what CI's `lint` runs; a weaker local command would pass where CI
|
|
102
|
+
* fails.
|
|
87
103
|
*
|
|
88
104
|
* `--all-targets` is what answers "what does test mean when cross-compiling": it
|
|
89
105
|
* type-checks bins, tests, benches and examples for the target, so test CODE is
|
|
@@ -101,7 +117,8 @@ export declare const CARGO_FETCH_COMMAND = "cargo fetch --locked";
|
|
|
101
117
|
*
|
|
102
118
|
* Keep the caller's CARGO_HOME: it owns registry sources, credentials and global
|
|
103
119
|
* Cargo configuration, including paths relative to that configuration. Relocating
|
|
104
|
-
* or replaying it through --config changes path resolution or precedence
|
|
120
|
+
* or replaying it through --config changes path resolution or precedence; the
|
|
121
|
+
* one `--config` here sets `build.warnings` alone.
|
|
105
122
|
* Cargo may serialize registry access on its package-cache lock; these checks
|
|
106
123
|
* are unbounded, and correctness takes priority over overlapping that access.
|
|
107
124
|
*
|
|
@@ -119,6 +136,7 @@ export declare const CARGO_CROSS_LINT_COMMAND: string;
|
|
|
119
136
|
* a proc-macro and ordinary code use stays a distinct unit: a dev build
|
|
120
137
|
* compiles it once at the target profile, while a check build needs a separate
|
|
121
138
|
* host copy. Distinct hashes coexist, so neither command dirties the other.
|
|
139
|
+
* A plain `cargo clippy --workspace --all-targets` checks exactly these units.
|
|
122
140
|
*/
|
|
123
141
|
export declare const CARGO_LINT_CLIPPY_COMMAND: string;
|
|
124
142
|
/** Root `package.json` script name, in the repo's `verb:qualifier` style. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross-check-policy.d.ts","sourceRoot":"","sources":["../src/cross-check-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,yBAAyB,CAAC;AAE1D
|
|
1
|
+
{"version":3,"file":"cross-check-policy.d.ts","sourceRoot":"","sources":["../src/cross-check-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,gBAAgB,CAAC;AAElD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAI1D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,yBAAyB,CAAC;AAE1D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,uCAAqC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,wBAAwB,QAElC,CAAC;AAEJ;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,QAAyE,CAAC;AAEhH,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AAErD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,2EAAiG,CAAC;AAEzI;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhE;AAID,iFAAiF;AACjF,wBAAgB,qCAAqC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvF"}
|
|
@@ -85,8 +85,24 @@ export const CARGO_FETCH_TARGET = 'cargo-fetch';
|
|
|
85
85
|
*/
|
|
86
86
|
export const CARGO_FETCH_COMMAND = 'cargo fetch --locked';
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
88
|
+
* Deny warnings through Cargo's `build.warnings`, never `-- -D warnings`.
|
|
89
|
+
*
|
|
90
|
+
* Arguments after `--` reach clippy-driver through `CLIPPY_ARGS`, which Cargo
|
|
91
|
+
* hashes into every member unit's fingerprint. A gate that passes
|
|
92
|
+
* `-D warnings` therefore owns a unit set of its own: it and a plain
|
|
93
|
+
* `cargo clippy` invalidate each other, re-checking every member each time.
|
|
94
|
+
* `build.warnings` is Cargo's own verdict over the diagnostics it collected,
|
|
95
|
+
* including those it replays from Fresh units, and it reaches no compiler
|
|
96
|
+
* invocation, so every caller shares one unit set while the gate still fails.
|
|
97
|
+
*
|
|
98
|
+
* On the command line rather than in a config file: the gate's verdict is not
|
|
99
|
+
* a repository's local choice, and `--config` outranks every config file.
|
|
100
|
+
*/
|
|
101
|
+
export const CARGO_DENY_WARNINGS = `--config 'build.warnings="deny"'`;
|
|
102
|
+
/**
|
|
103
|
+
* Clippy rather than `cargo check`, and warnings denied, because that is
|
|
104
|
+
* exactly what CI's `lint` runs; a weaker local command would pass where CI
|
|
105
|
+
* fails.
|
|
90
106
|
*
|
|
91
107
|
* `--all-targets` is what answers "what does test mean when cross-compiling": it
|
|
92
108
|
* type-checks bins, tests, benches and examples for the target, so test CODE is
|
|
@@ -104,7 +120,8 @@ export const CARGO_FETCH_COMMAND = 'cargo fetch --locked';
|
|
|
104
120
|
*
|
|
105
121
|
* Keep the caller's CARGO_HOME: it owns registry sources, credentials and global
|
|
106
122
|
* Cargo configuration, including paths relative to that configuration. Relocating
|
|
107
|
-
* or replaying it through --config changes path resolution or precedence
|
|
123
|
+
* or replaying it through --config changes path resolution or precedence; the
|
|
124
|
+
* one `--config` here sets `build.warnings` alone.
|
|
108
125
|
* Cargo may serialize registry access on its package-cache lock; these checks
|
|
109
126
|
* are unbounded, and correctness takes priority over overlapping that access.
|
|
110
127
|
*
|
|
@@ -112,7 +129,7 @@ export const CARGO_FETCH_COMMAND = 'cargo fetch --locked';
|
|
|
112
129
|
* are distinct anyway, and its own lock keeps the cross check from queueing
|
|
113
130
|
* behind host builds.
|
|
114
131
|
*/
|
|
115
|
-
export const CARGO_CROSS_LINT_COMMAND = `${CARGO_CROSS_LINT_GUARD}; ${cargoFrozen(`clippy --workspace --all-targets --target ${CARGO_LINUX_TRIPLE} --target-dir target/cargo-lint-cross
|
|
132
|
+
export const CARGO_CROSS_LINT_COMMAND = `${CARGO_CROSS_LINT_GUARD}; ${cargoFrozen(`clippy --workspace --all-targets --target ${CARGO_LINUX_TRIPLE} --target-dir target/cargo-lint-cross ${CARGO_DENY_WARNINGS}`)}`;
|
|
116
133
|
/**
|
|
117
134
|
* No `--target-dir`: clippy writes the workspace's own `target/`, beside every
|
|
118
135
|
* dev build. Check units carry their mode in the unit hash, so they never
|
|
@@ -122,8 +139,9 @@ export const CARGO_CROSS_LINT_COMMAND = `${CARGO_CROSS_LINT_GUARD}; ${cargoFroze
|
|
|
122
139
|
* a proc-macro and ordinary code use stays a distinct unit: a dev build
|
|
123
140
|
* compiles it once at the target profile, while a check build needs a separate
|
|
124
141
|
* host copy. Distinct hashes coexist, so neither command dirties the other.
|
|
142
|
+
* A plain `cargo clippy --workspace --all-targets` checks exactly these units.
|
|
125
143
|
*/
|
|
126
|
-
export const CARGO_LINT_CLIPPY_COMMAND = cargoFrozen(
|
|
144
|
+
export const CARGO_LINT_CLIPPY_COMMAND = cargoFrozen(`clippy --workspace --all-targets ${CARGO_DENY_WARNINGS}`);
|
|
127
145
|
/** Root `package.json` script name, in the repo's `verb:qualifier` style. */
|
|
128
146
|
export const CROSS_CHECK_SCRIPT_NAME = 'check:linux';
|
|
129
147
|
/**
|
|
@@ -181,7 +199,7 @@ export function cargoCrossTestTargetName(triple) {
|
|
|
181
199
|
* the other's name.
|
|
182
200
|
*/
|
|
183
201
|
export function cargoCrossTestArchiveFile(triple) {
|
|
184
|
-
return
|
|
202
|
+
return `.cache/nextest/archive-${triple}.tar.zst`;
|
|
185
203
|
}
|
|
186
204
|
const CARGO_CROSS_TEST_ARCHIVE_PREFIX = cargoCrossTestArchiveTargetName('');
|
|
187
205
|
/** Inverse of `cargoCrossTestArchiveTargetName`; null for every other target. */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Root's fixed boot script cannot execute a user-writable cowshed binary. No image verbs belong here. */
|
|
2
|
+
export declare const PHYSICAL_BOOT_LAYER = "packages/cowshed/crates/cowshed-core/src/storage/bootstrap/native/macos.rs";
|
|
3
|
+
/** Direct disk-image executors bypass cowshed's detached lifetime and can leak kernel devices. */
|
|
4
|
+
export declare function directDiskCommands(source: string, path?: string): number[];
|
|
5
|
+
/** Scan tracked code, tests and scripts, never build output, prose or recorded benchmark data. */
|
|
6
|
+
export declare function checkDiskCommandBoundary(root: string): string[];
|
|
7
|
+
//# sourceMappingURL=disk-command-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disk-command-policy.d.ts","sourceRoot":"","sources":["../src/disk-command-policy.ts"],"names":[],"mappings":"AAKA,0GAA0G;AAC1G,eAAO,MAAM,mBAAmB,+EAA+E,CAAC;AAEhH,kGAAkG;AAClG,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,MAAM,EAAE,CA8CtE;AAED,kGAAkG;AAClG,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAqC/D"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { basename, extname, resolve } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
/** Root's fixed boot script cannot execute a user-writable cowshed binary. No image verbs belong here. */
|
|
6
|
+
export const PHYSICAL_BOOT_LAYER = 'packages/cowshed/crates/cowshed-core/src/storage/bootstrap/native/macos.rs';
|
|
7
|
+
/** Direct disk-image executors bypass cowshed's detached lifetime and can leak kernel devices. */
|
|
8
|
+
export function directDiskCommands(source, path = '') {
|
|
9
|
+
// Preserve newlines for diagnostics; prose comments are not executable call sites.
|
|
10
|
+
const code = source
|
|
11
|
+
.replace(/\/\*[\s\S]*?\*\//g, (comment) => comment.replace(/[^\n]/g, ' '))
|
|
12
|
+
.replace(/(?:"""[\s\S]*?"""|'''[\s\S]*?''')/g, (comment) => comment.replace(/[^\n]/g, ' '))
|
|
13
|
+
.replace(/^[ \t]*(?:\/\/|#(?!!)).*$/gm, '');
|
|
14
|
+
const tool = String.raw `(?:\/usr\/(?:s?bin)\/)?(?:hdiutil|diskutil)`;
|
|
15
|
+
const quoted = `["']${tool}["']`;
|
|
16
|
+
const aliases = [
|
|
17
|
+
...code.matchAll(new RegExp(String.raw `\b([A-Za-z_]\w*)\s*(?::[^=\n]+)?=\s*(?:\(?\s*\[\s*)?${quoted}`, 'g')),
|
|
18
|
+
]
|
|
19
|
+
.map((match) => match[1])
|
|
20
|
+
.filter((name) => name !== undefined);
|
|
21
|
+
const program = `(?:${quoted}|HDIUTIL|DISKUTIL${aliases.map((name) => `|${name}`).join('')})`;
|
|
22
|
+
const patterns = [
|
|
23
|
+
// Rust, Node, Python and argv-list launchers, including literal aliases.
|
|
24
|
+
new RegExp(String.raw `\b(?:Command::new|spawn(?:Sync)?|execFile(?:Sync)?|exec(?:Sync)?|execa(?:Sync)?|Popen|check_call|check_output|subprocess\.run|sh|trial)\s*\(\s*(?:\{\s*cmd:\s*)?(?:&?\[\s*)?${program}(?=\s*[,\)\]])`, 'g'),
|
|
25
|
+
new RegExp(String.raw `(?:^|\n|\$\(|\$\x60|\|)[ \t]*(?:sudo\s+)?${tool}(?=\s|$)`, 'g'),
|
|
26
|
+
new RegExp(String.raw `HostCommand::new\s*\(\s*${program}\s*,\s*\[\s*"(?:image|eject|attach|detach|create)"`, 'g'),
|
|
27
|
+
];
|
|
28
|
+
if (['.sh', '.bash', '.zsh', '.nix', '.yaml', '.yml'].includes(extname(path))) {
|
|
29
|
+
patterns.push(new RegExp(String.raw `[;\x60&][ \t]*(?:sudo\s+)?${tool}(?=\s|$)`, 'g'));
|
|
30
|
+
}
|
|
31
|
+
if (['package.json', 'project.json'].includes(basename(path))) {
|
|
32
|
+
patterns.push(new RegExp(String.raw `"[^"\n]+"\s*:\s*"${tool}(?=\s)`, 'g'));
|
|
33
|
+
}
|
|
34
|
+
const lines = new Set();
|
|
35
|
+
for (const pattern of patterns) {
|
|
36
|
+
for (const match of code.matchAll(pattern)) {
|
|
37
|
+
const start = match.index + match[0].search(/\S/);
|
|
38
|
+
const line = code.slice(0, start).split('\n').length;
|
|
39
|
+
const text = code.split('\n')[line - 1]?.trim() ?? '';
|
|
40
|
+
if (path === PHYSICAL_BOOT_LAYER &&
|
|
41
|
+
/^(?:info=\$\()?\/usr\/sbin\/diskutil info -plist "\$uuid"\)?$|^\| \/usr\/sbin\/diskutil apfs unlockVolume "\$uuid" -nomount -stdinpassphrase$|^\/usr\/sbin\/diskutil mount -nobrowse -mountPoint "\$mountpoint" "\$uuid"$/.test(text))
|
|
42
|
+
continue;
|
|
43
|
+
lines.add(line);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return [...lines].sort((left, right) => left - right);
|
|
47
|
+
}
|
|
48
|
+
/** Scan tracked code, tests and scripts, never build output, prose or recorded benchmark data. */
|
|
49
|
+
export function checkDiskCommandBoundary(root) {
|
|
50
|
+
const files = execFileSync('git', ['ls-files', '-z', '--cached', '--others', '--exclude-standard'], {
|
|
51
|
+
cwd: root,
|
|
52
|
+
encoding: 'utf8',
|
|
53
|
+
maxBuffer: 32 * 1024 * 1024,
|
|
54
|
+
})
|
|
55
|
+
.split('\0')
|
|
56
|
+
.filter(Boolean);
|
|
57
|
+
const extensions = [
|
|
58
|
+
'.rs',
|
|
59
|
+
'.ts',
|
|
60
|
+
'.tsx',
|
|
61
|
+
'.js',
|
|
62
|
+
'.mjs',
|
|
63
|
+
'.cjs',
|
|
64
|
+
'.py',
|
|
65
|
+
'.sh',
|
|
66
|
+
'.bash',
|
|
67
|
+
'.zsh',
|
|
68
|
+
'.nix',
|
|
69
|
+
'.yaml',
|
|
70
|
+
'.yml',
|
|
71
|
+
];
|
|
72
|
+
const failures = [];
|
|
73
|
+
for (const path of files) {
|
|
74
|
+
if (extname(path) !== '' &&
|
|
75
|
+
!extensions.includes(extname(path)) &&
|
|
76
|
+
!['package.json', 'project.json'].includes(basename(path)))
|
|
77
|
+
continue;
|
|
78
|
+
const source = readFileSync(resolve(root, path), 'utf8');
|
|
79
|
+
for (const line of directDiskCommands(source, path)) {
|
|
80
|
+
failures.push(`${path}:${line}: direct disk tool; use cowshed disk-command or SystemCommandRunner`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return failures;
|
|
84
|
+
}
|
|
85
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
86
|
+
const roots = process.argv.slice(2);
|
|
87
|
+
if (roots.length === 0)
|
|
88
|
+
roots.push(process.cwd());
|
|
89
|
+
for (const root of roots) {
|
|
90
|
+
const failures = checkDiskCommandBoundary(root);
|
|
91
|
+
for (const failure of failures)
|
|
92
|
+
console.error(`${root}/${failure}`);
|
|
93
|
+
if (failures.length > 0)
|
|
94
|
+
process.exitCode = 1;
|
|
95
|
+
else
|
|
96
|
+
console.log(`${root}: no direct disk-tool executions`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Task } from 'nx/src/config/task-graph';
|
|
2
|
+
import type { expandOutputs, HashInputs } from 'nx/src/native';
|
|
3
|
+
import type { EnsureBuiltProbeFailure, EnsureBuiltReceipt } from './ensure-built.js';
|
|
4
|
+
export interface ProviderInputProof {
|
|
5
|
+
readonly kind: 'exact-file-inputs' | 'conservative-provider-source';
|
|
6
|
+
readonly files: readonly string[];
|
|
7
|
+
readonly inputs: Readonly<Record<string, HashInputs>>;
|
|
8
|
+
readonly runtimeSource: {
|
|
9
|
+
readonly kind: 'bounded';
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'opaque';
|
|
12
|
+
readonly detail: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** NUL-delimited Git paths preserve whitespace, rename sources and index-only changes. */
|
|
16
|
+
export declare function dirtyProviderPaths(status: string): string[];
|
|
17
|
+
export declare function providerReceipt(workspaceRoot: string, taskId: string, tasks: readonly Task[], proof: ProviderInputProof, expand: typeof expandOutputs): {
|
|
18
|
+
readonly disposition: 'hit';
|
|
19
|
+
readonly receipt: EnsureBuiltReceipt;
|
|
20
|
+
} | EnsureBuiltProbeFailure;
|
|
21
|
+
/** Admit only recipes emitted by the same owning toolchain generator.
|
|
22
|
+
* No shell parsing or keyword approximation confers file-source provenance.
|
|
23
|
+
*/
|
|
24
|
+
export declare function boundedReceiptRuntimes(inputs: Readonly<Record<string, HashInputs>>, directories: readonly string[], files: readonly string[], installationProved: boolean): ProviderInputProof['runtimeSource'];
|
|
25
|
+
//# sourceMappingURL=ensure-built-receipt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-built-receipt.d.ts","sourceRoot":"","sources":["../src/ensure-built-receipt.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,KAAK,EAA4B,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAK/G,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,GAAG,8BAA8B,CAAC;IACpE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACtD,QAAQ,CAAC,aAAa,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;KAAE,GAAG;QAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7G;AA0BD,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAa3D;AAED,wBAAgB,eAAe,CAC7B,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,KAAK,EAAE,kBAAkB,EACzB,MAAM,EAAE,OAAO,aAAa,GAC3B;IAAE,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAA;CAAE,GAAG,uBAAuB,CAqKjG;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,EAC5C,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,kBAAkB,EAAE,OAAO,GAC1B,kBAAkB,CAAC,eAAe,CAAC,CAqBrC"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { closeSync, lstatSync, openSync, readdirSync, readlinkSync, readSync, realpathSync } from 'node:fs';
|
|
4
|
+
import { isAbsolute, join, relative } from 'node:path';
|
|
5
|
+
import { CARGO_TOOLCHAIN_PIN_INPUTS, cargoRuntimeInput } from './cargo-toolchain-policy.js';
|
|
6
|
+
import { nodeStamp, nodesUnchanged } from './ensure-built-witness.js';
|
|
7
|
+
function git(root, args) {
|
|
8
|
+
// Provenance belongs to this provider, not a Git directory/index/object
|
|
9
|
+
// namespace an outer build lent the process. Nx's hashing environment is
|
|
10
|
+
// unchanged; only these read-only evidence children bind their own Git state.
|
|
11
|
+
const env = { ...process.env };
|
|
12
|
+
for (const key of [
|
|
13
|
+
'GIT_DIR',
|
|
14
|
+
'GIT_COMMON_DIR',
|
|
15
|
+
'GIT_WORK_TREE',
|
|
16
|
+
'GIT_INDEX_FILE',
|
|
17
|
+
'GIT_OBJECT_DIRECTORY',
|
|
18
|
+
'GIT_ALTERNATE_OBJECT_DIRECTORIES',
|
|
19
|
+
'GIT_NAMESPACE',
|
|
20
|
+
])
|
|
21
|
+
delete env[key];
|
|
22
|
+
const child = spawnSync('git', ['-C', root, ...args], { env, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
23
|
+
return child.status === 0 && child.error === undefined
|
|
24
|
+
? { ok: true, value: child.stdout }
|
|
25
|
+
: {
|
|
26
|
+
ok: false,
|
|
27
|
+
detail: `git ${args.join(' ')}: ${child.error?.message ?? child.stderr.trim()} (exit ${child.status}, signal ${child.signal})`,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** NUL-delimited Git paths preserve whitespace, rename sources and index-only changes. */
|
|
31
|
+
export function dirtyProviderPaths(status) {
|
|
32
|
+
const entries = status.split('\0');
|
|
33
|
+
const paths = [];
|
|
34
|
+
for (let index = 0; index < entries.length; index += 1) {
|
|
35
|
+
const entry = entries[index];
|
|
36
|
+
if (entry === '')
|
|
37
|
+
continue;
|
|
38
|
+
paths.push(entry.slice(3));
|
|
39
|
+
if (entry[0] === 'R' || entry[0] === 'C' || entry[1] === 'R' || entry[1] === 'C') {
|
|
40
|
+
index += 1;
|
|
41
|
+
if (entries[index] !== undefined)
|
|
42
|
+
paths.push(entries[index]);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return paths;
|
|
46
|
+
}
|
|
47
|
+
export function providerReceipt(workspaceRoot, taskId, tasks, proof, expand) {
|
|
48
|
+
const root = realpathSync(workspaceRoot);
|
|
49
|
+
const failed = (detail) => ({
|
|
50
|
+
disposition: 'failed',
|
|
51
|
+
reason: { kind: 'provider-proof', taskId, workspaceRoot: root, detail },
|
|
52
|
+
exitCode: 1,
|
|
53
|
+
signal: null,
|
|
54
|
+
});
|
|
55
|
+
if (proof.runtimeSource.kind === 'opaque')
|
|
56
|
+
return failed(proof.runtimeSource.detail);
|
|
57
|
+
const revision = git(root, ['rev-parse', '--verify', 'HEAD']);
|
|
58
|
+
if (!revision.ok)
|
|
59
|
+
return failed(revision.detail);
|
|
60
|
+
const head = revision.value.trim();
|
|
61
|
+
const tree = git(root, ['rev-parse', '--verify', `${head}^{tree}`]);
|
|
62
|
+
if (!tree.ok)
|
|
63
|
+
return failed(tree.detail);
|
|
64
|
+
const status = git(root, ['status', '--porcelain=v1', '-z', '--untracked-files=all']);
|
|
65
|
+
if (!status.ok)
|
|
66
|
+
return failed(status.detail);
|
|
67
|
+
const listed = git(root, ['ls-tree', '-r', '-z', '--full-tree', head]);
|
|
68
|
+
if (!listed.ok)
|
|
69
|
+
return failed(listed.detail);
|
|
70
|
+
const format = git(root, ['rev-parse', '--show-object-format']);
|
|
71
|
+
if (!format.ok)
|
|
72
|
+
return failed(format.detail);
|
|
73
|
+
const algorithm = format.value.trim();
|
|
74
|
+
if (algorithm !== 'sha1' && algorithm !== 'sha256')
|
|
75
|
+
return failed(`Unproved Git object format ${algorithm}`);
|
|
76
|
+
const tracked = new Map();
|
|
77
|
+
for (const entry of listed.value.split('\0')) {
|
|
78
|
+
if (entry === '')
|
|
79
|
+
continue;
|
|
80
|
+
const tab = entry.indexOf('\t');
|
|
81
|
+
const [mode, kind, oid] = entry.slice(0, tab).split(' ');
|
|
82
|
+
if (tab < 0 || oid === undefined)
|
|
83
|
+
return failed(`Unproved HEAD tree entry ${entry}`);
|
|
84
|
+
if (kind !== 'blob')
|
|
85
|
+
continue;
|
|
86
|
+
tracked.set(entry.slice(tab + 1), { mode, oid });
|
|
87
|
+
}
|
|
88
|
+
const observed = [];
|
|
89
|
+
const buffer = Buffer.allocUnsafe(1 << 20);
|
|
90
|
+
const outputNodes = new Map();
|
|
91
|
+
function observe(path) {
|
|
92
|
+
const stats = lstatSync(path, { bigint: true });
|
|
93
|
+
observed.push({ path, stamp: nodeStamp(stats) });
|
|
94
|
+
return stats;
|
|
95
|
+
}
|
|
96
|
+
function fileDigest(path, size, algorithm, gitBlob) {
|
|
97
|
+
const hash = createHash(algorithm);
|
|
98
|
+
if (gitBlob)
|
|
99
|
+
hash.update(`blob ${size}\0`);
|
|
100
|
+
const fd = openSync(path, 'r');
|
|
101
|
+
try {
|
|
102
|
+
for (let offset = 0; offset < size; offset += buffer.length) {
|
|
103
|
+
const count = Math.min(buffer.length, size - offset);
|
|
104
|
+
if (readSync(fd, buffer, 0, count, offset) !== count)
|
|
105
|
+
throw new Error(`File moved while reading ${path}`);
|
|
106
|
+
hash.update(buffer.subarray(0, count));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
closeSync(fd);
|
|
111
|
+
}
|
|
112
|
+
return hash.digest('hex');
|
|
113
|
+
}
|
|
114
|
+
function visit(path) {
|
|
115
|
+
const rel = relative(root, path);
|
|
116
|
+
if (rel === '..' || rel.startsWith('../') || isAbsolute(rel))
|
|
117
|
+
throw new Error(`Output escapes provider: ${path}`);
|
|
118
|
+
const previous = outputNodes.get(rel);
|
|
119
|
+
if (previous !== undefined)
|
|
120
|
+
return previous;
|
|
121
|
+
const stats = observe(path);
|
|
122
|
+
const mode = Number(stats.mode & 4095n);
|
|
123
|
+
let node;
|
|
124
|
+
if (stats.isFile()) {
|
|
125
|
+
node = { path: rel, type: 'file', mode, sha256: fileDigest(path, Number(stats.size), 'sha256', false) };
|
|
126
|
+
}
|
|
127
|
+
else if (stats.isSymbolicLink()) {
|
|
128
|
+
node = { path: rel, type: 'symlink', mode, linkText: readlinkSync(path) };
|
|
129
|
+
}
|
|
130
|
+
else if (stats.isDirectory()) {
|
|
131
|
+
const children = readdirSync(path)
|
|
132
|
+
.sort()
|
|
133
|
+
.map((name) => visit(join(path, name)));
|
|
134
|
+
const entries = children.map(({ path: child }) => relative(rel, child));
|
|
135
|
+
node = {
|
|
136
|
+
path: rel,
|
|
137
|
+
type: 'directory',
|
|
138
|
+
mode,
|
|
139
|
+
entries,
|
|
140
|
+
sha256: createHash('sha256').update(JSON.stringify(children)).digest('hex'),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
throw new Error(`Unsupported public output node ${path}`);
|
|
145
|
+
}
|
|
146
|
+
outputNodes.set(rel, node);
|
|
147
|
+
return node;
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const receipts = [];
|
|
151
|
+
for (const task of tasks) {
|
|
152
|
+
if (task.hash === undefined)
|
|
153
|
+
return failed(`No current hash for ${task.id}`);
|
|
154
|
+
const entries = task.outputs.length === 0 ? [] : expand(root, task.outputs);
|
|
155
|
+
if (task.outputs.length > 0 && entries.length === 0)
|
|
156
|
+
return failed(`No public outputs for ${task.id}`);
|
|
157
|
+
const selected = new Set();
|
|
158
|
+
for (const entry of entries) {
|
|
159
|
+
if (isAbsolute(entry) || entry.split('/').includes('..'))
|
|
160
|
+
return failed(`Invalid public output ${entry} for ${task.id}`);
|
|
161
|
+
// Root-to-entry parent directories must be real; do not follow a
|
|
162
|
+
// parent link into an unrelated tree and sign its bytes.
|
|
163
|
+
let parent = root;
|
|
164
|
+
for (const segment of entry.split('/').slice(0, -1)) {
|
|
165
|
+
parent = join(parent, segment);
|
|
166
|
+
if (!observe(parent).isDirectory())
|
|
167
|
+
return failed(`Symlinked public output parent ${parent}`);
|
|
168
|
+
}
|
|
169
|
+
visit(join(root, entry));
|
|
170
|
+
for (const path of outputNodes.keys()) {
|
|
171
|
+
if (path === entry || path.startsWith(`${entry}/`))
|
|
172
|
+
selected.add(path);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
receipts.push({
|
|
176
|
+
id: task.id,
|
|
177
|
+
hash: task.hash,
|
|
178
|
+
outputs: [...selected].sort().map((path) => {
|
|
179
|
+
const node = outputNodes.get(path);
|
|
180
|
+
if (node === undefined)
|
|
181
|
+
throw new Error(`Lost output census node ${path}`);
|
|
182
|
+
return node;
|
|
183
|
+
}),
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
const fileInputs = new Set(proof.files);
|
|
187
|
+
const deletedSource = status.value
|
|
188
|
+
.split('\0')
|
|
189
|
+
.some((entry) => (entry[0] === 'D' || entry[1] === 'D') && !outputNodes.has(entry.slice(3)));
|
|
190
|
+
const effectiveKind = deletedSource ? 'conservative-provider-source' : proof.kind;
|
|
191
|
+
const dirty = dirtyProviderPaths(status.value).filter((path) => (!outputNodes.has(path) || fileInputs.has(path)) &&
|
|
192
|
+
(effectiveKind === 'conservative-provider-source' || fileInputs.has(path)));
|
|
193
|
+
if (dirty.length > 0)
|
|
194
|
+
return failed(`${effectiveKind}: provider source differs from ${head}: ${dirty.join(', ')}`);
|
|
195
|
+
for (const file of fileInputs) {
|
|
196
|
+
const expected = tracked.get(file);
|
|
197
|
+
if (expected === undefined)
|
|
198
|
+
return failed(`Nx file input is not in provider HEAD tree: ${file}`);
|
|
199
|
+
const path = join(root, file);
|
|
200
|
+
const stats = observe(path);
|
|
201
|
+
const mode = stats.isSymbolicLink() ? '120000' : (stats.mode & 73n) !== 0n ? '100755' : '100644';
|
|
202
|
+
if (mode !== expected.mode)
|
|
203
|
+
return failed(`Nx file input mode differs from provider HEAD: ${file}`);
|
|
204
|
+
if (!stats.isFile())
|
|
205
|
+
return failed(`Unproved linked or non-file input source closure: ${file}`);
|
|
206
|
+
const oid = fileDigest(path, Number(stats.size), algorithm, true);
|
|
207
|
+
if (oid !== expected.oid)
|
|
208
|
+
return failed(`Nx file input bytes differ from provider HEAD: ${file}`);
|
|
209
|
+
}
|
|
210
|
+
const finalHead = git(root, ['rev-parse', '--verify', 'HEAD']);
|
|
211
|
+
const finalStatus = git(root, ['status', '--porcelain=v1', '-z', '--untracked-files=all']);
|
|
212
|
+
if (!finalHead.ok)
|
|
213
|
+
return failed(finalHead.detail);
|
|
214
|
+
if (!finalStatus.ok)
|
|
215
|
+
return failed(finalStatus.detail);
|
|
216
|
+
const newlyDirty = dirtyProviderPaths(finalStatus.value).some((path) => (!outputNodes.has(path) || fileInputs.has(path)) &&
|
|
217
|
+
(effectiveKind === 'conservative-provider-source' || fileInputs.has(path)));
|
|
218
|
+
if (finalHead.value.trim() !== head || newlyDirty || !nodesUnchanged(observed)) {
|
|
219
|
+
return failed('Provider source, revision or public output nodes moved during receipt capture');
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
disposition: 'hit',
|
|
223
|
+
receipt: {
|
|
224
|
+
workspaceRoot: root,
|
|
225
|
+
head,
|
|
226
|
+
headTree: tree.value.trim(),
|
|
227
|
+
tasks: receipts,
|
|
228
|
+
fileInputProvenance: effectiveKind,
|
|
229
|
+
runtimeEnvironmentProvenance: 'nx-task-hash-only',
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
if (error instanceof Error)
|
|
235
|
+
return failed(`Cannot prove provider source/public outputs: ${error.message}`);
|
|
236
|
+
throw error;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/** Admit only recipes emitted by the same owning toolchain generator.
|
|
240
|
+
* No shell parsing or keyword approximation confers file-source provenance.
|
|
241
|
+
*/
|
|
242
|
+
export function boundedReceiptRuntimes(inputs, directories, files, installationProved) {
|
|
243
|
+
const runtimes = Object.values(inputs).flatMap((input) => input.runtime);
|
|
244
|
+
if (runtimes.length === 0)
|
|
245
|
+
return { kind: 'bounded' };
|
|
246
|
+
if (!installationProved)
|
|
247
|
+
return { kind: 'opaque', detail: 'Runtime input plugin/module source closure is unproved' };
|
|
248
|
+
const pins = CARGO_TOOLCHAIN_PIN_INPUTS.map((path) => path.replace('{workspaceRoot}/', ''));
|
|
249
|
+
if (!pins.some((pin) => files.includes(pin)))
|
|
250
|
+
return { kind: 'opaque', detail: 'Version runtime input has no declared toolchain FILE pin' };
|
|
251
|
+
const allowed = new Set(directories.flatMap((directory) => [
|
|
252
|
+
'rustc -vV && cargo -V',
|
|
253
|
+
'rustc -vV && cargo -V && cargo clippy -V',
|
|
254
|
+
'rustc -vV && cargo -V && cargo clippy -V && cargo fmt --version',
|
|
255
|
+
'rustc -vV && cargo -V && cargo nextest --version',
|
|
256
|
+
].map((command) => cargoRuntimeInput(directory, command).runtime)));
|
|
257
|
+
const opaque = runtimes.filter((runtime) => !allowed.has(runtime));
|
|
258
|
+
return opaque.length === 0
|
|
259
|
+
? { kind: 'bounded' }
|
|
260
|
+
: { kind: 'opaque', detail: `Unbounded runtime source closure: ${opaque.join('; ')}` };
|
|
261
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { BigIntStats } from 'node:fs';
|
|
2
|
+
import type { NxJsonConfiguration } from 'nx/src/config/nx-json';
|
|
3
|
+
import type { ProjectGraph } from 'nx/src/config/project-graph';
|
|
4
|
+
import type { FileData, WorkspaceContext } from 'nx/src/native';
|
|
5
|
+
import type { readModulePackageJsonWithoutFallbacks } from 'nx/src/utils/package-json';
|
|
6
|
+
/** Identity of a previously read node, not a timestamp freshness threshold. */
|
|
7
|
+
export declare function nodeStamp(stats: BigIntStats): string;
|
|
8
|
+
export interface NodeWitness {
|
|
9
|
+
readonly path: string;
|
|
10
|
+
readonly stamp: string;
|
|
11
|
+
}
|
|
12
|
+
export interface WorkspaceSnapshot {
|
|
13
|
+
readonly files: readonly FileData[];
|
|
14
|
+
readonly nodes: readonly NodeWitness[];
|
|
15
|
+
readonly stable: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface GraphWitness {
|
|
18
|
+
readonly version: 1;
|
|
19
|
+
readonly workspaceRoot: string;
|
|
20
|
+
readonly environment: string;
|
|
21
|
+
readonly installation: string;
|
|
22
|
+
readonly snapshot: WorkspaceSnapshot;
|
|
23
|
+
readonly projectGraph: ProjectGraph;
|
|
24
|
+
}
|
|
25
|
+
/** An absent, unreadable or malformed optional witness never authorizes reuse. */
|
|
26
|
+
export declare function readGraphWitness(path: string): GraphWitness | null;
|
|
27
|
+
export declare function writeWitness(path: string, value: GraphWitness | ArtifactWitness): void;
|
|
28
|
+
/** Capture exact node identity and rehash new/replaced/rewritten nodes.
|
|
29
|
+
* Nx's Unix archive uses whole-second mtimes, so allFileData alone cannot
|
|
30
|
+
* prove an immediate same-second rewrite. An unbound archive hash is never
|
|
31
|
+
* admitted: on the first capture every file is rehashed through Nx itself.
|
|
32
|
+
*/
|
|
33
|
+
export declare function workspaceSnapshot(workspaceRoot: string, context: WorkspaceContext, previous: WorkspaceSnapshot | undefined): WorkspaceSnapshot;
|
|
34
|
+
export declare function nodesUnchanged(nodes: readonly NodeWitness[]): boolean;
|
|
35
|
+
/** Membership and content are exact. Outputs do not exempt manifests or
|
|
36
|
+
* newly created/deleted files; this graph witness has no output exclusions.
|
|
37
|
+
*/
|
|
38
|
+
export declare function snapshotsEqual(left: WorkspaceSnapshot, right: WorkspaceSnapshot): boolean;
|
|
39
|
+
export declare function reusableGraph(witness: GraphWitness | null, workspaceRoot: string, environment: string, installation: string | null, snapshot: WorkspaceSnapshot): ProjectGraph | null;
|
|
40
|
+
/** Plugins with opaque external graph inputs cannot borrow this proof.
|
|
41
|
+
* For the repository plugin and Nx, bind the entire owned module/file tree
|
|
42
|
+
* and its dependency/optional/peer resolution closure, including each alias,
|
|
43
|
+
* physical target and package manifest. SHA-256 binds every regular file's
|
|
44
|
+
* bytes, including manifest metadata; pre/post node stamps still reject a
|
|
45
|
+
* tree that moved while reading. A missing optional dependency is recorded too.
|
|
46
|
+
*/
|
|
47
|
+
export declare function graphInstallationIdentity(workspaceRoot: string, nxJson: NxJsonConfiguration, resolvePackage: typeof readModulePackageJsonWithoutFallbacks): string | null;
|
|
48
|
+
export interface ArtifactWitness {
|
|
49
|
+
readonly version: 1;
|
|
50
|
+
readonly workspaceRoot: string;
|
|
51
|
+
readonly claims: string;
|
|
52
|
+
readonly nodes: readonly (NodeWitness & {
|
|
53
|
+
readonly taskId: string;
|
|
54
|
+
})[];
|
|
55
|
+
}
|
|
56
|
+
export declare function readArtifactWitness(path: string): ArtifactWitness | null;
|
|
57
|
+
//# sourceMappingURL=ensure-built-witness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensure-built-witness.d.ts","sourceRoot":"","sources":["../src/ensure-built-witness.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAc3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,2BAA2B,CAAC;AAGvF,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAEpD;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;CACrC;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAOlE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,eAAe,GAAG,IAAI,CAQtF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,iBAAiB,GAAG,SAAS,GACtC,iBAAiB,CAyBnB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO,CAUrE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAIzF;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,YAAY,GAAG,IAAI,EAC5B,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,QAAQ,EAAE,iBAAiB,GAC1B,YAAY,GAAG,IAAI,CAUrB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,mBAAmB,EAC3B,cAAc,EAAE,OAAO,qCAAqC,GAC3D,MAAM,GAAG,IAAI,CA+Ef;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,WAAW,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CACxE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAOxE"}
|