fix: bump canary base to next minor so canaries sort above latest stable - #12325
fix: bump canary base to next minor so canaries sort above latest stable#12325deep200315 wants to merge 1 commit into
Conversation
Canary versions were built by stripping the prerelease suffix from the current core version without bumping it, producing e.g. `3.7.0-canary-N`. Per semver, a prerelease ranks below its stable base, so a canary built from commits after 3.7.0 shipped was treated as older than stable 3.7.0, triggering a bogus "Update available" CLI banner. Bump the minor version (patch reset to 0) before appending the canary suffix, so canaries sort above the latest stable release and the banner no longer fires. The version comparison in beforeCli.mjs is untouched, so genuine rc/beta -> stable upgrades still notify as before. Fixes facebook#11013
|
Hi @deep200315! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Pre-flight checklist
Motivation
Fixes #11013.
Canary releases are flagged as older than the latest stable, producing a bogus CLI banner
like
Update available 3.7.0-canary-6264 → 3.7.0on every run.The root cause is in the canary version script, not the CLI comparison.
canary:getCoreVersionreads the current core version and strips the prerelease suffix without bumping it, so a
canary built from commits after
3.7.0shipped is still labeled3.7.0-canary-N. Per semver aprerelease ranks below its stable base (
semver.lt('3.7.0-canary-6264', '3.7.0')istrue), sobeforeCli.mjsshows the update banner.This bumps the minor version (patch reset to 0) before appending the
-canary-suffix, asdiscussed in #11013. Canaries now publish as e.g.
3.11.0-canary-Nand sort above the laststable, so the banner no longer fires. Bumping minor (rather than patch) also signals that a
canary may contain new features and eventually breaking changes.
The version comparison in
beforeCli.mjsis intentionally left untouched, so genuinerc/beta→ stable upgrades still notify as before (
semver.lt('3.10.0-rc.1', '3.10.1')staystrue).Note (possible follow-up, out of scope):
beforeCli.mjsstill detects canaries viaupdate.current.startsWith('0.0.0')(from #5378). That predates the currentX.Y.Z-canary-Nscheme and no longer matches any published version, so it's now effectively dead. I left it
untouched to keep this PR scoped. Happy to remove it — or re-point it at the real
-canary-format as defense-in-depth — in a separate PR if preferred.
Test Plan
The change is confined to a build script (no canary publish required). The canary
pnpmscriptshave no existing unit-test harness, so the second pre-flight box is left unchecked; verified
manually instead:
pnpm --silent canary:getCoreVersion→3.11.0(next minor of the current3.10.1)pnpm --silent canary:version→3.11.0-canary-<N>+<sha>semver.lt('3.11.0-canary-1', '3.10.1')→false— the exact gate inbeforeCli.mjs, so no bannersemver.lt('3.9.0', '3.10.1')→true(stale stable installs still warn)semver.lt('3.10.0-rc.1', '3.10.1')→true(rc users still nudged to stable)Test links
N/A — build-script change only; nothing rendered on the site UI and no documentation changes.
Deploy preview: N/A — no UI or documentation changes.
Related issues/PRs
beforeCli.mjsfollow-up: Canary version users are getting false positive update notices #5378