config: rename LOG_ZOD_ERRORS to DISABLE_LOG_ZOD_ERRORS#1236
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughRenamed LOG_ZOD_ERRORS → DISABLE_LOG_ZOD_ERRORS across config, schema, docs, and build files; inverted Zod logging logic in middleware. Added centralized getActionErrorMessage and isInvalidAIModelError, updated many components to use the helper, added tests, adjusted safe-action logging to per-call loggers, and a small AboutSectionForm prop change. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used📓 Path-based instructions (22)**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/data-fetching.mdc)
Files:
**/*Form.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/form-handling.mdc)
Files:
apps/web/app/(app)/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.cursor/rules/prisma-enum-imports.mdc)
Files:
apps/web/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Files:
**/*.{tsx,ts}📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
Files:
**/*.{tsx,ts,css}📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
Files:
**/*.tsx📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
**/*.{jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
!(pages/_document).{jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Files:
**/*.{js,ts,jsx,tsx}📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
Files:
apps/web/**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
apps/web/app/**/*.{ts,tsx}📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
apps/web/**/*.{tsx,jsx}📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
apps/web/**/*.{ts,tsx,js,jsx,json,css}📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
apps/web/utils/actions/*.ts📄 CodeRabbit inference engine (.cursor/rules/fullstack-workflow.mdc)
Files:
apps/web/utils/actions/**/*.ts📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Files:
**/*.ts📄 CodeRabbit inference engine (.cursor/rules/security.mdc)
Files:
**/{utils,helpers,lib}/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/logging.mdc)
Files:
apps/web/utils/actions/**/*.{ts,tsx}📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
apps/web/**/*.{example,ts,json}📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Files:
🧠 Learnings (25)📓 Common learnings📚 Learning: 2025-11-25T14:37:09.306ZApplied to files:
📚 Learning: 2025-12-21T12:21:37.794ZApplied to files:
📚 Learning: 2025-11-25T14:36:51.389ZApplied to files:
📚 Learning: 2025-07-08T13:14:07.449ZApplied to files:
📚 Learning: 2025-11-25T14:36:53.147ZApplied to files:
📚 Learning: 2025-11-25T14:36:36.276ZApplied to files:
📚 Learning: 2025-11-25T14:36:36.276ZApplied to files:
📚 Learning: 2025-11-25T14:36:51.389ZApplied to files:
📚 Learning: 2025-11-25T14:37:09.306ZApplied to files:
📚 Learning: 2025-11-25T14:42:08.869ZApplied to files:
📚 Learning: 2025-11-25T14:42:08.869ZApplied to files:
📚 Learning: 2025-11-25T14:40:13.649ZApplied to files:
📚 Learning: 2025-11-25T14:40:13.649ZApplied to files:
📚 Learning: 2025-11-25T14:40:15.063ZApplied to files:
📚 Learning: 2025-11-25T14:36:51.389ZApplied to files:
📚 Learning: 2025-12-21T12:21:37.794ZApplied to files:
📚 Learning: 2025-11-25T14:36:51.389ZApplied to files:
📚 Learning: 2025-11-25T14:36:53.147ZApplied to files:
📚 Learning: 2025-11-25T14:39:49.448ZApplied to files:
📚 Learning: 2026-01-07T21:07:06.691ZApplied to files:
📚 Learning: 2025-11-25T14:38:07.606ZApplied to files:
📚 Learning: 2025-11-25T14:38:07.606ZApplied to files:
📚 Learning: 2025-11-25T14:38:07.606ZApplied to files:
📚 Learning: 2025-11-25T14:38:07.606ZApplied to files:
🧬 Code graph analysis (1)apps/web/utils/actions/settings.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (5)
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 |
There was a problem hiding this comment.
1 issue found across 7 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="docs/hosting/environment-variables.md">
<violation number="1" location="docs/hosting/environment-variables.md:93">
P2: The `DISABLE_LOG_ZOD_ERRORS` variable is marked as Required=Yes, but it should be Required=No. This is an opt-out debugging flag - the PR description confirms Zod errors are logged by default unless this variable is set, meaning it's optional.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
P2: The DISABLE_LOG_ZOD_ERRORS variable is marked as Required=Yes, but it should be Required=No. This is an opt-out debugging flag - the PR description confirms Zod errors are logged by default unless this variable is set, meaning it's optional.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/hosting/environment-variables.md, line 93:
<comment>The `DISABLE_LOG_ZOD_ERRORS` variable is marked as Required=Yes, but it should be Required=No. This is an opt-out debugging flag - the PR description confirms Zod errors are logged by default unless this variable is set, meaning it's optional.</comment>
<file context>
@@ -90,7 +90,7 @@ cp apps/web/.env.example apps/web/.env
| `NEXT_PUBLIC_INTEGRATIONS_ENABLED` | No | Enable the integrations feature, allowing users to connect external services. | `false` |
| **Debugging** ||||
-| `LOG_ZOD_ERRORS` | No | Log Zod validation errors | — |
+| `DISABLE_LOG_ZOD_ERRORS` | Yes | Disable logging Zod validation errors | — |
| `ENABLE_DEBUG_LOGS` | No | Enable debug logging | `false` |
| `NEXT_PUBLIC_LOG_SCOPES` | No | Comma-separated log scopes | — |
</file context>
| | `DISABLE_LOG_ZOD_ERRORS` | Yes | Disable logging Zod validation errors | — | | |
| | `DISABLE_LOG_ZOD_ERRORS` | No | Disable logging Zod validation errors | — | |
✅ Addressed in c157b1b
There was a problem hiding this comment.
Commit c157b1b addressed this comment. The Required field for DISABLE_LOG_ZOD_ERRORS was changed from "Yes" to "No" on line 93, correctly marking this opt-out debugging flag as optional rather than required.
There was a problem hiding this comment.
Fixed - changed Required to No since it's optional.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @docs/hosting/environment-variables.md:
- Line 93: The documentation entry for DISABLE_LOG_ZOD_ERRORS incorrectly marks
it as required; update the environment-variables.md table so
DISABLE_LOG_ZOD_ERRORS is marked optional/No to match the env schema where
DISABLE_LOG_ZOD_ERRORS is defined as .optional() in apps/web/env.ts; ensure the
description and example (if any) remain accurate and consistent with the env.ts
behavior.
🧹 Nitpick comments (1)
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx (1)
64-64: Remove unnecessary optional chaining.Since
onSuccessis now a required prop (line 44), the optional chaining operator?.()on line 64 is unnecessary and misleading. Call it directly.♻️ Proposed fix
- onSuccess?.(); + onSuccess();
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
.devcontainer/setup.shapps/web/.env.exampleapps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/env.tsapps/web/utils/middleware.tsdocs/hosting/environment-variables.mdturbo.json
💤 Files with no reviewable changes (2)
- apps/web/.env.example
- .devcontainer/setup.sh
🧰 Additional context used
📓 Path-based instructions (22)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/data-fetching.mdc)
**/*.{ts,tsx}: For API GET requests to server, use theswrpackage
Useresult?.serverErrorwithtoastErrorfrom@/components/Toastfor error handling in async operations
**/*.{ts,tsx}: Use wrapper functions for Gmail message operations (get, list, batch, etc.) from @/utils/gmail/message.ts instead of direct API calls
Use wrapper functions for Gmail thread operations from @/utils/gmail/thread.ts instead of direct API calls
Use wrapper functions for Gmail label operations from @/utils/gmail/label.ts instead of direct API calls
**/*.{ts,tsx}: For early access feature flags, create hooks using the naming conventionuse[FeatureName]Enabledthat return a boolean fromuseFeatureFlagEnabled("flag-key")
For A/B test variant flags, create hooks using the naming conventionuse[FeatureName]Variantthat define variant types, useuseFeatureFlagVariantKey()with type casting, and provide a default "control" fallback
Use kebab-case for PostHog feature flag keys (e.g.,inbox-cleaner,pricing-options-2)
Always define types for A/B test variant flags (e.g.,type PricingVariant = "control" | "variant-a" | "variant-b") and provide type safety through type casting
**/*.{ts,tsx}: Don't use primitive type aliases or misleading types
Don't use empty type parameters in type aliases and interfaces
Don't use this and super in static contexts
Don't use any or unknown as type constraints
Don't use the TypeScript directive @ts-ignore
Don't use TypeScript enums
Don't export imported variables
Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions
Don't use TypeScript namespaces
Don't use non-null assertions with the!postfix operator
Don't use parameter properties in class constructors
Don't use user-defined types
Useas constinstead of literal types and type annotations
Use eitherT[]orArray<T>consistently
Initialize each enum member value explicitly
Useexport typefor types
Use `impo...
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/env.tsapps/web/utils/middleware.ts
**/*Form.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/form-handling.mdc)
**/*Form.{ts,tsx}: Use React Hook Form with Zod for validation in form components
Validate form inputs before submission
Show validation errors inline next to form fields
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
apps/web/app/(app)/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)
apps/web/app/(app)/**/*.{ts,tsx}: Components for the page are either put inpage.tsx, or in theapps/web/app/(app)/PAGE_NAMEfolder
If we're in a deeply nested component we will useswrto fetch via API
If you need to useonClickin a component, that component is a client component and file must start withuse client
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/prisma-enum-imports.mdc)
Always import Prisma enums from
@/generated/prisma/enumsinstead of@/generated/prisma/clientto avoid Next.js bundling errors in client componentsImport Prisma using the project's centralized utility:
import prisma from '@/utils/prisma'
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/env.tsapps/web/utils/middleware.ts
apps/web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
Import specific lodash functions rather than entire lodash library to minimize bundle size (e.g.,
import groupBy from 'lodash/groupBy')
apps/web/**/*.{ts,tsx}: Use TypeScript with strict null checks
Do not export types/interfaces that are only used within the same file. Export later if needed
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/env.tsapps/web/utils/middleware.ts
**/*.{tsx,ts}
📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
**/*.{tsx,ts}: Use Shadcn UI and Tailwind for components and styling
Usenext/imagepackage for images
For API GET requests to server, use theswrpackage with hooks likeuseSWRto fetch data
For text inputs, use theInputcomponent withregisterPropsfor form integration and error handling
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/env.tsapps/web/utils/middleware.ts
**/*.{tsx,ts,css}
📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
Implement responsive design with Tailwind CSS using a mobile-first approach
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/env.tsapps/web/utils/middleware.ts
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)
**/*.tsx: Use theLoadingContentcomponent to handle loading states instead of manual loading state management
For text areas, use theInputcomponent withtype='text',autosizeTextareaprop set to true, andregisterPropsfor form integration
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
**/*.{js,jsx,ts,tsx}: Don't useaccessKeyattribute on any HTML element
Don't setaria-hidden="true"on focusable elements
Don't add ARIA roles, states, and properties to elements that don't support them
Don't use distracting elements like<marquee>or<blink>
Only use thescopeprop on<th>elements
Don't assign non-interactive ARIA roles to interactive HTML elements
Make sure label elements have text content and are associated with an input
Don't assign interactive ARIA roles to non-interactive HTML elements
Don't assigntabIndexto non-interactive HTML elements
Don't use positive integers fortabIndexproperty
Don't include "image", "picture", or "photo" in img alt prop
Don't use explicit role property that's the same as the implicit/default role
Make static elements with click handlers use a valid role attribute
Always include atitleelement for SVG elements
Give all elements requiring alt text meaningful information for screen readers
Make sure anchors have content that's accessible to screen readers
AssigntabIndexto non-interactive HTML elements witharia-activedescendant
Include all required ARIA attributes for elements with ARIA roles
Make sure ARIA properties are valid for the element's supported roles
Always include atypeattribute for button elements
Make elements with interactive roles and handlers focusable
Give heading elements content that's accessible to screen readers (not hidden witharia-hidden)
Always include alangattribute on the html element
Always include atitleattribute for iframe elements
AccompanyonClickwith at least one of:onKeyUp,onKeyDown, oronKeyPress
AccompanyonMouseOver/onMouseOutwithonFocus/onBlur
Include caption tracks for audio and video elements
Use semantic elements instead of role attributes in JSX
Make sure all anchors are valid and navigable
Ensure all ARIA properties (aria-*) are valid
Use valid, non-abstract ARIA roles for elements with ARIA roles
Use valid AR...
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/env.tsapps/web/utils/middleware.ts
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
**/*.{jsx,tsx}: Don't use unnecessary fragments
Don't pass children as props
Don't use the return value of React.render
Make sure all dependencies are correctly specified in React hooks
Make sure all React hooks are called from the top level of component functions
Don't forget key props in iterators and collection literals
Don't define React components inside other components
Don't use event handlers on non-interactive elements
Don't assign to React component props
Don't use bothchildrenanddangerouslySetInnerHTMLprops on the same element
Don't use dangerous JSX props
Don't use Array index in keys
Don't insert comments as text nodes
Don't assign JSX properties multiple times
Don't add extra closing tags for components without children
Use<>...</>instead of<Fragment>...</Fragment>
Watch out for possible "wrong" semicolons inside JSX elements
Make sure void (self-closing) elements don't have children
Don't usetarget="_blank"withoutrel="noopener"
Don't use<img>elements in Next.js projects
Don't use<head>elements in Next.js projects
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
!(pages/_document).{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
Don't use the next/head module in pages/_document.js on Next.js projects
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/env.tsturbo.jsonapps/web/utils/middleware.tsdocs/hosting/environment-variables.md
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)
**/*.{js,ts,jsx,tsx}: Use lodash utilities for common operations (arrays, objects, strings)
Import specific lodash functions to minimize bundle size (e.g.,import groupBy from 'lodash/groupBy')
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/env.tsapps/web/utils/middleware.ts
apps/web/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
apps/web/**/*.{ts,tsx,js,jsx}: Use@/path aliases for imports from project root
Prefer self-documenting code over comments; use descriptive variable and function names instead of explaining intent with comments
Add helper functions to the bottom of files, not the top
All imports go at the top of files, no mid-file dynamic imports
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/env.tsapps/web/utils/middleware.ts
apps/web/app/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Follow NextJS app router structure with (app) directory
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
apps/web/**/*.{tsx,jsx}
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
apps/web/**/*.{tsx,jsx}: Follow tailwindcss patterns with prettier-plugin-tailwindcss for class sorting
Prefer functional components with hooks in React
Use shadcn/ui components when available
Ensure responsive design with mobile-first approach in components
Follow consistent naming conventions using PascalCase for components
Use LoadingContent component for async data with loading and error states
Use React Hook Form with Zod validation for form handling
Useresult?.serverErrorwithtoastErrorandtoastSuccessfor error handling in forms
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
apps/web/**/*.{ts,tsx,js,jsx,json,css}
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Format code with Prettier
Files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/env.tsapps/web/utils/middleware.ts
apps/web/env.ts
📄 CodeRabbit inference engine (.cursor/rules/environment-variables.mdc)
apps/web/env.ts: Add server-only environment variables toapps/web/env.tsunder theserverobject with Zod schema validation
Add client-side environment variables toapps/web/env.tsunder theclientobject withNEXT_PUBLIC_prefix and Zod schema validation
Add client-side environment variables toapps/web/env.tsunder theexperimental__runtimeEnvobject to enable runtime access
Files:
apps/web/env.ts
{.env.example,apps/web/env.ts}
📄 CodeRabbit inference engine (.cursor/rules/environment-variables.mdc)
Client-side environment variables must be prefixed with
NEXT_PUBLIC_
Files:
apps/web/env.ts
**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/security.mdc)
**/*.ts: ALL database queries MUST be scoped to the authenticated user/account by including user/account filtering in WHERE clauses to prevent unauthorized data access
Always validate that resources belong to the authenticated user before performing operations, using ownership checks in WHERE clauses or relationships
Always validate all input parameters for type, format, and length before using them in database queries
Use SafeError for error responses to prevent information disclosure. Generic error messages should not reveal internal IDs, logic, or resource ownership details
Only return necessary fields in API responses using Prisma'sselectoption. Never expose sensitive data such as password hashes, private keys, or system flags
Prevent Insecure Direct Object References (IDOR) by validating resource ownership before operations. AllfindUnique/findFirstcalls MUST include ownership filters
Prevent mass assignment vulnerabilities by explicitly whitelisting allowed fields in update operations instead of accepting all user-provided data
Prevent privilege escalation by never allowing users to modify system fields, ownership fields, or admin-only attributes through user input
AllfindManyqueries MUST be scoped to the user's data by including appropriate WHERE filters to prevent returning data from other users
Use Prisma relationships for access control by leveraging nested where clauses (e.g.,emailAccount: { id: emailAccountId }) to validate ownership
Files:
apps/web/env.tsapps/web/utils/middleware.ts
apps/web/**/*.{example,ts,json}
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Add environment variables to
.env.example,env.ts, andturbo.json
Files:
apps/web/env.tsapps/web/utils/middleware.ts
turbo.json
📄 CodeRabbit inference engine (.cursor/rules/environment-variables.mdc)
Add new environment variables to
turbo.jsonundertasks.build.envas a global dependency for the build task
Files:
turbo.json
**/{utils,helpers,lib}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/logging.mdc)
Logger should be passed as a parameter to helper functions instead of creating their own logger instances
Files:
apps/web/utils/middleware.ts
🧠 Learnings (33)
📓 Common learnings
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2025-11-25T14:37:09.306Z
Learning: Applies to apps/web/components/**/*Form*.tsx : Use React Hook Form with Zod validation (`zodResolver`) for form handling, with form components using `register`, `handleSubmit`, and error handling from the hook
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/form-handling.mdc:0-0
Timestamp: 2025-11-25T14:36:53.147Z
Learning: Applies to **/*Form.{ts,tsx} : Use React Hook Form with Zod for validation in form components
📚 Learning: 2025-11-25T14:37:09.306Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2025-11-25T14:37:09.306Z
Learning: Applies to apps/web/components/**/*Form*.tsx : Handle form submission results using `result?.serverError` to show error toasts and `toastSuccess` to show success messages after server action completion
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-07-08T13:14:07.449Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 537
File: apps/web/app/(app)/[emailAccountId]/clean/onboarding/page.tsx:30-34
Timestamp: 2025-07-08T13:14:07.449Z
Learning: The clean onboarding page in apps/web/app/(app)/[emailAccountId]/clean/onboarding/page.tsx is intentionally Gmail-specific and should show an error for non-Google email accounts rather than attempting to support multiple providers.
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-12-21T12:21:37.794Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-12-21T12:21:37.794Z
Learning: Applies to apps/web/**/*.{tsx,jsx} : Use `result?.serverError` with `toastError` and `toastSuccess` for error handling in forms
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:36:51.389Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/form-handling.mdc:0-0
Timestamp: 2025-11-25T14:36:51.389Z
Learning: Applies to **/*Form.{ts,tsx} : Show validation errors inline next to form fields in the UI
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:40:13.649Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-11-25T14:40:13.649Z
Learning: Applies to **/*.{tsx,ts,jsx,js} : For text inputs in forms, use the `Input` component with `type='email'`, `name`, `label`, `registerProps` from react-hook-form, and `error` props
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:40:13.649Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-11-25T14:40:13.649Z
Learning: Applies to **/*.{tsx,ts,jsx,js} : For text areas in forms, use the `Input` component with `type='text'`, `autosizeTextarea` prop, `rows`, `name`, `placeholder`, `registerProps` from react-hook-form, and `error` props
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:40:15.063Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-11-25T14:40:15.063Z
Learning: Applies to **/*.{tsx,ts} : For text inputs, use the `Input` component with `registerProps` for form integration and error handling
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:36:36.276Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/data-fetching.mdc:0-0
Timestamp: 2025-11-25T14:36:36.276Z
Learning: Applies to **/*.{ts,tsx} : Import error and success toast utilities from '@/components/Toast' for displaying notifications
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:36:51.389Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/form-handling.mdc:0-0
Timestamp: 2025-11-25T14:36:51.389Z
Learning: Applies to **/*Form.{ts,tsx} : Validate form inputs before submission using React Hook Form and Zod resolver
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-12-21T12:21:37.794Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-12-21T12:21:37.794Z
Learning: Applies to apps/web/**/*.{tsx,jsx} : Use React Hook Form with Zod validation for form handling
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:36:51.389Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/form-handling.mdc:0-0
Timestamp: 2025-11-25T14:36:51.389Z
Learning: Applies to **/*Form.{ts,tsx} : Use React Hook Form with Zod for form validation
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:36:53.147Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/form-handling.mdc:0-0
Timestamp: 2025-11-25T14:36:53.147Z
Learning: Applies to **/*Form.{ts,tsx} : Use React Hook Form with Zod for validation in form components
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:37:09.306Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2025-11-25T14:37:09.306Z
Learning: Applies to apps/web/components/**/*Form*.tsx : Use React Hook Form with Zod validation (`zodResolver`) for form handling, with form components using `register`, `handleSubmit`, and error handling from the hook
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsxapps/web/utils/middleware.ts
📚 Learning: 2026-01-07T21:07:06.691Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 1230
File: apps/web/app/(app)/[emailAccountId]/drive/page.tsx:47-70
Timestamp: 2026-01-07T21:07:06.691Z
Learning: In TSX files across the codebase, prefer direct server action calls with manual error handling (e.g., check result?.serverError and handle errors explicitly). The useAction hook pattern is not required; you can call server actions directly and use try/finally to ensure cleanup (such as resetting loading states) regardless of the hook. Apply consistently for components that perform server interactions.
Applied to files:
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:36:45.807Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:45.807Z
Learning: Applies to apps/web/env.ts : Add server-only environment variables to `apps/web/env.ts` under the `server` object with Zod schema validation
Applied to files:
apps/web/env.tsapps/web/utils/middleware.tsdocs/hosting/environment-variables.md
📚 Learning: 2025-11-25T14:36:43.454Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:43.454Z
Learning: Applies to apps/web/env.ts : Define environment variables in `apps/web/env.ts` using Zod schema validation, organizing them into `server` and `client` sections
Applied to files:
apps/web/env.tsapps/web/utils/middleware.tsdocs/hosting/environment-variables.md
📚 Learning: 2025-11-25T14:36:45.807Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:45.807Z
Learning: Applies to apps/web/env.ts : Add client-side environment variables to `apps/web/env.ts` under the `client` object with `NEXT_PUBLIC_` prefix and Zod schema validation
Applied to files:
apps/web/env.tsturbo.jsonapps/web/utils/middleware.tsdocs/hosting/environment-variables.md
📚 Learning: 2025-11-25T14:36:45.807Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:45.807Z
Learning: Applies to apps/web/env.ts : Add client-side environment variables to `apps/web/env.ts` under the `experimental__runtimeEnv` object to enable runtime access
Applied to files:
apps/web/env.ts
📚 Learning: 2025-11-25T14:38:07.606Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm.mdc:0-0
Timestamp: 2025-11-25T14:38:07.606Z
Learning: Applies to apps/web/utils/ai/**/*.ts : LLM feature functions must import from `zod` for schema validation, use `createScopedLogger` from `@/utils/logger`, `chatCompletionObject` and `createGenerateObject` from `@/utils/llms`, and import `EmailAccountWithAI` type from `@/utils/llms/types`
Applied to files:
apps/web/env.tsapps/web/utils/middleware.ts
📚 Learning: 2025-07-19T15:06:43.730Z
Learnt from: garnertb
Repo: elie222/inbox-zero PR: 580
File: apps/web/.env.example:4-7
Timestamp: 2025-07-19T15:06:43.730Z
Learning: In apps/web/.env.example, boolean environment variables follow an unquoted convention (e.g., LOG_ZOD_ERRORS=true, AUTH_TRUST_HOST=true). Logical grouping of related variables (like auth variables together) is preferred over strict alphabetical ordering for better developer experience.
Applied to files:
apps/web/env.tsdocs/hosting/environment-variables.md
📚 Learning: 2026-01-06T06:54:43.485Z
Learnt from: jshwrnr
Repo: elie222/inbox-zero PR: 1198
File: apps/web/app/(marketing)/sanity/sanity.config.ts:1-31
Timestamp: 2026-01-06T06:54:43.485Z
Learning: For Sanity Studio integration in apps/web/app/(marketing)/sanity/, environment variables (NEXT_PUBLIC_SANITY_PROJECT_ID, NEXT_PUBLIC_SANITY_DATASET, NEXT_PUBLIC_SANITY_API_VERSION) should be kept in the local sanity/env.ts file following Sanity's recommended pattern, rather than being moved to the centralized apps/web/env.ts with Zod validation. These variables are specific to the Sanity Studio context.
Applied to files:
apps/web/env.ts
📚 Learning: 2025-11-25T14:39:49.448Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/server-actions.mdc:0-0
Timestamp: 2025-11-25T14:39:49.448Z
Learning: Applies to apps/web/utils/actions/*.validation.ts : Create separate validation files for server actions using the naming convention `apps/web/utils/actions/NAME.validation.ts` containing Zod schemas and inferred types
Applied to files:
apps/web/env.ts
📚 Learning: 2025-11-25T14:36:43.454Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:43.454Z
Learning: Applies to apps/web/env.ts : For client-side environment variables in `apps/web/env.ts`, prefix them with `NEXT_PUBLIC_` and add them to both the `client` and `experimental__runtimeEnv` sections
Applied to files:
apps/web/env.ts
📚 Learning: 2025-11-25T14:36:51.389Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/form-handling.mdc:0-0
Timestamp: 2025-11-25T14:36:51.389Z
Learning: Applies to **/*.validation.ts : Use descriptive error messages in Zod validation schemas
Applied to files:
apps/web/env.tsapps/web/utils/middleware.ts
📚 Learning: 2025-11-25T14:36:45.807Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:45.807Z
Learning: Applies to turbo.json : Add new environment variables to `turbo.json` under `tasks.build.env` as a global dependency for the build task
Applied to files:
turbo.json
📚 Learning: 2025-11-25T14:36:43.454Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/environment-variables.mdc:0-0
Timestamp: 2025-11-25T14:36:43.454Z
Learning: Applies to turbo.json : Add environment variables to `turbo.json` under `tasks.build.env` array to declare build-time dependencies
Applied to files:
turbo.json
📚 Learning: 2025-12-21T12:21:37.794Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-12-21T12:21:37.794Z
Learning: Applies to apps/web/**/*.{example,ts,json} : Add environment variables to `.env.example`, `env.ts`, and `turbo.json`
Applied to files:
turbo.json
📚 Learning: 2025-11-25T14:37:09.306Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2025-11-25T14:37:09.306Z
Learning: Applies to apps/web/utils/actions/*.validation.ts : Export types from Zod schemas using `z.infer<>` to maintain type safety between validation and client usage
Applied to files:
apps/web/utils/middleware.ts
📚 Learning: 2025-12-21T12:21:37.794Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-12-21T12:21:37.794Z
Learning: Applies to apps/web/utils/actions/**/*.{ts,tsx} : Infer types from Zod schemas using `z.infer<typeof schema>` instead of duplicating as separate interfaces
Applied to files:
apps/web/utils/middleware.ts
📚 Learning: 2025-12-21T12:21:37.794Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-12-21T12:21:37.794Z
Learning: Applies to apps/web/utils/actions/**/*.ts : Use `next-safe-action` with Zod schemas for server actions to handle mutations
Applied to files:
apps/web/utils/middleware.ts
📚 Learning: 2025-11-25T14:38:07.606Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm.mdc:0-0
Timestamp: 2025-11-25T14:38:07.606Z
Learning: Applies to apps/web/utils/ai/**/*.ts : Use descriptive scoped loggers for each LLM feature, log inputs and outputs with appropriate log levels, and include relevant context in log messages
Applied to files:
apps/web/utils/middleware.ts
📚 Learning: 2025-11-25T14:37:09.306Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2025-11-25T14:37:09.306Z
Learning: Applies to apps/web/utils/actions/*.ts : Use `next-safe-action` with Zod schemas for all server actions (create/update/delete mutations), storing validation schemas in `apps/web/utils/actions/*.validation.ts`
Applied to files:
apps/web/utils/middleware.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Baz Reviewer
- GitHub Check: cubic · AI code reviewer
- GitHub Check: test
🔇 Additional comments (3)
apps/web/env.ts (1)
84-84: LGTM!The environment variable rename from
LOG_ZOD_ERRORStoDISABLE_LOG_ZOD_ERRORScorrectly reflects the opt-out behavior and maintains proper Zod validation.apps/web/utils/middleware.ts (1)
129-131: LGTM!The logic correctly implements opt-out behavior: Zod validation errors are logged by default unless
DISABLE_LOG_ZOD_ERRORSis explicitly set to true.turbo.json (1)
59-59: LGTM!The environment variable rename in the build configuration correctly aligns with the changes in
env.tsandmiddleware.ts.
| CRON_SECRET= # openssl rand -hex 32 -note: cron disabled if not set | ||
|
|
||
| NEXT_PUBLIC_BYPASS_PREMIUM_CHECKS=true | ||
| LOG_ZOD_ERRORS=true | ||
| # WEBHOOK_URL= |
There was a problem hiding this comment.
The example .env no longer shows LOG_ZOD_ERRORS and doesn't add the new DISABLE_LOG_ZOD_ERRORS flag, so developers lose the one place that previously documented how to toggle Zod logging. With the new opt‑out semantics, we now default to logging and there is no sample entry to explain how to turn it off (the docs mention DISABLE_LOG_ZOD_ERRORS, but the .env template is now inconsistent and gives no guidance).
| CRON_SECRET= # openssl rand -hex 32 -note: cron disabled if not set | |
| NEXT_PUBLIC_BYPASS_PREMIUM_CHECKS=true | |
| LOG_ZOD_ERRORS=true | |
| # WEBHOOK_URL= | |
| CRON_SECRET= # openssl rand -hex 32 -note: cron disabled if not set | |
| NEXT_PUBLIC_BYPASS_PREMIUM_CHECKS=true | |
| # DISABLE_LOG_ZOD_ERRORS=true # Uncomment to disable Zod validation error logging | |
| # WEBHOOK_URL= |
Finding type: Logical Bugs
There was a problem hiding this comment.
Commit c157b1b addressed this comment by adding the line # DISABLE_LOG_ZOD_ERRORS=true # Uncomment to disable Zod validation error logging to the .env.example file. This provides the documentation that was requested, showing developers how to toggle Zod logging with the new opt-out flag.
There was a problem hiding this comment.
Fixed - added commented example for DISABLE_LOG_ZOD_ERRORS in .env.example.
- Add getActionErrorMessage to extract user-friendly messages from safe-action errors - Support both serverError and flattened validationErrors - Add prefix option for 'Failed to X. <error>' pattern - Configure safe-action with defaultValidationErrorsShape: 'flattened' - Add middleware to log validation errors at warn level - Update 16 components to use new error helper - Add tests for getActionErrorMessage - Update documentation with new error handling pattern
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx:
- Line 63: The code calls onSuccess with optional chaining (onSuccess?.()) even
though onSuccess is now a required prop; update the call in AboutSectionForm
(where onSuccess is invoked, around the onSuccess?.() line) to call onSuccess()
directly, removing the optional chaining so the required prop is invoked as
intended.
In @apps/web/utils/error-messages/index.ts:
- Line 114: Update the remaining reference to the renamed error constant: in the
errorTypes array inside the function/method in
apps/web/utils/actions/settings.ts (the block containing errorTypes: [...])
replace ErrorType.INVALID_OPENAI_MODEL with ErrorType.INVALID_AI_MODEL so it
matches the constant defined in ErrorType (INVALID_AI_MODEL).
🧹 Nitpick comments (4)
apps/web/app/(app)/[emailAccountId]/assistant/settings/MultiRuleSetting.tsx (1)
7-7: Centralized error handling applied correctly.The refactoring to use
getActionErrorMessageis implemented correctly and aligns with the project-wide standardization effort.💡 Optional: Consider a more specific error prefix
The current prefix "There was an error" is quite generic. Consider making it more descriptive:
- description: getActionErrorMessage(error.error, { - prefix: "There was an error", - }), + description: getActionErrorMessage(error.error, { + prefix: "Failed to toggle multi-rule selection", + }),This provides clearer context about which operation failed, improving the user experience.
Also applies to: 26-28
.cursor/rules/fullstack-workflow.mdc (1)
132-132: Remove unuseduseCallbackimport.The
useCallbackimport is not used in the form example below. Clean imports help maintain code clarity.♻️ Proposed fix
-import { useCallback } from "react"; import { useForm, type SubmitHandler } from "react-hook-form";apps/web/CLAUDE.md (1)
188-188: Remove unuseduseCallbackimport.The
useCallbackimport is not used in the example code. This is the same issue present in.cursor/rules/fullstack-workflow.mdcline 132.♻️ Proposed fix
-import { useCallback } from "react"; import { useForm, type SubmitHandler } from "react-hook-form";apps/web/utils/actions/safe-action.ts (1)
21-28: Consider enriching logger context in error handler.The logger created in
handleServerErrorlacks therequestIdcontext that the middleware logger has (line 59). For better log correlation and debugging, consider propagating therequestIdthrough the context chain or extracting it if available.💡 Potential improvement
If
requestIdcan be added to the context:const context = ctx as { userId?: string; userEmail?: string; emailAccountId?: string; + requestId?: string; }; - const logger = createScopedLogger("safe-action"); + const logger = context.requestId + ? createScopedLogger("safe-action").with({ requestId: context.requestId }) + : createScopedLogger("safe-action");
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
Outdated
Show resolved
Hide resolved
- Fix DISABLE_LOG_ZOD_ERRORS Required=No in docs - Add commented DISABLE_LOG_ZOD_ERRORS to .env.example - Remove optional chaining for required onSuccess prop - Update INVALID_OPENAI_MODEL to INVALID_AI_MODEL in settings.ts
User description
config: rename LOG_ZOD_ERRORS to DISABLE_LOG_ZOD_ERRORS
Renames the environment variable for logging Zod errors to better reflect its opt-out nature and updates the AboutSection component.
LOG_ZOD_ERRORStoDISABLE_LOG_ZOD_ERRORSacross the codebase and documentation.DISABLE_LOG_ZOD_ERRORSis set.onSuccessprop required inAboutSectionand cleaned up unused imports.Generated description
Below is a concise technical summary of the changes proposed in this PR:
graph LR handleError_("handleError"):::modified isInvalidAIModelError_("isInvalidAIModelError"):::added isKnownApiError_("isKnownApiError"):::modified AdminUserControls_("AdminUserControls"):::modified getActionErrorMessage_("getActionErrorMessage"):::added AdminSyncStripe_("AdminSyncStripe"):::modified AccountOptionsDropdown_("AccountOptionsDropdown"):::modified MultiAccountSection_("MultiAccountSection"):::modified handleError_ -- "Adds detection and user notification for invalid AI models." --> isInvalidAIModelError_ isKnownApiError_ -- "Classifies invalid-model API responses as known API errors." --> isInvalidAIModelError_ AdminUserControls_ -- "Replaces raw server text with formatted action error messages." --> getActionErrorMessage_ AdminSyncStripe_ -- "Shows parsed safe-action error in Stripe sync failure toast." --> getActionErrorMessage_ AccountOptionsDropdown_ -- "Displays flattened validation/server errors when deleting account." --> getActionErrorMessage_ MultiAccountSection_ -- "Uses prefixed parsed action errors for clearer failure toasts." --> getActionErrorMessage_ classDef added stroke:#15AA7A classDef removed stroke:#CD5270 classDef modified stroke:#EDAC4C linkStyle default stroke:#CBD5E1,font-size:13pxIntroduces a standardized error message extraction utility,
getActionErrorMessage, fornext-safe-actionresults, refactoring error handling across numerous UI components. Updates the environment variableLOG_ZOD_ERRORStoDISABLE_LOG_ZOD_ERRORSto reflect an opt-out logging behavior for Zod validation errors, and makes theonSuccessprop required in theAboutSectioncomponent.LOG_ZOD_ERRORStoDISABLE_LOG_ZOD_ERRORSto better reflect its opt-out nature for Zod validation error logging, and updates theAboutSectioncomponent to require theonSuccessprop.Modified files (7)
Latest Contributors(2)
getActionErrorMessageutility function to standardize the extraction of user-friendly error messages fromnext-safe-actionresults, including server errors and flattened validation errors, and updates documentation and AI model error types.Modified files (25)
Latest Contributors(1)