Skip to content

Comments

[CORRUPTED] Synthetic Benchmark PR #26458 - chore: Integrate booking cancellation audit#366

Open
tomerqodo wants to merge 10 commits intobase_pr_26458_20260114_6010from
corrupted_pr_26458_20260114_6010
Open

[CORRUPTED] Synthetic Benchmark PR #26458 - chore: Integrate booking cancellation audit#366
tomerqodo wants to merge 10 commits intobase_pr_26458_20260114_6010from
corrupted_pr_26458_20260114_6010

Conversation

@tomerqodo
Copy link

Benchmark PR calcom#26458

Type: Corrupted (contains bugs)

Original PR Title: chore: Integrate booking cancellation audit
Original PR Description: ## What does this PR do?

⚠️ Note: This PR does not enable booking audit in production. The BookingAuditTaskerProducerService has an IS_PRODUCTION guard that skips audit task queueing in production environments. This allows the integration to be tested in development before enabling it in production.

Integrates audit logging for booking cancellations, following the pattern established in PR calcom#26046 for booking creation/rescheduling audit.

Changes:

  • Add audit logging for single booking cancellation via onBookingCancelled
  • Add audit logging for bulk recurring booking cancellation via onBulkBookingsCancelled
  • Pass userUuid and actionSource from webapp cancel route (WEBAPP)
  • Pass userUuid and actionSource from API-v2 bookings service (API_V2)
  • Create getAuditActor helper to derive actor from userUuid or create synthetic guest actor
  • Add getUniqueIdentifier helper for generating unique actor identifiers
  • Add warning log when actionSource is "UNKNOWN" for observability
  • Add integration tests for booking cancellation audit

Audit Data Captured:

  • cancellationReason (simple string value)
  • cancelledBy (simple string value)
  • status (old → new, e.g., "ACCEPTED" → "CANCELLED")

Updates since last revision:

  • Simplified CancelledAuditActionService schema: cancellationReason and cancelledBy are now stored as simple nullable strings instead of change objects (old/new), since cancellation is a one-time event where tracking previous values doesn't apply
  • Added integration tests for cancelled booking audit in booking-audit-cancelled.integration-test.ts
  • Added getUniqueIdentifier helper function in actor.ts for generating unique identifiers with prefixes

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. N/A - no documentation changes needed.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Cancel a single booking via the webapp - verify audit record is created with actor and actionSource="WEBAPP"
  2. Cancel a single booking via API v2 - verify audit record is created with actionSource="API_V2"
  3. Cancel all remaining bookings in a recurring series - verify bulk audit records are created with shared operationId
  4. Cancel via unauthenticated cancel link - verify guest actor is created with synthetic email (prefixed with "param-" or "fallback-")
  5. Run integration tests: yarn test packages/features/booking-audit/lib/service/__tests__/booking-audit-cancelled.integration-test.ts

Human Review Checklist

  • Verify onBookingCancelled and onBulkBookingsCancelled methods exist in BookingEventHandlerService
  • Review the getAuditActor fallback logic - creates synthetic email with "fallback-" or "param-" prefix when no userUuid available
  • Confirm the simplified schema for cancellationReason/cancelledBy (no longer tracking old→new) is intentional
  • Note: Audit logging calls are awaited directly - if audit service fails, the cancellation will fail. Confirm this is the desired behavior.
  • Verify CancelledAuditDisplayData type no longer includes previousReason and previousCancelledBy fields

Link to Devin run: https://app.devin.ai/sessions/42404e76a66946fe9e46fa07fb12e779
Requested by: @hariombalhara (hariom@cal.com)
Original PR URL: calcom#26458

devin-ai-integration bot and others added 10 commits January 5, 2026 12:34
- Add audit logging for single booking cancellation
- Add audit logging for bulk recurring booking cancellation
- Pass userUuid and actionSource from webapp cancel route
- Pass userUuid and actionSource from API-v2 bookings service
- Add cancellationReason and cancelledBy to getBookingToDelete select
- Follow pattern from PR calcom#26046 for consistency

Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
… tests

- Refactor test files for better readability by adjusting import statements and formatting.
- Enhance mock data creation functions for clarity and consistency.
- Update test cases to ensure proper handling of booking actions and actor details.
- Ensure all test cases are structured uniformly for easier maintenance.
@github-actions
Copy link

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "[CORRUPTED] Synthetic Benchmark PR #26458 - chore: Integrate booking cancellation audit". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@github-actions
Copy link

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions bot added the Stale label Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants