Skip to content

fix: duplicate event created on attendee calendar due to wrong icalUid#23216

Merged
anikdhabal merged 2 commits intomainfrom
duplicate_calendar_event
Aug 20, 2025
Merged

fix: duplicate event created on attendee calendar due to wrong icalUid#23216
anikdhabal merged 2 commits intomainfrom
duplicate_calendar_event

Conversation

@anikdhabal
Copy link
Contributor

@anikdhabal anikdhabal commented Aug 20, 2025

What does this PR do?


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

@anikdhabal anikdhabal requested a review from a team as a code owner August 20, 2025 13:42
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 20, 2025

Walkthrough

The 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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch duplicate_calendar_event

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@graphite-app graphite-app bot requested a review from a team August 20, 2025 13:43
@keithwillcode keithwillcode added the core area: core, team members only label Aug 20, 2025
@vercel
Copy link

vercel bot commented Aug 20, 2025

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Aug 20, 2025 1:44pm
cal-eu Ignored Ignored Aug 20, 2025 1:44pm

@anikdhabal anikdhabal enabled auto-merge (squash) August 20, 2025 13:44
@dosubot dosubot bot added bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working labels Aug 20, 2025
@graphite-app
Copy link

graphite-app bot commented Aug 20, 2025

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.

@anikdhabal anikdhabal requested a review from volnei August 20, 2025 13:46
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: 0

🧹 Nitpick comments (2)
packages/features/bookings/lib/handleNewBooking.ts (2)

1926-1932: Also propagate iCalUID to RR scheduled/cancelled emails for UID consistency

To 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 UID

Recommend 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 48aa6bf and 2c631de.

📒 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 use include, always use select
Ensure the credential.key field 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 duplicates

Passing { ...copyEventAdditionalInfo, iCalUID } ensures the ICS sent to attendees keeps the original UID even when evt.iCalUID is intentionally cleared during organizer changes (Lines 1667–1668). This directly addresses the duplicate-event issue described in the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 20, 2025

E2E results are ready!

@anikdhabal anikdhabal merged commit e309e72 into main Aug 20, 2025
101 of 107 checks passed
@anikdhabal anikdhabal deleted the duplicate_calendar_event branch August 20, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working core area: core, team members only ready-for-e2e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants