Skip to content

Return early if detectBot in track/open#3460

Merged
steven-tey merged 4 commits intomainfrom
track-open-bot
Feb 12, 2026
Merged

Return early if detectBot in track/open#3460
steven-tey merged 4 commits intomainfrom
track-open-bot

Conversation

@steven-tey
Copy link
Collaborator

@steven-tey steven-tey commented Feb 12, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved open-tracking behavior so responses consistently include link information even when a click wasn’t recorded (e.g., bot-detected opens); clickId will be null in these cases.
  • Documentation

    • Clarified response schema to state when clickId may be null, including bot-detected opens and opens not associated with a deep link.

@vercel
Copy link
Contributor

vercel bot commented Feb 12, 2026

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

Project Deployment Actions Updated (UTC)
dub Ready Ready Preview Feb 12, 2026 5:59am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

Refactors the /track/open API response to use a reusable linkData object, captures recordClick result in clickData, and changes bot-detection handling to return clickId: null with link: linkData. Also updates schema documentation describing clickId null conditions.

Changes

Cohort / File(s) Summary
API Route Handler
apps/web/app/(ee)/api/track/open/route.ts
Introduce linkData object for final link fields; assign recordClick result to clickData instead of awaiting inline; on bot detection return clickId: null and link: linkData; add contextual comment about probabilistic IP-based tracking.
Schema Documentation
apps/web/lib/zod/schemas/opens.ts
Clarify trackOpenResponseSchema.clickId description: null can indicate absence of a deep link or that the open was by a bot (no click recorded).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • devkiran

Poem

🐰 I hopped through code with nimble paws,
Packing linkData neat because,
When bots arrive and clicks are nil,
I tuck the link in with a thrill,
Tidied routes — a rabbit's cause!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Return early if detectBot in track/open' accurately describes the main objective of the changes, which involve handling bot detection in the track/open API route and altering how responses are structured when bots are detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch track-open-bot

No actionable comments were generated in the recent review. 🎉


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

@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: 1

🤖 Fix all issues with AI agents
In `@apps/web/app/`(ee)/api/track/open/route.ts:
- Around line 145-150: The response object passed to
trackOpenResponseSchema.parse is double-nesting the link (currently using link:
{ link: linkData }); update the parse call in
apps/web/app/(ee)/api/track/open/route.ts so that it sets link: linkData (not an
extra { link: ... } wrapper) — locate the trackOpenResponseSchema.parse
invocation and replace the nested object with the direct linkData reference to
satisfy the schema.

@steven-tey steven-tey merged commit 003e2ad into main Feb 12, 2026
10 checks passed
@steven-tey steven-tey deleted the track-open-bot branch February 12, 2026 06:02
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