@diffci.com/diffci 0.3.32 → 0.3.34
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/README.md +23 -0
- package/dist-client/src/client/check-plan-junit.d.ts +25 -0
- package/dist-client/src/client/check-plan-junit.js +215 -0
- package/dist-client/src/client/check-plan.d.ts +42 -0
- package/dist-client/src/client/check-plan.js +143 -0
- package/dist-client/src/client/cli.js +212 -7
- package/dist-client/src/client/command-batches.d.ts +1 -0
- package/dist-client/src/client/command-batches.js +3 -1
- package/dist-client/src/client/enforce-misses-collect.js +6 -1
- package/dist-client/src/client/enforce-misses.d.ts +3 -2
- package/dist-client/src/client/enforce-misses.js +19 -59
- package/dist-client/src/client/failure-baseline.js +0 -0
- package/dist-client/src/client/full-command.d.ts +8 -0
- package/dist-client/src/client/full-command.js +31 -0
- package/dist-client/src/client/job-summary.js +1 -1
- package/dist-client/src/client/observe.d.ts +4 -0
- package/dist-client/src/client/observe.js +31 -2
- package/dist-client/src/client/report.d.ts +4 -0
- package/dist-client/src/client/test-results.js +7 -0
- package/dist-client/src/client/verify.d.ts +18 -0
- package/dist-client/src/client/verify.js +39 -10
- package/dist-client/src/client/watch.d.ts +36 -0
- package/dist-client/src/client/watch.js +76 -0
- package/node_modules/@diffci.com/core/README.md +36 -5
- 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 +3 -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.d.ts +12 -0
- package/node_modules/@diffci.com/core/dist/git/git-diff.js +86 -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 +8 -0
- package/node_modules/@diffci.com/core/dist/planner/test-command.js +16 -0
- package/node_modules/@diffci.com/core/dist/planner/test-command.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/adapters/index.js +2 -1
- package/node_modules/@diffci.com/core/dist/repo/adapters/index.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/adapters/python.d.ts +32 -0
- package/node_modules/@diffci.com/core/dist/repo/adapters/python.js +273 -0
- package/node_modules/@diffci.com/core/dist/repo/adapters/python.js.map +1 -0
- package/node_modules/@diffci.com/core/dist/repo/adapters/types.d.ts +2 -0
- package/node_modules/@diffci.com/core/dist/repo/adapters/types.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/file-references.d.ts +15 -0
- package/node_modules/@diffci.com/core/dist/repo/file-references.js +45 -0
- package/node_modules/@diffci.com/core/dist/repo/file-references.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/graph.d.ts +4 -0
- package/node_modules/@diffci.com/core/dist/repo/graph.js +182 -21
- package/node_modules/@diffci.com/core/dist/repo/graph.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/impact.d.ts +1 -0
- package/node_modules/@diffci.com/core/dist/repo/impact.js +37 -9
- package/node_modules/@diffci.com/core/dist/repo/impact.js.map +1 -1
- package/node_modules/@diffci.com/core/dist/repo/types.d.ts +5 -0
- package/node_modules/@diffci.com/core/src/cache/graph-cache.ts +3 -1
- package/node_modules/@diffci.com/core/src/git/git-diff.ts +72 -0
- package/node_modules/@diffci.com/core/src/git/types.ts +5 -0
- package/node_modules/@diffci.com/core/src/planner/test-command.ts +14 -0
- package/node_modules/@diffci.com/core/src/repo/adapters/index.ts +2 -1
- package/node_modules/@diffci.com/core/src/repo/adapters/python.ts +252 -0
- package/node_modules/@diffci.com/core/src/repo/adapters/types.ts +2 -0
- package/node_modules/@diffci.com/core/src/repo/file-references.ts +43 -0
- package/node_modules/@diffci.com/core/src/repo/graph.ts +154 -20
- package/node_modules/@diffci.com/core/src/repo/impact.ts +34 -9
- package/node_modules/@diffci.com/core/src/repo/types.ts +5 -0
- package/package.json +3 -2
|
@@ -8,7 +8,7 @@ import { refineConfidenceForDelta } 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";
|
|
11
|
-
import { directoryWalkers, DIRECTING_EXTENSIONS, infrastructureRole, listsDirectories, loadsWithoutNaming, isImplicitlyLoadedFile, isWorkerConfig, resolveFileReferences, suiteMayRunWorkers, testScriptClosure } from "./file-references.js";
|
|
11
|
+
import { compilerConfigNames, directoryWalkers, DIRECTING_EXTENSIONS, infrastructureRole, isAgentConfigurationPath, listsDirectories, loadsWithoutNaming, isImplicitlyLoadedFile, isWorkerConfig, resolveFileReferences, suiteMayRunWorkers, testScriptClosure } from "./file-references.js";
|
|
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";
|
|
@@ -114,9 +114,11 @@ function shortestDependentPathToTest(graph: DependencyGraph, changedFilePath: st
|
|
|
114
114
|
function collectScriptsAmong(candidates: Iterable<string>, isTestFile: IsTestFile, layout: RepositoryLayout): string[] { const result: string[] = []; for (const path of candidates) { if (isScriptFile(path, layout) && !isTestFile(path)) result.push(path); } return result.sort(); }
|
|
115
115
|
function makeEvidence(reason: ImpactReason, changedFile: string, message: string, affectedFile?: string, path?: ImpactEvidencePath): ImpactEvidence { return { reason, changedFile, affectedFile, message, path }; }
|
|
116
116
|
|
|
117
|
-
function classifyChangedFile(file: ChangedFile, isTestFile: IsTestFile, layout: RepositoryLayout, repositoryFiles?: ReadonlySet<string>, referenceResolved: ReadonlySet<string> = new Set()): ChangedImpact["category"] {
|
|
117
|
+
function classifyChangedFile(file: ChangedFile, isTestFile: IsTestFile, layout: RepositoryLayout, repositoryFiles?: ReadonlySet<string>, referenceResolved: ReadonlySet<string> = new Set(), pythonSources: ReadonlySet<string> = new Set()): ChangedImpact["category"] {
|
|
118
118
|
const path = file.path;
|
|
119
119
|
const oldPath = file.oldPath;
|
|
120
|
+
// Only coding agents read these (file-references.ts, isAgentConfigurationPath).
|
|
121
|
+
if (isAgentConfigurationPath(path) && (!oldPath || isAgentConfigurationPath(oldPath))) return "docs";
|
|
120
122
|
// Content inspection in analyzeGitDelta showed these cannot change how tests run; who reads them is
|
|
121
123
|
// resolved by reference (2026-10-21).
|
|
122
124
|
if (referenceResolved.has(path)) return "unknown";
|
|
@@ -124,7 +126,9 @@ function classifyChangedFile(file: ChangedFile, isTestFile: IsTestFile, layout:
|
|
|
124
126
|
if (isInfrastructureFile(path) || (oldPath && isInfrastructureFile(oldPath))) return "infrastructure";
|
|
125
127
|
if (infrastructureRole(path) === "data") return "unknown";
|
|
126
128
|
if (isDatabaseFile(path) || (oldPath && isDatabaseFile(oldPath))) return "database";
|
|
127
|
-
|
|
129
|
+
// A .py file is code only where the Python adapter modelled it (2026-11-06); elsewhere, such as a
|
|
130
|
+
// script in a JavaScript repository, it stays an unknown file whose readers are resolved by reference.
|
|
131
|
+
if (isSourceFilePath(path) || pythonSources.has(path)) {
|
|
128
132
|
if (isTestFile(path)) return "test";
|
|
129
133
|
if (isScriptFile(path, layout)) return "script";
|
|
130
134
|
if (classifyNextEntryPoint(path, layout)) return "entry-point";
|
|
@@ -259,6 +263,7 @@ export class ImpactAnalyzer {
|
|
|
259
263
|
private dependencyLockfile: string | undefined;
|
|
260
264
|
private packageJsonSpecifiersOnly = false;
|
|
261
265
|
private specifiersOnlyManifests: ReadonlySet<string> = new Set();
|
|
266
|
+
private exportsRemaps: ReadonlyMap<string, { targets: readonly string[]; dataChanged: boolean }> = new Map();
|
|
262
267
|
private readRepositoryFile: ((path: string) => string | undefined) | undefined;
|
|
263
268
|
private sortedRepositoryFiles: string[] = [];
|
|
264
269
|
private compiledProjectCache: CompiledProject[] | undefined;
|
|
@@ -348,7 +353,8 @@ export class ImpactAnalyzer {
|
|
|
348
353
|
this.dependencyLockfile = delta.analysis.dependencyLockfile;
|
|
349
354
|
this.packageJsonSpecifiersOnly = delta.analysis.packageJsonSpecifiersOnly === true;
|
|
350
355
|
this.specifiersOnlyManifests = new Set(delta.analysis.specifiersOnlyManifests ?? []);
|
|
351
|
-
|
|
356
|
+
this.exportsRemaps = new Map(Object.entries(delta.analysis.exportsRemaps ?? {}));
|
|
357
|
+
const changedImpacts: ChangedImpact[] = delta.files.map((file) => ({ file, category: classifyChangedFile(file, this.isTestFile, this.layout, options.repositoryFiles, referenceResolved, new Set(profile.pythonSources ?? [])), reasons: changedFileReasons(file) }));
|
|
352
358
|
const evidence: ImpactEvidence[] = [];
|
|
353
359
|
const riskSignals: ImpactRiskSignal[] = [];
|
|
354
360
|
const fallbackReasons: string[] = [...(graphResult.adapterBlockers ?? []), ...testDiscoveryErrors(profile)];
|
|
@@ -642,7 +648,7 @@ export class ImpactAnalyzer {
|
|
|
642
648
|
fail(`${dependencyChange(name)} and the test script runs it; full validation required`);
|
|
643
649
|
continue;
|
|
644
650
|
}
|
|
645
|
-
const toolingReader = this.sortedRepositoryFiles.find((path) => isImplicitlyLoadedFile(path) && !isLockfile(path) &&
|
|
651
|
+
const toolingReader = this.sortedRepositoryFiles.find((path) => isImplicitlyLoadedFile(path) && !isLockfile(path) && compilerConfigNames(path, this.readRepositoryFile!(path) ?? "", quoted));
|
|
646
652
|
if (toolingReader) {
|
|
647
653
|
fail(`${dependencyChange(name)} and ${toolingReader} loads it; full validation required`);
|
|
648
654
|
continue;
|
|
@@ -701,9 +707,9 @@ export class ImpactAnalyzer {
|
|
|
701
707
|
if (closureBodies.some((body) => named.test(body))) return "the test script runs it";
|
|
702
708
|
const scripts = profile.packageJson.scripts;
|
|
703
709
|
for (const path of this.sortedRepositoryFiles) {
|
|
704
|
-
if (path === "package.json" || isLockfile(path) || this.layout.isDocumentationPath(path)) continue;
|
|
710
|
+
if (path === "package.json" || isLockfile(path) || this.layout.isDocumentationPath(path) || isAgentConfigurationPath(path)) continue;
|
|
705
711
|
const content = this.readRepositoryFile!(path);
|
|
706
|
-
if (content === undefined || !
|
|
712
|
+
if (content === undefined || !compilerConfigNames(path, content, named)) continue;
|
|
707
713
|
if (isImplicitlyLoadedFile(path) || loadsWithoutNaming(path) || posix.basename(path) === "package.json") return `${path} names it and tooling loads that file`;
|
|
708
714
|
if (path.startsWith(".github/")) {
|
|
709
715
|
if (path.startsWith(".github/actions/") || (/^\.github\/workflows\//.test(path) && workflowFeedsTests(content, named, scripts))) return `${path} runs it before tests`;
|
|
@@ -744,6 +750,19 @@ export class ImpactAnalyzer {
|
|
|
744
750
|
this.addAffectedTest(changedPath, test, graph, affectedTests, "DECLARED_INPUT", evidence);
|
|
745
751
|
}
|
|
746
752
|
const covered = this.declaredCovered.has(changedPath);
|
|
753
|
+
// An `exports` remap reaches the importers of each subpath it changed, which depend on the subpath's
|
|
754
|
+
// target at HEAD or at the base. A target gone at HEAD is a changed file of this delta or was never
|
|
755
|
+
// importable; one present but outside the graph has unknown importers.
|
|
756
|
+
for (const target of this.exportsRemaps.get(changedPath)?.targets ?? []) {
|
|
757
|
+
if (hasNode(graph, target)) {
|
|
758
|
+
evidence.push(makeEvidence("DEPENDENCY_MANIFEST", changedPath, `${changedPath} remaps an export to ${target}`, target));
|
|
759
|
+
this.processSourceChange(target, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence);
|
|
760
|
+
} else if (this.repositoryFiles?.has(target) ?? true) {
|
|
761
|
+
const message = `${changedPath} remaps an export to ${target}, which is outside the dependency graph; full validation required`;
|
|
762
|
+
riskSignals.push({ level: "critical", reason: "DEPENDENCY_MANIFEST", message, paths: [changedPath] });
|
|
763
|
+
if (!fallbackReasons.includes(message)) fallbackReasons.push(message);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
747
766
|
// Go's embed metadata is ownership evidence regardless of suffix or documentation naming.
|
|
748
767
|
// Traverse it before generic unknown/docs classification can discard the dependency.
|
|
749
768
|
if (this.goEmbedPaths.has(changedPath)) {
|
|
@@ -790,7 +809,8 @@ export class ImpactAnalyzer {
|
|
|
790
809
|
// A package.json edit limited to dependency requests is covered by dependency selection, like
|
|
791
810
|
// the lockfile above, so finding no reader is not a gap. Tooling that loads a file naming it
|
|
792
811
|
// still is (2026-11-02).
|
|
793
|
-
const specifiersOnly = (changedPath === "package.json" && this.packageJsonSpecifiersOnly) || this.specifiersOnlyManifests.has(changedPath)
|
|
812
|
+
const specifiersOnly = (changedPath === "package.json" && this.packageJsonSpecifiersOnly) || this.specifiersOnlyManifests.has(changedPath)
|
|
813
|
+
|| this.exportsRemaps.get(changedPath)?.dataChanged === false;
|
|
794
814
|
const options = specifiersOnly ? { allowNoReaders: true, implicitReadersUnresolvable: true } : {};
|
|
795
815
|
if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, options)) return;
|
|
796
816
|
if (covered) return;
|
|
@@ -871,6 +891,11 @@ export class ImpactAnalyzer {
|
|
|
871
891
|
if (!fallbackReasons.includes(message)) fallbackReasons.push(message);
|
|
872
892
|
return;
|
|
873
893
|
}
|
|
894
|
+
// A Python file is also run by name: a JavaScript test or script that calls `python scripts/x.py`
|
|
895
|
+
// names it without importing it. Those readers are added to what the Python graph selects (2026-11-06).
|
|
896
|
+
if (changedPath.endsWith(".py") && profile.pythonSources?.includes(changedPath)) {
|
|
897
|
+
this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, { allowNoReaders: true });
|
|
898
|
+
}
|
|
874
899
|
this.processSourceChange(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence);
|
|
875
900
|
}
|
|
876
901
|
|
|
@@ -980,7 +1005,7 @@ export class ImpactAnalyzer {
|
|
|
980
1005
|
files: this.sortedRepositoryFiles,
|
|
981
1006
|
read: this.readRepositoryFile,
|
|
982
1007
|
isTestFile: this.isTestFile,
|
|
983
|
-
isDocumentation: (path) => layout.isDocumentationPath(path),
|
|
1008
|
+
isDocumentation: (path) => layout.isDocumentationPath(path) || isAgentConfigurationPath(path),
|
|
984
1009
|
inGraph: (path) => hasNode(graph, path),
|
|
985
1010
|
isCodeFile: isSourceFilePath,
|
|
986
1011
|
workflowFeedsTests: (content, names) => workflowFeedsTests(content, names, scripts),
|
|
@@ -51,6 +51,11 @@ export interface RepositoryProfile {
|
|
|
51
51
|
goDependencyPaths?: { sources: string[]; embeds: string[] };
|
|
52
52
|
/** Maven/JUnit test file to owning reactor module (repo-relative, "." for root). */
|
|
53
53
|
mavenTestModules?: Record<string, string>;
|
|
54
|
+
/** Python files and pytest test files the Python adapter modelled (adapters/python.ts), and the
|
|
55
|
+
* interpreter it found. Only these `.py` files are code; other `.py` files stay unknown files. */
|
|
56
|
+
pythonSources?: string[];
|
|
57
|
+
pythonTests?: string[];
|
|
58
|
+
pythonInterpreter?: string[];
|
|
54
59
|
/** Nested modules excluded by an explicit root-module execution scope. Changes here force full CI. */
|
|
55
60
|
goExcludedModuleRoots?: string[];
|
|
56
61
|
vueScope?: { packageRoot: string; testConfig: string };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diffci.com/diffci",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.34",
|
|
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,8 @@
|
|
|
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#77aaff901ee8bd7f05ccb573fcf2821d0ba53234",
|
|
80
|
+
"saxes": "6.0.0",
|
|
80
81
|
"yaml": "^2.9.0"
|
|
81
82
|
},
|
|
82
83
|
"devDependencies": {
|