Repository navigation
[stable/5.2] Skip releases that don't support the running Node when picking the auto-upgrade target #9224
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
Open
craigmichaelmartin
wants to merge
4
commits into
stable/5.2
Choose a base branch
from
patch-backport/stable/5.2/auto-upgrade-supported-node
base: stable/5.2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+58
−2
Open
[stable/5.2] Skip releases that don't support the running Node when picking the auto-upgrade target #9224
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e63d093
[stable/5.2] Skip releases that don't support the running Node when p…
craigmichaelmartin 603f380
Merge stable/5.2 into the backport
craigmichaelmartin 6ff9570
Merge stable/5.2 into the backport
craigmichaelmartin 6c71946
Merge stable/5.2 into the backport
craigmichaelmartin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| '@shopify/cli-kit': patch | ||
| '@shopify/cli': patch | ||
| --- | ||
|
|
||
| Auto-upgrade no longer installs a release that doesn't support your Node version |
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth fixing before the minor that raises the Node floor: this filter runs only when this CLI fetches. The target goes to
npm-package-@shopify/cli@5.x:registry:<hash>, a key that every installed 5.x CLI shares, andversionToAutoUpgradereads it with no Node check.A common case: the fixed CLI is installed globally, and an app's
package.jsonpins an older 5.x@shopify/cli. The older CLI's prerun lookup writes the unfiltered target to that key. The next global command reads it from the cache, sends no request, and auto-upgrades into a release that excludes its Node. One CLI does the same when the user switches Node versions within a day.I proved it at this head with a temporary test. I seeded both keys with a newer release whose
engines.nodeexcludes the running Node, as an older CLI would. ThencheckForNewVersionInBackground()sent 0 requests, andversionToAutoUpgrade()returned the excluded release.Suggested fix, on main first and then here: add the running Node to the current-major key, for example a
:node:${process.version}suffix, everywhere the key is written or read,getCachedCurrentMajorCLIVersionincluded. Older CLIs keep writing the old key, so they can't feed the new one. The cost is one more registry request per Node version per day.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, confirmed. The fix follows your suggestion: the target is now cached under a key that names the running Node, everywhere it's read or written,
getCachedCurrentMajorCLIVersionincluded, so older CLIs can't feed it. Two new tests cover an older CLI's cached target and a Node switch, and both fail without the fix.The same gap reached
shopify upgradeand the upgrade notice, which read a cachedlatestthat an older CLI wrote without its Node range. A cachedlatestnow counts only when the lookup cached its range too. Otherwise the lookup runs again.Both fixes are in one pull request for main, and you're requested on it: "Stop auto-upgrade and
shopify upgradefrom acting on another CLI's update check". Its backport to stable/5.2 comes after this one and theshopify upgradebackport, before 5.2.2.