Skip to content

fix(local): resolve Prisma dev through package manifest - #268

Closed
AmanVarshney01 wants to merge 1 commit into
mainfrom
codex/fix-prisma-dev-resolution
Closed

fix(local): resolve Prisma dev through package manifest#268
AmanVarshney01 wants to merge 1 commit into
mainfrom
codex/fix-prisma-dev-resolution

Conversation

@AmanVarshney01

Copy link
Copy Markdown
Member

Summary

  • resolve the exported prisma/package.json before looking up the CLI-owned @prisma/dev
  • cover the fallback with a realistic consolidated prisma fixture that has no root export
  • retain direct application-level @prisma/dev resolution for existing installations

Why

The local Postgres provider lets the generated application own its Prisma version. It first resolves @prisma/dev directly and then falls back to the prisma dependency tree. The fallback currently resolves the root prisma entry, but the consolidated package intentionally has no root export. In strict workspace layouts that means resolution fails even when prisma correctly carries @prisma/dev.

Resolving prisma/package.json uses an existing exported subpath and gives createRequire the correct package boundary. This removes the need for generated templates to depend directly on the internal emulator runtime.

Validation

  • pnpm build
  • pnpm --filter @internal/local-target test — 15 passed
  • pnpm --filter @internal/local-target typecheck
  • Biome check on both changed files
  • repository dependency lint from the signed-off commit hook
  • strict pnpm Turborepo smoke: build, Composer dev, Postgres and compute emulators, migrations, and HTTP response with seeded Alice/Bob/Carol

Companion fix

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

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: ffe296d4-7f51-436b-b36a-5b0e57f95945

📥 Commits

Reviewing files that changed from the base of the PR and between 93c176e and a1618f1.

📒 Files selected for processing (2)
  • packages/1-prisma-cloud/0-lowering/local-target/src/__tests__/postgres-module-resolution.test.ts
  • packages/1-prisma-cloud/0-lowering/local-target/src/postgres.ts

Included review availability: 1 review is currently available. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.


Summary by CodeRabbit

  • Bug Fixes
    • Improved PostgreSQL module resolution for consolidated Prisma packages.
    • Added a fallback through the package metadata when direct package resolution is unavailable.
    • Updated resolution behavior to support packages that expose only their package manifest.

Walkthrough

resolvePrismaDevModulePath now resolves prisma/package.json before locating @prisma/dev. The fallback remains relative to the application’s Prisma version and current working directory. Tests add a reusable Prisma package fixture that exports only ./package.json and use it for fallback and missing-dependency cases.

Merge Risk: ⚪ Minimal · up to a1618

This localized change adjusts Prisma development-module resolution and adds fallback coverage; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. 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 clearly summarizes the main change: resolving Prisma development through the package manifest.
Description check ✅ Passed The description directly explains the resolution fix, fallback behavior, test coverage, and motivation.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-prisma-dev-resolution
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/fix-prisma-dev-resolution

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@prisma/composer@268
npm i https://pkg.pr.new/@prisma/composer-cli@268
npm i https://pkg.pr.new/@prisma/composer-prisma-cloud@268

commit: a1618f1

@AmanVarshney01

Copy link
Copy Markdown
Member Author

Closing this for now. I opened it before confirming the upstream PR plan with the team.

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