Repository navigation
pr_gates: clean-env lint/mypy PATH names the dir the matched tool is in - #5511
Merged
Merged
Conversation
pinned_ruff_lint / pinned_mypy_audit matched the caller's ruff/mypy against CI's pin, then ran the audit under `env -i PATH=<interpreter bin>:/usr/bin:/bin`. churn's precheck runs pr_gates under /usr/bin/python3 while the pinned ruff sits on ~/.local/bin (nyx), so that PATH had no ruff: lint failed in 0 s with FileNotFoundError and green PRs (#5483, #5493, #5504) were sent back; workers rerunning under the venv python could never reproduce it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Owner
Author
|
No description provided. |
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.
Problem
The churn precheck on nyx has sent back green PRs with
pr_gates --fast is red: FAIL lint 0s: #5483, #5493 and #5504 today. Workers could never reproduce it.Root cause:
pinned_ruff_lintandpinned_mypy_auditcheck the caller'sruff/mypyagainst CI's pin. When the version matches, they run the audit underenv -i PATH=<dir of the interpreter>:/usr/bin:/bin. churn runspr_gatesunder/usr/bin/python3(its ownsys.executable), but the pinned ruff is on~/.local/bin(nyx's systemd user PATH includes it). The clean PATH was/usr/bin:/usr/bin:/bin, with no ruff, soruff_audit.pydied at once:Workers rerun the gate with the venv python, whose bin dir does contain ruff, so for them it always passed.
Fix
_tool_bin_dir(tool, env)returns the resolved directory of thetoolfound on the caller's PATH (the onelocal_versionsjust matched). If there is none, it falls back to the interpreter's bin dir, the old behaviour. Both clean-env gates now use it.Verification
test_matching_tool_off_the_interpreter_bin_dir_is_on_the_clean_path: fails on main, passes here.tests/tools/test_pr_gates_fleet.py10/10.tests/tools/box/heavy-run.sh /usr/bin/python3 tests/tools/pr_gates.py --fast: lint failed at 0 s before; it now showsruff used: ruff 0.16.10 (~/.cache/gitgalaxy/ruff-0.16.10/bin/ruff)and 6/6 gates pass.🤖 Generated with Claude Code