Skip to content

Conversation

zomars
Copy link
Contributor

@zomars zomars commented Jul 11, 2025

fix for revert #22400

  • Reproduces double-booking when two guests book same timeslot 1-2s apart
  • Enables both calendar-cache and calendar-cache-serve feature flags
  • Uses parallel browser contexts to simulate concurrent booking attempts
  • Verifies both bookings succeed and create double-booking scenario

What does this PR do?

  • Fixes #XXXX (GitHub issue number)
  • Fixes CAL-XXXX (Linear issue number - should be visible at the bottom of the GitHub issue description)

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.

How should this be tested?

  • Are there environment variables that should be set?
  • What are the minimal test data to have?
  • What is expected (happy path) to have (input and output)?
  • Any other important info that could help to test that PR

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my changes generate no new warnings

devin-ai-integration bot and others added 16 commits June 30, 2025 22:51
- Reproduces double-booking when two guests book same timeslot 1-2s apart
- Enables both calendar-cache and calendar-cache-serve feature flags
- Uses parallel browser contexts to simulate concurrent booking attempts
- Verifies both bookings succeed and create double-booking scenario

Co-Authored-By: zomars@cal.com <zomars@me.com>
- Change page.waitForTimeout(1500) to use correct page context
- Fix timeslot selection to ensure both contexts book same slot
- Remove incorrect host assertion and add logging to demonstrate race condition
- Test now successfully reproduces double-booking bug locally
- Fixes 'end of central directory record signature not found' error

Co-Authored-By: zomars@cal.com <zomars@me.com>
Signed-off-by: Omar López <zomars@me.com>
Copy link

vercel bot commented Jul 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Jul 13, 2025 2:43pm
cal-eu ⬜️ Ignored (Inspect) Visit Preview Jul 13, 2025 2:43pm

@graphite-app graphite-app bot requested a review from a team July 11, 2025 03:12
@keithwillcode keithwillcode added core area: core, team members only foundation labels Jul 11, 2025
@dosubot dosubot bot added automated-tests area: unit tests, e2e tests, playwright bookings area: bookings, availability, timezones, double booking labels Jul 11, 2025
Copy link

delve-auditor bot commented Jul 11, 2025

No security or compliance issues detected. Reviewed everything up to 8825052.

Security Overview
  • 🔎 Scanned files: 1 changed file(s)
Detected Code Changes
Change Type Relevant files
Enhancement ► booking-race-condition.e2e.ts
    Add test suite for concurrent booking behavior

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic found 1 issue across 1 file. Review it in cubic.dev

React with 👍 or 👎 to teach cubic. Tag @cubic-dev-ai to give specific feedback.

await mockGoogleCalendarAPI(page2);

// Navigate to booking page
await page1.goto(`/org/${org.slug}/${team.slug}/${teamEvent.slug}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Rule violated: E2E Tests Best Practices

  Missing expect(page).toHaveurl("") after navigation violates the E2E test guideline to fail fast on unexpected redirects.

Copy link

graphite-app bot commented Jul 11, 2025

Graphite Automations

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

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

Copy link
Contributor

github-actions bot commented Jul 11, 2025

E2E results are ready!

@anikdhabal anikdhabal self-assigned this Jul 11, 2025
Copy link
Contributor

@anikdhabal anikdhabal left a comment

Choose a reason for hiding this comment

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

Looks good

@zomars zomars merged commit dfe997d into main Jul 13, 2025
38 checks passed
@zomars zomars deleted the devin/1751323069-reproduce-booking-race-condition branch July 13, 2025 15:07
@anikdhabal anikdhabal removed their assignment Jul 13, 2025
devin-ai-integration bot added a commit that referenced this pull request Jul 15, 2025
- Recreate race condition test from PR #22401 for calendar-cache-serve booking flow
- Replace hardcoded TEST_DATE with dynamic first available slot selection
- Use getDynamicBookingDate function to select first available day dynamically
- Prevent test flakiness by avoiding hardcoded tomorrow dates
- Test validates concurrent booking prevention and cache functionality

Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
alishaz-polymath pushed a commit that referenced this pull request Jul 16, 2025
…22401)

Co-authored-by: zomars@cal.com <zomars@me.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
anikdhabal added a commit that referenced this pull request Jul 30, 2025
* feat: add race condition test with dynamic date selection

- Recreate race condition test from PR #22401 for calendar-cache-serve booking flow
- Replace hardcoded TEST_DATE with dynamic first available slot selection
- Use getDynamicBookingDate function to select first available day dynamically
- Prevent test flakiness by avoiding hardcoded tomorrow dates
- Test validates concurrent booking prevention and cache functionality

Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>

* fix: replace dynamic date selection with fixed future date for efficiency

Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>

* Revert "fix: replace dynamic date selection with fixed future date for efficiency"

This reverts commit b4b7d35.

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automated-tests area: unit tests, e2e tests, playwright bookings area: bookings, availability, timezones, double booking core area: core, team members only foundation ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants