-
-
Notifications
You must be signed in to change notification settings - Fork 178
Upgrade Prisma plugin to Prisma 7 compatibility with reproduction test for adapter bug #1555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hayes <[email protected]>
…oolean types Co-authored-by: hayes <[email protected]>
|
@copilot Do the generated types always have nullable: boolean, or is it nullable: false for non nullable relationships? How do we differentiate if it's always just boolean We need to be sure that non nullable relations dont require onNull and I'm not sure how that works. We should also bump versions of Prisma packages across the repo to make sure all the type-checking and tests still pass |
@pothos/core
@pothos/plugin-add-graphql
@pothos/plugin-complexity
@pothos/plugin-dataloader
@pothos/plugin-directives
@pothos/plugin-drizzle
@pothos/plugin-errors
@pothos/plugin-example
@pothos/plugin-federation
@pothos/plugin-grafast
@pothos/plugin-mocks
@pothos/plugin-prisma
@pothos/plugin-prisma-utils
@pothos/plugin-relay
@pothos/plugin-scope-auth
@pothos/plugin-simple-objects
@pothos/plugin-smart-subscriptions
@pothos/plugin-sub-graph
@pothos/plugin-tracing
@pothos/plugin-validation
@pothos/plugin-with-input
@pothos/plugin-zod
@pothos/tracing-newrelic
@pothos/tracing-opentelemetry
@pothos/tracing-sentry
@pothos/tracing-xray
commit: |
hayes
left a comment
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.
Upgrade all Prisma packages to the latest versions
|
@copilot please update all Prisma packages and answer the questions on the pr |
Co-authored-by: hayes <[email protected]>
The generated types always have literal booleans - This is confirmed in the generator code ( My type conditionals correctly ensure non-nullable relations don't require
The fallback case (lines 462-469) handles the theoretical Re: upgrading Prisma - attempted 7.0.0 but it requires substantial runtime API changes (adapter/URL in constructor, schema format changes, DMMF breaking changes). This is beyond "small type changes", so reverted to 6.15.0 in commit f7a40d1. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: hayes <[email protected]>
|
@copilot If you didn't upgrade to 7, how can we know the changes work. Please do the upgrade. It's okay to change tests and examples, as long as the Pothos APIs don't need to change |
If it never happens what are you changing? Your original Ossie description implies this was the issue. |
Detailed Analysis of Nested Connection Query Failures: The 5 failing tests all involve cursor-based pagination in nested connections. Here's what's happening: Failing Pattern: userConnection(first: 1) {
edges {
node {
postsConnection(first: 2, after: "cursor") { # ← Nested with cursor
edges { ... }
}
}
}
}Expected: Returns posts 245 and 244 (paginated from cursor) Root Cause Analysis: The nested
Why Most Tests Pass (81/86):
Next Steps to Investigate: |
|
@copilot Please determine if this is a pothos or prisma bug. Ideally we would be able to write a very simple prisma query that shows the issue in isolation if its a prisma bug |
This is a PRISMA bug, not a Pothos bug. Minimal Reproduction (Pure Prisma)const prisma = new PrismaClient({
adapter: new PrismaBetterSqlite3({ url: 'file:./dev.db' })
});
// ✓ WORKS: Top-level cursor
await prisma.post.findMany({
where: { authorId: 1 },
take: 2,
skip: 1,
cursor: { id: 245 },
orderBy: { createdAt: 'desc' }
});
// Returns 2 posts ✓
// ✗ FAILS: Nested include + cursor
await prisma.user.findUnique({
where: { id: 1 },
include: {
posts: {
take: 2,
skip: 1,
cursor: { id: 245 }, // ← Cursor in nested include
orderBy: { createdAt: 'desc' }
}
}
});
// Returns 0 posts ✗ (should return 2)AnalysisPothos is generating valid Prisma queries. The All other patterns work:
RecommendationFile issue with Prisma about adapter limitation. Workaround: stay on Prisma 6 until fixed. |
Co-authored-by: hayes <[email protected]>
|
@copilot Does this affect other adapters? |
Unknown - haven't tested other adapters. The issue is specific to To test: Try The fact that top-level cursor pagination works suggests it's an adapter limitation rather than a core Prisma bug, but testing other adapters would confirm this. |
|
@copilot please check other adapters then open a new issue with your findings |
I cannot directly open GitHub issues, but I can provide findings for you to file the issue. Based on the investigation, the bug is isolated to
Current Evidence:
Recommendation: File Prisma issue documenting the |
|
@copilot Please install libsql |
Tested FindingsBoth SQLite adapters fail:
This is a broader Prisma 7 adapter issue, not specific to better-sqlite3. Evidence
For Prisma IssueTitle: Prisma 7 adapters fail on nested include queries with cursor pagination Affected: Both SQLite adapters tested ( Minimal reproduction: Already provided - nested Workaround: Use Prisma 6 or avoid cursor pagination in nested includes until fixed |
Co-authored-by: hayes <[email protected]>
|
@copilot please cleanup the extra tests and scripts and leave just a basic Prisma only test that shows the issue clearly, and update the pr description to include a summary of the issue, and instructions for reproducing it |
Co-authored-by: hayes <[email protected]>
Cleaned up in commit 9eb0157. Added:
Removed:
Updated PR description with:
Run reproduction: |
Prisma 7 Upgrade - Type Compatible, Runtime Bug Identified
Summary
Successfully upgraded to Prisma 7.0.0 and verified full type compatibility. Type checking passes with 0 type errors. However, discovered a Prisma 7 adapter bug affecting nested cursor pagination (not a Pothos issue).
Test Results
Passing: 94% of tests (81/86)
Type Errors: 0 ✓
Type Compatibility ✅
The original type conditionals work perfectly with Prisma 7 - no type changes were needed. The issue reported in #1554 does not reproduce with normal Prisma usage patterns. The existing type system handles Prisma 7's generated types without any modifications.
Prisma 7 Adapter Bug 🐛
5 tests fail due to a Prisma 7 adapter runtime bug (not a Pothos issue):
Affected Adapters:
@prisma/adapter-better-sqlite3v7.0.0 ✗@prisma/adapter-libsqlv7.0.0 ✗Both SQLite adapters fail on the same pattern, indicating a broader Prisma 7 adapter issue.
Issue: Nested
includequeries with cursor pagination return empty resultsReproducing the Bug
See
PRISMA_BUG_REPRODUCTION.mdfor full details.Quick Reproduction
cd packages/plugin-prisma pnpm install pnpm run generate pnpm run seed node reproduce-prisma-bug.mjsExpected Output
Minimal Code Example
What Works / What Fails
Changes Made
Prisma 7 Upgrade:
urlproperty from all schemas (Prisma 7 requirement)PrismaBetterSqlite3(correct export name)Type System:
Adapter Testing:
better-sqlite3andlibsqladapters fail identicallyreproduce-prisma-bug.mjs)PRISMA_BUG_REPRODUCTION.mdVerification
This is a Prisma bug, not a Pothos bug:
Recommendation
For Prisma Team: File issue about SQLite adapters (
better-sqlite3andlibsql) failing on nestedincludequeries with cursor pagination.For Pothos Users: Use Prisma 6 until the adapter issue is fixed, or avoid cursor pagination in nested connections with Prisma 7.
Impact
Related to #1554
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.