Skip to content

ci(publish): dev builds publish as 8.0.1-dev.N, so ranges like ^8.0.0-rc.38 stop installing them - #429

Closed
wmadden-electric wants to merge 2 commits into
mainfrom
fix/dev-version-outside-release-ranges
Closed

wmadden-electric wants to merge 2 commits into
mainfrom
fix/dev-version-outside-release-ranges

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Dev builds of prisma and @prisma/cli now publish as a prerelease of the next patch, for example 8.0.1-dev.203, instead of <last release>-dev.<run>, for example 8.0.0-rc.36-dev.202. No version range a user writes for a release can match the new versions.

What a user sees today

npm has latest on 8.0.0-rc.36 and next on 8.0.0-rc.38. Someone who ran npm install prisma@next has "prisma": "^8.0.0-rc.38" in package.json. A fresh npm install of that range (no lockfile) installs 8.0.0-rc.9-dev.79, a dev build from months ago, not 8.0.0-rc.38.

The cause is semver's ordering of prerelease parts. In 8.0.0-rc.36-dev.202 the parts are rc, 36-dev and 202. 36-dev contains letters, so it is compared as text, and text always ranks above a number. So every 8.0.0-rc.N-dev.M sorts above every 8.0.0-rc.N, and among themselves they sort as text (9-dev above 36-dev). npm takes the latest version when the range allows it, and otherwise the highest version in the range, so the problem shows whenever latest is older than the user's range. Appending .dev.N instead does not help: 8.0.0-rc.38.dev.203 still sorts above 8.0.0-rc.38.

What changes

devVersion in scripts/determine-version-utils.ts returns <major>.<minor>.<patch + 1>-dev.<run>:

Root version Dev build before Dev build now
8.0.0-rc.38 8.0.0-rc.38-dev.203 8.0.1-dev.203
8.0.0 8.0.0-dev.203 8.0.1-dev.203
8.1.0 8.1.0-dev.203 8.1.1-dev.203

This is the scheme Prisma ORM already uses (its dev builds are 8.0.1-dev.N while its releases are 8.0.0-rc.N). A semver range matches a prerelease only when the range itself names a prerelease of the same major.minor.patch. No release range names 8.0.1-…, so ^8.0.0-rc.15, ^8.0.0, >=8.0.0 and * never match a dev build. The dev builds still sort below the next real release after 8.0.0 (8.0.1-dev.N < 8.1.0, which is what pnpm bump-version gives after 8.0.0).

The docs (docs/oss/versioning.md, docs/oss/release-automation.md, README.md, CONTRIBUTING.md) describe the new scheme and why the old one was wrong. The promotion test that checks a dev build on latest is not counted as a move back now covers both shapes.

What this costs

  • Peer ranges written for releases no longer accept a dev build. That is the same rule that fixes the bug, so any scheme that fixes it has this cost. @alchemy.run/prisma@2.0.0-beta.87, which @prisma/composer-prisma-cloud depends on, declares an optional peer prisma: ^8.0.0-rc.15. A reviewer repacked rc.38 as 8.0.1-dev.1 and installed it with npm 11: npm put a second, released prisma@8.0.0-rc.36, with @prisma/composer-cli@0.40.0 and ORM rc.25 packages, under node_modules/@prisma/composer-prisma-cloud/node_modules/, with no warning. Nothing loads that copy today. Alchemy's code does not import prisma, so the peer could be dropped there.
  • A dev build made before 8.0.0 gets no update notice at 8.0.0, only at 8.1.0, because 8.0.1-dev.N sorts above 8.0.0.

How it was checked

  • With npm 11.19's own semver and npm-pick-manifest and the real list of prisma versions on npm, for the ranges ^8.0.0-rc.15, ~8.0.0-rc.15, >=8.0.0-rc.15, ^8.0.0, ~8.0.0, >=8.0.0, 8, *, ^8.0.0-0 and >=8.0.0-0: no range picks 8.0.1-dev.203, with or without a latest tag, and after a hypothetical 8.0.0 every range picks 8.0.0. prisma@dev resolves to 8.0.1-dev.203, because a dist-tag names a version directly and ignores ordering.
  • No prisma or @prisma/cli version 8.0.1-* exists on npm, so the first dev publish cannot collide with an existing version.
  • prisma/cloud-deploy-action needs no release: isAtLeastRc in its cli.mjs counts 8.0.1-dev.N as newer than every RC, so on the RC line it sends a dev build the newest arguments (after 8.0.0 that no longer holds; docs/oss/release-automation.md says so).
  • Every consumer receives the computed version unchanged, and the pattern that recognises dev builds on promotion (-dev.<n> at the end) matches the new shape.
  • node --test scripts/determine-version-utils.test.ts scripts/promote-release-utils.test.ts, and Biome on the changed files. pnpm typecheck does not cover scripts/.

