From ee42255719c77a4b44511311d8bad356c7416aef Mon Sep 17 00:00:00 2001 From: L-zeus <1956795691@qq.com> Date: Wed, 2 Dec 2026 22:12:33 +0800 Subject: [PATCH] Name Python tool configuration in full-suite fallback reasons Signed-off-by: L-zeus <1956795691@qq.com> --- docs/using-diffci.md | 2 ++ src/repo/impact.ts | 11 +++++++++-- tests/repo/tool-config-reasons.test.ts | 5 +++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/using-diffci.md b/docs/using-diffci.md index 15ca968..414b8e5 100644 --- a/docs/using-diffci.md +++ b/docs/using-diffci.md @@ -760,6 +760,8 @@ _Module resource and dependency impact contributed by [@FredApps](https://github These appear only in Python projects (a root `pyproject.toml`, `setup.py`, `setup.cfg`, `pytest.toml`, `.pytest.toml`, `pytest.ini`, `.pytest.ini`, `tox.ini` or `conftest.py`). A changed project file such as `pyproject.toml` or `requirements.txt` falls back under `Configuration file(s) changed`. +When a change to `uv.toml`, `poetry.toml`, `pdm.toml` or `hatch.toml` already requires the full suite, DiffCI reports `Tool configuration changed: Python packaging settings`. For `.coveragerc`, it reports `Tool configuration changed: coverage settings`. + | Reason | Example change | Narrow | | --- | --- | --- | | `Python file could not be parsed (…): …` | A `.py` file with a syntax error | Fix: make the file parse | diff --git a/src/repo/impact.ts b/src/repo/impact.ts index 3a01d38..d22956c 100644 --- a/src/repo/impact.ts +++ b/src/repo/impact.ts @@ -78,8 +78,15 @@ function toolConfigurationSubject(filePath: string): string | undefined { // Name these settings only after reader resolution or the orphan-code check requires a full run. function toolConfigurationReason(filePath: string, subject?: string): string | undefined { - if (!subject && [".yarnrc.yml", ".yarnrc", "bunfig.toml", ".pnpmfile.cjs"].includes(posix.basename(filePath))) { - subject = "package manager settings"; + if (!subject) { + const base = posix.basename(filePath); + if ([".yarnrc.yml", ".yarnrc", "bunfig.toml", ".pnpmfile.cjs"].includes(base)) { + subject = "package manager settings"; + } else if (["uv.toml", "poetry.toml", "pdm.toml", "hatch.toml"].includes(base)) { + subject = "Python packaging settings"; + } else if (base === ".coveragerc") { + subject = "coverage settings"; + } } return subject && `Tool configuration changed: ${subject} (${filePath}); full validation required`; } diff --git a/tests/repo/tool-config-reasons.test.ts b/tests/repo/tool-config-reasons.test.ts index 5428afa..9d94cb1 100644 --- a/tests/repo/tool-config-reasons.test.ts +++ b/tests/repo/tool-config-reasons.test.ts @@ -59,6 +59,11 @@ const CASES: Array<{ file: string; before: string; after: string; reason: string { file: ".yarnrc", before: 'save-prefix "~"\n', after: 'save-prefix "^"\n', reason: "Tool configuration changed: package manager settings" }, { file: "bunfig.toml", before: "[install]\nexact = false\n", after: "[install]\nexact = true\n", reason: "Tool configuration changed: package manager settings" }, { file: ".pnpmfile.cjs", before: "module.exports = {};\n", after: "module.exports = { hooks: {} };\n", reason: "Tool configuration changed: package manager settings" }, + { file: "uv.toml", before: "offline = false\n", after: "offline = true\n", reason: "Tool configuration changed: Python packaging settings" }, + { file: "poetry.toml", before: "[virtualenvs]\nin-project = false\n", after: "[virtualenvs]\nin-project = true\n", reason: "Tool configuration changed: Python packaging settings" }, + { file: "pdm.toml", before: "[venv]\nin_project = false\n", after: "[venv]\nin_project = true\n", reason: "Tool configuration changed: Python packaging settings" }, + { file: "hatch.toml", before: '[dirs]\ncache = "cache-a"\n', after: '[dirs]\ncache = "cache-b"\n', reason: "Tool configuration changed: Python packaging settings" }, + { file: ".coveragerc", before: "[report]\nfail_under = 80\n", after: "[report]\nfail_under = 90\n", reason: "Tool configuration changed: coverage 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" },