Skip to content

Compare a workspace project's version only when something can resolve to it #246

Closed
pnpm/pnpm
#17579

Description

@zkochan

In a workspace with several projects, bumping the version of a project makes both CLIs report "The workspace structure has changed since last install". This happens even when no project depends on the bumped one. verifyDepsBeforeRun then refuses or reinstalls before every command, and a full install changes nothing.

pnpm/pnpm#17561 fixed this for a repository whose only project is its root. Workspaces still compare every project's version (project_structure_matches in pnpm/crates/package-manager/src/optimistic_repeat_install/settle.rs, findWorkspaceStructureIssue in pnpm11/deps/status/src/findWorkspaceStructureIssue.ts).

Repro

Projects a, b, and c, where c depends on a with workspace:* and nothing depends on b. Run pnpm install, change b's version from 1.0.0 to 1.0.1, then run pnpm --config.verify-deps-before-run=error --filter a exec node -e "". Both v11 and v12 exit 1.

The repeat-install oracle's manifest_edits_that_change_no_dependency scenario covers this. Its version step currently allows the refusal and links here.

What a fix has to decide

A version decides only how dependencies resolve to the project. So the check could compare a project's version only when something can resolve to it:

  • some project's manifest declares that package name in any dependency group, including through an npm: or workspace:<name>@ alias or a catalog: entry;
  • linkWorkspacePackages: deep, where a transitive dependency may resolve to it;
  • injectWorkspacePackages, where the lockfile records the injected copy's version;
  • a readPackage hook or packageExtensions that may add such a dependency.

Accepting too much here is worse than refusing too much: a wrong accept runs scripts against a stale tree. Treat the last point conservatively, and fix both stacks together.


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

Activity

  1. zkochan commented on Nov 2, 2026

    @zkochan
    MemberAuthor

    pnpm/pnpm#17579 fixes this in both CLIs. A project's version is now compared only when a dependency group or catalog entry names it (aliases included), when an override, package extension, or patch mentions it, when a pnpmfile is loaded in a multi-project workspace, or under linkWorkspacePackages: deep. The oracle's version step now requires both gates to accept the bump.


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

  2. added a commit that references this issue on Nov 3, 2026
    5162526
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