Repository navigation
Fix Pipenv stale-install remedy ignoring lock categories (#790) - #795
Merged
Mikola Lysenko (mikolalysenko) merged 3 commits intoOct 5, 2026
Merged
Mikola Lysenko (mikolalysenko) merged 3 commits into
Mikola Lysenko (mikolalysenko) merged 3 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
When a warm Pipenv virtualenv still holds the unpatched release, the hosted and vendored warnings told users to run `pipenv run pip uninstall -y <pkg> && pipenv sync` or `pipenv --rm && pipenv sync`. Plain `pipenv sync` installs only the default category, so for a package pinned in [dev-packages] or a named category, following the advice removed the package instead of reinstalling it patched, and the --rm form dropped every dev and category package. Both warnings now build the remedy from the Pipfile.lock: the targeted form re-syncs the categories that pin the package (`--dev`, or `--categories "<names>"`), and the --rm form re-syncs every non-empty category. Fixes #790 Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 4, 2026 16:50
Collaborator
Author
|
BugBot review Generated by Claude Code |
The develop-category regression test built only the POSIX lib/python3.12/site-packages layout, which the Windows venv probe never reads, so no stale install was found and the warning never fired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K9MfJ84pKgWnWZUoTYq8Zg
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 fbdfa6f. Configure here.
Collaborator
Author
|
Ready for review (burn-down agent).
Generated by Claude Code |
Tanmay Singla (Tanmay182003)
approved these changes
Oct 5, 2026
Mikola Lysenko (mikolalysenko)
deleted the
agent/fix-pipenv-remedy-lock-categories
branch
October 5, 2026 11:39
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 #790
Summary
When a warm Pipenv virtualenv still holds the unpatched release, the stale-install warning's remedy now reinstalls the package from the lock for every Pipfile.lock category. Before this change, following the printed remedy for a
[dev-packages]or named-category package uninstalled it and left it uninstalled.Root cause
The hosted
redirect_pypi_stale_installand vendoredpypi_pipenv_stale_installwarnings printed fixed text:pipenv run pip uninstall -y <pkg> && pipenv syncorpipenv --rm && pipenv sync. Plainpipenv syncinstalls onlydefault. So for a package pinned indevelopor a Pipenv 2022+ named category, the remedy removed it. The--rmform also dropped every dev and category package, even for adefaultpackage.Fix
socket_patch_core::vendor::pypi_pipenv::stale_install_remedy(lock, name). Both warnings use it, so they can't drift apart again:uninstall && sync): re-syncs exactly the categories that pin the package.defaultgives plainpipenv sync(unchanged),default/developgives--dev, and anything with a named category gives--categories "<Pipfile names>"(packages,dev-packages,<name>);--rm && sync): re-syncs every non-empty category in the lock;pipenv install --deploygets--devwhen the package is indevelop. Named categories don't exist before 2022;default-only text.Pipfile.locktext (rewrite.files, falling back to the read files). Vendored passes the already-parsed project lock.CLI_CONTRACT.mdanddocs/testing/pipenv-compatibility.md("Verified remedies") describe the category-aware arguments.Per-issue checklist
pipenv sync, so for a [dev-packages] or named-category entry following it uninstalls the package instead of reinstalling it patched #790, develop/named category, hosted:commands::scan::hosted::python::tests::pipenv_remedy_resyncs_the_category_that_pins_the_packagepipenv sync, so for a [dev-packages] or named-category entry following it uninstalls the package instead of reinstalling it patched #790, develop category, vendored:vendor::pypi::tests::pipenv_stale_install_remedy_names_the_develop_categorypipenv sync, so for a [dev-packages] or named-category entry following it uninstalls the package instead of reinstalling it patched #790, every variant (default only, develop, a default package next to dev-packages for--rm, named category, multi-category, no lock):vendor::pypi_pipenv::tests::stale_install_remedy_follows_the_lock_categoriesTest evidence
stale_install_remedyto ignore the lock, which reproduces the old behaviour. All three new tests then FAILED (core: 2 failed; cli lib: 1 failed). With the fix they pass.[packages] idna,[dev-packages] attrs,[docs] six), on 2026.8.0 and 2022.12.19:pip uninstall -y six && pipenv sync --categories "docs": all packages present;pip uninstall -y attrs && pipenv sync --dev: all present;pipenv --rm && pipenv sync --categories "packages dev-packages docs": all present;pip uninstall -y six && pipenv sync:ModuleNotFoundError: No module named 'six'(reproduces Pipenv stale-install remedy always sayspipenv sync, so for a [dev-packages] or named-category entry following it uninstalls the package instead of reinstalling it patched #790).cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-cli --all-features --lib --test in_process_redirect_pipenv --test in_process_vendor: 835 + 6 + 104 passed.cargo test -p socket-patch-core --all-features --lib: 4844 passed, 4 failed. The 4 failures are not caused by this change. They arechmod 0o555read-only-directory tests (copy_tree::relax_loop_must_not_traverse_symlinked_root,vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry,pypi_poetry::wire_write_failure_…,pypi_requirements::wire_failure_rolls_back_…), and they can't fail as designed when the sandbox runs as root (uid 0). CI runs as non-root.77071a5,test (windows-latest)failed invendor::pypi::tests::pipenv_stale_install_remedy_names_the_develop_category("the upstream six.py is installed"). The test only built the POSIXlib/python3.12/site-packageslayout, but the Windows venv probe reads.venv\Lib\site-packages. The test now also places the install there on Windows. The product code is unchanged.cargo test --workspace --all-featuresran out of the sandbox's disk (target/ reached 29 GB while linking the integration test binaries). CI covers it;cargo fmt --all -- --checkis not clean onmainitself (rustfmt 1.8.0 reformats ~130 files untouched by this PR), and CI doesn't run it. The files this PR touches were formatted hunk-by-hunk withrustfmt, so the diff carries no unrelated reformatting.🤖 Generated with Claude Code
https://claude.ai/code/session_01K9MfJ84pKgWnWZUoTYq8Zg
Note
Low Risk
Warning-message and documentation changes only; no redirect, vendor wiring, or install behavior is altered.
Overview
Fixes #790: stale-install warnings for Pipenv no longer tell users to run plain
pipenv sync, which only reinstallsdefaultand could leave dev or named-category packages missing afterpip uninstall.A shared
stale_install_remedy(lock, name)inpypi_pipenvbuilds the reinstall text fromPipfile.lock: targetedpipenv syncgets--devor--categories "…"for the sections that pin the package;pipenv --rm && pipenv synclists every non-empty category. Hostedredirect_pypi_stale_installand vendoredpypi_pipenv_stale_installboth call it (hosted passes the post-rewrite lock text from the scan rewrite). Contract and Pipenv compatibility docs match the new wording. Tests cover develop, named categories, multi-section pins, and Windows venv layout.Reviewed by Cursor Bugbot for commit fbdfa6f. Configure here.
Generated by Claude Code