@smoothbricks/nx-plugin 0.4.25 → 0.4.26

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 (54) hide show
  1. package/README.md +144 -41
  2. package/dist/bin/smoo-nx-exec.js +3 -14
  3. package/dist/cargo-closure-input.d.ts +13 -15
  4. package/dist/cargo-closure-input.d.ts.map +1 -1
  5. package/dist/cargo-closure-input.js +29 -37
  6. package/dist/cargo-source-hash.d.ts +12 -7
  7. package/dist/cargo-source-hash.d.ts.map +1 -1
  8. package/dist/cargo-source-hash.js +416 -32
  9. package/dist/cargo-workspace.d.ts +7 -7
  10. package/dist/cargo-workspace.js +8 -8
  11. package/dist/ensure-built.d.ts +6 -0
  12. package/dist/ensure-built.d.ts.map +1 -1
  13. package/dist/ensure-built.js +79 -6
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +69 -96
  16. package/dist/managed-assets.d.ts +6 -0
  17. package/dist/managed-assets.d.ts.map +1 -1
  18. package/dist/manifest-hash.d.ts.map +1 -1
  19. package/dist/manifest-hash.js +6 -2
  20. package/dist/workspace-manifest.d.ts +0 -1
  21. package/dist/workspace-manifest.d.ts.map +1 -1
  22. package/managed/raw/envrc +6 -1
  23. package/managed/raw/tooling/direnv/developer-links.ts +43 -11
  24. package/managed/raw/tooling/direnv/devenv.smoo.nix +1 -0
  25. package/managed/raw/tooling/direnv/inherited-devenv.ts +69 -19
  26. package/managed/raw/tooling/direnv/setup-environment.ts +79 -2
  27. package/nextest.toml +3 -37
  28. package/package.json +2 -2
  29. package/src/__tests__/counted-cargo-process.ts +286 -0
  30. package/src/__tests__/counted-cargo.ts +711 -0
  31. package/src/__tests__/fixture-cargo-home.ts +36 -0
  32. package/src/__tests__/fixture-nx-env.ts +93 -3
  33. package/src/bin/smoo-nx-exec.ts +3 -14
  34. package/src/bounded-test-policy.test.ts +0 -1
  35. package/src/cargo-closure-input.test.ts +313 -15
  36. package/src/cargo-closure-input.ts +42 -50
  37. package/src/cargo-resolve-cache.test.ts +975 -0
  38. package/src/cargo-source-hash.test.ts +17 -3
  39. package/src/cargo-source-hash.ts +447 -37
  40. package/src/cargo-workspace.ts +8 -8
  41. package/src/ensure-built.test.ts +122 -20
  42. package/src/ensure-built.ts +82 -5
  43. package/src/index.test.ts +203 -107
  44. package/src/index.ts +86 -115
  45. package/src/managed-assets.ts +12 -0
  46. package/src/manifest-hash.ts +7 -2
  47. package/src/nextest-partitions.test.ts +150 -0
  48. package/src/nx-cache-bound.test.ts +114 -0
  49. package/src/nx-resident-graph-workers.test.ts +121 -0
  50. package/src/nx-store-resolution.test.ts +98 -0
  51. package/src/task-history-namespace.test.ts +183 -0
  52. package/src/workspace-manifest.ts +0 -1
  53. package/test-timings.json +30 -28
  54. package/src/__tests__/in-process-nx-index.ts +0 -9
@@ -28,6 +28,16 @@
28
28
  * before the install, with a warning, so that install puts the lockfile's
29
29
  * version in its place.
30
30
  *
31
+ * An install that exists to replace links says which: `{ relink }` names the
32
+ * packages (`name` or `@scope/name`) it is meant to relink, in the root's
33
+ * tree and in every member's. When the install resolves, what it left at
34
+ * those names stays (a `bun link` run against providers a developer
35
+ * registered anew) and every other developer link is put back as before.
36
+ * When it rejects, every link is put back, the named ones included, so a
37
+ * failed relink changes nothing. A named package with no developer link when
38
+ * the install starts has nothing to put back, and a named link that dangled
39
+ * is removed first, as for any install.
40
+ *
31
41
  * Like secret-references.ts, this is a managed raw script: shell entry imports
