Repository navigation
test(lint): drop the toolchain-pin guard - #577
Merged
Merged
Conversation
sumithr
force-pushed
the
chore/drop-toolchain-pins-test
branch
from
August 3, 2026 13:08
599de29 to
261110c
Compare
The guard added in #570 cost more defects than it caught. Successive review passes found a hole in it every round - a repo-root that resolved into mutmut's mutants/ copy and aborted the mutation run, imports absent from the isolated pre-push hook environments, a probe that picked the one special-cased filename and so could not detect the over-selection it existed to catch, an allowlist that still left permitted VALUES unchecked - while never once finding a hole in the config it guarded. What it protected is a stale `rev:`, which the `ruff check + format` job cannot see because it installs ruff from pyproject.toml and never opens .pre-commit-config.yaml. That risk is real but narrow, and it is now carried by a comment at the pin itself rather than by a test module that has to be right about pre-commit's filter semantics to be worth anything. Everything the guard actually fixed stays: the exact ruff==0.16.0 pin, the matching rev, the markdown types_or on ruff-format, and the files-scoped ruff-check-config entry that catches an invalid ruff config at commit time. Those are enforced by CI running the real commands over the real tree.
The hooks are verifiable by running them, so the essay explaining them was load-bearing for nothing. Each behaviour it described is confirmed by executing the hook against a real file: ruff-check-config pyproject.toml + ruff.toml Passed ruff-check-config fixtures/.../Cargo.toml Skipped ruff-format tests/scenarios/CONFORMANCE.md Passed and each fails on an injected defect: a `NOT-A-RULE` selector in ruff.toml gives "Unknown rule selector ... in `select`", and a drifting Python fence in CONFORMANCE.md gives "1 file reformatted" where the upstream types_or would have skipped the file. One line survives, on `rev:`, because nothing executable covers it: the required `ruff check + format` job installs ruff from pyproject.toml and never reads this file.
sumithr
force-pushed
the
chore/drop-toolchain-pins-test
branch
from
August 3, 2026 13:29
261110c to
d2f2277
Compare
4 tasks
sumithr
added a commit
that referenced
this pull request
Aug 3, 2026
🤖 I have created a release *beep* *boop* --- ## [0.60.4](v0.60.3...v0.60.4) (2026-08-03) ### Tests * **lint:** drop the toolchain-pin guard ([#577](#577)) ([9d7f42d](9d7f42d)) --- 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>
6 tasks done
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
Removes
tests/test_toolchain_pins.py, the guard added in #570, and the block of prose in.pre-commit-config.yamlthat was standing in for it. The ruff hooks are executable: the way to know they are right is to run them, not to read an essay about them or a test asserting their shape.The guard cost more defects than it caught. Successive review passes found a hole in it every round, and never once found a hole in the config it guarded:
mutants/copy, raisingFileNotFoundError, tripping-xand reporting all six modules as 0 killedidentifyand shelled out toruff, neither of which exists in the isolated pre-push hook environments.toml, which ispyproject.toml, the one name ruff special-cases, so it could not detect the over-selection it existed to catchargs: [--exit-zero]passed every assertionOne comment line survives, on
rev:, because nothing executable covers it: the requiredruff check + formatjob installs ruff frompyproject.tomland never opens.pre-commit-config.yaml, so a rev that drifts from the pin puts contributors on a different formatter and stays quiet until an unrelated PR goes red.What stays
Nothing that fixed a real problem is removed. The config is untouched apart from the comments:
ruff==0.16.1inpyproject.tomland the matchingrev: v0.16.1, which is what turned the required check green onmaintypes_or: [python, pyi, jupyter, markdown]onruff-format, so a drifting Markdown fence is caught at commit timeruff-check-configentry, so an invalid ruff config fails at commit time instead of in CIHow it was verified
Each behaviour the deleted prose described, confirmed by running the hook against a real file rather than asserting it:
and each one failing on an injected defect, so the passes above are not vacuous:
That second one is the whole reason
ruff-formatoverridestypes_or: with the upstream python/pyi/jupyter list the same file reports(no files to check)Skipped.Both injections were reverted, confirmed by
git status.Full gates, on the pinned ruff 0.16.1 (rebased onto #582, which bumped the pin from 0.16.0; the conflict was in the comment this PR deletes, resolved by keeping the new rev):
uv run ruff check .: All checks passeduv run ruff format --check .: 335 files already formatted (252.py+ 83.md, one fewer.pyafter the deletion)uv run mypy: no issues in 74 source filesuv run pytest -q: 100% coverage held; onlytest_built_wheel_contains_py_typed_markerfails, the knownNo module named pipin a uv venv, which the CIpip installjobs coverpre-commit validate-config: exit 0grep -rn toolchain_pinsis empty)Mutation gate, dispatched on this branch because the diff touches
tests/**/*.py(run 30819133472, Linux, 4m27s):Residual risk, accepted deliberately
Stated plainly rather than buried, because it is the whole trade this PR makes.
Nothing now compares
pyproject.toml'sruff==pin with.pre-commit-config.yaml'srev:. Verified by injectingrev: v0.15.0and running every gate: the full suite passes,pre-commit validate-configexits 0, no test readsrev:at all, and the required lint job runspython -m ruffinstalled frompyproject.tomlwithout ever opening the config. A one-sided bump reachesmainsilently and surfaces later as a red required check on somebody's unrelated PR. That is the #570 failure, and it is now guarded by a comment instead of a test.The trade is accepted because the guard cost four rounds of its own defects and caught none in the config, and because the real bump path already does the right thing: #582 bumped
ruffto 0.16.1 and synced therev:in one commit, touching exactlypyproject.tomland.pre-commit-config.yaml.Two related notes from the adversarial pass, neither a defect in this PR:
types_or: [python]onruff-format, orstages: [manual]) is not caught by CI at the moment of weakening either. CI catches the drifting file it lets through, on the next push. The deleted test never asserted hook shapes, so this is unchanged by this PR.tests/test_mutmut_subprocess_exclusions.py:274globs everytests/test_*.py, so deleting one changes its parametrize set. Inert here: the deleted module was never in the mutmut--ignorelist, all six ignore paths still resolve, and the module runs 148 passed / 0 failed on this branch.Checklist
pytest) and lint/type checks are green (pre-commit run --all-files,python -m mypy)ruff check + formatjob)