DeepSeek V4.1 Flash · Heavy

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

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

The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Haiku 5.5.

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

Published comments (9)

highbugpackages/core/EventManager.ts:205-209

updateLocation drops externalCalendarId for updated events — `CalendarManager.updateEvent` never sets `externalId`, so location changes persist references without an `externalCalendarId`, and later deletes hit `primary`. Fall back to `evt.destinationCalendar?.[0]?.externalId` when `result.externalId` is absent.

highbugpackages/core/EventManager.ts:170

Video booking references lose credentialId, so meetings are never deleted on cancel — `handleCancelBooking.ts:491` has no else branch, so an undefined video `credentialId` means the Zoom/Daily/Meet meeting is never deleted on cancellation. Restore the video fallback so `createMeeting`'s `credentialId` is persisted.

highbugpackages/core/EventManager.ts:118-119

Dereference of possibly undefined mainHostDestinationCalendar — `handleNewBooking` sets `destinationCalendar` to `null` and the webhooks set `[]`, so this throws a TypeError for a Google Meet booking when the organizer has no destination calendar instead of falling back to Cal Video. Guard the dereference.

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

Dead selectedCalendar fallback passes undefined calendarId — The `find` only runs when the predicate's value is falsy, so it never matches and `calendar.events.update` gets an undefined `calendarId`. Fall back to `event.destinationCalendar?.[0]?.externalId` or match on `credentialId`.

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

deleteEvent destination calendar lookup always falls back to primary — The `find` can never match a falsy `externalCalendarId`, so every delete falls back to "primary" and events on secondary destination calendars are never deleted. Use the destination calendar's `externalId` as the fallback.

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

Collective team destination calendars dropped when organizer calendar is null — `destinationCalendar` is set to `null` a few lines above when no destination calendar exists, so the optional push silently drops every `teamDestinationCalendars` entry. Assign the merged array instead of pushing.

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

Hangout-link patch uses undefined calendarId when no matching destination calendar — Google Meet bookings with no matching destination calendar fail the patch and lose the updated description. Apply the same `|| "primary"` fallback to the `calendar.events.patch` call.

mediumperformancepackages/features/bookings/lib/handleCancelBooking.ts:449-468

Recurring cancellation repeats deletes for each calendar reference — The recurring branch now runs once per calendar reference while still looping over credentials and `updatedBookings`, so a collective with N references deletes the same events N times. Run it once when `allRemainingBookings` is set.

mediumsecuritypackages/app-store/googlecalendar/lib/CalendarService.ts:100-106

Organizer email uses first destination calendar, not credential's — With `destinationCalendar` now an array of every host's calendar, an event created with host B's credential is sent with host A's email as organizer. Match the destination calendar by `credentialId` (as `selectedCalendar` does) before using its `externalId`.

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