Claude Sonnet 5.5 · Balanced
add-guest-management-functionality-to-existing-bookings-cal-com
cal.com · TypeScript · M · 100–299 lines · 6 files
The normal review, with one generalist agent. Judge: Claude Haiku 5.5.
- Gold bugs found
- 5 of 8
- Comments published
- 7
- Comments matching a bug
- 5
- Comments not matching
- 2
- Cost of this PR
- $0.647
Published comments (7)
Team admin check uses && so admins who are not owners are denied — Legitimate team admins who are not owners cannot add guests to team bookings they do not host. Combine the `isTeamAdmin` and `isTeamOwner` checks with `||` instead of `&&`.
Case-sensitive guest email check bypasses blacklist and duplicate attendee check — A mixed-case address like `Blocked@Example.com` slips past `BLACKLISTED_GUEST_EMAILS` and the duplicate attendee check. Compare `guest.toLowerCase()` against the blacklist and the attendee emails.
Calendar update uses caller's credentials instead of the organizer's — `EventManager` is built from `getUsersCredentials(ctx.user)`, so when an attendee or team admin adds guests, the organizer's calendar event fails to update or errors. Build the credentials and `EventManager` from `booking.user`, and catch calendar failures.
sendAddGuestsEmails called with unfiltered guests instead of uniqueGuests — A re-submitted existing attendee is treated as new and gets the 'scheduled' email instead of the 'guests added' one. Pass `uniqueGuests` to `sendAddGuestsEmails` instead of `guests`.
Guests array has no maximum length, enabling email spam and load — Without a limit, any user with booking access can submit a huge `guests` list, creating many attendee rows and flooding recipients with emails. Add `.min(1).max(N)` to the `guests` array with a reasonable N.
Calendar update failure aborts handler after guests are saved, skipping emails — If a calendar integration throws in `eventManager.updateCalendarAttendees`, the mutation errors and skips emails even though guests are saved, and a retry hits `emails_must_be_unique_valid`. Wrap the call in try/catch and log the error.
Duplicate guest emails in input are not deduplicated on the server — Duplicates within `guests` pass through `uniqueGuests`, so a direct tRPC call can create duplicate attendee rows and emails. Dedupe the input on the server with a lowercased `Set` and compare against existing attendees case-insensitively.