Skip to content

Comments

cold-email: Fix date parsing in Cold Email Blocker test action#1159

Merged
elie222 merged 2 commits intomainfrom
fix/cold-email-test-date
Jan 1, 2026
Merged

cold-email: Fix date parsing in Cold Email Blocker test action#1159
elie222 merged 2 commits intomainfrom
fix/cold-email-test-date

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Dec 31, 2025

User description

Fixes an error when testing emails in the Cold Email Blocker for Gmail accounts caused by millisecond timestamps being incorrectly parsed.

  • Switched from new Date(date) to internalDateToDate(String(date)) to handle both Gmail numeric timestamps and Outlook ISO strings.
  • Correctly parses dates before passing them to the Gmail API query.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added FixWithChat feature alongside results display in process rules.
  • Improvements

    • Improved text truncation for email sender names and subjects.
    • Enhanced spacing and alignment in email message rows.
    • Better line wrapping for long URLs and content snippets.
  • Documentation

    • Added new email row truncation examples page.

✏️ 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:13px
Loading

Fixes 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 within EmailMessageCell components.

TopicDetails
Email Display UI Enhances the visual presentation of email messages by applying text truncation and layout adjustments to EmailMessageCell components, improving readability for long content.
Modified files (4)
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/web/components/EmailMessageCell.tsx
Latest Contributors(2)
UserCommitDate
elie222bulk-run-rules-activit...December 19, 2025
mojkakec12345@gmail.comfix-all-commentsJuly 11, 2025
Fix Date Parsing Corrects date parsing in the Cold Email Blocker's test action to handle Gmail numeric timestamps and Outlook ISO strings by replacing new Date() with internalDateToDate().
Modified files (1)
  • apps/web/utils/actions/cold-email.ts
Latest Contributors(2)
UserCommitDate
elie222fix-up-imports-forNovember 22, 2025
eduardoleliss@gmail.comAdd-Outlook-Cold-Email...July 29, 2025
This pull request is reviewed by Baz. Review like a pro on (Baz).

@vercel
Copy link

vercel bot commented Dec 31, 2025

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

Project Deployment Review Updated (UTC)
inbox-zero Ready Ready Preview Dec 31, 2025 7:35pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 31, 2025

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
UI Layout Restructuring
apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx, apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
Refactored row layouts using flex-1 for EmailMessageCell and shrink-0 for action containers with gap-4 spacing. ProcessRules additionally integrates FixWithChat and rerun controls when results are present.
Email Message Cell Rendering
apps/web/components/EmailMessageCell.tsx
Applied truncate class to subject line and line-clamp-2 with break-all to snippet, altering text overflow behavior.
Landing Page Components
apps/web/app/(landing)/components/page.tsx
Added EmailRowExample component demonstrating email row truncation with table elements (TableBody, TableRow, TableCell imports), inserted new "Email Row Truncation" section in Components page.
Date Conversion Utility
apps/web/utils/actions/cold-email.ts
Updated testColdEmailAction to use internalDateToDate(String(date)) instead of new Date(date) for date field construction; added import from "@/utils/date".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • edulelis
  • anakarentorosserrano-star

Poem

🐰 With flex and gaps, the rows align,
EmailCells truncate just fine,
FixWithChat joins the rightmost space,
Date conversions find their place!
A layout dance both sleek and bright,

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly and specifically addresses the main technical change: fixing date parsing in the Cold Email Blocker test action.
✨ Finishing touches
  • 📝 Generate docstrings

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.

@macroscopeapp
Copy link
Contributor

macroscopeapp bot commented Dec 31, 2025

Fix cold-email test date parsing by using utils.actions.cold-email.internalDateToDate in utils.actions.cold-email.testColdEmailAction and adjust email row layouts to truncate content and prevent action controls from stretching

Switch new Date(date) to internalDateToDate(String(date)) in apps/web/utils/actions/cold-email.ts and update email row UI to apply truncation and non-shrinking action containers across rule processing and test views.

📍Where to Start

Start with utils.actions.cold-email.testColdEmailAction in apps/web/utils/actions/cold-email.ts.


📊 Macroscope summarized d2eb609. 5 files reviewed, 1 issue evaluated, 0 issues filtered, 1 comment posted. View details

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.

