Skip to content

Conversation

@hariombalhara
Copy link
Member

@hariombalhara hariombalhara commented Dec 19, 2025

What does this PR do?

Creates a new BookingHistoryViewerService that combines booking audit logs with routing form submission data to provide a complete chronological history of a booking. This service replaces the direct usage of BookingAuditViewerService in the tRPC handler.

Changes:

  • New BookingHistoryViewerService that injects BookingAuditViewerService and RoutingFormResponseRepository
  • New DI infrastructure for RoutingFormResponseRepository (tokens and module)
  • Updated booking-logs-view.tsx to use the new getBookingHistory endpoint
  • Form submissions appear as history entries with title "Form Submitted" using existing translation key
  • Moved routing form zod schemas and field utilities from @calcom/app-store to @calcom/features/routing-forms/lib/

Updates since last revision

  • Fixed double prefix bug in uniqueId generation for form submission entries (was producing id: id: form-submission-X, now correctly produces form-submission-X)

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 - internal service change only.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Create a booking through a routing form
  2. Navigate to the booking logs view for that booking
  3. Verify that a "Form Submitted" entry appears in the timeline
  4. Verify entries are sorted reverse chronologically (newest first)
  5. Test with a booking that has no routing form response - should show only audit logs

Human Review Checklist

  • Verify the form submission entry structure in createFormSubmissionEntry matches what booking-logs-view.tsx expects
  • Review hardcoded values: type: "RECORD_CREATED", action: "CREATED", source: "WEBAPP", actor.type: "GUEST" - are these semantically appropriate for form submissions?
  • Consider if the actor should be determined dynamically rather than always showing "Guest" or email
  • Confirm the breaking change from getAuditLogs to getBookingHistory is acceptable

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked if my changes generate no new warnings

Link to Devin run: https://app.devin.ai/sessions/88c554ef0ed04e6d9b79985709d48552
Requested by: @hariombalhara (hariom@cal.com)

…outing form submissions

Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

- Updated the booking logs view to use the new getBookingHistory query instead of getAuditLogs.
- Introduced DisplayBookingAuditLog type for improved clarity in BookingAuditViewerService.
- Refactored BookingHistoryViewerService to utilize the new DisplayBookingAuditLog type and added sorting functionality for history logs.
- Adjusted related types and methods to ensure consistency across services.
- Consolidated type exports and imports from the features library for better organization.
- Removed redundant type definitions and functions in zod.ts, findFieldValueByIdentifier.ts, getFieldIdentifier.ts, and parseRoutingFormResponse.ts.
- Introduced new utility functions for handling field responses and parsing routing form responses.
- Improved type safety and clarity across routing form response handling.
@vercel
Copy link

vercel bot commented Dec 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Review Updated (UTC)
cal Ignored Ignored Jan 5, 2026 10:57am
cal-companion Ignored Ignored Preview Jan 5, 2026 10:57am
cal-eu Ignored Ignored Jan 5, 2026 10:57am

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved code from @calcom/app-store

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved code from @calcom/app-store

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved code from @calcom/app-store

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved code from @calcom/app-store

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved code from @calcom/app-store

@hariombalhara hariombalhara marked this pull request as ready for review December 23, 2025 08:59
@graphite-app graphite-app bot added enterprise area: enterprise, audit log, organisation, SAML, SSO core area: core, team members only labels Dec 23, 2025
@graphite-app graphite-app bot requested review from a team December 23, 2025 09:00
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.

2 issues found across 22 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/trpc/server/routers/viewer/bookings/_router.tsx">

<violation number="1" location="packages/trpc/server/routers/viewer/bookings/_router.tsx:111">
P2: The route name was changed from `getAuditLogs` to `getBookingHistory`, but the PR description claims backward compatibility was maintained by keeping the route name as `getAuditLogs`. If there are existing consumers of this tRPC endpoint, this will be a breaking change. Either:
1. Keep the original route name `getAuditLogs` (or add an alias) to maintain backward compatibility
2. Update the PR description to reflect that this is a breaking change</violation>
</file>

<file name="packages/features/booking-audit/lib/service/BookingHistoryViewerService.ts">

<violation number="1" location="packages/features/booking-audit/lib/service/BookingHistoryViewerService.ts:79">
P1: The `uniqueId` variable already contains the `id: ` prefix, causing double prefixing in the `id` field (`id: id: form-submission-X`) and inconsistent prefixing in `operationId` (`operationId: id: form-submission-X`). Remove the `id: ` prefix from `uniqueId`.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
@github-actions
Copy link
Contributor

E2E results are ready!

Udit-takkar
Udit-takkar previously approved these changes Jan 5, 2026
Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

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

LGTM

volnei
volnei previously approved these changes Jan 5, 2026
Copy link
Member Author

Merge activity

  • Jan 5, 10:52 AM UTC: Graphite couldn't merge this PR because it had merge conflicts.

@hariombalhara
Copy link
Member Author

@volnei @Udit-takkar Resolved a small conflict here. So, need a reapproval

@kodiakhq kodiakhq bot merged commit 9d39590 into main Jan 5, 2026
47 checks passed
@kodiakhq kodiakhq bot deleted the devin/booking-history-viewer-service-1766126882 branch January 5, 2026 11:11
Pallava-Joshi pushed a commit to Pallava-Joshi/cal.com that referenced this pull request Jan 7, 2026
…outing form submissions (calcom#26045)

* feat: create BookingHistoryViewerService to combine audit logs with routing form submissions

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

* refactor(booking): rename audit log query and enhance type safety

- Updated the booking logs view to use the new getBookingHistory query instead of getAuditLogs.
- Introduced DisplayBookingAuditLog type for improved clarity in BookingAuditViewerService.
- Refactored BookingHistoryViewerService to utilize the new DisplayBookingAuditLog type and added sorting functionality for history logs.
- Adjusted related types and methods to ensure consistency across services.

* refactor(routing-forms): streamline imports and enhance type definitions

- Consolidated type exports and imports from the features library for better organization.
- Removed redundant type definitions and functions in zod.ts, findFieldValueByIdentifier.ts, getFieldIdentifier.ts, and parseRoutingFormResponse.ts.
- Introduced new utility functions for handling field responses and parsing routing form responses.
- Improved type safety and clarity across routing form response handling.

* fix: remove double prefix from uniqueId in form submission entry

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

* 1c97f9c (calcom#26453)

---------

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

automerge core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ready-for-e2e size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants