From 707ca5205f7713fe7d5d37dba33dbaa7375d7b27 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 18 Nov 2026 10:24:31 +0000 Subject: [PATCH 1/3] fix(dependabot): list pip directories explicitly so one update opens one pull request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dependabot's pip fetcher reads the manifests of a listed directory and the requirements files of its direct child directories (dependabot-core shared_file_fetcher.rb, req_txt_and_in_files). The "**" and "**/*" globs listed both a folder and its parent, so roles/web-app-odoo/files/pip/requirements-no-deps.txt and roles/web-svc-translate/files/requirements.txt got two identical pull requests per bump (#2009/#2010, #2131/#2132). The pip entry now names the four manifest directories, and TestDependabotPipDirectories fails on a glob, on a manifest reached by no or by several directories, and on a stale directory. 🎯 Fix: 92 % 💥 Break: 3 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 89 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 --- .github/dependabot.yml | 6 +- .../workflows/test_dependabot_coverage.py | 78 +++++++++++++++++++ 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a34977f630..db38a85615 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,8 +7,10 @@ updates: # ------------------------------------------------------------ - package-ecosystem: "pip" directories: - - "**" - - "**/*" + - "/" + - "/roles/svc-net-tor-smtp/files" + - "/roles/web-app-odoo/files/pip" + - "/roles/web-svc-translate/files" schedule: interval: "daily" time: "00:00" diff --git a/tests/integration/meta/workflows/test_dependabot_coverage.py b/tests/integration/meta/workflows/test_dependabot_coverage.py index b5565dfb1f..7c586bc527 100644 --- a/tests/integration/meta/workflows/test_dependabot_coverage.py +++ b/tests/integration/meta/workflows/test_dependabot_coverage.py @@ -289,5 +289,83 @@ class TestDependabotCoverage(unittest.TestCase): ) +def _pip_manifests() -> list[str]: + return sorted( + rel_file + for rel_file in _list_candidate_files() + if any( + fnmatch.fnmatch(Path(rel_file).name, pattern) + for pattern in ECOSYSTEM_FILENAME_INDICATORS["pip"] + ) + ) + + +def _rel_dir(path: Path) -> str: + return "" if path == Path() else path.as_posix() + + +def _pip_dir_reaches(dep_dir: str, rel_file: str) -> bool: + """Args: + dep_dir: a pip ``directories`` entry; Dependabot reads its manifests and + the requirements files of its direct child directories. + rel_file: repo-relative path of a pip manifest. + + Returns: + True when Dependabot's pip fetcher reaches ``rel_file`` from ``dep_dir``. + """ + base = dep_dir.strip("/") + file_path = Path(rel_file) + if fnmatch.fnmatchcase(_rel_dir(file_path.parent), base): + return True + return ( + fnmatch.fnmatchcase(_rel_dir(file_path.parent.parent), base) + and file_path.suffix in (".txt", ".in") + and "requirements" in file_path.name + ) + + +class TestDependabotPipDirectories(unittest.TestCase): + def setUp(self) -> None: + pip_entries = [ + entry + for entry in _load_active_entries() + if entry["package-ecosystem"] == "pip" + ] + self.assertEqual(len(pip_entries), 1, "expected exactly one pip entry") + self.pip_dirs = _get_entry_dirs(pip_entries[0]) + self.manifests = _pip_manifests() + + def test_no_glob_directories(self): + globs = [d for d in self.pip_dirs if "*" in d] + self.assertFalse(globs, f"pip directories must not contain globs: {globs}") + + def test_every_manifest_is_reached_by_exactly_one_directory(self): + uncovered: list[str] = [] + duplicated: list[str] = [] + for rel_file in self.manifests: + reaching = [d for d in self.pip_dirs if _pip_dir_reaches(d, rel_file)] + if not reaching: + uncovered.append(rel_file) + elif len(reaching) > 1: + duplicated.append(f"{rel_file} <- {', '.join(reaching)}") + problems: list[str] = [] + if uncovered: + problems.append("Uncovered pip manifests:\n " + "\n ".join(uncovered)) + if duplicated: + problems.append( + "Pip manifests reached by several directories:\n " + + "\n ".join(duplicated) + ) + self.assertFalse(problems, "\n".join(problems)) + + def test_every_directory_reaches_a_manifest(self): + stale = [ + d + for d in self.pip_dirs + if not any(_pip_dir_reaches(d, f) for f in self.manifests) + ] + self.assertFalse(stale, f"pip directories reaching no manifest: {stale}") + + if __name__ == "__main__": unittest.main() From 21efcd0a65424e811db30185c721bc60736ab250 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 18 Nov 2026 10:41:37 +0000 Subject: [PATCH 2/3] fix(dependabot): match pip manifests by pattern instead of a per-role list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The explicit directory list would need a new entry for every role that ships pip manifests. The pip entry now uses two patterns: / for the root pyproject.toml and /roles/*/files, whose child scan also reaches requirements files one folder below (roles/web-app-odoo/files/pip). Every manifest is still reached exactly once, and a role that keeps its pip manifests in files/ or one folder below is covered without an edit. The pip directory test now models Dependabot's glob segments and drops the no-glob rule. 🎯 Fix: 92 % 💥 Break: 3 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 89 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 --- .github/dependabot.yml | 4 +--- .../workflows/test_dependabot_coverage.py | 22 +++++++++++-------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index db38a85615..f4e2da25b6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,9 +8,7 @@ updates: - package-ecosystem: "pip" directories: - "/" - - "/roles/svc-net-tor-smtp/files" - - "/roles/web-app-odoo/files/pip" - - "/roles/web-svc-translate/files" + - "/roles/*/files" schedule: interval: "daily" time: "00:00" diff --git a/tests/integration/meta/workflows/test_dependabot_coverage.py b/tests/integration/meta/workflows/test_dependabot_coverage.py index 7c586bc527..4085de5a5c 100644 --- a/tests/integration/meta/workflows/test_dependabot_coverage.py +++ b/tests/integration/meta/workflows/test_dependabot_coverage.py @@ -1,4 +1,5 @@ import fnmatch +import re import subprocess import unittest from collections.abc import Iterable @@ -304,21 +305,28 @@ def _rel_dir(path: Path) -> str: return "" if path == Path() else path.as_posix() +def _glob_to_regex(pattern: str) -> re.Pattern[str]: + parts = re.split(r"(\*\*|\*)", pattern) + translated = {"**": ".*", "*": "[^/]*"} + return re.compile("".join(translated.get(p) or re.escape(p) for p in parts)) + + def _pip_dir_reaches(dep_dir: str, rel_file: str) -> bool: """Args: - dep_dir: a pip ``directories`` entry; Dependabot reads its manifests and - the requirements files of its direct child directories. + dep_dir: a pip ``directories`` entry or glob (``*`` one path segment, + ``**`` any depth); Dependabot reads its manifests and the + requirements files of its direct child directories. rel_file: repo-relative path of a pip manifest. Returns: True when Dependabot's pip fetcher reaches ``rel_file`` from ``dep_dir``. """ - base = dep_dir.strip("/") + pattern = _glob_to_regex(dep_dir.strip("/")) file_path = Path(rel_file) - if fnmatch.fnmatchcase(_rel_dir(file_path.parent), base): + if pattern.fullmatch(_rel_dir(file_path.parent)): return True return ( - fnmatch.fnmatchcase(_rel_dir(file_path.parent.parent), base) + pattern.fullmatch(_rel_dir(file_path.parent.parent)) is not None and file_path.suffix in (".txt", ".in") and "requirements" in file_path.name ) @@ -335,10 +343,6 @@ class TestDependabotPipDirectories(unittest.TestCase): self.pip_dirs = _get_entry_dirs(pip_entries[0]) self.manifests = _pip_manifests() - def test_no_glob_directories(self): - globs = [d for d in self.pip_dirs if "*" in d] - self.assertFalse(globs, f"pip directories must not contain globs: {globs}") - def test_every_manifest_is_reached_by_exactly_one_directory(self): uncovered: list[str] = [] duplicated: list[str] = [] From 632491eba945adc3bae82b1f2b60db1c38ba294c Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 18 Nov 2026 11:18:03 +0000 Subject: [PATCH 3/3] test(dependabot): list requirements .in files as pip manifests and pin the reach model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CodeRabbit on #2145: the reach model already treats requirements .in files like .txt, but the pip inventory never listed them, so an overlap such as python/requirements.in reached from / and /python would go unseen. The inventory now includes requirements*.in, and test_reach_model pins the model on synthetic paths: the root and child-folder reach, the overlap case, one-segment *, and bracket syntax read literally. 🎯 Fix: 92 % 💥 Break: 3 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 89 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 --- .../meta/workflows/test_dependabot_coverage.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/integration/meta/workflows/test_dependabot_coverage.py b/tests/integration/meta/workflows/test_dependabot_coverage.py index 4085de5a5c..f3ec8faa4c 100644 --- a/tests/integration/meta/workflows/test_dependabot_coverage.py +++ b/tests/integration/meta/workflows/test_dependabot_coverage.py @@ -38,6 +38,7 @@ ECOSYSTEM_FILENAME_INDICATORS: dict[str, list[str]] = { "pyproject.toml", "requirements.txt", "requirements*.txt", + "requirements*.in", "setup.py", "setup.cfg", "Pipfile", @@ -370,6 +371,23 @@ class TestDependabotPipDirectories(unittest.TestCase): ] self.assertFalse(stale, f"pip directories reaching no manifest: {stale}") + def test_reach_model(self): + odoo = "roles/web-app-odoo/files/pip/requirements-no-deps.txt" + cases = ( + ("/", "pyproject.toml", True), + ("/", "python/requirements.in", True), + ("/", "a/b/requirements.txt", False), + ("/python", "python/requirements.in", True), + ("/roles/*/files", "roles/x/files/requirements.txt", True), + ("/roles/*/files", "roles/x/files/pip/requirements-no-deps.txt", True), + ("/roles/*/files", "roles/x/files/pip/setup.py", False), + ("/roles/*/files", "roles/x/y/files/requirements.txt", False), + ("/roles/web-app-odo[o]/files/pip", odoo, False), + ) + for dep_dir, rel_file, expected in cases: + with self.subTest(dep_dir=dep_dir, rel_file=rel_file): + self.assertEqual(_pip_dir_reaches(dep_dir, rel_file), expected) + if __name__ == "__main__": unittest.main()