Claude Sonnet 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
7
Comments matching a bug
6
Comments not matching
1
Cost of this PR
$1.089

Published comments (7)

highbugpackages/core/EventManager.ts:118-119

TypeError on Google Meet booking when destinationCalendar is empty — Any Google Meet booking without a destination calendar crashes in `EventManager.create`, because `mainHostDestinationCalendar` is undefined. Use `mainHostDestinationCalendar?.integration` so the check fails safely.

highbugpackages/app-store/office365calendar/lib/CalendarService.ts:72-77

Office365 createEvent uses first host's destination calendar for every credential — `EventManager` calls `createEvent` once per destination credential, yet it always uses `destinationCalendar[0]`. Other hosts' credentials then write to the wrong calendar, causing errors or duplicates.

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

Collective hosts' destination calendars dropped when destinationCalendar is null — Assign the combined, de-duplicated array instead of pushing.

mediumbugpackages/app-store/googlecalendar/lib/CalendarService.ts:147-157

Meet link patch uses undefined calendarId when no destination calendar matches — Compute `selectedCalendar` with the `"primary"` fallback once and use it in both the insert and the patch.

mediumbugpackages/core/EventManager.ts:205-210

updateLocation loses externalCalendarId because updateEvent returns no externalId — `CalendarManager.updateEvent` never returns `externalId`, so `result.externalId` is undefined and references created after a location edit lose `externalCalendarId`, breaking later updates and deletes. Return `externalId` from `updateEvent`, or reuse the existing reference's `externalCalendarId`.

mediumbugpackages/features/bookings/lib/handleCancelBooking.ts:423-471

Recurring cancel deletes all remaining events once per calendar reference — The recurring-cancel branch now runs inside the `bookingCalendarReference` loop, so with N references each remaining event gets N delete calls, and the repeats fail or double-delete. Run it once, guarded by a flag or moved outside the loop.

mediumbugpackages/app-store/googlecalendar/lib/CalendarService.ts:315-317

deleteEvent fallback searches destinationCalendar for a falsy externalId, always undefined — The fallback only runs when `externalCalendarId` is falsy, yet it searches `event.destinationCalendar` for that falsy value, so it is always undefined and deletes hit `"primary"`. Use `event.destinationCalendar?.[0]?.externalId` instead. **Also found in:** - `packages/app-store/googlecalendar/lib/CalendarService.ts:254-256`

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

Gold bugs missed (3)

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