Skip to content

fix: Manual RR reassign location change - Cal Video/Zoom/GoogleMeet to Zoom/Google Meet/Cal Video #22840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hariombalhara
Copy link
Member

@hariombalhara hariombalhara commented Jul 31, 2025

What does this PR do?

  • Reassigning from Host with Cal Video -> Host with Google Meet doesn't change the location. This is in general applicable to any Dynamic link based app while reassigning.
  • Also conferenceCredentialId was missing which could mean that Team installed Conferencing Apps(which save conferenceCredentialId to user metadata) won't be able to be used reliably. They might work most of the time because of fallback to using first available credential

Tech Debt Payment

  • Introduced BookingLocationService that is being used in roundRobinManualAssignment now

Fixes PRI-298

Visual Demo (For contributors especially)

Before After loom - https://www.loom.com/share/342131fed0f6447383801b81a2279c7d

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A 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.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

A new BookingLocationService class is introduced to centralize logic for determining booking locations based on organizer and event type metadata, supporting both static and dynamic conferencing apps. The round robin manual reassignment logic is refactored to utilize this service, ensuring that when an organizer changes, the booking location is correctly updated to reflect the new organizer’s default conferencing app. Comprehensive tests are added for both the new service and the reassignment logic, covering various scenarios and error handling. Minor related changes include a new constant export, explicit typing, and updates to OAuth-related redirect URIs.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Assessment against linked issues

Objective Addressed Explanation
Correctly update booking location to new organizer's default conferencing app during reassignment (PRI-298)
Ensure fallback to appropriate location if new organizer lacks a default conferencing app (PRI-298)
Correct handling of static and dynamic conferencing app locations during reassignment (PRI-298)
Error handling when conferencing link creation fails during reassignment (PRI-298)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Update OAuth redirect URI constant from WEBAPP_URL to WEBAPP_URL_FOR_OAUTH (packages/app-store/webex/api/add.ts, packages/app-store/webex/api/callback.ts) This change relates to OAuth configuration and is not directly tied to the objectives of PRI-298.
Addition of file-level TODO and new constant export CalVideoLocationType (packages/app-store/locations.ts) The TODO comment and constant export are not required for the reassignment/location update objectives.

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb6367b and a8fb459.

