In continuation of our exploration of using install-strategy=linked in the Gutenberg monorepo, which powers the WordPress Block Editor.
npm ci in v11.14.x rejects lockfiles that v11.13.x accepts, with EUSAGE: Invalid: lock file's <pkg>@<old> does not satisfy <pkg>@<new> for any workspace ^ range that has had a newer matching patch published since the lockfile was generated.
Bisected to commit e7805c3 (#9198). The new Link.recalculateOutEdgesOverrides was forwarding the link's OverrideSet to the target unconditionally — even when the OverrideSet had no rule naming any of the target's deps. That set target.overrides from undefined to the root's generic OverrideSet, and the cascade caused canReplaceWith's "overrides equal" branch to flip placeDep's decision from KEEP to REPLACE for an edge the lockfile already satisfied. validateLockfile then rejected the resulting ideal tree.
Fixed by gating the forward on the OverrideSet actually containing a rule that names a dep the target depends on. If no rule matches, don't forward — target.overrides stays undefined and downstream placement matches v11.13.0.
#9198's intent is preserved: when the override DOES name a dep of the target, propagation still fires. #9198's existing test still passes (including bar edge spec is overridden to 2.0.0). Added a regression test for the no-matching-rule case; verified failing before this fix and passing after.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In continuation of our exploration of using install-strategy=linked in the Gutenberg monorepo, which powers the WordPress Block Editor.
npm ci in v11.14.x rejects lockfiles that v11.13.x accepts, with EUSAGE: Invalid: lock file's <pkg>@<old> does not satisfy <pkg>@<new> for any workspace ^ range that has had a newer matching patch published since the lockfile was generated.
Bisected to commit e7805c3 (#9198). The new Link.recalculateOutEdgesOverrides was forwarding the link's OverrideSet to the target unconditionally — even when the OverrideSet had no rule naming any of the target's deps. That set target.overrides from undefined to the root's generic OverrideSet, and the cascade caused canReplaceWith's "overrides equal" branch to flip placeDep's decision from KEEP to REPLACE for an edge the lockfile already satisfied. validateLockfile then rejected the resulting ideal tree.
Fixed by gating the forward on the OverrideSet actually containing a rule that names a dep the target depends on. If no rule matches, don't forward — target.overrides stays undefined and downstream placement matches v11.13.0.
#9198's intent is preserved: when the override DOES name a dep of the target, propagation still fires. #9198's existing test still passes (including bar edge spec is overridden to 2.0.0). Added a regression test for the no-matching-rule case; verified failing before this fix and passing after.
References
Fixes #9357
Refines #9198