@smoothbricks/nx-plugin 0.4.19 → 0.4.21

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 (44) hide show
  1. package/README.md +68 -18
  2. package/dist/bin/smoo-nx-cargo-hash.js +5 -3
  3. package/dist/cargo-source-hash.d.ts +3 -11
  4. package/dist/cargo-source-hash.d.ts.map +1 -1
  5. package/dist/cargo-source-hash.js +25 -14
  6. package/dist/cargo-workspace.d.ts +0 -1
  7. package/dist/cargo-workspace.d.ts.map +1 -1
  8. package/dist/cargo-workspace.js +9 -2
  9. package/dist/ensure-built.d.ts +6 -5
  10. package/dist/ensure-built.d.ts.map +1 -1
  11. package/dist/ensure-built.js +227 -30
  12. package/dist/index.js +18 -10
  13. package/dist/managed-files/ci-workflow.d.ts +20 -0
  14. package/dist/managed-files/ci-workflow.d.ts.map +1 -1
  15. package/dist/managed-files/ci-workflow.js +42 -13
  16. package/dist/managed-files/files.d.ts +1 -1
  17. package/dist/managed-files/files.d.ts.map +1 -1
  18. package/dist/managed-files/files.js +8 -1
  19. package/dist/managed-files/pr-preview-cleanup-workflow.d.ts +37 -0
  20. package/dist/managed-files/pr-preview-cleanup-workflow.d.ts.map +1 -1
  21. package/dist/managed-files/pr-preview-cleanup-workflow.js +34 -6
  22. package/dist/workspace-manifest.d.ts +3 -1
  23. package/dist/workspace-manifest.d.ts.map +1 -1
  24. package/managed/raw/tooling/direnv/setup-environment.ts +23 -91
  25. package/managed/raw/tooling/git-hooks/commit-msg.sh +6 -0
  26. package/managed/raw/tooling/git-hooks/pre-commit.sh +6 -0
  27. package/managed/raw/tooling/git-hooks/pre-push.sh +6 -0
  28. package/managed/templates/github/actions/setup-devenv/action.yml +19 -7
  29. package/package.json +1 -1
  30. package/src/bin/smoo-nx-cargo-hash.ts +7 -3
  31. package/src/cargo-source-hash.test.ts +237 -1
  32. package/src/cargo-source-hash.ts +32 -16
  33. package/src/cargo-workspace.test.ts +17 -10
  34. package/src/cargo-workspace.ts +9 -3
  35. package/src/ensure-built.test.ts +87 -29
  36. package/src/ensure-built.ts +274 -29
  37. package/src/index.test.ts +117 -20
  38. package/src/index.ts +18 -11
  39. package/src/managed-files/ci-workflow.ts +45 -14
  40. package/src/managed-files/files.ts +9 -2
  41. package/src/managed-files/generator.test.ts +5 -1
  42. package/src/managed-files/github-host-cache-isolation.test.ts +32 -6
  43. package/src/managed-files/pr-preview-cleanup-workflow.ts +87 -6
  44. package/src/workspace-manifest.ts +3 -1
package/README.md CHANGED
@@ -90,9 +90,9 @@ source replacement, credentials, and toolchain settings; forwarding it with `--c
90
90
  access may consequently serialize on Cargo's package-cache lock. Clippy's dedicated target directory keeps its check
91
91
  artifacts out of the test build directory without splitting one directory per crate.
92
92
 
93
- ### External Rust sources
93
+ ### Cargo source runtime inputs
94
94
 
95
- For a repository-root Cargo workspace, declare the shared input once:
95
+ For inferred Cargo targets in a repository-root Cargo workspace, declare the external-source input once:
96
96
 
97
97
  ```json
