Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions apps/web/app/(app)/[emailAccountId]/assistant/ProcessRules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,19 @@ function ProcessRulesRow({
}
>
<TableCell>
<div className="flex items-center justify-between">
<EmailMessageCell
sender={message.headers.from}
subject={message.headers.subject}
snippet={message.snippet}
userEmail={userEmail}
threadId={message.threadId}
messageId={message.id}
labelIds={message.labelIds}
/>
<div className="ml-4 flex items-center gap-1">
<div className="flex items-center justify-between gap-4">
<div className="min-w-0 flex-1">
<EmailMessageCell
sender={message.headers.from}
subject={message.headers.subject}
snippet={message.snippet}
userEmail={userEmail}
threadId={message.threadId}
messageId={message.id}
labelIds={message.labelIds}
/>
</div>
<div className="ml-4 flex shrink-0 items-center gap-1">
{results ? (
<>
<ResultsDisplay results={results} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,19 @@ function TestRulesContentRow({
}
>
<TableCell>
<div className="flex items-center justify-between">
<EmailMessageCell
sender={message.headers.from}
subject={message.headers.subject}
snippet={message.snippet}
userEmail={userEmail}
threadId={message.threadId}
messageId={message.id}
labelIds={message.labelIds}
/>
<div className="ml-4">
<div className="flex items-center justify-between gap-4">
<div className="min-w-0 flex-1">
<EmailMessageCell
sender={message.headers.from}
subject={message.headers.subject}
snippet={message.snippet}
userEmail={userEmail}
threadId={message.threadId}
messageId={message.id}
labelIds={message.labelIds}
/>
</div>
<div className="ml-4 shrink-0">
<Button
color="white"
loading={testing}
Copy link
Copy Markdown

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

Expand Down
44 changes: 44 additions & 0 deletions apps/web/app/(landing)/components/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Button } from "@/components/Button";
import { Button as ShadButton } from "@/components/ui/button";
import { Badge } from "@/components/Badge";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Table, TableBody, TableRow, TableCell } from "@/components/ui/table";
import { AlertBasic } from "@/components/Alert";
import { Notice } from "@/components/Notice";
import { TestErrorButton } from "@/app/(landing)/components/TestError";
Expand Down Expand Up @@ -749,6 +750,13 @@ export default function Components() {
</div>
</div>

<div>
<div className="underline">Email Row Truncation</div>
<div className="mt-4">
<EmailRowExample />
</div>
</div>
Comment thread
elie222 marked this conversation as resolved.

<div className="flex gap-2">
<TestErrorButton />
<TestActionButton />
Expand Down Expand Up @@ -826,3 +834,39 @@ function getActivityLogEntries(): ActivityLogEntry[] {
},
];
}

function EmailRowExample() {
return (
<div className="border rounded-md overflow-hidden">
<Table>
<TableBody>
<TableRow>
<TableCell>
<div className="flex items-center justify-between gap-4">
<div className="min-w-0 flex-1">
<MessageText className="flex items-center">
<span className="max-w-[300px] truncate">
Extremely Long Sender Name That Should Definitely Be
Truncated
</span>
</MessageText>
<MessageText className="mt-1 truncate font-bold">
This is an extremely long subject line that used to cause
the table to grow horizontally
</MessageText>
<MessageText className="mt-1 line-clamp-2 break-all">
This snippet contains a very long URL that does not break:
https://www.this-is-a-very-long-url-that-goes-on-and-on-and-on-and-on-and-on-and-on-and-on-and-on-and-on-and-on.com/test
</MessageText>
</div>
<div className="ml-4 shrink-0">
<ShadButton size="sm">Test</ShadButton>
</div>
</div>
</TableCell>
</TableRow>
</TableBody>
</Table>
</div>
);
}
4 changes: 2 additions & 2 deletions apps/web/components/EmailMessageCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export function EmailMessageCell({
</span>
)}
</MessageText>
<MessageText className="mt-1 font-bold">{subject}</MessageText>
<MessageText className="mt-1">
<MessageText className="mt-1 truncate font-bold">{subject}</MessageText>
<MessageText className="mt-1 line-clamp-2 break-all">
{snippetRemoveReply(decodeSnippet(snippet)).trim()}
</MessageText>
</div>
Expand Down
3 changes: 2 additions & 1 deletion apps/web/utils/actions/cold-email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { createEmailProvider } from "@/utils/email/provider";
import type { EmailProvider } from "@/utils/email/types";
import { getColdEmailRule } from "@/utils/cold-email/cold-email-rule";
Comment on lines 14 to 15
Copy link
Copy Markdown

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

import { getRuleLabel } from "@/utils/rule/consts";
import { internalDateToDate } from "@/utils/date";

export const markNotColdEmailAction = actionClient
.metadata({ name: "markNotColdEmail" })
Expand Down Expand Up @@ -143,7 +144,7 @@ export const testColdEmailAction = actionClient
to: "",
subject,
content,
Comment on lines 144 to 146
Copy link
Copy Markdown

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

date: date ? new Date(date) : undefined,
date: date ? internalDateToDate(String(date)) : undefined,
Copy link
Copy Markdown

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

threadId: threadId || undefined,
id: messageId || "",
},
Expand Down
Loading