Skip to content

Fix Pipenv requirements remedy categories (#1507) - #1508

Merged
Mikola Lysenko (mikolalysenko) merged 2 commits into
mainfrom
agent/fix-pipenv-requirements-categories
Oct 14, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 2 commits into
mainfrom
agent/fix-pipenv-requirements-categories

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

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

Fixes #1507

Summary

Socket Patch prints a remedy when a --site-packages Pipenv venv imports an
unpatched copy from its base interpreter (#1450). If the package was pinned in
several lock categories and at least one was named ([packages] + [docs],
[dev-packages] + [docs], …), the remedy printed
pipenv requirements --categories "packages docs". On Pipenv
2022.12.x–2023.2.4 that export is empty, so the follow-up
pip install -r installed nothing and exited 0. The venv kept the unpatched
copy and the warning came back on the next scan.

The export now names comma-joined lock keys
(--categories "default,docs"), which every Pipenv release that has
--categories reads. The pipenv sync remedies are unchanged and keep the
Pipfile names that sync takes.

Root cause

install_over_command (crates/socket-patch-core/src/vendor/pypi_pipenv.rs)
reused sync_args, which joins Pipfile names with spaces. That's correct for
pipenv sync, but pipenv requirements before 2023.2.18 splits
--categories on commas and looks each name up as a raw lock key. The fix
adds requirements_args, which keeps sync_args' plain/--dev forms and
renders named categories as comma-joined lock keys. Hosted and vendored
modes both go through this one function, so both are fixed. The npm, PyPI and
gem wrappers don't touch this code.

Test evidence

  • New base_site_remedy_exports_comma_joined_lock_keys covers
    default+docs, develop+docs, default+develop+docs+tests and docs-only for
    both base-interpreter remedies. It also asserts that sync still takes
    Pipfile names. The existing Pipenv stale-install remedy can't replace a base-interpreter copy in a --site-packages venv: pip uninstall refuses it and pipenv sync keeps it, so following the warning leaves the package unpatched #1450 test's expectation was updated.

    • Red before the fix: both tests failed (cargo test -p socket-patch-core --lib base_site: 2 failed).
    • Green after: cargo test -p socket-patch-core --lib pypi_pipenv: 33 passed.
  • Real Pipenv run against the issue's lock (default: idna, six; develop: six; docs: six):

    pipenv requirements --categories … 2022.12.19 2023.2.4 2026.9.1
    "packages docs" (old) empty – –
    "dev-packages docs" (old) empty – –
    "default,docs" (new) idna six – idna six
    "develop,docs" (new) six – six
    "default,develop,docs" (new) idna six idna six idna six
    "docs" (new, single) six – six
  • cargo fmt --all -- --check: clean. cargo clippy --workspace --all-features -- -D warnings: clean.

  • cargo test -p socket-patch-cli --all-features --lib: 919 passed.

  • cargo test -p socket-patch-core --all-features: 6460 passed, 4 failed.
    The 4 failures are permission tests (copy_tree symlinked root,
    vlt_heal unremovable lock, pypi_poetry/pypi_requirements write
    failure). They can't fail as intended under root in this container, and
    they fail the same way with this PR's change reverted. CI runs as non-root.

  • The full cargo test --workspace hit this container's disk allowance
    while linking integration-test binaries (no test failed), so CI's full run
    is the check for those suites. No CLI integration test asserts this remedy
    string.

Per-issue checklist

/code-review high findings not fixed

🤖 Generated with Claude Code

https://claude.ai/code/session_01CdJ5dk71VDEiEYvkU3ULap


Generated by Claude Code

Assisted-by: Claude Code:claude-opus-5-5
The remedy for a stale base-interpreter copy in a --site-packages
venv printed `pipenv requirements --categories "packages docs"` when
the package sat in several lock categories, one of them named.
Pipenv 2022.12.x-2023.2.4 read that as one category the lock lacks,
so the export was empty, pip exited 0 and the venv kept importing
the unpatched copy while the warning repeated.

The export now names comma-joined lock keys ("default,docs"), which
every Pipenv release with --categories reads. The sync remedies keep
the Pipfile names `pipenv sync` takes.

Fixes #1507

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 9d5027f. Configure here.

Merged via the queue into main with commit 887a5f7 Oct 14, 2026
86 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-pipenv-requirements-categories branch October 14, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants