Skip to content

chore: Integrate confirmation booking audit#26

Open
hila-f-qodo wants to merge 2 commits intodevin_pr_code_review_bench_100_devin2_base_chore_integrate_confirmation_booking_audit_pr714from
devin_pr_code_review_bench_100_devin2_head_chore_integrate_confirmation_booking_audit_pr714
Open

chore: Integrate confirmation booking audit#26
hila-f-qodo wants to merge 2 commits intodevin_pr_code_review_bench_100_devin2_base_chore_integrate_confirmation_booking_audit_pr714from
devin_pr_code_review_bench_100_devin2_head_chore_integrate_confirmation_booking_audit_pr714

Conversation

@hila-f-qodo
Copy link

@hila-f-qodo hila-f-qodo commented Jan 26, 2026

Benchmark PR from qodo-benchmark#714


Open with Devin

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

View issues and 5 additional flags in Devin Review.

Open in Devin Review

updatedBookings.push(updatedBooking);
acceptedBookings = [
{
oldStatus: BookingStatus.ACCEPTED,

Choose a reason for hiding this comment

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

🔴 Incorrect oldStatus hardcoded as ACCEPTED instead of using booking.status

In the non-recurring booking acceptance flow, the oldStatus is incorrectly hardcoded to BookingStatus.ACCEPTED instead of using the actual booking.status value.

Click to expand

How the bug occurs

When a single (non-recurring) booking is accepted via handleConfirmation(), the code builds the acceptedBookings array to fire the audit event:

acceptedBookings = [
  {
    oldStatus: BookingStatus.ACCEPTED,  // BUG: Should be booking.status
    uid: booking.uid,
  },
];

The booking.status field is available in the function arguments (see packages/features/bookings/lib/handleConfirmation.ts:126) and should be BookingStatus.PENDING for bookings awaiting confirmation.

Actual vs Expected

  • Actual: Audit log records oldStatus: ACCEPTED and newStatus: ACCEPTED (no change detected)
  • Expected: Audit log should record oldStatus: PENDING and newStatus: ACCEPTED (showing the actual status transition)

Impact

The booking audit trail will have incorrect data, making it impossible to track the actual status transition from PENDING to ACCEPTED for non-recurring bookings.

Recommendation: Change oldStatus: BookingStatus.ACCEPTED to oldStatus: booking.status

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +444 to +447
rejectedBookings = updatedRecurringBookings.map((recurringBooking) => ({
uid: recurringBooking.uid,
oldStatus: recurringBooking.status,
}));

Choose a reason for hiding this comment

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

🔴 Rejection audit uses post-update status as oldStatus for recurring bookings

In the rejection flow for recurring bookings, the code fetches bookings AFTER they've been updated, causing the audit to record the NEW status (REJECTED) as the old status.

Click to expand

How the bug occurs

The code flow is:

  1. Fetch unconfirmedRecurringBookings with status: BookingStatus.PENDING (line 409-418)
  2. Update all bookings to status: BookingStatus.REJECTED (line 420-430)
  3. Fetch the same bookings AGAIN as updatedRecurringBookings (line 432-442)
  4. Use the status from updatedRecurringBookings as oldStatus (line 444-446)
rejectedBookings = updatedRecurringBookings.map((recurringBooking) => ({
  uid: recurringBooking.uid,
  oldStatus: recurringBooking.status,  // BUG: This is now REJECTED, not PENDING
}));

Actual vs Expected

  • Actual: Audit log records oldStatus: REJECTED and newStatus: REJECTED
  • Expected: Audit log should record oldStatus: PENDING and newStatus: REJECTED

Impact

The booking audit trail for recurring booking rejections will incorrectly show no status change, making it impossible to track the actual transition from PENDING to REJECTED.

Recommendation: Use unconfirmedRecurringBookings (which contains the pre-update status) instead of updatedRecurringBookings. Change to: rejectedBookings = unconfirmedRecurringBookings.map((booking) => ({ uid: booking.uid, oldStatus: booking.status }));

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

2 participants

Comments