fix(bookings): propagate Google Meet videoCallUrl metadata#29352
fix(bookings): propagate Google Meet videoCallUrl metadata#293524arjun wants to merge 3 commits into
Conversation
|
Welcome to Cal.diy, @4arjun! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis pull request refactors how booking metadata is handled for webhooks and API responses. It adds helper functions to normalize and filter Prisma JSON values down to primitive types suitable for webhook payloads. For Google Meet bookings, it introduces logic to prefer the Google Calendar event's conference data when available. The metadata construction flow now merges booking metadata, request metadata, and computed videoCallUrl details, filters the result for webhook safety, and consistently exposes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/features/bookings/lib/service/RegularBookingService.ts (1)
2028-2033:⚠️ Potential issue | 🟠 Major | 🏗️ Heavy liftPotential inconsistency: reschedule path still uses
results[0]for Google Meet metadata.The create path was fixed to prefer
googleCalResult?.createdEvent(lines 2100-2118), but the reschedule path here still extractshangoutLink,conferenceData, andentryPointsfromresults[0]?.updatedEvent/createdEvent. This could exhibit the same fragility as the original bug if Google Calendar is not the first integration result during a reschedule.Consider applying the same fix pattern used in the create path:
- Find the Google Calendar result using
findIndex- Prefer its updatedEvent/createdEvent for extracting hangoutLink and conference metadata
- Fall back to
results[0]only if Google Calendar result is not found🔄 Suggested fix pattern (similar to create path)
+ const googleCalIndex = updateManager.referencesToCreate.findIndex( + (ref) => ref.type === "google_calendar" + ); + const googleCalResult = results[googleCalIndex]; + const updatedOrCreatedEventWithAdditionalInformation = Array.isArray(googleCalResult?.updatedEvent) + ? googleCalResult.updatedEvent[0] + : (googleCalResult?.updatedEvent ?? googleCalResult?.createdEvent ?? + (Array.isArray(results[0]?.updatedEvent) + ? results[0]?.updatedEvent[0] + : (results[0]?.updatedEvent ?? results[0]?.createdEvent))); - const createdOrUpdatedEvent = Array.isArray(results[0]?.updatedEvent) - ? results[0]?.updatedEvent[0] - : (results[0]?.updatedEvent ?? results[0]?.createdEvent); - metadata.hangoutLink = createdOrUpdatedEvent?.hangoutLink; - metadata.conferenceData = createdOrUpdatedEvent?.conferenceData; - metadata.entryPoints = createdOrUpdatedEvent?.entryPoints; + metadata.hangoutLink = updatedOrCreatedEventWithAdditionalInformation?.hangoutLink; + metadata.conferenceData = updatedOrCreatedEventWithAdditionalInformation?.conferenceData; + metadata.entryPoints = updatedOrCreatedEventWithAdditionalInformation?.entryPoints;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/features/bookings/lib/service/RegularBookingService.ts` around lines 2028 - 2033, The reschedule path still reads Google Meet metadata from results[0] which is fragile; update the logic that sets metadata.hangoutLink, metadata.conferenceData, and metadata.entryPoints to first locate the Google Calendar result (use the same findIndex/variable name pattern used in the create path, e.g., googleCalIndex/googleCalResult), prefer googleCalResult?.updatedEvent ?? googleCalResult?.createdEvent as createdOrUpdatedEvent, and only fall back to results[0]?.updatedEvent ?? results[0]?.createdEvent if no Google Calendar result is found; update the existing createdOrUpdatedEvent variable assignment in RegularBookingService to follow this pattern so the reschedule path mirrors the create fix.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@packages/features/bookings/lib/service/RegularBookingService.ts`:
- Around line 2028-2033: The reschedule path still reads Google Meet metadata
from results[0] which is fragile; update the logic that sets
metadata.hangoutLink, metadata.conferenceData, and metadata.entryPoints to first
locate the Google Calendar result (use the same findIndex/variable name pattern
used in the create path, e.g., googleCalIndex/googleCalResult), prefer
googleCalResult?.updatedEvent ?? googleCalResult?.createdEvent as
createdOrUpdatedEvent, and only fall back to results[0]?.updatedEvent ??
results[0]?.createdEvent if no Google Calendar result is found; update the
existing createdOrUpdatedEvent variable assignment in RegularBookingService to
follow this pattern so the reschedule path mirrors the create fix.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: af073d2d-0444-4d60-936a-b8f94523c737
📒 Files selected for processing (2)
packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.tspackages/features/bookings/lib/service/RegularBookingService.ts
|
This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active. |
|
This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active. |
|
@bandhan-majumder Could you please take a look at this? |
What does this PR do?
Fixes Google Meet booking metadata propagation so the generated Meet URL from Google Calendar is written to
metadata.videoCallUrl.Root cause
The Google Calendar event creation flow was successfully creating a Google Meet link, but the booking metadata layer was not reliably reading that link from the Google Calendar result.
In the confirmed booking creation path, metadata extraction relied on
results[0].createdEvent. That is fragile because the Google Calendar result is not guaranteed to be the first result once conferencing/calendar integrations are processed. As a result, the Meet link could exist on the Google Calendar event while the final booking metadata was built withoutvideoCallUrl.The final booking response also reused the original booking object metadata, so even when metadata was computed later in the flow, the returned booking could still expose stale
{}metadata.What changed
results[0].videoCallUrl.videoCallUrl,{ "metadata": {} } After this change, booking creation returns, persists, and sends webhook metadata with: { "metadata": { "videoCallUrl": "https://meet.google.com/..." } }This keeps the fix scoped to the booking creation flow and adds regression coverage for the Google Meet case.
Visual Demo
Before.mp4
After.mp4
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Run the full changed test file
TZ=UTC yarn vitest run packages/features/bookings/lib/handleNewBooking/test/fresh-booking.test.tsChecklist