test(make): forbid bare 'uv run' in review-safe gates (#2296)#2299
Open
yastman wants to merge 1 commit into
Open
test(make): forbid bare 'uv run' in review-safe gates (#2296)#2299yastman wants to merge 1 commit into
yastman wants to merge 1 commit into
Conversation
make check (via lint/type-check) uses plain 'uv run', which auto-syncs the shared project .venv. In review/candidate worktrees this re-points the editable install at the temp worktree and can switch package versions — observed footgun during PR-queue validation. #2290 added check-frozen / candidate-check that preflight with 'uv sync --frozen --check' and run tools via $(UV_RUN_NO_SYNC), but nothing guarded that read-only guarantee against regression. Per the issue's proposed fix option, add a Makefile contract test (tests/contract/test_makefile_review_gate_no_autosync_contract.py) asserting: - check-frozen and candidate-check exist; - check-frozen preflights read-only via 'uv sync --frozen --check'; - every 'uv run' inside the review-safe gates uses --no-sync (directly or via $(UV_RUN_NO_SYNC)) — never a bare auto-syncing 'uv run'; - check-frozen covers both ruff and mypy via the no-sync runner; - the $(UV_RUN_NO_SYNC) macro itself resolves to '--no-sync'. Developer-friendly 'make check' is intentionally NOT constrained (auto-sync there is fine, per the issue). Detector self-checks pin the helper. Verified red first: injecting a bare 'uv run' into check-frozen makes the contract fail with the offending line; restored -> green. 61 makefile-contract tests pass; ruff clean. No production code changed.
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.
This pull request was created by @kiro-agent on behalf of @yastman 👻
Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro autonomous agent
Summary
Closes #2296 — guards the read-only review/candidate validation gates against silently regressing to a mutating
uv run.Background
make check(vialint/type-check) uses plainuv run, which auto-syncs the shared project.venv. In review/candidate worktrees this re-points the editable install at the temporary worktree and can switch package versions — the exact footgun observed during PR-queue validation (a latermake candidate-checkthen failed as stale). #2290 addedcheck-frozen/candidate-check(preflightuv sync --frozen --check+ run tools via$(UV_RUN_NO_SYNC)), but nothing guarded that read-only guarantee against future regression.Fix
Per the issue's proposed option, add a Makefile contract test (
tests/contract/test_makefile_review_gate_no_autosync_contract.py) asserting:check-frozenandcandidate-checkexist;check-frozenpreflights read-only withuv sync --frozen --check;uv runinside the review-safe gates uses--no-sync(directly or via$(UV_RUN_NO_SYNC)) — never a bare auto-syncinguv run;check-frozencovers bothruff checkandmypyvia the no-sync runner;$(UV_RUN_NO_SYNC)macro itself resolves to--no-sync.Developer-friendly
make checkis intentionally not constrained (auto-sync there is fine, per the issue). Detector self-checks pin the helper so the contract can't go vacuous.Testing (TDD — verified red first)
uv runintocheck-frozenmakestest_review_safe_gates_never_use_bare_uv_runfail with the offending line; restored → green.pytest tests/contract/ -k makefile→ 61 passed. Ruff clean.verify:repo-only— no Docker/runtime validation required.