Repository navigation
Fix(workflow): Pin setup-uv's Python install dir - #145
Merged
ModeSevenIndustrialSolutions merged 1 commit intoNov 5, 2026
Merged
ModeSevenIndustrialSolutions merged 1 commit into
ModeSevenIndustrialSolutions merged 1 commit into
Conversation
setup-uv puts its Python install directory on PATH ahead of its own uv directory and then runs a bare 'uv python find'. An earlier step that exports UV_PYTHON_INSTALL_DIR naming a directory holding a 'uv' therefore gets that 'uv' run, and the invalid UV_PYTHON_PREFERENCE guarding the lookup never applies. Set UV_PYTHON_INSTALL_DIR to the RUNNER_TEMP directory 'Install Python' already uses in the 'Set up uv' step env of linting.yaml and uv-isolation.yaml, so the step value overrides any inherited one. The isolation job now plants a bait 'uv' in a checkout directory that UV_PYTHON_INSTALL_DIR names, and its control runs a bare 'uv' with that directory first on PATH to show the bait is live. The fixture test pins the new setting and unsets the variable for its own runs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the setup-uv install-directory hardening.
No open issues 🎉
What changed in this PR
This PR closes #144 by pinning setup-uv’s Python install directory under runner.temp, preventing an inherited environment variable from directing setup-uv to a planted uv executable.
Changes:
- Pin
UV_PYTHON_INSTALL_DIRin the lint-plan and isolation workflows. - Extend both isolation test legs with a bait
uvand a control confirming it runs. - Update contract tests, fixture environment cleanup, and documentation.
| File | Description |
|---|---|
| tests/test-lint-plan-interpreter.sh | Require the new directory pin and clear inherited values in fixtures. |
| docs/linting.md | Explain the directory guard and expanded isolation coverage. |
| .github/workflows/uv-isolation.yaml | Add install-directory bait and its control; pin setup-uv’s directory. |
| .github/workflows/linting.yaml | Pin setup-uv’s Python install directory and document why. |
Review effort: Balanced
4 tasks
ModeSevenIndustrialSolutions
approved these changes
Nov 5, 2026
ModeSevenIndustrialSolutions
merged commit Nov 5, 2026
a8b720b
into
lfreleng-actions:main
55 of 56 checks passed
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.
Closes #144
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLI1eca13a71378f9957856073cd02a812a41c9b3fdbash tests/test-lint-plan-interpreter.shbash tests/test-lint-plan-interpreter.sh (with the new setting removed, negative check)prek run --files .github/workflows/linting.yaml .github/workflows/uv-isolation.yaml docs/linting.md tests/test-lint-plan-interpreter.shuvx zizmor --persona auditor --offline .github/workflows/linting.yaml .github/workflows/uv-isolation.yamlaislop scan --staged --jsongit commit -s (prek pre-commit and commit-msg hooks incl. gitlint)The
github-code-monkey-botworkflow opened this pull request.Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds; a maintainer must act on any finding that remains after that, and reviews every round before merge.
What changed
setup-uv puts its Python install directory on
PATHahead of its own uv directory and then runs a bareuv python find. An earlier step can exportUV_PYTHON_INSTALL_DIRthroughGITHUB_ENV. If it names a directory that holds auv, setup-uv runs thatuv, and the invalidUV_PYTHON_PREFERENCEadded in #143 never takes effect.linting.yaml(jobplan) anduv-isolation.yaml: theSet up uvstep env now setsUV_PYTHON_INSTALL_DIR: ${{ runner.temp }}/uv-python. This is the directoryInstall Pythonalready uses, and the step value overrides any inherited one. A comment explains why. BothInstall Pythonsteps already run withworking-directory: ${{ runner.temp }}, so they are unchanged.uv-isolation.yaml), both legs: the plant step now also writes a baituvinto$GITHUB_WORKSPACE/uv-python-baitand exportsUV_PYTHON_INSTALL_DIRpointing at it. The bait.venv(bin/python,python3,pyvenv.cfg) in the checkout stays. The control step runs a bareuvwith that directory first onPATH, as setup-uv does, and fails unless the marker records the bait.Check no bait ranthen fails if the marker exists after the uv steps.tests/test-lint-plan-interpreter.sh: theSet up uvcontract pins the new setting. The drift check already compares the two workflows' copies of the step, so both must carry it.run_stepalso unsetsUV_PYTHON_INSTALL_DIR, as it already unsets the other planted variables, so the fixtures stay hermetic when the isolation job runs them.docs/linting.md: describes the new setting and the new bait.What I ran
bash tests/test-lint-plan-interpreter.sh: 60 passed, 0 failed.linting.yamland the test failed twice: once on the missing pin and once on drift fromuv-isolation.yaml. I then restored the line.Plant bait interpretersandControl: the bait is livescripts and ran them locally against a temporaryGITHUB_ENV/GITHUB_PATH. Both exit 0, and the control saw the install-dir bait run.uv python findanduv python listignore a strayuvfile inUV_PYTHON_INSTALL_DIR. Later steps inherit the bait directory, and this shows they do not break because of it.prek run --files <changed files>: all hooks pass, including actionlint, zizmor, shellcheck, yamllint, markdownlint and the interpreter fixtures. gitlint passed on commit.zizmor --persona auditor --offlineon both changed workflows: no findings.aislop scan --changes/--staged: emptydiagnostics. aislop has no engine for YAML, shell or Markdown, so it scanned 0 files.For reviewers
PATHordering from the issue and did not check it against the setup-uv v10.3.3 source. The control models that ordering withPATH="$UV_PYTHON_INSTALL_DIR:$PATH" uvrather than running setup-uv without the guard.Set up uv, the job environment may still name the bait directory inUV_PYTHON_INSTALL_DIR, depending on whether setup-uv re-exports the variable. Later uv calls are not affected:Install Pythonruns underenv -i, and the resolver passes an absolute--python.Check no bait ranwould catch any regression.UV_PYTHON_INSTALL_DIRroute is only exercised on a real runner byuv-isolation.yaml. The shell fixtures cannot run setup-uv itself.