Skip to content

fix(build): name canaries after the release, not after a prerelease - #3767

Open
armando-navarro wants to merge 2 commits into
angular:mainfrom
armando-navarro:a33-canary-version-base
Open

armando-navarro wants to merge 2 commits into
angular:mainfrom
armando-navarro:a33-canary-version-base

Conversation

@armando-navarro

Copy link
Copy Markdown
Collaborator

Fixes #3766

These changes take us back to the release candidate pattern this repo used up until #3674, after which @angular/fire@next started resolving to a canary build instead of the release candidate.

Details

  • The root package.json version field returns to 21.0.0, so a canary published from main is named 21.0.0-canary.<sha>, which ranks below every 21.0.0-rc.N.
    • Release candidates are published from their own git tag, which is where tools/build.sh takes a tagged release's version from.
    • This is how releases through v20 were cut.
  • tools/build.sh also drops any prerelease part when naming a canary, and says so in the build log, so a prerelease written into that field again cannot produce a canary that outranks it.
  • The comment and log line in src/schematics/common.ts no longer say a prerelease range matches canary builds, since it stops being true with this PR.
  • The sample's tarball path follows the version field, becoming angular-fire-21.0.0.tgz.
  • A second commit regenerates sample/package-lock.json, which still named the 21.0.0-rc.0 tarball, two releases behind its own package.json.

Verification

Every naming path was run against the real script.

  • With the field at 21.0.0, a merge to main and a pull request build:
    • both produce 21.0.0-canary.95b3de1 on the canary tag
    • the tag 21.0.0-rc.2 publishes 21.0.0-rc.2 on next
    • the tag 21.0.0 publishes 21.0.0 on latest.
  • With a prerelease left in the field, the build still succeeds and names the canary 21.0.0-canary.95b3de1, logging why.
  • 21.0.0-canary.95b3de1 is selected by none of ^21.0.0-rc.1, ~21.0.0-rc.1, ^21.0.0-rc.2, ^21.0.0 or 21.x, and ranks below 21.0.0-rc.1.
  • npm run test:node after a full build: 331 specs, 0 failures.
  • The build produces angular-fire-21.0.0.tgz, and npm ci in sample/ succeeds against the regenerated lockfile, where it previously failed on the mismatch.

The root version field held `21.0.0-rc.1`, so every merge to main published
`21.0.0-rc.1-canary.<sha>`. Semver ranks that above `21.0.0-rc.1`, and the
caret range `ng add` writes into a user's package.json then resolves to the
canary instead of the release candidate they asked for.

Releases through v20 avoided this by keeping the plain release number in the
version field and publishing prereleases from their own git tag, which is
what the publish job reads. This restores that: the field returns to
`21.0.0`, and build.sh drops any prerelease part when naming a canary, so a
prerelease written there again cannot produce a canary that outranks it.

The schematics comment and its log line no longer say a prerelease range
matches canary builds, which stops being true here.
The sample's lockfile still named `angular-fire-21.0.0-rc.0.tgz`, two
releases behind its own package.json, so `npm ci` there failed on the
mismatch. Regenerated by building the library and running `npm install
../angular-fire-21.0.0.tgz` in sample/. It also picks up the `^21.2.0`
peer ranges the Angular 21.2 raise introduced.
@armando-navarro armando-navarro added bump: patch comp: build/pipeline Build, bundling, packaging, release pipeline. type: bug Defect: expected behavior doesn't happen. labels Sep 23, 2026

@tyler-reitz tyler-reitz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving. Every naming path reproduces: I ran this branch's build.sh with npm version/npm run build stubbed, and a merge to main gives 21.0.0-canary.95b3de1 on canary, tag 21.0.0-rc.2 gives next, tag 21.0.0 gives latest, and a prerelease left in the version field still yields 21.0.0-canary.95b3de1 with the new log line.

One thing for the release notes rather than for this PR. The 25 canaries already on npm outrank every future rc of 21.0.0, not just rc.1. Their prerelease parses as ["rc", "1-canary", "95b3de1"], and the alphanumeric 1-canary ranks above the numeric 2, so ^21.0.0-rc.2 and ~21.0.0-rc.2 both still resolve to 21.0.0-rc.1-canary.95b3de1. #3766's scope note is accurate, but it reads as though rc.2 clears this. It will not; deprecating the 25 would.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump: patch comp: build/pipeline Build, bundling, packaging, release pipeline. type: bug Defect: expected behavior doesn't happen.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Canary builds are named after the release candidate, so npm ranks them above it

2 participants