@diffci.com/diffci 0.3.29 → 0.3.30

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 (93) hide show
  1. package/dist-client/src/client/cli.js +53 -5
  2. package/dist-client/src/client/command-batches.d.ts +17 -0
  3. package/dist-client/src/client/command-batches.js +73 -9
  4. package/dist-client/src/client/failure-baseline.js +0 -0
  5. package/dist-client/src/client/outcome-log.d.ts +40 -0
  6. package/dist-client/src/client/outcome-log.js +38 -1
  7. package/dist-client/src/client/selected-coverage.d.ts +3 -0
  8. package/dist-client/src/client/selected-coverage.js +35 -5
  9. package/dist-client/src/client/test-ranking.d.ts +39 -0
  10. package/dist-client/src/client/test-ranking.js +127 -0
  11. package/dist-client/src/client/test-results.d.ts +27 -0
  12. package/dist-client/src/client/test-results.js +54 -0
  13. package/dist-client/src/client/test-shards.d.ts +36 -0
  14. package/dist-client/src/client/test-shards.js +68 -0
  15. package/dist-client/src/client/verify-savings.d.ts +6 -0
  16. package/dist-client/src/client/verify-savings.js +4 -0
  17. package/dist-client/src/client/verify.d.ts +32 -1
  18. package/dist-client/src/client/verify.js +141 -13
  19. package/node_modules/@babel/helper-string-parser/lib/index.js +5 -5
  20. package/node_modules/@babel/helper-string-parser/lib/index.js.map +1 -1
  21. package/node_modules/@babel/helper-string-parser/package.json +1 -1
  22. package/node_modules/@babel/parser/lib/index.js +6306 -6143
  23. package/node_modules/@babel/parser/lib/index.js.map +1 -1
  24. package/node_modules/@babel/parser/package.json +3 -3
  25. package/node_modules/@babel/types/lib/definitions/typescript.js +2 -1
  26. package/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -1
  27. package/node_modules/@babel/types/package.json +3 -3
  28. package/node_modules/@diffci.com/core/dist/cache/graph-cache.d.ts +1 -1
  29. package/node_modules/@diffci.com/core/dist/cache/graph-cache.js +2 -1
  30. package/node_modules/@diffci.com/core/dist/cache/graph-cache.js.map +1 -1
  31. package/node_modules/@diffci.com/core/dist/repo/file-references.js +39 -2
  32. package/node_modules/@diffci.com/core/dist/repo/file-references.js.map +1 -1
  33. package/node_modules/@diffci.com/core/dist/repo/impact-types.d.ts +1 -1
  34. package/node_modules/@diffci.com/core/dist/repo/impact.d.ts +13 -0
  35. package/node_modules/@diffci.com/core/dist/repo/impact.js +104 -9
  36. package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
  37. package/node_modules/@diffci.com/core/dist/repo/repo-config.d.ts +11 -0
  38. package/node_modules/@diffci.com/core/dist/repo/repo-config.js +11 -1
  39. package/node_modules/@diffci.com/core/dist/repo/repo-config.js.map +1 -1
  40. package/node_modules/@diffci.com/core/dist/repo/route-visits.d.ts +34 -0
  41. package/node_modules/@diffci.com/core/dist/repo/route-visits.js +93 -0
  42. package/node_modules/@diffci.com/core/dist/repo/route-visits.js.map +1 -0
  43. package/node_modules/@diffci.com/core/package.json +3 -3
  44. package/node_modules/@diffci.com/core/src/cache/graph-cache.ts +2 -1
  45. package/node_modules/@diffci.com/core/src/repo/file-references.ts +32 -2
  46. package/node_modules/@diffci.com/core/src/repo/impact-types.ts +2 -0
  47. package/node_modules/@diffci.com/core/src/repo/impact.ts +95 -9
  48. package/node_modules/@diffci.com/core/src/repo/repo-config.ts +23 -1
  49. package/node_modules/@diffci.com/core/src/repo/route-visits.ts +88 -0
  50. package/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js +4 -3
  51. package/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +4 -3
  52. package/node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js +4 -3
  53. package/node_modules/@vue/compiler-core/package.json +4 -4
  54. package/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js +9 -6
  55. package/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +41 -4
  56. package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +10 -7
  57. package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +12 -11
  58. package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +5 -3
  59. package/node_modules/@vue/compiler-dom/dist/compiler-dom.global.js +10 -7
  60. package/node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js +12 -11
  61. package/node_modules/@vue/compiler-dom/package.json +3 -3
  62. package/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +155 -20
  63. package/node_modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +431 -98
  64. package/node_modules/@vue/compiler-sfc/package.json +10 -10
  65. package/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1 -1
  66. package/node_modules/@vue/compiler-ssr/package.json +3 -3
  67. package/node_modules/@vue/shared/dist/shared.cjs.js +51 -32
  68. package/node_modules/@vue/shared/dist/shared.cjs.prod.js +51 -32
  69. package/node_modules/@vue/shared/dist/shared.d.ts +2 -1
  70. package/node_modules/@vue/shared/dist/shared.esm-bundler.js +51 -32
  71. package/node_modules/@vue/shared/package.json +1 -1
  72. package/node_modules/nanoid/async/index.d.cts +56 -0
  73. package/node_modules/nanoid/index.cjs +12 -7
  74. package/node_modules/nanoid/index.js +1 -1
  75. package/node_modules/nanoid/package.json +3 -3
  76. package/node_modules/postcss/lib/input.js +1 -1
  77. package/node_modules/postcss/lib/lazy-result.js +1 -1
  78. package/node_modules/postcss/lib/list.js +19 -1
  79. package/node_modules/postcss/lib/map-generator.js +9 -3
  80. package/node_modules/postcss/lib/no-work-result.js +1 -1
  81. package/node_modules/postcss/lib/node.js +2 -2
  82. package/node_modules/postcss/lib/parser.js +6 -1
  83. package/node_modules/postcss/lib/processor.js +1 -1
  84. package/node_modules/postcss/lib/stringifier.js +16 -28
  85. package/node_modules/postcss/lib/stringify.js +84 -2
  86. package/node_modules/postcss/lib/warning.js +1 -0
  87. package/node_modules/postcss/package.json +3 -3
  88. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +19 -18
  89. package/node_modules/yaml/browser/dist/nodes/Alias.js +25 -23
  90. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +19 -18
  91. package/node_modules/yaml/dist/nodes/Alias.js +25 -23
  92. package/node_modules/yaml/package.json +1 -1
  93. package/package.json +2 -2
