Repository navigation
ci(toolchain): guard pre-commit hook dependency pins against pyproject (#714) - #751
Merged
Merged
Conversation
6 tasks done
…nd pre-commit (#714) tests/test_toolchain_pin_lockstep.py compares each tool pinned in both pyproject.toml and .pre-commit-config.yaml (ruff: dev extra vs the ruff-pre-commit rev; mutmut: dev extra vs the mutmut hook's additional_dependencies) and fails in the required pytest jobs when a pair disagrees, naming both files and both values. Version-agnostic; pairs live in a LOCKSTEP_PAIRS table so another pair is one row. .pre-commit-config.yaml joins [tool.mutmut].also_copy so the test resolves under the mutants/ mirror. Stale mutmut version literals in the hook comment and docs/DEVELOPMENT.md are replaced with version-free wording, and the mechanism is documented in DEVELOPMENT.md.
…fix drifted pins (#714) Generalise tests/test_toolchain_pin_lockstep.py from a hand-maintained ruff/mutmut pair list to a rule: every pre-commit hook additional_dependencies entry whose package pyproject.toml also declares must carry an equal specifier set, plus the ruff-pre-commit rev vs ruff== special case. Markers and extras are ignored, ambiguous pyproject declarations fail, non-tag ruff revs fail with a clear message, and every mismatch is reported in one failure. Align the drifted hook pins the generalised guard found: pytest-cov >=6,<8 in the mutmut and pytest hooks, tree-sitter >=0.25,<0.27 in the pytest hook. Rewrite the mutmut pin rationale in pyproject.toml and docs/DEVELOPMENT.md to describe the current >=3.8,<3.9 pin.
…d to python hooks (#714) Require mutmut to be declared once in both pyproject and the mutmut hook, compare only Python hooks, prefer optional extras (including PEP 735 dependency-groups and tool.uv dev-dependencies) over runtime dependencies as the source of truth, tolerate marker-split runtime entries, compare direct-reference URLs, and name hooks that lack an id.
…idate (#714) A hook is skipped only when its inline language is not python; every other hook has each additional_dependencies entry checked on its own, so one direct-URL or unparseable entry no longer hides its declared siblings. Marker-split [project].dependencies entries are all candidates, and a hook pin must match one of them, instead of dropping the package from comparison.
sumithr
force-pushed
the
ci/issue-714-toolchain-pin-lockstep
branch
from
September 29, 2026 21:25
d15cf4c to
fd6c2e5
Compare
This was referenced Sep 29, 2026
sumithr
added a commit
that referenced
this pull request
Sep 30, 2026
🤖 I have created a release *beep* *boop* --- ## [0.67.0](v0.66.1...v0.67.0) (2026-09-30) ### Features * **review:** probe mirrored dependency constraints across manifests, hooks, CI, and images ([#493](#493)) ([#772](#772)) ([dd04c23](dd04c23)) ### Documentation * **contributing:** define the QA tool preflight and source-tree degraded mode ([#745](#745)) ([2eb9de0](2eb9de0)) ### Miscellaneous Chores * **pre-commit:** install the pre-push hooks by default and always run pytest ([#775](#775)) ([135cbf6](135cbf6)) ### Continuous Integration * **toolchain:** guard pre-commit hook dependency pins against pyproject ([#714](#714)) ([#751](#751)) ([121dc0e](121dc0e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <release-please[bot]@users.noreply.github.com>
This was referenced Oct 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Dependabot only edits
pyproject.toml, so every bump to a tool or package that.pre-commit-config.yamlalso pins has been half a change. #709 (ruff) and #708 (mutmut) both passed all checks with the second site left stale. This PR adds a required-CI guard that fails when the two files disagree, and realigns the pins that had already drifted.Review widened the scope beyond the ruff and mutmut pair the issue names. A hand-kept pair list already had holes:
pytest-cov(<8vs<7in both hooks) andtree-sitter(<0.27vs<0.26) had drifted unnoticed.Related issue
Closes #714
Changes
tests/test_toolchain_pin_lockstep.py, run by the requiredpytestjobs:language. Eachadditional_dependenciesentry that parses as PEP 508 and names a package declared in pyproject must match one of that package's pins, by specifier and URL. Markers and extras are ignored on purpose;tomlidiffers only by marker.[project.optional-dependencies],[dependency-groups]and[tool.uv].dev-dependenciesfirst, then[project].dependencies. Marker-split runtime declarations are all candidates.REQUIRED_MIRRORSmakes mutmut exist on both sides. Removing either pin fails instead of silently skipping.rev: vXmust match devruff==X. A rev that is not av<version>tag (a frozen SHA, or a YAML float) fails with a clear message..pre-commit-config.yaml:pytest-covis>=6,<8in the mutmut and pytest hooks, andtree-sitteris>=0.25,<0.27in the pytest hook, both matching pyproject. The "kept in sync by hand" comments now point at the guard.pyproject.toml: the mutmut pin comment describes the current>=3.8,<3.9pin. The committed baseline's minor sets the floor, and the ceiling allows one minor per baseline..pre-commit-config.yamlis added to[tool.mutmut].also_copyso the test can read it from themutants/copy.docs/DEVELOPMENT.md: the mutmut section is rewritten to current state, and a new "Toolchain pin lockstep" section states the rules.How it was verified
mutmutandpytesthooks, tree-sitter in thepytesthook), each with both files and values.rev: v0.16.7failed withruff pins disagree: ... 'ruff==0.16.8' ... 'v0.16.7'.mutmut must be declared exactly once in pyproject.toml to anchor its mirror ...; found 0.demo==99failed;demo==2passed.pytest-covfailed and named pytest-cov.tests/test_toolchain_pin_lockstep.py: 29 passed.uv run pytest: 4461 passed, 7 skipped, 1 xfailed, 100.00% coverage.ruff check,ruff format --checkandmypyare clean.d15cf4c: each desync was applied to the realpyproject.tomlor.pre-commit-config.yamlin a throwaway worktree and reverted. The guard failed on a ruffrev:one patch behind, a mutmut hook ceiling of<3.10, a pyproject-only ruff bump, a pyproject-only mutmut bump and a pyproject-only pytest-cov bump, naming both files and both values each time. Moving both sites together to unseen versions passed, and adding oneREQUIRED_MIRRORSrow made removing that package from its hook fail.pytestjobs collect the new file throughtestpaths, and the scoped Linux mutation gate on the branch passed with 0 survivors in every module.pre-commit run --hook-stage pre-push --all-filespassed. The rebuilt hook venvs resolved pytest-cov 7.1.0, tree-sitter 0.26.0 and mutmut 3.8.0. The push's own pre-push run (mutmut gate, pytest, plugin drift) passed on every commit./code-review. The final codex pass ond15cf4cfound nothing material, and its probes caught all 20 hook-pin drifts, a ruff rev bump and removal of either mutmut mirror.packagingdirectly (pytest requires it), and replacing the hook copies withuv runhooks (a design change outside this issue's scope).Checklist
pytest) and lint/type checks are green (pre-commit run --all-files,python -m mypy)