32
42
  * it before anything is installed, and `smoo monorepo update` loads the copy
33
43
  * the nx-plugin ships. Because both use the one implementation, the shell and
@@ -42,9 +52,11 @@ import {
42
52
  readFileSync,
43
53
  readlinkSync,
44
54
  rmSync,
55
+ statSync,
45
56
  symlinkSync,
46
57
  } from 'node:fs';
47
58
  import path from 'node:path';
59
+ import type { KeepDeveloperLinksOptions } from '@smoothbricks/nx-plugin/managed-assets';
48
60
 
49
61
  interface DeveloperLink {
50
62
  /** Where the link is, relative to the project root. */
@@ -60,24 +72,40 @@ interface DeveloperLinks {
60
72
  }
61
73
 
62
74
  /**
63
- * Runs `install` with every developer link under `root` kept. The links in
64
- * place when it starts are exactly the links in place when it settles,
65
- * whether it resolved or rejected, less those that already dangled. It then
66
- * names them as `reportDeveloperLinks` does.
75
+ * Runs `install` while preserving the developer links captured under `root`.
76
+ * On rejection every captured live link is restored, less links that already
77
+ * dangled; a resolved install keeps its selected `relink` replacements.
78
+ * This is not a transaction over new entries created by the install. Relink
79
+ * intent reports the actual final link state on either outcome.
67
80
  */
68
- export async function keepDeveloperLinks<T>(root: string, install: () => Promise<T>): Promise<T> {
81
+ export async function keepDeveloperLinks<T>(
82
+ root: string,
83
+ install: () => Promise<T>,
84
+ options?: KeepDeveloperLinksOptions,
85
+ ): Promise<T> {
69
86
  const { live, dangling } = findDeveloperLinks(root);
70
87
  for (const link of dangling) {
71
88
  rmSync(path.join(root, link.path), { force: true });
72
89
  console.error(`! removed developer link ${link.path}: its target ${resolvedTarget(root, link)} no longer exists`);
73
90
  }
91
+ // Only an install that resolved leaves the links it was meant to replace as
92
+ // it made them; a rejected one puts every captured live link back.
93
+ let replaced: readonly string[] | undefined;
74
94
  try {
75
- return await install();
95
+ const result = await install();
96
+ replaced = options?.relink;
97
+ return result;
76
98
  } finally {
77
99
  for (const link of live) {
78
- restoreLink(root, link);
100
+ if (!replaced?.length || !replaced.includes(packageName(link))) {
101
+ restoreLink(root, link);
102
+ }
103
+ }
104
+ if (options !== undefined) {
105
+ reportDeveloperLinks(root);
106
+ } else {
107
+ describeDeveloperLinks(root, live);
79
108
  }
80
- describeDeveloperLinks(root, live);
81
109
  }
82
110
  }
83
111
 
@@ -93,6 +121,11 @@ export function reportDeveloperLinks(root: string): void {
93
121
  describeDeveloperLinks(root, findDeveloperLinks(root).live);
94
122
  }
95
123
 
124
+ /** The package a link stands for in its tree: `name` or `@scope/name`. */
125
+ function packageName(link: DeveloperLink): string {
126
+ return link.path.slice(link.path.lastIndexOf('node_modules/') + 'node_modules/'.length);
127
+ }
128
+
96
129
  /** A package linked from many members is named once, with its count. */
97
130
  function describeDeveloperLinks(root: string, links: readonly DeveloperLink[]): void {
98
131
  if (links.length === 0) {
@@ -100,8 +133,7 @@ function describeDeveloperLinks(root: string, links: readonly DeveloperLink[]):
100
133
  }
101
134
  const counts = new Map<string, number>();
102
135
  for (const link of links) {
103
- const name = link.path.slice(link.path.lastIndexOf('node_modules/') + 'node_modules/'.length);
104
- const named = `${name} -> ${resolvedTarget(root, link)}`;
136
+ const named = `${packageName(link)} -> ${resolvedTarget(root, link)}`;
105
137
  counts.set(named, (counts.get(named) ?? 0) + 1);
106
138
  }
107
139
  const entries = [...counts].map(([named, count]) => (count === 1 ? named : `${named} (${count} links)`));
@@ -117,7 +149,7 @@ function findDeveloperLinks(root: string): DeveloperLinks {
117
149
  const target = resolvedTarget(root, link);
118
150
  const relative = path.relative(root, target);
119
151
  if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
120
- (existsSync(target) ? live : dangling).push(link);
152
+ (statSync(target, { throwIfNoEntry: false }) === undefined ? dangling : live).push(link);
121
153
  }
122
154
  }
123
155
  }
@@ -420,6 +420,7 @@ in {
420
420
  # workspace"), which reads as a hung Nx in a workspace that did nothing
421
421
  # wrong. Nx's own diagnostic names this exact cause.
422
422
  nx_workspace_root="$(cd "$DEVENV_ROOT/../.." >/dev/null 2>&1 && pwd || printf '%s' "$PWD")"
423
+ export NX_WORKSPACE_ROOT_PATH="$nx_workspace_root"
423
424
  export NX_SOCKET_DIR="$DEVENV_RUNTIME/nx-$(printf '%s' "$nx_workspace_root" | cksum | cut -d' ' -f1)"
424
425
  mkdir -p "$NX_SOCKET_DIR"
425
426
  ${lib.optionalString pkgs.stdenv.isDarwin ''
@@ -22,6 +22,9 @@ import path from 'node:path';
22
22
 
23
23
  const DEVENV_DIR = 'tooling/direnv';
24
24
  const ARTIFACT = 'inherited-shell.json';
25
+ // Every path a cowshed workspace child is handed that an export can embed. Each
26
+ // is the sandbox's own (its private HOME, TMPDIR, XDG roots, direnv config), so
27
+ // a clone relocates the origin's value to its own.
25
28
  const ENV_PATHS = [
26
29
  'HOME',
27
30
  'TMPDIR',
@@ -30,12 +33,21 @@ const ENV_PATHS = [
30
33
  'XDG_CACHE_HOME',
31
34
  'XDG_DATA_HOME',
32
35
  'XDG_STATE_HOME',
33
- 'DEVENV_HOME',
34
36
  'DIRENV_CONFIG',
35
- 'NX_SOCKET_DIR',
36
37
  ] as const;
37
- // Nix receives no caller credential, gateway token, or ambient impure override
38
- // while creating an artifact. A live shell still runs with its exact caller env.
38
+ // The evaluator sees exactly what a cowshed workspace child is handed and the
39
+ // evaluation needs, so an origin evaluated from a host shell and a clone agree:
40
+ // the bootstrap PATH, the private roots, and the live routing the evaluator
41
+ // fetches the lock's inputs with — the proxy endpoint (a cowshed workspace's
42
+ // userinfo is its own gateway token), its exclusions, the CA files, and the one
43
+ // NIX_CONFIG setting that is pure transport (`ssl-cert-file`, which outranks
44
+ // nix.conf). Nix's client cache is `$XDG_CACHE_HOME/nix`, which cowshed shares
45
+ // across workspaces. No login identity, locale, terminal, Xcode selection,
46
+ // other caller credential, gateway token, NIX_CONFIG line (`access-tokens`,
47
+ // `impure-env`, …) or ambient impure override reaches it: a tool the shell
48
+ // needs is the devenv's to declare. Routing belongs to the evaluating checkout
49
+ // only: an export that embeds any proxy value or its userinfo is never
50
+ // published. A live shell still runs with its exact caller env.
39
51
  const EVALUATOR_ENV = [
40
52
  'PATH',
41
53
  'HOME',
@@ -45,23 +57,16 @@ const EVALUATOR_ENV = [
45
57
  'XDG_CACHE_HOME',
46
58
  'XDG_DATA_HOME',
47
59
  'XDG_STATE_HOME',
48
- 'DEVENV_HOME',
49
60
  'DIRENV_CONFIG',
50
- 'NX_SOCKET_DIR',
51
- 'USER',
52
- 'LOGNAME',
53
- 'SHELL',
54
- 'LANG',
55
- 'LC_ALL',
56
- 'LC_CTYPE',
57
- 'TERM',
58
61
  'NIX_SSL_CERT_FILE',
59
62
  'SSL_CERT_FILE',
60
63
  'NODE_EXTRA_CA_CERTS',
61
64
  'GIT_SSL_CAINFO',
62
- 'DEVELOPER_DIR',
63
- 'SDKROOT',
65
+ 'NO_PROXY',
66
+ 'no_proxy',
64
67
  ] as const;
68
+ /** cowshed's proxy endpoint; a value may carry credentials as URL userinfo. */
69
+ const PROXY_ENV = ['HTTP_PROXY', 'HTTPS_PROXY', 'http_proxy', 'https_proxy'] as const;
65
70
 
66
71
  type Watch = { readonly scope: 'root' | 'home' | 'runtime' | 'tmp' | 'store'; readonly relative: string };
67
72
  type Entry = {
@@ -82,15 +87,56 @@ interface Artifact {
82
87
  readonly export: string;
83
88
  }
84
89
 
85
- function privateEnvironment(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
90
+ /** NIX_CONFIG reduced to its last `ssl-cert-file`, read as nix reads it: `#` starts a comment. */
91
+ function nixTransportConfig(config: string | undefined): string | undefined {
92
+ let caFile: string | undefined;
93
+ for (const line of config?.split('\n') ?? []) {
94
+ const setting = /^\s*ssl-cert-file\s*=\s*(.*?)\s*$/.exec(line.split('#', 1)[0] ?? '');
95
+ if (setting) caFile = setting[1];
96
+ }
97
+ return caFile === undefined ? undefined : `ssl-cert-file = ${caFile}`;
98
+ }
99
+
100
+ export function privateEnvironment(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
86
101
  const selected: NodeJS.ProcessEnv = {};
87
- for (const name of EVALUATOR_ENV) {
102
+ for (const name of [...EVALUATOR_ENV, ...PROXY_ENV]) {
88
103
  const value = env[name];
89
104
  if (value !== undefined) selected[name] = value;
90
105
  }
106
+ const transport = nixTransportConfig(env.NIX_CONFIG);
107
+ if (transport !== undefined) selected.NIX_CONFIG = transport;
91
108
  return selected;
92
109
  }
93
110
 
111
+ function percentDecoded(text: string): string {
112
+ try {
113
+ return decodeURIComponent(text);
114
+ } catch {
115
+ return text;
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Whether `text` holds a proxy value of `env`, or the credential in its userinfo. A
121
+ * userinfo with a password is matched whole or by the password, never by the
122
+ * username alone: cowshed's username is the fixed label `cowshed`.
123
+ */
124
+ export function embedsRouting(text: string, env: NodeJS.ProcessEnv): boolean {
125
+ const secrets: string[] = [];
126
+ for (const name of PROXY_ENV) {
127
+ const value = env[name];
128
+ if (!value) continue;
129
+ secrets.push(value);
130
+ const url = URL.parse(value);
131
+ if (url?.password) {
132
+ secrets.push(`${url.username}:${url.password}`, url.password, percentDecoded(url.password));
133
+ } else if (url?.username) {
134
+ secrets.push(url.username, percentDecoded(url.username));
135
+ }
136
+ }
137
+ return secrets.some((secret) => text.includes(secret));
138
+ }
139
+
94
140
  function toolchain(env: NodeJS.ProcessEnv): string | undefined {
95
141
  const versions: string[] = [];
96
142
  for (const command of [
@@ -527,7 +573,8 @@ export function exportShell(rootPath: string, args: readonly string[], env: Node
527
573
  }
528
574
  try {
529
575
  const before = sourceBasis(root);
530
- const options = args.slice(0, -1);
576
+ // Shared fetcher bytes are useful; a sibling-writable Nix eval cache must not supply shell code.
577
+ const options = [...args.slice(0, -1), '--nix-option', 'eval-cache', 'false'];
531
578
  const disabled = [...options, '--option', 'enterShell:string', ''];
532
579
  const evaluate = (argv: readonly string[]) =>
533
580
  Bun.spawnSync(['devenv', ...argv], {
@@ -594,8 +641,11 @@ export function exportShell(rootPath: string, args: readonly string[], env: Node
594
641
  toolchain: version,
595
642
  export: exported,
596
643
  };
644
+ const serialized = `${JSON.stringify(artifact)}\n`;
645
+ if (embedsRouting(exported, safe) || embedsRouting(serialized, safe))
646
+ throw new Error("the evaluated shell embeds this checkout's proxy routing, which no clone may inherit");
597
647
  const staged = `${file}.${randomUUID()}`;
598
- writeFileSync(staged, `${JSON.stringify(artifact)}\n`, { mode: 0o600, flag: 'wx' });
648
+ writeFileSync(staged, serialized, { mode: 0o600, flag: 'wx' });
599
649
  renameSync(staged, file);
600
650
  process.stdout.write(exported);
601
651
  return 0;
@@ -16,6 +16,7 @@ import {
16
16
  writeFileSync,
17
17
  } from 'node:fs';
18
18
  import { createRequire } from 'node:module';
19
+ import { homedir } from 'node:os';
19
20
  import path from 'node:path';
20
21
  import { parseArgs } from 'node:util';
21
22
  import { $ } from 'bun';
@@ -127,6 +128,10 @@ const POST_COMMIT_BLOCK = [
127
128
  // Declared above the bootstrap block for the same hoisting reason as above.
128
129
  const { values: flags } = parseArgs({ options: { python: { type: 'string' } } });
129
130
 
131
+ // The Nx plugin's test for a Cargo workspace root manifest (CARGO_WORKSPACE_PATTERN), which
132
+ // cargoFetchInputs applies during the bootstrap block; declared above it for the same reason.
133
+ const CARGO_WORKSPACE = /^\s*\[workspace\]/m;
134
+
130
135
  // Go to project root
131
136
  process.chdir(projectRoot);
132
137
 
@@ -136,7 +141,9 @@ try {
136
141
  // and package resolution/Typia transforms are not available yet.
137
142
  const bunInputs = bunInstallInputs();
138
143
  const uvInputs = uvSyncInputs();
139
- recordInstallInputs([...bunInputs, ...uvInputs]);
144
+ const cargo = cargoFetchInputs(bunInputs);
145
+ recordInstallInputs([...bunInputs, ...uvInputs, ...cargo.inputs]);
146
+ const cargoFetches = cargo.workspaces.map(cargoFetcher);
140
147
  // A CI runner is GitHub Actions or Forgejo Actions, which mirrors every FORGEJO_*
141
148
  // variable as GITHUB_*. Not `CI`: agent harnesses set CI=true on every command
142
149
  // they run, and this branch installs unconditionally.
@@ -184,6 +191,9 @@ try {
184
191
  if (uv !== null) {
185
192
  await uv.install({ quiet: false });
186
193
  }
194
+ for (const fetch of cargoFetches) {
195
+ await fetch.install({ quiet: false });
196
+ }
187
197
  });
188
198
  } else {
189
199
  // A local secret-resolution or install failure (a provider that is not
@@ -196,7 +206,9 @@ try {
196
206
  const uv = uvInstaller(uvInputs, { locked: false });
197
207
  const bun = bunInstaller(bunInputs);
198
208
  const installError = await withInstallLock(async () => {
199
- const pending = (uv === null ? [bun] : [bun, uv]).filter((installer) => !installer.isCurrent());
209
+ const pending = [bun, ...(uv === null ? [] : [uv]), ...cargoFetches].filter(
210
+ (installer) => !installer.isCurrent(),
211
+ );
200
212
  const error = await installLocalDependencies(pending);
201
213
  if (!pending.includes(bun)) {
202
214
  reportDeveloperLinks(projectRoot);
@@ -433,6 +445,41 @@ function uvInstaller(inputs: readonly string[], options: { locked: boolean }): I
433
445
  };
434
446
  }
435
447
 
448
+ /**
449
+ * `cargo fetch --locked` for one Cargo workspace. The Nx plugin infers every
450
+ * project's Cargo closure from locked, offline `cargo metadata`, which Cargo
451
+ * can answer only when the packages Cargo.lock pins are already in
452
+ * CARGO_HOME; without them the project graph refuses, and the graph's own
453
+ * `cargo-fetch` target can never run. This establishes that precondition the
454
+ * way `bun install` establishes node_modules.
455
+ *
456
+ * What it installs lives in CARGO_HOME, so the stamp lives there too, named
457
+ * by the digest of the workspace's Cargo.lock, manifest and Cargo
458
+ * configuration: replacing CARGO_HOME takes the stamps with it, and a
459
+ * copy-on-write clone of this checkout sharing that CARGO_HOME enters
460
+ * fetched. `--locked` makes a stale Cargo.lock fail here, in Cargo's words,
461
+ * rather than fetch a graph the lockfile does not name.
462
+ */
463
+ function cargoFetcher(workspace: string): Installer {
464
+ const manifest = path.posix.join(workspace, 'Cargo.toml');
465
+ const cargo = Bun.which('cargo');
466
+ const identity = ['cargo fetch --locked', cargo === null ? 'cargo not on PATH' : realpathSync(cargo)];
467
+ const digest = inputsDigest(identity, cargoWorkspaceInputs(workspace));
468
+ const cargoHome = path.resolve(process.env.CARGO_HOME ?? path.join(homedir(), '.cargo'));
469
+ const stampPath = path.join(cargoHome, 'smoo-fetched', digest);
470
+ return {
471
+ isCurrent: () => readInstallStamp(stampPath)?.inputs === digest,
472
+ install: async ({ quiet }) => {
473
+ await runSetupCommand(
474
+ `cargo fetch --locked --manifest-path ${manifest}`,
475
+ $`cargo fetch --locked --manifest-path ${manifest}`,
476
+ { quiet },
477
+ );
478
+ writeInstallStamp(stampPath, { inputs: digest });
479
+ },
480
+ };
481
+ }
482
+
436
483
  /**
437
484
  * Rewrite every `.pth` line in the environment's site-packages that names a
438
485
  * directory inside this checkout as a path relative to that site-packages,
@@ -502,6 +549,36 @@ function uvSyncInputs(): string[] {
502
549
  return [...new Set(['pyproject.toml', 'uv.lock', ...workspaceFiles(patterns, 'pyproject.toml')])].sort();
503
550
  }
504
551
 
552
+ /**
553
+ * The Cargo workspaces the Nx plugin resolves — a project directory (the root
554
+ * or a workspace member, found by its package.json) whose Cargo.toml declares
555
+ * `[workspace]` — and what their fetch reads. Every project directory's
556
+ * Cargo.toml is an input whether or not it exists, so adding a Cargo
557
+ * workspace is itself a change.
558
+ */
559
+ function cargoFetchInputs(bunInputs: readonly string[]): { workspaces: string[]; inputs: string[] } {
560
+ const workspaces: string[] = [];
561
+ const inputs: string[] = [];
562
+ for (const projectManifest of bunInputs.filter((input) => path.posix.basename(input) === 'package.json')) {
563
+ const directory = path.posix.dirname(projectManifest);
564
+ const manifest = path.posix.join(directory, 'Cargo.toml');
565
+ inputs.push(manifest);
566
+ const content = readFileIfPresent(path.join(projectRoot, manifest));
567
+ if (content !== null && CARGO_WORKSPACE.test(content.toString('utf8'))) {
568
+ workspaces.push(directory);
569
+ inputs.push(...cargoWorkspaceInputs(directory));
570
+ }
571
+ }
572
+ return { workspaces: workspaces.sort(), inputs: [...new Set(inputs)].sort() };
573
+ }
574
+
575
+ /** What `cargo fetch --locked` reads for the workspace at `directory`, relative to the project root. */
576
+ function cargoWorkspaceInputs(directory: string): string[] {
577
+ return ['Cargo.toml', 'Cargo.lock', '.cargo/config', '.cargo/config.toml'].map((file) =>
578
+ path.posix.join(directory, file),
579
+ );
580
+ }
581
+
505
582
  /**
506
583
  * A manifest that does not parse contributes no members, never a failure
507
584
  * here: its bytes are still an input, so the installer runs and reports the
package/nextest.toml CHANGED
@@ -9,40 +9,12 @@ slow-timeout = { period = "30s", terminate-after = 1 }
9
9
  # at test time. Filterset matches the class by test name rather than listing
10
10
  # today's two tests (`compile_fail_cases`, `lesser_capabilities_fail_to_compile_*`).
11
11
  #
12
- # 180s is provisional: measure on an idle machine with `--test-threads=1`.
12
+ # 180s is provisional: measure the test alone on an idle machine.
13
13
  # An unbounded run phase is how a hung test becomes a hung lane.
14
14
  [[profile.default.overrides]]
15
15
  filter = 'test(/compile_fail|fail_to_compile/)'
16
16
  slow-timeout = { period = "180s", terminate-after = 1 }
17
17
 
18
- # Tests that drive the host's REAL APFS stack — creating, attaching, mounting and
19
- # detaching actual disk images — contend on a single machine-wide serialization
20
- # point: Disk Arbitration and the APFS driver. Measured on this host, a read-only
21
- # `diskutil apfs list -plist` costs 0.7s idle at 33 attached images but up to
22
- # 14.4s while another process is attaching/detaching. Run in parallel these tests
23
- # manufacture exactly that contention for each other, so each one's wall time
24
- # becomes a function of how many siblings happen to be mid-attach — a test whose
25
- # verdict depends on that is measuring the scheduler, not the code.
26
- #
27
- # `max-threads = 1` makes the group a mutex across the WHOLE run (groups are
28
- # run-wide, not per-binary, so the lib unit tests and the apfs_integration binary
29
- # serialize against each other as intended). The other ~830 tests stay parallel.
30
- #
31
- # This bounds contention; it does NOT grant more time. The per-test deadline above
32
- # is unchanged and each of these tests is expected to fit it on its own merits.
33
- # Membership is by name: `real_apfs_*` is the class marker, so a new real-APFS
34
- # test joins the group by being named for what it touches. A bare `real_*` filter
35
- # would be wrong here — unrelated `real_*` tests exist in columine-arrow,
36
- # cowshed-cli and cowshed-gateway that touch no disk image at all.
37
- #
38
- # The `@tool:smoo:` prefix is not decoration: this file is passed as
39
- # `--tool-config-file smoo:...` so a repository's own `.config/nextest.toml`
40
- # can override it, and nextest REFUSES a tool config whose groups are not
41
- # namespaced ("test groups must start with '@tool:<tool-name>:'") precisely so
42
- # a tool cannot collide with a repository's group of the same name.
43
- [test-groups]
44
- "@tool:smoo:real-apfs" = { max-threads = 1 }
45
-
46
18
  # The full-lifecycle real-APFS tests cannot meet the default deadline, and
47
19
  # `specs/cowshed/08_testing.md` already contains the arithmetic that proves it.
48
20
  #
@@ -71,15 +43,9 @@ slow-timeout = { period = "180s", terminate-after = 1 }
71
43
  # bounded because an unbounded run phase is how a hung test becomes a hung lane.
72
44
  # Re-derive it if the idle measurements in `apfs_integration.rs` change.
73
45
  #
74
- # Membership is by name and narrower than the group: the fast `real_apfs_*` unit
46
+ # Membership is by name and narrower than the class: the fast `real_apfs_*` unit
75
47
  # tests in the lib keep the 30s default — they passed at 4.4s and 7.3s and have no
76
- # claim on more. This override precedes the group-only one so it wins the
77
- # first-match for both keys it sets.
48
+ # claim on more.
78
49
  [[profile.default.overrides]]
79
50
  filter = 'test(/real_apfs_.*_substrate_lifecycle/)'
80
51
  slow-timeout = { period = "60s", terminate-after = 1 }
81
- test-group = '@tool:smoo:real-apfs'
82
-
83
- [[profile.default.overrides]]
84
- filter = 'test(/real_apfs_/)'
85
- test-group = '@tool:smoo:real-apfs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smoothbricks/nx-plugin",
3
- "version": "0.4.25",
3
+ "version": "0.4.26",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "./loader.js",
@@ -234,7 +234,7 @@
234
234
  "yaml": "^2.9.0"
235
235
  },
236
236
  "devDependencies": {
237
- "@smoothbricks/lmao": "0.5.2",
237
+ "@smoothbricks/lmao": "0.5.4",
238
238
  "@smoothbricks/validation": "0.1.10",
239
239
  "fast-check": "^4.4.0"
240
240
  }