Duplicate link conversions on concurrent track/sale requests - #4076
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesFirst-conversion claim deduplication
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/lib/api/conversions/track-sale.ts`:
- Around line 507-516: The first-conversion Redis claim in track-sale should not
expire before the sale is fully durable, because customer.sales is updated later
in the waitUntil pipeline. Update the claim logic around
claimedFirstConversion/redis.set so the key either uses a TTL that safely covers
the entire async sale workflow or is replaced with a more durable claim tied to
the customer/link state, ensuring link.conversions cannot be incremented twice
if the background tasks are delayed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6b7cb0f6-6166-402b-9a7c-2b1353ff04c9
📒 Files selected for processing (1)
apps/web/lib/api/conversions/track-sale.ts
…c/dub into track-sale-conversion-race
|
@coderabbitai full review please |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/web/lib/api/conversions/track-sale.ts`:
- Around line 509-519: The Redis claim in track-sale’s firstConversionFlag path
can throw or time out and currently prevents the sale ingestion flow from
reaching the waitUntil persistence logic. Update the claim handling around
redis.set in track-sale to use try/catch, keep firstConversionFlag false when
the claim check fails, and log the error so dedup failures do not block
recording the sale.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5a26f424-1951-4c33-bc4c-2466e84f0faa
📒 Files selected for processing (1)
apps/web/lib/api/conversions/track-sale.ts
|
@coderabbitai final review |
|
✅ Action performedFull review finished. |
Summary by CodeRabbit