cold-email: Fix date parsing in Cold Email Blocker test action#1159
cold-email: Fix date parsing in Cold Email Blocker test action#1159
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR restructures UI layouts in email rule processing components with flex-based container adjustments and spacing refinements. The EmailMessageCell truncation behavior is enhanced, a new EmailRowExample component demonstrates row rendering, and date conversion in cold-email testing is updated to use a custom utility function instead of native Date construction. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
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 |
Fix cold-email test date parsing by using
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/web/utils/actions/cold-email.ts (1)
147-147: The date parsing fix correctly handles both Gmail and Outlook formats.The change from
new Date(date)tointernalDateToDate(String(date))properly addresses the issue with Gmail's numeric timestamps (milliseconds) and Outlook's ISO string dates. TheinternalDateToDateutility already handles both formats by attempting ISO string parsing first, then falling back to numeric timestamp parsing.However, consider applying the same utility function to other locations for consistency:
apps/web/app/api/user/stats/response-time/calculate.ts(lines 78, 87) still uses directnew Date(internalDate)callsapps/web/utils/ai/meeting-briefs/generate-briefing.ts(lines 211-214) has custom numeric timestamp detection logicThese should be refactored to use
internalDateToDateto maintain consistency across the codebase.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/app/(landing)/components/page.tsxapps/web/components/EmailMessageCell.tsxapps/web/utils/actions/cold-email.ts
🧰 Additional context used
📓 Path-based instructions (23)
**/*.{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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.ts
apps/web/components/**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/fullstack-workflow.mdc)
Use
LoadingContentcomponent to consistently handle loading and error states, passingloading,error, andchildrenpropsUse PascalCase for component file names (e.g.,
components/Button.tsx)
Files:
apps/web/components/EmailMessageCell.tsx
**/{pages,routes,components}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/gmail-api.mdc)
Never call Gmail API directly from routes or components - always use wrapper functions from the utils folder
Files:
apps/web/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.ts
**/*.{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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.ts
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/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
apps/web/**/*.{ts,tsx,js,jsx,json,css}
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Format code with Prettier
Files:
apps/web/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.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/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.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]/assistant/ProcessRules.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
apps/web/utils/actions/*.ts
📄 CodeRabbit inference engine (.cursor/rules/fullstack-workflow.mdc)
apps/web/utils/actions/*.ts: Usenext-safe-actionwith Zod schemas for all server actions (create/update/delete mutations), storing validation schemas inapps/web/utils/actions/*.validation.ts
Server actions should use 'use server' directive and automatically receive authentication context (emailAccountId) from theactionClient
apps/web/utils/actions/*.ts: Create corresponding server action implementation files using the naming conventionapps/web/utils/actions/NAME.tswith 'use server' directive
Use 'use server' directive at the top of server action implementation files
Implement all server actions using thenext-safe-actionlibrary with actionClient, actionClientUser, or adminActionClient for type safety and validation
UseactionClientUserwhen only authenticated user context (userId) is needed
UseactionClientwhen both authenticated user context and a specific emailAccountId are needed, with emailAccountId bound when calling from the client
UseadminActionClientfor actions restricted to admin users
Add metadata with a meaningful action name using.metadata({ name: "actionName" })for Sentry instrumentation and monitoring
Use.schema()method with Zod validation schemas from corresponding.validation.tsfiles in next-safe-action configuration
Access context (userId, emailAccountId, etc.) via thectxobject parameter in the.action()handler
UserevalidatePathorrevalidateTagfrom 'next/cache' within server action handlers when mutations modify data displayed elsewhere
Files:
apps/web/utils/actions/cold-email.ts
apps/web/utils/actions/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)
apps/web/utils/actions/**/*.ts: Server actions must be located inapps/web/utils/actionsfolder
Server action files must start withuse serverdirective
apps/web/utils/actions/**/*.ts: Use proper error handling with try/catch blocks
Usenext-safe-actionwith Zod schemas for server actions to handle mutations
UserevalidatePathin server actions for cache invalidation after mutations
Files:
apps/web/utils/actions/cold-email.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/utils/actions/cold-email.ts
**/{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/actions/cold-email.ts
apps/web/utils/actions/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/web/CLAUDE.md)
Infer types from Zod schemas using
z.infer<typeof schema>instead of duplicating as separate interfaces
Files:
apps/web/utils/actions/cold-email.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/utils/actions/cold-email.ts
🧠 Learnings (19)
📚 Learning: 2025-11-25T14:37:22.660Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/gmail-api.mdc:0-0
Timestamp: 2025-11-25T14:37:22.660Z
Learning: Applies to **/*.{ts,tsx} : Use wrapper functions for Gmail thread operations from @/utils/gmail/thread.ts instead of direct API calls
Applied to files:
apps/web/components/EmailMessageCell.tsxapps/web/app/(landing)/components/page.tsxapps/web/utils/actions/cold-email.ts
📚 Learning: 2025-11-25T14:37:22.660Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/gmail-api.mdc:0-0
Timestamp: 2025-11-25T14:37:22.660Z
Learning: Applies to **/*.{ts,tsx} : Use wrapper functions for Gmail message operations (get, list, batch, etc.) from @/utils/gmail/message.ts instead of direct API calls
Applied to files:
apps/web/components/EmailMessageCell.tsxapps/web/utils/actions/cold-email.ts
📚 Learning: 2025-07-17T04:19:57.099Z
Learnt from: edulelis
Repo: elie222/inbox-zero PR: 576
File: packages/resend/emails/digest.tsx:78-83
Timestamp: 2025-07-17T04:19:57.099Z
Learning: In packages/resend/emails/digest.tsx, the DigestEmailProps type uses `[key: string]: DigestItem[] | undefined | string | Date | undefined` instead of intersection types like `& Record<string, DigestItem[] | undefined>` due to implementation constraints. This was the initial implementation approach and cannot be changed to more restrictive typing.
Applied to files:
apps/web/components/EmailMessageCell.tsx
📚 Learning: 2025-11-25T14:38:56.992Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:56.992Z
Learning: Applies to apps/web/components/ui/**/*.tsx : Shadcn UI components are located in `components/ui` directory
Applied to files:
apps/web/app/(landing)/components/page.tsx
📚 Learning: 2025-11-25T14:38:23.265Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:23.265Z
Learning: Applies to apps/web/app/(app)/**/*.{ts,tsx} : Components for the page are either put in `page.tsx`, or in the `apps/web/app/(app)/PAGE_NAME` folder
Applied to files:
apps/web/app/(landing)/components/page.tsx
📚 Learning: 2025-11-25T14:37:22.660Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/gmail-api.mdc:0-0
Timestamp: 2025-11-25T14:37:22.660Z
Learning: Applies to apps/web/utils/gmail/**/*.{ts,tsx} : Keep Gmail provider-specific implementation details isolated within the apps/web/utils/gmail/ directory
Applied to files:
apps/web/app/(landing)/components/page.tsx
📚 Learning: 2025-11-25T14:40:00.833Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-11-25T14:40:00.833Z
Learning: Applies to **/*.test.{ts,tsx} : Use test helpers `getEmail`, `getEmailAccount`, and `getRule` from `@/__tests__/helpers` for mocking emails, accounts, and rules
Applied to files:
apps/web/app/(landing)/components/page.tsxapps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.ts
📚 Learning: 2025-11-25T14:38:18.874Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:18.874Z
Learning: Applies to apps/web/app/(app)/**/*.tsx : Components for pages are either put in `page.tsx`, or in the `apps/web/app/(app)/PAGE_NAME` folder
Applied to files:
apps/web/app/(landing)/components/page.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 shadcn/ui components when available
Applied to files:
apps/web/app/(landing)/components/page.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} : Use Shadcn UI and Tailwind for components and styling
Applied to files:
apps/web/app/(landing)/components/page.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} : Use Shadcn UI and Tailwind for components and styling
Applied to files:
apps/web/app/(landing)/components/page.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/(landing)/components/page.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/(landing)/components/page.tsx
📚 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 XML-like tags to structure data in prompts, remove excessive whitespace and truncate long inputs, and format data consistently across similar LLM functions
Applied to files:
apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
📚 Learning: 2025-11-25T14:37:56.430Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm-test.mdc:0-0
Timestamp: 2025-11-25T14:37:56.430Z
Learning: Applies to apps/web/__tests__/**/*.test.ts : Prefer using existing helpers from `@/__tests__/helpers.ts` (`getEmailAccount`, `getEmail`, `getRule`, `getMockMessage`, `getMockExecutedRule`) instead of creating custom test data helpers
Applied to files:
apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsxapps/web/utils/actions/cold-email.ts
📚 Learning: 2025-11-25T14:37:22.660Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/gmail-api.mdc:0-0
Timestamp: 2025-11-25T14:37:22.660Z
Learning: Applies to **/*.{ts,tsx} : Use wrapper functions for Gmail label operations from @/utils/gmail/label.ts instead of direct API calls
Applied to files:
apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.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} : Ensure responsive design with mobile-first approach in components
Applied to files:
apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
📚 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/utils/actions/cold-email.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/*.ts : Use `actionClient` when both authenticated user context and a specific emailAccountId are needed, with emailAccountId bound when calling from the client
Applied to files:
apps/web/utils/actions/cold-email.ts
🧬 Code graph analysis (4)
apps/web/components/EmailMessageCell.tsx (1)
apps/web/components/Typography.tsx (1)
MessageText(128-128)
apps/web/app/(landing)/components/page.tsx (1)
apps/web/components/Typography.tsx (1)
MessageText(128-128)
apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx (1)
apps/web/components/EmailMessageCell.tsx (1)
EmailMessageCell(21-132)
apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx (1)
apps/web/components/EmailMessageCell.tsx (1)
EmailMessageCell(21-132)
⏰ 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). (4)
- GitHub Check: Baz Reviewer
- GitHub Check: Macroscope - Correctness Check
- GitHub Check: test
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
apps/web/app/(landing)/components/page.tsx (1)
838-872: LGTM! Helpful visual demonstration of email row truncation behavior.The
EmailRowExamplecomponent effectively demonstrates the truncation improvements made toEmailMessageCell, particularly the handling of long sender names, subjects, and URLs. This serves as a useful visual reference for the text overflow behavior.apps/web/components/EmailMessageCell.tsx (1)
126-129: LGTM! Improved text overflow handling with truncation and line clamping.The styling updates effectively prevent layout issues from long content:
- Subject line now uses
truncatefor single-line ellipsis andfont-boldfor visual emphasis- Snippet uses
line-clamp-2to limit to 2 lines andbreak-allto handle long URLs without natural break pointsThese changes work well with the flex layout updates in consuming components.
apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx (1)
152-185: LGTM! Flex layout improvements enable proper text truncation.The restructured layout correctly handles content overflow:
min-w-0 flex-1on the left container allows the EmailMessageCell to truncate properly by permitting flex children to shrink below their content sizeshrink-0on the right ensures the action button maintains its fixed widthgap-4provides consistent spacing between sectionsThis pattern works well with the truncation styles in EmailMessageCell.
apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx (1)
359-404: LGTM! Consistent flex layout pattern with enhanced controls.The layout improvements mirror the changes in TestRules.tsx:
min-w-0 flex-1on the email cell container enables proper truncationshrink-0on the controls container maintains fixed-width buttonsgap-4provides consistent spacingThe addition of
FixWithChatcomponent enhances the user experience when results are available.
Changes SummaryFixes an error in Cold Email Blocker's test action where Gmail numeric timestamps were incorrectly parsed, causing failures. Also enhances email message display with text truncation for long sender names, subjects, and snippets to prevent table layout issues. Type: mixed Components Affected: Cold Email Blocker test action, Email message display cells, Process rules table, Test rules table, Landing page documentation Files Changed
Architecture Impact
Risk Areas: Date parsing behavior change - Must verify that internalDateToDate() correctly handles all Gmail timestamp formats that may be passed in the test action, CSS layout changes - Should verify truncation works correctly with different content lengths and screen sizes in both ProcessRules and TestRules pages Suggestions
Full review in progress... | Powered by diffray |
| <div className="ml-4 shrink-0"> | ||
| <Button | ||
| color="white" | ||
| loading={testing} |
There was a problem hiding this comment.
🟡 MEDIUM - Inconsistent null coalescing in TestRules.tsx
Agent: typescript
Category: quality
Description:
Lines 172-177 mix || null and || undefined interchangeably when passing parameters. textHtml uses || null but internalDate uses || undefined, creating type inconsistency.
Suggestion:
Standardize on one approach using ?? to preserve falsy values correctly: textHtml: message.textHtml ?? null, date: message.internalDate ?? undefined,
Confidence: 70%
Rule: ts_strict_null_checks
Review ID: 9c67e485-7baa-4aee-8a5d-c988494444ed
Rate it 👍 or 👎 to improve future reviews | Powered by diffray
| import type { EmailProvider } from "@/utils/email/types"; | ||
| import { getColdEmailRule } from "@/utils/cold-email/cold-email-rule"; |
There was a problem hiding this comment.
🟡 MEDIUM - JSDoc comment uncertainty contradicts actual schema
Agent: documentation
Category: docs
Description:
The comment in validation file (line 9) states uncertainty about why internalDate accepts both string and number types. The comment should be explanatory rather than uncertain.
Suggestion:
Update the comment to be definitive: '// internalDate can be a string (ISO date) or number (Unix timestamp) depending on the Gmail API response format'
Confidence: 75%
Rule: ts_jsdoc_description_mismatch
Review ID: 9c67e485-7baa-4aee-8a5d-c988494444ed
Rate it 👍 or 👎 to improve future reviews | Powered by diffray
| to: "", | ||
| subject, | ||
| content, |
There was a problem hiding this comment.
🟡 MEDIUM - Using || operator instead of ?? for null values
Agent: typescript
Category: quality
Description:
Lines 136-137 use || operator which treats empty strings as missing. For nullable string fields (textHtml, textPlain), this loses semantics defined in the schema.
Suggestion:
Use ?? (nullish coalescing) instead of ||: textHtml: textHtml ?? undefined, and textPlain: textPlain ?? undefined,
Confidence: 70%
Rule: ts_strict_null_checks
Review ID: 9c67e485-7baa-4aee-8a5d-c988494444ed
Rate it 👍 or 👎 to improve future reviews | Powered by diffray
| subject, | ||
| content, | ||
| date: date ? new Date(date) : undefined, | ||
| date: date ? internalDateToDate(String(date)) : undefined, |
There was a problem hiding this comment.
🟡 MEDIUM - Ternary condition treats valid zero as falsy
Agent: typescript
Category: bug
Description:
The expression 'date ? internalDateToDate(String(date)) : undefined' would treat date=0 (valid Unix timestamp for 1970-01-01) as falsy and return undefined instead.
Suggestion:
Use explicit nullish check: 'date !== null && date !== undefined ? internalDateToDate(String(date)) : undefined'
Confidence: 65%
Rule: ts_falsy_zero_in_ternary
Review ID: 9c67e485-7baa-4aee-8a5d-c988494444ed
Rate it 👍 or 👎 to improve future reviews | Powered by diffray
Review Summary
Validated 20 issues: 11 kept (critical bugs, quality issues, missing tests), 9 filtered (false positives, low value, incorrect claims) Issues Found: 11💬 See 4 individual line comment(s) for details. 📊 9 unique issue type(s) across 11 location(s) 📋 Full issue list (click to expand)🟠 HIGH - internalDateToDate function lacks test coverage (2 occurrences)Agent: testing Category: quality 📍 View all locations
Rule: 🟠 HIGH - Unhandled promise rejections in batch processingAgent: react Category: bug File: Description: handleRunAll async function has await setSize() and await mutate() calls at lines 181-182 that are not wrapped in try-catch. Only inner queue tasks have error handling. Suggestion: Wrap the entire function body in try-catch-finally: Confidence: 75% Rule: 🟡 MEDIUM - Inconsistent null coalescing in TestRules.tsx (2 occurrences)Agent: typescript Category: quality 📍 View all locations
Rule: 🟡 MEDIUM - Console statement in production codeAgent: accessibility Category: code-quality File: Description: console.error() is used directly in production code. The error is already handled with toastError, so the console statement provides limited value. Suggestion: Replace console.error() with a proper logging service (e.g., logger.error()) or remove since toastError already provides user feedback. Confidence: 85% Rule: 🟡 MEDIUM - JSDoc comment uncertainty contradicts actual schemaAgent: documentation Category: docs File: Description: The comment in validation file (line 9) states uncertainty about why internalDate accepts both string and number types. The comment should be explanatory rather than uncertain. Suggestion: Update the comment to be definitive: '// internalDate can be a string (ISO date) or number (Unix timestamp) depending on the Gmail API response format' Confidence: 75% Rule: 🟡 MEDIUM - Function type signature incomplete - doesn't match implAgent: documentation Category: quality File: Description: internalDateToDate signature declares only Suggestion: Update signature to Confidence: 80% Rule: 🟡 MEDIUM - Non-null assertion on potentially undefined valueAgent: typescript Category: bug File: Description: Using non-null assertion (!) on result.data at line 161 even though TypeScript should narrow the type from the conditional check. Suggestion: Remove the non-null assertion and rely on the type guard: Confidence: 80% Rule: 🟡 MEDIUM - Ternary condition treats valid zero as falsyAgent: typescript Category: bug File: Description: The expression 'date ? internalDateToDate(String(date)) : undefined' would treat date=0 (valid Unix timestamp for 1970-01-01) as falsy and return undefined instead. Suggestion: Use explicit nullish check: 'date !== null && date !== undefined ? internalDateToDate(String(date)) : undefined' Confidence: 65% Rule: 🟡 MEDIUM - Fixed width on responsive layout containerAgent: react Category: style File: Description: The Tabs component uses hardcoded w-[400px] which is not responsive and will cause layout issues on mobile devices. Suggestion: Replace 'w-[400px]' with 'w-full max-w-[400px]' or use responsive prefixes 'w-full md:w-[400px]' Confidence: 75% Rule: ℹ️ 7 issue(s) outside PR diff (click to expand)
🟠 HIGH - internalDateToDate function lacks test coverage (2 occurrences)Agent: testing Category: quality 📍 View all locations
Rule: 🟠 HIGH - Unhandled promise rejections in batch processingAgent: react Category: bug File: Description: handleRunAll async function has await setSize() and await mutate() calls at lines 181-182 that are not wrapped in try-catch. Only inner queue tasks have error handling. Suggestion: Wrap the entire function body in try-catch-finally: Confidence: 75% Rule: 🟡 MEDIUM - Console statement in production codeAgent: accessibility Category: code-quality File: Description: console.error() is used directly in production code. The error is already handled with toastError, so the console statement provides limited value. Suggestion: Replace console.error() with a proper logging service (e.g., logger.error()) or remove since toastError already provides user feedback. Confidence: 85% Rule: 🟡 MEDIUM - Function type signature incomplete - doesn't match implAgent: documentation Category: quality File: Description: internalDateToDate signature declares only Suggestion: Update signature to Confidence: 80% Rule: 🟡 MEDIUM - Non-null assertion on potentially undefined valueAgent: typescript Category: bug File: Description: Using non-null assertion (!) on result.data at line 161 even though TypeScript should narrow the type from the conditional check. Suggestion: Remove the non-null assertion and rely on the type guard: Confidence: 80% Rule: 🟡 MEDIUM - Fixed width on responsive layout containerAgent: react Category: style File: Description: The Tabs component uses hardcoded w-[400px] which is not responsive and will cause layout issues on mobile devices. Suggestion: Replace 'w-[400px]' with 'w-full max-w-[400px]' or use responsive prefixes 'w-full md:w-[400px]' Confidence: 75% Rule: Review ID: |
User description
Fixes an error when testing emails in the Cold Email Blocker for Gmail accounts caused by millisecond timestamps being incorrectly parsed.
new Date(date)tointernalDateToDate(String(date))to handle both Gmail numeric timestamps and Outlook ISO strings.Summary by CodeRabbit
Release Notes
New Features
Improvements
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.
Generated description
Below is a concise technical summary of the changes proposed in this PR:
graph LR Components_("Components"):::modified EmailRowExample_("EmailRowExample"):::added TABLE_COMPONENTS_("TABLE_COMPONENTS"):::added ProcessRulesRow_("ProcessRulesRow"):::modified EmailMessageCell_("EmailMessageCell"):::modified TestRulesContentRow_("TestRulesContentRow"):::modified markNotColdEmailAction_("markNotColdEmailAction"):::modified INTERNAL_DATE_TO_DATE_("INTERNAL_DATE_TO_DATE"):::added Components_ -- "Adds EmailRowExample rendering to showcase email row truncation." --> EmailRowExample_ EmailRowExample_ -- "Uses Table components to structure the truncation demo row." --> TABLE_COMPONENTS_ ProcessRulesRow_ -- "Passes messageId and labelIds; adds truncation-aware layout." --> EmailMessageCell_ TestRulesContentRow_ -- "Passes messageId and labelIds; uses truncation-friendly layout." --> EmailMessageCell_ markNotColdEmailAction_ -- "Replaces new Date with internalDateToDate for date conversion." --> INTERNAL_DATE_TO_DATE_ classDef added stroke:#15AA7A classDef removed stroke:#CD5270 classDef modified stroke:#EDAC4C linkStyle default stroke:#CBD5E1,font-size:13pxFixes an error in the Cold Email Blocker's test action by correctly parsing email dates using
internalDateToDate()to support both Gmail numeric timestamps and Outlook ISO strings. Enhances the display of email messages by implementing text truncation for long sender names, subjects, and snippets withinEmailMessageCellcomponents.EmailMessageCellcomponents, improving readability for long content.Modified files (4)
Latest Contributors(2)
new Date()withinternalDateToDate().Modified files (1)
Latest Contributors(2)