@diffci.com/diffci 0.3.32 → 0.3.33
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.js +21 -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 +29 -4
- 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 +19 -0
- package/node_modules/@diffci.com/core/src/repo/graph.ts +154 -20
- package/node_modules/@diffci.com/core/src/repo/impact.ts +27 -4
- package/node_modules/@diffci.com/core/src/repo/types.ts +5 -0
- package/package.json +3 -2
|
@@ -114,7 +114,7 @@ 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
120
|
// Content inspection in analyzeGitDelta showed these cannot change how tests run; who reads them is
|
|
@@ -124,7 +124,9 @@ function classifyChangedFile(file: ChangedFile, isTestFile: IsTestFile, layout:
|
|
|
124
124
|
if (isInfrastructureFile(path) || (oldPath && isInfrastructureFile(oldPath))) return "infrastructure";
|
|
125
125
|
if (infrastructureRole(path) === "data") return "unknown";
|
|
126
126
|
if (isDatabaseFile(path) || (oldPath && isDatabaseFile(oldPath))) return "database";
|
|
127
|
-
|
|
127
|
+
// A .py file is code only where the Python adapter modelled it (2026-11-06); elsewhere, such as a
|
|
128
|
+
// script in a JavaScript repository, it stays an unknown file whose readers are resolved by reference.
|
|
129
|
+
if (isSourceFilePath(path) || pythonSources.has(path)) {
|
|
128
130
|
if (isTestFile(path)) return "test";
|
|
129
131
|
if (isScriptFile(path, layout)) return "script";
|
|
130
132
|
if (classifyNextEntryPoint(path, layout)) return "entry-point";
|
|
@@ -259,6 +261,7 @@ export class ImpactAnalyzer {
|
|
|
259
261
|
private dependencyLockfile: string | undefined;
|
|
260
262
|
private packageJsonSpecifiersOnly = false;
|
|
261
263
|
private specifiersOnlyManifests: ReadonlySet<string> = new Set();
|
|
264
|
+
private exportsRemaps: ReadonlyMap<string, { targets: readonly string[]; dataChanged: boolean }> = new Map();
|
|
262
265
|
private readRepositoryFile: ((path: string) => string | undefined) | undefined;
|
|
263
266
|
private sortedRepositoryFiles: string[] = [];
|
|
264
267
|
private compiledProjectCache: CompiledProject[] | undefined;
|
|
@@ -348,7 +351,8 @@ export class ImpactAnalyzer {
|
|
|
348
351
|
this.dependencyLockfile = delta.analysis.dependencyLockfile;
|
|
349
352
|
this.packageJsonSpecifiersOnly = delta.analysis.packageJsonSpecifiersOnly === true;
|
|
350
353
|
this.specifiersOnlyManifests = new Set(delta.analysis.specifiersOnlyManifests ?? []);
|
|
351
|
-
|
|
354
|
+
this.exportsRemaps = new Map(Object.entries(delta.analysis.exportsRemaps ?? {}));
|
|
355
|
+
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
356
|
const evidence: ImpactEvidence[] = [];
|
|
353
357
|
const riskSignals: ImpactRiskSignal[] = [];
|
|
354
358
|
const fallbackReasons: string[] = [...(graphResult.adapterBlockers ?? []), ...testDiscoveryErrors(profile)];
|
|
@@ -744,6 +748,19 @@ export class ImpactAnalyzer {
|
|
|
744
748
|
this.addAffectedTest(changedPath, test, graph, affectedTests, "DECLARED_INPUT", evidence);
|
|
745
749
|
}
|
|
746
750
|
const covered = this.declaredCovered.has(changedPath);
|
|
751
|
+
// An `exports` remap reaches the importers of each subpath it changed, which depend on the subpath's
|
|
752
|
+
// target at HEAD or at the base. A target gone at HEAD is a changed file of this delta or was never
|
|
753
|
+
// importable; one present but outside the graph has unknown importers.
|
|
754
|
+
for (const target of this.exportsRemaps.get(changedPath)?.targets ?? []) {
|
|
755
|
+
if (hasNode(graph, target)) {
|
|
756
|
+
evidence.push(makeEvidence("DEPENDENCY_MANIFEST", changedPath, `${changedPath} remaps an export to ${target}`, target));
|
|
757
|
+
this.processSourceChange(target, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence);
|
|
758
|
+
} else if (this.repositoryFiles?.has(target) ?? true) {
|
|
759
|
+
const message = `${changedPath} remaps an export to ${target}, which is outside the dependency graph; full validation required`;
|
|
760
|
+
riskSignals.push({ level: "critical", reason: "DEPENDENCY_MANIFEST", message, paths: [changedPath] });
|
|
761
|
+
if (!fallbackReasons.includes(message)) fallbackReasons.push(message);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
747
764
|
// Go's embed metadata is ownership evidence regardless of suffix or documentation naming.
|
|
748
765
|
// Traverse it before generic unknown/docs classification can discard the dependency.
|
|
749
766
|
if (this.goEmbedPaths.has(changedPath)) {
|
|
@@ -790,7 +807,8 @@ export class ImpactAnalyzer {
|
|
|
790
807
|
// A package.json edit limited to dependency requests is covered by dependency selection, like
|
|
791
808
|
// the lockfile above, so finding no reader is not a gap. Tooling that loads a file naming it
|
|
792
809
|
// still is (2026-11-02).
|
|
793
|
-
const specifiersOnly = (changedPath === "package.json" && this.packageJsonSpecifiersOnly) || this.specifiersOnlyManifests.has(changedPath)
|
|
810
|
+
const specifiersOnly = (changedPath === "package.json" && this.packageJsonSpecifiersOnly) || this.specifiersOnlyManifests.has(changedPath)
|
|
811
|
+
|| this.exportsRemaps.get(changedPath)?.dataChanged === false;
|
|
794
812
|
const options = specifiersOnly ? { allowNoReaders: true, implicitReadersUnresolvable: true } : {};
|
|
795
813
|
if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, options)) return;
|
|
796
814
|
if (covered) return;
|
|
@@ -871,6 +889,11 @@ export class ImpactAnalyzer {
|
|
|
871
889
|
if (!fallbackReasons.includes(message)) fallbackReasons.push(message);
|
|
872
890
|
return;
|
|
873
891
|
}
|
|
892
|
+
// A Python file is also run by name: a JavaScript test or script that calls `python scripts/x.py`
|
|
893
|
+
// names it without importing it. Those readers are added to what the Python graph selects (2026-11-06).
|
|
894
|
+
if (changedPath.endsWith(".py") && profile.pythonSources?.includes(changedPath)) {
|
|
895
|
+
this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, { allowNoReaders: true });
|
|
896
|
+
}
|
|
874
897
|
this.processSourceChange(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence);
|
|
875
898
|
}
|
|
876
899
|
|
|
@@ -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.33",
|
|
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#bad141841d434f1079a2f84216640c6af5f413f9",
|
|
80
|
+
"saxes": "6.0.0",
|
|
80
81
|
"yaml": "^2.9.0"
|
|
81
82
|
},
|
|
82
83
|
"devDependencies": {
|