Skip to content

Build the Pipenv stale-install remedy in one core helper: hosted scan and vendored pypi each write it, and the copies drifted #1878

Closed

Description

[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register comment.

Kind: refactor. Register ID: T26.

Problem

When an unpatched release is still installed, Pipenv will not reinstall it. Both hosted scan and vendored pypi tell the user what to do, and each builds that remedy itself. Both copies sort the stale sites into three classes (inherited base site, a venv copy shadowing the base, the venv's own copy) and pick the matching pypi_pipenv::*_remedy text:

A third copy of the "Pipenv does not reinstall a release that is already present…" sentence is in commands/pypi_reinstall.rs L86-L89.

The copies have drifted (verified by reading):

  • Warning count. Hosted emits one warning per (site, purl). Vendored aggregates every site into one warning per purl, with a For <dirs>: lead when the sites fall into more than one class.
  • Suffix. Hosted says "socket-patch vex --product <purl> re-verifies", with a literal <purl> placeholder. Vendored says "socket-patch vex re-verifies".
  • Name parsing. Hosted hand-splits the purl (strip_prefix("pkg:pypi/") + split('@')), falling back to the literal <package>. Vendored uses parse_pypi_purl and falls back to the whole purl. This is one of the A14 copies.
  • Order of checks. Hosted checks the inherited class before the shadowing probe, per site. Vendored partitions all sites first.

Proposed change

  • Add a core vendor::pypi_pipenv::stale_install_detail(lock, name, version, sites) -> String. It does the partition and wording once.
  • pipenv_stale_install_warning calls it, and so does hosted python.rs; hosted keeps its own warning code and its lead sentence.
  • Replace hosted's hand purl split with parse_pypi_purl.
  • Fix the <purl> placeholder: substitute the purl.

Size

3 files. Roughly −70 / +30.

Acceptance criteria

  • Vendored warning text is unchanged. The vendor/pypi.rs pipenv stale tests guard it.
  • Hosted's detail names the actual purl rather than <purl>.
  • A unit test covers the shared helper for each of the three site classes.
  • Move the CLI test that re-tests core categories (python.rs L369) to core or delete it.

Activity

  1. added
    arch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)
    refactorStructural change: duplicated code or logic, missing abstraction, layering, dead code
    on Oct 30, 2026
  2. mikolalysenko commented on Oct 30, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Claiming this issue (shared root cause: the Pipenv stale-install remedy is built twice, in hosted scan and in vendored pypi). Branch: agent/fix-pipenv-stale-remedy. Claim-ID: 2026-10-30T04:23:20Z-e95298


    Generated by Claude Code

  3. mikolalysenko commented on Oct 30, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Draft PR: #1883


    Generated by Claude Code

  4. added a commit that references this issue on Oct 30, 2026
    1e057b9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)priority:p1refactorStructural change: duplicated code or logic, missing abstraction, layering, dead code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions