Skip to content

fix: Make BOOKING_CANCELLED` webhook payload consistent for regular cancellation and request-reschedule flow#11

Open
tomerqodo wants to merge 3 commits into
coderabbit_full_base_fix_make_booking_cancelled_webhook_payload_consistent_for_regular_cancellation_and_request-reschedule_flow_pr11from
coderabbit_full_head_fix_make_booking_cancelled_webhook_payload_consistent_for_regular_cancellation_and_request-reschedule_flow_pr11
Open

fix: Make BOOKING_CANCELLED` webhook payload consistent for regular cancellation and request-reschedule flow#11
tomerqodo wants to merge 3 commits into
coderabbit_full_base_fix_make_booking_cancelled_webhook_payload_consistent_for_regular_cancellation_and_request-reschedule_flow_pr11from
coderabbit_full_head_fix_make_booking_cancelled_webhook_payload_consistent_for_regular_cancellation_and_request-reschedule_flow_pr11

Conversation

@tomerqodo

@tomerqodo tomerqodo commented Jan 29, 2026

Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#11

Summary by CodeRabbit

  • New Features

    • Booking cancellation webhooks now include additional metadata fields: reschedule request status, iCal sequence number, event title, duration, and event type ID.
    • Webhooks can be conditionally enabled or disabled via configuration.
  • Documentation

    • Updated webhook payload examples to reflect new cancellation fields.
  • Tests

    • Enhanced test coverage for expanded webhook payload structure.

@coderabbitai

coderabbitai Bot commented Jan 29, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This pull request extends booking cancellation webhook payloads to include a requestReschedule boolean field and iCalSequence number field. It adds conditional webhook execution (gated by ENABLE_WEBHOOKS), updates type definitions across the webhook system, and enhances booking cancellation handlers to populate these new fields when notifying webhooks.

Changes

Cohort / File(s) Summary
Webhook Type Definitions
packages/features/webhooks/lib/dto/types.ts, packages/features/webhooks/lib/types/params.ts, packages/features/webhooks/lib/sendPayload.ts
Added optional fields requestReschedule?: boolean and iCalSequence?: number | null to BookingCancelledDTO, BookingCancelledParams, and EventPayloadType.
Webhook Payload Builders
packages/features/webhooks/lib/factory/base/BaseBookingPayloadBuilder.ts, packages/features/webhooks/lib/factory/versioned/v2021-10-20/BookingPayloadBuilder.ts, packages/features/webhooks/lib/service/BookingWebhookService.ts
Updated BookingExtraDataMap to include requestReschedule?: boolean; payload builders now populate requestReschedule (defaulting to true in v2021-10-20, derived from params in service).
Booking Cancellation Logic
packages/features/bookings/lib/handleCancelBooking.ts, packages/features/bookings/lib/handleSeats/cancel/cancelAttendeeSeat.ts
Added conditional webhook execution gated by ENABLE_WEBHOOKS; payloads now include requestReschedule field (false for direct cancellations, true for seat cancellations).
Booking Repository & Data Access
packages/features/bookings/repositories/BookingRepository.ts
Enhanced findByUidIncludeEventTypeAndReferences selection to include iCalSequence: true at top-level and title: true, length: true in eventType selection; minor formatting adjustments.
Reschedule Handler
packages/trpc/server/routers/viewer/bookings/requestReschedule.handler.ts
Updated to pass eventTypeId, length, eventTitle, iCalSequence (incremented), and requestReschedule: true to booking status and webhook payload calls.
Webhook Factory & Tests
packages/lib/server/service/BookingWebhookFactory.ts, packages/lib/server/service/\_\_tests\_\_/BookingWebhookFactory.test.ts
Extended CancelledEventPayload interface with eventTypeId, length, iCalSequence, eventTitle, and requestReschedule fields; updated test assertions to validate new payload properties.
Documentation
docs/developing/guides/automation/webhooks.mdx
Updated BOOKING_CANCELLED webhook payload example to include "requestReschedule": false field.

Sequence Diagram

sequenceDiagram
    participant Client
    participant BookingService as Booking Service
    participant WebhookFactory as Webhook Factory
    participant WebhookService as Webhook Service
    participant WebhookEndpoint as External Webhook

    Client->>BookingService: Cancel booking / Request reschedule
    BookingService->>BookingService: Check ENABLE_WEBHOOKS setting
    alt Webhooks enabled
        BookingService->>WebhookFactory: Create cancelled event payload<br/>(with eventTypeId, length, iCalSequence, eventTitle)
        WebhookFactory->>WebhookFactory: Set requestReschedule flag<br/>(true for reschedule, false for direct cancel)
        WebhookFactory->>WebhookService: Build webhook payload with new fields
        WebhookService->>WebhookEndpoint: POST webhook event<br/>(includes requestReschedule & iCalSequence)
        WebhookEndpoint-->>WebhookService: ACK
    else Webhooks disabled
        BookingService->>BookingService: Skip webhook execution
    end
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A reschedule flag hops through the code so bright,
iCal sequences dance in webhook light,
Payloads grow richer with each new field,
Booking cancellations their metadata yield! 📋✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the core objective: ensuring consistent webhook payloads for BOOKING_CANCELLED events across different cancellation flows.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch coderabbit_full_head_fix_make_booking_cancelled_webhook_payload_consistent_for_regular_cancellation_and_request-reschedule_flow_pr11

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.

@tomerqodo

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@tomerqodo

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@tomerqodo

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@hussam789

Copy link
Copy Markdown

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Feb 2, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@avior-qc

avior-qc commented Feb 2, 2026

Copy link
Copy Markdown

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Feb 2, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants