Repository navigation
Fix vendored PDM missing stale-install warning (#641) - #1727
Conversation
Assisted-by: Claude Code:claude-opus-5-5
Vendoring a patch into a PDM project whose pdm.lock was written by PDM before 2.11 (lock_version 2, 4.3 or 4.4) left an env that already held the package unpatched: PDM keeps a same-version install on `pdm sync`, the scan said nothing, and `vex` attested not_affected with a "re-run your install" hint that does not help. The vendored PDM flavor now probes the env PDM installs into (its venv or PEP 582 __pypackages__) like the Pipenv and Hatch flavors, and warns pypi_pdm_stale_install with the remedy that release line supports: `pdm sync --reinstall` on PDM 2.x, or removing the installed copy before `pdm sync` on PDM 1.x, which has no --reinstall. vex's vendored_tree_out_of_sync hint names the same remedy. A 2.11+ lock stays silent. Fixes #641 Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
Review follow-ups for the PDM < 2.11 stale-install warning: - warn on a superseding re-wire too, not only fresh and in-sync runs - name a copy inherited from the base interpreter of a --system-site-packages venv apart, with a remedy that reaches it - add vex's PDM hint only for a package pdm.lock wires to a vendored artifact, reading pdm.lock once per run instead of once per package - share the "keeps an installed release" lock-version check between hosted and vendored mode - say "PDM before 2.0" for lock_version 2, which PDM 0.x writes too 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 dd2a447. Configure here.
|
Labeled Ready for review (burn-down agent).
Generated by Claude Code |
Final review briefWhat it does. PDM releases before 2.11 (pdm.lock Risk: low. It only adds a warning and extends a hint. It doesn't change patch application, lock wiring or auth. The lock-version check is now one shared predicate, and hosted mode behaves the same as before. Look here
Verified
Changes I made: none. Open questions: none blocking. As the PR description notes, the probe runs twice per package (preflight plus the real run), the same as Pipenv and Hatch. Auto-merge is armed, so approving sends this straight to the merge queue. Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #641
Summary
scan --mode vendored(andvendor) on a PDM project whosepdm.lockwas written by PDM before 2.11 now warnspypi_pdm_stale_installwhen the env PDM installs into still holds the upstream release. Before, it said nothing, the nextpdm synckept the unpatched bytes, andvexattestednot_affectedwith a "re-run your install" hint that doesn't work on those releases. The warning names the remedy that works for that release line, andvex'svendored_tree_out_of_synchint now names it too.Root cause
PDM < 2.11 (lock_version
2/4.3/4.4) keeps a release already installed at the same version onpdm sync/pdm install. Hosted mode already accounted for this (redirect_pdm_stale_install_riskplus the installed-byte probe). The vendored flavors had an installed-byte probe only for Pipenv and Hatch, so the PDM flavor never checked.Changes
vendor/pypi.rs: newpdm_stale_install_warning, the PDM twin of the Pipenv/Hatch probes. It reusesstale_install_sitesovernon_hatch_local_venv_site_packages, which already resolves PDM's env (.pdm-python, an activated or in-project venv, PEP 582__pypackages__). It runs on a fresh vendor, an in-sync re-run, and a superseding re-wire. A copy inherited from a--system-site-packagesbase interpreter is named separately with a remedy that reaches it.vendor/pypi_pdm.rs:stale_install_remedygivespdm sync --reinstallon PDM 2.x. For lock_version2(PDM before 2.0, which has no--reinstall), it says to remove the installed copy and then runpdm sync.stale_install_lock/stale_install_notebuild the VEX addendum, only for a package the governing pdm.lock wires to a vendored artifact, and read pdm.lock once per run.utils/pdm_lock.rs:keeps_installed_releaseis now shared by hosted (redirect/pdm.rs) and vendored mode.commands/vex.rs: thevendored_tree_out_of_syncdetail appends the PDM remedy.CLI_CONTRACT.mdwarning table plus the vex hint note, anddocs/testing/pdm-compatibility.md.Test evidence
vendor::pypi::tests::pdm_vendor_warns_about_a_stale_install_before_pdm_2_11left: 0 right: 1(onlyvendor_prebuilt_downloaded) → ok__pypackages__)vendor::pypi::tests::pdm_1x_vendor_warns_about_a_stale_pep582_installleft: 0 right: 1→ okvendor::pypi_pdm::tests::stale_install_note_follows_the_lock_and_its_wiringe2e_vex_build pdm::pdm_vendored_install_then_manifest_less_vex(newstale_install_flow: the warning fires, realpdm synckeeps upstream six, and the named remedy installs the patched wheel)pdm 2.10.4 lock 4.4 stale install: []FAILED → ok on 2.10.4 (lock 4.4), 1.4.5 (lock 2) and 2.29.2 (lock 4.5.1, silent)Commands run locally:
cargo fmt --all -- --check: okcargo clippy --workspace --all-features -- -D warnings: okSOCKET_PATCH_PDM_E2E_REQUIRED=1 SOCKET_PATCH_PDM_E2E_VERSION={2.10.4,1.4.5,2.29.2} cargo test -p socket-patch-cli --all-features --test e2e_vex_build -- pdm:: --ignored: 2 passed per releasecargo test --workspace --all-features --no-fail-fast: 228 of 239 suites passed. The 11 failing tests come from this sandbox and are outside the code this PR touches:e2e_bun_lockbtests need network access to patches-api.socket.dev and the bun release CI pins (bun 1.4.4 is installed locally).Review
I ran
/code-review highand fixed findings 1-7 in dd2a447: base-interpreter copies, the VEX note limited to packages pdm.lock wires, one pdm.lock parse per run, the superseding path, a shared lock-version predicate,parse_pypi_purl, and the wording. I didn't fix this one:pypi_preluderuns from bothservice_preflightand the real run. The Pipenv and Hatch probes already share this cost through the same prelude. Splitting the prelude is a separate refactor.https://claude.ai/code/session_01JGE2ajfBnCgDHnaCM2D1NK
Note
Low Risk
Additive warnings and clearer VEX hints on vendored PyPI/PDM paths; no change to patch application or auth behavior.
Overview
Fixes #641 by surfacing when vendored PDM wiring leaves upstream bytes in the live env on locks written by PDM < 2.11 (
lock_version2/4.3/4.4), wherepdm syncdoes not replace a same-version install.Vendored
vendor/scannow emitspypi_pdm_stale_install(mirroring Pipenv/Hatch): it probes PDM’s install target (venv or PEP 582__pypackages__), namespdm sync --reinstallon PDM 2.x or manual removal before sync on lock_version2, and treats inherited--system-site-packagescopies separately. The warning runs on fresh vendor, in-sync re-run, and superseding re-wire.keeps_installed_releaseinpdm_lockis shared with hostedredirect_pdm_stale_install_risk.vexappends the same PDM remedy tovendored_tree_out_of_syncwhen the governingpdm.lockwires the package to a vendored artifact.CLI contract and PDM compatibility docs document the new code; unit and e2e PDM tests assert warning text, silence on 2.11+ locks, and that the named remedy actually installs the patched wheel.
Reviewed by Cursor Bugbot for commit dd2a447. Configure here.
Generated by Claude Code