-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Prisma upgrade #1001
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
Prisma upgrade #1001
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedMore than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review. 78 files out of 185 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits. You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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.
1 issue found across 186 files
Note: This PR contains a large number of files. cubic only reviews up to 150 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="apps/web/scripts/check-enum-imports.ts">
<violation number="1" location="apps/web/scripts/check-enum-imports.ts:116">
Line numbers reported for violations are incorrect when imports span multiple lines because match indexes come from the normalized string, not the original file content.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
|
|
||
| if (valueImportPattern.test(importedItems)) { | ||
| // Find the line number in original content | ||
| const lineNumber = content |
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.
Line numbers reported for violations are incorrect when imports span multiple lines because match indexes come from the normalized string, not the original file content.
Prompt for AI agents
Address the following comment on apps/web/scripts/check-enum-imports.ts at line 116:
<comment>Line numbers reported for violations are incorrect when imports span multiple lines because match indexes come from the normalized string, not the original file content.</comment>
<file context>
@@ -0,0 +1,159 @@
+
+ if (valueImportPattern.test(importedItems)) {
+ // Find the line number in original content
+ const lineNumber = content
+ .substring(0, match.index)
+ .split("\n").length;
</file context>
Upgrade Prisma in apps/web and switch all enum imports to
@/generated/prisma/enumswhile instantiatingPrismaClientwith@prisma/adapter-pgusingenv.DATABASE_URLin prisma.tsPrisma enums move to
@/generated/prisma/enumsand types to@/generated/prisma/client,PrismaClientis initialized withPrismaPgadapter, and CI adds an enum import check script. Generator output and package dependencies are updated to align with the new client location.📍Where to Start
Start with Prisma initialization in
PrismaClientat prisma.ts, then review generator config in schema.prisma and the enum import check in check-enum-imports.js.📊 Macroscope summarized 0f01b04. 11 files reviewed, 13 issues evaluated, 10 issues filtered, 0 comments posted
🗂️ Filtered Issues
apps/web/app/(app)/[emailAccountId]/settings/MultiAccountSection.tsx — 0 comments posted, 2 evaluated, 2 filtered
MultiAccountForm.onSubmit, whenneedsToPurchaseMoreSeatsis true the function returns early with no user feedback or error, leaving the form in a non-terminal state after submit (no success, no failure, no toast). This violates the requirement that every input path reaches a visible outcome. Consider displaying a toast/error message or disabling the submit when extra seats are required. [ Low confidence ]Inputusage inMultiAccountFormsetsname/idtorules.${i}.instructionswhile registering asemailAddresses.${i}.email. BecauseInputcomposesinputPropswithname/idfirst and then spreadsregisterProps, the final inputnamewill be correct (fromregisterProps) but theidwill remain mismatched. This can break label association and may create duplicate or misleading IDs in the DOM. [ Low confidence ]apps/web/app/(app)/premium/config.ts — 0 comments posted, 4 evaluated, 4 filtered
variantIdToTiermay silently mis-map tiers if twoenv.NEXT_PUBLIC_*_VARIANT_IDvalues are equal. In an object literal, duplicate numeric keys overwrite earlier entries, resulting in the last defined tier winning. This yields incorrect tier resolution and potential unexpectedUnknown variant iderrors for the overwritten tier. Add validation at init to detect duplicates and fail fast with a clear error. [ Low confidence ]variantIdToTieruses computed keys fromenv.NEXT_PUBLIC_*_VARIANT_IDwithout validation. If any env isundefinedor a non-numeric value, the object will contain a key like"undefined"or a string that won’t be matched by a numericvariantIdpassed togetLemonSubscriptionTier, causingUnknown variant iderrors for valid inputs. Add upfront validation/coercion to numbers and fail fast if any is missing/invalid. [ Low confidence ]variantIdToTieris missing entries forBUSINESS_PLUS_MONTHLYandBUSINESS_PLUS_ANNUALLY. Any Lemon variant IDs for these tiers will not resolve andgetLemonSubscriptionTierwill throwUnknown variant id: <id>. Add mappings like[env.NEXT_PUBLIC_BUSINESS_PLUS_MONTHLY_VARIANT_ID]: "BUSINESS_PLUS_MONTHLY"and[env.NEXT_PUBLIC_BUSINESS_PLUS_ANNUALLY_VARIANT_ID]: "BUSINESS_PLUS_ANNUALLY". [ Out of scope ]variantIdToTieruses computed numeric keys from multipleenv.NEXT_PUBLIC_*_VARIANT_IDvalues that default to0(z.coerce.number().default(0)inenv.ts). If any of these env vars are unset (or share the same numeric value), their computed keys collide in the object literal, with later entries overwriting earlier ones. This causes incorrect mappings (e.g., all default keys of0end up mapped to"COPILOT_MONTHLY") and makes valid variant IDs missing from the map. As a result,getLemonSubscriptionTiermay throwError("Unknown variant id: ...")for legitimate inputs or return the wrong tier for0. Concretely: keys defined at lines 33–40 can collapse to the same number (often0), and the lookup at line 237 will fail or mis-route. Ensure unique keys by validating env values, rejecting0defaults in production, or constructing the map only with defined, unique IDs. [ Out of scope ]apps/web/app/(landing)/components/page.tsx — 0 comments posted, 2 evaluated, 2 filtered
DismissibleVideoCardis given astorageKeybuilt withDate.now()(storageKey={video-dismissible-${Date.now()}}), making the key change on each render/mount. This prevents persistent dismissal across reloads and can create lots of unused keys inlocalStorage. Use a stable key (e.g., a fixed string or feature-based key) to persist dismissal. [ Low confidence ]ResultDisplayContentusesuseAccount()which throws if noEmailAccountProvideris present, but this page rendersResultDisplayContentdirectly without providing that context. This will cause a runtime error when those sections render. Wrap the page (or those parts) inEmailAccountProvideror avoid usingResultDisplayContentin contexts without the provider. [ Out of scope ]apps/web/components/PremiumAlert.tsx — 0 comments posted, 2 evaluated, 1 filtered
PremiumAiAssistantAlert,isStripeTrialingis computed asstripeSubscriptionStatus && stripeSubscriptionStatus !== "active"(line 73–75). This treats any non-"active" status (e.g.,"past_due","canceled","incomplete") as "trialing" for theactiveOnlygate, showing the "Active Subscription Required" card with the description "This feature is not available on trial plans." This contradicts the message by blocking more than trialing plans and can falsely block access for statuses that should be considered premium elsewhere (e.g.,"trialing"is considered premium inisPremiumStripe). If the intention is to block only trial plans, change the condition to explicitly detect"trialing"; if the intention is to block all non-active statuses, update the description to match behavior. [ Out of scope ]apps/web/scripts/check-enum-imports.js — 0 comments posted, 3 evaluated, 1 filtered
PRISMA_ENUMSlist risks drifting from the actual Prisma enums. If new enums are introduced or names change, the script will silently miss problematic imports, allowing bundling errors to reach production. Consider sourcing this list from the generated enums output or validating against the actual enums file to avoid false negatives. [ Low confidence ]