Skip to content

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Nov 22, 2025

Upgrade Prisma in apps/web and switch all enum imports to @/generated/prisma/enums while instantiating PrismaClient with @prisma/adapter-pg using env.DATABASE_URL in prisma.ts

Prisma enums move to @/generated/prisma/enums and types to @/generated/prisma/client, PrismaClient is initialized with PrismaPg adapter, 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 PrismaClient at 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
  • line 188: In MultiAccountForm.onSubmit, when needsToPurchaseMoreSeats is 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 ]
  • line 207: Input usage in MultiAccountForm sets name/id to rules.${i}.instructions while registering as emailAddresses.${i}.email. Because Input composes inputProps with name/id first and then spreads registerProps, the final input name will be correct (from registerProps) but the id will 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
  • line 32: variantIdToTier may silently mis-map tiers if two env.NEXT_PUBLIC_*_VARIANT_ID values 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 unexpected Unknown variant id errors for the overwritten tier. Add validation at init to detect duplicates and fail fast with a clear error. [ Low confidence ]
  • line 32: variantIdToTier uses computed keys from env.NEXT_PUBLIC_*_VARIANT_ID without validation. If any env is undefined or a non-numeric value, the object will contain a key like "undefined" or a string that won’t be matched by a numeric variantId passed to getLemonSubscriptionTier, causing Unknown variant id errors for valid inputs. Add upfront validation/coercion to numbers and fail fast if any is missing/invalid. [ Low confidence ]
  • line 32: variantIdToTier is missing entries for BUSINESS_PLUS_MONTHLY and BUSINESS_PLUS_ANNUALLY. Any Lemon variant IDs for these tiers will not resolve and getLemonSubscriptionTier will throw Unknown 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 ]
  • line 32: variantIdToTier uses computed numeric keys from multiple env.NEXT_PUBLIC_*_VARIANT_ID values that default to 0 (z.coerce.number().default(0) in env.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 of 0 end up mapped to "COPILOT_MONTHLY") and makes valid variant IDs missing from the map. As a result, getLemonSubscriptionTier may throw Error("Unknown variant id: ...") for legitimate inputs or return the wrong tier for 0. Concretely: keys defined at lines 33–40 can collapse to the same number (often 0), and the lookup at line 237 will fail or mis-route. Ensure unique keys by validating env values, rejecting 0 defaults 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
  • line 242: DismissibleVideoCard is given a storageKey built with Date.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 in localStorage. Use a stable key (e.g., a fixed string or feature-based key) to persist dismissal. [ Low confidence ]
  • line 477: ResultDisplayContent uses useAccount() which throws if no EmailAccountProvider is present, but this page renders ResultDisplayContent directly without providing that context. This will cause a runtime error when those sections render. Wrap the page (or those parts) in EmailAccountProvider or avoid using ResultDisplayContent in contexts without the provider. [ Out of scope ]
apps/web/components/PremiumAlert.tsx — 0 comments posted, 2 evaluated, 1 filtered
  • line 73: In PremiumAiAssistantAlert, isStripeTrialing is computed as stripeSubscriptionStatus && stripeSubscriptionStatus !== "active" (line 73–75). This treats any non-"active" status (e.g., "past_due", "canceled", "incomplete") as "trialing" for the activeOnly gate, 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 in isPremiumStripe). 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
  • line 36: The hardcoded PRISMA_ENUMS list 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 ]

@vercel
Copy link

vercel bot commented Nov 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
inbox-zero Ready Ready Preview Nov 22, 2025 11:15pm
inbox-zero (staging) Ready Ready Preview Nov 22, 2025 11:15pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 22, 2025

Important

Review skipped

More 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 reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit 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 docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch staging

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

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

@socket-security
Copy link

socket-security bot commented Nov 22, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​prisma/​adapter-pg@​7.0.01001008398100
Updated@​prisma/​client@​6.6.0 ⏵ 6.16.394 +110085 +297100

View full report

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 22, 2025

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(&quot;\n&quot;).length;
</file context>
Fix with Cubic

@elie222 elie222 merged commit 242e5a4 into main Nov 23, 2025
18 checks passed
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.

2 participants