@diffci.com/diffci 0.3.50 → 0.3.51

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.
@@ -51,9 +51,24 @@ type IsTestFile = (filePath: string) => boolean;
51
51
  // exact directories.
52
52
  function isScriptFile(filePath: string, layout: RepositoryLayout): boolean { return layout.isScriptPath(filePath); }
53
53
  function isDocumentationFile(filePath: string, layout: RepositoryLayout): boolean { return layout.isDocumentationPath(filePath); }
54
+ /**
55
+ * What a tool configuration file controls, when that is worth naming in the fallback reason
56
+ * (issue #142). A change to one of these falls back to the full suite either way; "Unknown changed
57
+ * file" made a deliberate decision read like a gap in DiffCI. Returns undefined for the files that
58
+ * stay under the general configuration sentence.
59
+ */
60
+ function toolConfigurationSubject(filePath: string): string | undefined {
61
+ const base = posix.basename(filePath);
62
+ if (base === ".nvmrc" || base === ".node-version") return "Node version";
63
+ if (base === ".npmrc") return "package manager settings";
64
+ return undefined;
65
+ }
66
+
54
67
  function isConfigFile(filePath: string): boolean {
55
- const CONFIG_FILE_NAMES = new Set(["package.json","package-lock.json","yarn.lock","pnpm-lock.yaml","bun.lockb","bun.lock","tsconfig.json","tsconfig.base.json","tsconfig.build.json","jsconfig.json"]);
68
+ const CONFIG_FILE_NAMES = new Set(["package.json","tsconfig.json","tsconfig.base.json","tsconfig.build.json","jsconfig.json"]);
56
69
  const base = posix.basename(filePath);
70
+ // Every lockfile in the shared pattern (issue #97); the old copy here lacked npm-shrinkwrap.json.
71
+ if (LOCKFILE.test(base)) return true;
57
72
  if (["go.mod", "go.sum", "go.work", "go.work.sum"].includes(base)) return true;
58
73
  if (/^(?:vite|vue|nuxt)\.config\./.test(base)) return true;
59
74
  if (CONFIG_FILE_NAMES.has(base)) return true;
@@ -824,6 +839,20 @@ export class ImpactAnalyzer {
824
839
  paths = paths.filter((path) => !isWorkerConfig(path));
825
840
  if (paths.length === 0) continue;
826
841
  }
842
+ if (rule.signal === "config" && paths.length > 0) {
843
+ // A tool configuration we can name is reported by name, not folded into the generic sentence,
844
+ // so a reader sees which file decided the full run (issue #142).
845
+ const named = paths.filter((path) => toolConfigurationSubject(path) !== undefined);
846
+ if (named.length > 0) {
847
+ for (const path of named) {
848
+ const message = `Tool configuration changed: ${toolConfigurationSubject(path)} (${path}); full validation required`;
849
+ riskSignals.push({ level: "critical", reason: "CONFIG_GLOBAL", message, paths: [path] });
850
+ if (!fallbackReasons.includes(message)) fallbackReasons.push(message);
851
+ }
852
+ paths = paths.filter((path) => toolConfigurationSubject(path) === undefined);
853
+ if (paths.length === 0) continue;
854
+ }
855
+ }
827
856
  if ((rule.signal === "infrastructure" || rule.signal === "database") && paths.length > 0) {
828
857
  // A database or deployment definition the repository declared inputs for selects those tests in
829
858
  // processChangedPath. Configuration, manifests, lockfiles and workflows stay global (2026-11-05).
@@ -1124,9 +1153,16 @@ export class ImpactAnalyzer {
1124
1153
  const specifiersOnly = (changedPath === "package.json" && this.packageJsonSpecifiersOnly) || this.specifiersOnlyManifests.has(changedPath)
1125
1154
  || this.exportsRemaps.get(changedPath)?.dataChanged === false;
1126
1155
  const options = specifiersOnly ? { allowNoReaders: true, implicitReadersUnresolvable: true } : {};
1127
- if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, options)) return;
1156
+ // A tool configuration we recognise by name gets a reason that says what it controls, whether or
1157
+ // not some file happens to reference it: a reader of `.mocharc.json` cannot prove which tests
1158
+ // notice a change to the runner's settings, so this is still a full run (issue #142).
1159
+ if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence, options)
1160
+ && toolConfigurationSubject(changedPath) === undefined) return;
1128
1161
  if (covered) return;
