The Last Seat

Decide what you would build from the brief alone. Everything below it is available, but the exercise stops working if you open it first.

The brief you were given

A ticketing endpoint oversells popular events. It reads availability, checks it, and inserts a booking. Fix it without serialising every booking in the system.

The trap — the wrong fix that looks right

Wrapping the check and the insert in a transaction and calling it fixed, because "transactions prevent race conditions". A transaction gives atomicity and the isolation level's guarantees — and under Read Committed, which is the default on several engines, both transactions read the same availability and both insert. The test suite passes because tests run sequentially. Production oversells exactly as before, and the transaction now makes each failed attempt more expensive.