MiniMax M3 · 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
- 2 of 8
- Comments published
- 5
- Comments matching a bug
- 2
- Comments not matching
- 3
- Cost of this PR
- $0.174
Published comments (5)
Team admin-or-owner check uses && instead of ||, blocking admins — `isTeamAdminOrOwner` wrongly rejects team ADMINs who aren't OWNERs because `&&` reduces the check to OWNER-only. Combine the two predicates with `||` so admins are authorized.
addGuests handler stores newly added guests with an empty name — Newly added guests stored with `name: ""` produce malformed headers like ` <guest@example.com>` in `attendee-add-guests-email.ts` and drop the attendee name in `organizer-add-guests-email.ts`. Derive a display name from the email's local part instead.
sendAddGuestsEmails uses unfiltered guests instead of uniqueGuests — `newGuests.includes(attendee.email)` in `email-manager.ts` reclassifies existing attendees as new when `sendAddGuestsEmails` receives the un-filtered `guests` list, sending them a full `AttendeeScheduledEmail`. Pass `uniqueGuests` so they only get `AttendeeAddGuestsEmail`.
addGuestsHandler TOCTOU race on attendee email uniqueness — Two concurrent calls can both pass the filter and insert duplicate attendees since `Attendee` in `schema.prisma` lacks a unique `(bookingId, email)` constraint. Re-read and re-filter inside a `prisma.$transaction` so the check and `createMany` are atomic.
isInvalidEmail persists across retries and re-appears on edit — The inline error stays visible across retries and re-appears alongside an `onError` toast because `setIsInvalidEmail(true)` is never cleared. Reset it at the top of `handleAdd` so it reflects only the latest validation.