-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(nm): optimize hoisting by treating peer deps same as other deps #6517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
larixer
merged 3 commits into
yarnpkg:master
from
akwodkiewicz:fix/nm-hoisting-algorithm
Sep 24, 2024
Merged
fix(nm): optimize hoisting by treating peer deps same as other deps #6517
larixer
merged 3 commits into
yarnpkg:master
from
akwodkiewicz:fix/nm-hoisting-algorithm
Sep 24, 2024
Conversation
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
…nces Until now the peerDependencies had a higher preference that could lead to unoptimal hoisting behaviour. Thanks to @larixer for pointing out to this particular snippet. Co-Authored-By: Victor Vlasenko <[email protected]>
larixer
approved these changes
Sep 24, 2024
merceyz
approved these changes
Sep 24, 2024
jeffwidman
added a commit
to dependabot/dependabot-core
that referenced
this pull request
Dec 13, 2024
This is the failing test: https://github.com/dependabot/dependabot-core/blob/8f037cf1be97f2a0c1f383d74479ebe2a48e0c17/npm_and_yarn/spec/dependabot/npm_and_yarn/update_checker/version_resolver_spec.rb#L855-L875 Full commit including lockfiles: 1dcda58 Interestingly, it doesn't fail in Yarn `4.3.1` as seen in: * #8265 Poking through the changelog between 4.3.1 and 4.5.3, this seems to be relevant upstream PR: * yarnpkg/berry#6517 My understanding of peer dependency handling in Yarn is hazy at best, but after reading the PR description, it _looks_ like the algorithm changed and now the peer dependency can be updated and not necessarily held back. That would explain [this test failure](https://github.com/dependabot/dependabot-core/actions/runs/12307737164/job/34351931150?pr=11123#step:5:56): ``` 1) Dependabot::NpmAndYarn::UpdateChecker::VersionResolver#latest_resolvable_version with a yarn berry lockfile when updating a dependency with a peer requirement is expected to eq #<Gem::Version "15.2.0"> Failure/Error: it { is_expected.to eq(Gem::Version.new("15.2.0")) } expected: #<Gem::Version "15.2.0"> got: #<Gem::Version "16.3.1"> (compared using ==) Diff: @@ -1 +1 @@ -Gem::Version.new("15.2.0") +Gem::Version.new("16.3.1") # ./spec/dependabot/npm_and_yarn/update_checker/version_resolver_spec.rb:873:in `block (5 levels) in <top (required)>' # /home/dependabot/common/spec/spec_helper.rb:66:in `block (2 levels) in <top (required)>' # /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/webmock-3.24.0/lib/webmock/rspec.rb:39:in `block (2 levels) in <top (required)>' ```
jeffwidman
added a commit
to dependabot/dependabot-core
that referenced
this pull request
Dec 13, 2024
This is the failing test: https://github.com/dependabot/dependabot-core/blob/8f037cf1be97f2a0c1f383d74479ebe2a48e0c17/npm_and_yarn/spec/dependabot/npm_and_yarn/update_checker/version_resolver_spec.rb#L855-L875 Full commit including lockfiles: 1dcda58 Interestingly, it doesn't fail in Yarn `4.3.1` as seen in: * #8265 Poking through the changelog between 4.3.1 and 4.5.3, this seems to be relevant upstream PR: * yarnpkg/berry#6517 My understanding of peer dependency handling in Yarn is hazy at best, but after reading the PR description, it _looks_ like the algorithm changed and now the peer dependency can be updated and not necessarily held back. That would explain [this test failure](https://github.com/dependabot/dependabot-core/actions/runs/12307737164/job/34351931150?pr=11123#step:5:56): ``` 1) Dependabot::NpmAndYarn::UpdateChecker::VersionResolver#latest_resolvable_version with a yarn berry lockfile when updating a dependency with a peer requirement is expected to eq #<Gem::Version "15.2.0"> Failure/Error: it { is_expected.to eq(Gem::Version.new("15.2.0")) } expected: #<Gem::Version "15.2.0"> got: #<Gem::Version "16.3.1"> (compared using ==) Diff: @@ -1 +1 @@ -Gem::Version.new("15.2.0") +Gem::Version.new("16.3.1") # ./spec/dependabot/npm_and_yarn/update_checker/version_resolver_spec.rb:873:in `block (5 levels) in <top (required)>' # /home/dependabot/common/spec/spec_helper.rb:66:in `block (2 levels) in <top (required)>' # /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/webmock-3.24.0/lib/webmock/rspec.rb:39:in `block (2 levels) in <top (required)>' ```
jeffwidman
added a commit
to dependabot/dependabot-core
that referenced
this pull request
Dec 13, 2024
This is the failing test: https://github.com/dependabot/dependabot-core/blob/8f037cf1be97f2a0c1f383d74479ebe2a48e0c17/npm_and_yarn/spec/dependabot/npm_and_yarn/update_checker/version_resolver_spec.rb#L855-L875 Full commit including lockfiles: 1dcda58 Interestingly, it doesn't fail in Yarn `4.3.1` as seen in: * #8265 Poking through the changelog between 4.3.1 and 4.5.3, this seems to be relevant upstream PR: * yarnpkg/berry#6517 My understanding of peer dependency handling in Yarn is hazy at best, but after reading the PR description, it _looks_ like the algorithm changed and now the peer dependency can be updated and not necessarily held back. That would explain [this test failure](https://github.com/dependabot/dependabot-core/actions/runs/12307737164/job/34351931150?pr=11123#step:5:56): ``` 1) Dependabot::NpmAndYarn::UpdateChecker::VersionResolver#latest_resolvable_version with a yarn berry lockfile when updating a dependency with a peer requirement is expected to eq #<Gem::Version "15.2.0"> Failure/Error: it { is_expected.to eq(Gem::Version.new("15.2.0")) } expected: #<Gem::Version "15.2.0"> got: #<Gem::Version "16.3.1"> (compared using ==) Diff: @@ -1 +1 @@ -Gem::Version.new("15.2.0") +Gem::Version.new("16.3.1") # ./spec/dependabot/npm_and_yarn/update_checker/version_resolver_spec.rb:873:in `block (5 levels) in <top (required)>' # /home/dependabot/common/spec/spec_helper.rb:66:in `block (2 levels) in <top (required)>' # /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/webmock-3.24.0/lib/webmock/rspec.rb:39:in `block (2 levels) in <top (required)>' ```
jeffwidman
added a commit
to dependabot/dependabot-core
that referenced
this pull request
Dec 13, 2024
* Bump yarn to 4.5.3 * Update test to match new handling of peer deps This is the failing test: https://github.com/dependabot/dependabot-core/blob/8f037cf1be97f2a0c1f383d74479ebe2a48e0c17/npm_and_yarn/spec/dependabot/npm_and_yarn/update_checker/version_resolver_spec.rb#L855-L875 Full commit including lockfiles: 1dcda58 Interestingly, it doesn't fail in Yarn `4.3.1` as seen in: * #8265 Poking through the changelog between 4.3.1 and 4.5.3, this seems to be relevant upstream PR: * yarnpkg/berry#6517 My understanding of peer dependency handling in Yarn is hazy at best, but after reading the PR description, it _looks_ like the algorithm changed and now the peer dependency can be updated and not necessarily held back. That would explain [this test failure](https://github.com/dependabot/dependabot-core/actions/runs/12307737164/job/34351931150?pr=11123#step:5:56): ``` 1) Dependabot::NpmAndYarn::UpdateChecker::VersionResolver#latest_resolvable_version with a yarn berry lockfile when updating a dependency with a peer requirement is expected to eq #<Gem::Version "15.2.0"> Failure/Error: it { is_expected.to eq(Gem::Version.new("15.2.0")) } expected: #<Gem::Version "15.2.0"> got: #<Gem::Version "16.3.1"> (compared using ==) Diff: @@ -1 +1 @@ -Gem::Version.new("15.2.0") +Gem::Version.new("16.3.1") # ./spec/dependabot/npm_and_yarn/update_checker/version_resolver_spec.rb:873:in `block (5 levels) in <top (required)>' # /home/dependabot/common/spec/spec_helper.rb:66:in `block (2 levels) in <top (required)>' # /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/webmock-3.24.0/lib/webmock/rspec.rb:39:in `block (2 levels) in <top (required)>' ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What's the problem this PR addresses?
Fixes #6516
How did you fix it?
Simplified the sorting algorithm in
getHoistIndetMap
.Checklist