GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix Poetry/PDM vendored re-vendor to superseding patch (#1136) by mikolalysenko · Pull Request #1137 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

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

Fixes #1136

Summary

A vendored Poetry (or PDM) project can now move to a newer patch for the same release. Before, when the patch API superseded patch A with patch B, scan --mode vendored and vendor failed with pypi_poetry_source_already_exists (or pypi_pdm_source_already_exists) and exit 1, while --dry-run promised would_revendor. The lock stayed on A, so every install kept getting the old patch. Now the re-vendor rewires the lock to B, sweeps A's artifact (vendor_stale_artifact_removed), and exits 0, as the CLI contract's scan --vendor paragraph promises.

Root cause

The PyPI vendored orchestrator (crates/socket-patch-core/src/vendor/pypi.rs) handles a superseding patch by routing a flavor guard's "already wired by an older socket-patch vendor" refusal through supersede_or_refuse. That replays the old ledger entry's revert, then plans a fresh wiring over the restored lock (#943 did this for uv, script locks and Hatch). The Poetry and PDM arms skipped it: they turned every check_target_guards error straight into a refusal, SUPERSEDABLE_REFUSALS had no Poetry or PDM code, superseded_files had no entry for them, and fresh_pyproject_plan could not re-plan either flavor.

Fix

  • Poetry and PDM arms route a guard refusal through supersede_or_refuse, like uv/script-lock/Hatch.
  • SUPERSEDABLE_REFUSALS gains pypi_poetry_source_already_exists and pypi_pdm_source_already_exists; superseded_files gains poetry.lock / pdm.lock; fresh_pyproject_plan gains Poetry and PDM arms.
  • Unchanged safety: a user-authored source, old wiring with no ledger entry, or old wiring hand-edited since vendoring still refuses, with every file left byte-identical and no new uuid dir. These paths are covered by the existing ledgerless and drifted-wiring tests, now run for Poetry and PDM too.

PDM has no issue of its own. The #1136 reporter found the same gap in the PDM arm and handed it to the PDM routine. It is the same defect at the same boundary, so this PR fixes it too.

No wrapper changes are needed (npm/, pypi/, gem/ only dispatch to the binary).

Tests (red on main → green here)

Issue / lane Test Before fix After
#1136 Poetry LF + CRLF, PDM LF + CRLF (core orchestrator, dry and wet) vendor::pypi::tests::pyproject_flavors_revendor_to_a_superseding_uuid panics: Refused { code: "pypi_poetry_source_already_exists" } pass
Poetry/PDM: drifted old wiring still refuses pyproject_flavors_superseding_uuid_with_drifted_wiring_refuses n/a (new lanes) pass
Poetry/PDM: no ledger entry still refuses pyproject_flavors_superseding_uuid_without_ledger_refuses, splice_flavor_stale_uuid_vendor_refuses_through_orchestrator pass pass
#1136 CLI vendor, Poetry LF + CRLF mode_migration_pypi::pyproject_flavors_vendored_revendor_superseding_patch exit 1, pypi_poetry_source_already_exists pass
#1136 CLI, venv installed from patch A mode_migration_pypi::poetry_revendors_to_a_superseding_patch_over_a_patched_venv exit 1, same code pass
#1136 real Poetry 2.4.3: dry run, wet run, fresh poetry install gets B, revert restores lock e2e_vex_build poetry::poetry_vendored_revendors_to_a_superseding_patch (--ignored, runs in the CI Poetry matrix 1.0.10 to 2.4.3) partial_failure, pypi_poetry_source_already_exists (the issue's exact output) pass

Commands run locally

  • cargo clippy --workspace --all-features -- -D warnings: clean.
  • rustfmt --check on every touched file: clean. Note: cargo fmt --all -- --check flags files on main that this PR does not touch; CI has no fmt gate, so I left them alone.
  • cargo test -p socket-patch-core --all-features --lib: 5772 passed, 4 failed. The same 4 also fail on main in this sandbox because it runs as root, so chmod-based write-failure tests don't trip: copy_tree::relax_loop_must_not_traverse_symlinked_root, vlt_heal::an_unremovable_hidden_lock_keeps_every_store_entry, pypi_poetry::wire_write_failure_maps_error_and_leaves_lock_untouched, pypi_requirements::wire_failure_rolls_back_already_written_files. CI runs non-root and is green on main.
  • mode_migration_pypi: 41/42. The 1 failure, pipenv_hosted_to_vendored_names_the_unpatched_requirements, needs pypi.org, which the sandbox can't reach; it fails the same way on main.
  • in_process_vendor_pypi_takeover, hosted_superseding_pypi, in_process_redirect_poetry: all pass.
  • e2e_vex_build -- poetry:: --ignored with real Poetry 2.4.3: both vendored tests pass. The hosted test fails on pypi.org access in the sandbox; it doesn't touch this code path.
  • The full cargo test --workspace filled the sandbox disk, so I ran the suites above instead. CI runs the full set.

Follow-ups

  • uv hosted → vendored takeover onto a newer patch uuid fails "no installed package found on disk" (exit 1) when the venv holds the hosted patch's bytes, while --dry-run previews success #1105 (uv): a hosted → vendored takeover fails package_not_installed when the venv holds the old patch. That is a separate cause.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9VebYpgWmCcMxocpcReMJ


Note

Medium Risk
Touches lock-file wiring and ledger-driven revert for Poetry/PDM vendoring; behavior change is scoped to superseding socket-patch uuids with existing safety tests for ledgerless and drifted cases.

Overview
Fixes #1136: vendored Poetry and PDM projects can move from patch A to a superseding patch B without failing with pypi_poetry_source_already_exists / pypi_pdm_source_already_exists.

The PyPI vendored orchestrator now treats those guard refusals like uv, script locks, and Hatch—routing them through supersede_or_refuse when the ledger still records the older uuid. That replays the prior vendor revert, rewires the lock to B, removes A’s artifact, and succeeds instead of exiting 1 while --dry-run promised re-vendor.

Implementation adds Poetry/PDM to SUPERSEDABLE_REFUSALS, includes poetry.lock / pdm.lock in supersede revert file lists, and extends fresh_pyproject_plan for both flavors. Refusal paths without a ledger entry or with drifted wiring stay unchanged.

Tests cover core supersede (LF and CRLF locks), CLI migration (including a venv already installed from patch A), and a real-Poetry e2e for dry run, wet re-vendor, fresh install, and revert.

Reviewed by Cursor Bugbot for commit 876923a. Configure here.


Generated by Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@claude
Start fix for #1136
d2d61d3
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 8, 2026
Vendored Poetry never re-vendors to a superseding patch: re-scan exits 1 with pypi_poetry_source_already_exists, while --dry-run previews would_revendor, and the project keeps installing the old patch #1136
Closed
Claude (claude) added 3 commits October 8, 2026 14:42
@claude
Re-vendor Poetry and PDM to a superseding patch
8165728
When the patch API replaced a vendored Poetry or PDM package's patch
with a newer one, `scan --mode vendored` and `vendor` failed with
pypi_poetry_source_already_exists (or the PDM code) and exit 1, while
the dry run promised a re-vendor. The lock stayed on the old patch, so
every install kept getting it.

The Poetry and PDM arms of the PyPI vendored orchestrator now route
their "already wired by an older socket-patch vendor" refusal through
the same supersede path uv, script locks and Hatch use: replay the old
ledger entry's revert, then wire the new patch over the restored lock.
A user-authored source, or old wiring with no ledger entry, still
refuses as before.

Fixes #1136

Assisted-by: Claude Code:claude-opus-5-5
@claude
Test Poetry re-vendor over a patched venv
6816d03
A Poetry project whose venv was installed from the old patch's
vendored wheel must still move to the superseding patch, and reverting
afterwards must restore the original lock.

Refs #1136

Assisted-by: Claude Code:claude-opus-5-5
@claude
E2e: real Poetry re-vendors to a superseding patch
8e0762e
Runs the #1136 report against a real Poetry: vendor patch A, install
it, then let the patch service offer only patch B. The re-vendor must
exit 0, rewire poetry.lock to B and sweep A, a fresh `poetry install`
must get B's bytes, and reverting must restore the pristine lock.

Refs #1136

Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko
Mikola Lysenko (mikolalysenko) marked this pull request as ready for review October 8, 2026 15:08
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@claude
Recreate the venv before installing patch A
876923a
Poetry before 1.2 keeps an installed package whose version is
unchanged, even after its lock source moves to the vendored wheel, so
the e2e never got patch A into the project venv on Poetry 1.0 and 1.1.
Recreate the venv first, as the #1136 report does.

Refs #1136

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

Mikola Lysenko (mikolalysenko) commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

BugBot review


Generated by Claude Code

cursor[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Oct 8, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

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 876923a. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Tanmay182003
Tanmay Singla (Tanmay182003) approved these changes Oct 8, 2026
View reviewed changes
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 8, 2026
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Ready for review (burn-down agent).

  • Head: 876923a1e1a885f21a8ee8f762ebed44ac37981b
  • CI: all check runs green (success/skipped/neutral) on this head, including ci-ok; mergeable, no conflicts.
  • Bugbot: reviewed this head, no new issues; no unresolved review threads.
  • Changelog: untouched.

Already approved.


Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) added this pull request to the merge queue Oct 8, 2026
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 8, 2026
Add CI watch script, API budget rules and /code-review note for agents #1164
Merged
Merged via the queue into main with commit 72ba026 Oct 8, 2026
413 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-pypi-poetry-pdm-supersede branch October 8, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cursor cursor[bot] cursor[bot] left review comments
@Tanmay182003 Tanmay Singla (Tanmay182003) Tanmay182003 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Vendored Poetry never re-vendors to a superseding patch: re-scan exits 1 with pypi_poetry_source_already_exists, while --dry-run previews would_revendor, and the project keeps installing the old patch

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mikolalysenko @Tanmay182003 @claude
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.