feat: Add infrastructure for no-show audit integration#27187
feat: Add infrastructure for no-show audit integration#27187hariombalhara merged 11 commits intomainfrom
Conversation
- Add Prisma migrations for SYSTEM source and NO_SHOW_UPDATED audit action - Add NoShowUpdatedAuditActionService with array-based attendeesNoShow schema - Update BookingAuditActionServiceRegistry to include NO_SHOW_UPDATED - Update BookingAuditTaskConsumer and BookingAuditViewerService - Add AttendeeRepository methods for no-show queries - Update IAuditActionService interface with values array support - Update locales with no-show audit translation keys Co-Authored-By: [email protected] <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…urce types Co-Authored-By: [email protected] <[email protected]>
…okingAuditAction type to match Prisma schema Co-Authored-By: [email protected] <[email protected]>
…f HOST_NO_SHOW_UPDATED and ATTENDEE_NO_SHOW_UPDATED Co-Authored-By: [email protected] <[email protected]>
…wUpdatedAuditActionService - Delete HostNoShowUpdatedAuditActionService and AttendeeNoShowUpdatedAuditActionService - Update BookingAuditProducerService.interface.ts to use queueNoShowUpdatedAudit - Update BookingAuditTaskerProducerService.ts to use queueNoShowUpdatedAudit - Update BookingEventHandlerService.ts to use onNoShowUpdated - Add integration tests for NoShowUpdatedAuditActionService Co-Authored-By: [email protected] <[email protected]>
There was a problem hiding this comment.
Consolidated AttendeeNoShow and HostNoShow in this single action file because both host and attendee could update through a single action too.
There was a problem hiding this comment.
1 issue found across 26 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/prisma/migrations/20260120093500_add_no_show_updated_audit_action/migration.sql">
<violation number="1" location="packages/prisma/migrations/20260120093500_add_no_show_updated_audit_action/migration.sql:28">
P1: Missing data migration step - this migration will fail if any existing records use the deprecated `host_no_show_updated` or `attendee_no_show_updated` enum values. Add an UPDATE statement before the type cast to convert existing data to the new `no_show_updated` value.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
packages/prisma/migrations/20260120093500_add_no_show_updated_audit_action/migration.sql
Outdated
Show resolved
Hide resolved
Devin AI is addressing Cubic AI's review feedbackA Devin session has been created to address the issues identified by Cubic AI. |
Addresses Cubic AI review feedback (confidence 9/10): The migration now includes an UPDATE statement to convert existing records using the deprecated 'host_no_show_updated' or 'attendee_no_show_updated' enum values to the new unified 'no_show_updated' value before the type cast. This prevents migration failures if any existing data uses the old values. Co-Authored-By: unknown <>
There was a problem hiding this comment.
BookingAudit table is empty in production at the moemnt, so we are safe to do destructive changes
Fixes PostgreSQL error 'unsafe use of new value of enum type' by avoiding the ADD VALUE statement and instead using a CASE expression in the ALTER TABLE USING clause to convert deprecated enum values (host_no_show_updated, attendee_no_show_updated) to the new unified value (no_show_updated) during the type conversion. Co-Authored-By: unknown <>
E2E results are ready! |
packages/features/booking-audit/lib/actions/NoShowUpdatedAuditActionService.ts
Show resolved
Hide resolved
Udit-takkar
left a comment
There was a problem hiding this comment.
Looks good. left few comments
| const doesMatchDisplayFields = (): boolean => { | ||
| return log.displayFields?.some((field) => { | ||
| return field.valueKey?.toLowerCase().includes(searchTerm.toLowerCase()) || | ||
| field.labelKey?.toLowerCase().includes(searchTerm.toLowerCase()); | ||
| }) ?? false; | ||
| return ( | ||
| log.displayFields?.some((field) => { | ||
| return ( | ||
| field.valueKey?.toLowerCase().includes(searchTerm.toLowerCase()) || | ||
| field.labelKey?.toLowerCase().includes(searchTerm.toLowerCase()) | ||
| ); | ||
| }) ?? false | ||
| ); |
There was a problem hiding this comment.
🟡 Search filter does not check value and values fields in displayFields
The search filter in useBookingLogsFilters only checks valueKey and labelKey when filtering audit logs, but the new displayFields type can also contain value and values properties.
Click to expand
Issue
The doesMatchDisplayFields function at lines 369-377 only checks:
field.valueKey?.toLowerCase().includes(searchTerm.toLowerCase()) ||
field.labelKey?.toLowerCase().includes(searchTerm.toLowerCase())However, the NoShowUpdatedAuditActionService.getDisplayFields (NoShowUpdatedAuditActionService.ts:120-133) returns fields using value and values:
displayFields.push({ labelKey: "Attendees", values: attendeesFieldValues });
displayFields.push({ labelKey: "Host", value: hostFieldValue });Impact
Users searching for attendee emails or host names in no-show audit logs will not find matching results, even though those values are displayed in the UI. The search functionality is incomplete for the new NO_SHOW_UPDATED audit action type.
Expected vs Actual
- Expected: Searching for an attendee email like "[email protected]" should find no-show audit logs containing that attendee
- Actual: The search returns no results because
valueandvaluesfields are not checked
Recommendation: Update doesMatchDisplayFields to also check field.value and field.values:
const doesMatchDisplayFields = (): boolean => {
return (
log.displayFields?.some((field) => {
return (
field.valueKey?.toLowerCase().includes(searchTerm.toLowerCase()) ||
field.labelKey?.toLowerCase().includes(searchTerm.toLowerCase()) ||
field.value?.toLowerCase().includes(searchTerm.toLowerCase()) ||
field.values?.some(v => v.toLowerCase().includes(searchTerm.toLowerCase()))
);
}) ?? false
);
};Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Fixing in a followup
What does this PR do?
Adds the infrastructure foundation for no-show audit integration. This is a preparatory PR that sets up the booking audit system to track no-show events. The actual integration with no-show flows will be stacked on top of this PR (PR #26570).
Key changes:
Database schema:
SYSTEMsource toBookingAuditSourceenum for background jobs (tasker tasks, trigger.dev)HOST_NO_SHOW_UPDATEDandATTENDEE_NO_SHOW_UPDATEDinto singleNO_SHOW_UPDATEDactionNew service:
NoShowUpdatedAuditActionServicewith array-based schema for attendees:attendeesNoShow: Array<{attendeeEmail, noShow}>HostNoShowUpdatedAuditActionServiceandAttendeeNoShowUpdatedAuditActionServiceProducer service updates:
BookingAuditProducerService.interface.ts: ReplacesqueueHostNoShowUpdatedAuditandqueueAttendeeNoShowUpdatedAuditwith unifiedqueueNoShowUpdatedAuditBookingAuditTaskerProducerService.ts: Implements the unified methodBookingEventHandlerService.ts: ReplacesonHostNoShowUpdatedandonAttendeeNoShowUpdatedwith unifiedonNoShowUpdatedRepository enhancements:
AttendeeRepositorymethods for no-show queries (findByIds,findByBookingId,updateNoShow,findByBookingUidAndEmails, etc.)UI updates:
BookingHistorycomponent now supportsvalues?: string[]in display fields for rendering multiple valuesDisplayFieldValuecomponent for flexible field renderingType updates:
IBookingAuditRepository.BookingAuditActionupdated to useNO_SHOW_UPDATEDActionSourceSchemaupdated to includeSYSTEMBookingAuditActionSchemain bookingAuditTask.ts aligned with Prisma schemaTests:
NoShowUpdatedAuditActionServicecovering host no-show, attendee no-show, and combined scenariosUpdates since last revision
Migration fix (addresses Cubic AI review feedback):
20260120093500_add_no_show_updated_audit_action/migration.sqlADD VALUEstatement that caused the transaction issueCASEexpression in theALTER TABLE ... USINGclause to convert deprecated enum values (host_no_show_updated,attendee_no_show_updated) to the new unified value (no_show_updated) during the type conversionMandatory Tasks (DO NOT REMOVE)
How should this be tested?
This is infrastructure-only. Full testing will occur with the stacked integration PR (PR #26570).
yarn prisma migrate deployyarn type-check:ci --forceNoShowUpdatedAuditActionServiceschema validates correctlyVITEST_MODE=integration yarn test no-show-updated-action.integration-test.tsHuman Review Checklist
BookingAuditActionis defined in multiple places (IBookingAuditRepository.ts, bookingAuditTask.ts, Prisma schema) - ensure they matchNoShowUpdatedAuditActionServiceschema uses array format:attendeesNoShow: Array<{attendeeEmail, noShow}>IAuditActionServiceinterface changes are backward compatible with existing action services (newvalues?: string[]field)BookingHistorycomponent correctly renders the newvaluesarray field viaDisplayFieldValueChecklist
Link to Devin run
https://app.devin.ai/sessions/fd5750de158b4cb09e577713d93cdf1a
Link to Devin run (Cubic AI feedback)
https://app.devin.ai/sessions/c472f87d284a4986ba3a651d04d24eae
Requested by
@hariombalhara