fix: duplicate event created on attendee calendar due to wrong icalUid#23216
fix: duplicate event created on attendee calendar due to wrong icalUid#23216anikdhabal merged 2 commits intomainfrom
Conversation
WalkthroughThe change updates packages/features/bookings/lib/handleNewBooking.ts. In the Round Robin reschedule emails branch, the call to sendRoundRobinRescheduledEmailsAndSMS now spreads copyEventAdditionalInfo and adds iCalUID: { ...copyEventAdditionalInfo, iCalUID }. This augments the reschedule email/SMS payload with the iCalUID. No other logic or control flow modifications are made, and no exported/public signatures are altered. Possibly related PRs
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (08/20/25)1 reviewer was added to this PR based on Keith Williams's automation. "Add ready-for-e2e label" took an action on this PR • (08/20/25)1 label was added to this PR based on Keith Williams's automation. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/features/bookings/lib/handleNewBooking.ts (2)
1926-1932: Also propagate iCalUID to RR scheduled/cancelled emails for UID consistencyTo avoid any UID drift across all ICS messages in the same RR reschedule flow (particularly the CANCEL sent to the previous host), mirror the iCalUID override in the other two calls. Low risk, improves consistency.
Apply:
- sendRoundRobinScheduledEmailsAndSMS({ - calEvent: copyEventAdditionalInfo, + sendRoundRobinScheduledEmailsAndSMS({ + calEvent: { ...copyEventAdditionalInfo, iCalUID }, members: newBookedMembers, eventTypeMetadata: eventType.metadata, }); - sendRoundRobinCancelledEmailsAndSMS(cancelledRRHostEvt, cancelledMembers, eventType.metadata); + sendRoundRobinCancelledEmailsAndSMS( + { ...cancelledRRHostEvt, iCalUID }, + cancelledMembers, + eventType.metadata + );
1919-1933: Add a regression test for RR organizer-change reschedule preserving UIDRecommend a test that:
- Creates a RR booking, then reschedules with a different organizer.
- Asserts that the attendee-facing ICS UID in the reschedule email matches the original booking’s iCalUID (no duplicate on attendee calendars).
I can draft this test or open a tracking issue if preferred.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/features/bookings/lib/handleNewBooking.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts
📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)
**/*.ts: For Prisma queries, only select data you need; never useinclude, always useselect
Ensure thecredential.keyfield is never returned from tRPC endpoints or APIs
Files:
packages/features/bookings/lib/handleNewBooking.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)
Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js
.utc()in hot paths like loops
Files:
packages/features/bookings/lib/handleNewBooking.ts
🧠 Learnings (1)
📚 Learning: 2025-08-08T09:29:11.681Z
Learnt from: Udit-takkar
PR: calcom/cal.com#22919
File: packages/features/calAIPhone/interfaces/AIPhoneService.interface.ts:118-143
Timestamp: 2025-08-08T09:29:11.681Z
Learning: In calcom/cal.com PR #22919, packages/features/calAIPhone/interfaces/AIPhoneService.interface.ts (TypeScript), the AIPhoneServiceAgentListItem is required to include user.email in listAgents responses (per maintainer Udit-takkar). Future reviews should not flag this as unnecessary PII unless requirements change.
Applied to files:
packages/features/bookings/lib/handleNewBooking.ts
⏰ 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). (3)
- GitHub Check: Linters / lint
- GitHub Check: Tests / Unit
- GitHub Check: Type check / check-types
🔇 Additional comments (1)
packages/features/bookings/lib/handleNewBooking.ts (1)
1921-1925: Good fix: preserving iCalUID in RR reschedule emails prevents attendee duplicatesPassing
{ ...copyEventAdditionalInfo, iCalUID }ensures the ICS sent to attendees keeps the original UID even whenevt.iCalUIDis intentionally cleared during organizer changes (Lines 1667–1668). This directly addresses the duplicate-event issue described in the PR.
E2E results are ready! |
What does this PR do?
cal.com/packages/features/bookings/lib/handleNewBooking.ts
Line 1667 in e6959f3
Here, due to setting icalUid to undefined at the time of changing the organizer, a duplicate event gets created in the attendee’s calendar. This happens because a new icalUid is generated (bookingUid) instead of keeping the original one