Skip to content

ci: publish prereleases as next after 2.0.0 - #496

Merged
uniqueg merged 6 commits into
devfrom
ci/dist-tag-next
Oct 28, 2026
Merged

uniqueg merged 6 commits into
devfrom
ci/dist-tag-next

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

New npm dist-tag rule in scripts/release.js (distTag, printed by node scripts/release.js dist-tag <version> and used by the Release workflow):

  • releases: latest (unchanged);
  • prereleases: next, so that latest holds the newest release;
  • exception: prereleases of 2.x keep latest while there is no release tag v2.<minor>.<patch> or later, i.e. the 2.0.0-alpha.N series behaves as today.

The rule reads the git tags, so nothing needs to change at 2.0.0: the first v2.x.y tag ends the exception. Before, prereleases of a released major got their identifier as dist-tag (rc, beta), and prereleases of a new major (e.g. 3.0.0-alpha.1) got latest. .github/workflows/release.yml only uses the script's output and is unchanged.

CONTRIBUTING.md ("Releases", step 4) describes the rule and its caveats: a pushed v2.x.y tag ends the exception even if its release fails, and a release of an older major (backport) also gets latest.

Closes #491

Verification

  • node --test scripts/release.test.js: 11 passed (new cases: 2.x prereleases before 2.0.0, 1.x and 3.x prereleases before 2.0.0, prerelease and build-metadata tags, a later major's release ending the exception, all prereleases after 2.0.0).
  • node scripts/release.js dist-tag 2.0.0-alpha.50 with the repository's tags: latest.
  • npm run lint, npm run build: pass.
  • npm test: not run locally (Playwright browsers not installed in the sandbox); the component tests are untouched and run in CI.
  • CI: all checks passed.
  • Reviewed by adversarial and quality reviewer subagents (2 rounds); all findings fixed.

Declined review findings

  • Count only tags merged into dev for the rule (adversarial, low): a failed v2.x.y tag on dev would still count, so this doesn't remove the caveat; documented instead.
  • Separate dist-tag for backport releases (adversarial, low): out of scope, documented.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Update npm prerelease tagging so stable releases remain on latest while prereleases use next, with a compatibility exception for the unreleased 2.x line.

New Features:

  • Publish prereleases under the next npm dist-tag while keeping latest for stable releases.
  • Preserve the latest dist-tag for 2.x prereleases until a 2.x or later release is tagged.

Enhancements:

  • Document the prerelease dist-tag rules, backport behavior, and release caveats for maintainers.

Tests:

  • Expand release-script coverage for prerelease dist-tags across major versions, release milestones, and version metadata.

uniqueg and others added 3 commits October 28, 2026 06:08
Releases keep the npm dist-tag latest. Prereleases get next, except
those of a major without a release while there is no release 2.0.0 or
later (the 2.0.0 alphas), which keep latest as before. The rule needs no
edit at 2.0.0: it reads the release tags.

Closes #491

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Only prereleases of 2.x get latest before 2.0.0 (not, e.g., 3.0.0
alphas). Document the backport and failed-tag caveats, and test
prerelease tags, build metadata and later majors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Updates release dist-tag selection so stable releases remain on latest, prereleases publish on next, and only 2.x prereleases retain the legacy latest behavior until a stable 2.x-or-later tag is present; tests and release documentation cover the transition and its caveats.

Flow diagram for release dist-tag selection

flowchart TD
    A["distTag(version, tags)"] --> B{prerelease.length === 0}
    B -->|yes| C["latest"]
    B -->|no| D{major === 2 and no release tag with major >= 2}
    D -->|yes| C
    D -->|no| E["next"]
Loading

File-Level Changes

Change Details Files
Changed prerelease publishing to use the next dist-tag, with a temporary 2.x compatibility exception.
  • Return latest for all stable releases.
  • Return next for prereleases by default instead of the prerelease identifier.
  • Keep 2.x prereleases on latest until any stable 2.x-or-later release tag exists.
  • Continue failing when no release tags are available.
scripts/release.js
Expanded automated coverage for dist-tag decisions across release, prerelease, metadata, major-version, and missing-tag scenarios.
  • Verify stable versions always use latest.
  • Verify the pre-2.0.0 2.x exception and its termination by 2.x or later release tags.
  • Verify all other prereleases use next.
  • Verify prerelease and build-metadata tags are not treated as stable release tags.
scripts/release.test.js
Documented the new dist-tag policy and operational caveats for maintainers.
  • Explain latest versus next for releases and prereleases.
  • Document that a pushed 2.x-or-later tag ends the 2.x exception even if publishing fails.
  • Document that backport releases move latest to the older major.
  • Point maintainers to the dist-tag inspection command.
CONTRIBUTING.md

Assessment against linked issues

Issue Objective Addressed Explanation
#491 Publish releases with the latest dist-tag, and publish prereleases with latest only for 2.x while no 2.0.0-or-later release tag exists; otherwise publish prereleases with next. ✅
#491 Update release-script tests and the “Releases” guidance in CONTRIBUTING.md to reflect the new dist-tag rule and its behavior. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@uniqueg
uniqueg marked this pull request as ready for review October 28, 2026 05:25
@uniqueg
uniqueg requested a review from anuragxxd as a code owner October 28, 2026 05:25

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="scripts/release.js" line_range="112" />
<code_context>
+  const exceptionEnded = releases.some(
+    (parsed) => parsed.major >= latestPrereleaseMajor
+  );
+  return major === latestPrereleaseMajor && !exceptionEnded ? "latest" : "next";
 };

</code_context>
<issue_to_address>
**Approving stale stage rolls tag back**

When an older prerelease is staged with a tag, a newer release using that tag is published before the stage is approved, `distTag` chooses the tag at readiness and the pending stage retains it; approving the stage reapplies that stale tag, so installs from it resolve to the older prerelease instead of the newer release.

Recompute or validate the dist-tag against the current releases when approving the stage.

Also at `CONTRIBUTING.md:87`.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and a mistaken calculation could stage a release under latest instead of next, or vice versa, changing what users installing from that channel receive. The staged version’s tag cannot be changed, so reverting alone won’t undo a release already staged, though the channel can be repaired by publishing or retagging appropriately.

Blocking findings: scripts/release.js:112


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread scripts/release.js Resolved
@uniqueg
uniqueg enabled auto-merge (squash) October 28, 2026 05:55
@uniqueg
uniqueg merged commit f5163b8 into dev Oct 28, 2026
8 of 9 checks passed
@uniqueg
uniqueg deleted the ci/dist-tag-next branch October 28, 2026 06:00
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.

ci: publish prereleases as next after 2.0.0

1 participant