Skip to content

fix: detect overrides and other lockfile-affecting setting changes in optimisticRepeatInstall#10654

Merged
zkochan merged 2 commits into
mainfrom
fix-repeat-install
Feb 20, 2026
Merged

fix: detect overrides and other lockfile-affecting setting changes in optimisticRepeatInstall#10654
zkochan merged 2 commits into
mainfrom
fix-repeat-install

Conversation

@zkochan

@zkochan zkochan commented Feb 19, 2026

Copy link
Copy Markdown
Member

When optimisticRepeatInstall was enabled, changing overrides, packageExtensions, ignoredOptionalDependencies, patchedDependencies, or peersSuffixMaxLength would not trigger a reinstall because these settings were not tracked in the workspace state file.

Copilot AI review requested due to automatic review settings February 19, 2026 21:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes optimisticRepeatInstall incorrectly skipping reinstalls by ensuring additional lockfile-affecting settings are persisted in the workspace state and therefore included in dependency status change detection.

Changes:

  • Persist additional settings in workspace state (overrides, packageExtensions, ignoredOptionalDependencies, patchedDependencies, peersSuffixMaxLength).
  • Add/extend tests to verify workspace state persistence and checkDepsStatus() change detection for these settings.
  • Add a changeset to release patch updates for pnpm and @pnpm/workspace.state.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
workspace/state/test/createWorkspaceState.test.ts Adds coverage ensuring lockfile-affecting settings are saved into workspace state.
workspace/state/src/types.ts Extends WorkspaceStateSettings to include additional lockfile-affecting config keys.
workspace/state/src/createWorkspaceState.ts Updates the persisted settings key list to include the newly tracked options.
deps/status/test/checkDepsStatus.test.ts Adds tests verifying checkDepsStatus() returns upToDate: false when these settings change.
.changeset/fix-optimistic-repeat-install-overrides.md Declares patch releases documenting the fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 32 to 36
'hoistWorkspacePackages',
'ignoredOptionalDependencies',
'injectWorkspacePackages',
'linkWorkspacePackages',
'nodeLinker',

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The settings key list passed to pick([...], opts.settings) needs to stay in sync with the WorkspaceStateSettings type in workspace/state/src/types.ts, which is easy to miss (and was the root cause of the original optimisticRepeatInstall bug). Consider extracting a shared const list of keys (e.g. WORKSPACE_STATE_SETTINGS_KEYS as const) and reusing it for both the runtime pick() and the TS type (via typeof ...[number]) to prevent future drift.

Copilot uses AI. Check for mistakes.
zkochan and others added 2 commits February 19, 2026 23:22
… optimisticRepeatInstall

When optimisticRepeatInstall was enabled, changing overrides,
packageExtensions, ignoredOptionalDependencies, patchedDependencies,
or peersSuffixMaxLength would not trigger a reinstall because these
settings were not tracked in the workspace state file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e drift

The settings key list in createWorkspaceState's pick() call must stay
in sync with the WorkspaceStateSettings type. Extract a shared const
array so both the type and runtime pick are derived from a single
source, preventing the class of bug fixed in the previous commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zkochan zkochan merged commit 03c502c into main Feb 20, 2026
11 of 13 checks passed
@zkochan zkochan deleted the fix-repeat-install branch February 20, 2026 13:00
zkochan added a commit that referenced this pull request Mar 7, 2026
… optimisticRepeatInstall (#10654)

* fix: detect overrides and other lockfile-affecting setting changes in optimisticRepeatInstall

When optimisticRepeatInstall was enabled, changing overrides,
packageExtensions, ignoredOptionalDependencies, patchedDependencies,
or peersSuffixMaxLength would not trigger a reinstall because these
settings were not tracked in the workspace state file.

* refactor: extract WORKSPACE_STATE_SETTING_KEYS to prevent type/runtime drift

The settings key list in createWorkspaceState's pick() call must stay
in sync with the WorkspaceStateSettings type. Extract a shared const
array so both the type and runtime pick are derived from a single
source, preventing the class of bug fixed in the previous commit.
zkochan added a commit that referenced this pull request Mar 7, 2026
… optimisticRepeatInstall (#10654)

* fix: detect overrides and other lockfile-affecting setting changes in optimisticRepeatInstall

When optimisticRepeatInstall was enabled, changing overrides,
packageExtensions, ignoredOptionalDependencies, patchedDependencies,
or peersSuffixMaxLength would not trigger a reinstall because these
settings were not tracked in the workspace state file.

* refactor: extract WORKSPACE_STATE_SETTING_KEYS to prevent type/runtime drift

The settings key list in createWorkspaceState's pick() call must stay
in sync with the WorkspaceStateSettings type. Extract a shared const
array so both the type and runtime pick are derived from a single
source, preventing the class of bug fixed in the previous commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants