MiniMax M3 · 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
- 5 of 9
- Comments published
- 8
- Comments matching a bug
- 5
- Comments not matching
- 3
- Cost of this PR
- $0.465
Published comments (8)
EventManager throws when destination calendar array is empty/null — Any Google Meet booking with an empty or null `evt.destinationCalendar` throws on `mainHostDestinationCalendar.integration` because the optional chaining was lost during the array refactor in `EventManager.ts`. Add optional chaining to `mainHostDestinationCalendar?.integration` so the `TypeError` is avoided.
updateEvent selectedCalendar fallback predicate is self-referential — The `find` predicate in `updateEvent`'s fallback searches for the falsy `externalCalendarId` the ternary just rejected, so `selectedCalendar` becomes undefined and Google rejects the `update` call. Replace it with `event.destinationCalendar?.[0]?.externalId` so the fallback picks a real calendar.
deleteEvent fallback searches for the falsy externalCalendarId and loses destination calendar — The `find` predicate in `deleteEvent`'s fallback searches for the falsy `externalCalendarId` the ternary just rejected, then the `calendarId ? calendarId : defaultCalendarId` masking silently routes deletion to `primary`. Use `event.destinationCalendar?.[0]?.externalId` so the original destination calendar is honored.
Collective booking silently skips team destination calendars when organizer has none — When both `eventType.destinationCalendar` and `organizerUser.destinationCalendar` are null, `handleNewBooking.ts` initializes `evt.destinationCalendar` to `null`, and the optional-chained `push` drops every team host calendar silently. Initialize `evt.destinationCalendar` to `[]` so collective bookings actually populate host calendars.
Lark createEvent signature missing credentialId parameter — Add the `credentialId` parameter and pick the matching `DestinationCalendar` like `GoogleCalendarService` does.
createEvent signature is missing the second credentialId parameter — The `Calendar` interface in `packages/types/Calendar.d.ts` and `CalendarManager` require `createEvent` to accept a `credentialId`, but Office365's `createEvent` in `Office365CalendarService.ts` still takes only `event`. Add the `credentialId` parameter and filter `event.destinationCalendar` by it like `GoogleCalendarService` does.
Organization slug is dropped when team billing is disabled — The slug condition in `create.handler.ts` is inverted: `IS_TEAM_BILLING_ENABLED ? { slug } : {}` drops the slug when team billing is off, making new organizations unsluggable. Restore the negation `!IS_TEAM_BILLING_ENABLED && { slug }` unless this reversal was intentional.
createAllCalendarEvents fetches missing credentials serially — `createAllCalendarEvents` awaits `prisma.credential.findUnique` sequentially per destination in `EventManager.ts`, so N missing host credentials issue N serial DB round-trips before any createEvent work begins. Collect missing ids and fetch with one `findMany` run before dispatching creates in parallel. **Also found in:** - `packages/core/EventManager.ts:493-554` - `packages/features/bookings/lib/handleCancelBooking.ts:416-484`