Skip to content

Conversation

anikdhabal
Copy link
Contributor

@anikdhabal anikdhabal commented Jul 17, 2025

What does this PR do?

A booking was rescheduled from a past booking. The original booking's end time was June 23rd, and it was rescheduled on July 10th — resulting in a gap of more than 14 days. Since we set the room expiry to 14 days+endtime, it’s throwing an error when trying to update using an expired room in the API

Copy link

vercel bot commented Jul 17, 2025

@anikdhabal is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Jul 17, 2025

Walkthrough

The changes update the reschedule method of the EventManager class to handle expiration logic for "daily video room" integrations. The booking query now includes the endTime field. New logic checks if a booking with the location "integrations:daily" has expired by verifying if the current date is more than 14 days after the booking's end time. An isDailyVideoRoomExpired flag is introduced and incorporated into the conditions that determine whether to update booking references and trigger location update logic during rescheduling. The method's control flow is modified accordingly.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/lib/EventManager.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-playwright".

(The package "eslint-plugin-playwright" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-playwright@latest --save-dev

The plugin "eslint-plugin-playwright" was referenced from the config file in ".eslintrc.js".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • @coderabbitai modularize this function.
  • 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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 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.

@graphite-app graphite-app bot requested a review from a team July 17, 2025 12:16
@keithwillcode keithwillcode added the core area: core, team members only label Jul 17, 2025
@dosubot dosubot bot added the 🐛 bug Something isn't working label Jul 17, 2025
Copy link

graphite-app bot commented Jul 17, 2025

Graphite Automations

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

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

"Add ready-for-e2e label" took an action on this PR • (07/17/25)

1 label 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: 0

🧹 Nitpick comments (2)
packages/lib/EventManager.ts (2)

589-596: Well-implemented expiration logic with good practices.

The Daily video room expiration check is correctly implemented with proper Date handling and clear variable naming. The 14-day expiration period appears reasonable for video room lifecycles.

Consider making the expiration period configurable through an environment variable or constant for better maintainability:

+const DAILY_VIDEO_ROOM_EXPIRY_DAYS = 14;
+
 if (evt.location === "integrations:daily") {
   const originalBookingEndTime = new Date(booking.endTime);
-  const roomExpiryTime = new Date(originalBookingEndTime.getTime() + 14 * 24 * 60 * 60 * 1000);
+  const roomExpiryTime = new Date(originalBookingEndTime.getTime() + DAILY_VIDEO_ROOM_EXPIRY_DAYS * 24 * 60 * 60 * 1000);
   const now = new Date();
   isDailyVideoRoomExpired = now > roomExpiryTime;
 }

589-596: Consider adding logging for better observability.

The expiration logic implementation is solid. Consider adding a log statement when a Daily video room is detected as expired for better debugging and monitoring:

 if (evt.location === "integrations:daily") {
   const originalBookingEndTime = new Date(booking.endTime);
   const roomExpiryTime = new Date(originalBookingEndTime.getTime() + 14 * 24 * 60 * 60 * 1000);
   const now = new Date();
   isDailyVideoRoomExpired = now > roomExpiryTime;
+  
+  if (isDailyVideoRoomExpired) {
+    log.info("Daily video room expired, will create new room", {
+      bookingId: booking.id,
+      originalEndTime: originalBookingEndTime,
+      roomExpiryTime: roomExpiryTime
+    });
+  }
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c472bce and ad6bcbb.

📒 Files selected for processing (1)
  • packages/lib/EventManager.ts (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: alishaz-polymath
PR: calcom/cal.com#22304
File: packages/prisma/schema.prisma:1068-1071
Timestamp: 2025-07-16T05:10:22.863Z
Learning: In PR #22304 for Cal.com private link expiration features, the `maxUsageCount` field was intentionally set to default to 1 (non-nullable) as a breaking change, making all existing private links single-use after migration. This was a deliberate design decision by alishaz-polymath.
⏰ 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). (3)
  • GitHub Check: Check for E2E label
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Security Check
🔇 Additional comments (3)
packages/lib/EventManager.ts (3)

552-552: LGTM! Necessary field addition for expiration logic.

The endTime field addition is required for the Daily video room expiration check and follows the existing query pattern correctly.


599-599: Correct integration of expiration logic into booking reference updates.

The addition of isDailyVideoRoomExpired to the shouldUpdateBookingReferences condition is logical and consistent with the existing pattern. Expired Daily rooms should indeed trigger booking reference updates similar to location changes.


623-623: Proper integration of expiration logic into location update flow.

The inclusion of isDailyVideoRoomExpired in the location update condition correctly ensures that expired Daily video rooms trigger the updateLocation method, which will create a new room. This completes the logical flow for handling expired rooms.

@anikdhabal anikdhabal enabled auto-merge (squash) July 17, 2025 12:23
Copy link
Contributor

E2E results are ready!

@anikdhabal anikdhabal merged commit 4dc2260 into calcom:main Jul 17, 2025
58 of 64 checks passed
@@ -609,7 +620,7 @@ export default class EventManager {
updatedBookingReferences.push(...createdEvent.referencesToCreate);
} else {
// If the reschedule doesn't require confirmation, we can "update" the events and meetings to new time.
if (isLocationChanged || isBookingRequestedReschedule) {
if (isLocationChanged || isBookingRequestedReschedule || isDailyVideoRoomExpired) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@anikdhabal you have mentioned creating new room when old one expires but you can also just update the meeting expiry time

Copy link
Contributor Author

@anikdhabal anikdhabal Jul 18, 2025

Choose a reason for hiding this comment

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

@Udit-takkar But how can we update a room's expiry if the room is already expired? To update the expiry, we need to pass that room's id in the api — but it's already expired

Copy link
Contributor Author

@anikdhabal anikdhabal Jul 18, 2025

Choose a reason for hiding this comment

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

Aslo as per their docs:-
Rooms that have an exp in the past are not returned by the [list rooms endpoint](https://docs.daily.co/reference/rest-api/rooms/list-rooms); they are zombies of a sort. An existing meeting can continue in the room, but from the perspective of most of the API, the room does not exist!

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh okay so the meeting was rescheduled very late

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working core area: core, team members only ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants