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: update notifier to consider engine range #8050

Open
wants to merge 3 commits into
base: latest
Choose a base branch
from

Conversation

milaninfy
Copy link
Contributor

@milaninfy milaninfy commented Jan 21, 2025

When doing manifest call for fetching npm manifest it was using latest every-time, however fetchingnpm@* will still give latest if it's satisfies the engine range otherwise it will give highest matching version for the current engine range.
Pacote.manifest calls internally uses pick-manifest logic to pick the appropriate version of the manifest for the engine range.

@milaninfy milaninfy marked this pull request as ready for review January 22, 2025 04:27
@milaninfy milaninfy requested a review from a team as a code owner January 22, 2025 04:27
@wraithgar
Copy link
Member

We'll want a new test for the behavior this is guarding against.

@milaninfy milaninfy marked this pull request as draft January 22, 2025 19:22
@milaninfy
Copy link
Contributor Author

while thinking on how to write a test for this one, logically the problem this pr solves it to get correct engine matched version, we only request for manifest from pacote with appropriate spec. earlier we were requesting npm@latest which gave us latest no matter what the node version is, but now we are fetching manifest with npm@* which gives us default tag ( latest ) if nothing matched otherwise highest appropriate version with engine consideration ( This logic is from npm-pick-manifest )
Do we need an end to end test here to show that it's marching based on engine ?

@wraithgar
Copy link
Member

Do we need an end to end test here to show that it's matching based on engine ?

Yes, this is behavior we don't want to accidentally regress from. The update notifier tests will likely need a bit of tweaking to get there

@milaninfy milaninfy force-pushed the mm/fix-update-notification branch from f95e421 to 07fd64f Compare February 3, 2025 22:20
@milaninfy milaninfy marked this pull request as ready for review February 3, 2025 22:51
const NEXT_MINOR = '123.420.70'
const NEXT_PATCH = '123.421.69'
const CURRENT_BETA = '124.0.0-beta.99999'
const HAVE_BETA = '124.0.0-beta.0'

const pacumentResponse = {
Copy link
Member

Choose a reason for hiding this comment

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

packument not pacument (I didn't do a code suggestion cause it will need to be changed in multiple places)

})

if (PACOTE_MOCK_REQ_COUNT > 0) {
registry.nock.get('/npm').times(PACOTE_MOCK_REQ_COUNT).reply(200, pacumentResponse)
Copy link
Member

Choose a reason for hiding this comment

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

This is a great iteration. Eventually we'd want this in the mock registry (this request AND the packument it generates) but I don't want to block the PR on that.

@milaninfy milaninfy force-pushed the mm/fix-update-notification branch from af46071 to ee70630 Compare February 5, 2025 21:01
@milaninfy milaninfy force-pushed the mm/fix-update-notification branch from ee70630 to a1f0923 Compare February 5, 2025 21:07
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.

2 participants