Not in this change

  • The old dev builds stay on npm and still win. Even after this merges, ^8.0.0-rc.37 resolves to 8.0.0-rc.9-dev.79 while latest is older than the range, because the existing 8.0.0-rc.N-dev.M versions still sort above every RC. npm skips deprecated versions when it can: with those versions deprecated, the same range resolves to 8.0.0-rc.38. Deprecating the old dev builds, 133 versions of prisma and 136 of @prisma/cli (one npm deprecate per version: a range cannot select them cleanly, because they interleave with the RCs in semver order) is a registry action for a maintainer, not part of this pull request. Promoting 8.0.0-rc.38 to latest also hides the problem for npm users of ^8.0.0-rc.38 and older ranges.
  • @prisma/compute has the same flaw. scripts/resolve-package-version.mjs publishes its dev builds as 0.1.0-dev.<run>.<attempt> beside releases 0.1.0-beta.N, and dev sorts above beta. It is versioned separately, has its own workflow and is due to move to another repository, so it is left out. The engine has no dev builds.

Alternatives

  • <base>.dev.<run> (8.0.0-rc.38.dev.203): still sorts above 8.0.0-rc.38 and matches ^8.0.0-rc.15.
  • Next RC's dev build (8.0.0-rc.39-dev.0.203 or similar): any 8.0.0- prerelease is matched by ^8.0.0-rc.N, so this keeps the problem.
  • Next minor (8.1.0-dev.N): works equally for ranges, but differs from the ORM's scheme for no gain.

Agent: cobain-55

🤖 Generated with Claude Code

…o release range picks them

A dev build was <base>-dev.<run>, for example 8.0.0-rc.36-dev.202. Semver
ranks the identifier 36-dev above any number, so that version sorts above
8.0.0-rc.38 and ranges such as ^8.0.0-rc.37 resolved to dev builds. Dev
builds now publish as <major>.<minor>.<patch+1>-dev.<run> (8.0.0-rc.38 ->
8.0.1-dev.<run>), the scheme Prisma ORM uses. A range matches a prerelease
only on the patch it names, so no release range matches them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Summary by CodeRabbit

  • New Features
    • Development builds published from main now use the next patch version with a dev prerelease identifier, including when a push also cuts a release.
  • Documentation
    • Updated guidance explains how development versions relate to release candidates and stable releases, including version ordering, package range matching, nested installs, and update notices. It also clarifies how deployment arguments are selected for CLI development builds.

Walkthrough

The devVersion function now increments the base patch before adding the workflow run number. Documentation describes next-patch dev versions, the main push publishing rule, and related semver and release-automation behavior. Tests cover the generated versions and confirm that two dev-version forms are not treated as rollbacks.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@pkg-pr-new

pkg-pr-new Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npx https://pkg.pr.new/@prisma/cli@429
npx https://pkg.pr.new/@prisma/cli-engine@429

commit: 8428831

…cost

Peer ranges written for releases no longer accept a dev build, a dev build
made before 8.0.0 gets no update notice until 8.1.0, and the action's
argument rule covers dev builds only on the RC line. README and
CONTRIBUTING no longer describe <base>-dev.N.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
@wmadden-electric wmadden-electric changed the title ci(publish): dev builds publish as the next patch's dev version, so no release range picks them ci(publish): dev builds publish as 8.0.1-dev.N, so ranges like ^8.0.0-rc.38 stop installing them Dec 2, 2026
@wmadden-electric
wmadden-electric marked this pull request as ready for review December 2, 2026 22:16
@wmadden-electric

Copy link
Copy Markdown
Contributor Author

Closing: not pursuing changes to the dev-build versions.

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.

1 participant