@diffci.com/diffci 0.3.29 → 0.3.31

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 (111) hide show
  1. package/dist-client/src/client/cli.js +78 -5
  2. package/dist-client/src/client/command-batches.d.ts +22 -0
  3. package/dist-client/src/client/command-batches.js +82 -9
  4. package/dist-client/src/client/coverage-map.d.ts +46 -0
  5. package/dist-client/src/client/coverage-map.js +213 -0
  6. package/dist-client/src/client/failure-baseline.js +0 -0
  7. package/dist-client/src/client/observe.js +3 -0
  8. package/dist-client/src/client/outcome-log.d.ts +40 -0
  9. package/dist-client/src/client/outcome-log.js +38 -1
  10. package/dist-client/src/client/report.d.ts +3 -0
  11. package/dist-client/src/client/selected-coverage.d.ts +3 -0
  12. package/dist-client/src/client/selected-coverage.js +35 -5
  13. package/dist-client/src/client/test-ranking.d.ts +39 -0
  14. package/dist-client/src/client/test-ranking.js +127 -0
  15. package/dist-client/src/client/test-results.d.ts +27 -0
  16. package/dist-client/src/client/test-results.js +54 -0
  17. package/dist-client/src/client/test-shards.d.ts +36 -0
  18. package/dist-client/src/client/test-shards.js +68 -0
  19. package/dist-client/src/client/verify-savings.d.ts +6 -0
  20. package/dist-client/src/client/verify-savings.js +4 -0
  21. package/dist-client/src/client/verify.d.ts +36 -1
  22. package/dist-client/src/client/verify.js +171 -13
  23. package/node_modules/@babel/helper-string-parser/lib/index.js +5 -5
  24. package/node_modules/@babel/helper-string-parser/lib/index.js.map +1 -1
  25. package/node_modules/@babel/helper-string-parser/package.json +1 -1
  26. package/node_modules/@babel/parser/lib/index.js +6306 -6143
  27. package/node_modules/@babel/parser/lib/index.js.map +1 -1
  28. package/node_modules/@babel/parser/package.json +3 -3
  29. package/node_modules/@babel/types/lib/definitions/typescript.js +2 -1
  30. package/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -1
  31. package/node_modules/@babel/types/package.json +3 -3
  32. package/node_modules/@diffci.com/core/dist/cache/graph-cache.d.ts +1 -1
  33. package/node_modules/@diffci.com/core/dist/cache/graph-cache.js +2 -1
  34. package/node_modules/@diffci.com/core/dist/cache/graph-cache.js.map +1 -1
  35. package/node_modules/@diffci.com/core/dist/git/git-diff.js +59 -0
  36. package/node_modules/@diffci.com/core/dist/git/git-diff.js.map +1 -1
  37. package/node_modules/@diffci.com/core/dist/git/types.d.ts +4 -0
  38. package/node_modules/@diffci.com/core/dist/planner/test-command.d.ts +11 -0
  39. package/node_modules/@diffci.com/core/dist/planner/test-command.js +65 -9
  40. package/node_modules/@diffci.com/core/dist/planner/test-command.js.map +1 -1
  41. package/node_modules/@diffci.com/core/dist/repo/file-references.d.ts +10 -1
  42. package/node_modules/@diffci.com/core/dist/repo/file-references.js +96 -18
  43. package/node_modules/@diffci.com/core/dist/repo/file-references.js.map +1 -1
  44. package/node_modules/@diffci.com/core/dist/repo/impact-types.d.ts +4 -1
  45. package/node_modules/@diffci.com/core/dist/repo/impact.d.ts +20 -0
  46. package/node_modules/@diffci.com/core/dist/repo/impact.js +147 -25
  47. package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
  48. package/node_modules/@diffci.com/core/dist/repo/repo-config.d.ts +11 -0
  49. package/node_modules/@diffci.com/core/dist/repo/repo-config.js +11 -1
  50. package/node_modules/@diffci.com/core/dist/repo/repo-config.js.map +1 -1
  51. package/node_modules/@diffci.com/core/dist/repo/route-visits.d.ts +34 -0
  52. package/node_modules/@diffci.com/core/dist/repo/route-visits.js +93 -0
  53. package/node_modules/@diffci.com/core/dist/repo/route-visits.js.map +1 -0
  54. package/node_modules/@diffci.com/core/dist/repo/test-fixture-ownership.d.ts +1 -1
  55. package/node_modules/@diffci.com/core/dist/repo/test-fixture-ownership.js +48 -5
  56. package/node_modules/@diffci.com/core/dist/repo/test-fixture-ownership.js.map +1 -1
  57. package/node_modules/@diffci.com/core/package.json +3 -3
  58. package/node_modules/@diffci.com/core/src/cache/graph-cache.ts +2 -1
  59. package/node_modules/@diffci.com/core/src/git/git-diff.ts +48 -0
  60. package/node_modules/@diffci.com/core/src/git/types.ts +4 -0
  61. package/node_modules/@diffci.com/core/src/planner/test-command.ts +54 -9
  62. package/node_modules/@diffci.com/core/src/repo/file-references.ts +92 -20
  63. package/node_modules/@diffci.com/core/src/repo/impact-types.ts +5 -0
  64. package/node_modules/@diffci.com/core/src/repo/impact.ts +134 -25
  65. package/node_modules/@diffci.com/core/src/repo/repo-config.ts +23 -1
  66. package/node_modules/@diffci.com/core/src/repo/route-visits.ts +88 -0
  67. package/node_modules/@diffci.com/core/src/repo/test-fixture-ownership.ts +39 -5
  68. package/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js +4 -3
  69. package/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +4 -3
  70. package/node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js +4 -3
  71. package/node_modules/@vue/compiler-core/package.json +4 -4
  72. package/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js +9 -6
  73. package/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +41 -4
  74. package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +10 -7
  75. package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +12 -11
  76. package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +5 -3
  77. package/node_modules/@vue/compiler-dom/dist/compiler-dom.global.js +10 -7
  78. package/node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js +12 -11
  79. package/node_modules/@vue/compiler-dom/package.json +3 -3
  80. package/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +155 -20
  81. package/node_modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +431 -98
  82. package/node_modules/@vue/compiler-sfc/package.json +10 -10
  83. package/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1 -1
  84. package/node_modules/@vue/compiler-ssr/package.json +3 -3
  85. package/node_modules/@vue/shared/dist/shared.cjs.js +51 -32
  86. package/node_modules/@vue/shared/dist/shared.cjs.prod.js +51 -32
  87. package/node_modules/@vue/shared/dist/shared.d.ts +2 -1
  88. package/node_modules/@vue/shared/dist/shared.esm-bundler.js +51 -32
  89. package/node_modules/@vue/shared/package.json +1 -1
  90. package/node_modules/nanoid/async/index.d.cts +56 -0
  91. package/node_modules/nanoid/index.cjs +12 -7
  92. package/node_modules/nanoid/index.js +1 -1
  93. package/node_modules/nanoid/package.json +3 -3
  94. package/node_modules/postcss/lib/input.js +1 -1
  95. package/node_modules/postcss/lib/lazy-result.js +1 -1
  96. package/node_modules/postcss/lib/list.js +19 -1
  97. package/node_modules/postcss/lib/map-generator.js +9 -3
  98. package/node_modules/postcss/lib/no-work-result.js +1 -1
  99. package/node_modules/postcss/lib/node.js +2 -2
  100. package/node_modules/postcss/lib/parser.js +6 -1
  101. package/node_modules/postcss/lib/processor.js +1 -1
  102. package/node_modules/postcss/lib/stringifier.js +16 -28
  103. package/node_modules/postcss/lib/stringify.js +84 -2
  104. package/node_modules/postcss/lib/warning.js +1 -0
  105. package/node_modules/postcss/package.json +3 -3
  106. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +19 -18
  107. package/node_modules/yaml/browser/dist/nodes/Alias.js +25 -23
  108. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +19 -18
  109. package/node_modules/yaml/dist/nodes/Alias.js +25 -23
  110. package/node_modules/yaml/package.json +1 -1
  111. package/package.json +2 -2