📒 Files selected for processing (1)
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-booking-reassign-location-change

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Jul 31, 2025
@hariombalhara hariombalhara changed the title feat: add optional startTime prop to BookerPlatformWrapper (#22731) fix: fix-booking-reassign-location-change Jul 31, 2025
@hariombalhara hariombalhara force-pushed the fix-booking-reassign-location-change branch from 0ea3c7b to 4603c9c Compare August 1, 2025 11:14
Copy link

vercel bot commented Aug 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Aug 5, 2025 7:58am
cal-eu ⬜️ Ignored (Inspect) Aug 5, 2025 7:58am

Copy link

linear bot commented Aug 4, 2025

PRI-298

Copy link
Contributor

github-actions bot commented Aug 4, 2025

E2E results are ready!

@hariombalhara hariombalhara force-pushed the fix-booking-reassign-location-change branch from 8ced440 to d04a16c Compare August 4, 2025 12:12
@hariombalhara hariombalhara changed the title fix: fix-booking-reassign-location-change fix: Manual RR reassign location change - Cal Video to Google Meet Aug 4, 2025
@hariombalhara hariombalhara changed the title fix: Manual RR reassign location change - Cal Video to Google Meet fix: Manual RR reassign location change - Cal Video/Zoom/GoogleMeet to Zoom/Google Meet/Cal Video Aug 4, 2025
@hariombalhara hariombalhara marked this pull request as ready for review August 4, 2025 12:13
@graphite-app graphite-app bot requested a review from a team August 4, 2025 12:13
@dosubot dosubot bot added bookings area: bookings, availability, timezones, double booking teams area: teams, round robin, collective, managed event-types 🐛 bug Something isn't working labels Aug 4, 2025
Copy link

graphite-app bot commented Aug 4, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (08/04/25)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
packages/app-store/webex/api/add.ts (1)

27-31: Inconsistent redirect-URI encoding between “add” and “callback” handlers

Here the raw string is passed to querystring.stringify, which already performs percent-encoding.
In callback.ts the same URI is wrapped in encodeURI before being sent through URLSearchParams, causing different (and potentially double-encoded) behaviour.

No change needed in this file, but align both handlers by removing the superfluous encodeURI in callback.ts (see suggested diff there).

packages/app-store/webex/api/callback.ts (1)

18-23: Drop redundant encodeURI to avoid double-encoding

URLSearchParams encodes each value internally, so pre-encoding the URI is unnecessary and can lead to an over-encoded redirect_uri.

-  const redirectUri = encodeURI(`${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`);
+  const redirectUri = `${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`;
packages/features/ee/round-robin/handleRescheduleEventManager.ts (1)

76-78: Simplify the find condition.

The condition result.type.includes("_video") && result.type === "daily_video" is redundant. If result.type === "daily_video", it will always include "_video".

-  const calVideoResult = results.find(
-    (result) => result.type.includes("_video") && result.type === "daily_video"
-  );
+  const calVideoResult = results.find((result) => result.type === "daily_video");
packages/lib/server/service/bookingLocationService.test.ts (1)

459-476: Consider making the test more explicit about behavior.

The comment on line 466 mentions that getLocationValueForDB picks the last matching credential due to forEach. This behavior dependency makes the test fragile if the implementation changes.

Consider adding a more explicit test name or assertion comment to clarify that this tests the "last-one-wins" behavior when multiple locations have the same type.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84210dc and d04a16c.

📒 Files selected for processing (8)
  • packages/app-store/locations.ts (3 hunks)
  • packages/app-store/webex/api/add.ts (2 hunks)
  • packages/app-store/webex/api/callback.ts (2 hunks)
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts (2 hunks)
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (8 hunks)
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts (5 hunks)
  • packages/lib/server/service/bookingLocationService.test.ts (1 hunks)
  • packages/lib/server/service/bookingLocationService.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/app-store/webex/api/callback.ts
  • packages/app-store/locations.ts
  • packages/app-store/webex/api/add.ts
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/lib/server/service/bookingLocationService.test.ts
  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/app-store/webex/api/callback.ts
  • packages/app-store/locations.ts
  • packages/app-store/webex/api/add.ts
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/lib/server/service/bookingLocationService.test.ts
  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
**/*Service.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Service files must include Service suffix, use PascalCase matching exported class, and avoid generic names (e.g., MembershipService.ts)

Files:

  • packages/lib/server/service/bookingLocationService.ts
🧠 Learnings (10)
📓 Common learnings
Learnt from: CarinaWolli
PR: calcom/cal.com#22296
File: packages/lib/bookings/filterHostsBySameRoundRobinHost.ts:41-42
Timestamp: 2025-07-22T11:42:47.623Z
Learning: The filterHostsBySameRoundRobinHost function in packages/lib/bookings/filterHostsBySameRoundRobinHost.ts has a known limitation where it doesn't work correctly with fixed hosts or round robin groups. This is pre-existing technical debt that was already broken before the round robin groups feature. CarinaWolli has documented this in Linear issue CAL-6134 for future fix.
📚 Learning: in signup-view.tsx, when checking if redirecturl contains certain strings, using explicit && checks ...
Learnt from: Anshumancanrock
PR: calcom/cal.com#22570
File: apps/web/modules/signup-view.tsx:253-253
Timestamp: 2025-07-21T21:33:23.371Z
Learning: In signup-view.tsx, when checking if redirectUrl contains certain strings, using explicit && checks (redirectUrl && redirectUrl.includes()) is preferred over optional chaining (redirectUrl?.includes()) to ensure the result is always a boolean rather than potentially undefined. This approach provides cleaner boolean contracts for downstream conditional logic.

Applied to files:

  • packages/app-store/webex/api/callback.ts
  • packages/app-store/webex/api/add.ts
📚 Learning: in cal.com's embed system, internal events like "__scrollbydistance" are fired by cal.com's own code...
Learnt from: hariombalhara
PR: calcom/cal.com#22547
File: packages/embeds/embed-core/src/lib/eventHandlers/scrollByDistanceEventHandler.ts:11-14
Timestamp: 2025-07-16T11:46:28.759Z
Learning: In Cal.com's embed system, internal events like "__scrollByDistance" are fired by Cal.com's own code, so runtime validation of event data structure is unnecessary since TypeScript type system guarantees type safety for internal events.

Applied to files:

  • packages/app-store/locations.ts
📚 Learning: in cal.com's calendar integration, both google calendar and outlook calendar are designed to allow m...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/prisma/schema.prisma:891-891
Timestamp: 2025-07-18T08:47:01.264Z
Learning: In Cal.com's calendar integration, both Google Calendar and Outlook Calendar are designed to allow multiple eventTypeIds to share the same subscription ID (googleChannelId or outlookSubscriptionId). This is an intentional design pattern to reuse existing subscriptions for efficiency rather than creating separate subscriptions for each event type. Therefore, unique constraints like `@@unique([outlookSubscriptionId, eventTypeId])` should not be added as they would break this subscription sharing functionality.

Applied to files:

  • packages/app-store/locations.ts
📚 Learning: the filterhostsbysameroundrobinhost function in packages/lib/bookings/filterhostsbysameroundrobinhos...
Learnt from: CarinaWolli
PR: calcom/cal.com#22296
File: packages/lib/bookings/filterHostsBySameRoundRobinHost.ts:41-42
Timestamp: 2025-07-22T11:42:47.623Z
Learning: The filterHostsBySameRoundRobinHost function in packages/lib/bookings/filterHostsBySameRoundRobinHost.ts has a known limitation where it doesn't work correctly with fixed hosts or round robin groups. This is pre-existing technical debt that was already broken before the round robin groups feature. CarinaWolli has documented this in Linear issue CAL-6134 for future fix.

Applied to files:

  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
📚 Learning: the office365calendar webhook handler in packages/app-store/office365calendar/api/webhook.ts is spec...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/app-store/office365calendar/api/webhook.ts:120-123
Timestamp: 2025-07-18T17:57:16.395Z
Learning: The office365calendar webhook handler in packages/app-store/office365calendar/api/webhook.ts is specifically designed for Office365 calendar integration, not as a generic webhook handler. Therefore, it's safe to assume that fetchAvailabilityAndSetCache method will be implemented in the Office365CalendarService, making explicit validation checks unnecessary.

Applied to files:

  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
📚 Learning: in the multipleprivatelinkscontroller component (packages/features/eventtypes/components/multiplepri...
Learnt from: alishaz-polymath
PR: calcom/cal.com#22304
File: packages/features/eventtypes/components/MultiplePrivateLinksController.tsx:92-94
Timestamp: 2025-07-16T06:42:27.024Z
Learning: In the MultiplePrivateLinksController component (packages/features/eventtypes/components/MultiplePrivateLinksController.tsx), the `currentLink.maxUsageCount ?? 1` fallback in the openSettingsDialog function is intentional. Missing maxUsageCount values indicate old/legacy private links that existed before the expiration feature was added, and they should default to single-use behavior (1) for backward compatibility.

Applied to files:

  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
📚 Learning: in the insightsbookingservice (packages/lib/server/service/insightsbooking.ts), the constructor stor...
Learnt from: eunjae-lee
PR: calcom/cal.com#22702
File: packages/lib/server/service/insightsBooking.ts:120-124
Timestamp: 2025-07-24T08:39:06.185Z
Learning: In the InsightsBookingService (packages/lib/server/service/insightsBooking.ts), the constructor stores null for invalid options or filters but this is handled safely through null checks in buildFilterConditions() and buildAuthorizationConditions() methods. The service uses defensive programming to return safe fallback conditions (null or NOTHING_CONDITION) rather than throwing errors on invalid inputs.

Applied to files:

  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
📚 Learning: in the failedbookingsbyfield component (packages/features/insights/components/failedbookingsbyfield....
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.

Applied to files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
📚 Learning: for e2e integration tests that require real third-party service credentials (like outlook calendar),...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: .env.example:354-357
Timestamp: 2025-07-18T08:49:18.779Z
Learning: For E2E integration tests that require real third-party service credentials (like Outlook calendar), it's acceptable to temporarily include actual test account credentials in .env.example during feature development and validation, provided there's a clear plan to replace them with placeholder values before final release. Test credentials should be for dedicated test tenants/accounts, not production systems.

Applied to files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
🧬 Code Graph Analysis (4)
packages/app-store/webex/api/callback.ts (1)
packages/lib/constants.ts (1)
  • WEBAPP_URL_FOR_OAUTH (22-22)
packages/app-store/webex/api/add.ts (1)
packages/lib/constants.ts (1)
  • WEBAPP_URL_FOR_OAUTH (22-22)
packages/lib/server/service/bookingLocationService.ts (1)
packages/app-store/locations.ts (4)
  • LocationObject (202-212)
  • OrganizerDefaultConferencingAppType (70-70)
  • CalVideoLocationType (64-64)
  • getLocationValueForDB (379-408)
packages/features/ee/round-robin/roundRobinManualReassignment.ts (1)
packages/lib/server/service/bookingLocationService.ts (1)
  • BookingLocationService (89-247)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (15)
packages/app-store/webex/api/callback.ts (1)

3-4: LGTM – consistent constant import

Switching to WEBAPP_URL_FOR_OAUTH matches the change in the “add” endpoint and keeps the OAuth flow consistent.

packages/app-store/locations.ts (3)

1-3: Good documentation of technical debt.

The TODO comment clearly indicates the need for future consolidation work and test coverage. This aligns well with the introduction of BookingLocationService.


64-64: Good abstraction for Cal Video location type.

Creating a semantic alias CalVideoLocationType improves code readability while maintaining backward compatibility with DailyLocationType.


384-384: Good type safety improvement.

Explicitly typing conferenceCredentialId as number | undefined improves type safety and code clarity.

packages/features/ee/round-robin/roundRobinManualReassignment.ts (3)

158-172: Good refactoring to use BookingLocationService.

The migration to BookingLocationService.getLocationForHost properly centralizes the location determination logic and correctly handles both booking location and conference credential ID extraction.


223-233: Good handling of credential ID extraction for unchanged organizer.

The code correctly extracts conferenceCredentialId even when the organizer hasn't changed, ensuring the credential ID is properly propagated in all reassignment scenarios.


306-306: Correct propagation of conferenceCredentialId.

The credential ID is properly included in the CalendarEvent, with appropriate null-to-undefined conversion for API compatibility.

packages/lib/server/service/bookingLocationService.test.ts (1)

1-558: Excellent test coverage!

The test suite is comprehensive, well-structured, and covers all major scenarios including edge cases. The use of mocks is appropriate and the test organization follows best practices.

packages/lib/server/service/bookingLocationService.ts (1)

1-247: Excellent service implementation!

The BookingLocationService is well-designed with:

  • Clear separation of concerns
  • Comprehensive JSDoc documentation
  • Strong TypeScript typing with discriminated unions
  • Proper error handling with null returns
  • Follows the Service naming convention as required

This successfully centralizes the booking location logic as intended by the PR objectives.

packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (6)

20-29: LGTM! Clean mock setup

The new imports and mock configuration follow the established patterns correctly.


30-50: Well-structured type definitions

The type definitions are clear and properly structured, providing good type safety for the test data.


52-137: Excellent test data builder implementation

The factory pattern implementation significantly improves test maintainability and readability. The builders provide sensible defaults while allowing flexible overrides, reducing code duplication across tests.


161-234: Comprehensive mock implementation for EventManager

The mock helpers provide excellent coverage for different conferencing scenarios including static links, dynamic conferencing apps, and error cases. The implementation correctly simulates real-world behavior.

Note: The eslint-disable-next-line @typescript-eslint/no-explicit-any comments are justified here due to the need to mock private methods.


239-526: Thorough test coverage for core reassignment scenarios

The refactored tests effectively utilize the new test builders and provide comprehensive coverage for:

  • Basic reassignment with workflow updates
  • Conference credential ID propagation
  • Fixed host scenarios
  • Cancellation email handling

The tests properly verify both the integration points (EventManager calls) and the resulting state changes.


528-875: Excellent test coverage for location change scenarios

This new test suite directly addresses the PR objectives by thoroughly testing location updates during round-robin reassignment. The tests cover:

  • Dynamic conferencing app transitions (Google Meet ↔ Zoom)
  • Static video link handling
  • Fallback behavior when no default app is configured
  • Error handling for failed conferencing setup

The test structure with dedicated helpers (createConferencingUsers, mockAppStore) makes the tests maintainable and easy to understand.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (6)
packages/app-store/webex/api/add.ts (1)

29-33: Minor encoding mismatch between auth & token requests

In this file the redirect_uri value is implicitly URL-encoded by querystring.stringify (which calls encodeURIComponent) whereas the token-exchange route (callback.ts) first applies encodeURI and then URLSearchParams, resulting in slightly different encodings (e.g. slashes encoded vs. not). Most providers tolerate this, but Webex’ spec requires the token request use exactly the same redirect_uri that was supplied on the authorize call.

Consider aligning both sides to a single helper:

-redirect_uri: `${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`,
+redirect_uri: buildWebexRedirectUri(config.slug),

and in a shared util:

export const buildWebexRedirectUri = (slug: string) =>
  `${WEBAPP_URL_FOR_OAUTH}/api/integrations/${slug}/callback`;

Then let each caller rely on the transport (querystring / URLSearchParams) to perform one consistent round of encodeURIComponent.

packages/app-store/webex/api/callback.ts (1)

20-27: Potential double-encoding of redirect_uri

Here redirectUri is first processed by encodeURI, after which URLSearchParams will run encodeURIComponent again. For harmless characters (e.g. /, :) this simply results in once-encoded output, but any space or reserved char would become double-encoded (%20%2520). To stay future-proof and fully match the value sent in the initial /authorize call, you can skip the manual encodeURI:

-const redirectUri = encodeURI(`${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`);
+const redirectUri = `${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`;

The subsequent URLSearchParams call will perform the correct single encoding.

packages/app-store/locations.ts (1)

1-3: Track the TODO consolidation task

The TODO indicates plans to consolidate this file with BookingLocationService. Consider creating a tracking issue to ensure this technical debt is addressed.

Would you like me to create a tracking issue for this consolidation task?

packages/lib/server/service/bookingLocationService.test.ts (1)

466-466: Document the multiple credential ID behavior

The comment indicates that getLocationValueForDB picks the last matching location when there are multiple with the same type. This behavior should be documented in the service implementation to prevent confusion.

Consider adding a comment in the BookingLocationService or getLocationValueForDB implementation to document this behavior explicitly.

packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (2)

454-455: Consider using a more type-safe approach for BookingRepository

Instead of casting prismaMock with as any, consider using proper typing or a mock-specific type to maintain type safety in tests.

-    // eslint-disable-next-line @typescript-eslint/no-explicit-any
-    const bookingRepo = new BookingRepository(prismaMock as any);
+    const bookingRepo = new BookingRepository(prismaMock);

675-676: Remove commented code

This commented line appears to be leftover from development and should be removed.

-      // (await mockGetAppFromSlug()).mockReturnValue(undefined);
-
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84210dc and d04a16c.

📒 Files selected for processing (8)
  • packages/app-store/locations.ts (3 hunks)
  • packages/app-store/webex/api/add.ts (2 hunks)
  • packages/app-store/webex/api/callback.ts (2 hunks)
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts (2 hunks)
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (8 hunks)
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts (5 hunks)
  • packages/lib/server/service/bookingLocationService.test.ts (1 hunks)
  • packages/lib/server/service/bookingLocationService.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/app-store/webex/api/add.ts
  • packages/app-store/locations.ts
  • packages/app-store/webex/api/callback.ts
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/lib/server/service/bookingLocationService.test.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/app-store/webex/api/add.ts
  • packages/app-store/locations.ts
  • packages/app-store/webex/api/callback.ts
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/lib/server/service/bookingLocationService.test.ts
**/*Service.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Service files must include Service suffix, use PascalCase matching exported class, and avoid generic names (e.g., MembershipService.ts)

Files:

  • packages/lib/server/service/bookingLocationService.ts
🧠 Learnings (10)
📓 Common learnings
Learnt from: CarinaWolli
PR: calcom/cal.com#22296
File: packages/lib/bookings/filterHostsBySameRoundRobinHost.ts:41-42
Timestamp: 2025-07-22T11:42:47.623Z
Learning: The filterHostsBySameRoundRobinHost function in packages/lib/bookings/filterHostsBySameRoundRobinHost.ts has a known limitation where it doesn't work correctly with fixed hosts or round robin groups. This is pre-existing technical debt that was already broken before the round robin groups feature. CarinaWolli has documented this in Linear issue CAL-6134 for future fix.
📚 Learning: in signup-view.tsx, when checking if redirecturl contains certain strings, using explicit && checks ...
Learnt from: Anshumancanrock
PR: calcom/cal.com#22570
File: apps/web/modules/signup-view.tsx:253-253
Timestamp: 2025-07-21T21:33:23.371Z
Learning: In signup-view.tsx, when checking if redirectUrl contains certain strings, using explicit && checks (redirectUrl && redirectUrl.includes()) is preferred over optional chaining (redirectUrl?.includes()) to ensure the result is always a boolean rather than potentially undefined. This approach provides cleaner boolean contracts for downstream conditional logic.

Applied to files:

  • packages/app-store/webex/api/add.ts
  • packages/app-store/webex/api/callback.ts
📚 Learning: in cal.com's embed system, internal events like "__scrollbydistance" are fired by cal.com's own code...
Learnt from: hariombalhara
PR: calcom/cal.com#22547
File: packages/embeds/embed-core/src/lib/eventHandlers/scrollByDistanceEventHandler.ts:11-14
Timestamp: 2025-07-16T11:46:28.759Z
Learning: In Cal.com's embed system, internal events like "__scrollByDistance" are fired by Cal.com's own code, so runtime validation of event data structure is unnecessary since TypeScript type system guarantees type safety for internal events.

Applied to files:

  • packages/app-store/locations.ts
📚 Learning: in cal.com's calendar integration, both google calendar and outlook calendar are designed to allow m...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/prisma/schema.prisma:891-891
Timestamp: 2025-07-18T08:47:01.264Z
Learning: In Cal.com's calendar integration, both Google Calendar and Outlook Calendar are designed to allow multiple eventTypeIds to share the same subscription ID (googleChannelId or outlookSubscriptionId). This is an intentional design pattern to reuse existing subscriptions for efficiency rather than creating separate subscriptions for each event type. Therefore, unique constraints like `@@unique([outlookSubscriptionId, eventTypeId])` should not be added as they would break this subscription sharing functionality.

Applied to files:

  • packages/app-store/locations.ts
📚 Learning: the office365calendar webhook handler in packages/app-store/office365calendar/api/webhook.ts is spec...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/app-store/office365calendar/api/webhook.ts:120-123
Timestamp: 2025-07-18T17:57:16.395Z
Learning: The office365calendar webhook handler in packages/app-store/office365calendar/api/webhook.ts is specifically designed for Office365 calendar integration, not as a generic webhook handler. Therefore, it's safe to assume that fetchAvailabilityAndSetCache method will be implemented in the Office365CalendarService, making explicit validation checks unnecessary.

Applied to files:

  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
📚 Learning: the filterhostsbysameroundrobinhost function in packages/lib/bookings/filterhostsbysameroundrobinhos...
Learnt from: CarinaWolli
PR: calcom/cal.com#22296
File: packages/lib/bookings/filterHostsBySameRoundRobinHost.ts:41-42
Timestamp: 2025-07-22T11:42:47.623Z
Learning: The filterHostsBySameRoundRobinHost function in packages/lib/bookings/filterHostsBySameRoundRobinHost.ts has a known limitation where it doesn't work correctly with fixed hosts or round robin groups. This is pre-existing technical debt that was already broken before the round robin groups feature. CarinaWolli has documented this in Linear issue CAL-6134 for future fix.

Applied to files:

  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
📚 Learning: for e2e integration tests that require real third-party service credentials (like outlook calendar),...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: .env.example:354-357
Timestamp: 2025-07-18T08:49:18.779Z
Learning: For E2E integration tests that require real third-party service credentials (like Outlook calendar), it's acceptable to temporarily include actual test account credentials in .env.example during feature development and validation, provided there's a clear plan to replace them with placeholder values before final release. Test credentials should be for dedicated test tenants/accounts, not production systems.

Applied to files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
📚 Learning: in the failedbookingsbyfield component (packages/features/insights/components/failedbookingsbyfield....
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.

Applied to files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
📚 Learning: in the insightsbookingservice (packages/lib/server/service/insightsbooking.ts), the constructor stor...
Learnt from: eunjae-lee
PR: calcom/cal.com#22702
File: packages/lib/server/service/insightsBooking.ts:120-124
Timestamp: 2025-07-24T08:39:06.185Z
Learning: In the InsightsBookingService (packages/lib/server/service/insightsBooking.ts), the constructor stores null for invalid options or filters but this is handled safely through null checks in buildFilterConditions() and buildAuthorizationConditions() methods. The service uses defensive programming to return safe fallback conditions (null or NOTHING_CONDITION) rather than throwing errors on invalid inputs.

Applied to files:

  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
📚 Learning: applies to **/*.{service,repository}.ts : avoid dot-suffixes like `.service.ts` or `.repository.ts` ...
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*.{service,repository}.ts : Avoid dot-suffixes like `.service.ts` or `.repository.ts` for new files; reserve `.test.ts`, `.spec.ts`, `.types.ts` for their specific purposes

Applied to files:

  • packages/lib/server/service/bookingLocationService.test.ts
🧬 Code Graph Analysis (5)
packages/app-store/webex/api/add.ts (1)
packages/lib/constants.ts (1)
  • WEBAPP_URL_FOR_OAUTH (22-22)
packages/app-store/webex/api/callback.ts (1)
packages/lib/constants.ts (1)
  • WEBAPP_URL_FOR_OAUTH (22-22)
packages/lib/server/service/bookingLocationService.ts (1)
packages/app-store/locations.ts (4)
  • LocationObject (202-212)
  • OrganizerDefaultConferencingAppType (70-70)
  • CalVideoLocationType (64-64)
  • getLocationValueForDB (379-408)
packages/features/ee/round-robin/roundRobinManualReassignment.ts (1)
packages/lib/server/service/bookingLocationService.ts (1)
  • BookingLocationService (89-247)
packages/lib/server/service/bookingLocationService.test.ts (1)
packages/lib/server/service/bookingLocationService.ts (1)
  • BookingLocationService (89-247)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (9)
packages/app-store/webex/api/add.ts (1)

4-4: Consistent constant for OAuth redirect – looks good

Switching to WEBAPP_URL_FOR_OAUTH keeps local-dev and staging flows working without hard-coding localhost. No further action needed.

packages/app-store/webex/api/callback.ts (1)

3-3: Consistent constant import – looks good

The callback now uses the same WEBAPP_URL_FOR_OAUTH constant as the authorisation endpoint, avoiding environment drift.

packages/app-store/locations.ts (1)

384-384: Good type clarity improvement

Explicitly typing conferenceCredentialId as number | undefined improves code clarity and type safety.

packages/features/ee/round-robin/roundRobinManualReassignment.ts (1)

158-172: Excellent refactoring using BookingLocationService

The refactoring properly centralizes location determination logic and correctly handles conference credential IDs for both organizer change scenarios. This aligns with the PR objectives to fix location updates during reassignment.

Also applies to: 223-233, 306-306

packages/lib/server/service/bookingLocationService.test.ts (1)

1-558: Excellent comprehensive test coverage

The test suite thoroughly covers all methods of BookingLocationService with proper edge case handling, mock setup, and clear test organization. Great work!

packages/lib/server/service/bookingLocationService.ts (1)

1-247: Well-designed service with excellent documentation

The BookingLocationService is well-structured with:

  • Clear separation of concerns
  • Comprehensive JSDoc documentation
  • Proper TypeScript typing
  • Defensive programming with null returns instead of throwing errors
  • Correct handling of both dynamic and static link conferencing apps

The implementation aligns perfectly with the PR objectives to fix location updates during round-robin reassignment.

packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (3)

51-117: Excellent test data builder pattern implementation

The test data builders provide a clean and maintainable way to create test fixtures with sensible defaults. This pattern significantly improves test readability and reduces duplication across test cases.


527-875: Comprehensive test coverage for location changes

This test suite thoroughly covers the location change scenarios mentioned in the PR objectives, including:

  • Transitions between different conferencing apps (Cal Video → Google Meet)
  • Static video link handling
  • Fallback behaviors when hosts lack default conferencing apps
  • Error scenarios for Cal Video failures

The tests effectively validate the fix for issue PRI-298.


320-373: Critical test for conferenceCredentialId handling

This test validates that conferenceCredentialId is properly included during reassignment, which is essential for teams using installed conferencing apps. This directly addresses one of the key issues mentioned in the PR objectives.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (2)
packages/app-store/webex/api/add.ts (1)

26-33: State parameter is an empty string – defeats CSRF protection

OAuth best-practice requires a non-guessable state value that is verified on the callback.
decodeOAuthState is called later but an empty string means no verification happens. At minimum generate a random nonce and persist it in the session:

+import crypto from "crypto";
 ...
-  const params = {
+  const state = crypto.randomBytes(16).toString("hex");
+  const params = {
     response_type: "code",
     client_id,
     redirect_uri: encodeURI(
       `${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`
     ),
-    scope: "spark:kms meeting:schedules_read meeting:schedules_write", //should be "A space-separated list of scopes being requested by your integration"
-    state: "",
+    scope:
+      "spark:kms meeting:schedules_read meeting:schedules_write", // space-separated list of scopes
+    state,
   };

Remember to save state (e.g. req.session.oauthState = state) and validate it inside decodeOAuthState.

packages/app-store/webex/api/callback.ts (1)

20-26: Potential double-encoding of redirect_uri

Here the redirect URI is first wrapped with encodeURI and then passed through URLSearchParams, which internally applies encodeURIComponent. That results in %25 sequences (e.g. https%3A%2F%2F… becomes https%253A%252F%252F…).
The authorization server usually rejects such double-encoded values.

Options:

  1. Drop the manual encodeURI and rely on URLSearchParams:
-  const redirectUri = encodeURI(`${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`);
+  const redirectUri = `${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`;
  1. Keep the manual encode here and in the /add endpoint but pass the already-encoded value to URLSearchParams using the second argument encode: false (node-18 feature) ― less portable.

Given the simplicity, option 1 is recommended; it also resolves the inconsistency highlighted in add.ts.

🧹 Nitpick comments (2)
packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (2)

320-320: Fix typo in test description

There's a duplicate word "with" in the test description.

-  test("should include conferenceCredentialId when reassigning booking with with fixed host as organizer", async () => {
+  test("should include conferenceCredentialId when reassigning booking with fixed host as organizer", async () => {

675-675: Remove commented code

This commented line should be removed as it doesn't provide any value.

-      // (await mockGetAppFromSlug()).mockReturnValue(undefined);
-
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84210dc and d04a16c.

📒 Files selected for processing (8)
  • packages/app-store/locations.ts (3 hunks)
  • packages/app-store/webex/api/add.ts (2 hunks)
  • packages/app-store/webex/api/callback.ts (2 hunks)
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts (2 hunks)
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (8 hunks)
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts (5 hunks)
  • packages/lib/server/service/bookingLocationService.test.ts (1 hunks)
  • packages/lib/server/service/bookingLocationService.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/app-store/webex/api/add.ts
  • packages/app-store/webex/api/callback.ts
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/app-store/locations.ts
  • packages/lib/server/service/bookingLocationService.test.ts
  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/app-store/webex/api/add.ts
  • packages/app-store/webex/api/callback.ts
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/app-store/locations.ts
  • packages/lib/server/service/bookingLocationService.test.ts
  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
**/*Service.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Service files must include Service suffix, use PascalCase matching exported class, and avoid generic names (e.g., MembershipService.ts)

Files:

  • packages/lib/server/service/bookingLocationService.ts
🧠 Learnings (10)
📓 Common learnings
Learnt from: CarinaWolli
PR: calcom/cal.com#22296
File: packages/lib/bookings/filterHostsBySameRoundRobinHost.ts:41-42
Timestamp: 2025-07-22T11:42:47.623Z
Learning: The filterHostsBySameRoundRobinHost function in packages/lib/bookings/filterHostsBySameRoundRobinHost.ts has a known limitation where it doesn't work correctly with fixed hosts or round robin groups. This is pre-existing technical debt that was already broken before the round robin groups feature. CarinaWolli has documented this in Linear issue CAL-6134 for future fix.
📚 Learning: in signup-view.tsx, when checking if redirecturl contains certain strings, using explicit && checks ...
Learnt from: Anshumancanrock
PR: calcom/cal.com#22570
File: apps/web/modules/signup-view.tsx:253-253
Timestamp: 2025-07-21T21:33:23.371Z
Learning: In signup-view.tsx, when checking if redirectUrl contains certain strings, using explicit && checks (redirectUrl && redirectUrl.includes()) is preferred over optional chaining (redirectUrl?.includes()) to ensure the result is always a boolean rather than potentially undefined. This approach provides cleaner boolean contracts for downstream conditional logic.

Applied to files:

  • packages/app-store/webex/api/add.ts
  • packages/app-store/webex/api/callback.ts
📚 Learning: the filterhostsbysameroundrobinhost function in packages/lib/bookings/filterhostsbysameroundrobinhos...
Learnt from: CarinaWolli
PR: calcom/cal.com#22296
File: packages/lib/bookings/filterHostsBySameRoundRobinHost.ts:41-42
Timestamp: 2025-07-22T11:42:47.623Z
Learning: The filterHostsBySameRoundRobinHost function in packages/lib/bookings/filterHostsBySameRoundRobinHost.ts has a known limitation where it doesn't work correctly with fixed hosts or round robin groups. This is pre-existing technical debt that was already broken before the round robin groups feature. CarinaWolli has documented this in Linear issue CAL-6134 for future fix.

Applied to files:

  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
📚 Learning: the office365calendar webhook handler in packages/app-store/office365calendar/api/webhook.ts is spec...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/app-store/office365calendar/api/webhook.ts:120-123
Timestamp: 2025-07-18T17:57:16.395Z
Learning: The office365calendar webhook handler in packages/app-store/office365calendar/api/webhook.ts is specifically designed for Office365 calendar integration, not as a generic webhook handler. Therefore, it's safe to assume that fetchAvailabilityAndSetCache method will be implemented in the Office365CalendarService, making explicit validation checks unnecessary.

Applied to files:

  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
📚 Learning: in cal.com's embed system, internal events like "__scrollbydistance" are fired by cal.com's own code...
Learnt from: hariombalhara
PR: calcom/cal.com#22547
File: packages/embeds/embed-core/src/lib/eventHandlers/scrollByDistanceEventHandler.ts:11-14
Timestamp: 2025-07-16T11:46:28.759Z
Learning: In Cal.com's embed system, internal events like "__scrollByDistance" are fired by Cal.com's own code, so runtime validation of event data structure is unnecessary since TypeScript type system guarantees type safety for internal events.

Applied to files:

  • packages/app-store/locations.ts
📚 Learning: in cal.com's calendar integration, both google calendar and outlook calendar are designed to allow m...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/prisma/schema.prisma:891-891
Timestamp: 2025-07-18T08:47:01.264Z
Learning: In Cal.com's calendar integration, both Google Calendar and Outlook Calendar are designed to allow multiple eventTypeIds to share the same subscription ID (googleChannelId or outlookSubscriptionId). This is an intentional design pattern to reuse existing subscriptions for efficiency rather than creating separate subscriptions for each event type. Therefore, unique constraints like `@@unique([outlookSubscriptionId, eventTypeId])` should not be added as they would break this subscription sharing functionality.

Applied to files:

  • packages/app-store/locations.ts
📚 Learning: applies to **/*.{service,repository}.ts : avoid dot-suffixes like `.service.ts` or `.repository.ts` ...
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*.{service,repository}.ts : Avoid dot-suffixes like `.service.ts` or `.repository.ts` for new files; reserve `.test.ts`, `.spec.ts`, `.types.ts` for their specific purposes

Applied to files:

  • packages/lib/server/service/bookingLocationService.test.ts
📚 Learning: in the insightsbookingservice (packages/lib/server/service/insightsbooking.ts), the constructor stor...
Learnt from: eunjae-lee
PR: calcom/cal.com#22702
File: packages/lib/server/service/insightsBooking.ts:120-124
Timestamp: 2025-07-24T08:39:06.185Z
Learning: In the InsightsBookingService (packages/lib/server/service/insightsBooking.ts), the constructor stores null for invalid options or filters but this is handled safely through null checks in buildFilterConditions() and buildAuthorizationConditions() methods. The service uses defensive programming to return safe fallback conditions (null or NOTHING_CONDITION) rather than throwing errors on invalid inputs.

Applied to files:

  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
📚 Learning: in the failedbookingsbyfield component (packages/features/insights/components/failedbookingsbyfield....
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.

Applied to files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
📚 Learning: for e2e integration tests that require real third-party service credentials (like outlook calendar),...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: .env.example:354-357
Timestamp: 2025-07-18T08:49:18.779Z
Learning: For E2E integration tests that require real third-party service credentials (like Outlook calendar), it's acceptable to temporarily include actual test account credentials in .env.example during feature development and validation, provided there's a clear plan to replace them with placeholder values before final release. Test credentials should be for dedicated test tenants/accounts, not production systems.

Applied to files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
🧬 Code Graph Analysis (4)
packages/app-store/webex/api/add.ts (1)
packages/lib/constants.ts (1)
  • WEBAPP_URL_FOR_OAUTH (22-22)
packages/app-store/webex/api/callback.ts (1)
packages/lib/constants.ts (1)
  • WEBAPP_URL_FOR_OAUTH (22-22)
packages/lib/server/service/bookingLocationService.ts (1)
packages/app-store/locations.ts (4)
  • LocationObject (202-212)
  • OrganizerDefaultConferencingAppType (70-70)
  • CalVideoLocationType (64-64)
  • getLocationValueForDB (379-408)
packages/features/ee/round-robin/roundRobinManualReassignment.ts (1)
packages/lib/server/service/bookingLocationService.ts (1)
  • BookingLocationService (89-247)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (16)
packages/app-store/webex/api/add.ts (1)

4-4: Constant swap looks correct

Changing to WEBAPP_URL_FOR_OAUTH aligns the file with the new OAuth-specific constant already used elsewhere. No further action needed here.

packages/app-store/webex/api/callback.ts (1)

3-3: Consistent constant usage – good catch

Switching to WEBAPP_URL_FOR_OAUTH keeps both endpoints in sync.

packages/app-store/locations.ts (3)

1-3: Good practice to track technical debt

Adding this TODO comment helps track the need for future consolidation and test coverage.


64-64: Good alias for improved readability

The CalVideoLocationType alias provides a clearer, more descriptive name while maintaining backward compatibility.


384-384: Improved type safety with explicit typing

Making the type explicit as number | undefined improves code clarity and type safety.

packages/features/ee/round-robin/handleRescheduleEventManager.ts (2)

76-88: Good error handling for video conferencing failures

This error handling appropriately catches Cal Video creation failures and provides clear feedback that the meeting was rescheduled even though the video link failed. This aligns with the PR's objective of improving conferencing app reliability.


169-169: Minor formatting improvement

packages/features/ee/round-robin/roundRobinManualReassignment.ts (4)

30-30: Proper import of the new service

The BookingLocationService import is correctly placed and follows the project structure.


158-172: Excellent refactoring using the centralized service

The refactoring properly centralizes the location determination logic using BookingLocationService.getLocationForHost. This addresses the PR objective of correctly updating locations during reassignment and ensures proper handling of conference credentials.


223-234: Good addition to handle credential extraction without organizer change

This logic ensures that conferenceCredentialId is properly extracted even when the organizer hasn't changed, addressing the missing credential issue mentioned in the PR objectives.


306-306: Proper propagation of conference credential ID

Adding conferenceCredentialId to the CalendarEvent ensures proper credential handling throughout the booking flow.

packages/lib/server/service/bookingLocationService.test.ts (1)

1-558: Excellent comprehensive test coverage

The test file provides thorough coverage of all BookingLocationService methods with well-structured tests covering:

  • Dynamic and static conferencing apps
  • Edge cases and error scenarios
  • Proper mocking and test isolation
  • Clear, descriptive test names

This level of test coverage ensures the service's reliability.

packages/lib/server/service/bookingLocationService.ts (4)

1-87: Well-structured type definitions with excellent documentation

The type definitions are comprehensive and use discriminated unions effectively for type safety. The inline documentation clearly explains the purpose and usage of each type.


107-140: Robust implementation with proper error handling

The method safely handles metadata parsing and gracefully returns null for invalid cases. Good separation of concerns between static and dynamic conferencing apps.


153-212: Well-designed location determination logic

The method implements a clear fallback chain and properly respects event type restrictions. Good reuse of getLocationDetailsFromType for consistent credential extraction.


236-246: Clean abstraction with consistent return values

The method provides a clean API by wrapping getLocationValueForDB and ensuring consistent null values instead of undefined.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
packages/app-store/webex/api/add.ts (1)

26-30: Double-check redirect-URI encoding parity between auth & token calls
In this request the redirect_uri value is passed to querystring.stringify without prior encoding, while the token-exchange step (callback.ts Line 20) pre-encodes the same value with encodeURI before URLSearchParams applies its own encoding.
Although encodeURI currently leaves the string unchanged (no spaces/UTF-8 chars), the two-step encoding in the token call could drift from the value used here if the path ever contains unsafe characters, breaking the OAuth “exact match” requirement.

Consider removing the redundant encodeURI in the token exchange for symmetry (preferred) or applying the same call here — but avoid a situation where one side is double-encoded and the other is not.

-  const redirectUri = encodeURI(`${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`);
+  const redirectUri = `${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`;
packages/app-store/webex/api/callback.ts (1)

20-20: Redundant encodeURI may lead to silent drift
URLSearchParams already performs percent-encoding on values; wrapping the URL in encodeURI beforehand adds no benefit for ASCII paths and risks double-encoding if the base constant ever contains encoded characters. Removing it simplifies the flow and guarantees the raw string matches the value sent in the initial authorization request.

-  const redirectUri = encodeURI(`${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`);
+  const redirectUri = `${WEBAPP_URL_FOR_OAUTH}/api/integrations/${config.slug}/callback`;
packages/features/ee/round-robin/handleRescheduleEventManager.ts (1)

76-88: Simplify redundant condition in Cal Video result check

The condition result.type.includes("_video") && result.type === "daily_video" is redundant since checking for exact equality to "daily_video" already ensures it includes "_video".

  const calVideoResult = results.find(
-    (result) => result.type.includes("_video") && result.type === "daily_video"
+    (result) => result.type === "daily_video"
  );
packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (2)

94-96: Consider extracting date calculation

The date calculation is repeated in the test. Consider extracting it to a helper or passing it as a parameter for better reusability.


320-320: Fix grammatical error in test description

The test description has a duplicate "with" word.

-  test("should include conferenceCredentialId when reassigning booking with with fixed host as organizer", async () => {
+  test("should include conferenceCredentialId when reassigning booking with fixed host as organizer", async () => {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84210dc and d04a16c.

📒 Files selected for processing (8)
  • packages/app-store/locations.ts (3 hunks)
  • packages/app-store/webex/api/add.ts (2 hunks)
  • packages/app-store/webex/api/callback.ts (2 hunks)
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts (2 hunks)
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (8 hunks)
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts (5 hunks)
  • packages/lib/server/service/bookingLocationService.test.ts (1 hunks)
  • packages/lib/server/service/bookingLocationService.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/app-store/webex/api/callback.ts
  • packages/app-store/webex/api/add.ts
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/app-store/locations.ts
  • packages/lib/server/service/bookingLocationService.test.ts
  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/app-store/webex/api/callback.ts
  • packages/app-store/webex/api/add.ts
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/app-store/locations.ts
  • packages/lib/server/service/bookingLocationService.test.ts
  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
**/*Service.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Service files must include Service suffix, use PascalCase matching exported class, and avoid generic names (e.g., MembershipService.ts)

Files:

  • packages/lib/server/service/bookingLocationService.ts
🧠 Learnings (10)
📓 Common learnings
Learnt from: CarinaWolli
PR: calcom/cal.com#22296
File: packages/lib/bookings/filterHostsBySameRoundRobinHost.ts:41-42
Timestamp: 2025-07-22T11:42:47.623Z
Learning: The filterHostsBySameRoundRobinHost function in packages/lib/bookings/filterHostsBySameRoundRobinHost.ts has a known limitation where it doesn't work correctly with fixed hosts or round robin groups. This is pre-existing technical debt that was already broken before the round robin groups feature. CarinaWolli has documented this in Linear issue CAL-6134 for future fix.
📚 Learning: in signup-view.tsx, when checking if redirecturl contains certain strings, using explicit && checks ...
Learnt from: Anshumancanrock
PR: calcom/cal.com#22570
File: apps/web/modules/signup-view.tsx:253-253
Timestamp: 2025-07-21T21:33:23.371Z
Learning: In signup-view.tsx, when checking if redirectUrl contains certain strings, using explicit && checks (redirectUrl && redirectUrl.includes()) is preferred over optional chaining (redirectUrl?.includes()) to ensure the result is always a boolean rather than potentially undefined. This approach provides cleaner boolean contracts for downstream conditional logic.

Applied to files:

  • packages/app-store/webex/api/callback.ts
  • packages/app-store/webex/api/add.ts
📚 Learning: the filterhostsbysameroundrobinhost function in packages/lib/bookings/filterhostsbysameroundrobinhos...
Learnt from: CarinaWolli
PR: calcom/cal.com#22296
File: packages/lib/bookings/filterHostsBySameRoundRobinHost.ts:41-42
Timestamp: 2025-07-22T11:42:47.623Z
Learning: The filterHostsBySameRoundRobinHost function in packages/lib/bookings/filterHostsBySameRoundRobinHost.ts has a known limitation where it doesn't work correctly with fixed hosts or round robin groups. This is pre-existing technical debt that was already broken before the round robin groups feature. CarinaWolli has documented this in Linear issue CAL-6134 for future fix.

Applied to files:

  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
📚 Learning: the office365calendar webhook handler in packages/app-store/office365calendar/api/webhook.ts is spec...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/app-store/office365calendar/api/webhook.ts:120-123
Timestamp: 2025-07-18T17:57:16.395Z
Learning: The office365calendar webhook handler in packages/app-store/office365calendar/api/webhook.ts is specifically designed for Office365 calendar integration, not as a generic webhook handler. Therefore, it's safe to assume that fetchAvailabilityAndSetCache method will be implemented in the Office365CalendarService, making explicit validation checks unnecessary.

Applied to files:

  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
📚 Learning: in cal.com's embed system, internal events like "__scrollbydistance" are fired by cal.com's own code...
Learnt from: hariombalhara
PR: calcom/cal.com#22547
File: packages/embeds/embed-core/src/lib/eventHandlers/scrollByDistanceEventHandler.ts:11-14
Timestamp: 2025-07-16T11:46:28.759Z
Learning: In Cal.com's embed system, internal events like "__scrollByDistance" are fired by Cal.com's own code, so runtime validation of event data structure is unnecessary since TypeScript type system guarantees type safety for internal events.

Applied to files:

  • packages/app-store/locations.ts
📚 Learning: in cal.com's calendar integration, both google calendar and outlook calendar are designed to allow m...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: packages/prisma/schema.prisma:891-891
Timestamp: 2025-07-18T08:47:01.264Z
Learning: In Cal.com's calendar integration, both Google Calendar and Outlook Calendar are designed to allow multiple eventTypeIds to share the same subscription ID (googleChannelId or outlookSubscriptionId). This is an intentional design pattern to reuse existing subscriptions for efficiency rather than creating separate subscriptions for each event type. Therefore, unique constraints like `@@unique([outlookSubscriptionId, eventTypeId])` should not be added as they would break this subscription sharing functionality.

Applied to files:

  • packages/app-store/locations.ts
📚 Learning: applies to **/*.{service,repository}.ts : avoid dot-suffixes like `.service.ts` or `.repository.ts` ...
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*.{service,repository}.ts : Avoid dot-suffixes like `.service.ts` or `.repository.ts` for new files; reserve `.test.ts`, `.spec.ts`, `.types.ts` for their specific purposes

Applied to files:

  • packages/lib/server/service/bookingLocationService.test.ts
📚 Learning: in the insightsbookingservice (packages/lib/server/service/insightsbooking.ts), the constructor stor...
Learnt from: eunjae-lee
PR: calcom/cal.com#22702
File: packages/lib/server/service/insightsBooking.ts:120-124
Timestamp: 2025-07-24T08:39:06.185Z
Learning: In the InsightsBookingService (packages/lib/server/service/insightsBooking.ts), the constructor stores null for invalid options or filters but this is handled safely through null checks in buildFilterConditions() and buildAuthorizationConditions() methods. The service uses defensive programming to return safe fallback conditions (null or NOTHING_CONDITION) rather than throwing errors on invalid inputs.

Applied to files:

  • packages/lib/server/service/bookingLocationService.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
📚 Learning: in the failedbookingsbyfield component (packages/features/insights/components/failedbookingsbyfield....
Learnt from: eunjae-lee
PR: calcom/cal.com#22106
File: packages/features/insights/components/FailedBookingsByField.tsx:65-71
Timestamp: 2025-07-15T12:59:34.389Z
Learning: In the FailedBookingsByField component (packages/features/insights/components/FailedBookingsByField.tsx), although routingFormId is typed as optional in useInsightsParameters, the system automatically enforces a routing form filter, so routingFormId is always present in practice. This means the data always contains only one entry, making the single-entry destructuring approach safe.

Applied to files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
📚 Learning: for e2e integration tests that require real third-party service credentials (like outlook calendar),...
Learnt from: vijayraghav-io
PR: calcom/cal.com#21072
File: .env.example:354-357
Timestamp: 2025-07-18T08:49:18.779Z
Learning: For E2E integration tests that require real third-party service credentials (like Outlook calendar), it's acceptable to temporarily include actual test account credentials in .env.example during feature development and validation, provided there's a clear plan to replace them with placeholder values before final release. Test credentials should be for dedicated test tenants/accounts, not production systems.

Applied to files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
🧬 Code Graph Analysis (5)
packages/app-store/webex/api/callback.ts (1)
packages/lib/constants.ts (1)
  • WEBAPP_URL_FOR_OAUTH (22-22)
packages/app-store/webex/api/add.ts (1)
packages/lib/constants.ts (1)
  • WEBAPP_URL_FOR_OAUTH (22-22)
packages/lib/server/service/bookingLocationService.test.ts (1)
packages/lib/server/service/bookingLocationService.ts (1)
  • BookingLocationService (89-247)
packages/lib/server/service/bookingLocationService.ts (1)
packages/app-store/locations.ts (4)
  • LocationObject (202-212)
  • OrganizerDefaultConferencingAppType (70-70)
  • CalVideoLocationType (64-64)
  • getLocationValueForDB (379-408)
packages/features/ee/round-robin/roundRobinManualReassignment.ts (1)
packages/lib/server/service/bookingLocationService.ts (1)
  • BookingLocationService (89-247)
🔇 Additional comments (13)
packages/app-store/webex/api/add.ts (1)

4-4: Consistent constant usage looks good
Switching to WEBAPP_URL_FOR_OAUTH aligns this endpoint with the new OAuth-specific base URL introduced in @calcom/lib/constants.

packages/app-store/webex/api/callback.ts (1)

3-3: Import update acknowledged
Using WEBAPP_URL_FOR_OAUTH keeps this file consistent with the auth-step change.

packages/app-store/locations.ts (2)

1-3: Good documentation of technical debt

The TODO comment clearly indicates the planned consolidation with BookingLocationService, which aligns with the PR's goal of centralizing location management logic.


64-64: Good improvements to type safety and exports

  • Exporting CalVideoLocationType provides a clearer semantic name for the Daily location type
  • Explicit typing of conferenceCredentialId as number | undefined improves type safety

Also applies to: 384-384

packages/features/ee/round-robin/handleRescheduleEventManager.ts (1)

169-169: Good formatting improvement

Adding a blank line before cloning references improves code readability by separating logical sections.

packages/features/ee/round-robin/roundRobinManualReassignment.ts (2)

159-172: Excellent integration of BookingLocationService

The implementation properly:

  • Determines event type characteristics (managed/team)
  • Uses the centralized service for location determination
  • Handles both static links and dynamic conferencing apps correctly

224-233: Good handling of conferenceCredentialId extraction

Properly extracts the conferenceCredentialId even when the organizer hasn't changed, ensuring consistent handling across all reassignment scenarios.

packages/lib/server/service/bookingLocationService.test.ts (1)

1-558: Excellent test coverage

The test suite provides comprehensive coverage for all BookingLocationService methods with:

  • Well-organized test structure
  • Thorough edge case testing
  • Proper mock setup and cleanup

Consider adding a test case for when getLocationValueForDB returns an empty string (triggering the fallback to DailyLocationType), though this might be an edge case handled internally.

packages/lib/server/service/bookingLocationService.ts (1)

1-247: Well-designed service implementation

The BookingLocationService is excellently implemented with:

  • Clear separation of concerns between the three methods
  • Comprehensive JSDoc documentation with examples
  • Proper null handling and defensive programming
  • Strong type safety with well-defined interfaces

The service successfully centralizes the booking location logic as intended by the PR objectives.

packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (4)

30-50: Well-structured type definitions for test data

The type definitions provide good type safety and clarity for the test data structures.


139-159: Clean assertion helper for EventManager verification

Good abstraction that makes test assertions more readable and maintainable.


177-229: Comprehensive mocking of EventManager reschedule behavior

Excellent mock implementation that covers various scenarios including static links, different conferencing apps, and failure cases. This provides realistic test conditions.


528-875: Excellent test coverage for location change scenarios

The new test suite provides comprehensive coverage of location change functionality during round robin reassignment. The tests cover:

  • Different conferencing app transitions
  • Fallback behavior
  • Static video links
  • Error handling

The helper functions are well-structured and promote test maintainability.

@hariombalhara hariombalhara force-pushed the fix-booking-reassign-location-change branch from d04a16c to bb6367b Compare August 4, 2025 13:13
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (1)

844-849: Fix duplicate event type ID.

Event type ID 3 is used in multiple tests, which could cause conflicts or confusion. Each test should use unique IDs to avoid potential issues.

-            id: 3,
+            id: 5,
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d04a16c and bb6367b.

📒 Files selected for processing (3)
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts (2 hunks)
  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (8 hunks)
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/features/ee/round-robin/handleRescheduleEventManager.ts
  • packages/features/ee/round-robin/roundRobinManualReassignment.ts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • packages/features/ee/round-robin/roundRobinManualReassignment.test.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install dependencies / Yarn install & cache
🔇 Additional comments (5)
packages/features/ee/round-robin/roundRobinManualReassignment.test.ts (5)

20-137: Excellent refactoring with structured test data builders.

The introduction of factory functions for test data creation significantly improves test maintainability and readability. The type definitions are well-structured, and the builders follow good patterns with sensible defaults and flexible overrides.


139-234: Well-designed mock and assertion helpers.

The helper functions provide excellent abstractions that make the tests more readable and maintainable. The mockEventManagerReschedule function particularly well simulates real-world conferencing scenarios including failure cases, which is crucial for comprehensive testing.


239-526: Comprehensive test coverage with improved structure.

The refactored tests maintain excellent coverage of the reassignment functionality while benefiting from the new structured approach. The tests properly verify all aspects including workflow updates, conference credentials, and email notifications.


528-669: Excellent coverage for location change scenarios.

This new test suite directly addresses the core issue described in the PR objectives. The tests comprehensively verify that location updates work correctly when reassigning between hosts with different default conferencing apps, which was the main problem being solved.


831-874: Proper error handling test for conferencing failures.

This test correctly verifies that the system handles conferencing setup failures gracefully while still completing the meeting rescheduling process. The error message assertion ensures proper user feedback in failure scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ready-for-e2e teams area: teams, round robin, collective, managed event-types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants