Code Review Bench PR #26782 - fix: Make BOOKING_CANCELLED webhook payload consistent for regular cancellation and request-reschedule flow#11
Conversation
| extra: { | ||
| cancelledBy: dto.cancelledBy, | ||
| cancellationReason: dto.cancellationReason, | ||
| requestReschedule: dto.requestReschedule ?? true, |
There was a problem hiding this comment.
⚠️ Bug: Inconsistent default: requestReschedule ?? true vs ?? false
The BookingPayloadBuilder (v2021-10-20) defaults requestReschedule to true when the value is undefined/null:
requestReschedule: dto.requestReschedule ?? true, // line 48But the BookingWebhookFactory defaults it to false:
requestReschedule: params.requestReschedule ?? false, // line 135Per the PR's own semantics, false means "regular cancellation" and true means "reschedule-driven cancellation". The safe default should be false (regular cancellation is the more common case and the safer assumption). Currently, emitBookingCancelled isn't called for regular cancellations yet, but when it is wired up, any caller that omits requestReschedule will incorrectly tell consumers this is a reschedule-driven cancellation.
The default in BookingPayloadBuilder should be ?? false to match the BookingWebhookFactory and the documented behavior.
Was this helpful? React with 👍 / 👎
| requestReschedule: dto.requestReschedule ?? true, | |
| requestReschedule: dto.requestReschedule ?? false, |
- Apply suggested fix
|
|
||
| const promises = webhooks.map((webhook) => | ||
| // Only send webhooks if enabled in environment | ||
| const webhooksEnabled = process.env.ENABLE_WEBHOOKS !== "false"; |
There was a problem hiding this comment.
⚠️ Bug: Unrelated ENABLE_WEBHOOKS env var diverges from existing pattern
The new code introduces process.env.ENABLE_WEBHOOKS !== "false" as a webhook kill-switch in handleCancelBooking.ts. However:
-
Wrong variable name: The codebase already uses
TASKER_ENABLE_WEBHOOKS(checked as=== "1") insendOrSchedulePayload.tsandWebhookService.ts. The newENABLE_WEBHOOKSis a completely different, undocumented env variable with inverted check semantics. -
Inconsistent application: The guard is only applied to
handleCancelBooking.tsbut NOT to the parallelcancelAttendeeSeat.tscode path (which also sends BOOKING_CANCELLED webhooks viasendPayload). This means the kill-switch only works for regular cancellations, not for seat-removal cancellations. -
Out of scope: This kill-switch doesn't seem related to the PR's stated goal of adding
requestRescheduleto webhook payloads. It appears to be an unrelated change mixed in.
If a webhook kill-switch is truly needed, it should be implemented at the sendPayload level (so it applies consistently to all callers) and use a naming convention consistent with the existing TASKER_ENABLE_WEBHOOKS.
Was this helpful? React with 👍 / 👎
- Apply suggested fix
There was a problem hiding this comment.
Configure merge blocking · Maintainers can dismiss this review. Gitar never approves changes.
Code Review
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
Benchmark Evaluation ResultsGround Truth Bugs (Recall: 2/4 = 50.0%)
Extra Gitar Findings
Summary
|
Code Review Bench PR calcom#26782 - fix: Make BOOKING_CANCELLED webhook payload consistent for regular cancellation and request-reschedule flow
Benchmark PR for Gitar evaluation
Original PR: agentic-review-benchmarks#11
fix: Make BOOKING_CANCELLED webhook payload consistent for regular cancellation and request-reschedule flow
Summary by Gitar
requestRescheduleboolean added toBOOKING_CANCELLEDwebhook payloads distinguishing regular cancellations (false) from reschedule-driven cancellations (true)handleCancelBooking.tssetsrequestReschedule: falsefor organizer-initiated cancellations;cancelAttendeeSeat.tsandrequestReschedule.handler.tssettruefor seat removalsBookingCancelledDTO,EventPayloadType,BookingCancelledParams,BookingExtraDataMap, andCancelledEventPayloadfor type safetyBookingRepositoryqueries updated to fetcheventTypeId,title,length, andiCalSequencerequired for webhook payloadsThis will update automatically on new commits.