GPT-6.1 Sol · 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
7 of 9
Comments published
7
Comments matching a bug
7
Comments not matching
0
Cost of this PR
$1.552

Published comments (7)

highbugpackages/core/EventManager.ts:118-119

Google Meet bookings crash when destination calendars are empty or absent — Dereferencing `mainHostDestinationCalendar.integration` prevents the fallback to Cal Video when no destination is available. Restore optional chaining on `mainHostDestinationCalendar` in this condition.

highbugpackages/core/EventManager.ts:170

Video booking references lose credentials required for cancellation — Without `credentialId`, `handleCancelBooking` cannot delete dedicated video meetings when bookings are canceled. Preserve `result.credentialId` for video results as well as calendar results.

highbugpackages/core/EventManager.ts:370

Secondary hosts use the organizer's destination calendar — The Office 365, Lark, and base calendar adapters select the first entry in `event.destinationCalendar`, sending secondary hosts' events to the wrong calendar. Pass only the current credential's `destination` in `event.destinationCalendar` when calling `createEvent`.

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

Missing calendar IDs break destination fallback for updates and deletions — For older references without `externalCalendarId`, the `selectedCalendar` fallback resolves to `primary`, causing updates to fail for events on other calendars. Restore the configured destination fallback in both `updateEvent` and `deleteEvent`.

highbugpackages/features/bookings/lib/handleCancelBooking.ts:449-457

Recurring collective cancellations repeat organizer deletions and skip hosts — Looping over `bookingToDelete.user.credentials` and selecting the first calendar reference repeats organizer deletions while leaving secondary hosts' events undeleted. Match each occurrence's `bookingRef` to `reference.type` and `credentialId`, then delete it using the already resolved host credential.

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

Collective host calendars are dropped when the organizer has no destination — Optional chaining on a null `evt.destinationCalendar` silently discards every collected secondary-host destination. Initialize `evt.destinationCalendar` to an empty array before appending `teamDestinationCalendars`.

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

Organization creation loses all slug sources when team billing is disabled — Without `slug` or `metadata.requestedSlug`, `createTeams` rejects the organization and `publish` has no slug to publish. Invert the `IS_TEAM_BILLING_ENABLED` condition for the direct `slug` assignment so a slug source is always persisted.

Gold bugs found (7)

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.
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.
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 (2)

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.