Skip to content

Finish repeat-install and verifyDepsBeforeRun unification across v11 and v12 #161

Closed
pnpm/pnpm
#17150

Description

@zkochan

Found by the defect-hotspots skill on 2026-10-19 over 90 days of main (c43ba554b7), following up on #142, #139, #148, and #157.

Loop: verifyDepsBeforeRun & repeat-install fast path (12 fixes, 2 regressions)

Property. A pre-run check (verifyDepsBeforeRun) or repeat-install fast path skips an install if and only if running that command's install would change nothing for the covered project selection, and any install spawned by the gate receives the same flags/selection and writes a validation state that immediately satisfies the gate.

Recent members. pnpm/pnpm#15112, pnpm/pnpm#16211 (pnpm/pnpm#11865), pnpm/pnpm#16268 (#45), pnpm/pnpm#16317 (pnpm/pnpm#16313), pnpm/pnpm#16324 (pnpm/pnpm#16322), pnpm/pnpm#16396 (pnpm/pnpm#16374), pnpm/pnpm#16566 (pnpm/pnpm#16545), pnpm/pnpm#16558 (pnpm/pnpm#16583), pnpm/pnpm#16992 (pnpm/pnpm#16988), pnpm/pnpm#16996 (pnpm/pnpm#16993), pnpm/pnpm#17019 (pnpm/pnpm#17011), pnpm/pnpm#17030 (#142), pnpm/pnpm#17034 (#139).

Remaining Flaws after pnpm/pnpm#17030 & pnpm/pnpm#17034

  1. Four v11 parity gaps in @pnpm/deps.status and runDepsStatusCheck.ts:
    • autoDedupe + CI=true infinite install loop in v11: 5eaad67e6b (fix: stop the pre-run install for a dedupe baseline a frozen install cannot record pnpm#16396) made v12's deps_status.rs:143-145 ignore autoDedupe when install_would_run_frozen is true. v11's pnpm11/exec/commands/src/runDepsStatusCheck.ts:35-48 and pnpm11/deps/status/src/checkDepsStatus.ts:72-86 still do not ignore autoDedupe when frozen, so verifyDepsBeforeRun on CI still triggers a frozen install on every pnpm run when autoDedupe is set.
    • sharedWorkspaceLockfile: false in v11 bypasses validationProof: In pnpm11/deps/status/src/checkWorkspaceDepsStatus.ts:72-77, opts.sharedWorkspaceLockfile === false sets proof = undefined, falling back to legacy mtime checks instead of using the per-project validation digests added in 9204d64b8c (fix(deps.status): record which projects each install proved installed pnpm#17034).
    • Non-recursive pnpm run / pnpm exec inside a workspace project ignores {.}... workspace dependencies (tracked in verifyDepsBeforeRun: hold the workspace dependencies of the project a non-recursive command runs in #157).
    • Four separate state writers in v11: Unlike v12's single recorded_workspace_state (pnpm/crates/package-manager/src/install/workspace_state/write.rs), v11 calls updateWorkspaceState from 4 places (installDeps.ts:363, reportAlreadyUpToDate.ts, checkWorkspaceDepsStatus.ts:160-175, checkRootProjectDepsStatus.ts:133-146).
  2. Spawned pnpm install drops first-class CLI flags (verify_deps.rs and runDepsStatusCheck.ts). pnpm/crates/cli/src/cli_args/verify_deps.rs:256-306 and pnpm11/exec/commands/src/runDepsStatusCheck.ts:263-332 forward only --filter and --config.<k>=<v> (raw_cli_config). First-class CLI flags passed to pnpm run/exec (--lockfile-dir, --modules-dir, --store-dir, --offline, --prefer-offline, --frozen-lockfile, --ignore-scripts) are used by the gate check on the parent Config but dropped when spawning pnpm install.
  3. Divergent empty-project predicates and GatePolicy in v12. manifest_has_runtime_deps (optimistic_repeat_install.rs:369-378), no_project_has_dependencies (install/run/dispatch.rs:344-357), and project_has_something_to_install (install/workspace_state/nothing_to_install.rs:76-129) check different subsets of peerDependencies (auto_install_peers), lifecycle scripts, and pnpmfiles; and deps_status.rs:84 hardcodes dedupe_peers: false in GatePolicy while optimistic_repeat_install.rs:189 uses check.config.dedupe_peers.

Design Change

  1. Port install_would_run_frozen (autoDedupe exemption) to pnpm11/deps/status/src/checkDepsStatus.ts, enable validationProof for sharedWorkspaceLockfile: false in checkWorkspaceDepsStatus.ts, and centralize v11's 4 updateWorkspaceState callers into one merge helper in @pnpm/installing.workspace-state.
  2. Forward effective CLI flags when verifyDepsBeforeRun: install spawns pnpm install in both verify_deps.rs and runDepsStatusCheck.ts, and align GatePolicy::dedupe_peers and the empty-project predicate in v12.

Tests


Written by an agent (Antigravity, Gemini 4 Argon).

Activity

  1. added
    area: monorepo
    on Oct 19, 2026
  2. self-assigned this
    on Oct 19, 2026
  3. zkochan commented on Oct 20, 2026

    @zkochan
    MemberAuthor

    Opened pnpm/pnpm#17150 covering the full scope of this issue:

    1. v11 repeat-install and verifyDepsBeforeRun parity:
      • Centralized workspace state writes in @pnpm/workspace.state (preserveWorkspaceStateSettings) and @pnpm/installing.commands (workspaceStateUpdate.ts), preserving carried dev/optional/production settings when ignoredWorkspaceStateSettings ignores them and preserving v12-recorded autoDedupe.
      • Updated selectProjectsToVerify.ts 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 (verifyDepsBeforeRun: hold the workspace dependencies of the project a non-recursive command runs in #157).
      • Aligned v11's recorded validation (checkRecordedWorkspace) and legacy unrecorded validation (checkModifiedSinceLastValidation) in @pnpm/deps.status with v12's check_freshness, including empty-project handling, dedupeDirectDeps, dedupePeerDependents, autoInstallPeers, excludeLinksFromLockfile, catalog/override config comparison, and opts.lockfileDir resolution.
    2. Forwarded CLI flags on verifyDepsBeforeRun: install:
      • Forwarded effective CLI flags (--lockfile-dir, --modules-dir, --virtual-store-dir, --store-dir, --dir, --workspace-root, --prod, --dev, --no-optional, --filter, --filter-prod, --test-pattern, --changed-files-ignore-pattern, and --config.*) when verifyDepsBeforeRun: install spawns pnpm install in both v11 (runDepsStatusCheck.ts) and v12 (verify_deps.rs).
    3. v12 GatePolicy::dedupe_peers and empty-project predicates:
      • Aligned GatePolicy::dedupe_peers and empty-project checks across optimistic_repeat_install and nothing_to_install.rs.
    4. Tests:

    Generated by Antigravity (Claude Opus 4.6)

  4. added 4 commits that reference this issue on Oct 20, 2026
    51281ec
    2382aaa
    f52e2a4
    60662b4
  5. added a commit that references this issue on Oct 20, 2026
    7164fc7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: monorepotype: refactor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions