Skip to content

fix(action): deny UV_PYTHON in the shellHook env forward - #1357

Merged
c-vigo merged 2 commits into
devfrom
bugfix/1353-deny-uv-python-forward
Aug 7, 2026
Merged

c-vigo merged 2 commits into
devfrom
bugfix/1353-deny-uv-python-forward

Conversation

@c-vigo

@c-vigo c-vigo commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Two correct mechanisms in the direnv-mode setup-devkit-toolchain cancelled out. The step drops the bare Nix CPython from the exported PATH and forwards UV_PYTHON_DOWNLOADS_JSON_URL so uv sync builds the runner venv from a downloaded manylinux CPython (#698/#703/#729) — but the shellHook env forward (#1180) diffs the dev-shell env against the ambient env and shipped every added var, including mkProjectShell's UV_PYTHON store-path pin. UV_PYTHON beats PATH resolution, so the CI venv was built on the Nix interpreter anyway and any C-extension wheel failed under the Nix loader on Ubuntu (ImportError: libstdc++.so.6). First live hit: exo-pet/playground-carlos#9 (numpy 2.4.4, run 31163316165); existing direnv Python consumers were green only because their test deps are pure-Python.

UV_PYTHON and UV_PYTHON_DOWNLOADS are now denied by name in the forward's denylist. The second is required for the first: forwarded on its own, UV_PYTHON_DOWNLOADS=never (also set by mkProjectShell) would forbid the very managed-CPython download the JSON-URL forward exists to enable, turning the wheel ImportError into "no interpreter found". Patterns are exact matches, so the deliberate UV_PYTHON_DOWNLOADS_JSON_URL forward is untouched — and now pinned by a test.

Denylist audit (per the issue)

Everything else mkProjectShell sets was reviewed: BATS_LIB_PATH kept (the store is realized on the runner in direnv mode), NVIM_APPNAME kept (portable), LD_LIBRARY_PATH kept (exported only behind the shellHook's own /etc/NIXOS guard, never reaches a hosted runner). UV_PROJECT_ENVIRONMENT / UV_PYTHON_PREFERENCE / LOCALE_ARCHIVE are image-path-only, not dev-shell exports. Pre-existing leaks outside this issue's scope (PYTHONPATH store components, IN_NIX_SHELL, missed stdenv machinery like doCheck/CC/LD) → follow-up issue.

Test plan

  • _DEVSHELL_ENV now carries all three uv vars; UV_PYTHON + UV_PYTHON_DOWNLOADS added to the parametrized denylist test (RED before the fix: 3 failed, 25 passed, with UV_PYTHON visibly landing in GITHUB_ENV).
  • New test_uv_interpreter_pins_do_not_defeat_the_manylinux_path: both pins absent AND UV_PYTHON_DOWNLOADS_JSON_URL still forwarded — the survival assertion did not exist before.
  • Harness fix: the test subprocess env is scrubbed of ambient uv vars (pytest itself runs under nix develop, which made one parametrize case pass spuriously via the unchanged-var filter).
  • Full tests/test_setup_toolchain_env.py: 28/28 green (verified independently by reviewer); test_renovate_preset_managed_exclusion.py 31/31; prek run --all-files green.

Refs: #1353

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant