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 vendored requirements.txt re-vendoring removed pins (#786) by mikolalysenko · Pull Request #787 · SocketDev/socket-patch

Conversation

@mikolalysenko

@mikolalysenko Mikola Lysenko (mikolalysenko) commented Oct 4, 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 #786

Root cause

dispatch_in_use_one (crates/socket-patch-cli/src/commands/vendor.rs) only has lockfile in-use probes for npm and cargo. For pypi it returns None ("can't tell"). The vendor-ledger discovery supplement and the scan --prune GC both treat None as "still wired". So when a user removes or bumps a vendored requirements.txt pin, the next vendored scan rediscovers the ledger entry. It then re-adds the package as a (transitive) line, or refuses with pypi_requirement_not_pinned on every run, and --prune never reverts the entry.

Change

  • vendor::pypi_requirements::requirements_entry_in_use: for the requirements flavor, the requirements tree is the lock pip installs from. The probe reads the root requirements.txt plus every in-root -r include (the same walk the planner and the unwired-revert guard use).
    • Some(true) when a requirement line's code (not its comment) still names .socket/vendor/pypi/<uuid>/.
    • Some(false) when the tree was read and nothing does.
    • None (keep the entry, fail-safe) when no file could be read, or when a reached include exists but is unreadable.
  • vendor::pypi::vendored_entry_in_use routes the requirements flavor to that probe. Every other pypi flavor still returns None. dispatch_in_use_one gains the pypi arm.

Tests (red → green)

  • crates/socket-patch-cli/tests/scan_vendor_requirements_unwired.rs (built binary, mock patch API with no patches, seeded requirements-flavor ledger):
    • removed_vendored_pin_is_unwired_and_pruned (Vendored requirements.txt after the user removes or bumps a vendored pin: the rescan re-adds the removed package as a "(transitive)" line (exit 0), or exits 1 forever after a bump, and scan --prune never reverts the entry #786 case A) and bumped_vendored_pin_is_unwired_and_pruned (Vendored requirements.txt after the user removes or bumps a vendored pin: the rescan re-adds the removed package as a "(transitive)" line (exit 0), or exits 1 forever after a bump, and scan --prune never reverts the entry #786 case B). A plain rescan warns vendor_ledger_entry_unwired, exits 0, never sends the stale purl to the patch API and leaves requirements.txt untouched. --prune then reports the entry in gc.revertedVendoredEntries, exits 0, keeps the user's own pin and removes the uuid dir and the ledger entry.
    • wired_vendored_pin_stays_discoverable (control: the fresh-clone supplement still works).
    • Red without the fix: with the pypi arm removed from dispatch_in_use_one, both Vendored requirements.txt after the user removes or bumps a vendored pin: the rescan re-adds the removed package as a "(transitive)" line (exit 0), or exits 1 forever after a bump, and scan --prune never reverts the entry #786 tests fail at the vendor_ledger_entry_unwired assertion (0 warnings). The control passes either way.
  • Core unit tests in pypi_requirements.rs: in_use_probe_sees_wired_vendor_lines (root pin, transitive line, -r include), in_use_probe_reports_removed_or_bumped_pins_unused (removed, bumped, commented-out, another uuid), in_use_probe_is_undeterminable_without_a_readable_tree (no requirements.txt, FIFO include).
Issue Regression test
#786 case A (removed pin re-added as transitive) removed_vendored_pin_is_unwired_and_pruned
#786 case B (bumped pin, exit 1 forever) bumped_vendored_pin_is_unwired_and_pruned

Local verification

Command Result
cargo clippy --workspace --all-features -- -D warnings clean
cargo test -p socket-patch-core --all-features --lib 4845 passed. The 4 that fail as root (permission-denial fixtures: relax_loop_must_not_traverse_symlinked_root, an_unremovable_hidden_lock_keeps_every_store_entry, wire_write_failure_maps_error_and_leaves_lock_untouched, wire_failure_rolls_back_already_written_files) pass when re-run as an unprivileged user
cargo test -p socket-patch-cli --all-features --lib 834 passed
--test scan_vendor_requirements_unwired 3 passed
--test scan_requirements_lock_only 2 passed
--test scan_vendor_e2e 33 passed
--test e2e_vendor_pypi_build -- --include-ignored (uv 0.8.17, real pip) 23 passed
node --test npm/socket-patch/bin/socket-patch.test.mjs passed

I couldn't run the full cargo test --workspace locally: building every test binary exceeds the session's disk allowance. CI runs it.

CI

All 475 checks are green on 580fff7, and Bugbot reviewed 580fff7 with no findings. The first attempt had three compatibility-matrix cells fail on paths this change can't reach, so I re-ran them once and all passed:

  • Bun 1.3.0 preexisting-manifest vendored (refusalCodesExact, an 80s case).
  • PDM 1.15.5 and 2.9.3 agent-mode rescanIdempotent.

The same jobs were green on other open PRs.

Notes

  • The repo isn't cargo fmt-clean on main with the pinned toolchain, and CI has no fmt gate. cargo fmt --all rewrites about 130 unrelated files, so this PR carries only its own hunks, which are rustfmt-clean.
  • Follow-ups (not claimed here): uv / poetry / pdm / pipenv / hatch / python-lock entries, and gem / golang / composer / nuget / maven, still have no in-use probe. They keep the fail-safe None.
  • No wrapper changes are needed (npm/ only dispatches to the binary; the pypi and gem wrappers were dropped in v5).
  • Picked ahead of older p1 issues because it's a correctness bug that silently re-adds a dependency the user removed, and the fix is small and self-contained.

🤖 Generated with Claude Code


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 #786
004ad9c
Assisted-by: Claude Code:claude-opus-5-5
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 4, 2026
Vendored requirements.txt after the user removes or bumps a vendored pin: the rescan re-adds the removed package as a "(transitive)" line (exit 0), or exits 1 forever after a bump, and scan --prune never reverts the entry #786
Closed
@claude
Stop re-vendoring removed requirements.txt pins
580fff7
A vendored requirements.txt entry stayed "in use" forever, because
the in-use probe behind the ledger supplement and `scan --prune` had
no pypi arm. After a user removed a vendored pin, the next vendored
scan re-added the package as a "(transitive)" line. After a bump,
every scan failed with pypi_requirement_not_pinned. `--prune` never
reverted the entry.

The requirements flavor now asks its requirements tree (the root
file plus in-root -r includes) whether any requirement line still
installs the vendored wheel. A removed or bumped pin now gets the
vendor_ledger_entry_unwired warning, and `--prune` reverts it with
exit 0. An unreadable tree still keeps the entry.

Fixes #786

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

Mikola Lysenko (mikolalysenko) commented Oct 4, 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 4, 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 580fff7. Configure here.

Sorry, something went wrong.

Uh oh!

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

All reactions
@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 4, 2026
@mikolalysenko

Mikola Lysenko (mikolalysenko) commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator Author

Ready for review — head 580fff7847e3.

  • CI: 97/97 completed checks green (3 skipped by path filter); branch is up to date with main, no conflicts.
  • Bugbot: reviewed 580fff7 — no findings. No unresolved review threads.
  • Reviewer focus: the new pypi arm in dispatch_in_use_one returns None (keep entry) whenever the requirements tree can't be fully read, so --prune only reverts entries it can prove are unwired.

Generated by Claude Code

All reactions

Sorry, something went wrong.

Uh oh!

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

Tanmay182003
Tanmay Singla (Tanmay182003) approved these changes Oct 5, 2026
View reviewed changes
@mikolalysenko Mikola Lysenko (mikolalysenko) mentioned this pull request Oct 5, 2026
Fix uv vendored revert half-reverting after a relock (#806, #821) #822
Merged
4 tasks done
@mikolalysenko
Mikola Lysenko (mikolalysenko) merged commit 70fb61f into main Oct 5, 2026
585 of 588 checks passed

Uh oh!

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

@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/fix-pypi-vendored-in-use-probe branch October 5, 2026 11:38
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 requirements.txt after the user removes or bumps a vendored pin: the rescan re-adds the removed package as a "(transitive)" line (exit 0), or exits 1 forever after a bump, and scan --prune never reverts the entry

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.