GLM-5.3 Flash · 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 Opus 5.5.
- Gold bugs found
- 6 of 20
- Comments published
- 6
- Comments matching a bug
- 6
- Comments not matching
- 0
- Cost of this PR
- $0.117
Published comments (6)
Missing optional chaining on mainHostDestinationCalendar crashes when no destination calendar — When `evt.destinationCalendar` is null or empty, `mainHostDestinationCalendar.integration` throws a `TypeError`, crashing `EventManager.create` for Meet bookings without a calendar — exactly the case the fallback covers. Restore the optional chaining via `mainHostDestinationCalendar?.integration`.
Stale `credential` leaks across loop iterations in updateAllCalendarEvents — If a reference's `credentialId` is found neither in `this.calendarCredentials` nor in the DB, `updateEvent` receives the previous iteration's `credential` and silently updates the wrong host's calendar event. Reset `credential = undefined` at the top of each iteration, or scope it there.
Inverted IS_TEAM_BILLING_ENABLED check creates org without slug on self-hosted — On self-hosted instances organizations are now created without a `slug`, breaking their URLs, while hosted instances get it at creation and skip the publish/checkout flow that should set it afterwards. Negate the flag: `...(!IS_TEAM_BILLING_ENABLED ? { slug } : {})`.
credentialId dropped for video references in referencesToCreate — Video references are persisted with `credentialId: null`, so consumers that resolve the credential from the reference — `deleteMeeting` in handleNewBooking.ts and `updateMeeting` in handleCancelBooking.ts — skip silently, leaving Zoom and Meet meetings orphaned or unupdated. Keep `credentialId: result.credentialId ?? undefined` for all types and gate only `externalCalendarId` by `isCalendarType`.
Collective event drops team destination calendars when organizer has none — When the organizer and event type have no destination calendar, `evt.destinationCalendar` is null and the optional chain makes this push a silent no-op, so COLLECTIVE events get no calendar event and team hosts are never invited. Initialize it to an empty array, e.g. `(evt.destinationCalendar ??= []).push(...)`.
`updateEvent` fallback compares `externalCalendarId` against itself — When the booking reference lacks `externalCalendarId`, the fallback looks for that same falsy value in `event.destinationCalendar`, never matches, and reschedules fail with `calendarId: undefined` in `calendar.events.update`. Use the main host's calendar instead, `mainHostDestinationCalendar?.externalId`. **Also found in:** - `packages/app-store/googlecalendar/lib/CalendarService.ts:314-320`