Claude Sonnet 5.5 · Heavy
add-guest-management-functionality-to-existing-bookings-cal-com
cal.com · TypeScript · M · 100–299 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 8
- Comments published
- 8
- Comments matching a bug
- 5
- Comments not matching
- 3
- Cost of this PR
- $1.765
Published comments (8)
`EventManager` uses the requesting user's credentials, not the organizer's — Calendar updates run against the wrong credentials, so `updateCalendarAttendees` does not update the organizer's event when an attendee or team admin adds guests. Build `EventManager` from `booking.user` and its credentials, as the other booking handlers do.
`isTeamAdminOrOwner` joins `isTeamAdmin` and `isTeamOwner` with `&&` — `isTeamAdmin` already matches admins and owners, so joining it with `isTeamOwner` using `&&` limits access to owners and returns FORBIDDEN for other team admins. Use `isTeamAdmin` alone or join the checks with `||`, and skip the lookup when `teamId` is null.
Blacklisted guest emails bypass filter when entered with upper-case letters — The blacklist is lowercased but `guest` is compared as typed, so a blacklisted address with upper-case letters gets through. Compare `guest.toLowerCase()` against `blacklistedGuestEmails`.
Unbounded guests array allows mass email sending in one request — One authenticated call can add arbitrarily many attendees, and `sendAddGuestsEmails` emails every attendee, the organizer and each team member, so work grows with guests × attendees. Add `.min(1)` and `.max(N)` to the `guests` array.
Error toast always shows raw error code prefix; fallback message is unreachable — The message is always a truthy string, so the `t("unable_to_add_guests")` fallback never runs and users see a raw prefix such as "FORBIDDEN:". Show the translated `err.message`, falling back to `t("unable_to_add_guests")` when it is empty.
Duplicate guest emails in input are not deduplicated before createMany — Uniqueness is enforced only in the client dialog, so a direct API call with repeated emails makes `createMany` insert duplicate attendee rows. Dedupe `guests` before filtering, and compare against the lowercased `blacklistedGuestEmails`.
sendAddGuestsEmails receives unfiltered guests instead of uniqueGuests — Duplicate and blacklisted emails still match `newGuests.includes(attendee.email)`, so existing attendees get a full scheduled-invite email instead of the add-guests notice. Pass `uniqueGuests` to `sendAddGuestsEmails` instead of `guests`.
Case-sensitive guest email checks allow duplicate or blacklisted guests — The `guest === attendee.email` check is case-sensitive, so a case variant of an existing attendee's email counts as a new guest and creates a duplicate. Compare lowercased values in the `uniqueGuests` filter, and dedupe submitted guests case-insensitively too.