Kimi K3.1 Pro · 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
- 6 of 8
- Comments published
- 12
- Comments matching a bug
- 6
- Comments not matching
- 6
- Cost of this PR
- $1.607
Published comments (12)
Team admin check incorrectly requires ownership — Non-owner team admins are rejected because ANDing `isTeamAdmin` with `isTeamOwner` reduces `isTeamAdminOrOwner` to owners, even though `isTeamAdmin` already includes both roles. Use `isTeamAdmin` alone or OR the two checks so admins can add guests.
Duplicate guest emails create duplicate attendees and notifications — Repeated addresses within `guests` survive this filter, so `createMany` receives both entries, creating duplicate attendee records and notifications. Deduplicate `guests` server-side before filtering against existing attendees and blacklist entries.
Blacklist check is bypassable with case changes and plus tags — Because only `blacklistedGuestEmails` is lowercased, `Blocked@example.com` or `blocked+tag@example.com` can bypass `blocked@example.com` and receive an invitation. Compare lowercase `extractBaseEmail(guest)` values against the blacklist, matching the normal booking flow.
EventManager uses requester credentials instead of the booking organizer's — Attendee and team-admin requests pass the requester's credentials to `EventManager`, so references without `credentialId` can skip the update or use the wrong account, leaving guests off the organizer's calendar. Initialize it with `booking.user` and `getUsersCredentials(booking.user)`, rejecting a missing organizer.
Mixed guest requests email existing attendees as newly added guests — Passing `guests` to `sendAddGuestsEmails` makes existing attendees in mixed requests look newly added, so they receive `AttendeeScheduledEmail` despite not being inserted. Pass `uniqueGuests` instead so only attendees actually added receive the new-guest scheduled email.
Guests can be added to cancelled or rejected bookings — Reject inactive statuses before `prisma.booking.update` inserts attendees.
Missing team data prevents team-member guest notifications — The `CalendarEvent` built for `sendAddGuestsEmails` omits `team`, so its team-member notification loop never runs, even for team bookings. Load the event type's team and accepted members, then populate `evt.team` before sending notifications.
Unbounded guest array can trigger excessive database and email work — An unbounded `guests` array lets one authorized request create thousands of rows and outbound messages, exhausting database and mail-provider quotas. Add a conservative `.max(100)` limit to the schema and enforce it server-side.
Attendees can add guests when disableGuests is enabled — Reject guest additions when that flag is set, and hide the corresponding booking action in the UI.
Add-guest emails ignore event-type standard email suppression — Host and attendee notifications still go out when `eventType.metadata.disableStandardEmails.all` suppresses standard emails. Accept the metadata in `sendAddGuestsEmails`, gate both recipient branches with the location-change flow's helpers, and pass `booking.eventType?.metadata` from `addGuestsHandler`.
Add-guests attendee emails omit showAttendees for seated events — Without the `showAttendees` argument, `AttendeeScheduledEmail` strips other attendees whenever `seatsPerTimeSlot` is set, even if `seatsShowAttendees` is true. Pass `calendarEvent.seatsShowAttendees` as the third argument to both `AttendeeScheduledEmail` and `AttendeeAddGuestsEmail`.
Successful submission leaves a stale email validation error — Call `setIsInvalidEmail(false)` in `onSuccess`, as cancellation already does.