1129
- const message = `Unknown changed file: ${changedPath}`;
1162
+ const subject = toolConfigurationSubject(changedPath);
1163
+ const message = subject
1164
+ ? `Tool configuration changed: ${subject} (${changedPath}); full validation required`
1165
+ : `Unknown changed file: ${changedPath}`;
1130
1166
  evidence.push(makeEvidence("UNKNOWN_FILE", changedPath, message));
1131
1167
  riskSignals.push({ level: "critical", reason: "UNKNOWN_FILE", message, paths: [changedPath] });
1132
1168
  if (!fallbackReasons.includes(message)) fallbackReasons.push(message);
@@ -1142,9 +1178,15 @@ export class ImpactAnalyzer {
1142
1178
  // tried, so a fixture no module imports is claimed here (2026-11-05: LobeHub's
1143
1179
  // src/spawn/__fixtures__/copilotAcp/handshake.json beside the spawn tests).
1144
1180
  if (this.claimFixture(changedPath, graph, affectedTests, evidence)) return;
1145
- if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence)) return;
1181
+ if (this.resolveByReference(changedPath, graph, profile, affectedSources, affectedEntryPoints, affectedTests, affectedScripts, evidence)
1182
+ && toolConfigurationSubject(changedPath) === undefined) return;
1146
1183
  if (covered) return;
1147
- const message = `Unknown changed file: ${changedPath}`;
1184
+ // `.mocharc.json` is an asset by extension; it is still a runner configuration, so it keeps the
1185
+ // reason that says so (issue #142).
1186
+ const subject = toolConfigurationSubject(changedPath);
1187
+ const message = subject
1188
+ ? `Tool configuration changed: ${subject} (${changedPath}); full validation required`
1189
+ : `Unknown changed file: ${changedPath}`;
1148
1190
  evidence.push(makeEvidence("UNKNOWN_FILE", changedPath, message));
1149
1191
  riskSignals.push({ level: "critical", reason: "UNKNOWN_FILE", message, paths: [changedPath] });
1150
1192
  if (!fallbackReasons.includes(message)) fallbackReasons.push(message);
@@ -2,6 +2,7 @@
2
2
  import type { TaskRegistry } from "../../planner/task-registry.js";
3
3
  import { matchesAny } from "./matcher.js";
4
4
  import type { ChangedFile } from "../../git/types.js";
5
+ import { LOCKFILE } from "../../repo/lockfiles.js";
5
6
 
6
7
  export interface GenericPathBaselineResult {
7
8
  selectedTaskIds: string[];
@@ -51,7 +52,8 @@ export function runGenericPathBaseline(taskRegistry: TaskRegistry, changedFiles:
51
52
 
52
53
  function globalFallbackPattern(path: string): boolean {
53
54
  const p = path.toLowerCase();
54
- if (["package.json", "package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lock", "bun.lockb", "go.mod", "go.sum", "requirements.txt", "setup.py", "pyproject.toml", "cargo.toml", "cargo.lock", "pom.xml", "build.gradle", "gradle.lockfile"].includes(p)) return true;
55
+ if (LOCKFILE.test(p)) return true;
56
+ if (["package.json", "go.mod", "go.sum", "requirements.txt", "setup.py", "pyproject.toml", "cargo.toml", "cargo.lock", "pom.xml", "build.gradle", "gradle.lockfile"].includes(p)) return true;
55
57
  if (p.startsWith(".github/workflows/")) return true;
56
58
  if (p.startsWith("database/") || p.startsWith("migrations/")) return true;
57
59
  if (p.startsWith("ops/") || p.startsWith("terraform/") || p.startsWith("docker") || p.includes("dockerfile")) return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diffci.com/diffci",
3
- "version": "0.3.50",
3
+ "version": "0.3.51",
4
4
  "description": "Verification for AI coding agents: runs the tests and checks a change affects, with full fallback and a receipt",
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#8fa0a1655c5aa56e31c803a8154ce690bf49fc9a",
79
+ "@diffci.com/core": "git+https://github.com/DiffCI/core.git#a35ef3130395ea210b3b2414e584c02603b61eea",
80
80
  "saxes": "6.0.0",
81
81
  "yaml": "^2.9.0"
82
82
  },