@@ -0,0 +1,93 @@
1
+ // SPDX-License-Identifier: MIT
2
+ /**
3
+ * End-to-end specs selected by the routes they visit (2026-11-06).
4
+ *
5
+ * WHY. A Playwright spec reaches the application through a URL, not an import: `page.goto("/blog/x")`
6
+ * exercises `app/blog/[slug]/page.tsx` without naming it. The dependency graph sees no edge, so a change
7
+ * to that page selected no end-to-end spec at all, a silent skip wherever the suite runs them.
8
+ *
9
+ * WHAT. A spec is a Playwright spec when it imports `@playwright/test`. The URLs it visits are read from
10
+ * literal `.goto(...)` and `request.get/post/...(...)` calls. A Next.js App Router entry point maps to a
11
+ * route pattern (route groups and parallel slots dropped, `[x]`, `[...x]` and `[[...x]]` matched as Next
12
+ * matches them); a page or route handler matches its own route, a layout, loading, error, template or
13
+ * not-found file every route under it, and middleware every route. A spec visiting a URL built at run time
14
+ * (a template with `${}` or a variable) is selected whenever any entry point is affected, as is every spec
15
+ * when an affected entry point's route cannot be derived: an unknown visit is not a negative.
16
+ */
17
+ const PLAYWRIGHT_IMPORT = /(?:from\s+|require\(\s*|import\(\s*)['"]@playwright\/test['"]/;
18
+ export function isPlaywrightSpec(source) {
19
+ return PLAYWRIGHT_IMPORT.test(source);
20
+ }
21
+ function normalizeVisit(url) {
22
+ const withoutOrigin = url.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i, "");
23
+ const path = withoutOrigin.replace(/[?#].*$/, "");
24
+ const absolute = path.startsWith("/") ? path : `/${path}`;
25
+ return absolute.length > 1 ? absolute.replace(/\/+$/, "") : "/";
26
+ }
27
+ export function visitedRoutes(source) {
28
+ const paths = new Set();
29
+ let computed = false;
30
+ const call = /(?:\.goto|\brequest\.(?:get|post|put|patch|delete|head|fetch))\(\s*(?:(['"])((?:\\.|(?!\1).)*)\1|`((?:\\.|[^`\\])*)`|([^\s)]))/g;
31
+ for (const match of source.matchAll(call)) {
32
+ const quoted = match[2];
33
+ const template = match[3];
34
+ if (quoted !== undefined)
35
+ paths.add(normalizeVisit(quoted));
36
+ else if (template !== undefined && !template.includes("${"))
37
+ paths.add(normalizeVisit(template));
38
+ else
39
+ computed = true;
40
+ }
41
+ return { paths: [...paths].sort(), computed };
42
+ }
43
+ /** The route pattern an App Router entry point serves, or undefined when the path is not under `app/`. */
44
+ export function nextAppRoute(entryPath, kind) {
45
+ const parts = entryPath.split("/");
46
+ const base = (parts[parts.length - 1] ?? "").replace(/\.[^.]+$/, "");
47
+ if (base === "middleware")
48
+ return { segments: [], scope: "all" };
49
+ const appIndex = parts.lastIndexOf("app");
50
+ if (appIndex < 0 || appIndex === parts.length - 1)
51
+ return undefined;
52
+ const segments = parts.slice(appIndex + 1, -1)
53
+ .filter((segment) => !/^\(.*\)$/.test(segment) && !segment.startsWith("@"));
54
+ if (segments.some((segment) => segment.startsWith("(")))
55
+ return undefined; // intercepting routes
56
+ const exact = kind === "next-page" || kind === "next-route" || kind === "next-api" || base === "page" || base === "route";
57
+ return { segments, scope: exact ? "exact" : "prefix" };
58
+ }
59
+ /** Whether `path` (a visited URL path) is served by the route `segments` under `scope`. */
60
+ export function routeMatches(route, path) {
61
+ if (route.scope === "all")
62
+ return true;
63
+ const url = path.split("/").filter(Boolean).map((part) => { try {
64
+ return decodeURIComponent(part);
65
+ }
66
+ catch {
67
+ return part;
68
+ } });
69
+ const match = (r, u) => {
70
+ if (r === route.segments.length)
71
+ return route.scope === "prefix" || u === url.length;
72
+ const segment = route.segments[r];
73
+ if (/^\[\[\.\.\..+\]\]$/.test(segment)) {
74
+ for (let next = u; next <= url.length; next += 1)
75
+ if (match(r + 1, next))
76
+ return true;
77
+ return false;
78
+ }
79
+ if (/^\[\.\.\..+\]$/.test(segment)) {
80
+ for (let next = u + 1; next <= url.length; next += 1)
81
+ if (match(r + 1, next))
82
+ return true;
83
+ return false;
84
+ }
85
+ if (u >= url.length)
86
+ return false;
87
+ if (/^\[.+\]$/.test(segment))
88
+ return match(r + 1, u + 1);
89
+ return segment === url[u] && match(r + 1, u + 1);
90
+ };
91
+ return match(0, 0);
92
+ }
93
+ //# sourceMappingURL=route-visits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-visits.js","sourceRoot":"","sources":["../../src/repo/route-visits.ts"],"names":[],"mappings":"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"}
@@ -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;
@@ -253,6 +253,35 @@ export function scriptNamesPath(body: string, target: string, pattern: RegExp, {
253
253
 
254
254
  const CONTENT_PATH_WORD = /[A-Za-z0-9._\-/@+~*?{}[\]!,$]+/g;
255
255
 
256
+ /** Keys whose list names files a tool skips: tsconfig and Vitest `exclude`, knip `ignore`, ESLint-style
257
+ * `ignores` and `ignorePatterns`, Jest `testPathIgnorePatterns` and its siblings. */
258
+ const EXCLUSION_KEY = /^(?:ignored?|ignores|excluded?|excludes|ignorePatterns|\w*PathIgnorePatterns)$/;
259
+
260
+ /**
261
+ * Whether the word at `index` is an element of a bracketed list assigned to an exclusion key
262
+ * (`exclude: [...]`, `"exclude": [...]`, `ignores = [...]`) (2026-11-05). A tool never reads what its
263
+ * own ignore list excludes, yet each such glob counted as a reader: on LobeHub, knip's
264
+ * `ignore: ['scripts/**']`, alint's `ignores = ["**\/fixtures/**"]` and a Vitest `exclude` named every
265
+ * data file of a migration under scripts/, and each change to one ran the full suite. YAML block lists
266
+ * and anything not directly inside such a list keep the conservative answer.
267
+ */
268
+ function inExclusionList(content: string, index: number): boolean {
269
+ // Closers seen so far, so a balanced `{x,}` or `[!d]` in an earlier glob of the same list is skipped.
270
+ const open: Record<string, number> = { "[": 0, "{": 0, "(": 0 };
271
+ const opener: Record<string, string> = { "]": "[", "}": "{", ")": "(" };
272
+ for (let i = index - 1; i >= 0; i--) {
273
+ const char = content[i]!;
274
+ if (char in opener) { open[opener[char]!]!++; continue; }
275
+ if (!(char in open)) continue;
276
+ if (open[char]! > 0) { open[char]!--; continue; }
277
+ // The innermost unclosed bracket: a list, or an object or call the word sits directly inside.
278
+ if (char !== "[") return false;
279
+ const key = /["']?([A-Za-z_$][\w$]*)["']?\s*[:=]\s*$/.exec(content.slice(Math.max(0, i - 80), i));
280
+ return key !== null && EXCLUSION_KEY.test(key[1]!);
281
+ }
282
+ return false;
283
+ }
284
+
256
285
  /**
257
286
  * Whether `content`, read from `readerPath`, names `target` (or, with `ancestors`, one of its
258
287
  * directories), once each matching word is read as a whole path (2026-10-28). The reference pattern
@@ -273,6 +302,7 @@ export function contentNamesPath(content: string, readerPath: string, target: st
273
302
  // Judged with the characters around it, so a bare directory name in prose (`the overlay packages,`
274
303
  // in a workflow comment) does not count, as the reference pattern intends (2026-11-04).
275
304
  if (!pattern.test(content.slice(Math.max(0, match.index - 1), match.index + word.length + 1))) continue;
305
+ if (inExclusionList(content, match.index)) continue;
276
306
  // A leading variable is a directory the content does not name (`$GITHUB_ACTION_PATH/../../scripts/x.sh`
277
307
  // names `scripts/x.sh` somewhere, not the repository's `scripts/`), so the rest is a path relative to
278
308
  // an unknown directory (2026-11-04: a LobeHub composite action blocked every changed file under scripts/).
@@ -340,7 +370,7 @@ export function loadsWithoutNaming(path: string): boolean {
340
370
  /** A root dependency manifest that a Dockerfile names only in `COPY`/`ADD` instructions, which put it
341
371
  * into the image for a package manager to install from. Any other instruction naming it (a `RUN` that
342
372
  * 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
373
+ * the file only in comments qualifies too (2026-11-05: two dogfood-repository Dockerfiles' `# ... pinned in
344
374
  * package.json` comments blocked every dependency bump). */
345
375
  function copiesOnly(content: string, target: string): boolean {
346
376
  if (target.includes("/") || !["package.json", ...LOCKFILES].includes(target)) return false;
@@ -501,7 +531,7 @@ export function resolveFileReferences(filePath: string, input: ReferenceResoluti
501
531
  visited.add(candidate);
502
532
  if (input.allowNoReaders && /^dockerfile/i.test(base) && copiesOnly(content, target.path)) {
503
533
  // 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
534
+ // that only copies it into the image to install from it adds nothing (2026-11-04: a dogfood repository's
505
535
  // `COPY package.json package-lock.json ./` made every dependency bump a full run).
506
536
  resolution.readers.push({ path: candidate, kind: "documentation", via: target.path });
507
537
  } else if (input.implicitReadersUnresolvable && loadsWithoutNaming(candidate)) {
@@ -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"
@@ -12,6 +12,7 @@ import { directoryWalkers, DIRECTING_EXTENSIONS, infrastructureRole, listsDirect
12
12
  import { workflowFeedsTests } from "./workflow-test-steps.js";
13
13
  import { modelTestScriptUniverse, type ScriptUniverse } from "./script-universe.js";
14
14
  import { compiledProjects, type CompiledProject } from "./compiled-projects.js";
15
+ import { isPlaywrightSpec, nextAppRoute, routeMatches, visitedRoutes } from "./route-visits.js";
15
16
 
16
17
  const SOURCE_EXTENSIONS = new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".vue",".go",".java",".kt"]);
17
18
  const ASSET_EXTENSIONS = new Set([".css",".scss",".sass",".less",".json",".jsonc",".svg",".png",".jpg",".jpeg",".gif",".webp",".ico",".bmp",".woff",".woff2",".ttf",".otf",".eot",".wasm",".md",".txt"]);
@@ -267,6 +268,33 @@ export class ImpactAnalyzer {
267
268
  private runtimeTestSelection = false;
268
269
  private unresolved: readonly UnresolvedDependency[] = [];
269
270
  private walkerTests: string[] | undefined;
271
+ private knownTests: string[] | undefined;
272
+ private declaredCovered = new Set<string>();
273
+
274
+ /** Test files known to the graph: nodes matching the profile's test globs or the test-file matcher. */
275
+ private knownTestPaths(profile: RepositoryProfile, graph: DependencyGraph): string[] {
276
+ if (this.knownTests) return this.knownTests;
277
+ const known = new Set<string>();
278
+ for (const testLocation of profile.tests) {
279
+ for (const node of graph.nodes) {
280
+ if (matchesTestGlob(node.path, testLocation.glob) || this.isTestFile(node.path)) known.add(node.path);
281
+ }
282
+ }
283
+ this.knownTests = [...known].sort();
284
+ return this.knownTests;
285
+ }
286
+
287
+ /**
288
+ * The tests the repository's declared inputs (src/repo/repo-config.ts, `inputs`) select for a changed
289
+ * path, or undefined when no declaration names the path (2026-11-05). An empty array means a declaration
290
+ * names it but its `tests` globs match nothing: a stale declaration, which must not stand in for evidence.
291
+ */
292
+ private declaredTests(path: string, profile: RepositoryProfile, graph: DependencyGraph): string[] | undefined {
293
+ const inputs = (profile.diffciConfig?.inputs ?? []).filter((input) => input.files.some((glob) => matchesTestGlob(path, glob)));
294
+ if (inputs.length === 0) return undefined;
295
+ const globs = inputs.flatMap((input) => input.tests);
296
+ return this.knownTestPaths(profile, graph).filter((test) => globs.some((glob) => matchesTestGlob(test, glob)));
297
+ }
270
298
 
271
299
  /** Dependents whose tests a change to `path` can affect. When the graph allows runtime selection
272
300
  * (DependencyGraphResult.runtimeTestSelection) an `import type` edge selects only type tests. */
@@ -298,6 +326,8 @@ export class ImpactAnalyzer {
298
326
  this.testPhases = new Set();
299
327
  this.workersOutsideSuite = undefined;
300
328
  this.walkerTests = undefined;
329
+ this.knownTests = undefined;
330
+ this.declaredCovered = new Set();
301
331
  this.runtimeTestSelection = graphResult.runtimeTestSelection === true;
302
332
  this.unresolved = graphResult.unresolved ?? [];
303
333
  this.sortedRepositoryFiles = options.repositoryFiles ? [...options.repositoryFiles].sort() : [];
@@ -347,6 +377,18 @@ export class ImpactAnalyzer {
347
377
  }
348
378
  }
349
379
 
380
+ // Declared inputs (2026-11-05): a changed path a declaration names, with at least one test behind it,
381
+ // is covered - its tests are selected below instead of the unknown-file or database/infrastructure
382
+ // fallback. A declaration whose tests match nothing is stale and falls back.
383
+ for (const path of new Set(delta.files.flatMap(allChangePaths))) {
384
+ const tests = this.declaredTests(path, profile, graph);
385
+ if (tests === undefined) continue;
386
+ if (tests.length > 0) { this.declaredCovered.add(path); continue; }
387
+ const message = `Declared input ${path} selects no tests; full validation required`;
388
+ riskSignals.push({ level: "critical", reason: "DECLARED_INPUT", message, paths: [path] });
389
+ if (!fallbackReasons.includes(message)) fallbackReasons.push(message);
390
+ }
391
+
350
392
  this.applyGlobalRiskRules(delta, riskSignals, fallbackReasons);
351
393
 
352
394
  // Stage 1B fix (2026-08-21, docs/research/2026-08-21-stage1b-*.md): refine the graph's raw,
@@ -394,6 +436,7 @@ export class ImpactAnalyzer {
394
436
  this.collectDependencyChangeTests(delta, graphResult, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, riskSignals, fallbackReasons);
395
437
  this.handleStructuralNextLayout(changedImpacts, profile, affectedEntryPoints, affectedSources, evidence);
396
438
  this.handleAddedEntryPoints(delta, affectedEntryPoints, affectedSources, affectedTests, evidence, fallbackReasons);
439
+ this.collectRouteVisitTests(profile, graph, affectedEntryPoints, affectedTests, evidence);
397
440
  this.collectAlwaysRunTests(profile, graph, affectedTests, evidence, graphResult.profile.vueRuntimeAlwaysRunPaths ?? []);
398
441
  this.collectComputedImportTests(graphResult, graph, changedImpacts, affectedTests, evidence, riskSignals, fallbackReasons);
399
442
 
@@ -474,6 +517,12 @@ export class ImpactAnalyzer {
474
517
  paths = paths.filter((path) => !isWorkerConfig(path));
475
518
  if (paths.length === 0) continue;
476
519
  }
520
+ if ((rule.signal === "infrastructure" || rule.signal === "database") && paths.length > 0) {
521
+ // A database or deployment definition the repository declared inputs for selects those tests in
522
+ // processChangedPath. Configuration, manifests, lockfiles and workflows stay global (2026-11-05).
523
+ paths = paths.filter((path) => !this.declaredCovered.has(path));
524
+ if (paths.length === 0) continue;
525
+ }
477
526
  const message = paths.length === 0 ? rule.message
478
527
  : `${rule.message}: ${paths.slice(0, 5).join(", ")}${paths.length > 5 ? ` (+${paths.length - 5} more)` : ""}`;
479
528
  riskSignals.push({ level: "critical", reason: rule.reason, message, ...(paths.length ? { paths: [...paths] } : {}) });
@@ -673,6 +722,12 @@ export class ImpactAnalyzer {
673
722
  riskSignals: ImpactRiskSignal[],
674
723
  fallbackReasons: string[],
675
724
  ): void {
725
+ // Declared inputs add their tests to whatever the graph finds. For a covered path they also stand in
726
+ // for the reader evidence whose absence would otherwise fall back below (2026-11-05).
727
+ for (const test of this.declaredTests(changedPath, profile, graph) ?? []) {
728
+ this.addAffectedTest(changedPath, test, graph, affectedTests, "DECLARED_INPUT", evidence);
729
+ }
730
+ const covered = this.declaredCovered.has(changedPath);
676
731
  // Go's embed metadata is ownership evidence regardless of suffix or documentation naming.
677
732
  // Traverse it before generic unknown/docs classification can discard the dependency.
678
733
  if (this.goEmbedPaths.has(changedPath)) {
@@ -731,6 +786,7 @@ export class ImpactAnalyzer {
731
786
  const specifiersOnly = changedPath === "package.json" && this.packageJsonSpecifiersOnly;
732
787
  const options = specifiersOnly ? { allowNoReaders: true, implicitReadersUnresolvable: true } : {};
733
788
  if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, options)) return;
789
+ if (covered) return;
734
790
  const message = `Unknown changed file: ${changedPath}`;
735
791
  evidence.push(makeEvidence("UNKNOWN_FILE", changedPath, message));
736
792
  riskSignals.push({ level: "critical", reason: "UNKNOWN_FILE", message, paths: [changedPath] });
@@ -745,6 +801,7 @@ export class ImpactAnalyzer {
745
801
  // and require nothing, which is a silent skip; it now needs reader evidence like any other
746
802
  // non-code file (2026-10-21).
747
803
  if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence)) return;
804
+ if (covered) return;
748
805
  const message = `Unknown changed file: ${changedPath}`;
749
806
  evidence.push(makeEvidence("UNKNOWN_FILE", changedPath, message));
750
807
  riskSignals.push({ level: "critical", reason: "UNKNOWN_FILE", message, paths: [changedPath] });
@@ -754,6 +811,7 @@ export class ImpactAnalyzer {
754
811
  if (isAssetFilePath(changedPath)) {
755
812
  if (removed && !hasNode(graph, changedPath)) {
756
813
  if (this.resolveRemovedFile(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence)) return;
814
+ if (covered) return;
757
815
  const message = `Deleted source/asset ${changedPath} not present in HEAD dependency graph; legacy dependents cannot be determined`;
758
816
  evidence.push(makeEvidence("DELETED_FILE_UNKNOWABLE_GRAPH", changedPath, message));
759
817
  riskSignals.push({ level: "critical", reason: "DELETED_FILE_UNKNOWABLE_GRAPH", message, paths: [changedPath] });
@@ -765,6 +823,7 @@ export class ImpactAnalyzer {
765
823
  }
766
824
  if (category === "infrastructure" && isWorkerConfig(changedPath) && this.workerConfigsOutsideSuite()) {
767
825
  if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence)) return;
826
+ if (covered) return;
768
827
  const message = `Unknown changed file: ${changedPath}`;
769
828
  evidence.push(makeEvidence("UNKNOWN_FILE", changedPath, message));
770
829
  riskSignals.push({ level: "critical", reason: "UNKNOWN_FILE", message, paths: [changedPath] });
@@ -782,6 +841,7 @@ export class ImpactAnalyzer {
782
841
  // its readers are resolved like any other non-code file. A deployment definition that names it
783
842
  // (wrangler.*, Dockerfile) runs it without naming anything a test would, so that stays global.
784
843
  if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, { implicitReadersUnresolvable: true })) return;
844
+ if (covered) return;
785
845
  const message = `Infrastructure code ${changedPath} is outside the dependency graph; full validation required`;
786
846
  evidence.push(makeEvidence("INFRASTRUCTURE_GLOBAL", changedPath, message));
787
847
  riskSignals.push({ level: "critical", reason: "INFRASTRUCTURE_GLOBAL", message, paths: [changedPath] });
@@ -794,6 +854,7 @@ export class ImpactAnalyzer {
794
854
  }
795
855
  if (changedImpact.file.changeType === "deleted" && !hasNode(graph, changedPath)) {
796
856
  if (this.resolveRemovedFile(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence)) return;
857
+ if (covered) return;
797
858
  const message = `Deleted source/asset ${changedPath} not present in HEAD dependency graph; legacy dependents cannot be determined`;
798
859
  evidence.push(makeEvidence("DELETED_FILE_UNKNOWABLE_GRAPH", changedPath, message));
799
860
  riskSignals.push({ level: "critical", reason: "DELETED_FILE_UNKNOWABLE_GRAPH", message, paths: [changedPath] });
@@ -1205,6 +1266,39 @@ export class ImpactAnalyzer {
1205
1266
  }
1206
1267
  }
1207
1268
 
1269
+ /** Playwright specs that visit an affected Next.js route (route-visits.ts, 2026-11-06). Without the
1270
+ * repository's contents no spec can be read, which leaves selection as the graph made it. */
1271
+ private collectRouteVisitTests(
1272
+ profile: RepositoryProfile,
1273
+ graph: DependencyGraph,
1274
+ affectedEntryPoints: Map<string, EntryPointImpact>,
1275
+ affectedTests: Map<string, TestImpact>,
1276
+ evidence: ImpactEvidence[],
1277
+ ): void {
1278
+ const read = this.readRepositoryFile;
1279
+ if (!read) return;
1280
+ const entries = [...affectedEntryPoints.values()].filter((entry) => entry.kind.startsWith("next-"));
1281
+ if (entries.length === 0) return;
1282
+ const specs = this.knownTestPaths(profile, graph).flatMap((path) => {
1283
+ const source = read(path);
1284
+ return source !== undefined && isPlaywrightSpec(source) ? [{ path, visits: visitedRoutes(source) }] : [];
1285
+ });
1286
+ if (specs.length === 0) return;
1287
+ for (const entry of entries) {
1288
+ const route = nextAppRoute(entry.path, entry.kind);
1289
+ for (const spec of specs) {
1290
+ const visited = route ? spec.visits.paths.find((path) => routeMatches(route, path)) : undefined;
1291
+ const why = !route ? `${entry.path} has no route DiffCI can derive, so every end-to-end spec may reach it`
1292
+ : visited ? `${spec.path} visits ${visited}, served by ${entry.path}`
1293
+ : spec.visits.computed ? `${spec.path} visits a URL built at run time, which may be served by ${entry.path}`
1294
+ : undefined;
1295
+ if (!why) continue;
1296
+ this.addAffectedTest(entry.path, spec.path, graph, affectedTests, "ROUTE_VISIT", evidence);
1297
+ evidence.push(makeEvidence("ROUTE_VISIT", entry.path, why, spec.path));
1298
+ }
1299
+ }
1300
+ }
1301
+
1208
1302
  private collectAlwaysRunTests(
1209
1303
  profile: RepositoryProfile,
1210
1304
  graph: DependencyGraph,
@@ -1213,16 +1307,8 @@ export class ImpactAnalyzer {
1213
1307
  graphRuntimeTests: readonly string[],
1214
1308
  ): void {
1215
1309
  const alwaysRunPaths = new Set<string>([...(profile.vueTypeTestPaths ?? []), ...(profile.vueRuntimeAlwaysRunPaths ?? []), ...graphRuntimeTests]);
1216
- const knownTestPaths = new Set<string>();
1217
- for (const testLocation of profile.tests) {
1218
- for (const node of graph.nodes) {
1219
- if (matchesTestGlob(node.path, testLocation.glob) || this.isTestFile(node.path)) {
1220
- knownTestPaths.add(node.path);
1221
- }
1222
- }
1223
- }
1224
1310
  for (const check of [...this.alwaysRunChecks, ...alwaysRunChecksFromProfile(profile)]) {
1225
- for (const path of knownTestPaths) {
1311
+ for (const path of this.knownTestPaths(profile, graph)) {
1226
1312
  if (check.patterns.some((pattern) => pattern.test(path))) { alwaysRunPaths.add(path); continue; }
1227
1313
  if (check.globs?.some((glob) => matchesTestGlob(path, glob))) alwaysRunPaths.add(path);
1228
1314
  }
@@ -24,9 +24,21 @@
24
24
  import { existsSync, readFileSync } from "node:fs";
25
25
  import { join } from "node:path";
26
26
 
27
+ /**
28
+ * A declared edge (2026-11-05): when a changed path matches `files`, the tests matching `tests` are
29
+ * selected. For edges static analysis cannot see - fixtures loaded by name, env files, codegen inputs,
30
+ * schemas - the way Nx `namedInputs` and Turborepo `inputs` let a repository say what a task reads.
31
+ */
32
+ export interface DeclaredInput {
33
+ files: string[];
34
+ tests: string[];
35
+ }
36
+
27
37
  export interface DiffCiRepositoryConfig {
28
38
  /** Globs for tests that must be selected on every analysed change, regardless of reachability. */
29
39
  alwaysRunTests?: string[];
40
+ /** Edges the repository declares about itself; see DeclaredInput and ImpactAnalyzer.declaredTests. */
41
+ inputs?: DeclaredInput[];
30
42
  /** Explicitly limit Go selection to the root module's `go test ./...` universe. */
31
43
  go?: { scope: "root-module" };
32
44
  /** One package's default Vitest suite; paths are relative to the repository/package respectively. */
@@ -62,8 +74,18 @@ function parseConfig(raw: unknown): DiffCiRepositoryConfig {
62
74
  const safePath = (value: unknown): value is string => typeof value === "string" && /^(?:[A-Za-z0-9_][A-Za-z0-9_.-]*)(?:\/[A-Za-z0-9_][A-Za-z0-9_.-]*)*$/.test(value) && !value.split("/").some(part => part === "." || part === "..");
63
75
  const validVue = vue && (vue.packageRoot === "." || safePath(vue.packageRoot)) && safePath(vue.testConfig) && /^vitest\.config\.[cm]?[jt]s$/.test(vue.testConfig);
64
76
  const validMaven = maven && (maven.goal === "test" || maven.goal === "verify") && (maven.profiles === undefined || Array.isArray(maven.profiles) && maven.profiles.every((profile: unknown) => typeof profile === "string" && /^[A-Za-z0-9_.-]+$/.test(profile)));
77
+ // Unlike a malformed file, a malformed `inputs` block is an error: dropping one entry would turn a
78
+ // declared edge into a silent skip, so the analysis falls back instead (graph.ts, adapterBlockers).
79
+ const globs = (value: unknown): value is string[] => Array.isArray(value) && value.length > 0
80
+ && value.every((entry) => typeof entry === "string" && entry.trim() !== "");
81
+ const inputs = record.inputs;
82
+ const validInputs = Array.isArray(inputs) && inputs.every((entry: unknown) => entry !== null && typeof entry === "object"
83
+ && globs((entry as Record<string, unknown>).files) && globs((entry as Record<string, unknown>).tests));
65
84
  return {
66
85
  ...(alwaysRunTests && alwaysRunTests.length > 0 ? { alwaysRunTests } : {}),
86
+ ...(validInputs && inputs.length > 0
87
+ ? { inputs: (inputs as DeclaredInput[]).map(({ files, tests }) => ({ files: [...files], tests: [...tests] })) }
88
+ : inputs !== undefined && !validInputs ? { configurationError: "Invalid inputs: each entry needs non-empty files and tests glob lists" } : {}),
67
89
  ...(go?.scope === "root-module" ? { go: { scope: "root-module" as const } } : {}),
68
90
  ...(validVue ? { vue: { packageRoot: vue.packageRoot as string, testConfig: vue.testConfig as string } } : record.vue !== undefined ? { configurationError: "Invalid Vue package/suite scope" } : {}),
69
91
  ...(validMaven ? { maven: { goal: maven.goal as "test" | "verify", ...(maven.profiles ? { profiles: maven.profiles as string[] } : {}) } } : record.maven !== undefined ? { configurationError: "Invalid Maven lifecycle goal or profiles" } : {}),
@@ -78,7 +100,7 @@ export function readRepositoryConfig(repoPath: string, packageJson?: Record<stri
78
100
  const dedicated = readJsonFile(join(repoPath, "diffci.json"));
79
101
  if (dedicated) {
80
102
  const parsed = parseConfig(dedicated);
81
- if (parsed.alwaysRunTests || parsed.go || parsed.vue || parsed.maven || parsed.configurationError) return parsed;
103
+ if (parsed.alwaysRunTests || parsed.inputs || parsed.go || parsed.vue || parsed.maven || parsed.configurationError) return parsed;
82
104
  }
83
105
  const pkg = packageJson ?? readJsonFile(join(repoPath, "package.json"));
84
106
  return parseConfig(pkg?.diffci);
@@ -0,0 +1,88 @@
1
+ // SPDX-License-Identifier: MIT
2
+ /**
3
+ * End-to-end specs selected by the routes they visit (2026-11-06).
4
+ *
5
+ * WHY. A Playwright spec reaches the application through a URL, not an import: `page.goto("/blog/x")`
6
+ * exercises `app/blog/[slug]/page.tsx` without naming it. The dependency graph sees no edge, so a change
7
+ * to that page selected no end-to-end spec at all, a silent skip wherever the suite runs them.
8
+ *
9
+ * WHAT. A spec is a Playwright spec when it imports `@playwright/test`. The URLs it visits are read from
10
+ * literal `.goto(...)` and `request.get/post/...(...)` calls. A Next.js App Router entry point maps to a
11
+ * route pattern (route groups and parallel slots dropped, `[x]`, `[...x]` and `[[...x]]` matched as Next
12
+ * matches them); a page or route handler matches its own route, a layout, loading, error, template or
13
+ * not-found file every route under it, and middleware every route. A spec visiting a URL built at run time
14
+ * (a template with `${}` or a variable) is selected whenever any entry point is affected, as is every spec
15
+ * when an affected entry point's route cannot be derived: an unknown visit is not a negative.
16
+ */
17
+
18
+ export interface RouteVisits {
19
+ /** Literal paths the spec visits, origin, query and hash removed. */
20
+ paths: string[];
21
+ /** True when some visit's URL is computed at run time. */
22
+ computed: boolean;
23
+ }
24
+
25
+ const PLAYWRIGHT_IMPORT = /(?:from\s+|require\(\s*|import\(\s*)['"]@playwright\/test['"]/;
26
+
27
+ export function isPlaywrightSpec(source: string): boolean {
28
+ return PLAYWRIGHT_IMPORT.test(source);
29
+ }
30
+
31
+ function normalizeVisit(url: string): string {
32
+ const withoutOrigin = url.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/?#]*/i, "");
33
+ const path = withoutOrigin.replace(/[?#].*$/, "");
34
+ const absolute = path.startsWith("/") ? path : `/${path}`;
35
+ return absolute.length > 1 ? absolute.replace(/\/+$/, "") : "/";
36
+ }
37
+
38
+ export function visitedRoutes(source: string): RouteVisits {
39
+ const paths = new Set<string>();
40
+ let computed = false;
41
+ const call = /(?:\.goto|\brequest\.(?:get|post|put|patch|delete|head|fetch))\(\s*(?:(['"])((?:\\.|(?!\1).)*)\1|`((?:\\.|[^`\\])*)`|([^\s)]))/g;
42
+ for (const match of source.matchAll(call)) {
43
+ const quoted = match[2];
44
+ const template = match[3];
45
+ if (quoted !== undefined) paths.add(normalizeVisit(quoted));
46
+ else if (template !== undefined && !template.includes("${")) paths.add(normalizeVisit(template));
47
+ else computed = true;
48
+ }
49
+ return { paths: [...paths].sort(), computed };
50
+ }
51
+
52
+ export type RouteScope = "exact" | "prefix" | "all";
53
+
54
+ /** The route pattern an App Router entry point serves, or undefined when the path is not under `app/`. */
55
+ export function nextAppRoute(entryPath: string, kind: string): { segments: string[]; scope: RouteScope } | undefined {
56
+ const parts = entryPath.split("/");
57
+ const base = (parts[parts.length - 1] ?? "").replace(/\.[^.]+$/, "");
58
+ if (base === "middleware") return { segments: [], scope: "all" };
59
+ const appIndex = parts.lastIndexOf("app");
60
+ if (appIndex < 0 || appIndex === parts.length - 1) return undefined;
61
+ const segments = parts.slice(appIndex + 1, -1)
62
+ .filter((segment) => !/^\(.*\)$/.test(segment) && !segment.startsWith("@"));
63
+ if (segments.some((segment) => segment.startsWith("("))) return undefined; // intercepting routes
64
+ const exact = kind === "next-page" || kind === "next-route" || kind === "next-api" || base === "page" || base === "route";
65
+ return { segments, scope: exact ? "exact" : "prefix" };
66
+ }
67
+
68
+ /** Whether `path` (a visited URL path) is served by the route `segments` under `scope`. */
69
+ export function routeMatches(route: { segments: string[]; scope: RouteScope }, path: string): boolean {
70
+ if (route.scope === "all") return true;
71
+ const url = path.split("/").filter(Boolean).map((part) => { try { return decodeURIComponent(part); } catch { return part; } });
72
+ const match = (r: number, u: number): boolean => {
73
+ if (r === route.segments.length) return route.scope === "prefix" || u === url.length;
74
+ const segment = route.segments[r]!;
75
+ if (/^\[\[\.\.\..+\]\]$/.test(segment)) {
76
+ for (let next = u; next <= url.length; next += 1) if (match(r + 1, next)) return true;
77
+ return false;
78
+ }
79
+ if (/^\[\.\.\..+\]$/.test(segment)) {
80
+ for (let next = u + 1; next <= url.length; next += 1) if (match(r + 1, next)) return true;
81
+ return false;
82
+ }
83
+ if (u >= url.length) return false;
84
+ if (/^\[.+\]$/.test(segment)) return match(r + 1, u + 1);
85
+ return segment === url[u] && match(r + 1, u + 1);
86
+ };
87
+ return match(0, 0);
88
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.5.42
2
+ * @vue/compiler-core v3.5.44
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1542,7 +1542,8 @@ const errorMessages = {
1542
1542
  [42]: `v-model value must be a valid JavaScript member expression.`,
1543
1543
  [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
1544
1544
  [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
1545
- Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
1545
+ Use a v-bind binding combined with a v-on listener that emits update:x event instead.
1546
+ For props declared with defineModel(), assign the returned ref to a variable and use v-model on that variable.`,
1546
1547
  [45]: `v-model cannot be used on a const binding because it is not writable.`,
1547
1548
  [46]: `Error parsing JavaScript expression: `,
1548
1549
  [47]: `<KeepAlive> expects exactly one child component.`,
@@ -5041,7 +5042,7 @@ const transformFor = createStructuralDirectiveTransform(
5041
5042
  createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
5042
5043
  createCompoundExpression([
5043
5044
  `if (_cached && _cached.el`,
5044
- ...keyExp ? [` && _cached.key === `, keyExp] : [],
5045
+ ...keyExp ? [` && _cached.key === (`, keyExp, `)`] : [],
5045
5046
  ` && ${context.helperString(
5046
5047
  IS_MEMO_SAME
5047
5048
  )}(_cached, _memo)) return _cached`
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.5.42
2
+ * @vue/compiler-core v3.5.44
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1538,7 +1538,8 @@ const errorMessages = {
1538
1538
  [42]: `v-model value must be a valid JavaScript member expression.`,
1539
1539
  [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
1540
1540
  [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
1541
- Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
1541
+ Use a v-bind binding combined with a v-on listener that emits update:x event instead.
1542
+ For props declared with defineModel(), assign the returned ref to a variable and use v-model on that variable.`,
1542
1543
  [45]: `v-model cannot be used on a const binding because it is not writable.`,
1543
1544
  [46]: `Error parsing JavaScript expression: `,
1544
1545
  [47]: `<KeepAlive> expects exactly one child component.`,
@@ -4954,7 +4955,7 @@ const transformFor = createStructuralDirectiveTransform(
4954
4955
  createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
4955
4956
  createCompoundExpression([
4956
4957
  `if (_cached && _cached.el`,
4957
- ...keyExp ? [` && _cached.key === `, keyExp] : [],
4958
+ ...keyExp ? [` && _cached.key === (`, keyExp, `)`] : [],
4958
4959
  ` && ${context.helperString(
4959
4960
  IS_MEMO_SAME
4960
4961
  )}(_cached, _memo)) return _cached`
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compiler-core v3.5.42
2
+ * @vue/compiler-core v3.5.44
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -1473,7 +1473,8 @@ const errorMessages = {
1473
1473
  [42]: `v-model value must be a valid JavaScript member expression.`,
1474
1474
  [43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
1475
1475
  [44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
1476
- Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
1476
+ Use a v-bind binding combined with a v-on listener that emits update:x event instead.
1477
+ For props declared with defineModel(), assign the returned ref to a variable and use v-model on that variable.`,
1477
1478
  [45]: `v-model cannot be used on a const binding because it is not writable.`,
1478
1479
  [46]: `Error parsing JavaScript expression: `,
1479
1480
  [47]: `<KeepAlive> expects exactly one child component.`,
@@ -4294,7 +4295,7 @@ const transformFor = createStructuralDirectiveTransform(
4294
4295
  createCompoundExpression([`const _memo = (`, memo.exp, `)`]),
4295
4296
  createCompoundExpression([
4296
4297
  `if (_cached && _cached.el`,
4297
- ...keyExp ? [` && _cached.key === `, keyExp] : [],
4298
+ ...keyExp ? [` && _cached.key === (`, keyExp, `)`] : [],
4298
4299
  ` && ${context.helperString(
4299
4300
  IS_MEMO_SAME
4300
4301
  )}(_cached, _memo)) return _cached`