@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.
- package/dist-client/src/client/cli.js +78 -5
- package/dist-client/src/client/command-batches.d.ts +22 -0
- package/dist-client/src/client/command-batches.js +82 -9
- package/dist-client/src/client/coverage-map.d.ts +46 -0
- package/dist-client/src/client/coverage-map.js +213 -0
- package/dist-client/src/client/failure-baseline.js +0 -0
- package/dist-client/src/client/observe.js +3 -0
- package/dist-client/src/client/outcome-log.d.ts +40 -0
- package/dist-client/src/client/outcome-log.js +38 -1
- package/dist-client/src/client/report.d.ts +3 -0
- package/dist-client/src/client/selected-coverage.d.ts +3 -0
- package/dist-client/src/client/selected-coverage.js +35 -5
- package/dist-client/src/client/test-ranking.d.ts +39 -0
- package/dist-client/src/client/test-ranking.js +127 -0
- package/dist-client/src/client/test-results.d.ts +27 -0
- package/dist-client/src/client/test-results.js +54 -0
- package/dist-client/src/client/test-shards.d.ts +36 -0
- package/dist-client/src/client/test-shards.js +68 -0
- package/dist-client/src/client/verify-savings.d.ts +6 -0
- package/dist-client/src/client/verify-savings.js +4 -0
- package/dist-client/src/client/verify.d.ts +36 -1
- package/dist-client/src/client/verify.js +171 -13
- package/node_modules/@babel/helper-string-parser/lib/index.js +5 -5
- package/node_modules/@babel/helper-string-parser/lib/index.js.map +1 -1
- package/node_modules/@babel/helper-string-parser/package.json +1 -1
- package/node_modules/@babel/parser/lib/index.js +6306 -6143
- package/node_modules/@babel/parser/lib/index.js.map +1 -1
- package/node_modules/@babel/parser/package.json +3 -3
- package/node_modules/@babel/types/lib/definitions/typescript.js +2 -1
- package/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -1
- package/node_modules/@babel/types/package.json +3 -3
- package/node_modules/@diffci.com/core/dist/cache/graph-cache.d.ts +1 -1
- package/node_modules/@diffci.com/core/dist/cache/graph-cache.js +2 -1
- package/node_modules/@diffci.com/core/dist/cache/graph-cache.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/git/git-diff.js +59 -0
- package/node_modules/@diffci.com/core/dist/git/git-diff.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/git/types.d.ts +4 -0
- package/node_modules/@diffci.com/core/dist/planner/test-command.d.ts +11 -0
- package/node_modules/@diffci.com/core/dist/planner/test-command.js +65 -9
- package/node_modules/@diffci.com/core/dist/planner/test-command.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/file-references.d.ts +10 -1
- package/node_modules/@diffci.com/core/dist/repo/file-references.js +96 -18
- package/node_modules/@diffci.com/core/dist/repo/file-references.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/impact-types.d.ts +4 -1
- package/node_modules/@diffci.com/core/dist/repo/impact.d.ts +20 -0
- package/node_modules/@diffci.com/core/dist/repo/impact.js +147 -25
- package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/repo-config.d.ts +11 -0
- package/node_modules/@diffci.com/core/dist/repo/repo-config.js +11 -1
- package/node_modules/@diffci.com/core/dist/repo/repo-config.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/route-visits.d.ts +34 -0
- package/node_modules/@diffci.com/core/dist/repo/route-visits.js +93 -0
- package/node_modules/@diffci.com/core/dist/repo/route-visits.js.map +1 -0
- package/node_modules/@diffci.com/core/dist/repo/test-fixture-ownership.d.ts +1 -1
- package/node_modules/@diffci.com/core/dist/repo/test-fixture-ownership.js +48 -5
- package/node_modules/@diffci.com/core/dist/repo/test-fixture-ownership.js.map +1 -1
- package/node_modules/@diffci.com/core/package.json +3 -3
- package/node_modules/@diffci.com/core/src/cache/graph-cache.ts +2 -1
- package/node_modules/@diffci.com/core/src/git/git-diff.ts +48 -0
- package/node_modules/@diffci.com/core/src/git/types.ts +4 -0
- package/node_modules/@diffci.com/core/src/planner/test-command.ts +54 -9
- package/node_modules/@diffci.com/core/src/repo/file-references.ts +92 -20
- package/node_modules/@diffci.com/core/src/repo/impact-types.ts +5 -0
- package/node_modules/@diffci.com/core/src/repo/impact.ts +134 -25
- package/node_modules/@diffci.com/core/src/repo/repo-config.ts +23 -1
- package/node_modules/@diffci.com/core/src/repo/route-visits.ts +88 -0
- package/node_modules/@diffci.com/core/src/repo/test-fixture-ownership.ts +39 -5
- package/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js +4 -3
- package/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +4 -3
- package/node_modules/@vue/compiler-core/dist/compiler-core.esm-bundler.js +4 -3
- package/node_modules/@vue/compiler-core/package.json +4 -4
- package/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js +9 -6
- package/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +41 -4
- package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +10 -7
- package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +12 -11
- package/node_modules/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +5 -3
- package/node_modules/@vue/compiler-dom/dist/compiler-dom.global.js +10 -7
- package/node_modules/@vue/compiler-dom/dist/compiler-dom.global.prod.js +12 -11
- package/node_modules/@vue/compiler-dom/package.json +3 -3
- package/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +155 -20
- package/node_modules/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +431 -98
- package/node_modules/@vue/compiler-sfc/package.json +10 -10
- package/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1 -1
- package/node_modules/@vue/compiler-ssr/package.json +3 -3
- package/node_modules/@vue/shared/dist/shared.cjs.js +51 -32
- package/node_modules/@vue/shared/dist/shared.cjs.prod.js +51 -32
- package/node_modules/@vue/shared/dist/shared.d.ts +2 -1
- package/node_modules/@vue/shared/dist/shared.esm-bundler.js +51 -32
- package/node_modules/@vue/shared/package.json +1 -1
- package/node_modules/nanoid/async/index.d.cts +56 -0
- package/node_modules/nanoid/index.cjs +12 -7
- package/node_modules/nanoid/index.js +1 -1
- package/node_modules/nanoid/package.json +3 -3
- package/node_modules/postcss/lib/input.js +1 -1
- package/node_modules/postcss/lib/lazy-result.js +1 -1
- package/node_modules/postcss/lib/list.js +19 -1
- package/node_modules/postcss/lib/map-generator.js +9 -3
- package/node_modules/postcss/lib/no-work-result.js +1 -1
- package/node_modules/postcss/lib/node.js +2 -2
- package/node_modules/postcss/lib/parser.js +6 -1
- package/node_modules/postcss/lib/processor.js +1 -1
- package/node_modules/postcss/lib/stringifier.js +16 -28
- package/node_modules/postcss/lib/stringify.js +84 -2
- package/node_modules/postcss/lib/warning.js +1 -0
- package/node_modules/postcss/package.json +3 -3
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +19 -18
- package/node_modules/yaml/browser/dist/nodes/Alias.js +25 -23
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +19 -18
- package/node_modules/yaml/dist/nodes/Alias.js +25 -23
- package/node_modules/yaml/package.json +1 -1
- package/package.json +2 -2
|
@@ -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"]);
|
|
@@ -257,6 +258,7 @@ export class ImpactAnalyzer {
|
|
|
257
258
|
private contentCleared: ReadonlySet<string> = new Set();
|
|
258
259
|
private dependencyLockfile: string | undefined;
|
|
259
260
|
private packageJsonSpecifiersOnly = false;
|
|
261
|
+
private specifiersOnlyManifests: ReadonlySet<string> = new Set();
|
|
260
262
|
private readRepositoryFile: ((path: string) => string | undefined) | undefined;
|
|
261
263
|
private sortedRepositoryFiles: string[] = [];
|
|
262
264
|
private compiledProjectCache: CompiledProject[] | undefined;
|
|
@@ -266,7 +268,36 @@ export class ImpactAnalyzer {
|
|
|
266
268
|
private workersOutsideSuite: boolean | undefined;
|
|
267
269
|
private runtimeTestSelection = false;
|
|
268
270
|
private unresolved: readonly UnresolvedDependency[] = [];
|
|
271
|
+
/** Why each changed file the reference resolver could not narrow is unresolvable, for fallbackDetails. */
|
|
272
|
+
private referenceBlockers = new Map<string, string[]>();
|
|
269
273
|
private walkerTests: string[] | undefined;
|
|
274
|
+
private knownTests: string[] | undefined;
|
|
275
|
+
private declaredCovered = new Set<string>();
|
|
276
|
+
|
|
277
|
+
/** Test files known to the graph: nodes matching the profile's test globs or the test-file matcher. */
|
|
278
|
+
private knownTestPaths(profile: RepositoryProfile, graph: DependencyGraph): string[] {
|
|
279
|
+
if (this.knownTests) return this.knownTests;
|
|
280
|
+
const known = new Set<string>();
|
|
281
|
+
for (const testLocation of profile.tests) {
|
|
282
|
+
for (const node of graph.nodes) {
|
|
283
|
+
if (matchesTestGlob(node.path, testLocation.glob) || this.isTestFile(node.path)) known.add(node.path);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
this.knownTests = [...known].sort();
|
|
287
|
+
return this.knownTests;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* The tests the repository's declared inputs (src/repo/repo-config.ts, `inputs`) select for a changed
|
|
292
|
+
* path, or undefined when no declaration names the path (2026-11-05). An empty array means a declaration
|
|
293
|
+
* names it but its `tests` globs match nothing: a stale declaration, which must not stand in for evidence.
|
|
294
|
+
*/
|
|
295
|
+
private declaredTests(path: string, profile: RepositoryProfile, graph: DependencyGraph): string[] | undefined {
|
|
296
|
+
const inputs = (profile.diffciConfig?.inputs ?? []).filter((input) => input.files.some((glob) => matchesTestGlob(path, glob)));
|
|
297
|
+
if (inputs.length === 0) return undefined;
|
|
298
|
+
const globs = inputs.flatMap((input) => input.tests);
|
|
299
|
+
return this.knownTestPaths(profile, graph).filter((test) => globs.some((glob) => matchesTestGlob(test, glob)));
|
|
300
|
+
}
|
|
270
301
|
|
|
271
302
|
/** Dependents whose tests a change to `path` can affect. When the graph allows runtime selection
|
|
272
303
|
* (DependencyGraphResult.runtimeTestSelection) an `import type` edge selects only type tests. */
|
|
@@ -298,8 +329,11 @@ export class ImpactAnalyzer {
|
|
|
298
329
|
this.testPhases = new Set();
|
|
299
330
|
this.workersOutsideSuite = undefined;
|
|
300
331
|
this.walkerTests = undefined;
|
|
332
|
+
this.knownTests = undefined;
|
|
333
|
+
this.declaredCovered = new Set();
|
|
301
334
|
this.runtimeTestSelection = graphResult.runtimeTestSelection === true;
|
|
302
335
|
this.unresolved = graphResult.unresolved ?? [];
|
|
336
|
+
this.referenceBlockers = new Map();
|
|
303
337
|
this.sortedRepositoryFiles = options.repositoryFiles ? [...options.repositoryFiles].sort() : [];
|
|
304
338
|
this.compiledProjectCache = undefined;
|
|
305
339
|
// One read per file per analysis, however many changed files ask who reads them.
|
|
@@ -313,6 +347,7 @@ export class ImpactAnalyzer {
|
|
|
313
347
|
this.contentCleared = referenceResolved;
|
|
314
348
|
this.dependencyLockfile = delta.analysis.dependencyLockfile;
|
|
315
349
|
this.packageJsonSpecifiersOnly = delta.analysis.packageJsonSpecifiersOnly === true;
|
|
350
|
+
this.specifiersOnlyManifests = new Set(delta.analysis.specifiersOnlyManifests ?? []);
|
|
316
351
|
const changedImpacts: ChangedImpact[] = delta.files.map((file) => ({ file, category: classifyChangedFile(file, this.isTestFile, this.layout, options.repositoryFiles, referenceResolved), reasons: changedFileReasons(file) }));
|
|
317
352
|
const evidence: ImpactEvidence[] = [];
|
|
318
353
|
const riskSignals: ImpactRiskSignal[] = [];
|
|
@@ -347,6 +382,18 @@ export class ImpactAnalyzer {
|
|
|
347
382
|
}
|
|
348
383
|
}
|
|
349
384
|
|
|
385
|
+
// Declared inputs (2026-11-05): a changed path a declaration names, with at least one test behind it,
|
|
386
|
+
// is covered - its tests are selected below instead of the unknown-file or database/infrastructure
|
|
387
|
+
// fallback. A declaration whose tests match nothing is stale and falls back.
|
|
388
|
+
for (const path of new Set(delta.files.flatMap(allChangePaths))) {
|
|
389
|
+
const tests = this.declaredTests(path, profile, graph);
|
|
390
|
+
if (tests === undefined) continue;
|
|
391
|
+
if (tests.length > 0) { this.declaredCovered.add(path); continue; }
|
|
392
|
+
const message = `Declared input ${path} selects no tests; full validation required`;
|
|
393
|
+
riskSignals.push({ level: "critical", reason: "DECLARED_INPUT", message, paths: [path] });
|
|
394
|
+
if (!fallbackReasons.includes(message)) fallbackReasons.push(message);
|
|
395
|
+
}
|
|
396
|
+
|
|
350
397
|
this.applyGlobalRiskRules(delta, riskSignals, fallbackReasons);
|
|
351
398
|
|
|
352
399
|
// Stage 1B fix (2026-08-21, docs/research/2026-08-21-stage1b-*.md): refine the graph's raw,
|
|
@@ -394,6 +441,7 @@ export class ImpactAnalyzer {
|
|
|
394
441
|
this.collectDependencyChangeTests(delta, graphResult, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, riskSignals, fallbackReasons);
|
|
395
442
|
this.handleStructuralNextLayout(changedImpacts, profile, affectedEntryPoints, affectedSources, evidence);
|
|
396
443
|
this.handleAddedEntryPoints(delta, affectedEntryPoints, affectedSources, affectedTests, evidence, fallbackReasons);
|
|
444
|
+
this.collectRouteVisitTests(profile, graph, affectedEntryPoints, affectedTests, evidence);
|
|
397
445
|
this.collectAlwaysRunTests(profile, graph, affectedTests, evidence, graphResult.profile.vueRuntimeAlwaysRunPaths ?? []);
|
|
398
446
|
this.collectComputedImportTests(graphResult, graph, changedImpacts, affectedTests, evidence, riskSignals, fallbackReasons);
|
|
399
447
|
|
|
@@ -446,6 +494,7 @@ export class ImpactAnalyzer {
|
|
|
446
494
|
riskSignals: dedupedRiskSignals,
|
|
447
495
|
fallbackRequired,
|
|
448
496
|
fallbackReasons,
|
|
497
|
+
...(fallbackRequired && this.referenceBlockers.size ? { fallbackDetails: this.fallbackDetails(fallbackReasons) } : {}),
|
|
449
498
|
analysisStatus,
|
|
450
499
|
effectiveGraphConfidence,
|
|
451
500
|
evidence: evidence.sort((a, b) => { const c = a.changedFile.localeCompare(b.changedFile); if (c !== 0) return c; return a.message.localeCompare(b.message); }),
|
|
@@ -453,6 +502,16 @@ export class ImpactAnalyzer {
|
|
|
453
502
|
};
|
|
454
503
|
}
|
|
455
504
|
|
|
505
|
+
/** Blockers of each file a fallback reason names, at most 20 files and 10 blockers each. */
|
|
506
|
+
private fallbackDetails(fallbackReasons: readonly string[]): Record<string, string[]> {
|
|
507
|
+
const details: Record<string, string[]> = {};
|
|
508
|
+
for (const [path, blockers] of [...this.referenceBlockers].sort(([a], [b]) => a.localeCompare(b))) {
|
|
509
|
+
if (Object.keys(details).length >= 20) break;
|
|
510
|
+
if (fallbackReasons.some((reason) => reason.includes(path))) details[path] = blockers.slice(0, 10);
|
|
511
|
+
}
|
|
512
|
+
return details;
|
|
513
|
+
}
|
|
514
|
+
|
|
456
515
|
private applyGlobalRiskRules(delta: GitDelta, riskSignals: ImpactRiskSignal[], fallbackReasons: string[]): void {
|
|
457
516
|
type SignalKey = keyof NonNullable<GitDelta["analysis"]["signalPaths"]>;
|
|
458
517
|
const reasons: Array<{ reason: ImpactReason; message: string; signal: SignalKey; check: (a: GitDelta["analysis"]) => boolean }> = [
|
|
@@ -474,6 +533,12 @@ export class ImpactAnalyzer {
|
|
|
474
533
|
paths = paths.filter((path) => !isWorkerConfig(path));
|
|
475
534
|
if (paths.length === 0) continue;
|
|
476
535
|
}
|
|
536
|
+
if ((rule.signal === "infrastructure" || rule.signal === "database") && paths.length > 0) {
|
|
537
|
+
// A database or deployment definition the repository declared inputs for selects those tests in
|
|
538
|
+
// processChangedPath. Configuration, manifests, lockfiles and workflows stay global (2026-11-05).
|
|
539
|
+
paths = paths.filter((path) => !this.declaredCovered.has(path));
|
|
540
|
+
if (paths.length === 0) continue;
|
|
541
|
+
}
|
|
477
542
|
const message = paths.length === 0 ? rule.message
|
|
478
543
|
: `${rule.message}: ${paths.slice(0, 5).join(", ")}${paths.length > 5 ? ` (+${paths.length - 5} more)` : ""}`;
|
|
479
544
|
riskSignals.push({ level: "critical", reason: rule.reason, message, ...(paths.length ? { paths: [...paths] } : {}) });
|
|
@@ -673,6 +738,12 @@ export class ImpactAnalyzer {
|
|
|
673
738
|
riskSignals: ImpactRiskSignal[],
|
|
674
739
|
fallbackReasons: string[],
|
|
675
740
|
): void {
|
|
741
|
+
// Declared inputs add their tests to whatever the graph finds. For a covered path they also stand in
|
|
742
|
+
// for the reader evidence whose absence would otherwise fall back below (2026-11-05).
|
|
743
|
+
for (const test of this.declaredTests(changedPath, profile, graph) ?? []) {
|
|
744
|
+
this.addAffectedTest(changedPath, test, graph, affectedTests, "DECLARED_INPUT", evidence);
|
|
745
|
+
}
|
|
746
|
+
const covered = this.declaredCovered.has(changedPath);
|
|
676
747
|
// Go's embed metadata is ownership evidence regardless of suffix or documentation naming.
|
|
677
748
|
// Traverse it before generic unknown/docs classification can discard the dependency.
|
|
678
749
|
if (this.goEmbedPaths.has(changedPath)) {
|
|
@@ -712,25 +783,17 @@ export class ImpactAnalyzer {
|
|
|
712
783
|
if (!fallbackReasons.includes(message)) fallbackReasons.push(message);
|
|
713
784
|
return;
|
|
714
785
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
const ownership = resolveTestFixtureOwners(changedPath, this.isTestFile, this.repositoryFiles);
|
|
719
|
-
if (ownership) {
|
|
720
|
-
for (const owner of ownership.owners) {
|
|
721
|
-
this.addAffectedTest(changedPath, owner, graph, affectedTests, "TEST_FIXTURE_OWNER", evidence);
|
|
722
|
-
}
|
|
723
|
-
evidence.push(makeEvidence("TEST_FIXTURE_OWNER", changedPath, `Test fixture ${changedPath} under ${ownership.fixtureDir} is owned by ${ownership.owners.length} test(s) in ${ownership.testsDir} (${ownership.scope})`));
|
|
724
|
-
return;
|
|
725
|
-
}
|
|
726
|
-
}
|
|
786
|
+
// Resolved per change PATH (a rename's old path resolves independently); an unresolvable side
|
|
787
|
+
// degrades to the unknown-file fallback below rather than being silently dropped.
|
|
788
|
+
if (category === "test-fixture" && this.claimFixture(changedPath, graph, affectedTests, evidence)) return;
|
|
727
789
|
if (category === "unknown" || category === "test-fixture") {
|
|
728
790
|
// A package.json edit limited to dependency requests is covered by dependency selection, like
|
|
729
791
|
// the lockfile above, so finding no reader is not a gap. Tooling that loads a file naming it
|
|
730
792
|
// still is (2026-11-02).
|
|
731
|
-
const specifiersOnly = changedPath === "package.json" && this.packageJsonSpecifiersOnly;
|
|
793
|
+
const specifiersOnly = (changedPath === "package.json" && this.packageJsonSpecifiersOnly) || this.specifiersOnlyManifests.has(changedPath);
|
|
732
794
|
const options = specifiersOnly ? { allowNoReaders: true, implicitReadersUnresolvable: true } : {};
|
|
733
795
|
if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, options)) return;
|
|
796
|
+
if (covered) return;
|
|
734
797
|
const message = `Unknown changed file: ${changedPath}`;
|
|
735
798
|
evidence.push(makeEvidence("UNKNOWN_FILE", changedPath, message));
|
|
736
799
|
riskSignals.push({ level: "critical", reason: "UNKNOWN_FILE", message, paths: [changedPath] });
|
|
@@ -743,8 +806,12 @@ export class ImpactAnalyzer {
|
|
|
743
806
|
if (isAssetFilePath(changedPath) && !hasNode(graph, changedPath) && !removed && !isDocumentationFile(changedPath, this.layout) && !isLockfile(changedPath)) {
|
|
744
807
|
// An asset no module imports can still be read from disk by a test. It used to select nothing
|
|
745
808
|
// and require nothing, which is a silent skip; it now needs reader evidence like any other
|
|
746
|
-
// non-code file (2026-10-21).
|
|
809
|
+
// non-code file (2026-10-21). Assets (`.json`, `.txt`) are classified before fixture ownership is
|
|
810
|
+
// tried, so a fixture no module imports is claimed here (2026-11-05: LobeHub's
|
|
811
|
+
// src/spawn/__fixtures__/copilotAcp/handshake.json beside the spawn tests).
|
|
812
|
+
if (this.claimFixture(changedPath, graph, affectedTests, evidence)) return;
|
|
747
813
|
if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence)) return;
|
|
814
|
+
if (covered) return;
|
|
748
815
|
const message = `Unknown changed file: ${changedPath}`;
|
|
749
816
|
evidence.push(makeEvidence("UNKNOWN_FILE", changedPath, message));
|
|
750
817
|
riskSignals.push({ level: "critical", reason: "UNKNOWN_FILE", message, paths: [changedPath] });
|
|
@@ -754,6 +821,7 @@ export class ImpactAnalyzer {
|
|
|
754
821
|
if (isAssetFilePath(changedPath)) {
|
|
755
822
|
if (removed && !hasNode(graph, changedPath)) {
|
|
756
823
|
if (this.resolveRemovedFile(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence)) return;
|
|
824
|
+
if (covered) return;
|
|
757
825
|
const message = `Deleted source/asset ${changedPath} not present in HEAD dependency graph; legacy dependents cannot be determined`;
|
|
758
826
|
evidence.push(makeEvidence("DELETED_FILE_UNKNOWABLE_GRAPH", changedPath, message));
|
|
759
827
|
riskSignals.push({ level: "critical", reason: "DELETED_FILE_UNKNOWABLE_GRAPH", message, paths: [changedPath] });
|
|
@@ -765,6 +833,7 @@ export class ImpactAnalyzer {
|
|
|
765
833
|
}
|
|
766
834
|
if (category === "infrastructure" && isWorkerConfig(changedPath) && this.workerConfigsOutsideSuite()) {
|
|
767
835
|
if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence)) return;
|
|
836
|
+
if (covered) return;
|
|
768
837
|
const message = `Unknown changed file: ${changedPath}`;
|
|
769
838
|
evidence.push(makeEvidence("UNKNOWN_FILE", changedPath, message));
|
|
770
839
|
riskSignals.push({ level: "critical", reason: "UNKNOWN_FILE", message, paths: [changedPath] });
|
|
@@ -782,6 +851,7 @@ export class ImpactAnalyzer {
|
|
|
782
851
|
// its readers are resolved like any other non-code file. A deployment definition that names it
|
|
783
852
|
// (wrangler.*, Dockerfile) runs it without naming anything a test would, so that stays global.
|
|
784
853
|
if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, { implicitReadersUnresolvable: true })) return;
|
|
854
|
+
if (covered) return;
|
|
785
855
|
const message = `Infrastructure code ${changedPath} is outside the dependency graph; full validation required`;
|
|
786
856
|
evidence.push(makeEvidence("INFRASTRUCTURE_GLOBAL", changedPath, message));
|
|
787
857
|
riskSignals.push({ level: "critical", reason: "INFRASTRUCTURE_GLOBAL", message, paths: [changedPath] });
|
|
@@ -794,6 +864,7 @@ export class ImpactAnalyzer {
|
|
|
794
864
|
}
|
|
795
865
|
if (changedImpact.file.changeType === "deleted" && !hasNode(graph, changedPath)) {
|
|
796
866
|
if (this.resolveRemovedFile(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence)) return;
|
|
867
|
+
if (covered) return;
|
|
797
868
|
const message = `Deleted source/asset ${changedPath} not present in HEAD dependency graph; legacy dependents cannot be determined`;
|
|
798
869
|
evidence.push(makeEvidence("DELETED_FILE_UNKNOWABLE_GRAPH", changedPath, message));
|
|
799
870
|
riskSignals.push({ level: "critical", reason: "DELETED_FILE_UNKNOWABLE_GRAPH", message, paths: [changedPath] });
|
|
@@ -803,6 +874,15 @@ export class ImpactAnalyzer {
|
|
|
803
874
|
this.processSourceChange(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence);
|
|
804
875
|
}
|
|
805
876
|
|
|
877
|
+
/** Selects the tests that own `path` as a test fixture (src/repo/test-fixture-ownership.ts), if any do. */
|
|
878
|
+
private claimFixture(path: string, graph: DependencyGraph, affectedTests: Map<string, TestImpact>, evidence: ImpactEvidence[]): boolean {
|
|
879
|
+
const ownership = resolveTestFixtureOwners(path, this.isTestFile, this.repositoryFiles);
|
|
880
|
+
if (!ownership) return false;
|
|
881
|
+
for (const owner of ownership.owners) this.addAffectedTest(path, owner, graph, affectedTests, "TEST_FIXTURE_OWNER", evidence);
|
|
882
|
+
evidence.push(makeEvidence("TEST_FIXTURE_OWNER", path, `Test fixture ${path} under ${ownership.fixtureDir} is owned by ${ownership.owners.length} test(s) in ${ownership.testsDir} (${ownership.scope})`));
|
|
883
|
+
return true;
|
|
884
|
+
}
|
|
885
|
+
|
|
806
886
|
/**
|
|
807
887
|
* A file gone at HEAD that the HEAD graph has no node for (2026-11-04). Its old importers cannot be
|
|
808
888
|
* listed, but each one is either changed in this delta (its import was edited or removed, so it is
|
|
@@ -829,7 +909,9 @@ export class ImpactAnalyzer {
|
|
|
829
909
|
// Conservative: any unresolved import whose last segment could name the file blocks, wherever it is.
|
|
830
910
|
const importer = this.unresolved.find((ref) => !ref.computed && names.has(posix.basename(ref.specifier.split(/[?#]/)[0]!)));
|
|
831
911
|
if (importer) {
|
|
832
|
-
|
|
912
|
+
const blocker = `${importer.importer} imports ${importer.specifier}, which may have resolved to the removed ${removedPath}`;
|
|
913
|
+
evidence.push(makeEvidence("UNKNOWN_FILE", removedPath, blocker));
|
|
914
|
+
this.referenceBlockers.set(removedPath, [blocker]);
|
|
833
915
|
return false;
|
|
834
916
|
}
|
|
835
917
|
if (!this.resolveByReference(removedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, { implicitReadersUnresolvable: true, removed: true })) return false;
|
|
@@ -910,7 +992,9 @@ export class ImpactAnalyzer {
|
|
|
910
992
|
workerConfigsOutsideSuite: this.workerConfigsOutsideSuite(),
|
|
911
993
|
});
|
|
912
994
|
if (resolution.unresolvable.length > 0) {
|
|
913
|
-
|
|
995
|
+
const blockers = resolution.blockers.map(({ reason, chain }) => chain.length > 1 ? `${reason} (via ${chain.slice(1).join(" <- ")})` : reason);
|
|
996
|
+
this.referenceBlockers.set(changedPath, blockers);
|
|
997
|
+
evidence.push(makeEvidence("UNKNOWN_FILE", changedPath, `References to ${changedPath} could not be resolved: ${blockers.slice(0, 5).join("; ")}${blockers.length > 5 ? `; and ${blockers.length - 5} more` : ""}`));
|
|
914
998
|
return false;
|
|
915
999
|
}
|
|
916
1000
|
for (const reader of resolution.readers) {
|
|
@@ -1205,6 +1289,39 @@ export class ImpactAnalyzer {
|
|
|
1205
1289
|
}
|
|
1206
1290
|
}
|
|
1207
1291
|
|
|
1292
|
+
/** Playwright specs that visit an affected Next.js route (route-visits.ts, 2026-11-06). Without the
|
|
1293
|
+
* repository's contents no spec can be read, which leaves selection as the graph made it. */
|
|
1294
|
+
private collectRouteVisitTests(
|
|
1295
|
+
profile: RepositoryProfile,
|
|
1296
|
+
graph: DependencyGraph,
|
|
1297
|
+
affectedEntryPoints: Map<string, EntryPointImpact>,
|
|
1298
|
+
affectedTests: Map<string, TestImpact>,
|
|
1299
|
+
evidence: ImpactEvidence[],
|
|
1300
|
+
): void {
|
|
1301
|
+
const read = this.readRepositoryFile;
|
|
1302
|
+
if (!read) return;
|
|
1303
|
+
const entries = [...affectedEntryPoints.values()].filter((entry) => entry.kind.startsWith("next-"));
|
|
1304
|
+
if (entries.length === 0) return;
|
|
1305
|
+
const specs = this.knownTestPaths(profile, graph).flatMap((path) => {
|
|
1306
|
+
const source = read(path);
|
|
1307
|
+
return source !== undefined && isPlaywrightSpec(source) ? [{ path, visits: visitedRoutes(source) }] : [];
|
|
1308
|
+
});
|
|
1309
|
+
if (specs.length === 0) return;
|
|
1310
|
+
for (const entry of entries) {
|
|
1311
|
+
const route = nextAppRoute(entry.path, entry.kind);
|
|
1312
|
+
for (const spec of specs) {
|
|
1313
|
+
const visited = route ? spec.visits.paths.find((path) => routeMatches(route, path)) : undefined;
|
|
1314
|
+
const why = !route ? `${entry.path} has no route DiffCI can derive, so every end-to-end spec may reach it`
|
|
1315
|
+
: visited ? `${spec.path} visits ${visited}, served by ${entry.path}`
|
|
1316
|
+
: spec.visits.computed ? `${spec.path} visits a URL built at run time, which may be served by ${entry.path}`
|
|
1317
|
+
: undefined;
|
|
1318
|
+
if (!why) continue;
|
|
1319
|
+
this.addAffectedTest(entry.path, spec.path, graph, affectedTests, "ROUTE_VISIT", evidence);
|
|
1320
|
+
evidence.push(makeEvidence("ROUTE_VISIT", entry.path, why, spec.path));
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1208
1325
|
private collectAlwaysRunTests(
|
|
1209
1326
|
profile: RepositoryProfile,
|
|
1210
1327
|
graph: DependencyGraph,
|
|
@@ -1213,16 +1330,8 @@ export class ImpactAnalyzer {
|
|
|
1213
1330
|
graphRuntimeTests: readonly string[],
|
|
1214
1331
|
): void {
|
|
1215
1332
|
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
1333
|
for (const check of [...this.alwaysRunChecks, ...alwaysRunChecksFromProfile(profile)]) {
|
|
1225
|
-
for (const path of knownTestPaths) {
|
|
1334
|
+
for (const path of this.knownTestPaths(profile, graph)) {
|
|
1226
1335
|
if (check.patterns.some((pattern) => pattern.test(path))) { alwaysRunPaths.add(path); continue; }
|
|
1227
1336
|
if (check.globs?.some((glob) => matchesTestGlob(path, glob))) alwaysRunPaths.add(path);
|
|
1228
1337
|
}
|
|
@@ -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
|
+
}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* 1. the nearest ancestor directory named `tests`, `test` or `__tests__` is the tests dir T;
|
|
16
16
|
* 2. the segment directly under T must be a fixture directory by name (`snapshots`,
|
|
17
17
|
* `goal-snapshots`, `fixtures`, `__fixtures__`, `__snapshots__`, ...) - a `.jsonl` elsewhere
|
|
18
|
-
* under T (or outside any tests dir) is NOT claimed
|
|
18
|
+
* under T (or outside any tests dir) is NOT claimed, except a non-code file directly in T, which
|
|
19
|
+
* the direct test children of T own (2026-11-05);
|
|
19
20
|
* 3. owners are the recognised test files (profile test patterns) that are DIRECT children of T.
|
|
20
21
|
* When the fixture dir is snapshot-named and T has snapshot-family tests, only those are owned
|
|
21
22
|
* (a snapshots dir is read by snapshot suites); otherwise all direct test children; if T has no
|
|
@@ -24,6 +25,12 @@
|
|
|
24
25
|
* undefined and the file stays "unknown" (fallback). Deleted fixtures resolve against HEAD: the
|
|
25
26
|
* tests dir still exists -> its tests are selected; tests dir gone -> unknown.
|
|
26
27
|
*
|
|
28
|
+
* A fixture directory BESIDE its tests (2026-11-05, LobeHub `verification/fixtures/assets/*` next to
|
|
29
|
+
* `verification/__tests__/`, `src/spawn/__fixtures__/` next to `src/spawn/*.test.ts`) is owned the same
|
|
30
|
+
* way when no tests-dir ancestor claims it: the nearest fixture-named ancestor F, its parent P, and as
|
|
31
|
+
* owners the tests directly in P or directly in P's `tests`/`test`/`__tests__`; if there are none, every
|
|
32
|
+
* test under P/** (scope `sibling-recursive`).
|
|
33
|
+
*
|
|
27
34
|
* Ownership is by directory convention only; nothing here inspects file contents or file extensions,
|
|
28
35
|
* so the same rule covers `.jsonl`, `.json`, `.txt`, `.expected.*` fixtures alike.
|
|
29
36
|
*/
|
|
@@ -31,15 +38,36 @@ import { testFamilyOfPath } from "./test-discovery.js";
|
|
|
31
38
|
|
|
32
39
|
const TESTS_DIR_NAMES = new Set(["tests", "test", "__tests__"]);
|
|
33
40
|
const FIXTURE_DIR = /(^|[-_.])(snapshots?|fixtures?)([-_.]|$)|^__(snapshots|fixtures)__$/i;
|
|
41
|
+
const CODE_FILE = /\.(?:[cm]?[jt]sx?|vue|svelte|go|java|kt|py|rb)$/i;
|
|
34
42
|
|
|
35
43
|
export interface FixtureOwnership {
|
|
36
44
|
testsDir: string;
|
|
37
45
|
fixtureDir: string;
|
|
38
46
|
/** How owners were chosen - surfaced in evidence so over-selection is auditable. */
|
|
39
|
-
scope: "direct-snapshot-family" | "direct" | "recursive";
|
|
47
|
+
scope: "direct-snapshot-family" | "direct" | "recursive" | "sibling" | "sibling-recursive";
|
|
40
48
|
owners: string[];
|
|
41
49
|
}
|
|
42
50
|
|
|
51
|
+
/** Owners of a fixture directory that sits beside its tests rather than inside a tests dir. */
|
|
52
|
+
function siblingOwners(segments: readonly string[], isTestFile: (p: string) => boolean, repositoryFiles: ReadonlySet<string>): FixtureOwnership | undefined {
|
|
53
|
+
let f = -1;
|
|
54
|
+
for (let i = segments.length - 2; i >= 1; i--) { if (FIXTURE_DIR.test(segments[i]!)) { f = i; break; } }
|
|
55
|
+
if (f === -1) return undefined;
|
|
56
|
+
const scope = segments.slice(0, f).join("/");
|
|
57
|
+
const fixtureDir = `${scope}/${segments[f]}`;
|
|
58
|
+
const direct: string[] = [];
|
|
59
|
+
const recursive: string[] = [];
|
|
60
|
+
for (const file of repositoryFiles) {
|
|
61
|
+
if (!file.startsWith(`${scope}/`) || !isTestFile(file)) continue;
|
|
62
|
+
recursive.push(file);
|
|
63
|
+
const rest = file.slice(scope.length + 1).split("/");
|
|
64
|
+
if (rest.length === 1 || (rest.length === 2 && TESTS_DIR_NAMES.has(rest[0]!))) direct.push(file);
|
|
65
|
+
}
|
|
66
|
+
if (direct.length > 0) return { testsDir: scope, fixtureDir, scope: "sibling", owners: direct.sort() };
|
|
67
|
+
if (recursive.length > 0) return { testsDir: scope, fixtureDir, scope: "sibling-recursive", owners: recursive.sort() };
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
|
|
43
71
|
export function resolveTestFixtureOwners(
|
|
44
72
|
changedPath: string,
|
|
45
73
|
isTestFile: (p: string) => boolean,
|
|
@@ -51,10 +79,16 @@ export function resolveTestFixtureOwners(
|
|
|
51
79
|
// nearest tests-dir ancestor (search from the deepest directory upward)
|
|
52
80
|
let t = -1;
|
|
53
81
|
for (let i = segments.length - 2; i >= 0; i--) { if (TESTS_DIR_NAMES.has(segments[i]!)) { t = i; break; } }
|
|
54
|
-
|
|
55
|
-
|
|
82
|
+
// A data file directly in a tests dir (`__tests__/recordedRun.json`) is read by the tests beside it
|
|
83
|
+
// (2026-11-05, LobeHub). Code there is a helper the graph sees, so only non-code files are claimed.
|
|
84
|
+
if (t !== -1 && t === segments.length - 2 && /\.[^./]+$/.test(changedPath) && !CODE_FILE.test(changedPath)) {
|
|
85
|
+
const testsDir = segments.slice(0, t + 1).join("/");
|
|
86
|
+
const owners = [...repositoryFiles].filter((f) => f.startsWith(`${testsDir}/`) && !f.slice(testsDir.length + 1).includes("/") && isTestFile(f)).sort();
|
|
87
|
+
if (owners.length > 0) return { testsDir, fixtureDir: testsDir, scope: "direct", owners };
|
|
88
|
+
}
|
|
89
|
+
const fixtureSegment = t === -1 ? undefined : segments[t + 1];
|
|
56
90
|
// must be a fixture DIRECTORY (at least one more segment = the file itself), and fixture-named
|
|
57
|
-
if (fixtureSegment === undefined || t + 1 >= segments.length - 1 || !FIXTURE_DIR.test(fixtureSegment)) return
|
|
91
|
+
if (fixtureSegment === undefined || t + 1 >= segments.length - 1 || !FIXTURE_DIR.test(fixtureSegment)) return siblingOwners(segments, isTestFile, repositoryFiles);
|
|
58
92
|
const testsDir = segments.slice(0, t + 1).join("/");
|
|
59
93
|
const prefix = `${testsDir}/`;
|
|
60
94
|
const direct: string[] = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.5.
|
|
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.
|
|
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.
|
|
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`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.44",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@babel/parser": "^7.29.
|
|
49
|
+
"@babel/parser": "^7.29.9",
|
|
50
|
+
"@vue/shared": "3.5.44",
|
|
50
51
|
"entities": "^7.0.1",
|
|
51
52
|
"estree-walker": "^2.0.2",
|
|
52
|
-
"source-map-js": "^1.2.
|
|
53
|
-
"@vue/shared": "3.5.42"
|
|
53
|
+
"source-map-js": "^1.2.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@babel/types": "^7.29.8"
|