GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(cli): warn on global local version mismatch by Iineman2 · Pull Request #29546 · prisma/orm

Conversation

@Iineman2

@Iineman2 Iineman2 commented May 11, 2026

Copy link
Copy Markdown

/claim #1911

Summary

  • add a global/local Prisma version mismatch warning to prisma generate
  • compare the running global CLI version against local prisma and @prisma/client versions when the CLI is installed globally
  • avoid noisy false positives for non-exact specifiers such as workspace:* or dist tags
  • include project-package-manager-specific guidance (npx, pnpm, yarn, or bun) so users can run the local Prisma CLI

Verification

  • nvm use 20.19.4; pnpm --filter prisma test -- src/__tests__/version-mismatch-warning.test.ts
  • nvm use 20.19.4; pnpm exec turbo build --filter=prisma
  • git diff --check HEAD~1 HEAD

Note: I also added focused Generate.test.ts coverage for the user-facing generate output path, but the full Generate.test.ts fixture suite is blocked on this Windows environment by symlink permissions (EPERM: operation not permitted, symlink ... node_modules/@prisma/client). The helper suite and filtered CLI build pass locally.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Iineman2
feat(cli): warn on global local version mismatch
084dd9c
@coderabbitai

coderabbitai Bot commented May 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8209e004-7c4c-4f52-8b1e-736f579a77d9

📥 Commits

Reviewing files that changed from the base of the PR and between 084dd9c and 51ace9a.

📒 Files selected for processing (1)
  • packages/cli/src/utils/version-mismatch-warning.ts

Summary by CodeRabbit

  • New Features

    • CLI generate now surfaces a global/local version-mismatch warning in its output (including when the JS client generator is absent), and shows the appropriate package-manager command to resolve it.
  • Bug Fixes

    • Ensure the version-mismatch warning appears even when hints are otherwise suppressed.
  • Tests

    • Added extensive tests covering mismatch detection, formatting, normalization, and package-manager detection.

Walkthrough

This PR adds detection and display of version mismatch warnings when a globally installed Prisma CLI differs from locally declared Prisma packages in a project. A new utility module detects mismatches, normalizes versions, infers package managers, and formats warnings. The Generate command integrates this utility to display warnings in output, with comprehensive test coverage.

Changes

Version Mismatch Warning Detection & Display

Layer / File(s) Summary
Utility Module & Core Orchestration
packages/cli/src/utils/version-mismatch-warning.ts
getVersionMismatchWarning orchestrates version mismatch detection: validates global install, normalizes versions, reads local package.json versions, detects package manager (pnpm/yarn/bun/npm), computes mismatches for prisma and @prisma/client, and returns formatted warning with appropriate generate command or null if no mismatch.
Helper Functions & Formatters
packages/cli/src/utils/version-mismatch-warning.ts
formatVersionMismatchWarning formats detected mismatches with package-manager-specific commands. Internal helpers: findMismatch (builds mismatch objects when versions differ), getPackageJsonVersion (reads local versions from package.json dependencies), normalizeVersion (normalizes version strings; returns null for workspace:* or non-semver), detectPackageManagerFromProject (infers from lockfiles/package.json), getPrismaGenerateCommand (maps package manager to command).
Generate Command Integration
packages/cli/src/Generate.ts
Generate class now accepts optional versionMismatchWarningOptions in constructor. During non-watch parse runs, computes globalLocalVersionWarning via getVersionMismatchWarning. Hint assembly includes the version warning even when no JS client generator is found, allowing warning display for all execution paths.
Tests
packages/cli/src/__tests__/version-mismatch-warning.test.ts, packages/cli/src/__tests__/commands/Generate.test.ts
Unit tests verify getVersionMismatchWarning returns null when no global install or versions match, returns formatted warning for @prisma/client/prisma mismatches with correct package-manager commands, and handles unsafe version comparisons. Tests for normalizeVersion (exact, caret, tilde, prerelease) and formatVersionMismatchWarning output format. Integration tests verify Generate includes mismatch warning in output and respects --no-hints flag (warning persists, standard hints omitted).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main feature added: warning on global-local version mismatch in the CLI.
Description check ✅ Passed The description is detailed and directly related to the changeset, explaining the feature's purpose, implementation approach, and verification steps.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands and usage tips.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@CLAassistant

CLAassistant commented May 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]
coderabbitai Bot reviewed May 11, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/utils/version-mismatch-warning.ts`:
- Around line 28-60: The defaulting of options.globalVersion to an empty string
is redundant; update the assignment in getVersionMismatchWarning so
globalVersion is computed by calling normalizeVersion with options.globalVersion
(not options.globalVersion ?? ''), relying on normalizeVersion to handle
undefined/empty values; this simplifies the code while preserving behavior for
the normalizeVersion/globalVersion flow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2399160f-0398-4420-8705-40983f828d2b

📥 Commits

Reviewing files that changed from the base of the PR and between d6d9fc9 and 084dd9c.

📒 Files selected for processing (4)
  • packages/cli/src/Generate.ts
  • packages/cli/src/__tests__/commands/Generate.test.ts
  • packages/cli/src/__tests__/version-mismatch-warning.test.ts
  • packages/cli/src/utils/version-mismatch-warning.ts

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/cli/src/utils/version-mismatch-warning.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Iineman2
chore(cli): simplify version warning option handling
51ace9a
@Iineman2

Iineman2 commented May 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

CLA is now signed, and CodeRabbit is clean after the follow-up simplification commit. Latest local targeted verification remains green:

  • pnpm --filter prisma test -- src/__tests__/version-mismatch-warning.test.ts
  • pnpm exec turbo build --filter=prisma

Happy to adjust quickly if maintainers prefer different wording or placement for the warning.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Iineman2 Iineman2 mentioned this pull request May 11, 2026
Warn on mismatch between global prisma and local prisma or @prisma/client #1911
Closed
@baronguyen001 baronguyen001 mentioned this pull request May 22, 2026
feat(cli): warn on global Prisma CLI vs local installed version mismatch #29578
Closed
@tensordreams

tensordreams commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Thanks — this is close: gating on isCurrentBinInstalledGlobally(), reading @prisma/client via getInstalledPrismaClientVersion() (node_modules first), and rejecting workspace:*/dist-tags/ranges in normalizeVersion() are all right.

One blocking ask: the prisma self-version side reads the package.json specifier (via getPackageJsonVersion/package-up) rather than the installed node_modules/prisma/package.json. normalizeVersion() mitigates the worst of it, but a ^7.0.0 specifier with a newer installed version still misreports. Please read the installed version for both packages, and get a full CI run on the branch (we saw the note about the Windows symlink issue blocking local verification).


We're triaging a large number of overlapping PRs for this issue. If we don't hear back within the next few days, we'll close this PR to keep the queue manageable.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tensordreams
tensordreams changed the base branch from main to v7 July 21, 2026 12:06
@tensordreams
tensordreams changed the base branch from v7 to main July 21, 2026 15:11
This was referenced Jul 23, 2026
feat(cli): warn when global prisma CLI differs from locally installed version #29598
Closed
fix(cli): confirm global Prisma usage #29562
Closed
feat(cli): add version mismatch warning for global vs local prisma #29555
Closed
feat(cli): warn on mismatch between global prisma and local versions #29293
Closed
feat(cli): warn when running global Prisma with local version installed #29012
Closed
@aqrln

aqrln commented Jul 24, 2026

Copy link
Copy Markdown
Member

Merged in #29593

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@aqrln aqrln closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@Iineman2 @CLAassistant @tensordreams @aqrln
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.