No issues found across 5 files

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) to internalDateToDate(String(date)) properly addresses the issue with Gmail's numeric timestamps (milliseconds) and Outlook's ISO string dates. The internalDateToDate utility 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 direct new Date(internalDate) calls
  • apps/web/utils/ai/meeting-briefs/generate-briefing.ts (lines 211-214) has custom numeric timestamp detection logic

These should be refactored to use internalDateToDate to maintain consistency across the codebase.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a0d4df and d2eb609.

📒 Files selected for processing (5)
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/components/EmailMessageCell.tsx
  • apps/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 the swr package
Use result?.serverError with toastError from @/components/Toast for 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 convention use[FeatureName]Enabled that return a boolean from useFeatureFlagEnabled("flag-key")
For A/B test variant flags, create hooks using the naming convention use[FeatureName]Variant that define variant types, use useFeatureFlagVariantKey() 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
Use as const instead of literal types and type annotations
Use either T[] or Array<T> consistently
Initialize each enum member value explicitly
Use export type for types
Use `impo...

Files:

  • apps/web/components/EmailMessageCell.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/web/utils/actions/cold-email.ts
apps/web/components/**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/fullstack-workflow.mdc)

Use LoadingContent component to consistently handle loading and error states, passing loading, error, and children props

Use 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.tsx
  • apps/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/enums instead of @/generated/prisma/client to avoid Next.js bundling errors in client components

Import Prisma using the project's centralized utility: import prisma from '@/utils/prisma'

Files:

  • apps/web/components/EmailMessageCell.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/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.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/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
Use next/image package for images
For API GET requests to server, use the swr package with hooks like useSWR to fetch data
For text inputs, use the Input component with registerProps for form integration and error handling

Files:

  • apps/web/components/EmailMessageCell.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/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.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/web/utils/actions/cold-email.ts
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)

**/*.tsx: Use the LoadingContent component to handle loading states instead of manual loading state management
For text areas, use the Input component with type='text', autosizeTextarea prop set to true, and registerProps for form integration

Files:

  • apps/web/components/EmailMessageCell.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/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 use accessKey attribute on any HTML element
Don't set aria-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 the scope prop 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 assign tabIndex to non-interactive HTML elements
Don't use positive integers for tabIndex property
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 a title element 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
Assign tabIndex to non-interactive HTML elements with aria-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 a type attribute for button elements
Make elements with interactive roles and handlers focusable
Give heading elements content that's accessible to screen readers (not hidden with aria-hidden)
Always include a lang attribute on the html element
Always include a title attribute for iframe elements
Accompany onClick with at least one of: onKeyUp, onKeyDown, or onKeyPress
Accompany onMouseOver/onMouseOut with onFocus/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.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/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 both children and dangerouslySetInnerHTML props 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 use target="_blank" without rel="noopener"
Don't use <img> elements in Next.js projects
Don't use <head> elements in Next.js projects

Files:

  • apps/web/components/EmailMessageCell.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/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.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/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.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/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.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/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
Use result?.serverError with toastError and toastSuccess for error handling in forms

Files:

  • apps/web/components/EmailMessageCell.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/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.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/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.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/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 in page.tsx, or in the apps/web/app/(app)/PAGE_NAME folder
If we're in a deeply nested component we will use swr to fetch via API
If you need to use onClick in a component, that component is a client component and file must start with use client

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
  • apps/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: 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
Server actions should use 'use server' directive and automatically receive authentication context (emailAccountId) from the actionClient

apps/web/utils/actions/*.ts: Create corresponding server action implementation files using the naming convention apps/web/utils/actions/NAME.ts with 'use server' directive
Use 'use server' directive at the top of server action implementation files
Implement all server actions using the next-safe-action library with actionClient, actionClientUser, or adminActionClient for type safety and validation
Use actionClientUser when only authenticated user context (userId) is needed
Use actionClient when both authenticated user context and a specific emailAccountId are needed, with emailAccountId bound when calling from the client
Use adminActionClient for 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.ts files in next-safe-action configuration
Access context (userId, emailAccountId, etc.) via the ctx object parameter in the .action() handler
Use revalidatePath or revalidateTag from '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 in apps/web/utils/actions folder
Server action files must start with use server directive

apps/web/utils/actions/**/*.ts: Use proper error handling with try/catch blocks
Use next-safe-action with Zod schemas for server actions to handle mutations
Use revalidatePath in 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's select option. 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. All findUnique/findFirst calls 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
All findMany queries 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, and turbo.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.tsx
  • apps/web/app/(landing)/components/page.tsx
  • apps/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.tsx
  • apps/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.tsx
  • apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx
  • apps/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.tsx
  • apps/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 EmailRowExample component effectively demonstrates the truncation improvements made to EmailMessageCell, 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 truncate for single-line ellipsis and font-bold for visual emphasis
  • Snippet uses line-clamp-2 to limit to 2 lines and break-all to handle long URLs without natural break points

These 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-1 on the left container allows the EmailMessageCell to truncate properly by permitting flex children to shrink below their content size
  • shrink-0 on the right ensures the action button maintains its fixed width
  • gap-4 provides consistent spacing between sections

This 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-1 on the email cell container enables proper truncation
  • shrink-0 on the controls container maintains fixed-width buttons
  • gap-4 provides consistent spacing

The addition of FixWithChat component enhances the user experience when results are available.

@diffray-bot
Copy link

Changes Summary

Fixes 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
File Summary Change Impact
apps/web/utils/actions/cold-email.ts Fixed date parsing by switching from new Date() to internalDateToDate() to handle Gmail numeric timestamps and Outlook ISO strings. ✏️ 🔴
apps/web/components/EmailMessageCell.tsx Added truncate and line-clamp CSS classes to subject and snippet text to prevent horizontal table expansion. ✏️ 🟡
...pp)/[emailAccountId]/assistant/ProcessRules.tsx Enhanced flexbox layout with min-w-0 flex-1 wrapper and shrink-0 for proper text truncation behavior. ✏️ 🟡
...mailAccountId]/cold-email-blocker/TestRules.tsx Enhanced flexbox layout with min-w-0 flex-1 wrapper and shrink-0 for proper text truncation behavior. ✏️ 🟡
apps/web/app/(landing)/components/page.tsx Added EmailRowExample component to demonstrate email row truncation pattern in documentation. ✏️ 🟢
Architecture Impact
  • New Patterns: Flexbox truncation pattern with min-w-0 and flex-1 for text overflow handling, Utility function reuse for date parsing across different contexts
  • Dependencies: Added import: internalDateToDate from @/utils/date in cold-email.ts
  • Coupling: Increased reuse of internalDateToDate utility function, reducing code duplication for date parsing across different email providers.

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
  • Verify that the String() conversion in internalDateToDate(String(date)) correctly handles all input types (string, number, null, undefined)
  • Test the date parsing fix with actual Gmail accounts to ensure millisecond timestamps are correctly interpreted
  • Confirm that the flexbox truncation pattern doesn't cause issues with badge labels or action buttons in narrow viewports

Full review in progress... | Powered by diffray

<div className="ml-4 shrink-0">
<Button
color="white"
loading={testing}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment on lines 14 to 15
import type { EmailProvider } from "@/utils/email/types";
import { getColdEmailRule } from "@/utils/cold-email/cold-email-rule";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment on lines 144 to 146
to: "",
subject,
content,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

@diffray-bot
Copy link

Review Summary

Free public review - Want AI code reviews on your PRs? Check out diffray.ai

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
File Description Suggestion Confidence
apps/web/utils/date.ts:62-74 The internalDateToDate function has multiple code paths (null, ISO strings, numeric timestamps) but ... Add a test suite covering: null/undefined inputs, ISO date strings, numeric timestamps, invalid date... 85%
apps/web/utils/actions/cold-email.ts:98-159 The testColdEmailAction server action has no corresponding unit test file. No cold-email.test.ts fil... Create apps/web/utils/actions/tests/cold-email.test.ts with tests covering date parameter handli... 80%

Rule: test_new_parameter_coverage


🟠 HIGH - Unhandled promise rejections in batch processing

Agent: react

Category: bug

File: apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx:168-223

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: try { handleStart(); ... } catch (error) { toastError({...}); } finally { handleStop(); }

Confidence: 75%

Rule: ts_handle_async_operations_with_proper_erro


🟡 MEDIUM - Inconsistent null coalescing in TestRules.tsx (2 occurrences)

Agent: typescript

Category: quality

📍 View all locations
File Description Suggestion Confidence
apps/web/app/(app)/[emailAccountId]/cold-email-blocker/TestRules.tsx:167 Lines 172-177 mix || null and || undefined interchangeably when passing parameters. textHtml use... Standardize on one approach using ?? to preserve falsy values correctly: `textHtml: message.textHtml... 70%
apps/web/utils/actions/cold-email.ts:144-146 Lines 136-137 use || operator which treats empty strings as missing. For nullable string fields (t... Use ?? (nullish coalescing) instead of ||: textHtml: textHtml ?? undefined, and `textPlain: text... 70%

Rule: ts_strict_null_checks


🟡 MEDIUM - Console statement in production code

Agent: accessibility

Category: code-quality

File: apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx:205

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: fe_console_in_production


🟡 MEDIUM - JSDoc comment uncertainty contradicts actual schema

Agent: documentation

Category: docs

File: apps/web/utils/actions/cold-email.ts:14-15

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


🟡 MEDIUM - Function type signature incomplete - doesn't match impl

Agent: documentation

Category: quality

File: apps/web/utils/date.ts:62-74

Description: internalDateToDate signature declares only string | null but implementation handles numeric values at line 70 with new Date(+internalDate). The validation schema allows both string and number.

Suggestion: Update signature to export function internalDateToDate(internalDate?: string | number | null): Date { to match actual behavior.

Confidence: 80%

Rule: ts_jsdoc_param_mismatch


🟡 MEDIUM - Non-null assertion on potentially undefined value

Agent: typescript

Category: bug

File: apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx:161

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: setResultsMap((prev) => ({ ...prev, [message.id]: result.data }));

Confidence: 80%

Rule: ts_non_null_assertion


🟡 MEDIUM - Ternary condition treats valid zero as falsy

Agent: typescript

Category: bug

File: apps/web/utils/actions/cold-email.ts:147

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


🟡 MEDIUM - Fixed width on responsive layout container

Agent: react

Category: style

File: apps/web/app/(landing)/components/page.tsx:139

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: ts_prefer_responsive_over_fixed_dimensions


ℹ️ 7 issue(s) outside PR diff (click to expand)

These issues were found in lines not modified in this PR.

🟠 HIGH - internalDateToDate function lacks test coverage (2 occurrences)

Agent: testing

Category: quality

📍 View all locations
File Description Suggestion Confidence
apps/web/utils/date.ts:62-74 The internalDateToDate function has multiple code paths (null, ISO strings, numeric timestamps) but ... Add a test suite covering: null/undefined inputs, ISO date strings, numeric timestamps, invalid date... 85%
apps/web/utils/actions/cold-email.ts:98-159 The testColdEmailAction server action has no corresponding unit test file. No cold-email.test.ts fil... Create apps/web/utils/actions/tests/cold-email.test.ts with tests covering date parameter handli... 80%

Rule: test_new_parameter_coverage


🟠 HIGH - Unhandled promise rejections in batch processing

Agent: react

Category: bug

File: apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx:168-223

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: try { handleStart(); ... } catch (error) { toastError({...}); } finally { handleStop(); }

Confidence: 75%

Rule: ts_handle_async_operations_with_proper_erro


🟡 MEDIUM - Console statement in production code

Agent: accessibility

Category: code-quality

File: apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx:205

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: fe_console_in_production


🟡 MEDIUM - Function type signature incomplete - doesn't match impl

Agent: documentation

Category: quality

File: apps/web/utils/date.ts:62-74

Description: internalDateToDate signature declares only string | null but implementation handles numeric values at line 70 with new Date(+internalDate). The validation schema allows both string and number.

Suggestion: Update signature to export function internalDateToDate(internalDate?: string | number | null): Date { to match actual behavior.

Confidence: 80%

Rule: ts_jsdoc_param_mismatch


🟡 MEDIUM - Non-null assertion on potentially undefined value

Agent: typescript

Category: bug

File: apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx:161

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: setResultsMap((prev) => ({ ...prev, [message.id]: result.data }));

Confidence: 80%

Rule: ts_non_null_assertion


🟡 MEDIUM - Fixed width on responsive layout container

Agent: react

Category: style

File: apps/web/app/(landing)/components/page.tsx:139

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: ts_prefer_responsive_over_fixed_dimensions



Review ID: 9c67e485-7baa-4aee-8a5d-c988494444ed
Rate it 👍 or 👎 to improve future reviews | Powered by diffray

@elie222 elie222 merged commit c6db5c2 into main Jan 1, 2026
30 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