Skip to content

verifyDepsBeforeRun: hold the workspace dependencies of the project a non-recursive command runs in #157

Closed
pnpm/pnpm
#17150

Description

@zkochan

Context

checkDepsStatus (pnpm11/deps/status/src/checkWorkspaceDepsStatus.ts) holds a never-installed project only when the install the gate would spawn covers it. createInstallCoverage decides that from selectedProjectsGraph for a filtered command and from dir for a non-recursive one. The recorded-validation path (heldProjects) and the per-project-lockfile path (coveredProjectsMissingLockfile, added in pnpm/pnpm#17017) share that rule.

Gap

For a non-recursive pnpm run or pnpm exec inside a workspace project, selectedProjectsGraph is not set, so coverage is the command's directory only. The pnpm install the gate spawns runs in that directory and, being recursive by default in a workspace, selects {.}... (enableRecursiveByDefault in pnpm11/pnpm/src/selectWorkspaceProjects.ts): the project and its workspace dependencies. So a workspace dependency that was never installed, or whose pnpm-lock.yaml is missing with sharedWorkspaceLockfile: false, is something the spawned install would fix, but the gate does not hold it and reports the project as up to date.

Filtered commands do not have this gap: selectProjectsToVerify (pnpm11/exec/commands/src/selectProjectsToVerify.ts) already adds the workspace dependencies of the selected projects (#45).

Suggested fix

Give the gate the same {.}... closure for a non-recursive command: resolve the workspace dependencies of the command's project (the gate already has allProjects) and treat them as covered, in one place so both paths agree. Add a test with a project that depends on a never-installed workspace package, with both a shared lockfile and a lockfile per project.

Raised by CodeRabbit on pnpm/pnpm#17017 as an out-of-diff comment. Verified by code reading only, not reproduced.


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

Activity

  1. zkochan commented on Oct 20, 2026

    @zkochan
    MemberAuthor

    Opened pnpm/pnpm#17150 covering the full scope of this issue: updated selectProjectsToVerify.ts and findModulesDirIssue.ts in v11 so non-recursive pnpm run, pnpm exec, and pnpm restart inside a workspace project hold {.}... (the target project and its transitive workspace dependencies), matching v12's ReachableWorkspaceDeps scope, and verified single_project_verify_deps_checks_transitive_workspace_dep across v12, v11, and mixed v11↔v12 drivers in repeat_install_oracle.rs.


    Generated by Antigravity (Claude Opus 4.6)

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