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 PyPI agent apply patching only one installed copy (#529, #501) by mikolalysenko · Pull Request #538 · SocketDev/socket-patch Conversation
|
| Issue | Test | Without the fix | With the fix |
|---|---|---|---|
| #529 | pipenv_workon_home_and_dot_venv_copies_are_all_patched |
FAILED: "the ./.venv copy must be patched" | ok |
| #501 | global_system_and_user_site_copies_are_all_patched (unix; stub python3 lists a system dir, then the user site) |
FAILED: "the user site copy must be patched" | ok |
| review (prefetch) | mismatch_blob_gaps_gates_pypi_variants_per_copy (unit) |
FAILED: queued {1…}, not {4…} |
ok |
Commands run locally (Linux, toolchain 1.93.1):
main's apply.rs and green with the fix (19 passed). The prefetch unit test is red under first-copy gating and green with per-copy gating.cargo clippy --workspace --all-features -- -D warnings: clean. All 830 socket-patch-cli lib tests pass. These suites pass too: in_process_pypi_apply, in_process_pypi_multi_release, in_process_python_envs, covgap_commands_rollback, e2e_gem, cli_apply_silent.cargo test --workspace --all-features --no-fail-fast (on 99881ad): 209 test binaries green. 15 tests failed, and all of them are permission and write-failure tests that can't fail as intended in this sandbox, because it runs as root (uid 0), which ignores chmod 0555. None of them touch the apply path. CI runs as non-root.cargo fmt: the new and changed lines are rustfmt-clean. main itself isn't fmt-clean under 1.93.1 rustfmt, and CI has no fmt step, so I didn't reformat unrelated files.npm/, pypi/, gem/) changes are needed: this is Rust apply logic only.pipenv_workon_home_and_dot_venv_copies_are_all_patchedglobal_system_and_user_site_copies_are_all_patched🤖 Generated with Claude Code
Note
Medium Risk
Changes in-place patch behavior for PyPI agent apply across multiple environments; incorrect deduplication or fan-out could miss a copy or double-patch, though tests and canonical-path collapse mitigate that.
Overview
Agent-mode PyPI apply now patches every discovered site-packages copy of a release (like gems and npm), instead of only the first path the crawler returns. That closes cases where Pipenv’s WORKON_HOME venv and ./.venv both hold the same version (#529), or global installs shadow user vs system dirs (#501), leaving the import path unpatched while vex still reported success.
The apply loop fans out over all PyPI copies with one JSON event per copy, dedupes symlinked/aliased dirs via distinct_install_dirs, and keeps Maven on a single representative. mismatch_blob_gaps gates release variants per copy for PyPI/gem so prefetch matches multi-wheel layouts. CLI_CONTRACT.md and CHANGELOG.md document the rule; new offline e2e tests cover the Pipenv and global user-site scenarios.
Reviewed by Cursor Bugbot for commit d354e9b. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Assisted-by: Claude Code:claude-opus-5-5
The Python crawler can find one release in several site-packages dirs, but apply patched only the first. The copy the interpreter actually imports could stay vulnerable while vex attested it. Apply now patches every distinct copy, like gem and npm; paths that alias one directory through a symlink count once. Fixes #529, #501 Assisted-by: Claude Code:claude-opus-5-5
The apply JSON envelope reports per-copy outcomes as events, not results; count the applied events for the patched release. Assisted-by: Claude Code:claude-opus-5-5
d3fddc9 to
99881ad
Compare
|
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.
|
Ready for review — head
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Reviewed
Validation: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Two environments can hold different wheels of one release. Apply gates each variant per copy, but the blob prefetch gated it against the first copy only, so a locally modified file in the second copy never got its full patched blob and its apply then failed. The prefetch now probes each variant on the copies it is applied to. Assisted-by: Claude Code:claude-opus-5-5
|
[agent] Fixed in
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 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 d354e9b. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Follow-up review of |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Agent mode patches only the WORKON_HOME venv when a Pipenv project also has an auto-detected ./.venv, so Pipenv 2018–2026.1 keep running the unpatched .venv and VEX attests not_affected (regression from #388) With the same release in user site-packages and a system site-packages dir, agent mode patches the shadowed system copy, leaves the copy Python imports unpatched, and VEX attests it (worse since #452: now hits apt-installed packages)
There was an error while loading. Please reload this page.