Skip to content

[CLEAN] Synthetic Benchmark PR #25593 - fix(api): return original email without OAuth suffix in bookings#699

Closed
tomerqodo wants to merge 1 commit intobase_pr_25593_20260121_8675from
clean_pr_25593_20260121_8675
Closed

[CLEAN] Synthetic Benchmark PR #25593 - fix(api): return original email without OAuth suffix in bookings#699
tomerqodo wants to merge 1 commit intobase_pr_25593_20260121_8675from
clean_pr_25593_20260121_8675

Conversation

@tomerqodo
Copy link

Benchmark PR calcom#25593

Type: Clean (correct implementation)

Original PR Title: fix(api): return original email without OAuth suffix in bookings
Original PR Description: ## What does this PR do?

This PR fixes a bug in API v2 (2024-08-13) where emails in booking API responses contained the OAuth client ID as a suffix (+{cuid}). This suffix exists to prevent email collisions between managed users of different OAuth clients.

Fixes calcom#25494 | Linear: CAL-6843

Problem:

  • Managed user emails were returned as: bob+cmidditrv0000mza4q93hbcau@example.com
  • Expected display: bob@example.com

Solution:
To avoid breaking changes for platform customers who may rely on the original email format, we preserve the original email field and add a new displayEmail field with the CUID suffix removed.

Key Changes:

  • Add getDisplayEmail() helper to strip CUID suffix from emails
  • Add displayEmail field to all relevant response objects
  • Keep original email field unchanged for backwards compatibility

Regex pattern used: /\+[a-zA-Z0-9]{25}/ (CUID format, consistent with google-calendar.service.ts)

Affected Fields

Field Value
hosts[].email bob+{cuid}@example.com (unchanged)
hosts[].displayEmail bob@example.com (new)
attendees[].email bob+{cuid}@example.com (unchanged)
attendees[].displayEmail bob@example.com (new)
bookingFieldsResponses.email bob+{cuid}@example.com (unchanged)
bookingFieldsResponses.displayEmail bob@example.com (new)
bookingFieldsResponses.guests[] guest+{cuid}@example.com (unchanged)
bookingFieldsResponses.displayGuests[] guest@example.com (new)
reassignedTo.email bob+{cuid}@example.com (unchanged)
reassignedTo.displayEmail bob@example.com (new)

How should this be tested?

Test Scenario 1 - Managed user as HOST:

  1. Create an event type using managed user's access token
  2. Create booking on that event type (external user booking managed user)
  3. GET /v2/bookings/{uid} with header Cal-Api-Version: 2024-08-13
  4. Verify hosts[].email returns original email with suffix
  5. Verify hosts[].displayEmail returns email without suffix

Test Scenario 2 - Managed user as ATTENDEE:

  1. Create booking where attendee is a managed user
  2. GET /v2/bookings/{uid} with header Cal-Api-Version: 2024-08-13
  3. Verify attendees[].email returns original email with suffix
  4. Verify attendees[].displayEmail returns email without suffix

Test Scenario 3 - Self-booking:

  1. Managed user books their own event type
  2. Verify both email and displayEmail fields are present and correct

Expected result: email fields preserve original value, displayEmail fields return clean email without +{cuid} suffix

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox. - N/A, OpenAPI spec auto-updated
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Human Review Checklist

  • Verify regex pattern /\+[a-zA-Z0-9]{25}/ correctly strips CUID suffixes without affecting normal emails
  • Confirm backwards compatibility: original email field values are unchanged
  • Verify displayEmail is added to all booking output types (hosts, attendees, reassignedTo)

Original PR URL: calcom#25593

@github-actions
Copy link

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "[CLEAN] Synthetic Benchmark PR #25593 - fix(api): return original email without OAuth suffix in bookings". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@github-actions
Copy link

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions bot added the Stale label Jan 30, 2026
@github-actions
Copy link

This PR has been closed due to inactivity. Please feel free to reopen it if you'd like to continue the work.

@github-actions github-actions bot closed this Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant