Repository navigation
Fix pip reinstall advisory after unwind (#1953) - #1954
Conversation
Assisted-by: Claude Code:claude-opus-5-5
After a hosted rollback, a vendored rollback or `vendor --revert` of a requirements.txt pin, a plain `pip install -r` reports the requirement already satisfied and keeps the patched wheel, while `pip freeze` keeps naming the patch server or the deleted vendored wheel. The CLI only named the reinstall for PDM, uv and Pipenv, so pip users got the generic "until the next package-manager install" note (false for pip) or, from `vendor --revert`, no advisory at all. The reinstall advisory now knows pip: a vendored `requirements` entry and a hosted pin in any requirements file (`*.txt`, `*.in`) name `pip install --force-reinstall --no-deps <name>==<version>` and the `uv pip` equivalent, and rollback's note lists pip with the tools a plain install does not refresh. Fixes #1953 Assisted-by: Claude Code:claude-opus-5-5
Review fixes for the pip reinstall advisory: - A hosted pin wired in both uv.lock and a `uv export` requirements.txt kept getting pip's remedy instead of uv's. A lock tool now wins over a requirements file beside it. - The CLI had its own requirements-file rule (`.in`, any case) that disagreed with the hosted restore. It now asks core's restore which files it reads as requirements. - The remedy pinned `--force-reinstall name==version`, which ignores the file's index and `--hash` options and its version range. It now says to uninstall the package and reinstall from the requirements file. - Rollback's note says "a plain install or sync", which fits both pip and the lock tools. Refs #1953 Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
|
BugBot review Generated by Claude Code |
The pip advisory always told users to run `pip install -r requirements.txt`, even when the restored pin lived in another file such as reqs/dev.txt, so following it did not bring the upstream release back. The advisory now names the requirements files that wired the pin: hosted takes them from the restored pin, vendored from the entry's wiring records. An entry with no recorded wiring gets a placeholder rather than a guessed file name. Refs #1953 Assisted-by: Claude Code:claude-opus-5-5
|
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 b572ade. Configure here.
|
Burn-down agent: labeled Ready for review.
Generated by Claude Code |
Final review briefWhat it does. After a rollback, Risk: low. It only changes the text of the advisory and rollback's note. No lock, wiring or install behavior changes. When a pin is wired by both a lock and a requirements file, the lock tool's remedy still wins, so existing PDM/uv/Pipenv output stays the same. Look here
Verified
Changes I made: none. Open questions (not blocking)
Auto-merge (squash) is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
Wenxin Jiang (Wenxin-Jiang)
left a comment
There was a problem hiding this comment.
[agent] Reviewed b572ade917811435a4421b67d945baeffa7ebfa6. Checked pip reinstall advisories, requirements wiring paths, lock-tool precedence and rollback/remove/vendor propagation. No major correctness issues found. Validation: source and regression-test review plus the available exact-head CI checks; no local test pass is claimed.
Resolve the conflict with #1954 in VendoredBackend::revert: the entry's wiring files, read from the cloned entry before the revert drops it, go to push_vendor_advisory as main now requires. Assisted-by: Claude Code:claude-opus-5-5
Resolves hosted_unwind.rs against #1954's pip reinstall advisory: main's Unwound/of_files version now sits inside the merged post-flush block. Assisted-by: Claude Code:claude-opus-5-5
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1953
Summary
After a hosted
rollback, a vendoredrollbackorvendor --revertof a requirements.txt pin, a plainpip install -rreportsRequirement already satisfiedand keeps the patched wheel.pip freezealso keeps naming the patch server, or the vendored wheel thatvendor --revertjust deleted. Before this PR the CLI told pip users the opposite: rollback printed the generic "until the next package-manager install" note, andvendor --revertprinted no advisory. pip users now get the same*_pypi_reinstall_requiredadvisory that PDM, uv and Pipenv already get (#477 / #1308).Root cause
commands/pypi_reinstall.rsnames the reinstall that brings back the upstream build after an unwind, but itsToolenum only knew PDM, uv and Pipenv.Tool::of_flavor("requirements")andTool::of_file("requirements.txt")returnedNone, andremedyhad no pip arm. Hosted rollback, vendored rollback, remove,vendor --revertandscan --pruneall route through that one helper, so the fix belongs there.Change
Tool::Pip: the vendoredrequirementsflavor maps to it. A hosted pin maps to it when core's hosted restore reads the wiring file as a requirements file. The newupstream::is_requirements_filereusesformat_of, so the CLI and core can't disagree about which files count.Tool::of_files: when a hosted pin is wired by both a lock and a requirements file (auv exportrequirements.txt next touv.lock), the lock tool's remedy wins, because that is the sync that keeps the patched build.pip uninstall -y <name>, thenpip install -r <file>for each requirements file that wired the pin (with theuv pippair as an alternative). Hosted reads the files from the restored pin and vendored from the entry's wiring records; lock files are filtered out, paths are shell-quoted, and an entry with no recorded wiring gets a<requirements file>placeholder instead of a guessed name. The uninstall-then-reinstall form keeps the requirements file's own version range,--index-urland--hashoptions. A pinned--force-reinstall name==versionwould drop them.reinstall_required,vendor_pypi_reinstall_requiredandredirect_pypi_reinstall_requiredare updated to match.npm/,pypi/,gem/only dispatch to the binary).Out of scope
pylock.tomlinstalled withpip install -r pylock.tomland Hatch envs probably behave the same way, but After a hosted rollback or vendored revert of a requirements.txt pin, plainpip install -rkeeps the patched build, though rollback says the next install restores it (andvendor --revertsays nothing) #1953 didn't test them and neither did I. They keep the generic note. That deserves a follow-up issue backed by a probe.Test evidence
main→ green hererollback/removeof a requirements.txt pinmode_migration_pypi::pypi_unwinds_name_the_reinstall_a_plain_sync_skips(newpiprow)pip hosted ["rollback", "--yes"] namespip uninstall -y six`` panicked atmode_migration_pypi.rs:3798; green after the fixrollback,remove,vendor --revert,scan --prunepiprow)pypi_reinstall::tests::requirements_wiring_is_pip,advisory_names_pips_uninstall_and_reinstallTool::Pip)rollback::tests::reinstall_note_defers_to_the_pypi_advisoryLocal runs:
cargo fmt --all -- --check: clean.cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-cli --all-features --test mode_migration_pypi: 76 passed.cargo test --workspace --all-features --no-fail-fast(on 194940d): 236 test binaries passed, 4 had failures (11 tests). The only failures are tests that can't pass in this sandbox, and none of them involves this change: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_…) fail identically on unmodifiedmain, as recorded in Build: share one test env guard in core (#1889) #1891. Threein_process_redirecttests (partial_lockfile_write_failure_…,redirect_json_mode_write_failures_…,vlt::…invalidation_failure_warns) and tworepairtests (…cleanup_failure_…,…lock_file_unremovable) are write-failure tests of the same kind.e2e_bun_lockbtests reach the live blob API from this sandbox (themissing_blobrollback). That is the issue ci-janitor Fix bun.lockb nightly e2e reaching the live blob API #1905 fixes.Bugbot
One finding on c8cd874: the remedy hard-coded
requirements.txt. Fixed in b572ade (pip_remedy_names_the_wiring_requirements_files), the thread is answered and resolved, and Bugbot was re-triggered./code-review highfindingsI verified all 7 and fixed them in 194940d: lock tool beats a requirements file; one requirements-file classifier shared with core; uninstall plus
pip install -rinstead of a pinned force-reinstall (this also covers a missing version, version ranges, index and hash options, and the percent-encoded version); "install or sync" wording.Generated by Claude Code