Skip to content
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

fix(arborist): Allow downgrades to hoisted version dedupe workspace i… #8168

Merged
merged 1 commit into from
Mar 20, 2025

Conversation

owlstronaut
Copy link
Contributor

@owlstronaut owlstronaut commented Mar 18, 2025

fixes #7028

The crux of the issue as that when the downgrade was attempting to dedupe, there was nothing in the canDedupe logic that said it was okay to take the other version if it was an explicit request. It would see the 0.0.2 in the root, the 0.0.3 in the workspace, and give up, leaving them both as they were.

The proposed change adds a new parameter explicitRequest to the canDedupe method with a default value of false. This parameter enables dedupe behavior when a package version was explicitly requested by the user.

Adding the explicitRequest parameter introduces a new condition that allows deduping when:

  • A user has explicitly requested a specific package version via commands like npm install package@version
  • None of the other deduping criteria are met
  • The current version isn't already the result of an override

I believe this was just an edge case that wasn't handled in the dedupe logic, and this change should fix it.

@owlstronaut owlstronaut added the pr: needs tests requires tests before merging label Mar 18, 2025
@owlstronaut owlstronaut force-pushed the owlstronaut/fix-downgrade-workspaces branch from 370597c to d642219 Compare March 20, 2025 18:20
@owlstronaut owlstronaut removed the pr: needs tests requires tests before merging label Mar 20, 2025
@owlstronaut owlstronaut marked this pull request as ready for review March 20, 2025 18:27
@owlstronaut owlstronaut requested a review from a team as a code owner March 20, 2025 18:27
@owlstronaut owlstronaut force-pushed the owlstronaut/fix-downgrade-workspaces branch from d642219 to 8fc88db Compare March 20, 2025 18:50
Copy link
Contributor

@fritzy fritzy left a comment

Choose a reason for hiding this comment

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

Pretty straight forward change, good explanation, good test coverage.

@owlstronaut owlstronaut merged commit 8b7bb12 into latest Mar 20, 2025
16 checks passed
@owlstronaut owlstronaut deleted the owlstronaut/fix-downgrade-workspaces branch March 20, 2025 22:21
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.

[BUG] presence of overrides breaks ability to downgrade un-hoisted workspace dependencies
2 participants