@@ -45,12 +45,12 @@
45
45
  "prepare": "npm run build"
46
46
  },
47
47
  "dependencies": {
48
- "@vue/compiler-sfc": "3.5.42",
48
+ "@vue/compiler-sfc": "3.5.44",
49
49
  "typescript": "^5.8.3",
50
50
  "yaml": "^2.9.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@types/node": "^22.15.12",
54
- "tsx": "^4.23.0"
53
+ "@types/node": "^22.20.5",
54
+ "tsx": "^4.23.15"
55
55
  }
56
56
  }
@@ -6,7 +6,8 @@ import type { DependencyGraphResult } from "../repo/types.js";
6
6
 
7
7
  // 4: bounded computed loads have edges, and results carry runtimeTestSelection (2026-11-03).
8
8
  // 5: inline type-only imports are type edges and vi.mock/jest.mock targets are edges (2026-11-04).
9
- export const GRAPH_CACHE_SCHEMA_VERSION = "5";
9
+ // 6: the profile's diffciConfig carries declared `inputs` (2026-11-05).
10
+ export const GRAPH_CACHE_SCHEMA_VERSION = "6";
10
11
 
11
12
  export interface GraphCacheKeyInputs {
12
13
  commitSha: string;
@@ -333,6 +333,7 @@ export function testListEdit(oldBody: string, newBody: string): { added: string[
333
333
  }
334
334
 
335
335
  const DEPENDENCY_FIELDS = new Set(["dependencies", "devDependencies", "optionalDependencies"]);
336
+ const PACKAGE_LOCKFILES = ["package-lock.json", "npm-shrinkwrap.json", "yarn.lock", "pnpm-lock.yaml", "bun.lock", "bun.lockb"];
336
337
 
337
338
  /** Exact root requests for the supported Classic layout. Unlike scriptRecord, never discard an
338
339
  * invalid dependency value: an omitted root would make the lockfile attribution incomplete. */
@@ -763,6 +764,53 @@ export async function analyzeGitDelta(
763
764
  }
764
765
  }
765
766
  }
