Skip to content

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Nov 10, 2025

No description provided.

@vercel
Copy link

vercel bot commented Nov 10, 2025

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

Project Deployment Preview Updated (UTC)
inbox-zero Ready Ready Preview Nov 10, 2025 9:54am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 10, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • main
  • staging

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/response-time-analytics

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.

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.

3 issues found across 1 file

Prompt for AI agents (all 3 issues)

Understand the root cause of the following 3 issues and fix them.


<file name="apps/web/app/api/user/stats/response-time/route.ts">

<violation number="1" location="apps/web/app/api/user/stats/response-time/route.ts:106">
The received filter compares against the recipient address, so the customer&#39;s reply is excluded and your own outbound message is treated as inbound; switch to the sender address so we keep actual customer responses.</violation>

<violation number="2" location="apps/web/app/api/user/stats/response-time/route.ts:118">
This filter also checks against the recipient address, so inbound replies are treated as your own outbound messages; use the sender address to capture actual user-sent mail.</violation>

<violation number="3" location="apps/web/app/api/user/stats/response-time/route.ts:255">
Guard the previous-period recursion when `differenceInDays` returns 0 (same-day range); otherwise this calls itself with identical parameters and recurses forever.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

const previousFromDate = subDays(new Date(fromDate), currentPeriodDays);
const previousToDate = new Date(fromDate);

const previousPeriodStats = await getResponseTimeStats({
Copy link
Contributor

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

Choose a reason for hiding this comment

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

Guard the previous-period recursion when differenceInDays returns 0 (same-day range); otherwise this calls itself with identical parameters and recurses forever.

Prompt for AI agents
Address the following comment on apps/web/app/api/user/stats/response-time/route.ts at line 255:

<comment>Guard the previous-period recursion when `differenceInDays` returns 0 (same-day range); otherwise this calls itself with identical parameters and recurses forever.</comment>

<file context>
@@ -0,0 +1,309 @@
+    const previousFromDate = subDays(new Date(fromDate), currentPeriodDays);
+    const previousToDate = new Date(fromDate);
+
+    const previousPeriodStats = await getResponseTimeStats({
+      fromDate: previousFromDate.getTime(),
+      toDate: previousToDate.getTime(),
</file context>
Fix with Cubic

.filter(
(m) =>
m.internalDate &&
m.headers.from?.includes(sentMsg.headers.to || ""),
Copy link
Contributor

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

Choose a reason for hiding this comment

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

This filter also checks against the recipient address, so inbound replies are treated as your own outbound messages; use the sender address to capture actual user-sent mail.

Prompt for AI agents
Address the following comment on apps/web/app/api/user/stats/response-time/route.ts at line 118:

<comment>This filter also checks against the recipient address, so inbound replies are treated as your own outbound messages; use the sender address to capture actual user-sent mail.</comment>

<file context>
@@ -0,0 +1,309 @@
+        .filter(
+          (m) =&gt;
+            m.internalDate &amp;&amp;
+            m.headers.from?.includes(sentMsg.headers.to || &quot;&quot;),
+        )
+        .sort(
</file context>
Fix with Cubic

.filter(
(m) =>
m.internalDate &&
!m.headers.from?.includes(sentMsg.headers.to || ""),
Copy link
Contributor

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

Choose a reason for hiding this comment

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

The received filter compares against the recipient address, so the customer's reply is excluded and your own outbound message is treated as inbound; switch to the sender address so we keep actual customer responses.

Prompt for AI agents
Address the following comment on apps/web/app/api/user/stats/response-time/route.ts at line 106:

<comment>The received filter compares against the recipient address, so the customer&#39;s reply is excluded and your own outbound message is treated as inbound; switch to the sender address so we keep actual customer responses.</comment>

<file context>
@@ -0,0 +1,309 @@
+        .filter(
+          (m) =&gt;
+            m.internalDate &amp;&amp;
+            !m.headers.from?.includes(sentMsg.headers.to || &quot;&quot;),
+        )
+        .sort(
</file context>
Fix with Cubic

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