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.
Problem
PATCH /bookings/{bookingId}updates booking status without a version check,ETag, orIf-Matchprecondition. 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:538reads the current booking.apps/bot/services/booking-service/src/booking-router.ts:542validates the transition against that read copy.apps/bot/services/booking-service/src/booking-router.ts:566updates byidonly, without checking the previously read status or a version field.docs/openapi/metrix-bot-api.yamlcurrently does not enforceIf-Matchfor 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:
versionfield tobooking.Booking;ETagwith booking responses;If-Matchfor status updates;where: { id, version }or equivalent transactional guard;412 Precondition Failedon stale writes.