767
+ // 2026-11-05: without a committed lockfile every install resolves each request afresh, so an edit
768
+ // limited to dependency requests reaches only the packages whose request changed and what they
769
+ // install; importers of those packages are selected like a lockfile-attributed change. LobeHub ignores
770
+ // pnpm-lock.yaml, and each of its workspace dependency bumps ran the full suite. A lockfile that governs
771
+ // any changed manifest, a local (`workspace:`, `link:`, `file:`) request, a scripts edit, any other
772
+ // behavioral field, or a package-manager configuration change keeps the global signal.
773
+ const manifests = filesWithBinary.filter((f) => f.changeType === "modified" && posix.basename(f.path) === "package.json" && !f.path.split("/").includes("node_modules"));
774
+ const managerConfiguration = allPaths.some((path) => posix.basename(path) !== "package.json"
775
+ && (LOCKFILE.test(posix.basename(path)) || /^(?:\.npmrc|\.yarnrc(?:\.yml)?|pnpm-workspace\.yaml|\.pnpmfile\.cjs|bunfig\.toml)$/.test(posix.basename(path))));
776
+ if (manifests.length > 0 && !manifests.some((f) => narrowed.has(f)) && !analysis.lockfileChanged && !managerConfiguration) {
777
+ const lockfileGoverns = (path: string) => {
778
+ for (let dir = posix.dirname(path); ; dir = posix.dirname(dir)) {
779
+ const prefix = dir === "." ? "" : `${dir}/`;
780
+ if (PACKAGE_LOCKFILES.some((name) => [baseSha, headSha].some((sha) => readFileAtSha(sha, prefix + name, repoPath) !== undefined))) return true;
781
+ if (dir === ".") return false;
782
+ }
783
+ };
784
+ const edits = manifests.map((file) => {
785
+ const before = readFileAtSha(baseSha, file.path, repoPath);
786
+ const after = readFileAtSha(headSha, file.path, repoPath);
787
+ const change = packageJsonChange(before, after);
788
+ const localChanged = change.changedDependencies.some((name) => [before, after].some((content) => {
789
+ try {
790
+ const json = JSON.parse(content ?? "") as Record<string, unknown>;
791
+ return [...DEPENDENCY_FIELDS].some((field) => /^(?:workspace|link|file|portal):/.test(scriptRecord(json[field])?.[name] ?? ""));
792
+ } catch { return true; }
793
+ }));
794
+ const eligible = change.kind !== "behavioral" && !localChanged
795
+ && JSON.stringify(parsePackageScripts(before)) === JSON.stringify(parsePackageScripts(after));
796
+ return { file, change, eligible };
797
+ });
798
+ if (edits.some((edit) => edit.change.kind === "dependencies") && edits.every((edit) => edit.eligible) && !manifests.some((f) => lockfileGoverns(f.path))) {
799
+ const names = new Set(analysis.changedDependencies ?? []);
800
+ const specifiersOnly: string[] = [];
801
+ for (const { file, change } of edits) {
802
+ for (const name of change.changedDependencies) names.add(name);
803
+ narrowed.add(file);
804
+ if (change.kind !== "metadata" && !referenceResolvedPaths.includes(file.path)) referenceResolvedPaths.push(file.path);
805
+ if (change.kind === "dependencies" && change.specifiersOnly) specifiersOnly.push(file.path);
806
+ if (file.path === "package.json" && change.testScriptAddedPaths.length > 0) analysis.testScriptAddedPaths = change.testScriptAddedPaths;
807
+ }
808
+ analysis.dependencyManifestChanged = false;
809
+ analysis.changedDependencies = [...names].sort();
810
+ if (specifiersOnly.includes("package.json")) analysis.packageJsonSpecifiersOnly = true;
811
+ if (specifiersOnly.length > 0) analysis.specifiersOnlyManifests = specifiersOnly.sort();
812
+ }
813
+ }
766
814
  // 2026-11-03: a workspace package's package.json used to be an unknown file and a full run. One whose
767
815
  // edit is limited to metadata and data fields (a release bumping `version`) cannot change how tests
768
816
  // run, so its readers are resolved like the root's. A script edit stays unknown: the root's test
@@ -58,6 +58,10 @@ export interface GitDeltaAnalysis {
58
58
  * accounts for (2026-11-02). Its dependency effect is in changedDependencies, so ImpactAnalyzer
59
59
  * accepts no readers of the file itself. */
60
60
  packageJsonSpecifiersOnly?: boolean;
61
+ /** Every package.json, root or workspace, whose edit only changed dependency requests that
62
+ * changedDependencies accounts for (2026-11-05, lockfile-free repositories). Like
63
+ * packageJsonSpecifiersOnly, ImpactAnalyzer accepts no readers of these files. */
64
+ specifiersOnlyManifests?: string[];
61
65
  /** The changed paths behind each flag above, so a fallback reason can name its files (2026-10-21:
62
66
  * "Configuration file(s) changed" was the most frequent reason in both telemetry cohorts and never
63
67
  * said which file). Absent on analyses produced before this field existed. */
@@ -241,6 +241,35 @@ function runsOnlyDefaultVitest(scripts: Readonly<Record<string, string>>, name =
241
241
  });
242
242
  }
243
243
 
