Skip to content

Comments

fix: double-booking on reserved slots#23947

Closed
saurabhraghuvanshii wants to merge 5 commits intocalcom:mainfrom
saurabhraghuvanshii:booking
Closed

fix: double-booking on reserved slots#23947
saurabhraghuvanshii wants to merge 5 commits intocalcom:mainfrom
saurabhraghuvanshii:booking

Conversation

@saurabhraghuvanshii
Copy link
Contributor

What does this PR do?

  • Added reservedSlotUid parameter to booking flow to validate slot ownership

  • Enhanced handleNewBooking to check for reserved slots before creating bookings

  • Integrated slot reservation ID management into Booker store for consistent state

  • Added automatic cleanup of reserved slots after successful booking creation

  • Fixes [Bug] Booking flow allows double-booking reserved slots #23938

  • Fixes CAL-6430

Visual Demo (For contributors especially)

A visual demonstration is strongly recommended, for both the original and new change (video / image - any one).

Video Demo (if applicable):

  • Show screen recordings of the issue or feature.
  • Demonstrate how to reproduce the issue, the behavior before and after the change.

Image Demo (if applicable):

  • Add side-by-side screenshots of the original and updated change.
  • Highlight any significant change(s).

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • 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.

@saurabhraghuvanshii saurabhraghuvanshii requested a review from a team September 19, 2025 13:42
@saurabhraghuvanshii saurabhraghuvanshii requested a review from a team as a code owner September 19, 2025 13:42
@vercel
Copy link

vercel bot commented Sep 19, 2025

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

A member of the Team first needs to authorize it.

@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Sep 19, 2025
@graphite-app graphite-app bot requested a review from a team September 19, 2025 13:42
@github-actions github-actions bot added bookings area: bookings, availability, timezones, double booking High priority Created by Linear-GitHub Sync reactive⚡︎ 🐛 bug Something isn't working labels Sep 19, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2025

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the Stale label Oct 4, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This change threads a reserved slot identifier through the booking flow and enforces reservation checks. The Booker store adds slotReservationId with a setter. Hooks (useSlots, useHandleBookEvent) read from this store and pass the value as reservedSlotUid in booking inputs. The booking input schema and the booking-to-mutation mapper now include reservedSlotUid. handleNewBooking reads reservedSlotUid, performs pre-booking checks against reserved slots (ownership or availability) when not a dry run, and deletes the reserved slot after successful booking. useSlots/useHandleBookEvent variants under platform/features are aligned to source the ID from the Booker store.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Linked Issues Check ⚠️ Warning The implementation correctly accepts and validates reservedSlotUid from the client and integrates it into handleNewBooking as required by issues #23938 and CAL-6430, but it does not perform the booking creation and reservation deletion within a single atomic transaction nor address reservation support for round-robin and collective events, and it lacks persistence of reservedSlotUid across sessions. To satisfy the linked issues, modify handleNewBooking to wrap booking creation and reservation cleanup in one atomic database transaction so that cleanup failures rollback the booking, extend reserved-slot support to round-robin and collective event flows, and implement persistent storage (e.g., localStorage) of reservedSlotUid in the client.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title succinctly communicates the primary intent of the changeset which is to fix double-booking on reserved slots, and it accurately reflects the main issue addressed without extraneous detail.
Out of Scope Changes Check ✅ Passed All modifications in this pull request are limited to implementing the reservedSlotUid parameter and its propagation through the Booker store, mutation input mapping, schema, handler, and hooks, with no unrelated or extraneous code changes introduced.
Description Check ✅ Passed The pull request description clearly outlines the new reservedSlotUid parameter, enhancements to handleNewBooking, store integration, cleanup logic, and references the fixed issues, making it directly relevant to the changeset.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot removed the Stale label Oct 7, 2025
Copy link
Contributor

@kart1ka kart1ka left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. Can you please attach a loom video showing your fix works? We will also need test for this fix. Can you please add that as well?

@kart1ka kart1ka marked this pull request as draft October 7, 2025 03:26
@github-actions
Copy link
Contributor

This PR is being marked as stale due to inactivity.

@supalarry
Copy link
Contributor

Thank you for the contribution! I will be closing this PR though because it has been stale and another PR #24670 will adress this issue 🙏

@supalarry supalarry closed this Nov 18, 2025
@saurabhraghuvanshii saurabhraghuvanshii deleted the booking branch November 18, 2025 10:31
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 community Created by Linear-GitHub Sync High priority Created by Linear-GitHub Sync reactive⚡︎ size/L Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Booking flow allows double-booking reserved slots

3 participants