Claude Opus 5.5 · 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
7 of 9
Comments published
10
Comments matching a bug
7
Comments not matching
3
Cost of this PR
$4.584

Published comments (10)

highbugpackages/core/EventManager.ts:375-381

Destination calendar without credentialId loses externalId on created events — Without `destination.externalId`, `createEvent(c, event)` returns no `result.externalId`, so the reference stores no `externalCalendarId` and later updates and deletes hit the wrong calendar. Pass `destination.externalId` to `createEvent` in this branch too.

highbugpackages/features/bookings/lib/handleCancelBooking.ts:423-461

Recurring-series calendar delete repeats per reference and skips other hosts — Inside the per-reference loop, each collective-host reference deletes the organizer's `updatedBookings` events again, causing extra calls and 404/410 errors, while other hosts' recurring events are never deleted. Run the recurring delete once outside the loop, or scope it to the current reference's `credentialId`.

highbugpackages/lib/CalendarService.ts:156-164

CalDAV createEvent always targets the organizer's destination calendar — `createAllCalendarEvents` calls `createEvent` per host credential, so a second collective host's event targets the organizer's `destinationCalendar[0]` and never reaches their calendar (Office365 and Lark do the same). Pick the destination calendar whose `credentialId` matches this credential, as the Google service does.

highbugpackages/core/EventManager.ts:118-119

Crash on Google Meet bookings with no destination calendar — Cancellation, confirm and payment-webhook paths now pass a null or empty `destinationCalendar`, so for Google Meet locations `mainHostDestinationCalendar.integration` throws a TypeError and booking fails. Use `mainHostDestinationCalendar?.integration`.

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

Fallback calendar lookup compares against falsy externalCalendarId — Because the fallback only runs when `externalCalendarId` is falsy, matching `cal.externalId` against it always yields undefined, losing the old fallback to the destination calendar (`deleteEvent` has the same bug). Fall back to the first `destinationCalendar` entry's `externalId` instead. **Also found in:** - `packages/app-store/googlecalendar/lib/CalendarService.ts:315-317`

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

Collective hosts' calendars dropped when organizer has no destination calendar — With no event-type or organizer destination calendar, `evt.destinationCalendar` is `null`, so `evt.destinationCalendar?.push(...teamDestinationCalendars)` silently drops the other collective hosts' calendars. Initialize it to `[]` instead of `null` so team calendars are added.

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

Inverted billing condition sets org slug only when billing is enabled — Organizations now get a live `slug` before payment when billing is on, and none at all when it is off. Restore the original `!IS_TEAM_BILLING_ENABLED` condition.

highbugpackages/core/EventManager.ts:170

Video booking references lose their `credentialId` — Video booking references lose the credential they were created with, which later update and delete steps rely on. Set `credentialId` to `result.credentialId` for both calendar and non-calendar results.

mediumbugpackages/features/bookings/lib/handleNewBooking.ts:726-762

Plain Error for empty dynamicUserList is turned into a generic 500 — The catch only maps `HttpError` and Prisma errors to 400, so this plain `Error` becomes a 500 "Unable to load users", hiding the message and reporting bad input as a server error. Throw `HttpError` with `statusCode: 400` here, ideally with an i18n key like the rest of the file.

mediumsecuritypackages/features/bookings/lib/handleNewBooking.ts:757-762

Raw Prisma error message leaked to unauthenticated booking clients — Prisma messages can include the query, table, field and constraint names and values, which the public booking endpoint returns to unauthenticated callers. Log the `PrismaClientKnownRequestError` server-side in `loadUsers` and return a generic message like "Unable to load users" instead of `error.message`.

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.