@smoothbricks/nx-plugin 0.7.1 → 0.7.3

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.
Files changed (73) hide show
  1. package/README.md +140 -137
  2. package/dist/.build-inputs.json +18 -18
  3. package/dist/cargo-toolchain-paths.d.ts +1 -1
  4. package/dist/cargo-toolchain-paths.js +1 -1
  5. package/dist/cargo-toolchain-policy.d.ts +2 -2
  6. package/dist/cargo-toolchain-policy.js +2 -2
  7. package/dist/cross-check-policy.d.ts +25 -30
  8. package/dist/cross-check-policy.d.ts.map +1 -1
  9. package/dist/cross-check-policy.js +27 -31
  10. package/dist/ensure-built-witness.js +727 -450
  11. package/dist/ensure-built.js +2 -2
  12. package/dist/executors/bounded-exec/bounds.d.ts +6 -3
  13. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
  14. package/dist/executors/bounded-exec/bounds.js +9 -2
  15. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  16. package/dist/executors/bounded-exec/executor.js +24 -19
  17. package/dist/executors/bounded-exec/mbx-pool.d.ts +13 -16
  18. package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
  19. package/dist/executors/bounded-exec/mbx-pool.js +24 -28
  20. package/dist/executors/bounded-exec/runner-lifecycle.d.ts +2 -0
  21. package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
  22. package/dist/executors/bounded-exec/runner-lifecycle.js +9 -5
  23. package/dist/executors/bounded-exec/runner-sizing.d.ts +6 -1
  24. package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -1
  25. package/dist/executors/bounded-exec/runner-sizing.js +7 -2
  26. package/dist/executors/bounded-exec/schema.d.ts +12 -3
  27. package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
  28. package/dist/executors/cargo-zigbuild/executor.d.ts +10 -0
  29. package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
  30. package/dist/executors/cargo-zigbuild/executor.js +36 -2
  31. package/dist/index.js +24 -11
  32. package/dist/managed-files/files.d.ts +4 -4
  33. package/dist/managed-files/files.js +4 -4
  34. package/dist/owned-installation.d.ts.map +1 -1
  35. package/dist/owned-installation.js +4 -2
  36. package/dist/producer-receipts.js +476 -402
  37. package/dist/task-graph-policy.js +1 -1
  38. package/dist/testing.d.ts +8 -0
  39. package/dist/testing.d.ts.map +1 -1
  40. package/dist/testing.js +15 -0
  41. package/dist/workspace-config-policy.d.ts +1 -1
  42. package/dist/workspace-config-policy.js +1 -1
  43. package/dist/workspace-manifest.d.ts +5 -0
  44. package/dist/workspace-manifest.d.ts.map +1 -1
  45. package/managed/raw/patches/{nx@23.2.1.patch → nx@24.0.3.patch} +1397 -2174
  46. package/managed/raw/tooling/direnv/devenv.smoo.nix +30 -31
  47. package/managed/raw/tooling/git-hooks/pre-push.sh +21 -21
  48. package/managed/templates/github/actions/setup-devenv/action.yml +20 -5
  49. package/package.json +4 -3
  50. package/runtime/nx-publish/.build-inputs.json +2 -2
  51. package/runtime/nx-publish/cache_adapter.js +24 -11
  52. package/runtime/nx-publish/nx_publish.js +2 -1
  53. package/runtime-input.sh +1 -1
  54. package/src/cargo-toolchain-paths.ts +1 -1
  55. package/src/cargo-toolchain-policy.ts +2 -2
  56. package/src/cross-check-policy.ts +29 -32
  57. package/src/ensure-built.ts +2 -2
  58. package/src/executors/bounded-exec/bounds.ts +13 -4
  59. package/src/executors/bounded-exec/executor.ts +27 -29
  60. package/src/executors/bounded-exec/mbx-pool.ts +36 -30
  61. package/src/executors/bounded-exec/runner-lifecycle.ts +13 -6
  62. package/src/executors/bounded-exec/runner-sizing.ts +8 -2
  63. package/src/executors/bounded-exec/schema.json +5 -1
  64. package/src/executors/bounded-exec/schema.ts +12 -3
  65. package/src/executors/cargo-zigbuild/executor.ts +42 -2
  66. package/src/index.ts +27 -9
  67. package/src/managed-files/files.ts +4 -4
  68. package/src/owned-installation.ts +4 -2
  69. package/src/task-graph-policy.ts +1 -1
  70. package/src/testing.ts +13 -0
  71. package/src/workspace-config-policy.ts +1 -1
  72. package/src/workspace-manifest.ts +5 -0
  73. package/test-timings.json +2 -0
@@ -95,13 +95,11 @@
95
95
  ln -s ${pkgs.python3Packages.pyflakes}/bin/pyflakes "$out/bin/pyflakes"
96
96
  '';
97
97
 