244
+ /**
245
+ * A workspace package's test script as one Vitest invocation DiffCI can repeat with selected files
246
+ * (2026-11-05): `vitest`, `vitest run` or `vitest --run`, optionally through `bunx`, `npx`, `pnpm exec`,
247
+ * `pnpm`/`yarn`, with `--typecheck`, one `--config`/`-c` file, and flags that only change output
248
+ * (LobeHub's `bunx vitest run --config vitest.config.mts --silent='passed-only'`). Anything else is
249
+ * undefined, `--coverage` included: its thresholds can fail a run that the selection would not repeat.
250
+ */
251
+ export function workspaceVitestScript(script: string | undefined): { config?: string; typecheck: boolean } | undefined {
252
+ const words = (script ?? "").trim().split(/\s+/).filter(Boolean);
253
+ if (words[0] === "bunx" || words[0] === "npx") words.shift();
254
+ else if (words[0] === "pnpm" && words[1] === "exec") words.splice(0, 2);
255
+ else if ((words[0] === "pnpm" || words[0] === "yarn") && words[1] === "vitest") words.shift();
256
+ if (words.shift() !== "vitest") return undefined;
257
+ if (words[0] === "run" || words[0] === "--run") words.shift();
258
+ let config: string | undefined;
259
+ let typecheck = false;
260
+ for (let index = 0; index < words.length; index++) {
261
+ const word = words[index]!;
262
+ const inline = /^--config=(.+)$/.exec(word)?.[1];
263
+ if (word === "--typecheck") typecheck = true;
264
+ else if (word === "--run") continue;
265
+ else if (config === undefined && inline) config = inline;
266
+ else if (config === undefined && (word === "--config" || word === "-c") && words[index + 1]) config = words[++index];
267
+ else if (!/^--(?:silent|reporter|passWithNoTests)(?:=\S+)?$/.test(word)) return undefined;
268
+ }
269
+ const file = config?.replace(/^["']|["']$/g, "").replace(/^\.\//, "");
270
+ return { ...(file ? { config: file } : {}), typecheck };
271
+ }
272
+
244
273
  /**
245
274
  * Routes each selected test to the runner configuration that claims it, then emits one command per
246
275
  * group. A repository with `vitest.config.ts` and `vitest.e2e.config.ts` gets two commands, because
@@ -257,12 +286,15 @@ export function planSelectiveTestCommands(
257
286
  const suites = profile.workspaceTestPackages;
258
287
  const refuse = (reason: string): SelectiveTestCommandPlan => ({ commands: [], groups: [], unroutedPaths: [...selectedPaths], refusalReason: reason });
259
288
  if (!["pnpm", "npm"].includes(profile.packageManager) || suites.some(s => suites.some(other => other !== s && s.packageRoot.startsWith(`${other.packageRoot}/`)))) return refuse("Workspace routing requires non-overlapping declared npm or pnpm packages");
260
- const owned = (path: string) => suites.some(s => path.startsWith(`${s.packageRoot}/`) && s.profile.testFilePaths.includes(path.slice(s.packageRoot.length + 1)));
289
+ // A package without a `test` script runs nothing itself; its tests run where the root suite claims them
290
+ // (2026-11-05: LobeHub's apps/server tests run in the root's `server` Vitest project).
291
+ const scripted = suites.filter(s => s.profile.packageJson.scripts.test?.trim());
292
+ const owned = (path: string) => scripted.some(s => path.startsWith(`${s.packageRoot}/`) && s.profile.testFilePaths.includes(path.slice(s.packageRoot.length + 1)));
261
293
  // Tests no workspace package owns belong to the root package's own suite, planned as a
262
294
  // single-package repository would be (2026-11-04: LobeHub keeps its app and server tests at the
263
295
  // root beside `packages/*`, and every selection was refused).
264
296
  const rootPaths = selectedPaths.filter(path => !owned(path));
265
- if (rootPaths.some(path => suites.some(s => path.startsWith(`${s.packageRoot}/`)))) return refuse("A selected test has no verified workspace owner");
297
+ if (rootPaths.some(path => scripted.some(s => path.startsWith(`${s.packageRoot}/`)))) return refuse("A selected test has no verified workspace owner");
266
298
  const rootScript = profile.packageJson.scripts.test ?? "";
267
299
  const runsWorkspaceScripts = !rootScript.trim() || /(?:^|\s)(?:-r|--recursive|--filter|-F|--workspaces?|-ws)(?:[\s=]|$)|\b(?:turbo|nx|lerna)\b/.test(rootScript);
268
300
  const groups: SelectiveTestCommandGroup[] = [];
@@ -273,11 +305,12 @@ export function planSelectiveTestCommands(
273
305
  groups.push(...root.groups);
274
306
  outsideSuitePaths = root.outsideSuitePaths;
275
307
  }
276
- for (const suite of suites) {
277
- const child = suite.profile;
308
+ for (const suite of scripted) {
309
+ let child = suite.profile;
278
310
  const script = child.packageJson.scripts.test?.trim();
279
- const paths = selectedPaths.filter(path => path.startsWith(`${suite.packageRoot}/`)).map(path => path.slice(suite.packageRoot.length + 1));
280
- if (!/^vitest(?: run)?(?: --typecheck)?$/.test(script ?? "") || child.packageJson.scripts.pretest || child.packageJson.scripts.posttest || child.testUniverse?.blindSpot || child.testUniverse?.declaredFrameworks.length !== 1 || child.testUniverse.declaredFrameworks[0] !== "vitest" || child.workspaceTestPackages?.length) {
311
+ const vitest = workspaceVitestScript(script);
312
+ let paths = selectedPaths.filter(path => path.startsWith(`${suite.packageRoot}/`)).map(path => path.slice(suite.packageRoot.length + 1));
313
+ if (!vitest || child.packageJson.scripts.pretest || child.packageJson.scripts.posttest || child.testUniverse?.blindSpot || child.testUniverse?.declaredFrameworks.length !== 1 || child.testUniverse.declaredFrameworks[0] !== "vitest" || child.workspaceTestPackages?.length) {
281
314
  // A package with no selected test has nothing to narrow when the root test script never runs
282
315
  // workspace scripts, so their extra phases are not part of full validation either, unless it
283
316
  // runs type tests, which the graph does not track (2026-11-04: LobeHub's root runs only its own
@@ -285,6 +318,18 @@ export function planSelectiveTestCommands(
285
318
  if (!paths.length && !runsWorkspaceScripts && !/--typecheck\b/.test(script ?? "")) continue;
286
319
  return refuse("Workspace test scripts require a single declared Vitest phase without lifecycle hooks or discovery blind spots");
287
320
  }
321
+ if (vitest.config) {
322
+ // The script runs one named configuration: plan with only that one, and report files it does not
323
+ // include as outside the suite (apps/cli's vitest.e2e.config.mts tests run under `test:e2e`).
324
+ const named = child.testRunnerConfigs?.find(config => config.file === vitest.config);
325
+ if (!named || (named.includes.length === 0 && !named.isDefault)) return refuse("A workspace test script names a Vitest configuration DiffCI did not discover");
326
+ child = { ...child, testRunnerConfigs: [named] };
327
+ if (named.includes.length) {
328
+ const outside = paths.filter(path => !configAllowsPath(named, path) || !named.includes.some(glob => matchesGlob(path, glob)));
329
+ if (outside.length) outsideSuitePaths = [...(outsideSuitePaths ?? []), ...outside.map(path => `${suite.packageRoot}/${path}`)];
330
+ paths = paths.filter(path => !outside.includes(path));
331
+ }
332
+ }
288
333
  const wrap = (args: string[]): CommandSpec => profile.packageManager === "npm"
289
334
  ? { executable: "npm", args: ["exec", "--offline", `--workspace=${suite.packageRoot}`, "--", "vitest", ...args] }
290
335
  : { executable: "pnpm", args: ["--dir", suite.packageRoot, "exec", "vitest", ...args] };
@@ -301,8 +346,8 @@ export function planSelectiveTestCommands(
301
346
  if (child.testRunnerConfigs?.some(config => config.runtimeSelectionUnsafe)) {
302
347
  // Preserve state-sharing files together in the original package process.
303
348
  // Only whole unaffected packages may be omitted, never files within it.
304
- if (paths.length) groups.push({ runnerId: `${suite.packageRoot}:full`, label: "Full non-isolated workspace suite", paths: child.testFilePaths.map(path => `${suite.packageRoot}/${path}`), commandSpec: wrap(["run", ...(script?.endsWith(" --typecheck") ? ["--typecheck"] : [])]) });
305
- else if (script?.endsWith(" --typecheck")) groups.push({ runnerId: `${suite.packageRoot}:types`, label: "Full workspace type tests", paths: [], commandSpec: wrap(["run", "--typecheck.only", "--passWithNoTests"]) });
349
+ if (paths.length) groups.push({ runnerId: `${suite.packageRoot}:full`, label: "Full non-isolated workspace suite", paths: child.testFilePaths.map(path => `${suite.packageRoot}/${path}`), commandSpec: wrap(["run", ...(vitest.typecheck ? ["--typecheck"] : [])]) });
350
+ else if (vitest.typecheck) groups.push({ runnerId: `${suite.packageRoot}:types`, label: "Full workspace type tests", paths: [], commandSpec: wrap(["run", "--typecheck.only", "--passWithNoTests"]) });
306
351
  continue;
307
352
  }
308
353
  const local = planSelectiveTestCommands({ ...child, packageManager: "pnpm" }, paths);
@@ -320,7 +365,7 @@ export function planSelectiveTestCommands(
320
365
  for (const [index, batch] of batches.entries()) groups.push({ ...group, runnerId: `${suite.packageRoot}:${group.runnerId}:${index}`, paths: batch.map(path => `${suite.packageRoot}/${path}`), commandSpec: wrap([...prefix.slice(2), ...batch]) });
321
366
  }
322
367
  // Type-test files are not runtime selection candidates. Retain the entire type suite.
323
- if (script?.endsWith(" --typecheck")) groups.push({ runnerId: `${suite.packageRoot}:types`, label: "Full workspace type tests", paths: [], commandSpec: wrap(["run", "--typecheck.only", "--passWithNoTests"]) });
368
+ if (vitest.typecheck) groups.push({ runnerId: `${suite.packageRoot}:types`, label: "Full workspace type tests", paths: [], commandSpec: wrap(["run", "--typecheck.only", "--passWithNoTests"]) });
324
369
  }
325
370
  if (!groups.some(group => group.paths.length)) return refuse("No workspace runtime suite can be safely narrowed; full validation is required");
326
371
  return { commands: groups.map(g => g.commandSpec), groups, unroutedPaths: [], ...(outsideSuitePaths?.length ? { outsideSuitePaths: outsideSuitePaths.sort() } : {}) };
@@ -173,6 +173,10 @@ export interface ReferenceResolution {
173
173
  code: string[];
174
174
  /** Why the file cannot be narrowed; empty when it can. */
175
175
  unresolvable: string[];
176
+ /** Each unresolvable reason with the readers leading to it, from the changed file to the file it was
177
+ * found through. Every blocker of the level where the first one appeared is reported, not only the first,
178
+ * so one run explains a fallback that used to take one fix per blocker to uncover (2026-11-05). */
179
+ blockers: Array<{ reason: string; chain: string[] }>;
176
180
  /** Every reader found, for evidence. */
177
181
  readers: Array<{ path: string; kind: ReaderKind; via: string }>;
178
182
  /** Phases of the root test script, verbatim, that run a reader directly; the caller must run them.
@@ -223,6 +227,10 @@ export function scriptNamesPath(body: string, target: string, pattern: RegExp, {
223
227
  const targetBase = posix.basename(target);
224
228
  const dirs: string[] = [];
225
229
  for (let dir = posix.dirname(target); ancestors && dir !== "." && dir !== "/"; dir = posix.dirname(dir)) dirs.push(dir);
230
+ // A file name with an extension is the script's own directory's file (`vitest -c vitest.config.mts` in
231
+ // apps/cli/package.json is apps/cli's config, not packages/alint's; 2026-11-05) unless the script runs
232
+ // somewhere else: a `cd`, a workspace-wide run or a directory flag keeps any same-named file.
233
+ const elsewhere = /(?:^|[\s;&|(])(?:cd|pushd)\s|--(?:dir|cwd|prefix|filter|recursive|workspaces?)\b|(?:^|\s)-[rC]\s|\b(?:turbo|nx|lerna)\b/.test(body);
226
234
  for (const raw of body.split(/\s+/)) {
227
235
  const word = raw.replace(/^["']+|["']+$/g, "");
228
236
  if (!word) continue;
@@ -245,7 +253,7 @@ export function scriptNamesPath(body: string, target: string, pattern: RegExp, {
245
253
  continue;
246
254
  }
247
255
  if (resolved === target || dirs.includes(resolved)) return true;
248
- if (!candidate.includes("/") && (candidate === targetBase || dirs.some((dir) => posix.basename(dir) === candidate))) return true;
256
+ if (!candidate.includes("/") && ((candidate === targetBase && (elsewhere || !/\.[A-Za-z0-9]+$/.test(candidate))) || dirs.some((dir) => posix.basename(dir) === candidate))) return true;
249
257
  }
250
258
  }
251
259
  return false;
@@ -253,6 +261,35 @@ export function scriptNamesPath(body: string, target: string, pattern: RegExp, {
253
261
 
254
262
  const CONTENT_PATH_WORD = /[A-Za-z0-9._\-/@+~*?{}[\]!,$]+/g;
255
263
 
264
+ /** Keys whose list names files a tool skips: tsconfig and Vitest `exclude`, knip `ignore`, ESLint-style
265
+ * `ignores` and `ignorePatterns`, Jest `testPathIgnorePatterns` and its siblings. */
266
+ const EXCLUSION_KEY = /^(?:ignored?|ignores|excluded?|excludes|ignorePatterns|\w*PathIgnorePatterns)$/;
267
+
268
+ /**
269
+ * Whether the word at `index` is an element of a bracketed list assigned to an exclusion key
270
+ * (`exclude: [...]`, `"exclude": [...]`, `ignores = [...]`) (2026-11-05). A tool never reads what its
271
+ * own ignore list excludes, yet each such glob counted as a reader: on LobeHub, knip's
272
+ * `ignore: ['scripts/**']`, alint's `ignores = ["**\/fixtures/**"]` and a Vitest `exclude` named every
273
+ * data file of a migration under scripts/, and each change to one ran the full suite. YAML block lists
274
+ * and anything not directly inside such a list keep the conservative answer.
275
+ */
276
+ function inExclusionList(content: string, index: number): boolean {
277
+ // Closers seen so far, so a balanced `{x,}` or `[!d]` in an earlier glob of the same list is skipped.
278
+ const open: Record<string, number> = { "[": 0, "{": 0, "(": 0 };
279
+ const opener: Record<string, string> = { "]": "[", "}": "{", ")": "(" };
280
+ for (let i = index - 1; i >= 0; i--) {
281
+ const char = content[i]!;
282
+ if (char in opener) { open[opener[char]!]!++; continue; }
283
+ if (!(char in open)) continue;
284
+ if (open[char]! > 0) { open[char]!--; continue; }
285
+ // The innermost unclosed bracket: a list, or an object or call the word sits directly inside.
286
+ if (char !== "[") return false;
287
+ const key = /["']?([A-Za-z_$][\w$]*)["']?\s*[:=]\s*$/.exec(content.slice(Math.max(0, i - 80), i));
288
+ return key !== null && EXCLUSION_KEY.test(key[1]!);
289
+ }
290
+ return false;
291
+ }
292
+
256
293
  /**
257
294
  * Whether `content`, read from `readerPath`, names `target` (or, with `ancestors`, one of its
258
295
  * directories), once each matching word is read as a whole path (2026-10-28). The reference pattern
@@ -262,7 +299,7 @@ const CONTENT_PATH_WORD = /[A-Za-z0-9._\-/@+~*?{}[\]!,$]+/g;
262
299
  * a different file names that file, and a glob names only what it matches (2026-11-04). Bare names and
263
300
  * variables inside a path keep the conservative answer.
264
301
  */
265
- export function contentNamesPath(content: string, readerPath: string, target: string, pattern: RegExp, ancestors: boolean): boolean {
302
+ export function contentNamesPath(content: string, readerPath: string, target: string, pattern: RegExp, ancestors: boolean, readGlobs = true): boolean {
266
303
  if (!pattern.test(content)) return false;
267
304
  const dirs: string[] = [];
268
305
  for (let dir = posix.dirname(target); ancestors && dir !== "." && dir !== "/"; dir = posix.dirname(dir)) dirs.push(dir);
@@ -273,6 +310,7 @@ export function contentNamesPath(content: string, readerPath: string, target: st
273
310
  // Judged with the characters around it, so a bare directory name in prose (`the overlay packages,`
274
311
  // in a workflow comment) does not count, as the reference pattern intends (2026-11-04).
275
312
  if (!pattern.test(content.slice(Math.max(0, match.index - 1), match.index + word.length + 1))) continue;
313
+ if (inExclusionList(content, match.index)) continue;
276
314
  // A leading variable is a directory the content does not name (`$GITHUB_ACTION_PATH/../../scripts/x.sh`
277
315
  // names `scripts/x.sh` somewhere, not the repository's `scripts/`), so the rest is a path relative to
278
316
  // an unknown directory (2026-11-04: a LobeHub composite action blocked every changed file under scripts/).
@@ -284,6 +322,7 @@ export function contentNamesPath(content: string, readerPath: string, target: st
284
322
  }
285
323
  if (!word.includes("/") || /[!$]/.test(word)) return true;
286
324
  if (/[*?{}[\]]/.test(word)) {
325
+ if (!readGlobs) continue;
287
326
  if (word.startsWith("../")) return true;
288
327
  // A glob names what it matches, from the reader's directory, the root, or any directory below the
289
328
  // root; `packages/sdk/**` in a workflow's `paths` filter does not name `packages/database/`.
@@ -333,6 +372,20 @@ export function directoryWalkers(filePath: string, tests: readonly string[], rea
333
372
  * non-default `wrangler.validation.json` is used only when a command names it. */
334
373
  const RUNS_FILES_WITHOUT_NAMING = /^(?:wrangler\.(?:toml|json|jsonc)|dockerfile.*|docker-compose.*|compose\.ya?ml|procfile|makefile|justfile|taskfile\.ya?ml|(?:vitest|vite|jest|playwright|cypress|ava|babel|webpack|rollup|esbuild|vue|nuxt|svelte|astro|next)\.config\..+|\.mocharc.*|\.babelrc.*|\.c8rc.*|\.nycrc.*)$/i;
335
374
 
375
+ /** TypeScript project files: they list what to compile, and a non-code file they name is read only
376
+ * through an import, which the dependency graph already has. */
377
+ const PATH_LIST_CONFIG = /^[jt]sconfig(?:\.[^/]+)?\.json$/i;
378
+ const LINTERS = new Set(["eslint", "oxlint", "stylelint", "prettier", "alint", "cspell", "markdownlint", "commitlint", "lintstaged", "lint-staged", "biome", "knip", "dprint"]);
379
+
380
+ /** A linter's or formatter's configuration (`alint.config.toml`, `.eslintrc.json`, `biome.json`). */
381
+ export function isLintConfig(filePath: string): boolean {
382
+ const base = posix.basename(filePath).toLowerCase();
383
+ const stem = base.replace(/^\./, "").split(".")[0]!;
384
+ const tool = stem.replace(/rc$/, "");
385
+ if (!LINTERS.has(tool)) return false;
386
+ return stem !== tool || base.includes(".config.") || /^(?:biome|knip|dprint|cspell)\.(?:json|jsonc|ts|js|mjs|cjs|ya?ml)$/.test(base);
387
+ }
388
+
336
389
  export function loadsWithoutNaming(path: string): boolean {
337
390
  return RUNS_FILES_WITHOUT_NAMING.test(posix.basename(path));
338
391
  }
@@ -340,7 +393,7 @@ export function loadsWithoutNaming(path: string): boolean {
340
393
  /** A root dependency manifest that a Dockerfile names only in `COPY`/`ADD` instructions, which put it
341
394
  * into the image for a package manager to install from. Any other instruction naming it (a `RUN` that
342
395
  * reads it) does not qualify. Comment lines execute nothing and are ignored, so a Dockerfile that names
343
- * the file only in comments qualifies too (2026-11-05: two DiffCI.com Dockerfiles' `# ... pinned in
396
+ * the file only in comments qualifies too (2026-11-05: two dogfood-repository Dockerfiles' `# ... pinned in
344
397
  * package.json` comments blocked every dependency bump). */
345
398
  function copiesOnly(content: string, target: string): boolean {
346
399
  if (target.includes("/") || !["package.json", ...LOCKFILES].includes(target)) return false;
@@ -453,18 +506,24 @@ function packageJsonNames(content: string, pattern: RegExp, target: string, ance
453
506
 
454
507
  /** Resolves who reads `filePath`. See the module comment for the rule and its limits. */
455
508
  export function resolveFileReferences(filePath: string, input: ReferenceResolutionInput): ReferenceResolution {
456
- const resolution: ReferenceResolution = { tests: [], code: [], unresolvable: [], readers: [], phases: [] };
509
+ const resolution: ReferenceResolution = { tests: [], code: [], unresolvable: [], blockers: [], readers: [], phases: [] };
510
+ const parent = new Map<string, string>();
511
+ const chainOf = (path: string) => { const chain = [path]; while (parent.has(chain[0]!)) chain.unshift(parent.get(chain[0]!)!); return chain; };
512
+ const block = (reason: string, through: string) => { resolution.unresolvable.push(reason); resolution.blockers.push({ reason, chain: chainOf(through) }); };
457
513
  const phases = new Set<string>();
458
514
  const tests = new Set<string>();
459
515
  const code = new Set<string>();
460
516
  const visited = new Set<string>([filePath]);
461
- let frontier: Array<{ path: string; via: string }> = [{ path: filePath, via: filePath }];
517
+ // `lint`: the file configures a linter, so only a test or graph code naming it is followed; anything else
518
+ // that reads it is lint tooling and runs no test (isLintConfig; 2026-11-05: LobeHub's oxlint.config.mts
519
+ // chain under scripts/stylexMigration/legacyFiles.json went past the depth limit).
520
+ let frontier: Array<{ path: string; via: string; lint?: boolean }> = [{ path: filePath, via: filePath }];
462
521
  let transitiveCount = 0;
463
522
  const contents = new Map<string, string | undefined>();
464
523
  const read = (path: string) => { if (!contents.has(path)) contents.set(path, input.read(path)); return contents.get(path); };
465
524
 
466
525
  for (let depth = 0; depth < MAX_DEPTH && frontier.length > 0; depth++) {
467
- const next: Array<{ path: string; via: string }> = [];
526
+ const next: Array<{ path: string; via: string; lint?: boolean }> = [];
468
527
  for (const target of frontier) {
469
528
  // Directories are matched only for the changed file itself, which a test may find by listing its
470
529
  // directory. A reader reached through the changed file (a script, a manifest) matters only if
@@ -475,38 +534,50 @@ export function resolveFileReferences(filePath: string, input: ReferenceResoluti
475
534
  for (const candidate of input.files) {
476
535
  if (visited.has(candidate) || candidate === target.path || LOCKFILES.has(posix.basename(candidate))) continue;
477
536
  const base = posix.basename(candidate);
537
+ // A lint step in a workflow or a package's lint script reads a linter's configuration to lint,
538
+ // which no test observes; a test or graph code naming it is still followed (2026-11-05: LobeHub's
539
+ // alint.config.toml names fixture directories and its test workflow runs alint before the tests).
540
+ if (target.lint && (base === "package.json" || candidate.startsWith(".github/"))) continue;
478
541
  if (base === "package.json") {
479
542
  const content = read(candidate);
480
543
  if (content === undefined) {
481
- if (input.allowNoReaders) resolution.unresolvable.push(`${candidate} could not be read`);
544
+ if (input.allowNoReaders) block(`${candidate} could not be read`, target.path);
482
545
  continue;
483
546
  }
484
547
  const named = packageJsonNames(content, pattern, target.path, ancestors, posix.dirname(candidate));
485
548
  if (named === "no") continue;
486
549
  visited.add(candidate);
487
- if (named === "unparseable") { resolution.unresolvable.push(`${candidate} could not be parsed`); continue; }
550
+ if (named === "unparseable") { block(`${candidate} could not be parsed`, target.path); continue; }
488
551
  resolution.readers.push({ path: candidate, kind: "package-script", via: target.path });
489
552
  const direct = input.testPhases && candidate === "package.json" ? directTestPhases(content, target.path, pattern, ancestors) : undefined;
490
553
  if (direct) { for (const phase of direct) phases.add(phase); continue; }
491
- resolution.unresolvable.push(`${candidate} runs ${target.path} as part of its test script`);
554
+ block(`${candidate} runs ${target.path} as part of its test script`, target.path);
492
555
  continue;
493
556
  }
494
557
  if (input.isDocumentation(candidate)) continue;
558
+ // 2026-11-05: LobeHub's root tsconfig `include` names scripts/, and with every tsconfig extending it
559
+ // the readers of scripts/stylexMigration/legacyFiles.json passed the transitive limit. tsc compiles
560
+ // what a tsconfig lists and runs none of it, and changed code it compiles is a compiled project's.
561
+ if (PATH_LIST_CONFIG.test(base)) continue;
495
562
  const content = read(candidate);
496
563
  if (content === undefined && input.allowNoReaders && (input.isCodeFile(candidate) || DIRECTING_EXTENSIONS.test(candidate) || isImplicitlyLoadedFile(candidate))) {
497
- resolution.unresolvable.push(`${candidate} could not be read`);
564
+ block(`${candidate} could not be read`, target.path);
498
565
  continue;
499
566
  }
500
- if (content === undefined || !contentNamesPath(content, candidate, target.path, pattern, ancestors)) continue;
567
+ // A test runner's include and exclude globs select test files, so one matching a data file does not
568
+ // make the runner read it; an exact path in the config still counts (2026-11-05: LobeHub's
569
+ // packages/alint/vitest.config.mts excludes fixture directories under scripts/).
570
+ const globsSelectTests = loadsWithoutNaming(candidate) && !input.isCodeFile(target.path);
571
+ if (content === undefined || !contentNamesPath(content, candidate, target.path, pattern, ancestors, !globsSelectTests)) continue;
501
572
  visited.add(candidate);
502
573
  if (input.allowNoReaders && /^dockerfile/i.test(base) && copiesOnly(content, target.path)) {
503
574
  // The caller modelled what the file does when installed (dependency selection); a Dockerfile
504
- // that only copies it into the image to install from it adds nothing (2026-11-04: DentalPresence's
575
+ // that only copies it into the image to install from it adds nothing (2026-11-04: a dogfood repository's
505
576
  // `COPY package.json package-lock.json ./` made every dependency bump a full run).
506
577
  resolution.readers.push({ path: candidate, kind: "documentation", via: target.path });
507
578
  } else if (input.implicitReadersUnresolvable && loadsWithoutNaming(candidate)) {
508
579
  resolution.readers.push({ path: candidate, kind: "unresolvable", via: target.path });
509
- resolution.unresolvable.push(`${candidate} is loaded by tooling and names ${target.path}`);
580
+ block(`${candidate} is loaded by tooling and names ${target.path}`, target.path);
510
581
  } else if (candidate.startsWith(".github/")) {
511
582
  // A workflow step that comes before a test step in its job, or a composite action, may feed
512
583
  // the file to the suite's environment; issue templates and standalone CI checks do not.
@@ -516,37 +587,38 @@ export function resolveFileReferences(filePath: string, input: ReferenceResoluti
516
587
  || (/^\.github\/workflows\//.test(candidate) && !input.contentCleared?.has(target.path) && input.workflowFeedsTests(content, (text) => contentNamesPath(text, candidate, target.path, pattern, ancestors)));
517
588
  if (!executes) continue;
518
589
  resolution.readers.push({ path: candidate, kind: "unresolvable", via: target.path });
519
- resolution.unresolvable.push(`${candidate} names ${target.path}`);
590
+ block(`${candidate} names ${target.path}`, target.path);
520
591
  } else if (input.isCodeFile(candidate) && input.isTestFile(candidate)) {
521
592
  resolution.readers.push({ path: candidate, kind: "test", via: target.path });
522
593
  tests.add(candidate);
523
594
  } else if (input.isCodeFile(candidate) && input.inGraph(candidate)) {
524
595
  resolution.readers.push({ path: candidate, kind: "graph-code", via: target.path });
525
596
  code.add(candidate);
526
- } else if (input.isCodeFile(candidate) || DIRECTING_EXTENSIONS.test(candidate)) {
597
+ } else if (!target.lint && (input.isCodeFile(candidate) || DIRECTING_EXTENSIONS.test(candidate))) {
527
598
  resolution.readers.push({ path: candidate, kind: "transitive", via: target.path });
528
- if (++transitiveCount > MAX_TRANSITIVE_READERS) { resolution.unresolvable.push(`more than ${MAX_TRANSITIVE_READERS} non-code files name ${filePath}`); break; }
529
- next.push({ path: candidate, via: target.path });
599
+ if (++transitiveCount > MAX_TRANSITIVE_READERS) { block(`more than ${MAX_TRANSITIVE_READERS} non-code files name ${filePath}`, target.path); break; }
600
+ parent.set(candidate, target.path);
601
+ next.push({ path: candidate, via: target.path, lint: isLintConfig(candidate) });
530
602
  } else {
531
603
  // Markup, prose, images and licences name paths in links and URLs but execute nothing and
532
604
  // direct no reads, so nothing reaches the suite through them.
533
605
  resolution.readers.push({ path: candidate, kind: "documentation", via: target.path });
534
606
  }
535
607
  }
536
- if (resolution.unresolvable.length > 0) break;
608
+ if (transitiveCount > MAX_TRANSITIVE_READERS) break;
537
609
  }
538
610
  if (resolution.unresolvable.length > 0) break;
539
611
  frontier = next;
540
612
  }
541
613
  if (resolution.unresolvable.length === 0 && frontier.length > 0) {
542
- resolution.unresolvable.push(`reference chain from ${filePath} is deeper than ${MAX_DEPTH} files`);
614
+ block(`reference chain from ${filePath} is deeper than ${MAX_DEPTH} files`, filePath);
543
615
  }
544
616
  // Found readers that something could run (check scripts, manifests), none of which any test, test
545
617
  // script or test-feeding workflow step reaches: the suite cannot observe the file. Finding no such
546
618
  // reader at all is different - the file's reader is unknown, so it stays unknown.
547
619
  const executableReaders = resolution.readers.some((reader) => reader.kind === "transitive");
548
620
  if (resolution.unresolvable.length === 0 && tests.size === 0 && code.size === 0 && !executableReaders && !input.allowNoReaders && !input.removed && !loadedOnlyOutsideTests(filePath, input, read)) {
549
- resolution.unresolvable.push(`no test or source file names ${filePath}`);
621
+ block(`no test or source file names ${filePath}`, filePath);
550
622
  }
551
623
  resolution.phases = resolution.unresolvable.length === 0 ? [...phases].sort() : [];
552
624
  resolution.tests = [...tests].sort();
@@ -24,6 +24,8 @@ export type ImpactReason =
24
24
  | "OUTSIDE_FULL_SUITE"
25
25
  | "TEST_FIXTURE_OWNER"
26
26
  | "ALWAYS_RUN_POLICY"
27
+ | "DECLARED_INPUT"
28
+ | "ROUTE_VISIT"
27
29
  | "DELETED_FILE_LEGACY_DEPENDENTS"
28
30
  | "DELETED_FILE_UNKNOWABLE_GRAPH"
29
31
  | "RENAMED_FILE_LEGACY_IDENTITY"
@@ -99,6 +101,9 @@ export interface ImpactResult {
99
101
 
100
102
  fallbackRequired: boolean;
101
103
  fallbackReasons: string[];
104
+ /** For a changed file whose readers could not be resolved: every blocker, each with the chain of readers
105
+ * that leads to it (`reader names x (via a <- b)`). Present only on a fallback (2026-11-05). */
106
+ fallbackDetails?: Record<string, string[]>;
102
107
 
103
108
  analysisStatus: "SAFE_TO_PROPOSE" | "FALLBACK";
104
109