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 requirements.txt pins not matched under PEP 440 (#475) by mikolalysenko · Pull Request #478 · SocketDev/socket-patch Conversation
|
| Issue variant | Test | main | this PR |
|---|---|---|---|
hosted ==X.Y, ==X.Y.Z.0, ==0X.Y.Z, spaced + marker |
patch::redirect::requirements::tests::pep440_equivalent_pins_are_rewritten |
❌ redirect_requirements_entry_not_found |
✅ |
hosted, end to end (get <uuid> --mode hosted over requests==2.31, ==2.31.0.0, Requests==02.31.0) |
in_process_get_hosted_ecosystems::pypi_requirements_hosted_rewrites_pep440_equivalent_pin |
❌ file unchanged | ✅ |
vendored false pypi_requirement_not_pinned |
vendor::pypi_requirements::tests::find_pin_classifies_every_shape (new PEP 440 cases; === / wildcard still Range) |
❌ | ✅ |
| Hatch equivalent pins | utils::hatch::tests::pep440_equivalent_pins_are_exact_declarations |
❌ | ✅ |
| helper | utils::pep440::tests::* (equal spellings, non-equal releases, invalid input, == vs ===/wildcards) |
new | ✅ |
Local runs (Linux):
cargo clippy --workspace --all-features -- -D warnings: clean.cargo test --workspace --all-features --no-fail-fast: everything passes except 12 permission-based write-failure tests, which fail because this sandbox runs as uid 0 (root ignores read-only bits). They fail identically on main, and all 12 pass when re-run as uid 65534.cargo test -p socket-patch-cli --all-features --test e2e_vendor_pypi_build -- --ignored (real uv + pip + PyPI): 7/7 pass.cargo fmt: the changed code is rustfmt-formatted. CI has no fmt step and main itself isn't fmt-clean (rustfmt 1.8 rewrites ~125 unrelated files), so unrelated reflows were left out.npm/, pypi/ and gem/ only dispatch to the binary.🤖 Generated with Claude Code
Note
Medium Risk
Changes pin-matching on the patch redirect path for PyPI; incorrect PEP 440 logic could mis-redirect or skip pins, but invalid versions fail closed and ===/wildcards are unchanged.
Overview
Fixes #475: PyPI pin matching now treats == the same way pip/uv/Hatch do under PEP 440, instead of comparing version strings literally.
Adds utils/pep440 with packaging-style parsing and equality (versions_equal, is_exact_pin_of). Hosted requirements.txt redirect, vendored pypi_requirements pin discovery, and Hatch pyproject.toml rewrites all use it for == pins. === stays plain string equality; wildcards and ranges are unchanged.
Pins like requests==2.31, ==2.31.0.0, or ==02.31.0 now redirect to the patched wheel when the grant is 2.31.0, instead of skipping with “no entry” / false “not pinned” and leaving the project unpatched.
Regression coverage: unit tests for the helper and each rewriter, plus an in-process get --mode hosted test over equivalent requirements.txt pins.
Reviewed by Cursor Bugbot for commit bcc5335. Configure here.
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 hand-written pin such as `six==1.16` installs six 1.16.0, but the hosted requirements.txt rewrite compared versions as raw strings and skipped it, so `scan` exited 0 and the project stayed unpatched. The vendored requirements writer and the Hatch rewriter refused the same pins as "not pinned". Add a small PEP 440 equality helper (zero-padded release segments, leading zeros, case and pre/post/dev spellings) and use it for `==` pins in all three writers. `===` keeps plain string equality, as PEP 440 defines it. Fixes #475 Assisted-by: Claude Code:claude-opus-5-5
Mirrors the #475 repro end to end: `get <uuid> --mode hosted` over `requests==2.31`, `==2.31.0.0` and `Requests==02.31.0` must redirect the pin to the hosted wheel. Fails on main, passes with the fix. 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 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.
Stale Bugbot comment from a previous run.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Burn-down agent: ready for review at
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Reviewed Validation: 5 PEP 440-focused core tests, all 36 vendored-requirements unit tests, and the in-process hosted-get regression passed. Full workspace and real pip/uv matrices were not rerun. The separately documented lock-only discovery follow-up remains outside this change. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…s-pep440-pin-match
Since #383, a hosted scan of a requirements.txt that is not in hash-checking mode pins the patched wheel with the url's #sha256= fragment rather than --hash, so the PEP 440 regression test now expects that form, matching the existing hosted pypi test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CVbFzTeYSTvB5iKjY6FRg7
|
Tanmay Singla (@Tanmay182003) Good catch, thanks. Fixed in c331d18. I merged Checked locally on the merged tree:
The existing Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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 c331d18. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CI: This doesn't look like it comes from this PR:
I couldn't see which refusal code appeared, because the log only records the check name and the artifact isn't reachable from my sandbox. No fix for it exists yet. I'll re-run the failed job once the workflow finishes, since GitHub won't re-run it while the rest of the run is still going. If it fails again, I'll treat it as a real failure and dig in. Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
[agent] All checks green on 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.
|
Second pass reviewed Validation at this exact head: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Hosted requirements.txt rewrite skips PEP 440-equivalent pins likesix==1.16 for an installed 1.16.0, so scan exits 0 and pip installs the unpatched release (regression from v4.0.0)
There was an error while loading. Please reload this page.