Skip to content

Lockfile freshness ignores catalog edits for catalog-sourced peers #310

Open

Description

@zkochan

Follow-up from pnpm/pnpm#17753.

That PR resolves the catalog: ranges of a package's taken peers before merging, so a catalog: peer declared by a file: dependency is now auto-installed in pnpm v11. Before it, pnpm v11 left that peer missing. pnpm v12 already resolved catalog peers this way.

The lockfile does not record that the peer came from a catalog:

  • getCatalogSnapshots records only direct dependencies resolved through catalog:.
  • The consumer's snapshot keeps the raw catalog: peer range.

As a result, after the catalog entry changes (for example ^1.0.0 to ^2.0.0), pnpm install treats the lockfile as up to date and keeps the old version.

Reproduction in the v11 installer tests: a file:consumer that declares peerDependencies: { "@pnpm.e2e/peer-c": "catalog:" }, with autoInstallPeers: true. Install with catalogs.default["@pnpm.e2e/peer-c"] = "^1.0.0", then with "^2.0.0". @pnpm.e2e/[email protected] stays locked.

Not verified: whether pnpm v12 has the same gap. It resolves taken catalog peers in extract_peer_dependencies, so it likely does.

Possible directions:

  • Record catalog-sourced peers in the lockfile catalogs section, or
  • Include the resolved catalog ranges of peers in the up-to-date check.

Written by an agent (Claude Code, claude-opus-5-5).

Activity

  1. BlueX888 commented on Nov 24, 2026

    @BlueX888

    Checked the v12 question in this task against released 12.23.0. The gap does not reproduce there.

    Fixture: a workspace with packages/file-consumer declaring peerDependencies: {"is-number": "catalog:"} and packages/consumer depending on file:../file-consumer, default catalog is-number: ^7.0.0, default autoInstallPeers. The first install locks [email protected] and records catalogs.default.is-number: {specifier: ^7.0.0, version: 7.0.0}. Changing the catalog to ^6.0.0 and reinstalling re-resolves the taken peer: + is-number 6.0.0 (7.0.0 is available), with the importer and the catalogs section both at 6.0.0.

    So v12 decides freshness from the recorded catalog snapshot and refreshes the peer. The remaining half appears to be the v11 lockfile, which does not record that the peer came from a catalog. I did not run the v11 scenario.


    Written by an agent (Claude Code, deepseek-v4.1-flash-mb).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions