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(npm): Fix replace strategy edge-case for carets #9106

Merged
merged 8 commits into from Mar 20, 2021

Conversation

renovate-testing
Copy link
Contributor

Changes:

Re-implement new value update logic. It's more verbose, but it backward-compatible with current behavior while fixing its edge-cases.

Context:

Closes #4762

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please tick one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added unit tests, or
  • No new tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@viceice
Copy link
Member

viceice commented Mar 12, 2021

@zharinov can you use your normal account for future pr's. 😏

@renovate-testing
Copy link
Contributor Author

Sorry, I'm waiting for GitHub support addressing my issue with it

@viceice
Copy link
Member

viceice commented Mar 12, 2021

🙈😅👍


['^0.2.3', '0.2.4', '^0.2.4'],
['^2.3.0', '2.4.0', '^2.4.0'],
['^2.3.4', '2.4.5', '^2.4.0'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

These shouldn't really happen with replace though, should they?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fixed, now it remains ^2.3.4

['^0.0.1', '0.0.2', '^0.0.2'],
['^1.0.1', '2.0.2', '^2.0.0'],
['^1.2.3', '1.2.3', '^1.2.3'],
['^1.2.3', '1.2.0', '^1.2.3'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure about this one?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, it seems sometimes downgrades are desirable

@rarkins rarkins marked this pull request as draft March 14, 2021 06:49
@zharinov
Copy link
Collaborator

expect(
  poetry.getNewValue({
    currentValue: '^1.0.0',
    rangeStrategy: 'replace',
    currentVersion: '1.0.0',
    newVersion: '1.0.7',
  })
).toEqual('^1.0.7');

Do we really need upgrade to ^1.0.7 here? If I understand it right, replace strategy should return new ranges with new versions and shouldn't just shrink old ranges.

@rarkins
Copy link
Collaborator

rarkins commented Mar 14, 2021

expect(
  poetry.getNewValue({
    currentValue: '^1.0.0',
    rangeStrategy: 'replace',
    currentVersion: '1.0.0',
    newVersion: '1.0.7',
  })
).toEqual('^1.0.7');

Do we really need upgrade to ^1.0.7 here? If I understand it right, replace strategy should return new ranges with new versions and shouldn't just shrink old ranges.

Agreed, it should return the existing range of ^1.0.0.

@renovate-testing renovate-testing marked this pull request as ready for review March 15, 2021 09:16
@rarkins rarkins enabled auto-merge (squash) March 20, 2021 21:33
@rarkins rarkins merged commit 3ff8649 into renovatebot:master Mar 20, 2021
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 24.91.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

npm and cargo managers "downgrade" caret dependencies in some cases
5 participants