Skip to content

booking status updates do not guard stale writes #31

Description

@Hqzdev

Problem

PATCH /bookings/{bookingId} updates booking status without a version check, ETag, or If-Match precondition. Two clients can read the same active booking and both send stale updates that succeed.

Evidence

  • apps/bot/services/booking-service/src/booking-router.ts:538 reads the current booking.
  • apps/bot/services/booking-service/src/booking-router.ts:542 validates the transition against that read copy.
  • apps/bot/services/booking-service/src/booking-router.ts:566 updates by id only, without checking the previously read status or a version field.
  • docs/openapi/metrix-bot-api.yaml currently does not enforce If-Match for booking updates on main.

Impact

Concurrent cancellations or reschedules can report success to more than one caller. The second caller is not told that it acted on stale state.

Expected Fix

Add optimistic concurrency control:

  • add a version field to booking.Booking;
  • return ETag with booking responses;
  • require/validate If-Match for status updates;
  • update with where: { id, version } or equivalent transactional guard;
  • return 412 Precondition Failed on stale writes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bookingBooking service or booking domainbugSomething isn't workingconcurrencyConcurrent writes, races, and consistency

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions