@diffci.com/diffci 0.3.36 → 0.3.38
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/check-plan-junit.js +12 -3
- package/dist-client/src/client/command-batches.d.ts +6 -0
- package/dist-client/src/client/command-batches.js +7 -1
- package/dist-client/src/client/context.d.ts +13 -0
- package/dist-client/src/client/context.js +27 -0
- package/dist-client/src/client/hook.d.ts +7 -0
- package/dist-client/src/client/hook.js +34 -3
- package/dist-client/src/client/node-bin-launch.d.ts +10 -0
- package/dist-client/src/client/node-bin-launch.js +71 -0
- package/dist-client/src/client/observe.js +4 -3
- package/dist-client/src/client/verify-savings.js +18 -11
- package/node_modules/@diffci.com/core/README.md +42 -6
- 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 +1 -1
- package/node_modules/@diffci.com/core/dist/cache/vue-analysis-cache.js +2 -0
- package/node_modules/@diffci.com/core/dist/cache/vue-analysis-cache.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/adapters/types.d.ts +5 -0
- package/node_modules/@diffci.com/core/dist/repo/adapters/types.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/adapters/vue.js +25 -3
- package/node_modules/@diffci.com/core/dist/repo/adapters/vue.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/graph.d.ts +5 -1
- package/node_modules/@diffci.com/core/dist/repo/graph.js +185 -6
- package/node_modules/@diffci.com/core/dist/repo/graph.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/impact.js +6 -1
- package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/types.d.ts +12 -0
- package/node_modules/@diffci.com/core/src/cache/graph-cache.ts +1 -1
- package/node_modules/@diffci.com/core/src/cache/vue-analysis-cache.ts +1 -0
- package/node_modules/@diffci.com/core/src/repo/adapters/types.ts +2 -0
- package/node_modules/@diffci.com/core/src/repo/adapters/vue.ts +15 -3
- package/node_modules/@diffci.com/core/src/repo/graph.ts +152 -6
- package/node_modules/@diffci.com/core/src/repo/impact.ts +5 -1
- package/node_modules/@diffci.com/core/src/repo/types.ts +13 -0
- package/package.json +2 -2
|
@@ -7,6 +7,7 @@ import { adapterFiles, REPOSITORY_ADAPTERS } from "./adapters/index.js";
|
|
|
7
7
|
import { pythonAdapter } from "./adapters/python.js";
|
|
8
8
|
import { analyzeRepository, type AnalyzeRepositoryOptions } from "./analyzer.js";
|
|
9
9
|
import { applyVueScope, inVuePackage } from "./vue-scope.js";
|
|
10
|
+
import { declaredWorkspaceRoots } from "./workspaces.js";
|
|
10
11
|
import type {
|
|
11
12
|
DependencyEdge,
|
|
12
13
|
DependencyEdgeKind,
|
|
@@ -19,6 +20,7 @@ import type {
|
|
|
19
20
|
GraphPerformanceMetrics,
|
|
20
21
|
RepositoryProfile,
|
|
21
22
|
ResolutionReference,
|
|
23
|
+
ScopedAdapterBlocker,
|
|
22
24
|
SourceRoot,
|
|
23
25
|
UnresolvedDependency,
|
|
24
26
|
} from "./types.js";
|
|
@@ -872,13 +874,31 @@ export async function buildDependencyGraph(
|
|
|
872
874
|
? cachedVue(context, options.vueAnalysisCache.directory, options.vueAnalysisCache.version) : adapter.analyze(context));
|
|
873
875
|
markPhase("adapters");
|
|
874
876
|
const adapterBlockers = [...scopeBlockers, ...contributions.flatMap((item) => item.blockers)];
|
|
877
|
+
// The directories each narrowable blocker is confined to ("" when one of its files is not confined).
|
|
878
|
+
// Outside a declared Vue suite, a blocker confined to directories only is scoped to them below.
|
|
879
|
+
const blockerScopes = new Map<string, Set<string>>();
|
|
880
|
+
const addScope = (reason: string, directory: string) => {
|
|
881
|
+
if (scope) return;
|
|
882
|
+
let scopes = blockerScopes.get(reason);
|
|
883
|
+
if (!scopes) blockerScopes.set(reason, scopes = new Set());
|
|
884
|
+
scopes.add(directory);
|
|
885
|
+
};
|
|
886
|
+
const packageDirectories = new Map<string, string>();
|
|
887
|
+
const packageScope = (path: string) => nearestPackageDirectory(repoPath, path, packageDirectories);
|
|
888
|
+
const workspaceRoots = new Set(declaredWorkspaceRoots(repoPath));
|
|
889
|
+
for (const item of contributions) for (const { path, reason } of [...(item.fileBlockers ?? []), ...(item.subjectBlockers ?? [])]) addScope(reason, packageScope(path));
|
|
875
890
|
if (profile.diffciConfig?.configurationError && !adapterBlockers.includes(profile.diffciConfig.configurationError)) adapterBlockers.push(profile.diffciConfig.configurationError);
|
|
876
891
|
if (contributions.some((item) => item.id === "go") && files.some((file) => /\.(?:[cm]?[jt]sx?|vue)$/.test(file))) {
|
|
877
892
|
adapterBlockers.push("Mixed Go/JavaScript repositories require explicit cross-language dependencies; full validation required");
|
|
878
893
|
}
|
|
879
894
|
const pythonModeled = contributions.some((item) => item.id === "python");
|
|
880
|
-
|
|
881
|
-
|
|
895
|
+
const unmodeledLanguageFiles = contributions.length ? files.filter((file) => (!pythonModeled && /\.py$/.test(file)) || /\.(?:rs|cs|svelte|astro)$/.test(file) || !contributions.some((item) => item.id === "maven") && /\.(?:java|kt)$/.test(file)) : [];
|
|
896
|
+
if (unmodeledLanguageFiles.length) {
|
|
897
|
+
const reason = "Unmodeled languages alongside an adapter require full validation";
|
|
898
|
+
adapterBlockers.push(reason);
|
|
899
|
+
// Files in a top-level dot-directory outside every package (agent skills, editor tooling) are confined
|
|
900
|
+
// to that directory: no package's sources or tests can load them.
|
|
901
|
+
for (const file of unmodeledLanguageFiles) addScope(reason, packageScope(file) || (/^\.[^/]+\//.test(file) && !file.startsWith(".github/") ? file.slice(0, file.indexOf("/")) : ""));
|
|
882
902
|
}
|
|
883
903
|
profile.adapters = contributions.map(({ id, version, blockers }) => ({ id, version, blockers }));
|
|
884
904
|
profile.goTestPackages = Object.assign({}, ...contributions.map((item) => item.testPackages));
|
|
@@ -1092,7 +1112,13 @@ export async function buildDependencyGraph(
|
|
|
1092
1112
|
const invalid = !parsed || errors.some(error => error.code !== 18003)
|
|
1093
1113
|
&& !hasUnavailableExternalBase(read.config, errors);
|
|
1094
1114
|
if (invalid) {
|
|
1095
|
-
|
|
1115
|
+
const configRel = toRelativeInternal(repoPath, config);
|
|
1116
|
+
const reason = `Invalid importer TypeScript configuration: ${configRel}`;
|
|
1117
|
+
adapterBlockers.push(reason);
|
|
1118
|
+
// Only the files this configuration governs resolve with the wrong options. That is confined
|
|
1119
|
+
// to a nested package only when no workspace package links to it by name and nothing the
|
|
1120
|
+
// configuration states points outside the package (an alias there would hide its edges).
|
|
1121
|
+
if (configRel) addScope(reason, read.error ? "" : confinedConfigScope(repoPath, configRel, read.config, packageScope(configRel), workspaceRoots));
|
|
1096
1122
|
projectOptions.set(config, compilerOptions);
|
|
1097
1123
|
} else {
|
|
1098
1124
|
// A target newer than the bundled compiler knows is at least its newest one.
|
|
@@ -1287,12 +1313,17 @@ export async function buildDependencyGraph(
|
|
|
1287
1313
|
if (vue?.performance) Object.assign(vue.performance.counts, { verifiedSuiteRoots: roots.length, reachablePaths: reachable.size, outOfSuiteBlockers, runtimeAlwaysRunTests: profile.vueRuntimeAlwaysRunPaths?.length ?? 0 });
|
|
1288
1314
|
}
|
|
1289
1315
|
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1316
|
+
const unresolvedVue = unresolved.filter((ref) => ref.importer.endsWith(".vue") || stripImportQuery(ref.specifier).endsWith(".vue"));
|
|
1317
|
+
if (unresolvedVue.length) {
|
|
1318
|
+
const reason = "Unresolved Vue dependencies require full validation";
|
|
1319
|
+
adapterBlockers.push(reason);
|
|
1320
|
+
for (const ref of unresolvedVue) addScope(reason, packageScope(ref.importer));
|
|
1292
1321
|
}
|
|
1293
1322
|
filesParsed = sourceFiles.length;
|
|
1294
1323
|
if (scope && unresolved.length) adapterBlockers.push("Unresolved dependencies in the declared Vue suite require full validation");
|
|
1295
1324
|
if (scope && edges.some(edge => outsideScope(edge.from) || outsideScope(edge.to))) adapterBlockers.push("Vue asset or macro dependency crosses the declared package boundary");
|
|
1325
|
+
const scopedAdapterBlockers = scopeAdapterBlockers(adapterBlockers, blockerScopes);
|
|
1326
|
+
scopedAdapterBlockers.push(...uninstalledWorkspaceBlockers(repoPath, references, workspaceRoots));
|
|
1296
1327
|
profile.adapterBlockers = [...adapterBlockers];
|
|
1297
1328
|
markPhase("importExtractionAndResolution");
|
|
1298
1329
|
|
|
@@ -1341,13 +1372,15 @@ export async function buildDependencyGraph(
|
|
|
1341
1372
|
|
|
1342
1373
|
const integrity = validateDependencyGraph(graph);
|
|
1343
1374
|
const dynamicUnresolvedCount = unresolved.filter((u) => u.dynamic).length;
|
|
1344
|
-
const
|
|
1375
|
+
const confidenceWithoutScopedBlockers = adapterBlockers.length ? "UNSAFE" : computeConfidence(
|
|
1345
1376
|
unresolved.length,
|
|
1346
1377
|
dynamicUnresolvedCount,
|
|
1347
1378
|
integrity.criticalCount,
|
|
1348
1379
|
profile.stats.sourceFiles,
|
|
1349
1380
|
resolvedViaProjectReferences,
|
|
1350
1381
|
);
|
|
1382
|
+
// The graph's own confidence still counts scoped blockers; only a delta can rule them out.
|
|
1383
|
+
const confidence = scopedAdapterBlockers.length ? "UNSAFE" : confidenceWithoutScopedBlockers;
|
|
1351
1384
|
|
|
1352
1385
|
const internalAssetEdges = edges.filter((e) => e.kind === "asset").length;
|
|
1353
1386
|
const externalReferences = references.filter((r) => r.resolution === "external-package").length;
|
|
@@ -1378,6 +1411,7 @@ export async function buildDependencyGraph(
|
|
|
1378
1411
|
return {
|
|
1379
1412
|
graph,
|
|
1380
1413
|
adapterBlockers,
|
|
1414
|
+
...(scopedAdapterBlockers.length ? { scopedAdapterBlockers, confidenceWithoutScopedBlockers } : {}),
|
|
1381
1415
|
profile,
|
|
1382
1416
|
unresolved,
|
|
1383
1417
|
references,
|
|
@@ -1642,6 +1676,34 @@ function computeConfidence(
|
|
|
1642
1676
|
* sourceFileCount or integrity triggered it. */
|
|
1643
1677
|
export function refineConfidenceForDelta(result: DependencyGraphResult, changedFiles: string[]): GraphConfidence {
|
|
1644
1678
|
if (result.adapterBlockers?.length) return "UNSAFE";
|
|
1679
|
+
if (result.scopedAdapterBlockers?.length) {
|
|
1680
|
+
if (relevantScopedAdapterBlockers(result, changedFiles).length) return "UNSAFE";
|
|
1681
|
+
// An older result without the unscoped confidence fails closed.
|
|
1682
|
+
return refineUnscopedConfidence({ ...result, confidence: result.confidenceWithoutScopedBlockers ?? "UNSAFE" }, changedFiles);
|
|
1683
|
+
}
|
|
1684
|
+
return refineUnscopedConfidence(result, changedFiles);
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
/** The scoped blockers a delta reaches: a changed file, or a file the changed files depend on or that
|
|
1688
|
+
* depends on them, lies inside one of the blocker's package directories. A missing edge starts at a file
|
|
1689
|
+
* inside that directory, so this is stricter than the per-importer narrowing of unresolved imports. */
|
|
1690
|
+
export function relevantScopedAdapterBlockers(result: DependencyGraphResult, changedFiles: string[]): ScopedAdapterBlocker[] {
|
|
1691
|
+
const blockers = result.scopedAdapterBlockers ?? [];
|
|
1692
|
+
if (!blockers.length) return [];
|
|
1693
|
+
const touched = new Set<string>(changedFiles);
|
|
1694
|
+
for (const file of changedFiles) {
|
|
1695
|
+
for (const dep of result.graph.transitiveDependenciesOf(file)) touched.add(dep);
|
|
1696
|
+
for (const dep of result.graph.transitiveDependentsOf(file)) touched.add(dep);
|
|
1697
|
+
}
|
|
1698
|
+
const directories = new Set<string>();
|
|
1699
|
+
for (const path of touched) {
|
|
1700
|
+
let index = path.lastIndexOf("/");
|
|
1701
|
+
while (index > 0) { directories.add(path.slice(0, index)); index = path.lastIndexOf("/", index - 1); }
|
|
1702
|
+
}
|
|
1703
|
+
return blockers.filter((blocker) => blocker.directories.some((directory) => directories.has(directory)));
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
function refineUnscopedConfidence(result: DependencyGraphResult, changedFiles: string[]): GraphConfidence {
|
|
1645
1707
|
// A computed runtime target can be any file, so its missing edge proves nothing about which changed
|
|
1646
1708
|
// file it loads. It cannot, however, change the behaviour of a test that never runs the importer:
|
|
1647
1709
|
// ImpactAnalyzer selects every test that does (COMPUTED_IMPORT) and falls back when the importer is
|
|
@@ -1694,6 +1756,89 @@ export function refineConfidenceForDelta(result: DependencyGraphResult, changedF
|
|
|
1694
1756
|
return result.resolvedViaProjectReferences ? "PARTIAL" : "COMPLETE";
|
|
1695
1757
|
}
|
|
1696
1758
|
|
|
1759
|
+
/** Nearest directory holding a package.json, relative to the repository; "" is the repository root. */
|
|
1760
|
+
function nearestPackageDirectory(repoPath: string, path: string, cache: Map<string, string>): string {
|
|
1761
|
+
const visited: string[] = [];
|
|
1762
|
+
let directory = path.includes("/") ? path.slice(0, path.lastIndexOf("/")) : "";
|
|
1763
|
+
let found = "";
|
|
1764
|
+
while (directory) {
|
|
1765
|
+
const cached = cache.get(directory);
|
|
1766
|
+
if (cached !== undefined) { found = cached; break; }
|
|
1767
|
+
visited.push(directory);
|
|
1768
|
+
if (existsSync(join(repoPath, directory, "package.json"))) { found = directory; break; }
|
|
1769
|
+
directory = directory.includes("/") ? directory.slice(0, directory.lastIndexOf("/")) : "";
|
|
1770
|
+
}
|
|
1771
|
+
for (const item of visited) cache.set(item, found);
|
|
1772
|
+
return found;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
/** The package directory an invalid importer tsconfig is confined to, or "" when it is not: the package
|
|
1776
|
+
* is the repository root or a declared workspace member, or a path the configuration states leaves it. */
|
|
1777
|
+
function confinedConfigScope(repoPath: string, configRel: string, config: unknown, directory: string, workspaceRoots: ReadonlySet<string>): string {
|
|
1778
|
+
if (!directory || workspaceRoots.has(directory) || [...workspaceRoots].some((root) => root.startsWith(`${directory}/`))) return "";
|
|
1779
|
+
const configDirectory = resolve(repoPath, dirname(configRel));
|
|
1780
|
+
const packageRoot = resolve(repoPath, directory);
|
|
1781
|
+
const strings: string[] = [];
|
|
1782
|
+
const collect = (value: unknown): void => {
|
|
1783
|
+
if (typeof value === "string") strings.push(value);
|
|
1784
|
+
else if (Array.isArray(value)) value.forEach(collect);
|
|
1785
|
+
else if (value && typeof value === "object") for (const [key, item] of Object.entries(value)) { strings.push(key); collect(item); }
|
|
1786
|
+
};
|
|
1787
|
+
collect(config);
|
|
1788
|
+
for (const value of strings) {
|
|
1789
|
+
if (!value.includes("..") && !value.startsWith("/") && !/^[A-Za-z]:/.test(value)) continue;
|
|
1790
|
+
const target = relative(packageRoot, resolve(configDirectory, value.replace(/\*.*$/, "")));
|
|
1791
|
+
if (target === ".." || target.startsWith(`..${sep}`) || target.startsWith("../") || /^[A-Za-z]:|^[\\/]/.test(target)) return "";
|
|
1792
|
+
}
|
|
1793
|
+
return directory;
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
/** Moves blockers confined to directories out of `adapterBlockers` and returns them scoped to those
|
|
1797
|
+
* directories (2026-11-08: Sentry's JavaScript SDK keeps 19 Nuxt, SvelteKit and Vue E2E applications whose
|
|
1798
|
+
* tsconfig extends generated `.nuxt/`/`.svelte-kit/` files; they made every change in its SDK packages fall
|
|
1799
|
+
* back to full validation, although no package imports them). A blocker with any unconfined file, or with
|
|
1800
|
+
* no recorded files, stays global. */
|
|
1801
|
+
function scopeAdapterBlockers(adapterBlockers: string[], scopes: Map<string, Set<string>>): ScopedAdapterBlocker[] {
|
|
1802
|
+
const scoped = new Map<string, Set<string>>();
|
|
1803
|
+
for (const reason of new Set(adapterBlockers)) {
|
|
1804
|
+
const directories = scopes.get(reason);
|
|
1805
|
+
if (!directories?.size || directories.has("")) continue;
|
|
1806
|
+
scoped.set(reason, directories);
|
|
1807
|
+
}
|
|
1808
|
+
for (let i = adapterBlockers.length - 1; i >= 0; i--) if (scoped.has(adapterBlockers[i]!)) adapterBlockers.splice(i, 1);
|
|
1809
|
+
return [...scoped].map(([reason, directories]) => ({ reason, directories: [...directories].sort() }));
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
/** A declared workspace package imported by name that resolves to no repository file, typically because
|
|
1813
|
+
* dependencies are not installed, hides every edge into that package (2026-11-08: in an uninstalled
|
|
1814
|
+
* Sentry checkout, 18 packages import `@sentry/server-utils`, and none of those edges existed). A change
|
|
1815
|
+
* reaching the package then falls back instead of skipping its dependents. */
|
|
1816
|
+
function uninstalledWorkspaceBlockers(repoPath: string, references: ResolutionReference[], workspaceRoots: ReadonlySet<string>): ScopedAdapterBlocker[] {
|
|
1817
|
+
const external = references.filter((ref) => ref.resolution === "external-package");
|
|
1818
|
+
if (!external.length) return [];
|
|
1819
|
+
const packages = new Map<string, string>();
|
|
1820
|
+
for (const root of workspaceRoots) {
|
|
1821
|
+
try {
|
|
1822
|
+
const name = JSON.parse(readFileSync(join(repoPath, root, "package.json"), "utf8"))?.name;
|
|
1823
|
+
if (typeof name === "string" && name) packages.set(name, root);
|
|
1824
|
+
} catch { /* an unreadable manifest names no package */ }
|
|
1825
|
+
}
|
|
1826
|
+
if (!packages.size) return [];
|
|
1827
|
+
const importers = new Map<string, Set<string>>();
|
|
1828
|
+
for (const ref of external) {
|
|
1829
|
+
const parts = ref.specifier.split("/");
|
|
1830
|
+
const name = ref.specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0]!;
|
|
1831
|
+
if (!packages.has(name)) continue;
|
|
1832
|
+
let set = importers.get(name);
|
|
1833
|
+
if (!set) importers.set(name, set = new Set());
|
|
1834
|
+
set.add(ref.importer);
|
|
1835
|
+
}
|
|
1836
|
+
return [...importers].sort(([a], [b]) => a.localeCompare(b)).map(([name, files]) => ({
|
|
1837
|
+
reason: `Workspace package ${name} is imported by ${files.size} file${files.size === 1 ? "" : "s"} but does not resolve to its repository sources; install and link dependencies before analysis`,
|
|
1838
|
+
directories: [packages.get(name)!],
|
|
1839
|
+
}));
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1697
1842
|
/** Why the graph's own confidence is below COMPLETE, in counts only (no paths), so a report can say why a
|
|
1698
1843
|
* repository-wide UNSAFE did not decide this change's verdict. 2026-11-06: every LobeHub receipt read
|
|
1699
1844
|
* "UNSAFE" beside "safe to propose" with nothing connecting the two. Empty when the graph is COMPLETE. */
|
|
@@ -1703,6 +1848,7 @@ export function explainGraphConfidence(result: DependencyGraphResult): string[]
|
|
|
1703
1848
|
if (result.graph.nodes.every((node) => !node.isSource)) reasons.push("no source files were analysed");
|
|
1704
1849
|
if (result.integrity.criticalCount > 0) reasons.push(`${plural(result.integrity.criticalCount, "graph integrity problem")}; every change falls back to full validation`);
|
|
1705
1850
|
if (result.adapterBlockers?.length) reasons.push(`${plural(result.adapterBlockers.length, "unsupported framework or language relationship")}; every change falls back to full validation`);
|
|
1851
|
+
if (result.scopedAdapterBlockers?.length) reasons.push(`${plural(result.scopedAdapterBlockers.length, "unsupported relationship")} confined to package directories; a change that reaches one falls back to full validation`);
|
|
1706
1852
|
const computed = result.unresolved.filter((ref) => ref.computed);
|
|
1707
1853
|
const staticRefs = result.unresolved.filter((ref) => !ref.computed);
|
|
1708
1854
|
if (computed.length) {
|
|
@@ -4,7 +4,7 @@ import { inVuePackage } from "./vue-scope.js";
|
|
|
4
4
|
import type { ChangedFile, GitDelta } from "../git/types.js";
|
|
5
5
|
import type { DependencyGraph, DependencyGraphNode, DependencyGraphResult, EntryPoint, RepositoryProfile, UnresolvedDependency } from "./types.js";
|
|
6
6
|
import type { ChangedImpact, EntryPointImpact, ImpactEvidence, ImpactEvidencePath, ImpactReason, ImpactResult, ImpactRiskSignal, TestImpact } from "./impact-types.js";
|
|
7
|
-
import { refineConfidenceForDelta } from "./graph.js";
|
|
7
|
+
import { refineConfidenceForDelta, relevantScopedAdapterBlockers } from "./graph.js";
|
|
8
8
|
import { repositoryLayout, UNKNOWN_REPOSITORY_LAYOUT, type RepositoryLayout } from "./layout.js";
|
|
9
9
|
import { DEFAULT_TEST_FILE_MATCHER, matchesGlob as matchesTestGlob, testDiscoveryErrors, testFileMatcherForProfile } from "./test-discovery.js";
|
|
10
10
|
import { resolveTestFixtureOwners } from "./test-fixture-ownership.js";
|
|
@@ -406,6 +406,10 @@ export class ImpactAnalyzer {
|
|
|
406
406
|
// delta-independent confidence to THIS delta's changed files - see refineConfidenceForDelta()'s doc
|
|
407
407
|
// comment in graph.ts for the full reasoning and what is (and is deliberately NOT) narrowed.
|
|
408
408
|
const changedPaths = delta.files.flatMap((f) => allChangePaths(f));
|
|
409
|
+
// A blocker confined to package directories names itself only when this delta reaches one of them.
|
|
410
|
+
for (const blocker of relevantScopedAdapterBlockers(graphResult, changedPaths)) {
|
|
411
|
+
if (!fallbackReasons.includes(blocker.reason)) fallbackReasons.push(blocker.reason);
|
|
412
|
+
}
|
|
409
413
|
const effectiveGraphConfidence = refineConfidenceForDelta(graphResult, changedPaths);
|
|
410
414
|
|
|
411
415
|
if (effectiveGraphConfidence === "UNSAFE") {
|
|
@@ -237,9 +237,22 @@ export interface GraphPerformanceMetrics {
|
|
|
237
237
|
filesParsed: number;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
/** A framework/language blocker whose missing relationships belong to files inside known package
|
|
241
|
+
* directories (an E2E test application with a generated tsconfig, a Nuxt app). It decides a delta only
|
|
242
|
+
* when a changed file, or a file reachable from one, lies inside one of those directories. */
|
|
243
|
+
export interface ScopedAdapterBlocker {
|
|
244
|
+
reason: string;
|
|
245
|
+
/** Repository-relative package directories, never the repository root. */
|
|
246
|
+
directories: string[];
|
|
247
|
+
}
|
|
248
|
+
|
|
240
249
|
export interface DependencyGraphResult {
|
|
241
250
|
/** Missing framework/language relationships are global, not reachability-narrowable. */
|
|
242
251
|
adapterBlockers?: string[];
|
|
252
|
+
/** Blockers confined to package directories; see ScopedAdapterBlocker. `confidence` still counts them. */
|
|
253
|
+
scopedAdapterBlockers?: ScopedAdapterBlocker[];
|
|
254
|
+
/** What `confidence` would be if no scoped blocker applied. Absent means none was recorded. */
|
|
255
|
+
confidenceWithoutScopedBlockers?: GraphConfidence;
|
|
243
256
|
graph: DependencyGraph;
|
|
244
257
|
profile: RepositoryProfile;
|
|
245
258
|
unresolved: UnresolvedDependency[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diffci.com/diffci",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.38",
|
|
4
4
|
"description": "Fail-closed, change-aware verification for AI coding agents with conservative affected-test selection",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"test": "node scripts/run-tests.mjs"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@diffci.com/core": "git+https://github.com/DiffCI/core.git#
|
|
79
|
+
"@diffci.com/core": "git+https://github.com/DiffCI/core.git#a50b0ef2d936fc82f0a82110532d1788f150a541",
|
|
80
80
|
"saxes": "6.0.0",
|
|
81
81
|
"yaml": "^2.9.0"
|
|
82
82
|
},
|