Kimi K3.1 Pro · 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
- 9 of 9
- Comments published
- 12
- Comments matching a bug
- 9
- Comments not matching
- 3
- Cost of this PR
- $2.099
Published comments (12)
Missing destination calendar crashes the Google Meet fallback — When `destinationCalendar` is null or empty and Google Meet is selected, `mainHostDestinationCalendar` is undefined and reading `.integration` throws before the intended Cal Video fallback. Use `mainHostDestinationCalendar?.integration` in the comparison.
Non-calendar references discard the video credential ID — Preserve `result.credentialId` when `isCalendarType` is false.
`CalendarManager.updateEvent` returns neither `externalId` nor `credentialId`, but… — Preserve the existing booking reference values or return these fields from `updateEvent`.
createEvent omits destination.externalId for credential-less destinations — For a destination without `credentialId`, `createEvent` is called without `destination.externalId`; because reference creation now relies on `result.externalId`, these booking references lose `externalCalendarId` and later updates/deletes cannot reliably target the original calendar. Pass `destination.externalId` in this branch as well.
Team destination calendars are dropped when no main destination exists — If neither the event type nor organizer has a destination calendar, `evt.destinationCalendar` remains null and the optional `push` silently discards every collected team destination, so other collective hosts get no calendar event. Initialize the array from `teamDestinationCalendars` when no main destination exists.
Inverted billing check assigns organization slugs to the wrong flow — The slug condition was inverted: billing-enabled organizations now receive a public slug before publishing, while billing-disabled organizations receive neither `slug` nor `requestedSlug`, breaking the expected organization setup/publish states. Restore `!IS_TEAM_BILLING_ENABLED` for `slug` and retain `requestedSlug` for the billing-enabled flow.
Hangout description patch can use an undefined calendar ID — `selectedCalendar` can be undefined when no destination matches the credential, and although insert falls back to `primary`, the subsequent Hangout-description patch at line 168 still passes the raw undefined value. Reuse the same `selectedCalendar || "primary"` fallback for the patch request.
Recurring cancellation repeats the full calendar deletion set per reference — The recurring-cancellation branch runs once for every calendar reference, yet each run already iterates all user calendar credentials and all updated bookings, so N references repeat the same remote deletion set N times. Move the all-bookings recurring deletion outside the reference loop or restrict each iteration to its own reference.
Every secondary collective-host destination missing from the organizer's credentials triggers its… — Bulk-load the required credentials and parallelize the independent event creations.
For recurring collective bookings, this inner loop always selects the first calendar reference… — Resolve each updated booking's matching reference and credential, including DB-fetched secondary-host credentials, instead of combining every organizer credential with `find`'s first reference.
Falsy externalCalendarId leaves updateEvent without a calendar ID — When `externalCalendarId` is null or empty, the fallback searches for a destination whose required string `externalId` equals that falsy value, so it always yields undefined and updates legacy references without a calendar ID. Fall back to `mainHostDestinationCalendar?.externalId` instead. **Also found in:** - `packages/app-store/googlecalendar/lib/CalendarService.ts:315-317`
Office 365 event creation always uses the first host's calendar — EventManager now calls `createEvent` for every collective host credential, but this adapter always posts to the first destination's external ID; secondary hosts therefore authenticate with their own token against the organizer's calendar and event creation fails. Accept the supplied credential ID and select the matching destination for each invocation. **Also found in:** - `packages/app-store/larkcalendar/lib/CalendarService.ts:125-129` - `packages/lib/CalendarService.ts:156-165`
Gold bugs found (9)
Gold bugs missed (0)
None.