Repository navigation
Fix bare requirements wheel paths not contesting VEX (#1587) - #1599
Open
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
Open
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
A requirements.txt line such as `wheels/six-1.16.0-py3-none-any.whl`, `six-1.16.0-py3-none-any.whl` or `dist/six-1.16.0.tar.gz` is installed by pip as a local, unpatched artifact. VEX discovery only treated a line as a path when it began with `.`, `/` or another non-alphanumeric character, so these spellings gave no evidence and `vex` attested not_affected for a Socket wiring of the same release in Pipfile.lock. Read a line as a path the way pip does: it holds a path separator, starts with something other than a letter or digit, or names an archive (`.whl`, `.tar.gz`, `.zip`, ...). `name@<location>` stays a PEP 508 direct reference, as in pip. Fixes #1587 Assisted-by: Claude Code:claude-opus-5-5
Move the "pip installs this as a local artifact" rule into utils::requirements beside the shared requirements grammar, and follow pip more closely: - `six@https://...` (no spaces) is a PEP 508 reference to six, not a bare url, as pip reads it. - A path's `[extras]` are cut before its filename is read, so `wheels/six-1.16.0-...whl[socks]` also contests the wiring. - The archive test splits `.tar.<ext>` the way pip's splitext does. Refs #1587 Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 16, 2026 04:48
Collaborator
Author
|
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 3a4de37. Configure here.
Collaborator
Author
|
Labeled Ready for review at head
Generated by Claude Code |
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.
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1587
Summary
pip installs a requirements.txt line such as
wheels/six-1.16.0-py3-none-any.whl,six-1.16.0-py3-none-any.whlordist/six-1.16.0.tar.gzas a local, unpatched artifact. Before this fix,vexignored those lines and attestednot_affectedfor a Socket wiring of the same release in Pipfile.lock. Only the./wheels/…spelling was withheld (#1562). These spellings now contest the wiring the same way, sovexwithholds the statement withpatched_ref_unattributable.Root cause
requirement_location(crates/socket-patch-core/src/vex/discover/pypi_other.rs) read a line as a path only when its first character wasn't a letter or digit. pip's rule (_looks_like_path/_get_url_from_path) is different: a token is a path when it holds a path separator, starts with., or names an archive file.Changes
utils::requirements, the shared requirements grammar, gets pip's rule aspip_reads_as_path, withis_archive_file(pip'sARCHIVE_EXTENSIONS, and itssplitexthandling of.tar.<ext>),names_before_atandstrip_path_extras.requirement_locationuses these helpers and now also follows pip on two more points:six@https://…orsix@wheels/…whlis a PEP 508 reference tosix. Before, the url form was read as a bare url and lost its declared name.[extras]are cut before its filename is read, sowheels/six-…whl[socks]also contests.Tests (red → green)
wheels/…whl,…whl,dist/…tar.gz,wheels\…whl, path with a;marker, vendored Pipfile.lock wiringvex::discover::pypi_other::tests::issue_1549_non_socket_direct_references_contest_wiring(new cases)vex::discover::pypi_other::tests::issue_1587_requirement_location_reads_paths_as_pip_doesleft: None)utils::requirements::tests::pip_reads_as_path_follows_pipvex, hosted and vendored wiringe2e_vex_lockfile pipenv::requirements_direct_reference_contests_the_lock_wiring(the issue's three spellings)vexexit 0)The red runs used main's
pypi_other.rswith the new e2e cases in place.Local runs:
cargo fmt --all -- --check: cleancargo clippy --workspace --all-features -- -D warnings: cleancargo test -p socket-patch-core --lib: 6536 passed, 4 failed. The 4 are chmod-based tests that can't fail under uid 0 in this sandbox:relax_loop_must_not_traverse_symlinked_root,an_unremovable_hidden_lock_keeps_every_store_entry, and the poetry and requirements write-failure tests. Other agent PRs report the same 4 on main.e2e_vex_lockfile: 350 passede2e_vex_redirect(53),e2e_vex_vendor(52),in_process_redirect_pipenv(11),in_process_vendor_pypi_takeover(6),scan_requirements_lock_only(10) andscan_vendor_requirements_unwired(4): all passCI and Bugbot
CI on 3a4de37:
ci-okgreen, no failed checks. Bugbot reviewed 3a4de37 and found no issues./code-review high
Fixed in 3a4de37:
six@https://…lost its declared name.[extras]on a path hid its filename..tar.<ext>the way pip does.Not changed:
.tar,.tbz,.txz,.tlz,.tar.lz,.tar.lzma) are now read as paths. The release can't be read from those filenames, though, so they still give no evidence, as before this PR. Real sdists use.tar.gzor.zip(PEP 625 requires.tar.gz). Widening the filename reader would also change the hosted rewriter and the lock inventory.requirement_namestill reads a bare path line as a name (wheels). These writers don't attest anything. Whether they should treat such a line as an install source of the package is a separate change, left as a follow-up.🤖 Generated with Claude Code
https://claude.ai/code/session_01JM7idHTBGCQp9fzoGJviT3
Generated by Claude Code