-
Notifications
You must be signed in to change notification settings - Fork 10.2k
fix: prevent booking references with empty UIDs when calendar event creation fails #22986
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
base: main
Are you sure you want to change the base?
Conversation
…reation fails - Filter out failed calendar events before creating booking references in EventManager.create() and updateLocation() - Add warning logs when skipping reference creation due to failures - Ensures BookingReference schema validation (uid must be non-empty) is respected - Maintains existing error logging for debugging calendar creation failures Log messages for debugging: - Look for 'createEvent failed' messages in CalendarManager.ts for calendar creation failures - Look for 'Skipping booking reference creation for failed [type] event' warnings when references are filtered out - Look for 'BookingCreatingMeetingFailed' error code in handleNewBooking.ts when all calendar events fail Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
- Remove expectation of booking reference with empty UID when calendar creation fails - Aligns with new behavior that prevents schema constraint violations - Test now expects no booking reference for failed calendar events - Remove outdated comment about uncertain purpose of empty UID references Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
fix: prevent booking references with empty UIDs when calendar event creation fails
Summary
This PR fixes an issue where booking references were being created with empty UIDs when Google Calendar event creation failed. The system was previously writing booking references to the database even when calendar events failed to be created, violating the BookingReference schema constraint that requires non-empty UIDs.
Root Cause: In
EventManager.ts
, thereferencesToCreate
array was being populated from all calendar/video creation results, including failed ones whereresult.createdEvent?.id
was null/undefined, leading to empty UID strings.Solution: Added filtering logic in both
EventManager.create()
andEventManager.updateLocation()
methods to exclude failed calendar events before creating booking references. Only events withresult.success === true
AND a valid UID are now included.Changes Made:
EventManager.create()
to filter results before mapping toreferencesToCreate
EventManager.updateLocation()
with the same filtering logicCalendarManager.ts
for debugging calendar failuresReview & Testing Checklist for Human
result.success && (valid UID)
condition properly distinguishes between successful and failed calendar/video eventsDiagram
Notes
Log Messages for Debugging:
createEvent failed
messages in CalendarManager.ts for calendar creation failuresSkipping booking reference creation for failed [type] event
warnings when references are filtered outBookingCreatingMeetingFailed
error code in handleNewBooking.ts when all calendar events failSchema Constraint: The BookingReference model requires non-empty uid field (
@zod.min(1)
), so filtering out empty UIDs prevents database constraint violations.Link to Devin run: https://app.devin.ai/sessions/102305fdf3db4f80b2e92e5e047bf037
Requested by: @joeauyeung