From 710cda299580cd2e40ef58ead65e1b22597a7dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E8=BE=BE=E6=98=8E?= <83948628+tyza66@users.noreply.github.com> Date: Wed, 18 Nov 2026 17:41:48 +0800 Subject: [PATCH] fix(impact): name tool-version files instead of reporting them as unknown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `.tool-versions`, `mise.toml`, `.mise.toml` and `.bun-version` pick the Node, Python or Bun version the suite runs on, so a change to one of them runs the full suite. That is right, but the reason was `Unknown changed file: .tool-versions`, which reads like a gap in DiffCI rather than a decision. The four files join `CONFIG_PATTERNS` so they reach the configuration signal, and `toolConfigurationSubject` gives them a name: `tool versions` for the asdf and mise files, `Bun version` for `.bun-version`. That is the pattern from #142 and its PRs. - `.tool-versions`, `mise.toml` and `.mise.toml` share one subject, since asdf and mise are the same idea in two file formats. - `mise.toml` is listed both with and without the leading dot, which is how mise allows that file to be named. - `tests/repo/tool-config-reasons.test.ts` has one case per file, through the existing body that asserts the plan stays FULL, every test is selected and the reason no longer says "Unknown". - `tests/repo/config-patterns.test.ts` gets one example per new pattern, which is what keeps a pattern and its example in step. - The `Tool configuration changed` row in `docs/using-diffci.md` lists them. Nothing else changes: the lockfile narrowing in `src/git/git-diff.ts` is not touched, and none of these files selects or deselects a test by itself. Signed-off-by: 孙达明 <83948628+tyza66@users.noreply.github.com> --- docs/using-diffci.md | 2 +- src/git/git-diff.ts | 6 ++++++ src/repo/impact.ts | 2 ++ tests/repo/config-patterns.test.ts | 3 +++ tests/repo/tool-config-reasons.test.ts | 5 +++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/using-diffci.md b/docs/using-diffci.md index a1e06fce..47aaedd1 100644 --- a/docs/using-diffci.md +++ b/docs/using-diffci.md @@ -606,7 +606,7 @@ For `Unknown changed file` and `Deleted source/asset`, `observe --json` also ret | `Infrastructure definition(s) changed; full validation required` | Edit a `Dockerfile` or `terraform/main.tf` | Yes: declare it in `inputs` | | `Database definition(s) changed; full validation required` | Add a file under `migrations/` | Yes: declare it in `inputs` | | `Language/framework configuration changed: …` | Edit `go.mod` or `pom.xml` | No | -| `Tool configuration changed: … (…); full validation required` | Change `.nvmrc`, `.node-version`, `.npmrc`, `.mocharc.*`, `tsconfig.base.json` or `tsconfig.test.json` | No | +| `Tool configuration changed: … (…); full validation required` | Change `.nvmrc`, `.node-version`, `.npmrc`, `.mocharc.*`, `tsconfig.base.json`, `tsconfig.test.json`, `.tool-versions`, `mise.toml`, `.mise.toml` or `.bun-version` | No | | `Code that no file imports changed: …; a tool may load it by name, so full validation required` | Edit `karma.conf.js`, `.c8rc.js` or a root-level script that nothing imports | Yes: declare it in `inputs` | | `The test script runs …; full validation required` | Edit `scripts/check.mjs` when `package.json` has `"test": "node scripts/check.mjs && node --test"` | Yes: `verify` and the agent tools run that phase instead when it runs the program alone (`node scripts/check.mjs`) | | `The test script runs …, which imports …; full validation required` | Edit a module that `scripts/check.mjs` imports, with the same test script | Same as above | diff --git a/src/git/git-diff.ts b/src/git/git-diff.ts index 64bc9b78..dfb6a4e6 100644 --- a/src/git/git-diff.ts +++ b/src/git/git-diff.ts @@ -252,6 +252,12 @@ export const CONFIG_PATTERNS = [ // `.mocharc.js` as code with no importers, so neither reached the configuration signals; both // decide how the suite runs. /^\.mocharc(?:\.[^/]+)?$/, + // Tool versions (issue #321). asdf, mise and Bun pick the toolchain the suite runs on, so a change + // falls back to the full suite; these entries make the reason name the file instead of reporting it + // as unknown. + /^\.tool-versions$/, + /^\.?mise\.toml$/, + /^\.bun-version$/, ]; // Stage 1B fix (2026-08-21, docs/research/2026-08-21-stage1b-*.md): root-caused in Stage 1A's fallback- diff --git a/src/repo/impact.ts b/src/repo/impact.ts index 34a7322f..0d70181a 100644 --- a/src/repo/impact.ts +++ b/src/repo/impact.ts @@ -67,6 +67,8 @@ function toolConfigurationSubject(filePath: string): string | undefined { if (base === ".npmrc") return "package manager settings"; if (/^tsconfig\.[^/]+\.json$/.test(base) || /^jsconfig\.[^/]+\.json$/.test(base)) return "TypeScript configuration"; if (base === ".mocharc" || base.startsWith(".mocharc.")) return "Mocha settings"; + if (base === ".tool-versions" || base === "mise.toml" || base === ".mise.toml") return "tool versions"; + if (base === ".bun-version") return "Bun version"; return undefined; } diff --git a/tests/repo/config-patterns.test.ts b/tests/repo/config-patterns.test.ts index 75962785..4d2e8f08 100644 --- a/tests/repo/config-patterns.test.ts +++ b/tests/repo/config-patterns.test.ts @@ -54,6 +54,9 @@ const EXAMPLES = [ ".node-version", ".npmrc", ".mocharc.json", + ".tool-versions", + "mise.toml", + ".bun-version", ]; test("every CONFIG_PATTERNS entry has one real file name in the table", () => { diff --git a/tests/repo/tool-config-reasons.test.ts b/tests/repo/tool-config-reasons.test.ts index c6f3e6ce..0be4a217 100644 --- a/tests/repo/tool-config-reasons.test.ts +++ b/tests/repo/tool-config-reasons.test.ts @@ -55,6 +55,11 @@ const CASES: Array<{ file: string; before: string; after: string; reason: string { file: ".nvmrc", before: "22\n", after: "24\n", reason: "Tool configuration changed: Node version" }, { file: ".node-version", before: "22.5.0\n", after: "24.1.0\n", reason: "Tool configuration changed: Node version" }, { file: ".npmrc", before: "save-exact=true\n", after: "save-exact=false\n", reason: "Tool configuration changed: package manager settings" }, + // Tool versions (issue #321): the Node, Python and Bun versions the suite runs on. + { file: ".tool-versions", before: "nodejs 22.5.0\n", after: "nodejs 24.1.0\n", reason: "Tool configuration changed: tool versions" }, + { file: "mise.toml", before: '[tools]\nnode = "22.5.0"\n', after: '[tools]\nnode = "24.1.0"\n', reason: "Tool configuration changed: tool versions" }, + { file: ".mise.toml", before: '[tools]\nnode = "22.5.0"\n', after: '[tools]\nnode = "24.1.0"\n', reason: "Tool configuration changed: tool versions" }, + { file: ".bun-version", before: "1.1.0\n", after: "1.2.0\n", reason: "Tool configuration changed: Bun version" }, ]; for (const { file, before, after, reason } of CASES) {