98
98
  {
@@ -106,12 +106,40 @@ For a package-root Cargo workspace, pass its manifest relative to the Nx root:
106
106
  `smoo-nx-cargo-hash packages/example/Cargo.toml`. A shared input covering several Cargo workspaces includes one runtime
107
107
  entry per manifest.
108
108
 
109
- The command queries `cargo metadata --locked --offline` and hashes the resolved external path packages, including
110
- transitive dependencies, Rust sources, target source files, governing Cargo manifests, and Cargo configuration. It also
111
- covers path packages under `node_modules`, which Nx's normal file map ignores. Adding or moving a dependency does not
109
+ By default, the command queries `cargo metadata --locked --offline` and hashes the resolved external path packages,
110
+ including transitive dependencies, Rust sources, target source files, governing Cargo manifests, and Cargo
111
+ configuration. It also covers path packages under `node_modules`, which Nx's normal file map ignores. Packages inside
112
+ both the Nx and Cargo workspaces are left to the plugin's inferred file inputs. Adding or moving a dependency does not
112
113
  require maintaining a second list of source roots. The command refuses missing dependencies or an unavailable locked
113
114
  dependency cache instead of emitting a partial digest.
114
115
 
116
+ Custom Cargo targets that replace inferred inputs need the in-workspace source closure too. Use
117
+ `smoo-nx-cargo-hash --include-workspace [Cargo.toml]` to include every mutable local package from the same locked,
118
+ offline Cargo metadata result. For a repository-root Cargo workspace:
119
+
120
+ ```json
121
+ {
122
+ "namedInputs": {
123
+ "externalRustCrates": [{ "runtime": "smoo-nx-cargo-hash" }],
124
+ "cargoSources": [
125
+ { "runtime": "smoo-nx-cargo-hash --include-workspace" },
126
+ "{workspaceRoot}/Cargo.lock",
127
+ "{workspaceRoot}/devenv.lock",
128
+ "{workspaceRoot}/tooling/direnv/devenv.lock"
129
+ ]
130
+ }
131
+ }
132
+ ```
133
+
134
+ Name `cargoSources` in each custom Cargo target's `inputs`, alongside its own scripts and non-Rust build inputs. Keep
135
+ `externalRustCrates` for the plugin's external-source inference contract; unrelated TypeScript targets do not need
136
+ `cargoSources`. For a package-root workspace, pass `--include-workspace packages/example/Cargo.toml` and name that
137
+ workspace's `Cargo.lock`. An Nx `^production` input only follows existing project graph edges; it cannot replace a
138
+ missing Cargo dependency closure.
139
+
140
+ The helper exposes the same choice as `hashCargoPathInputs(manifestPath, workspaceRoot, { includeWorkspace: true })`.
141
+ Omitting the options, or setting `includeWorkspace: false`, retains the external-only behavior.
142
+
115
143
  Git and registry dependencies are identified by `Cargo.lock`; uncommitted changes in a Git repository are not changes to
116
144
  a pinned Git dependency. Local `path` dependencies stay live and their source edits change the digest. Build-script data
117
145
  and environment inputs outside the Rust/Cargo inputs above still require explicit Nx inputs.
@@ -176,19 +204,22 @@ Concrete targets come from concrete files:
176
204
  - A workspace-root `Cargo.toml` provides `cargo-test`, `test`, `cargo-lint`, `mutation`, and `bench`.
177
205
  `cargo-test-compile` warms one workspace `cargo test --no-run`. `cargo-test-archive` runs one
178
206
  `cargo --frozen nextest archive --workspace` into `target/nextest/archive.tar.zst` and is the only cached cargo BUILD:
179
- it produces a file rather than a mutable build tree. Each member crate gets a cached `cargo-test-<package>` run (30s
180
- per-test timeout like `bun test --timeout=30000`) whose inputs include that crate and its path dependencies, and whose
181
- command is `cargo --frozen nextest run --archive-file <archive> --workspace-remap . -E 'package(<crate>)'`. Runners
182
- therefore execute rather than build: they extract binaries into their own temporary directory, write nothing to
183
- cargo's flocked `target/`, and fan out instead of chaining. `--workspace-remap` is required — an archive records the
184
- producing tree's absolute paths, and without it a restored archive hands tests another checkout's
185
- `CARGO_MANIFEST_DIR`. With it the archive is relocatable, so one cache entry serves every checkout of the same commit;
186
- nextest re-points `CARGO_BIN_EXE_<name>`/`NEXTEST_BIN_EXE_<name>` at the extracted binaries at runtime, but a test
187
- that reads them through the compile-time `env!` macro keeps the producing tree's path. Per-crate runners accept an
188
- empty nextest selection because a valid workspace member may have no tests and a hash partition may legitimately be
189
- empty. `napi-debug` stays behind `cargo-test-compile`, and a crate in the project that builds the debug cdylib runs
190
- after it. A crate declaring `[package.metadata.smoothbricks.wasm-bindgen]` also receives the cacheable `cargo-wasm`
191
- output target in its owning project.
207
+ it produces a file rather than a mutable build tree. Its inputs, like every cargo-derived fileset, are anchored at
208
+ `{workspaceRoot}`: Nx resolves a `{projectRoot}` glob against only the files its project owns, and a nested package
209
+ owns the crates under it, so a root workspace's archive spelled that way hashes none of its members and replays stale
210
+ binaries against edited crates. Each member crate gets a cached `cargo-test-<package>` run (30s per-test timeout like
211
+ `bun test --timeout=30000`) whose inputs include that crate and its path dependencies, and whose command is
212
+ `cargo --frozen nextest run --archive-file <archive> --workspace-remap . -E 'package(<crate>)'`. Runners therefore
213
+ execute rather than build: they extract binaries into their own temporary directory, write nothing to cargo's flocked
214
+ `target/`, and fan out instead of chaining. `--workspace-remap` is required — an archive records the producing tree's
215
+ absolute paths, and without it a restored archive hands tests another checkout's `CARGO_MANIFEST_DIR`. With it the
216
+ archive is relocatable, so one cache entry serves every checkout of the same commit; nextest re-points
217
+ `CARGO_BIN_EXE_<name>`/`NEXTEST_BIN_EXE_<name>` at the extracted binaries at runtime, but a test that reads them
218
+ through the compile-time `env!` macro keeps the producing tree's path. Per-crate runners accept an empty nextest
219
+ selection because a valid workspace member may have no tests and a hash partition may legitimately be empty.
220
+ `napi-debug` stays behind `cargo-test-compile`, and a crate in the project that builds the debug cdylib runs after it.
221
+ A crate declaring `[package.metadata.smoothbricks.wasm-bindgen]` also receives the cacheable `cargo-wasm` output
222
+ target in its owning project.
192
223
  - The plugin's own `nextest.toml` is passed as `--tool-config-file "smoo:$PWD/<path>"`, so it is a layer BENEATH the
193
224
  repository's `<cargo-workspace>/.config/nextest.toml` rather than a replacement for it: a repository can raise a
194
225
  timeout, add a test group, or declare `archive.include` for a cdylib or fixture the archived test binaries need, and
@@ -270,10 +301,29 @@ through the inferred `typecheck-tests` target, not through `tsc --build`.
270
301
  hashes. A full hit returns without running tasks or printing output. A miss runs the task graph through Nx's in-process
271
302
  runner with streaming output; only a workspace with the daemon disabled falls back to its checkout-local `nx` CLI.
272
303
 
304
+ An `nx:noop` task, including a command-less target that Nx normalizes to one, runs nothing and so needs no cache record:
305
+ the tasks it aggregates answer in its place, and any outputs it declares are verified like every other task's. Any other
306
+ uncacheable task is a miss on every call, because only running it can say whether its side effects are current.
307
+
308
+ The probe and runner use the workspace's installed Nx and its normal cache configuration. A build performed by the Nx
309
+ CLI can satisfy the next wrapper invocation without re-executing tasks; changed inputs still go through Nx's runner.
310
+ Both invocations must use the same cache location. Relative `NX_CACHE_DIRECTORY` and `NX_WORKSPACE_DATA_DIRECTORY`
311
+ values resolve against the Nx workspace root, so they remain checkout-local when inherited by another shell. Absolute
312
+ paths remain caller-controlled, including deliberately shared CI locations; an absolute path inherited from another
313
+ checkout does not become local merely because the working directory changed.
314
+
273
315
  Before hashing, it compares a native snapshot of the workspace with the daemon's file table. A write the daemon's
274
316
  watcher has not delivered yet counts as a miss unless every changed path is a declared output of a task in the graph, so
275
317
  a build's own artifacts never turn the next call noisy, and an edit made moments before the call never hits stale.
276
318
 
319
+ The daemon's output records are lossy: they are held in memory, tracked per collapsed directory, and erased by writes it
320
+ processes more than two seconds late — including, on a busy daemon, a restore's own writes. When it cannot vouch for a
321
+ task's outputs, the working tree is compared with Nx's local cache artifact for that exact task hash, entry by entry as
322
+ Nx's restore expands them: each entry must be reachable through real directories and hold the same node types, symlink
323
+ text (never followed), file permission bits and bytes. A tree the restore would leave unchanged is a hit, and the
324
+ daemon's record is re-armed as Nx's runner does after a restore. A missing or empty artifact, any difference, a read
325
+ error, or a write observed during the comparison is a miss.
326
+
277
327
  ```typescript
278
328
  import { ensureBuilt } from '@smoothbricks/nx-plugin/ensure-built';
279
329
 
@@ -2,12 +2,14 @@
2
2
  import { resolve } from 'node:path';
3
3
  import { hashCargoPathInputs } from '../cargo-source-hash.js';
4
4
  const args = process.argv.slice(2);
5
- if (args.length > 1) {
6
- process.stderr.write('usage: smoo-nx-cargo-hash [Cargo.toml]\n');
5
+ const includeWorkspace = args[0] === '--include-workspace';
6
+ const manifest = args[includeWorkspace ? 1 : 0];
7
+ if (args.length > (includeWorkspace ? 2 : 1) || manifest?.startsWith('-')) {
8
+ process.stderr.write('usage: smoo-nx-cargo-hash [--include-workspace] [Cargo.toml]\n');
7
9
  process.exit(2);
8
10
  }
9
11
  try {
10
- process.stdout.write(`${await hashCargoPathInputs(resolve(args[0] ?? 'Cargo.toml'), process.cwd())}\n`);
12
+ process.stdout.write(`${await hashCargoPathInputs(resolve(manifest ?? 'Cargo.toml'), process.cwd(), { includeWorkspace })}\n`);
11
13
  }
12
14
  catch (error) {
13
15
  process.stderr.write(`smoo-nx-cargo-hash: ${error instanceof Error ? error.message : String(error)}\n`);
@@ -1,12 +1,4 @@
1
- /**
2
- * Cargo owns resolution, including workspace inheritance, target dependencies,
3
- * patches, and transitive path dependencies. A locked offline query observes
4
- * that graph without fetching dependencies or changing the lockfile. Git and
5
- * registry packages are immutable inputs already identified by Cargo.lock.
6
- *
7
- * This covers Rust sources and Cargo configuration, matching the plugin's
8
- * in-workspace Rust inputs. Build scripts' other data/environment inputs remain
9
- * explicit Nx inputs, just as they are for in-workspace crates.
10
- */
11
- export declare function hashCargoPathInputs(manifestPath: string, workspaceRoot: string): Promise<string>;
1
+ export declare function hashCargoPathInputs(manifestPath: string, workspaceRoot: string, options?: {
2
+ includeWorkspace?: boolean;
3
+ }): Promise<string>;
12
4
  //# sourceMappingURL=cargo-source-hash.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cargo-source-hash.d.ts","sourceRoot":"","sources":["../src/cargo-source-hash.ts"],"names":[],"mappings":"AA+BA;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgGtG"}
1
+ {"version":3,"file":"cargo-source-hash.d.ts","sourceRoot":"","sources":["../src/cargo-source-hash.ts"],"names":[],"mappings":"AAmDA,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,GACvC,OAAO,CAAC,MAAM,CAAC,CAkGjB"}
@@ -111,14 +111,23 @@ const ancestorInputs = ['Cargo.toml', '.cargo/config', '.cargo/config.toml'];
111
111
  * patches, and transitive path dependencies. A locked offline query observes
112
112
  * that graph without fetching dependencies or changing the lockfile. Git and
113
113
  * registry packages are immutable inputs already identified by Cargo.lock.
114
+ * By default, Nx's in-workspace inputs own workspace packages; includeWorkspace
115
+ * also covers those packages for custom targets without inferred Cargo inputs.
114
116
  *
115
117
  * This covers Rust sources and Cargo configuration, matching the plugin's
116
118
  * in-workspace Rust inputs. Build scripts' other data/environment inputs remain
117
119
  * explicit Nx inputs, just as they are for in-workspace crates.
118
120
  */
119
- export async function hashCargoPathInputs(manifestPath, workspaceRoot) {
121
+ // Nx hashes a runtime input's stdout AND stderr. Cargo reports lock contention
122
+ // on stderr ("Blocking waiting for file lock on package cache") a
123
+ // timing-dependent number of times when Nx hashes many tasks at once, which
124
+ // made one unchanged tree produce four different task hashes per run. Cargo's
125
+ // stderr is kept for the failure path only, where execFileSync attaches it to
126
+ // the thrown error.
127
+ const CARGO_STDIO = ['ignore', 'pipe', 'pipe'];
128
+ export async function hashCargoPathInputs(manifestPath, workspaceRoot, options) {
120
129
  const root = await realpath(workspaceRoot);
121
- const metadata = parseMetadata(execFileSync('cargo', ['metadata', '--format-version', '1', '--locked', '--offline', '--manifest-path', resolve(manifestPath)], { cwd: root, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024, stdio: ['ignore', 'pipe', 'inherit'] }));
130
+ const metadata = parseMetadata(execFileSync('cargo', ['metadata', '--format-version', '1', '--locked', '--offline', '--manifest-path', resolve(manifestPath)], { cwd: root, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024, stdio: CARGO_STDIO }));
122
131
  const cargoRoot = await realpath(metadata.workspace_root);
123
132
  const directories = new Set();
124
133
  const files = new Set();
@@ -129,25 +138,27 @@ export async function hashCargoPathInputs(manifestPath, workspaceRoot) {
129
138
  continue;
130
139
  const manifest = await realpath(pkg.manifest_path);
131
140
  const directory = dirname(manifest);
132
- const fromRoot = relative(root, directory);
133
- const fromCargo = relative(cargoRoot, directory);
134
- if (fromRoot !== '..' &&
135
- !fromRoot.startsWith(`..${sep}`) &&
136
- !isAbsolute(fromRoot) &&
137
- fromCargo !== '..' &&
138
- !fromCargo.startsWith(`..${sep}`) &&
139
- !isAbsolute(fromCargo) &&
140
- !fromRoot.split(sep).includes('node_modules'))
141
- continue;
141
+ if (!options?.includeWorkspace) {
142
+ const fromRoot = relative(root, directory);
143
+ const fromCargo = relative(cargoRoot, directory);
144
+ if (fromRoot !== '..' &&
145
+ !fromRoot.startsWith(`..${sep}`) &&
146
+ !isAbsolute(fromRoot) &&
147
+ fromCargo !== '..' &&
148
+ !fromCargo.startsWith(`..${sep}`) &&
149
+ !isAbsolute(fromCargo) &&
150
+ !fromRoot.split(sep).includes('node_modules'))
151
+ continue;
152
+ }
142
153
  directories.add(directory);
143
154
  files.add(manifest);
144
155
  // Cargo resolves explicit package.workspace ownership as well as ancestor
145
156
  // workspaces. Metadata's workspace_root describes only the invoking root.
146
- const governingManifest = execFileSync('cargo', ['locate-project', '--workspace', '--manifest-path', manifest, '--message-format', 'plain'], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'inherit'] }).trim();
157
+ const governingManifest = execFileSync('cargo', ['locate-project', '--workspace', '--manifest-path', manifest, '--message-format', 'plain'], { cwd: root, encoding: 'utf8', stdio: CARGO_STDIO }).trim();
147
158
  files.add(await realpath(governingManifest));
148
159
  for (const target of pkg.targets)
149
160
  files.add(await realpath(target.src_path));
150
- // An external member can inherit edition, lint policy, dependencies and
161
+ // A member can inherit edition, lint policy, dependencies and
151
162
  // profiles from a workspace above its package directory. Those manifests
152
163
  // are not descendants of the source roots returned by Cargo metadata.
153
164
  for (let ancestor = dirname(directory); !ancestors.has(ancestor); ancestor = dirname(ancestor)) {
@@ -37,7 +37,6 @@ export interface CargoPackageTestInputsOptions {
37
37
  /** The cargo workspace root holding the top-level `Cargo.toml`. */
38
38
  absoluteProjectRoot: string;
39
39
  memberDir: string;
40
- inputRoot?: string;
41
40
  /** Shared across every call of one graph computation; see {@link createCargoInputsCache}. */
42
41
  cache?: CargoInputsCache;
43
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cargo-workspace.d.ts","sourceRoot":"","sources":["../src/cargo-workspace.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,+BAAgC,SAAQ,qBAAqB;IAC5E,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,w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IACnC,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CAAC,mBAAmB,EAAE,MAAM,GAAG,oBAAoB,EAAE,CA8C7F;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,eAAe,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAGtF;AAED;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYhF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoB9E;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAI1G;AAED,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,yBAAyB,CAAC"}
@@ -174,7 +174,7 @@ export function createCargoInputsCache() {
174
174
  }
175
175
  export function cargoPackageTestInputs(options) {
176
176
  const cache = options.cache ?? createCargoInputsCache();
177
- const key = `${options.absoluteProjectRoot}\0${options.memberDir}\0${options.inputRoot ?? '{projectRoot}'}`;
177
+ const key = `${options.absoluteProjectRoot}\0${options.memberDir}`;
178
178
  const cached = cache.results.get(key);
179
179
  if (cached !== undefined)
180
180
  return cached;
@@ -182,7 +182,14 @@ export function cargoPackageTestInputs(options) {
182
182
  cache.results.set(key, derived);
183
183
  return derived;
184
184
  }
185
- async function deriveCargoPackageTestInputs({ workspaceRoot, absoluteProjectRoot, memberDir, inputRoot = '{projectRoot}' }, cache) {
185
+ async function deriveCargoPackageTestInputs({ workspaceRoot, absoluteProjectRoot, memberDir }, cache) {
186
+ // Every fileset is anchored at `{workspaceRoot}`, never `{projectRoot}`: Nx
187
+ // hashes a `{projectRoot}` glob against only the files its project OWNS, and
188
+ // a nested Nx project owns the crates under it. A repository-root cargo
189
+ // workspace whose members live in `packages/*` would then hash none of its
190
+ // members' sources, and its archive would cache-hit against edited crates
191
+ // while every per-crate runner reran on the stale binaries.
192
+ const inputRoot = posix.join('{workspaceRoot}', relative(workspaceRoot, absoluteProjectRoot).split(sep).join('/'));
186
193
  const loadManifest = (path) => {
187
194
  const normalized = resolve(path);
188
195
  const cached = cache.manifests.get(normalized);
@@ -99,13 +99,14 @@ export declare function describeMiss(reason: MissReason): string;
99
99
  */
100
100
  export declare function firstCacheMiss(tasks: readonly Task[], cachedCodeByHash: ReadonlyMap<string, number>): MissReason | null;
101
101
  /**
102
- * First task whose recorded outputs are no longer the bytes on disk.
102
+ * The entries the daemon does not vouch for.
103
103
  *
104
- * `matches[index]` is the daemon's verdict for `tasks[index]`. A short or
105
- * ragged array counts as stale rather than as a hit: a missing verdict is not a
106
- * positive one, and being wrong here means exec'ing a binary that was deleted.
104
+ * `verdicts[index]` is the daemon's verdict for `entries[index]`. A short or
105
+ * ragged array leaves the remainder unvouched rather than cleared: a missing
106
+ * verdict is not a positive one, and being wrong here means exec'ing a binary
107
+ * that was deleted.
107
108
  */
108
- export declare function firstStaleOutputs(tasks: readonly Task[], matches: readonly boolean[]): MissReason | null;
109
+ export declare function unvouched<Entry>(entries: readonly Entry[], verdicts: readonly boolean[]): Entry[];
109
110
  /**
110
111
  * Make sure an Nx target's outputs are on disk, doing as little as possible
111
112
  * when they already are.
@@ -1 +1 @@
1
- {"version":3,"file":"ensure-built.d.ts","sourceRoot":"","sources":["../src/ensure-built.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,IAAI,EAAa,MAAM,0BAA0B,CAAC;AAmDhE;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OA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