Claude Opus 5.5 · Balanced

fix-handle-collective-multiple-host-on-destinationcalendar-cal-com

cal.com · TypeScript · S · 30–99 lines · 6 files

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

Gold bugs found
6 of 9
Comments published
6
Comments matching a bug
6
Comments not matching
0
Cost of this PR
$0.961

Published comments (6)

highbugpackages/core/EventManager.ts:118-119

TypeError on Google Meet bookings with no destination calendar — Every Google Meet booking without a destination calendar crashes, because `mainHostDestinationCalendar` is undefined when `evt.destinationCalendar` is null or empty. Use optional chaining with `mainHostDestinationCalendar?.integration`.

highbugpackages/features/bookings/lib/handleNewBooking.ts:1063-1079

Collective hosts' destination calendars dropped when organizer has none — When neither the event type nor `organizerUser` has a destination calendar, `destinationCalendar` is `null`, so `evt.destinationCalendar?.push(...teamDestinationCalendars)` silently does nothing. Default to `[]`, or assign `teamDestinationCalendars` when the array is missing.

highbugpackages/trpc/server/routers/viewer/organizations/create.handler.ts:151-153

Org `slug` condition inverted: set only when team billing is enabled — This reverses the previous behavior: with billing on, the org gets its final `slug` before payment, and with billing off, it gets none. Restore the `!IS_TEAM_BILLING_ENABLED` check for `slug` and keep `requestedSlug` only when billing is enabled.

highbugpackages/core/EventManager.ts:169-170

Video booking references lose their credentialId — Use `result.credentialId` for both calendar and non-calendar results.

highbugpackages/app-store/googlecalendar/lib/CalendarService.ts:254-256

Update fallback compares externalId to a falsy id, so calendarId is always undefined — This branch runs only when `externalCalendarId` is falsy, so the `find` never matches, updates get no `calendarId`, and the old destination-calendar fallback is lost. Fall back to the destination calendar's `externalId` (first entry or the one matching this credential), then `primary`. **Also found in:** - `packages/app-store/googlecalendar/lib/CalendarService.ts:315-317`

mediumbugpackages/features/bookings/lib/handleCancelBooking.ts:444-468

Recurring calendar deletes repeat for every calendar reference — Because the block ignores the current `reference`, it deletes every remaining booking's event across all `_calendar` credentials once per reference. This repeats API calls and still uses only each booking's first `_calendar` reference.

Gold bugs found (6)

highWhen externalCalendarId is absent, updateEvent/deleteEvent look for a destination calendar whose externalId equals that absent value, so the lookup never matches and the configured destination calendar is no longer used.
highThe organization slug is now set only when team billing is enabled (inverted condition), so with billing both slug and requestedSlug are set and without billing neither is.
highThe Google Meet fallback reads mainHostDestinationCalendar.integration without optional chaining, so a Meet booking with a null or empty destinationCalendar throws instead of falling back to Cal Video.
highFor collective events whose organizer has no destination calendar, destinationCalendar is null and the optional push drops all other hosts' destination calendars, so those hosts never get calendar events.
highVideo booking references are now saved without their credentialId, so cancelling the booking can no longer find the video credential and the meeting is not deleted.
highCancelling all remaining occurrences of a recurring collective booking deletes only the first calendar reference of each booking, repeated once per host, so the other hosts' events stay on their calendars.

Gold bugs missed (3)

highOffice365 (and Lark) createEvent ignore the new credentialId argument and always use the first destination calendar, so in collective bookings other hosts' credentials target the organizer's calendar instead of their own.
mediumIn Google createEvent, when no destination calendar matches the credentialId, the hangout-link events.patch is called with an undefined calendarId and fails, so the Meet link is not added to the event description.
mediumWhen cancelling a recurring booking with multiple calendar references, the recurring-event deletion over all remaining bookings and credentials runs once per reference, causing duplicate delete calls and errors.