@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.
- package/README.md +140 -137
- package/dist/.build-inputs.json +18 -18
- package/dist/cargo-toolchain-paths.d.ts +1 -1
- package/dist/cargo-toolchain-paths.js +1 -1
- package/dist/cargo-toolchain-policy.d.ts +2 -2
- package/dist/cargo-toolchain-policy.js +2 -2
- package/dist/cross-check-policy.d.ts +25 -30
- package/dist/cross-check-policy.d.ts.map +1 -1
- package/dist/cross-check-policy.js +27 -31
- package/dist/ensure-built-witness.js +727 -450
- package/dist/ensure-built.js +2 -2
- package/dist/executors/bounded-exec/bounds.d.ts +6 -3
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
- package/dist/executors/bounded-exec/bounds.js +9 -2
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +24 -19
- package/dist/executors/bounded-exec/mbx-pool.d.ts +13 -16
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-pool.js +24 -28
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts +2 -0
- package/dist/executors/bounded-exec/runner-lifecycle.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-lifecycle.js +9 -5
- package/dist/executors/bounded-exec/runner-sizing.d.ts +6 -1
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-sizing.js +7 -2
- package/dist/executors/bounded-exec/schema.d.ts +12 -3
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.d.ts +10 -0
- package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.js +36 -2
- package/dist/index.js +24 -11
- package/dist/managed-files/files.d.ts +4 -4
- package/dist/managed-files/files.js +4 -4
- package/dist/owned-installation.d.ts.map +1 -1
- package/dist/owned-installation.js +4 -2
- package/dist/producer-receipts.js +476 -402
- package/dist/task-graph-policy.js +1 -1
- package/dist/testing.d.ts +8 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +15 -0
- package/dist/workspace-config-policy.d.ts +1 -1
- package/dist/workspace-config-policy.js +1 -1
- package/dist/workspace-manifest.d.ts +5 -0
- package/dist/workspace-manifest.d.ts.map +1 -1
- package/managed/raw/patches/{nx@23.2.1.patch → nx@24.0.3.patch} +1397 -2174
- package/managed/raw/tooling/direnv/devenv.smoo.nix +30 -31
- package/managed/raw/tooling/git-hooks/pre-push.sh +21 -21
- package/managed/templates/github/actions/setup-devenv/action.yml +20 -5
- package/package.json +4 -3
- package/runtime/nx-publish/.build-inputs.json +2 -2
- package/runtime/nx-publish/cache_adapter.js +24 -11
- package/runtime/nx-publish/nx_publish.js +2 -1
- package/runtime-input.sh +1 -1
- package/src/cargo-toolchain-paths.ts +1 -1
- package/src/cargo-toolchain-policy.ts +2 -2
- package/src/cross-check-policy.ts +29 -32
- package/src/ensure-built.ts +2 -2
- package/src/executors/bounded-exec/bounds.ts +13 -4
- package/src/executors/bounded-exec/executor.ts +27 -29
- package/src/executors/bounded-exec/mbx-pool.ts +36 -30
- package/src/executors/bounded-exec/runner-lifecycle.ts +13 -6
- package/src/executors/bounded-exec/runner-sizing.ts +8 -2
- package/src/executors/bounded-exec/schema.json +5 -1
- package/src/executors/bounded-exec/schema.ts +12 -3
- package/src/executors/cargo-zigbuild/executor.ts +42 -2
- package/src/index.ts +27 -9
- package/src/managed-files/files.ts +4 -4
- package/src/owned-installation.ts +4 -2
- package/src/task-graph-policy.ts +1 -1
- package/src/testing.ts +13 -0
- package/src/workspace-config-policy.ts +1 -1
- package/src/workspace-manifest.ts +5 -0
- package/test-timings.json +2 -0
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ inference.
|
|
|
23
23
|
`@nx/devkit` publishes). A plugin carries no traversal of its own and no second `dependsOn` parser, and checks what
|
|
24
24
|
Nx already ships before adding a dependency. `dependsOn` takes `^`, wildcards such as `^*-js`, `project:target` and
|
|
25
25
|
object forms; a copy answers for the spellings its author thought of and drifts from the Nx that schedules the task,
|
|
26
|
-
and it never receives a repair of the pinned Nx ([Nx
|
|
26
|
+
and it never receives a repair of the pinned Nx ([Nx 24.0.3 Runtime Patch](#nx-2403-runtime-patch)).
|
|
27
27
|
2. **Put each decision in the hook that sees its data.** `createNodesV2` infers targets for each project file it
|
|
28
28
|
matches, before any graph exists. `createDependencies` adds project edges and has no dependency graph yet.
|
|
29
29
|
`createMetadata` runs after both, with every project's merged targets and the edges the plugins added (Nx adds a
|
|
@@ -184,6 +184,14 @@ their own `nx.json`; this keeps the native task database local too, rather than
|
|
|
184
184
|
Offline, path-only Cargo fixtures likewise own a temporary `CARGO_HOME`; production commands still keep the caller's
|
|
185
185
|
Cargo home.
|
|
186
186
|
|
|
187
|
+
Fixtures the suite infers in its own process own their Nx state the same way. The package's test preload
|
|
188
|
+
(`src/__tests__/isolate-nx-state.ts`) drops the `NX_WORKSPACE_DATA_DIRECTORY`, `NX_PROJECT_GRAPH_CACHE_DIRECTORY` and
|
|
189
|
+
`NX_CACHE_DIRECTORY` the suite inherits from its job (CI's setup-devenv action, a cowshed job), so every fixture root
|
|
190
|
+
resolves its own `.nx`. Nx's native file index shares one walk among every context of one workspace-data directory: the
|
|
191
|
+
walk holds `nx_files.lock` there, and a context that waits on it loads the archive that walk wrote instead of walking
|
|
192
|
+
its own root. Resolved through the job's absolute directory, a fixture's context gets the files of whichever root walked
|
|
193
|
+
there last.
|
|
194
|
+
|
|
187
195
|
Fixture sockets and loopback listeners live where a Cowshed sandbox admits them, never at a literal `/tmp` path or on
|
|
188
196
|
port 0. A fixture's short socket parent alias lives beside the Nx socket directory the job supplies (the parent of
|
|
189
197
|
`NX_SOCKET_DIR`, the workspace's short runtime link), else under `COWSHED_RUNTIME_LINK`, else the temp directory. The
|
|
@@ -336,12 +344,12 @@ gate and the cross check keep their own `target/cargo-lint` and `target/cargo-li
|
|
|
336
344
|
The `production` configuration adds `--release` to the targets that build shipped artifacts (`cargo-napi`,
|
|
337
345
|
`napi-<arch>-<os>`, `cargo-wasm`) and is selected for shipping: the generated publish workflow's build and platform-leg
|
|
338
346
|
steps, the `smoo release` commands it runs, and the build and deploy runs of a production `smoo github-ci nx-deploy`.
|
|
339
|
-
The land
|
|
340
|
-
reach that seam. Test targets have no `production` configuration, so a release build never compiles release
|
|
341
|
-
binaries. A package-local target that builds a shipped artifact follows the same rule: its default options compile
|
|
342
|
-
and its `production` configuration compiles a shipping profile. A shipping profile other than `release` is only
|
|
343
|
-
artifact family no other build compiles, such as a size-optimised wasm32 lane; a profile that compiles the same
|
|
344
|
-
for the same target as `dev` or `release` compiles every dependency a second time.
|
|
347
|
+
The land gate also builds the host production CLI and addon before its shipping-byte guard; ordinary build and test
|
|
348
|
+
graphs never reach that seam. Test targets have no `production` configuration, so a release build never compiles release
|
|
349
|
+
test binaries. A package-local target that builds a shipped artifact follows the same rule: its default options compile
|
|
350
|
+
`dev` and its `production` configuration compiles a shipping profile. A shipping profile other than `release` is only
|
|
351
|
+
for an artifact family no other build compiles, such as a size-optimised wasm32 lane; a profile that compiles the same
|
|
352
|
+
crates for the same target as `dev` or `release` compiles every dependency a second time.
|
|
345
353
|
|
|
346
354
|
Native profiles have disjoint output trees: development CLIs live under `.cache/bin/<platform>/` and development
|
|
347
355
|
platform addons under `.cache/native-dev/<platform>/`; production retains the shipping `dist/bin/` and `dist/native/`
|
|
@@ -349,8 +357,11 @@ layout. Declarations interpolate the same options the commands use, so their out
|
|
|
349
357
|
together. The host-resolved `cli-native` and `napi-native` aggregates delegate to the existing platform producers and
|
|
350
358
|
declare no outputs of their own. Their `production` configuration forwards that same selection to the host producer. A
|
|
351
359
|
test that executes the CLI or loads the ordinary platform addon names those producers; tests using the explicit test
|
|
352
|
-
addon still name `napi-debug`. The
|
|
353
|
-
`
|
|
360
|
+
addon still name `napi-debug`. The root `gate` target depends on `cowshed:cli-native` and `cowshed:napi-native` in their
|
|
361
|
+
`production` configuration (a `dependsOn` entry's `configuration`, a hunk of the carried Nx patch), so the land gate's
|
|
362
|
+
one Nx graph builds them beside its other tasks and replays them when their inputs did not move. The land host then runs
|
|
363
|
+
the dependency-free `cowshed:release-check`, cached on a runtime digest of the shipping bytes it inspects, never on a
|
|
364
|
+
development output.
|
|
354
365
|
|
|
355
366
|
After the fast-forward, main's output restoration explicitly requests `build`, `cli-native`, and `napi-native`. The
|
|
356
367
|
normal build remains JS/dependency-only; this post-land seam restores the source-selected host CLI/addon and their input
|
|
@@ -403,13 +414,13 @@ sources are not hashed instead: the managed module alone changed 43 times in the
|
|
|
403
414
|
would have rekeyed every cargo verdict; evaluated at those commits on Linux x86_64, the observed store objects did not
|
|
404
415
|
change. rustc and cargo are not in the list on purpose. Cargo keys units on the output of rustc's version command, which
|
|
405
416
|
is hashed beside this input, never on rustc's path. On a non-Linux host the default shell and its linux-cross profile
|
|
406
|
-
carry different rust-std sets, so that path would split
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
417
|
+
carry different rust-std sets, so that path would split one target's key between the two shells. Only a path in the Nix
|
|
418
|
+
store counts; a path elsewhere is ignored. A linker named only by Cargo configuration is outside this environment probe:
|
|
419
|
+
a target that runs one must name the script itself as an input. Workspace test runners additionally hash the manifest of
|
|
420
|
+
every package the workspace build compiles inside the Nx workspace (a member's, and a path package's that reaches the
|
|
421
|
+
build only as some crate's dev-dependency), because those affect unified features, and the nextest
|
|
422
|
+
executable/configuration. While the build compiles a path package outside the Nx workspace, every runner also names
|
|
423
|
+
externalRustCrates, which then must be declared: a runner's key does not follow the test build's outputs.
|
|
413
424
|
|
|
414
425
|
Nothing machine-local takes part. The ambient cargo environment as a whole and the global `$CARGO_HOME/config.toml` are
|
|
415
426
|
deliberately not hashed: their values carry per-checkout state directories (`CARGO_INSTALL_ROOT` moves under the active
|
|
@@ -450,7 +461,7 @@ this repository once loaded it through one, and the land gate refused the graph)
|
|
|
450
461
|
lock-scope node of the crates the target builds (`cargoClosure` carries it; a target that names neither gets the node of
|
|
451
462
|
the directory it runs in). An entry naming only `cargo-lock:` nodes does not count as naming npm packages.
|
|
452
463
|
|
|
453
|
-
No input declaration removes a project's own configuration from a task's key. Nx
|
|
464
|
+
No input declaration removes a project's own configuration from a task's key. Nx 24.0.3 adds `ProjectConfiguration` to
|
|
454
465
|
every task (`hash_planner.rs` `gather_self_inputs`), and `hash_project_config.rs` hashes the executor, outputs, options,
|
|
455
466
|
configurations and parallelism of every target in the project, plus its tags and named inputs (not `inputs`,
|
|
456
467
|
`dependsOn`, `cache` or `//`). An edit to one target's command therefore re-keys every target of that project, including
|
|
@@ -472,7 +483,7 @@ Policy excludes incidental Markdown through `!{projectRoot}/**/*.md` in `default
|
|
|
472
483
|
Markdown declares it through an input set without a matching negative: Nx exclusions win over positive paths in the same
|
|
473
484
|
fileset, so a later explicit path cannot re-include it. Inferred Cargo package filesets remain broad for arbitrary
|
|
474
485
|
compiled data, headers, schemas and build-script reads; incidental Markdown beneath a crate can therefore still
|
|
475
|
-
invalidate those tasks conservatively. Nx
|
|
486
|
+
invalidate those tasks conservatively. Nx 24.0.3 hashes a cached target that declares no `inputs` over every file under
|
|
476
487
|
its project root and ignores the `default` named input, so `smoo monorepo check` refuses such a target: declare its
|
|
477
488
|
inputs, or give its target name a `targetDefaults` entry with `"inputs": ["default", "^default"]`.
|
|
478
489
|
|
|
@@ -550,7 +561,7 @@ command failures use the same fail-closed path. For example:
|
|
|
550
561
|
{ "runtime": "sh node_modules/@smoothbricks/nx-plugin/runtime-input.sh bun --version" }
|
|
551
562
|
```
|
|
552
563
|
|
|
553
|
-
Nx
|
|
564
|
+
Nx 24.0.3 hashes a runtime input's stdout and stderr and ignores its exit status, so a failed input becomes a valid key:
|
|
554
565
|
its error text, one string for every history, toolchain or file it could not read, and a result cached under it is
|
|
555
566
|
replayed for all of them. The script keys on the command's stdout alone and turns a nonzero exit into an Nx error: it
|
|
556
567
|
ends stdout with the byte 0xFF, and Nx refuses output that is not UTF-8
|
|
@@ -1139,25 +1150,28 @@ aggregates.
|
|
|
1139
1150
|
Concrete targets come from concrete files:
|
|
1140
1151
|
|
|
1141
1152
|
- `tsc-js` runs `ttsc -p tsconfig.lib.json --emit` with flags that make it emit transformed JavaScript, declarations and
|
|
1142
|
-
declaration maps from one non-incremental program, then restores execute bits on outputs
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
a
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1153
|
+
declaration maps from one non-incremental program, then restores execute bits on the `package.json#bin` outputs that
|
|
1154
|
+
emit wrote: each beneath its `outDir`, or JavaScript beneath `dist` when the config states no `outDir`. A bin another
|
|
1155
|
+
target writes (a second emit into `dist` beside a `dist-types` declaration emit, a bundle) is that target's to make
|
|
1156
|
+
executable, and a launcher checked into Git keeps the mode Git gives it: a clean checkout can run `tsc-js` before such
|
|
1157
|
+
a target, so a `tsc-js` that claimed its bin failed on a file nothing had written yet. It writes no file beside the
|
|
1158
|
+
tsconfig, whose directory a consumer's ttsc transform lists while it compiles. Direct project references and every
|
|
1159
|
+
cached output lane are preserved. The config's `outDir` is the target's only output and holds exactly what this emit
|
|
1160
|
+
wrote: the compiler rewrites every output it produces in place, so after a successful emit the executor removes each
|
|
1161
|
+
file under `outDir` whose inode, ctime and mtime are unchanged since before the emit, and each directory that leaves
|
|
1162
|
+
empty. A file an earlier build wrote and this one no longer does (a bin moved to another package, a deleted module) is
|
|
1163
|
+
gone before Nx captures the output, so no cache artifact carries it. A failed emit removes nothing, and an `outDir`
|
|
1164
|
+
that holds a TypeScript source is refused before the compiler runs. It writes `.build-inputs.json` into the `outDir`:
|
|
1165
|
+
the SHA-256 of every file the config's `include` matches less its `exclude`, taken before the emit, and those globs as
|
|
1166
|
+
Git pathspecs. Native targets write the same record from rustc's dep-info through `@smoothbricks/build-inputs`: macOS
|
|
1167
|
+
uses its `smoo-nx-build-inputs` CLI and Linux's `cargo-zigbuild` executor calls that same collector. A record produced
|
|
1168
|
+
under Nx also carries its producer's project, target and optional configuration, taken from the actual task
|
|
1169
|
+
environment. Shell entry uses that identity to judge the selected development receipts, including inferred targets
|
|
1170
|
+
absent from package manifests, and name their actual cached rebuild. It constructs no Nx graph, shadow output registry
|
|
1171
|
+
or second interpolation policy. The record is inside the target's outputs, so a cache hit restores it with them; a
|
|
1172
|
+
live developer link (`@smoothbricks/cli`, "Declared Links") checks it to tell a current build from a stale one by
|
|
1173
|
+
content. The shell entry that bootstraps the plugin (`tooling/direnv/enter-shell.ts`) keeps its build marker under
|
|
1174
|
+
`node_modules/.cache`, not under `outDir`, where the executor would remove it as a file its emit did not write.
|
|
1161
1175
|
- `scriptc-<arch>-<family>` (`scriptc-arm64-macos`, `scriptc-x64-macos`, `scriptc-arm64-linux`, `scriptc-x64-linux`) are
|
|
1162
1176
|
inferred for a package that lists `scriptc` in `devDependencies` (that pin is the compiler the targets run; the
|
|
1163
1177
|
workspace root lists `scriptc` in `trustedDependencies` so its install links the platform compiler) together with each
|
|
@@ -1356,8 +1370,8 @@ Concrete targets come from concrete files:
|
|
|
1356
1370
|
executor with `bin` set; a static CLI targets `<arch>-unknown-linux-musl`. The executor runs `cargo-zigbuild`
|
|
1357
1371
|
directly, removes any compiler or linker the shell names for its triple (a Linux shell pins its host compiler for
|
|
1358
1372
|
`x86_64-unknown-linux-gnu`), and reads the artifact path from cargo's JSON messages. zig and cargo-zigbuild come from
|
|
1359
|
-
the managed devenv module
|
|
1360
|
-
(`tooling/devenv -P linux-cross shell -- …`).
|
|
1373
|
+
the managed devenv module, in every shell; the Linux rust-std set beyond `x86_64-unknown-linux-gnu` comes with a Linux
|
|
1374
|
+
shell, and on macOS only inside the `linux-cross` profile (`tooling/devenv -P linux-cross shell -- …`).
|
|
1361
1375
|
- `build` is inferred only when the project has at least one concrete build target to run, such as inferred `tsc-js`, a
|
|
1362
1376
|
package-local target like `tsdown-js`, or `cargo-wasm` from this plugin. It depends on output-family wildcard targets:
|
|
1363
1377
|
`*-js`, `*-web`, `*-html`, `*-css`, `*-ios`, `*-android`, `*-native`, `*-napi`, `*-bun`, and `*-wasm`.
|
|
@@ -1692,15 +1706,15 @@ smoo-nx-exec my-cli:build --workspace-root "$root"
|
|
|
1692
1706
|
A hit prints nothing, where `nx run` would replay every task's cached log. A miss prints Nx's run of the target on
|
|
1693
1707
|
stderr.
|
|
1694
1708
|
|
|
1695
|
-
## Nx
|
|
1709
|
+
## Nx 24.0.3 Runtime Patch
|
|
1696
1710
|
|
|
1697
|
-
The repository installs Nx
|
|
1698
|
-
`nx@
|
|
1711
|
+
The repository installs Nx 24.0.3 as an ordinary Bun `patchedDependencies` entry: the root `package.json` lists
|
|
1712
|
+
`nx@24.0.3` and `@nx/js@24.0.3`, and applies [`patches/nx@24.0.3.patch`](../../patches/nx@24.0.3.patch) to the registry
|
|
1699
1713
|
`nx` package. Bun installs a patched package project-local under `node_modules/.bun/`, so the `nx` the repository runs
|
|
1700
1714
|
is the patched one.
|
|
1701
1715
|
|
|
1702
|
-
`@nx/js` imports `nx` (`nx/release`, `nx/src/…`) without declaring it
|
|
1703
|
-
([nrwl/nx#34087](https://github.com/nrwl/nx/issues/34087)). `patches/@nx%2Fjs@
|
|
1716
|
+
`@nx/js` 24.0.3 still imports `nx` (`nx/release`, `nx/src/…`) without declaring it
|
|
1717
|
+
([nrwl/nx#34087](https://github.com/nrwl/nx/issues/34087)). `patches/@nx%2Fjs@24.0.3.patch` declares the peer, so Bun
|
|
1704
1718
|
binds the same pinned Nx through the package's normal dependency namespace.
|
|
1705
1719
|
|
|
1706
1720
|
Native APFS fixtures install this same pinned package and patch offline into their own checkout, using Bun's local
|
|
@@ -1740,23 +1754,12 @@ The Nx patch repairs upstream Nx runtime behavior, separately from this plugin's
|
|
|
1740
1754
|
keeps its full-closure default. The installed-product regression compares all root input buckets and configurations
|
|
1741
1755
|
against closure inspection and rejects the old all-plan selection. See
|
|
1742
1756
|
[root-only raw-input inspection](../../patches/README.md#root-only-raw-input-inspection).
|
|
1743
|
-
- **The default cache limit uses the cache's own filesystem.** It takes ten percent of `statfs(cacheDir)` capacity, or
|
|
1744
|
-
its nearest existing ancestor when the directory has not been created. This avoids synchronously inventorying every
|
|
1745
|
-
mounted disk. Explicit `NX_MAX_CACHE_SIZE` and `nx.json.maxCacheSize` retain their precedence; filesystem errors other
|
|
1746
|
-
than a missing directory still fail the operation. See [upstream Nx #37269](https://github.com/nrwl/nx/pull/37269).
|
|
1747
|
-
Cowshed exports an explicit caller-overridable default of configured build-volume capacity divided by ten for host
|
|
1748
|
-
shells and jobs. The hosted setup action keeps its existing separate `20GB` ceiling.
|
|
1749
1757
|
- **The daemon keeps graph plugin workers running.** Nx stops an isolated plugin worker after the last phase it has
|
|
1750
1758
|
hooks for, which for a graph-only plugin is every graph; the daemon recomputes the graph on every tracked file change,
|
|
1751
1759
|
so each change spawned and loaded every graph plugin's worker again (median 199 ms against 63 ms from edit to graph in
|
|
1752
1760
|
a one-project fixture, 0.9–1.5 s per worker under a gate's load). On the daemon a worker with graph hooks now lives as
|
|
1753
1761
|
long as the daemon; one-shot clients and task-only plugins keep the eager shutdown. See
|
|
1754
1762
|
[upstream Nx #37271](https://github.com/nrwl/nx/pull/37271).
|
|
1755
|
-
- **Nx resolves typescript and release version actions from the workspace.** Nx 23.2.1 loads both with a plain `require`
|
|
1756
|
-
from its own location. Where that location cannot see `typescript`, its dependency analysis skips every source import
|
|
1757
|
-
without a warning (the first install that exposed this lost 12 of 44 graph edges), and `release version` cannot
|
|
1758
|
-
resolve `@nx/js`'s version actions. The patch resolves both through `getNxRequirePaths` (the workspace first), falling
|
|
1759
|
-
back to Nx's own location. See [upstream Nx #37272](https://github.com/nrwl/nx/pull/37272).
|
|
1760
1763
|
- **A task's dependencies do not depend on which other tasks the run asks for.** A target that depends on `^build`
|
|
1761
1764
|
through a project with no `build` target gets a dummy task for it, and Nx flattens each dummy into the real tasks
|
|
1762
1765
|
behind it except a dummy it believes sits in a cycle. `findCycles` reported every task on the depth-first path that
|
|
@@ -1782,34 +1785,6 @@ The Nx patch repairs upstream Nx runtime behavior, separately from this plugin's
|
|
|
1782
1785
|
which untars the artifact with its stored mtimes and restores it with the same copy. Restoring one directory output of
|
|
1783
1786
|
10,000 1 KiB files took a median 3.4 s for the native remove and copy and 0.79 s more for the stamp, on a machine at
|
|
1784
1787
|
load average 70–120. Not yet proposed upstream.
|
|
1785
|
-
- **A file rewritten within the second it was hashed in is hashed again.** Every Nx context (each run without the
|
|
1786
|
-
daemon, and the daemon when it starts) hashes the workspace's files through `<workspace-data>/nx_files.nxt`, which on
|
|
1787
|
-
Unix keeps each file's hash beside its mtime in whole seconds, and reuses an archived hash while that second is
|
|
1788
|
-
unchanged; size and nanoseconds are not compared. A file written again within the second it was hashed in keeps its
|
|
1789
|
-
mtime and hashes as the bytes it replaced: a revert replays the cache entry of the edit it reverts. The patch applies
|
|
1790
|
-
Git's racy-index rule before the native context reads the archive: when the archive holds an mtime from ten seconds
|
|
1791
|
-
before its own write (the longest a hashing pass is assumed to run) or later, it is removed and every file is hashed
|
|
1792
|
-
again. A full pass over 6,370 files measured 288–753 ms at load average 70–110. The check reads each entry's mtime
|
|
1793
|
-
from the archive's rkyv layout as Nx 23.2.1's binary writes it (the root's entry count and entry pointer in the last
|
|
1794
|
-
12 bytes, 24-byte entries with the i64 mtime at +8), in under 1 ms for 6,396 files. In 134 synthetic workspaces of 1
|
|
1795
|
-
to 400 files dated 2001 it kept every archive, and it removed every one once a file was written in the pass. An
|
|
1796
|
-
archive whose root does not fit is removed. A file dated ahead of the archive keeps it distrusted, so every run hashes
|
|
1797
|
-
everything until the clock passes that date. The check cannot see a pass longer than ten seconds, nor an archive
|
|
1798
|
-
another Nx process rewrites between the check and the native read; on Windows, whose native mtime is a FILETIME, it
|
|
1799
|
-
does nothing. The native fix records every entry dated from the second its pass started on as racy and has none of
|
|
1800
|
-
these limits. Not yet proposed upstream.
|
|
1801
|
-
- **A failed run exits 1, not 130, when it skips the tasks behind a failure.** Nx skips every task that depends on a
|
|
1802
|
-
failed one, and tells no life cycle about a skipped task, so the results `nx` reads its exit status from had none for
|
|
1803
|
-
it; `didCommandComplete` takes a discrete task without a result for one the run never finished, and `nx` exited 130,
|
|
1804
|
-
the status of an interrupted run. A gate then reported `Failed to run "nx" due to exit code 130` for an ordinary test
|
|
1805
|
-
failure. The patch has `didCommandComplete` also accept a task the runner reports skipped, so the exit status is 1.
|
|
1806
|
-
With `--nx-bail=true`, pending tasks have no status and active tasks can be stopped by bailout cleanup; the CLI uses
|
|
1807
|
-
the orchestrator's actual bailout and interruption flags, so a known failure still exits 1, but a signal or forced TUI
|
|
1808
|
-
stop wins and exits 130. The terminal output's "Tasks not run" list is unchanged. Only that check sees the runner's
|
|
1809
|
-
skipped tasks: `invokeTasksRunner` and the plugins' `postTasksExecution` hooks still get Nx's own results, with none
|
|
1810
|
-
for a skipped task, so a caller that replays Nx's skip rule over them counts it once. (An earlier version of this hunk
|
|
1811
|
-
added a skipped result to those results, and such a caller counted no task as skipped.) Not yet proposed upstream: Nx
|
|
1812
|
-
`master` reports skipped tasks the same way.
|
|
1813
1788
|
- **A workspace has one daemon, and a second one leaves it alone.** Every daemon overwrote `server-process.json` with
|
|
1814
1789
|
its own pid, so two clients that each found no daemon started two, and the later one displaced the earlier. A client
|
|
1815
1790
|
of the displaced daemon lost its socket mid-request (`EPIPE` on `RECORD_OUTPUTS_HASH_BATCH`) after the run had printed
|
|
@@ -1823,14 +1798,14 @@ The Nx patch repairs upstream Nx runtime behavior, separately from this plugin's
|
|
|
1823
1798
|
a path another daemon has bound alone, so that daemon's socket is not unlinked. A holder starts when it claims, so a
|
|
1824
1799
|
live one that has not answered by the time its record is a minute old (a pid reused after a crash) is stale and
|
|
1825
1800
|
replaced. On a filesystem without hard links the record is created exclusively instead. Not yet proposed upstream.
|
|
1826
|
-
- **A run that throws part way through
|
|
1827
|
-
`finally`, so the static summary also prints when the orchestrator throws mid-run.
|
|
1828
|
-
whenever no task had failed or stopped, and counted each task the run never reported as skipped: a
|
|
1829
|
-
whose daemon socket died while recording output hashes printed success with "10 skipped", then
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1801
|
+
- **A run that throws part way through names the tasks it never finished.** The default tasks runner ends its life cycle
|
|
1802
|
+
in a `finally`, so the static summary also prints when the orchestrator throws mid-run. Nx 23.2.1 printed
|
|
1803
|
+
"Successfully ran" whenever no task had failed or stopped, and counted each task the run never reported as skipped: a
|
|
1804
|
+
focused `run-many` whose daemon socket died while recording output hashes printed success with "10 skipped", then
|
|
1805
|
+
`Error: write EPIPE`. Nx 24.0.3 prints success only when every discrete task was reported, as this repository's 23.2.1
|
|
1806
|
+
hunk did, and lists the others as not run "because their dependencies failed, --nx-bail=true, or their batch ended
|
|
1807
|
+
before reaching them". When no task failed, nothing skipped them, so the patch lists them under "Tasks the run ended
|
|
1808
|
+
without finishing" instead. Not yet proposed upstream.
|
|
1834
1809
|
- **Nx refuses an environment set up for another workspace.** A shell that moves into another checkout keeps the
|
|
1835
1810
|
`NX_WORKSPACE_ROOT_PATH`, `NX_WORKSPACE_DATA_DIRECTORY`, `NX_CACHE_DIRECTORY` and `NX_SOCKET_DIR` of the workspace it
|
|
1836
1811
|
was set up for, and Nx takes `NX_WORKSPACE_ROOT_PATH` verbatim as its root: `nx daemon --stop` run in the second
|
|
@@ -1881,44 +1856,54 @@ The Nx patch repairs upstream Nx runtime behavior, separately from this plugin's
|
|
|
1881
1856
|
connection once its request queue drains now covers the daemon process too. A bounded regression runs a real daemon
|
|
1882
1857
|
whose global sync generator globs through the daemon's own client and requires zero open connections once the
|
|
1883
1858
|
generator finishes.
|
|
1884
|
-
- **A daemon whose workspace has gone stops
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
file
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
The
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
directory): those are the bytes the watcher's rules came from. An event stops the daemon unless its file is one of
|
|
1903
|
-
those and still hashes the same; a file changed between the watcher's read and the context's, or one the context never
|
|
1904
|
-
held, stops it as before.
|
|
1859
|
+
- **A daemon whose workspace has gone stops.** Once every file of a workspace is deleted under a running daemon, as when
|
|
1860
|
+
a checkout is removed or unmounted before its daemon is stopped, Nx 23.2.1's native file worker read the empty file
|
|
1861
|
+
map as one it had not filled yet and waited on its condition variable for files (`FilesWorker::get_files`): the next
|
|
1862
|
+
glob blocked the daemon's only thread for good, where no SIGTERM handler runs. Nx 24's file state waits only while a
|
|
1863
|
+
scan runs (`FileState::wait_ready`). The daemon still stops itself when the workspace's `nx.json` is gone: a workspace
|
|
1864
|
+
without it is no Nx workspace, and its client already runs without a daemon. It checks on every applied watcher batch
|
|
1865
|
+
before recomputing from it, on every request and on the 5 s safety poll. A bounded regression deletes every tracked
|
|
1866
|
+
file under a real daemon and requires it to exit with that reason.
|
|
1867
|
+
- **The daemon stops for an ignore file only when its watch's rules may be stale.** Nx 23.2.1's daemon stopped itself on
|
|
1868
|
+
every watcher event for a `.gitignore` or `.nxignore`, whatever the file then held. A rewrite with the same bytes (a
|
|
1869
|
+
checkout, a formatter) reports one, and the stop destroys every client socket at once, so a file-watcher client lost
|
|
1870
|
+
the notification of the batch that carried the event, and a watcher waiting to judge an edit in that batch waited
|
|
1871
|
+
forever. Nx 24 stops only for an ignore file in its content-filtered batches, but its watch reads the ignore files
|
|
1872
|
+
once, as it starts and before its scan, so a file rewritten between the two is in no batch and the watch keeps the old
|
|
1873
|
+
rules. The patch keeps the content hash of each ignore file the scan read, but only where neither the file nor its
|
|
1874
|
+
directory changed since just before the watch started (judged on the filesystem's own clock, by stamping a probe in
|
|
1875
|
+
the workspace data directory): those are the bytes the watch's rules came from. A watch event for an ignore file stops
|
|
1876
|
+
the daemon when its bytes moved from those, or when it is a workspace file the patch holds no such hash for.
|
|
1905
1877
|
- **A failure before execution does not crash a completion lifecycle.** The
|
|
1906
1878
|
[run-information repair](../../patches/README.md#run-information-after-a-pre-start-failure) owns the completion,
|
|
1907
1879
|
history and timing contract.
|
|
1908
1880
|
|
|
1881
|
+
Nx 24 carries four repairs this patch carried on 23.2.1, so their hunks are gone and their regressions stay: the default
|
|
1882
|
+
cache bound taken from the cache's own filesystem (`statfs`, through its nearest existing ancestor;
|
|
1883
|
+
[upstream Nx #37269](https://github.com/nrwl/nx/pull/37269), since 24.0.2; where that filesystem cannot be read for
|
|
1884
|
+
another reason than a missing directory, Nx 24's `get_default_max_cache_size` logs it at debug level and bounds the
|
|
1885
|
+
cache at 100 GiB, where the 23.2.1 hunk failed the operation), resolving `typescript` and release version actions from
|
|
1886
|
+
the workspace ([upstream Nx #37272](https://github.com/nrwl/nx/pull/37272), since 24.0.3), Git's racy-index rule for
|
|
1887
|
+
file hashes (the archive, `nx_files_v2.nxt`, records when its gather began, `gathered_at`, and reuses no entry dated
|
|
1888
|
+
that second or later), and a failed run's exit status 1, never 130, when it skips the tasks behind a failure
|
|
1889
|
+
(`tasks-runner/run-outcome.js`). Cowshed exports an explicit caller-overridable default cache bound of configured
|
|
1890
|
+
build-volume capacity divided by ten for host shells and jobs; the hosted setup action keeps its existing separate
|
|
1891
|
+
`20GB` ceiling.
|
|
1892
|
+
|
|
1909
1893
|
Publishing or installing `@smoothbricks/nx-plugin` alone does **not** change a consumer's Nx. `smoo monorepo update`
|
|
1910
|
-
distributes the managed `patches/nx@
|
|
1894
|
+
distributes the managed `patches/nx@24.0.3.patch` and maintains the root registry override `nx = "24.0.3"` plus its
|
|
1911
1895
|
matching `patchedDependencies` entry. Run ordinary `bun install`, commit its lock changes, then prove a frozen install
|
|
1912
1896
|
and the affected normal Nx gates. Do not replace the registry dependency with a local link or hide a failure by
|
|
1913
1897
|
resetting the database or disabling the daemon.
|
|
1914
1898
|
|
|
1915
|
-
The patch is keyed to `nx@
|
|
1916
|
-
|
|
1899
|
+
The patch is keyed to `nx@24.0.3`; a different Nx version needs its own patch file, carried as
|
|
1900
|
+
[Activating a patch change](../../patches/README.md#activating-a-patch-change) describes. On an Nx upgrade, remove each
|
|
1901
|
+
hunk only when the installed upstream release contains that repair and the task-history namespace, cache-bound,
|
|
1917
1902
|
resident-worker, store-resolution, task-graph, restore-time, racy-archive, skipped-task exit, daemon-claim,
|
|
1918
1903
|
incomplete-run summary, foreign-environment, ignore-file and run-information regressions pass; preserve any repair not
|
|
1919
1904
|
yet released. The restore-time regression fails without its hunk only on macOS, where the copy clones (on Linux
|
|
1920
1905
|
`std::fs::copy` writes a fresh mtime), so run it on macOS before dropping the hunk. When every hunk is upstream, remove
|
|
1921
|
-
the `nx@
|
|
1906
|
+
the `nx@24.0.3` and `@nx/js@24.0.3` entries from `patchedDependencies` and delete their patch files.
|
|
1922
1907
|
|
|
1923
1908
|
## Bun Test Tracing Generator
|
|
1924
1909
|
|
|
@@ -2058,17 +2043,27 @@ so a package pattern that matched no tests cannot pass. It exits 1 when any bina
|
|
|
2058
2043
|
be run.
|
|
2059
2044
|
|
|
2060
2045
|
A target may name a `fixtureCommand` with its `fixtureTimeoutMs`: a compiler-fixture producer the executor runs first,
|
|
2061
|
-
in the same cwd, environment and CPU grant
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2046
|
+
in the same cwd, environment and CPU grant (under mbx inside the leaf's reservation, or before it when its units are
|
|
2047
|
+
counted, below; a build's compilers are admitted one by one), as segment 0 of the same lifecycle — a build interval for
|
|
2048
|
+
its whole life, under its own supervisor and acknowledged like a runner's phases. The command follows under `&&` (a
|
|
2049
|
+
direct Go/Cargo chain keeps its phases behind a brace group; any other command runs as one segment active from its
|
|
2050
|
+
spawn), so a fixture failure ends the run before a test starts, and fixture output earns no progress. `fixtureTimeoutMs`
|
|
2051
|
+
is the segment's own wall-clock ceiling, a build budget; the segment's terminal retires it, and expiring it records a
|
|
2052
|
+
`fixture` bound, since no test was running. The pair is refused unpaired, and a run that names it names no shadow record
|
|
2053
|
+
of warmth. This exists for warmth that lives outside Nx outputs — a compiler plugin cache, a Cargo `target/`: it cannot
|
|
2054
|
+
be a cacheable output, and as a `cache: false` prerequisite it executed even when every consumer then restored its
|
|
2055
|
+
verdict from cache, because Nx runs an uncached dependency before reaching its cached consumer. Inside the consumer's
|
|
2056
|
+
own task the cache decides: a hit restores the verdict and warms nothing; an execution warms first. Without the
|
|
2057
|
+
lifecycle channel (Windows) the fixture is plain shell text ahead of the command, bounded from spawn like any wrapper,
|
|
2058
|
+
and its ceiling does not apply.
|
|
2059
|
+
|
|
2060
|
+
Under mbx, a reserved leaf whose target names a `unitsCommand` (a shell command printing one line per unit `command`
|
|
2061
|
+
runs; the plugin's nextest pieces name the same `nextest list -T oneline` of their selection and partition) runs that
|
|
2062
|
+
command at the end of its fixture segment, under the fixture's ceiling, which then starts at spawn, with the fixture's
|
|
2063
|
+
own output on stderr; the fixture runs before the reservation, not inside it. The leaf then reserves
|
|
2064
|
+
`--cpus min(units, its runner's count)`, at least one, and its reservation says
|
|
2065
|
+
`cowshed: mbx reserve running cpus=<granted> asked=<asked>`. A count that fails fails the run before anything is
|
|
2066
|
+
reserved, named as the fixture segment. `unitsCommand` is refused without `fixtureCommand`.
|
|
2072
2067
|
|
|
2073
2068
|
Process-group timeout fixtures retain cleanup authority only until the command leader exits and every descendant closes
|
|
2074
2069
|
its inherited lifetime FIFO. EOF is the terminal ownership event; a later `afterEach` must not signal the retired PGID
|
|
@@ -2434,12 +2429,14 @@ pool grants at most what it can. A lent pool accounts for siblings together; eac
|
|
|
2434
2429
|
allocation to grandchildren. Closing a child's connection returns its local allocation, never the parent's upstream
|
|
2435
2430
|
grant. Upstream loss revokes the downstream pool, so a dead parent grants nothing more; a command whose grant closes
|
|
2436
2431
|
while it runs (the lending parent's exit) runs on over budget to its own exit, and stderr says
|
|
2437
|
-
`cowshed: cpu-pool grant ended`.
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2432
|
+
`cowshed: cpu-pool grant ended`. The fifo is made beside the pool's socket in `NX_SOCKET_DIR`, so a socket directory
|
|
2433
|
+
inside the checkout must be one Nx ignores before its daemon starts: Nx 24's watch reads a created fifo and blocks on it
|
|
2434
|
+
(`patches/README.md`, "Known upstream defect: the watch reads a FIFO"). A bare count proves no pool. An absent endpoint
|
|
2435
|
+
lends nothing: the command runs as configured, and stderr says so. A connected parent pool's refusal or protocol failure
|
|
2436
|
+
instead fails admission: running beside it would count the command twice. `options.env` cannot inject either marker, nor
|
|
2437
|
+
a jobserver (`CARGO_MAKEFLAGS`, `MAKEFLAGS`, `MFLAGS`); a parent make's jobserver the executor inherits still reaches an
|
|
2438
|
+
ungranted command. The verdict records the grant and its actual local wait as `cpu`. Pool setup, listener and cleanup
|
|
2439
|
+
errors fail rather than bypassing accounting. Command bounds stay unchanged.
|
|
2443
2440
|
|
|
2444
2441
|
A land gate (`tooling/land-host.sh`) runs as `cowshed exec <workspace> --class gate --host -- COMMAND [ARGS...]` after
|
|
2445
2442
|
daemon-stop. It is never CPU-limited: its class sets the priority the kernel schedules it at, and its Nx run serves its
|
|
@@ -2693,9 +2690,15 @@ tests) owns those roots:
|
|
|
2693
2690
|
- `publishFixtureSocketDirectory(workspace)` makes that alias and returns the leaf. The workspace must be a physical
|
|
2694
2691
|
directory in a run this process holds (`ownedFixtureRoot`), so the run's sweep can reclaim the alias if the process
|
|
2695
2692
|
dies; anything else is refused. The alias points at the fixture's own `.nx/sockets` (mode 0700, never through a
|
|
2696
|
-
symlinked `.nx`); Nx makes the real `nx` leaf.
|
|
2697
|
-
|
|
2698
|
-
|
|
2693
|
+
symlinked `.nx`); Nx makes the real `nx` leaf. The directory holds a `.gitignore` that ignores everything in it,
|
|
2694
|
+
itself included, so nothing made there is a workspace file, as cowshed's git exclude keeps a shed's `.cowshed/run`
|
|
2695
|
+
out: Nx 24's workspace context reads every path its watch reports created, and a jobserver fifo the run CPU pool makes
|
|
2696
|
+
in the socket namespace (`executors/bounded-exec/cpu-pool.ts`) blocks that read, and with it the daemon's only thread,
|
|
2697
|
+
until the pool ends. A `task-results.test.ts` daemon whose workspace ignored nothing hung that way in a land gate;
|
|
2698
|
+
`testing.test.ts` holds such a fifo open under a daemon of a workspace that ignores nothing and requires the daemon to
|
|
2699
|
+
answer. This package's `withNxFixture` publishes its workspace and passes the directory to the body, and the CLI's
|
|
2700
|
+
`runFixtureNx` publishes each root it runs in. Both `fixtureNxEnv`s take the directory as an argument and publish
|
|
2701
|
+
nothing.
|
|
2699
2702
|
- `ownedWorkspaceSocketDirectory(workspace, slot)` creates the real leaf `a` or `b` beside `nx` below a published alias,
|
|
2700
2703
|
for tests of multiple daemon socket directories. Its caller stops the daemon before removing the leaf.
|
|
2701
2704
|
- `retireFixtureSocketDirectory(workspace)` unlinks only the verified parent alias after the daemon exits, named from
|