Gemini 3.8 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
4 of 9
Comments published
4
Comments matching a bug
4
Comments not matching
0
Cost of this PR
$1.047

Published comments (4)

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

Null destinationCalendar drops collective hosts' calendars — When an organizer has no calendar configured, `evt.destinationCalendar?.push(...)` silently skips adding `teamDestinationCalendars`. Default `destinationCalendar` to an empty array `[]` instead of `null` to preserve collective host calendars.

highbugpackages/trpc/server/routers/viewer/organizations/create.handler.ts:150-154

Inverted IS_TEAM_BILLING_ENABLED check for organization slug — Organizations created with team billing disabled are left without a `slug`. Restore `!IS_TEAM_BILLING_ENABLED ? { slug } : {}` so the organization receives its slug directly.

highbugpackages/core/EventManager.ts:118-121

Unchecked access to mainHostDestinationCalendar causes TypeError — An empty `evt.destinationCalendar` causes `mainHostDestinationCalendar.integration` to throw an unhandled `TypeError` when checking `MeetLocationType`. Use optional chaining on `mainHostDestinationCalendar?.integration` to guard against `undefined`.

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

`selectedCalendar` fallback matches against falsy `externalCalendarId` — Matching against a falsy `externalCalendarId` always evaluates to `undefined`, leaving `selectedCalendar` unset. Fall back directly to `mainHostDestinationCalendar?.externalId` instead. **Also found in:** - `packages/app-store/googlecalendar/lib/CalendarService.ts:315-317` - `packages/app-store/googlecalendar/lib/CalendarService.ts:315-318`

Gold bugs found (4)

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.

Gold bugs missed (5)

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