GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix crawl of --system-site-packages venvs (#409) by mikolalysenko · Pull Request #1419 · SocketDev/socket-patch Conversation
|
| Issue / behavior | Test | Without fix (main) |
With fix |
|---|---|---|---|
#409: hosted scan + --vex over an unpatched base copy behind a system-site venv |
in_process_redirect_poetry::stale_base_copy_behind_system_site_venv_warns_and_cannot_attest |
FAILED: exit 0, attests (panicked at the exit-code assert) | ok: redirect_pypi_stale_install, exit 1, no VEX file |
| #409: base dirs discovered | python_crawler::tests::system_site_venv_adds_base_site_dirs_after_its_own |
FAILED | ok |
#409: base copy crawled/found (agent mode, vex copies) |
python_crawler::tests::base_copy_behind_a_system_site_venv_is_crawled |
FAILED | ok |
| Venv copy shadows base copy (no false stale warning, VEX attests) | in_process_redirect_poetry::venv_copy_shadows_stale_base_copy_behind_system_site_venv, python_crawler::tests::venv_copy_hides_the_base_copy_of_the_same_package |
n/a (guards the fix) | ok |
Isolated venv unchanged; user site / PYTHONNOUSERSITE; base-dir order; shared-base intersection; pyvenv.cfg parsing; symlinked prefix; Debian dirs |
isolated_venv_never_reaches_its_base_interpreter, system_site_venv_reaches_the_user_site_unless_disabled, earlier_base_site_dir_hides_a_later_one, shared_base_copy_stays_visible_to_a_venv_without_its_own, pyvenv_cfg_is_read_like_site_py, base_prefix_*, base_site_dirs_cover_debian_dist_packages_for_the_venv_version_only |
n/a | ok |
I also checked the derived dirs by hand against a real Debian python3 -m venv --system-site-packages (Python 3.11): sys.path = venv site-packages, /usr/local/lib/python3.11/dist-packages, /usr/lib/python3/dist-packages, which matches the discovery order.
Local checks: cargo fmt --all -- --check ✅, cargo clippy --workspace --all-features -- -D warnings ✅, cargo test --workspace --all-features ✅ except tests that fail only because this sandbox runs as root, so permission-denied setups (chmod 0555, unremovable files) don't take effect. These are the *write_failure* / *unremovable* / *cleanup_failure* tests in covgap_commands_vendor, in_process_redirect, repair and the core lib (copy_tree::relax_loop_must_not_traverse_symlinked_root, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, pypi_poetry/pypi_requirements wire-failure tests). There is also e2e_bun_lockb::binary_shared_bundled_record_hosted_pin_is_managed, which fails the same way on origin/main here. None of them involve Python discovery, and CI runs them green on this head. The Python e2e suite (e2e_pypi) needs the live API, so CI covers it.
CI: green on f1ba00d (36 pass / 50 path-skipped). Bugbot: no issues on f1ba00d.
/code-review high findings not fixed here:
PythonCrawler instance, not in the discovery return type. That would be a cleaner API, but it would change every Python consumer's signature. get_site_packages_paths resets the state, and each of the two free-function callers sets it.set_search_order lists the venv and base dirs once more, only when a system-site venv exists.hatch_stale_install_warning) still judges only Hatch's own env dirs. A Hatch env with system-packages = true gets the base copy judged by the hosted guard (generic remedy), but not by the vendored Hatch-specific warning.🤖 Generated with Claude Code
https://claude.ai/code/session_01MPfWuTkaymyECuH3w5YJ49
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
A venv made with --system-site-packages imports packages from its base interpreter (Debian dist-packages, the base site-packages, the user site). pip treats a release found there as already installed and leaves it in place, but socket-patch only looked inside the venv. So vex attested an unpatched copy as not_affected from the lock pin, the stale-install warning never fired, and agent mode said "not installed". Local discovery now reads include-system-site-packages and home from each venv's pyvenv.cfg and appends the base interpreter's site dirs after the venv's own. It derives them from the filesystem only; the project's interpreter is never run. A base copy the venv also installs (by name) is hidden, since Python imports the venv's copy first. Refs #409 Assisted-by: Claude Code:claude-opus-5-5
A base package that two venvs share stays visible unless every venv installs its own copy, so a venv without one is still checked against the base copy it imports. A pyvenv.cfg with no include-system-site-packages key now counts as on, matching CPython. Free-threaded venvs (python3.13t) find their base site dirs. Refs #409 Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f1ba00d. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ready for review at
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Final review briefWhat it does. A venv created with Risk: medium. The discovery and shadowing logic is self-contained and well tested. Two behavior changes are worth a deliberate yes: (1) agent-mode apply can now write into a base interpreter's site dir, outside the project venv. It fails with EACCES on a distro Python and succeeds on pyenv/Homebrew/user site. (2) Look here
Verified
Changes I made: none. Open questions
Auto-merge (squash) is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
* ci(release): publish npm from release.yml, not publish-npm.yml Every socket-patch npm package's trusted publisher is registered against release.yml, and npm allows only one publisher per package. The 5.0.0 release dispatched publish-npm.yml, whose OIDC token named that file, so npm rejected it with E401 before staging anything. Move the npm leg back inline as release.yml's npm-publish job (same steps as publish-npm.yml) and delete publish-npm.yml, so the existing registration keeps working. Add an `npm-retry-version` input that skips the version gate, build, tag, GitHub release and crates.io jobs and re-stages npm from an existing release's assets; this retries 5.0.0 now and replaces the manual Publish npm dispatch. crates.io stays dispatched through publish-cargo.yml, since crates.io allows several publishers per crate. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * chore(release): fold 22 more PRs into the 5.0.0 notes Cover the PRs merged to main after #1432's base (1779317..4cb3643): Cargo source replacement and registry = "crates-io" (#338/#455, #386), pnpm lockfile=false (#1074), berry removed descriptors (#1435), yarnrc ${VAR} reads (#1100), CRLF .npmrc append (#1196), Composer vendor-dir cascade and global home (#439/#686, #586), Go +incompatible vex (#484), gem moved BUNDLE_GEMFILE and commented Gemfile revert (#952, #988), Poetry source = "pypi" (#1282) and Hatch path characters (#547). No entries for #1411 (macOS fix to code #1393 added in this release; the #1393 entry already describes the intended behavior), #1426 (perf regression introduced and fixed within 5.0.0) or the CI/test/bench PRs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * chore(release): cover #1419, #1434, #1440, #1442, #1444 in the 5.0.0 notes Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * chore(release): 5.0.1 Cut [Unreleased] into [5.0.1] — 2026-10-13 and stamp 5.0.1 with scripts/version-sync.sh. The 5.0.1 notes cover main through 501c6d9 (#1449), i.e. every PR after the v5.0.0 tag (6ad6add): the npm publish fix (5.0.0 never reached npm or crates.io, 5.0.1 is the first v5 there), #1465, #759, #1460, #1462, #1445, #869, #1447, #1450, #1467, and #1449 under Maintenance. CI/test-only PRs (#1448, #1452, #1454, #1457, #1459) have no entries. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * chore(release): 5.0.1 notes for PRs merged since the cut Covers #1469, #1470, #1474, #1475, #1478, #1479, #1480 and #1482; #1484 is CI-only. The notes now cover main through 285a5e8. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
In a--system-site-packages venv, pip keeps the base interpreter's unpatched copy after a hosted rewrite, no stale-install warning fires, and vex attests it as patched
There was an error while loading. Please reload this page.