Fix Python crawler missing .egg-info installs (#447) - #452
Conversation
Assisted-by: Claude Code:claude-opus-5-5
pip before 23.1 installs an sdist without the wheel package via setup.py install, which records the install as <name>-<version>-pyX.Y.egg-info rather than .dist-info. That is the default state of a fresh venv on CPython 3.11 and older, and distro packages (Debian's python3-*) and distutils ship bare .egg-info files. The crawler only listed .dist-info, so these real, importable installs were reported "not installed" in agent mode, never got the hosted stale-install warning, and were missing from scan -g. The site-packages listing now also reads .egg-info directories (PKG-INFO, falling back to the directory name) and bare .egg-info files that carry metadata headers. Every consumer (scan, apply, rollback, the stale-install guards, -g) shares that listing. Fixes #447 Assisted-by: Claude Code:claude-opus-5-5
The step asserts vex attests from the lock pin when nothing is installed, but it ran with no venv, so the Hatch project fell back to the global interpreters. On Ubuntu runners those carry apt's python3-six 1.16.0, the fixture's exact release, as an .egg-info install. Now that the crawler sees .egg-info, vex correctly refused to attest over that unpatched copy. Point VIRTUAL_ENV at an empty venv so the step tests what it says: a package that is not installed. Assisted-by: Claude Code:claude-opus-5-5
|
[agent]
No fix to port. I'll re-run the failed jobs once when the workflow run finishes; a second failure gets treated as real. Generated by Claude Code |
The test vendors a hosted six 1.16.0 from a fresh checkout with nothing installed, but it ran with no venv, so the project fell back to the global interpreters. On Ubuntu those carry apt's python3-six 1.16.0 as an .egg-info install. Now that the crawler sees it, the variant probe compared it with the fixture's bytes and skipped it. Point VIRTUAL_ENV at an empty venv so nothing is installed. Assisted-by: Claude Code:claude-opus-5-5
|
[agent] On 35394a9, the Pipenv compatibility leg I don't think this PR caused it:
No fix to port. I'm re-running the failed job once; a second failure gets treated as real. Generated by Claude Code |
|
[agent] On 35394a9, the PDM compatibility leg I can't yet rule this PR in or out. Agent mode does read the listing this PR changes, but nothing in this change depends on the project path, and the space/unicode path is the only thing different about that cell. The cell's envelope is in the run artifact, and this sandbox can't download artifacts. The harness also drives the live I've re-run the failed job once as the diagnostic. If it fails again, I'll treat it as real and dig into PDM 0.12's install layout for that shape. Generated by Claude Code |
The new agent-mode egg-info test planted its site-packages at lib/python3.11/site-packages, which is where a venv keeps them on Unix. On Windows a venv uses Lib\site-packages, so the crawler never found the package and the Windows test job failed. Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
There was a problem hiding this comment.
✅ 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 4cb6673. Configure here.
|
[burn-down agent] Ready for review on
Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #447
Root cause
list_dist_info_packages_syncincrates/socket-patch-core/src/crawlers/python_crawler.rskeeps only*.dist-infoentries. Legacy installs record their metadata as<name>-<ver>[-pyX.Y].egg-infoinstead. That covers pip < 23.1 installing an sdist withoutwheel, distutils, and Debian/Ubuntu apt packages, and the crawler never sees any of them. Every consumer reads that one listing: agent apply/rollback lookups, the hostedredirect_pypi_stale_installguard, the Pipenv vendored stale-install probe,scan -g, and VEX. So all of them miss these packages.Fix
The site-packages listing (and its test-only equivalence oracle) now reads:
.egg-infodirectories: thePKG-INFOheaders, falling back to the<name>-<version>[-pyX.Y].egg-infoname the way the.dist-inforeader falls back to its dir name. setuptools escapes-to_, so the first-ends the name and the second starts the interpreter tag..egg-infofiles (distutils, distro packages such asPyGObject-3.48.2.egg-info). A file only counts when its headers parse, the same guard as the stray*.dist-infofile case.The wrappers under
npm/,pypi/andgem/only dispatch to the binary, so they need no change.Behaviour change worth a reviewer's eye
Apt-installed Python packages on Debian/Ubuntu (
/usr/lib/python3/dist-packages/*.egg-info) are now visible. That's what #447 asks for under-g. A Python project with no venv already falls back to the global interpreters, so those copies now take part there too, the same way a pip-installed system copy always has. Two CI tests only passed because Ubuntu's aptpython3-six1.16.0 (the fixtures' exact release) was invisible. Each one claims "nothing installed", and both now pointVIRTUAL_ENVat an empty venv to make that true:e2e_vex_build::hatchhosted pin-basis step: vex correctly refused to attest over the unpatched apt copy.vendor_eject_fresh_checkout::pypi_eject_needs_no_virtualenv: the release-variant probe compared the apt copy against the fixture's bytes.Neither test's assertions changed.
Tests (red → green)
in_process_pypi_apply::pypi_scan_sync_patches_egg_info_installscan::hosted::python::tests::egg_info_install_gets_the_stale_install_warning-g/--global-prefixreports egg-info packagesin_process_python_envs::pypi_egg_info_layout_handled(flipped from the pinned "not discovered" contract)-pyX.Y, headerless dir, bare file, headerless stray file)python_crawler::tests::egg_info_entries_are_listed,test_parse_egg_info_dir_namepython_crawler::tests::equivalence::randomized_site_packages_match_the_async_oracleReal-world check: pip 23.0.1 in a fresh CPython 3.11 venv without
wheel(pip install --no-binary six six==1.16.0) writes exactlysix-1.16.0-py3.11.egg-info/+six.py, the layout the new agent test plants (Windows:Lib\site-packages).Local runs:
cargo clippy --workspace --all-features -- -D warnings: clean.cargo test --workspace --all-features, batched with--no-fail-fastto fit the sandbox disk: 8324 passed, 10 failed. All 10 are write-failure/permission tests that fail identically onmainhere because the sandbox runs as root.cargo fmt --check:mainitself isn't fmt-clean and CI doesn't run it, so I didn't reformat unrelated files. The touched files are rustfmt-clean.CI on 4cb6673: all 481 check runs green (475 success, 6 conditional skips). Earlier single-cell failures on older heads (Bun
1.1.39, Pipenv2018.11.26 vendored, PDM0.12.3 space-unicode agent) didn't recur, which fits the live-API transport flakes noted in the comments. Bugbot reviewed 4cb6673: no issues.🤖 Generated with Claude Code
https://claude.ai/code/session_01MQdCDEbnNPApU1yUukp19S
Note
Medium Risk
Changes shared Python install discovery used by scan, apply, hosted redirects, and VEX; apt/global egg-info packages become visible by design, with broad test coverage but real-environment layout variance.
Overview
Fixes #447 by teaching the Python
site-packagesscan to treat legacy.egg-infoinstalls like.dist-info, so scan/apply, hosted stale-install checks, and global discovery no longer skip older pip sdist installs, distutils layouts, and distro packages (e.g. Debianpython3-*).Crawler:
list_dist_info_packagesnow reads.egg-infodirectories viaPKG-INFO(with a<name>-<version>[-pyX.Y].egg-infofilename fallback) and bare.egg-infofiles when headers parse; the test oracle matches the blocking scan.Tests: Discovery expectations flip from “egg-info ignored” to reported PURLs; new coverage for
scan --syncpatching egg-info layouts, hostedredirect_pypi_stale_installon egg-info, and reader edge cases. Two e2e/vendor tests setVIRTUAL_ENVto an empty venv so Ubuntu’s aptpython3-sixegg-info does not masquerade as “nothing installed.”Reviewed by Cursor Bugbot for commit 4cb6673. Configure here.
Generated by Claude Code