fix: rollback booking status to CANCELLED on calendar sync failure#28484
Open
sdip0971 wants to merge 1 commit intocalcom:mainfrom
Open
fix: rollback booking status to CANCELLED on calendar sync failure#28484sdip0971 wants to merge 1 commit intocalcom:mainfrom
sdip0971 wants to merge 1 commit intocalcom:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/features/bookings/lib/service/RegularBookingService.ts">
<violation number="1" location="packages/features/bookings/lib/service/RegularBookingService.ts:2353">
P1: Booking cancellation is keyed to "all integrations failed" instead of calendar-sync failure, causing false cancellations and missed calendar-failure rollbacks.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Member
sahitya-chandra
left a comment
There was a problem hiding this comment.
Can you add the steps for how to reproduce this issue?
and video evidence of the issue
18648c3 to
6755e91
Compare
Author
|
@sahitya-chandra Thanks for the review! Steps to Reproduce:
Here is the video evidence of the fix successfully catching the failure and updating the UI: Screen.Recording.2026-03-18.at.8.54.16.PM.mov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Fixes #28397
Fixes a state leak issue where a booking is permanently saved as ACCEPTED in the database even if EventManager.create fails to sync the event to the external calendar.
Previously, the backend would log the BookingCreatingMeetingFailed error but continue execution, returning a 200 OK to the frontend and resulting in a false "Success" UI state for the user.
How it works
This PR adds a synchronous compensation transaction inside RegularBookingService.ts. If the calendar integration fails:
It immediately executes a Prisma update to change the booking status to CANCELLED.
It sets a cancellationReason explicitly documenting the calendar integration failure.
It throws an HttpError(500) to halt backend execution. This forces the frontend's useMutation hook into its onError state, preventing the success redirect and ensuring the UI correctly displays the error toast.
Testing conditions (like isDryRun) are respected to ensure this doesn't break existing test suites.