fix: detect overrides and other lockfile-affecting setting changes in optimisticRepeatInstall#10654
Conversation
There was a problem hiding this comment.
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
pnpmand@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.
| 'hoistWorkspacePackages', | ||
| 'ignoredOptionalDependencies', | ||
| 'injectWorkspacePackages', | ||
| 'linkWorkspacePackages', | ||
| 'nodeLinker', |
There was a problem hiding this comment.
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.
… 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>
ca4f6ce to
2cee185
Compare
… 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.
… 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.
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.