GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix lock-only PEP 440 pin spellings missing patches (#604) by mikolalysenko · Pull Request #1334 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

LLM Description written by Claude Code:claude-opus-5-5

Fixes #604

Summary

On a fresh checkout (no venv, the usual CI case), lock-only requirements.txt discovery built each purl from the == version as written: six==1.16 became pkg:pypi/[email protected], ==1.16.0.0 became @1.16.0.0, and ==01.16.0 became @01.16.0. pip resolves all three to the registry release 1.16.0, but the patch is keyed pkg:pypi/[email protected] and the API matches purls exactly. So scan exited 0 with "No patches available", nothing was rewritten, and pip installed the unpatched release. The same file with a venv holding six 1.16.0 was patched (the #478 rewriters already compare == under PEP 440).

Root cause

utils/requirements.rs exact_pin returns the spelled version, vendor/lock_inventory/pypi.rs builds the lock-only purl from it, and the scan sent only that spelling to /patches/batch.

Fix

  • utils::pep440::equivalent_release_spellings returns the other spellings of a pure release: leading zeros dropped, and the release padded or trimmed between its trailing-zero-trimmed form and at least three segments (1.16 → 1.16.0; 1.16.0 → 1.16; 01.16.0.0 → 1.16, 1.16.0). Pre/post/dev/local versions get none.
  • Two new helpers in utils::purl_key: pypi_equivalent_purls and pypi_same_release.
  • scan: the batch query now carries, for each lockfile-only PyPI purl, its equivalent spellings (deduplicated by PurlKey). Installed packages aren't expanded, and scannedPackages / lockfileOnlyPackages still count packages, not queries. After the fetch, an API purl that names a lockfile-only pin under another spelling is added to the lockfile-only set, so notInstalled, the [NOT INSTALLED] marker and the vendored baseline pre-check treat it as that package. Hosted and vendored writers then match the pin under PEP 440 as before.
  • docs/testing/uv-compatibility.md documents the behavior.

Trade-off: a lock-only x.y.0 pin now also asks for @x.y (a registry might publish 4.2 for a ==4.2.0 pin). That's one extra purl in the batch body per such pin.

Tests (red → green)

Case Test Before After
hosted, lock-only six==1.16 / ==1.16.0.0 / ==01.16.0 against a mock that has the patch only under @1.16.0: redirected, line rewritten, notInstalled: true mode_migration_pypi::lock_only_pep440_equivalent_pin_is_patched FAILED ok
hosted + vendored: the batch carries the spelled and the @1.16.0 purl, lockfileOnlyPackages stays 1 scan_requirements_lock_only::lock_only_scan_queries_pep440_equivalent_spellings FAILED ok
spelling generation (pad, trim, leading zeros, non-releases) utils::pep440::tests::equivalent_release_spellings_pad_and_trim new ok

Red was verified by disabling the query expansion.

Commands run

  • cargo test -p socket-patch-core --lib: 6110 passed
  • cargo test -p socket-patch-cli --no-fail-fast (whole suite, non-ignored): every binary passes except e2e_vendor_cargo_build's two old-toolchain cases. Those fail locally only, with "Bad CPU type in executable" from an x86 rustup 1.41 toolchain on arm64, which is unrelated.
  • cargo clippy --workspace --all-features -- -D warnings: clean. cargo fmt --all -- --check: my files clean (the upstream/mod.rs diff is pre-existing on main)

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mikolalysenko @claude
Start v5 blocker fix (pypi-pep440-lockonly)
bdc255a
Empty commit to open the draft PR.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 9, 2026
Vendored requirements.txt refuses a six (==1.16.0) pin that the inventory and hosted mode accept, because exact pins are read by three grammars #1365
Closed
4 tasks
@mikolalysenko @claude
Find lock-only patches for PEP 440 pin spellings
6843538
On a fresh checkout (no venv), requirements.txt discovery sent a pin
as written: `six==1.16` became `pkg:pypi/[email protected]`, `==1.16.0.0`
became `@1.16.0.0`, `==01.16.0` became `@01.16.0`. pip installs the
registry release 1.16.0 for all three, but the patch API keys it
`@1.16.0`, so the scan said "No patches available" and the unpatched
release was installed. The same file with a venv holding six was
patched.

Scan now also asks the API for the other PEP 440 spellings of a
lockfile-only PyPI pure-release pin (leading zeros dropped, release
padded or trimmed to at least three segments). A patch returned under
another spelling is counted as that lockfile-only package, so
`notInstalled` and the vendored baseline pre-check see it. The
rewriters already match `==` pins under PEP 440 (#478).

Fixes #604

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 9, 2026 19:30
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) enabled auto-merge October 9, 2026 19:31
cursor[bot]
cursor Bot reviewed Oct 9, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for 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 6843538. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Tanmay182003
Tanmay Singla (Tanmay182003) approved these changes Oct 9, 2026
View reviewed changes
Mikola Lysenko (mikolalysenko) and others added 3 commits October 9, 2026 19:28
@mikolalysenko @claude
Merge origin/main into agent/v5-pypi-pep440-lockonly
09be73f
Resolve conflicts with #1335 (uv workspace member): keep both the PEP 440
lock-only pin test and the uv workspace Hatch-member test with its helpers
in mode_migration_pypi.rs, and keep both the lock-only discovery bullet and
main's reworded hosted-requirements bullet in docs/testing/uv-compatibility.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@mikolalysenko @claude
Merge origin/main into agent/v5-pypi-pep440-lockonly
fda71d8
Picks up #1351 (Go read-only module cache); no conflicts.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@mikolalysenko @claude
Merge origin/main into agent/v5-pypi-pep440-lockonly
f574348
Picks up #1296 (v5 migration docs); no conflicts.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 9, 2026
Merged via the queue into main with commit 08c71ff Oct 10, 2026
53 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/v5-pypi-pep440-lockonly branch October 10, 2026 00:07
Mikola Lysenko (mikolalysenko) added a commit that referenced this pull request Oct 10, 2026
@mikolalysenko @claude
Merge origin/main into agent/v5-hatch-pylock
56266e7
Resolve conflicts with #1334/#1335 in mode_migration_pypi.rs (keep the
hatch pylock test alongside the PEP 440 lock-only and uv workspace member
tests) and with main's CLI_CONTRACT.md edits (keep both the
redirect_hatch_lock_regenerated and redirect_requirements_direct_reference
rows).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@Tanmay182003 Tanmay Singla (Tanmay182003) Tanmay182003 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Lock-only requirements.txt discovery sends PEP 440-equivalent pins verbatim (six==1.16 → pkg:pypi/[email protected]), so a fresh checkout reports "No patches available" while the same file with a venv is patched

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@mikolalysenko @Tanmay182003
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.