98
- # Builds every Linux Rust artifact and the cross clippy; see
99
- # `profiles.linux-cross` below for where it applies and why. zig itself is in
100
- # the base shell (see `pkgs.zig` in `packages`). The rust-std set is every
101
- # Linux triple an artifact ships for except x86_64-unknown-linux-gnu, which the
102
- # base shell already carries.
98
+ # The Linux rust-std set every Linux Rust artifact ships for except
99
+ # x86_64-unknown-linux-gnu, which the base shell already carries; see
100
+ # `profiles.linux-cross` below for where it applies and why. zig and
101
+ # cargo-zigbuild are in the base shell (see `packages`).
103
102
  linuxToolchain = {
104
- packages = [pkgs.cargo-zigbuild];
105
103
  languages.rust.targets = [
106
104
  "aarch64-unknown-linux-gnu"
107
105
  "x86_64-unknown-linux-musl"
@@ -190,7 +188,7 @@ in {
190
188
  # its own process. Measured on a 56-project consumer's shed (2026-10-22,
191
189
  # three restarts each): the same project graph and the same hash for all
192
190
  # 443 tasks of `nx run-many -t lint`; the daemon tree went from 8
193
- # processes, about 1.75 GB RSS, to 1 process, about 0.65 GB. Nx 23.2.1
191
+ # processes, about 1.75 GB RSS, to 1 process, about 0.65 GB. Nx 24.0.3
194
192
  # reads only "false" as off (project-graph/plugins/isolation/enabled.js).
195
193
  NX_ISOLATE_PLUGINS = "false";
196
194
  SMOO_TYPECHECK_TSC = "${typecheckTsc}/bin/tsc";
@@ -256,8 +254,8 @@ in {
256
254
  # type-check the arm CI compiles. rust-std alone reaches every crate whose
257
255
  # dependency graph is pure Rust; a dependency that compiles C for the target
258
256
  # — ring, openssl-sys, libgit2-sys, libz-sys — additionally needs a C
259
- # compiler for the target, which is zig in the `linux-cross` toolchain
260
- # below, kept off every macOS shell and macOS runner.
257
+ # compiler for the target: zig, driven by cargo-zigbuild, both in every
258
+ # shell (see `packages` below).
261
259
  #
262
260
  # The reverse direction is not available at any price: type-checking an Apple
263
261
  # target from Linux needs an Apple SDK for those same C-building
@@ -270,35 +268,32 @@ in {
270
268
  ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux linuxToolchain.languages.rust.targets;
271
269
  };
272
270
 
273
- # The Linux Rust toolchain: cargo-zigbuild driving zig, plus the Linux
271
+ # The Linux Rust toolchain is cargo-zigbuild driving zig, plus the Linux
274
272
  # rust-std set. It builds every published Linux Rust artifact — static musl
275
- # CLIs, glibc 2.17 N-API addons — and `check:linux`'s cross clippy, with the
273
+ # CLIs, glibc 2.17 N-API addons — and the `cargo-lint-cross` clippy, with the
276
274
  # same command on every host. zig carries glibc symbol-version stubs for every
277
275
  # glibc and the musl sources inside its own store path, so nothing on the
278
276
  # build machine reaches the artifact: no loader path, no RUNPATH, no build
279
277
  # host's glibc floor. cargo-zigbuild supplies the `zig cc` shims and per-triple
280
278
  # compiler variables itself, so this module sets no environment.
281
279
  #
282
- # A Linux host carries it in the base shell, because its ordinary `build`
283
- # includes its own platform's artifacts. A macOS host opts in through the
284
- # `linux-cross` profile, activated by `devenv -P linux-cross` and driven by
285
- # the root `check:linux` script: the three rust-std targets are about 0.5 GiB
286
- # and nothing else on Darwin needs them. zig is not in the profile: every
287
- # host's base shell carries it, because the scriptc-<arch>-<family> targets
288
- # compile every platform's executables through `zig cc` on every host, the
289
- # host's own platform included (see `pkgs.zig` in `packages` below). devenv
290
- # 2.2.3 has first-class profiles, so this is one gated module in the shared
291
- # file rather than a second config directory that would re-import and re-pin
292
- # everything here.
280
+ # Every host's base shell carries zig, cargo-zigbuild and the
281
+ # x86_64-unknown-linux-gnu rust-std, which is all the cross clippy needs, so
282
+ # `cargo-lint-cross` runs in any checkout's shell and in the land gate's one Nx
283
+ # graph beside every other gate task. A Linux host also carries the remaining
284
+ # Linux rust-std set in the base shell, because its ordinary `build` includes
285
+ # its own platform's artifacts. A macOS host opts into that set through the
286
+ # `linux-cross` profile, activated by `devenv -P linux-cross`: the three
287
+ # rust-std targets are about 0.5 GiB and only a Linux artifact built on Darwin
288
+ # needs them. devenv 2.2.3 has first-class profiles, so this is one gated
289
+ # module in the shared file rather than a second config directory that would
290
+ # re-import and re-pin everything here.
293
291
  #
294
- # The profile supplies the toolchain and nothing else. CARGO_BUILD_TARGET is
295
- # deliberately NOT set: the triple belongs to the Nx target that asks for it
296
- # (`cargo-lint-cross` passes `--target` explicitly), not to the ambient
297
- # environment. An ambient triple would make the check silently host-local
298
- # whenever the profile was forgotten — reporting green having compiled macOS.
299
- # With the flag on the target instead, running it outside this profile fails
300
- # loudly on the missing cargo-zigbuild, and a host lint can never be mistaken
301
- # for a cross one.
292
+ # Neither shell sets CARGO_BUILD_TARGET: the triple belongs to the Nx target
293
+ # that asks for it (`cargo-lint-cross` passes `--target` explicitly), not to
294
+ # the ambient environment. An ambient triple would make the check silently
295
+ # host-local wherever it was missing, reporting green having compiled macOS,
296
+ # and a host lint can never be mistaken for a cross one.
302
297
  profiles.linux-cross.module = {
303
298
  config = lib.mkIf (!pkgs.stdenv.hostPlatform.isLinux) linuxToolchain;
304
299
  };
@@ -424,8 +419,12 @@ in {
424
419
  # on profiles below). The closure is about 380 MiB, fetched once per Nix
425
420
  # store, not per checkout.
426
421
  pkgs.zig
422
+ # Drives zig as the C compiler and linker of every Linux triple, for the
423
+ # Linux artifacts and for the `cargo-lint-cross` clippy, which therefore
424
+ # runs in every shell and in the land gate's Nx graph.
425
+ pkgs.cargo-zigbuild
427
426
  ]
428
- ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux ([pkgs.chromium] ++ linuxToolchain.packages);
427
+ ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [pkgs.chromium];
429
428
 
430
429
  # devenv wraps the Python interpreter to find native libraries in
431
430
  # `languages.python.libraries`, whose default is this checkout's
@@ -11,8 +11,8 @@
11
11
  # 2. The macOS-only Linux cross-compile gate. It asks Nx for cargo-lint-cross,
12
12
  # whose hit means a real `cargo-zigbuild clippy --target x86_64-unknown-linux-gnu`
13
13
  # already passed for exactly this tree, so the push is safe with no toolchain
14
- # present. From a plain shell the cross target itself never compiles here: on
15
- # a miss its guard refuses. Its dependencies are ordinary Nx tasks whose outputs
14
+ # present. The probe asks the cross target to replay and never to compile: on a
15
+ # miss its guard refuses. Its dependencies are ordinary Nx tasks whose outputs
16
16
  # the cross key reads, so Nx restores them from the cache or, for a tree no gate
17
17
  # ran, builds them. A refusal names the one command that fixes it; any other
18
18
  # failure is said as that, never as a cache miss.
@@ -27,18 +27,17 @@
27
27
  # SDK. Under the checkout's environment the keys are the gate's, and a dependency
28
28
  # that does miss builds the way the gate builds it.
29
29
  #
30
- # Why the cross target never compiles here. The cross-clippy needs zig and
31
- # cargo-zigbuild, which a macOS host carries only in the linux-cross devenv
32
- # profile, not in the default shell `direnv exec` enters. A hook that entered
33
- # that profile spent minutes compiling on a push the user expected to take a
34
- # second. Pushing is not the place to discover that the tree has not been
35
- # compiled for Linux: the land gate, or `bun run check:linux`, is.
30
+ # Why the cross target never compiles here. Every checkout shell carries zig,
31
+ # cargo-zigbuild and the Linux rust-std the cross clippy needs, so a miss would
32
+ # compile, and a push the user expected to take a second would spend minutes
33
+ # in clippy. Pushing is not the place to discover that the tree has not been
34
+ # compiled for Linux: the land gate, whose Nx graph holds cargo-lint-cross, or
35
+ # `bun run check:linux`, is.
36
36
  #
37
- # The target's own guard refuses to start when cargo-zigbuild is not on PATH,
38
- # which is what turns a miss into a refusal here. A push made from a shell that
39
- # already carries cargo-zigbuild — an entered linux-cross shell — passes that
40
- # guard, so there a miss runs the check itself: the same clippy `check:linux`
41
- # runs, in the toolchain the user entered for it.
37
+ # SMOO_CROSS_LINT_REPLAY_ONLY=1 makes the target's own guard refuse before it
38
+ # starts cargo-zigbuild, which is what turns a miss into a refusal here. Nx
39
+ # hashes no environment a target does not declare, so the variable leaves the
40
+ # probe's key the gate's, and a hit replays as before.
42
41
  #
43
42
  # The denylist gate needs only tooling/direnv/repo-path's PATH; the cross gate
44
43
  # needs direnv on the caller's PATH, and the checkout's own devenv through it,
@@ -89,23 +88,24 @@ cross_gate() {
89
88
  return 1
90
89
  fi
91
90
 
92
- # The guard's refusal (nx-plugin cross-check-policy.ts CARGO_CROSS_LINT_REFUSAL)
93
- # is the one line that means the key missed. Nx exits 1 for every task failure,
94
- # so the hook reads the output for it rather than guessing from the status.
91
+ # The guard's refusal (nx-plugin cross-check-policy.ts CARGO_CROSS_LINT_REFUSAL,
92
+ # under CARGO_CROSS_LINT_REPLAY_ONLY_ENV) is the one line that means the key
93
+ # missed. Nx exits 1 for every task failure, so the hook reads the output for it
94
+ # rather than guessing from the status.
95
95
  output=$(mktemp "${TMPDIR:-/tmp}/pre-push-cross.XXXXXX") || return 1
96
96
  trap 'rm -f "$output"' EXIT
97
97
  set -o pipefail
98
- direnv exec "$PWD" nx run-many -t cargo-lint-cross --output-style=static 2>&1 | tee "$output"
98
+ SMOO_CROSS_LINT_REPLAY_ONLY=1 direnv exec "$PWD" nx run-many -t cargo-lint-cross --output-style=static 2>&1 | tee "$output"
99
99
  status=$?
100
100
  [ "$status" -eq 0 ] && return 0
101
101
 
102
- if grep -qF 'cargo-lint-cross needs cargo-zigbuild from the linux-cross toolchain; run: bun run check:linux' "$output"; then
102
+ if grep -qF 'cargo-lint-cross is not cached for this tree; run: bun run check:linux' "$output"; then
103
103
  cat >&2 <<'EOF'
104
104
 
105
105
  pre-push: the Linux cross-compile check is NOT cached for this tree, so this
106
- push would ship code that has never been compiled for Linux. The "needs
107
- cargo-zigbuild" line above is the cross target refusing to compile here, not a
108
- broken toolchain.
106
+ push would ship code that has never been compiled for Linux. The "not cached"
107
+ line above is the cross target refusing to compile here, as the probe asked,
108
+ not a broken toolchain.
109
109
 
110
110
  Run: bun run check:linux
111
111
  Wait for it to pass, then push again.
@@ -121,13 +121,24 @@ runs:
121
121
  # job by design (act/runner/run_context.go: MustRandName), so a restored
122
122
  # cache could never match. The workspace is therefore bind-mounted at a
123
123
  # stable path (a symlink would not do: Nix canonicalises) and devenv is
124
- # evaluated from there; every later step still runs in the checkout, which
125
- # is the same tree. DEVENV_WORKDIR names the path the devenv steps use.
124
+ # evaluated from there. DEVENV_WORKDIR names the path the devenv steps use.
125
+ # Later steps start in the checkout, but the shell environment they inherit
126
+ # names the stable path (PATH, NX_WORKSPACE_ROOT_PATH), so Nx and every task
127
+ # it runs see the workspace there.
126
128
  # The mount target is the instance's own /work, not the shared bind: only
127
129
  # the path's spelling must be stable, and a bind onto the idmapped cache
128
130
  # dataset failed inside the job (move_mount: ENOENT) where a container-fs
129
- # target does not. If the mount is refused the job goes on from the
130
- # checkout and pays the evaluation: this is an optimisation, never a gate.
131
+ # target does not. An instance that already ran a job of this scope still
132
+ # holds that job's bind at the stable path, onto a checkout the runner has
133
+ # since deleted, and a bind over it fails with ENOENT too. Binds stack there
134
+ # when an earlier job's checkout outlived it. On Linux the step detaches
135
+ # each first, lazily: a process an earlier job left behind may still hold
136
+ # it. A detach that fails leaves the bind to the kernel's answer below.
137
+ # If the mount is still refused the job goes on from the checkout: devenv
138
+ # evaluates again, and every task sees the checkout's path instead of the
139
+ # stable one. That can change verdicts, not just cost: Biome's scanner skips
140
+ # every path with a .cache component, and act's default checkout lies under
141
+ # ~/.cache/act, so lint loaded no nested .gitignore and checked build output.
131
142
  - name: 📂 Locate devenv state on the shared bind
132
143
  if: steps.runner-kind.outputs.host == 'true'
133
144
  shell: bash
@@ -145,12 +156,16 @@ runs:
145
156
  ln -s "$root/.devenv" tooling/direnv/.devenv
146
157
  ln -s "$root/.direnv" tooling/direnv/.direnv
147
158
  stable="/work/$DEVENV_STATE_REPO/${lane:-default}/$DEVENV_STATE_JOB/$scope"
159
+ while [ "$RUNNER_OS" = Linux ] && mountpoint -q "$stable"; do
160
+ echo "detaching an earlier job's bind at $stable"
161
+ sudo umount --lazy "$stable" || break
162
+ done
148
163
  if mkdir -p "$stable" && sudo mount --bind "$GITHUB_WORKSPACE" "$stable"; then
149
164
  echo "DEVENV_WORKDIR=$stable" >> "$GITHUB_ENV"
150
165
  echo "devenv state: $root (workspace bind-mounted at $stable)"
151
166
  else
152
167
  echo "DEVENV_WORKDIR=$GITHUB_WORKSPACE" >> "$GITHUB_ENV"
153
- echo "::warning::stable devenv path unavailable (bind mount refused); evaluating from the checkout"
168
+ echo "::warning::stable devenv path unavailable (bind mount refused); devenv and every task run from the checkout at $GITHUB_WORKSPACE"
154
169
  echo "devenv state: $root (workspace at $GITHUB_WORKSPACE)"
155
170
  fi
156
171
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smoothbricks/nx-plugin",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "./loader.js",
@@ -283,6 +283,7 @@
283
283
  "default",
284
284
  "^dependencyDefault",
285
285
  "bunToolchain",
286
+ "{workspaceRoot}/packages/nx-23.2.1/package.json",
286
287
  {
287
288
  "runtime": "sh node_modules/@smoothbricks/nx-plugin/runtime-input.sh node --version"
288
289
  },
@@ -648,10 +649,10 @@
648
649
  "directory": "packages/nx-plugin"
649
650
  },
650
651
  "dependencies": {
651
- "@nx/js": "23.2.1",
652
+ "@nx/js": "24.0.3",
652
653
  "@smoothbricks/build-inputs": "0.0.2",
653
654
  "@smoothbricks/cargo-retain": "0.0.2",
654
- "@smoothbricks/cowshed": "0.4.3",
655
+ "@smoothbricks/cowshed": "0.4.4",
655
656
  "@smoothbricks/nextest-extract": "0.0.2",
656
657
  "jsonc-parser": "^3.3.1",
657
658
  "minimatch": "10.2.5",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "version": 1,
3
3
  "files": {
4
- "packages/cowshed/crates/cowshed-core/src/build_volume/cache_adapter.js": "3355da0dc7972b2fe981ca2217a1f373e60004dedeaa62c31131315bba2f4f18",
5
- "packages/cowshed/crates/cowshed-core/src/build_volume/nx_publish.js": "83ccff840b9d3e53cdcc629ffc2af6e64c956a0fcbaaa6c5ce0e59fe0dce436b"
4
+ "packages/cowshed/crates/cowshed-core/src/build_volume/cache_adapter.js": "e8c05f18787e395d1509daf75bdb521b1a7018dff60daa1c8afe93ca8f585d64",
5
+ "packages/cowshed/crates/cowshed-core/src/build_volume/nx_publish.js": "431e05ae1e1a1249a23bf2600101d6e88ca01bc0fc95bd389128e126edca33b9"
6
6
  },
7
7
  "producer": {
8
8
  "project": "nx-plugin",
@@ -1,5 +1,6 @@
1
1
  // One version-sensitive boundary for the checkout's own Nx cache (05_gateway.md, "Publication").
2
- // DbCache and its native cache field are INTERNAL Nx 23.2.1 APIs, not a public stable adapter.
2
+ // DbCache and its native cache field are INTERNAL Nx APIs, not a public stable adapter: each Nx version
3
+ // it was read against is declared in openNxCache with the layout it relies on, and any other is refused.
3
4
  // biome-ignore lint/correctness/noUnusedVariables: invoked by the bodies cache_adapter::script prefixes (cache_adapter.rs), not from this file.
4
5
  function openNxCache(root) {
5
6
  const path = require('node:path');
@@ -7,27 +8,40 @@ function openNxCache(root) {
7
8
  if (!root || !path.isAbsolute(root)) {
8
9
  throw new Error(`Nx cache adapter requires an absolute checkout root, got ${JSON.stringify(root)}`);
9
10
  }
11
+ // What each qualified Nx version fixes for this adapter, read in nrwl/nx at that tag: the checkout's
12
+ // task-database and cache directories (`utils/cache-directory.ts`). In both, the task database is
13
+ // `<machine>-v<DB_VERSION>.db` there (v3 in 23.2.1, v6 in 24.0.3: `native/db/mod.rs`, `initialize.rs`),
14
+ // reached only through Nx's own `NxCache.get`; an entry is `<cache>/<hash>/` with its terminal output in
15
+ // `<cache>/terminalOutputs/<hash>` (`native/cache/cache.rs`); `CachedResult` is `{ code, terminalOutput,
16
+ // outputsPath, size }`; and `HttpRemoteCache.store` archives the entry alike (`native/cache/http_remote_cache.rs`,
17
+ // the same source). 23.2.1's `get` answers a row whose entry directory is gone; 24.0.3's does not.
18
+ const layouts = new Map([
19
+ ['23.2.1', { workspaceData: '.nx/workspace-data', cache: '.nx/cache' }],
20
+ ['24.0.3', { workspaceData: '.nx/workspace-data', cache: '.nx/cache' }],
21
+ ]);
10
22
  const requireNx = createRequire(path.join(root, 'package.json'));
11
23
  const version = requireNx('nx/package.json').version;
12
- if (version !== '23.2.1') {
24
+ const layout = layouts.get(version);
25
+ if (!layout) {
13
26
  throw new Error(
14
- `Nx cache adapter supports exactly Nx 23.2.1, not ${version}; requalify the adapter before upgrading`,
27
+ `Nx cache adapter supports exactly Nx ${[...layouts.keys()].join(' or ')}, not ${version}; requalify the adapter against it`,
15
28
  );
16
29
  }
30
+ const workspaceData = path.join(root, layout.workspaceData);
31
+ const cacheDir = path.join(root, layout.cache);
17
32
  // Nx fixes these paths at module load. Every root is handled in its own existing job process.
18
33
  process.env.NX_WORKSPACE_ROOT_PATH = root;
19
- process.env.NX_WORKSPACE_DATA_DIRECTORY = path.join(root, '.nx', 'workspace-data');
20
- process.env.NX_CACHE_DIRECTORY = path.join(root, '.nx', 'cache');
34
+ process.env.NX_WORKSPACE_DATA_DIRECTORY = workspaceData;
35
+ process.env.NX_CACHE_DIRECTORY = cacheDir;
21
36
  if (requireNx('nx/src/native').IS_WASM) {
22
37
  throw new Error('The Nx cache adapter requires the pinned native database cache, not WASM');
23
38
  }
24
39
  // Nx resolves its workspace-data directory itself; prove it is this checkout's before any database is opened.
25
40
  const { sharedDataDirectory } = requireNx('nx/src/utils/cache-directory');
26
- const workspaceData = path.join(root, '.nx', 'workspace-data');
27
41
  const actualWorkspaceData = sharedDataDirectory(root, 'workspace-data');
28
42
  if (path.resolve(actualWorkspaceData) !== path.resolve(workspaceData)) {
29
43
  throw new Error(
30
- `Nx 23.2.1 workspace-data directory changed: expected ${workspaceData}, actual ${actualWorkspaceData}`,
44
+ `Nx ${version} workspace-data directory changed: expected ${workspaceData}, actual ${actualWorkspaceData}`,
31
45
  );
32
46
  }
33
47
  const { DbCache } = requireNx('nx/src/tasks-runner/cache');
@@ -35,11 +49,10 @@ function openNxCache(root) {
35
49
  const cache = new DbCache({ nxCloudRemoteCache: null, skipRemoteCache: true });
36
50
  const native = cache.cache;
37
51
  if (!native || typeof native.get !== 'function' || typeof native.cacheDirectory !== 'string') {
38
- throw new Error('Nx 23.2.1 DbCache native cache surface changed; requalify the adapter');
52
+ throw new Error(`Nx ${version} DbCache native cache surface changed; requalify the adapter`);
39
53
  }
40
- const expectedCacheDir = path.join(root, '.nx', 'cache');
41
- if (path.resolve(native.cacheDirectory) !== path.resolve(expectedCacheDir)) {
42
- throw new Error(`Nx 23.2.1 cache directory changed: expected ${expectedCacheDir}, actual ${native.cacheDirectory}`);
54
+ if (path.resolve(native.cacheDirectory) !== path.resolve(cacheDir)) {
55
+ throw new Error(`Nx ${version} cache directory changed: expected ${cacheDir}, actual ${native.cacheDirectory}`);
43
56
  }
44
57
  return { requireNx, cache, cacheDir: native.cacheDirectory, getLocal: (hash) => native.get(hash) };
45
58
  }
@@ -32,7 +32,8 @@ async function publish() {
32
32
  let skipped = 0;
33
33
  for (const hash of hashes) {
34
34
  const result = getLocal(hash);
35
- // A task Nx does not cache, or one that failed, has no complete entry to share.
35
+ // A task Nx does not cache, or one that failed, has no complete entry to share; nor has a row
36
+ // whose entry directory is gone, which Nx 23.2.1's lookup still answers.
36
37
  if (result?.code !== 0 || !fs.statSync(result.outputsPath, { throwIfNoEntry: false })?.isDirectory()) {
37
38
  skipped += 1;
38
39
  continue;
package/runtime-input.sh CHANGED
@@ -6,7 +6,7 @@
6
6
  # The input's value is the command's stdout. A command that fails stops Nx with
7
7
  # an error; its failure never becomes a key.
8
8
  #
9
- # WHY the 0xFF byte. Nx 23.2.1 (`packages/nx/src/native/tasks/hashers/
9
+ # WHY the 0xFF byte. Nx 24.0.3 (`packages/nx/src/native/tasks/hashers/
10
10
  # hash_runtime.rs`) runs a runtime input under `sh -c`, hashes its trimmed
11
11
  # stdout followed by its trimmed stderr, and never looks at the exit status. A
12
12
  # failed input is therefore a valid key: its error text, the same string for
@@ -20,7 +20,7 @@ import { delimiter, join } from 'node:path';
20
20
  *
21
21
  * rustc and cargo are not here on purpose. Cargo keys units on the output of `rustc -vV`, never on rustc's path, and the
22
22
  * version recipe beside this one hashes it. On a non-Linux host the default shell and its linux-cross profile carry
23
- * different rust-std targets, so a rustc path would split the pre-push probe from the cached cross-check verdict.
23
+ * different rust-std targets, so a rustc path would split one target's key between the two shells.
24
24
  *
25
25
  * Only a path in the Nix store counts. A store object is named by the hash of everything it was built from, so one
26
26
  * shell gives one object on every machine of a platform. A path elsewhere belongs to the machine and takes no part.
@@ -22,8 +22,8 @@ import { runtimeInput, shellWord } from './runtime-input.js';
22
22
  * differs between a bare shell and a devenv profile for the SAME sources: in
23
23
  * the `linux-cross` profile `CARGO_INSTALL_ROOT` moves under
24
24
  * `profiles/linux-cross/`, and every variable the profile's tools set appears,
25
- * so the entry `check:linux` writes inside the profile could never be hit by
26
- * the pre-push probe, which runs bare. Measured on one repository-root archive
25
+ * so an entry written inside the profile could never be hit from a bare shell (the
26
+ * pre-push probe ran bare while `check:linux` ran in the profile). Measured on one repository-root archive
27
27
  * target with the dump still in place: bare 18197306115812424011, in-profile
28
28
  * 12567954759860890767.
29
29
  *
@@ -5,10 +5,10 @@
5
5
  * compiles is invisible to every check a macOS host can run: a full local lint
6
6
  * passes and CI still goes red on unused imports, unresolved names and dead code
7
7
  * inside the `not(target_os = "macos")` branch. Closing that needs three pieces
8
- * to agree — a devenv profile carrying the Linux toolchain (zig, cargo-zigbuild
9
- * and the Linux rust-std set), an Nx target per Cargo workspace that asks for
10
- * the triple, and a root script that runs the second inside the first. They
11
- * live here together because the plugin infers the target while the CLI
8
+ * to agree: a shell carrying the Linux toolchain (zig, cargo-zigbuild and the
9
+ * x86_64-unknown-linux-gnu rust-std, every managed devenv shell's), an Nx target
10
+ * per Cargo workspace that asks for the triple, and a root script that runs it.
11
+ * They live here together because the plugin infers the target while the CLI
12
12
  * installs the script and reports a project missing it; kept apart, the three
13
13
  * spellings drift and the gate silently stops gating.
14
14
  */
@@ -19,14 +19,6 @@
19
19
  */
20
20
  export const CARGO_LINUX_TRIPLE = 'x86_64-unknown-linux-gnu';
21
21
 
22
- /**
23
- * The devenv profile carrying the Linux toolchain — zig, cargo-zigbuild and the
24
- * Linux rust-std set — defined in the managed `tooling/direnv/devenv.smoo.nix`.
25
- * Opt-in on macOS because zig alone is a 380 MiB closure that nothing but a
26
- * Linux artifact or this check uses.
27
- */
28
- export const DEVENV_CROSS_PROFILE = 'linux-cross';
29
-
30
22
  /**
31
23
  * Nx target name. No colons, per the repo's target-naming rule.
32
24
  *
@@ -41,15 +33,24 @@ export const DEVENV_CROSS_PROFILE = 'linux-cross';
41
33
  export const CARGO_CROSS_LINT_TARGET = 'cargo-lint-cross';
42
34
 
43
35
  /**
44
- * What the cross lint prints when it refuses to compile without cargo-zigbuild
45
- * on PATH: on a Darwin cache miss this line, and only this line, means the
46
- * key missed. The managed pre-push hook reads its output for exactly this text
47
- * to tell a miss from any other Nx failure.
36
+ * What the cross lint prints when it is asked to replay and not compile: on a
37
+ * Darwin cache miss under the managed pre-push probe this line, and only this
38
+ * line, means the key missed. The hook reads its output for exactly this text to
39
+ * tell a miss from any other Nx failure.
48
40
  */
49
- export const CARGO_CROSS_LINT_REFUSAL =
50
- 'cargo-lint-cross needs cargo-zigbuild from the linux-cross toolchain; run: bun run check:linux';
41
+ export const CARGO_CROSS_LINT_REFUSAL = 'cargo-lint-cross is not cached for this tree; run: bun run check:linux';
42
+
43
+ /**
44
+ * Set to `1` by the managed pre-push probe, which asks Nx for the cross target's
45
+ * cached verdict and must never start the clippy itself. Nx hashes no
46
+ * environment a target does not declare, so the probe's key is the gate's.
47
+ */
48
+ export const CARGO_CROSS_LINT_REPLAY_ONLY_ENV = 'SMOO_CROSS_LINT_REPLAY_ONLY';
49
+
50
+ const CARGO_CROSS_LINT_MISSING_TOOL =
51
+ "cargo-lint-cross needs cargo-zigbuild, which every managed devenv shell carries; run it in the checkout's shell: bun run check:linux";
51
52
 
52
- const CARGO_CROSS_LINT_GUARD = `command -v cargo-zigbuild >/dev/null || { echo '${CARGO_CROSS_LINT_REFUSAL}' >&2; exit 2; }`;
53
+ const CARGO_CROSS_LINT_GUARD = `[ "\${${CARGO_CROSS_LINT_REPLAY_ONLY_ENV}:-}" != 1 ] || { echo '${CARGO_CROSS_LINT_REFUSAL}' >&2; exit 2; }; command -v cargo-zigbuild >/dev/null || { echo "${CARGO_CROSS_LINT_MISSING_TOOL}" >&2; exit 2; }`;
53
54
 
54
55
  /**
55
56
  * The prefix `cargoFrozen` writes. Exported so target inference can recognize
@@ -147,9 +148,9 @@ export const CARGO_DENY_WARNINGS = `--config 'build.warnings="deny"'`;
147
148
  * cross test target; it could only recompile these crates to produce a harness it
148
149
  * must then refuse to launch.
149
150
  *
150
- * `--target` is explicit rather than inherited from a CARGO_BUILD_TARGET exported
151
- * by the profile, so running this outside the cross shell fails loudly on the
152
- * missing cargo-zigbuild instead of quietly linting the host and reporting green.
151
+ * `--target` is explicit rather than inherited from an ambient CARGO_BUILD_TARGET,
152
+ * so the triple belongs to this target and a host lint can never pass for a cross
153
+ * one.
153
154
  *
154
155
  * cargo-zigbuild rather than plain cargo because ring compiles C for the target
155
156
  * from its build script, and build scripts run even under clippy: zig is the
@@ -192,19 +193,15 @@ export const CROSS_CHECK_SCRIPT_NAME = 'check:linux';
192
193
 
193
194
  /**
194
195
  * The developer entry point: one command on macOS that reports what CI's Linux
195
- * job would. `tooling/devenv` is the managed wrapper, so this resolves the
196
- * repository's devenv config from any repo in the fleet without naming its path.
196
+ * job would. A plain Nx run, because every managed devenv shell carries the
197
+ * cross toolchain; the land gate's Nx graph holds the same target.
197
198
  *
198
199
  * Deliberately NOT `--quiet`. The pre-push gate is a probe: it consults the Nx
199
- * cache and refuses a push that has no hit, never entering a profile or starting
200
- * a compile of its own. That makes this script the only place the gate ever
201
- * runs, and a human watching it needs devenv's progress too — the cross profile
202
- * adds about 0.9 GiB (zig plus three rust-std targets) and the clippy behind it
203
- * is unbounded, so a silent terminal is indistinguishable from a hang.
204
- * Suppressing that output only paid while a hook ran this for you and nobody
205
- * read it.
200
+ * cache and refuses a push that has no hit, never starting a compile of its own.
201
+ * The clippy behind this script is unbounded, so a silent terminal is
202
+ * indistinguishable from a hang.
206
203
  */
207
- export const CROSS_CHECK_SCRIPT_COMMAND = `tooling/devenv -P ${DEVENV_CROSS_PROFILE} shell -- nx run-many -t ${CARGO_CROSS_LINT_TARGET}`;
204
+ export const CROSS_CHECK_SCRIPT_COMMAND = `nx run-many -t ${CARGO_CROSS_LINT_TARGET}`;
208
205
 
209
206
  /**
210
207
  * A cross-built test archive and the target that EXECUTES it, per foreign
@@ -921,7 +921,7 @@ export function providerInputProof(
921
921
  taskGraph: TaskGraph,
922
922
  requireNx: WorkspaceNxRequire,
923
923
  ): ProviderInputProof {
924
- const { WorkspaceContext, HashPlanInspector, HashPlanner, transferProjectGraph } = requireNx('nx/src/native');
924
+ const { WorkspaceContext, HashPlanInspector, HashPlanner } = requireNx('nx/src/native');
925
925
  const { transformProjectGraphForRust } = requireNx('nx/src/native/transform-objects');
926
926
  const { createProjectRootMappings } = requireNx('nx/src/project-graph/utils/find-project-for-path');
927
927
  const { workspaceDataDirectoryForWorkspace } = requireNx('nx/src/utils/cache-directory');
@@ -937,7 +937,7 @@ export function providerInputProof(
937
937
  runtimeSource: { kind: 'opaque', detail: 'Nx supplied no native file-input proof' },
938
938
  };
939
939
  }
940
- const planner = new HashPlanner(nxJson, transferProjectGraph(transformProjectGraphForRust(projectGraph)));
940
+ const planner = new HashPlanner(nxJson, transformProjectGraphForRust(projectGraph));
941
941
  const inspector = new HashPlanInspector(
942
942
  externalReferences.allWorkspaceFiles,
943
943
  externalReferences.projectFiles,
@@ -3,7 +3,8 @@
3
3
  * a pure function of the run's events and the times they happened at, so a table can test it with no clock and no
4
4
  * process (verdict.ts says why the bounds are separate).
5
5
  *
6
- * - A scheduled leaf arms nothing until its first grant. Later zero-hold intervals pause only the idle budget.
6
+ * - A scheduled leaf arms nothing until its first grant, but for a fixture that runs before its reservation, whose
7
+ * ceiling starts at spawn. Later zero-hold intervals pause only the idle budget.
7
8
  * - Any explicitly queued task process pauses idle, including alongside held grants; ceilings keep running.
8
9
  * - The fixture ceiling ends with its segment. The idle clock also stops outside the testing lifecycle.
9
10
  * - Finished tests reset the idle budget whether their release byte arrived before or after their output.
@@ -18,7 +19,7 @@ export interface BoundLimits {
18
19
 
19
20
  /**
20
21
  * When each armed bound expires, in the clock's milliseconds; `null` when it is not armed. `queued`: the run waits for
21
- * its pool's grant, so none is armed yet.
22
+ * its pool's grant, so none is armed yet but a fixture ceiling started at spawn (`fixtureFirst`).
22
23
  */
23
24
  export interface Bounds {
24
25
  readonly idle: number | null;
@@ -35,7 +36,8 @@ export type BoundKind = 'idle' | 'fixture' | 'total';
35
36
  export type BoundEvent =
36
37
  /**
37
38
  * The command started; `testing` is the lifecycle's answer then, `fixture` whether a supervised fixture leads it,
38
- * `queued` whether mbx schedules this leaf, as known before spawn.
39
+ * `queued` whether mbx schedules this leaf, as known before spawn, and `fixtureFirst` whether that fixture runs
40
+ * before the leaf's reservation (it counts the leaf's units), so its ceiling starts now, not at the grant.
39
41
  */
40
42
  | {
41
43
  readonly kind: 'spawn';
@@ -43,6 +45,7 @@ export type BoundEvent =
43
45
  readonly testing: boolean;
44
46
  readonly fixture: boolean;
45
47
  readonly queued: boolean;
48
+ readonly fixtureFirst: boolean;
46
49
  }
47
50
  /** Each admission begins a hold; the first one starts the queued leaf's ceilings. */
48
51
  | { readonly kind: 'granted'; readonly at: number; readonly testing: boolean; readonly fixture: boolean }
@@ -91,7 +94,13 @@ export function stepBounds(bounds: Bounds, limits: BoundLimits, event: BoundEven
91
94
  switch (event.kind) {
92
95
  case 'spawn':
93
96
  return event.queued
94
- ? { ...UNARMED, queued: true, holds: 0, idleRemaining: limits.idleMs ?? null }
97
+ ? {
98
+ ...UNARMED,
99
+ queued: true,
100
+ holds: 0,
101
+ idleRemaining: limits.idleMs ?? null,
102
+ fixture: event.fixtureFirst && limits.fixtureMs !== undefined ? event.at + limits.fixtureMs : null,
103
+ }
95
104
  : armed(limits, event.at, event.testing, event.fixture);
96
105
  case 'granted': {
97
106
  if (bounds.holds === null) return bounds;