Concurrent checkout / 31.32s

One shopper wins the last unit.

Two independent customers act on the same final unit. Stock accepts one authoritative hold and gives the other customer a clear sold-out result.

Silent film with burned-in narrationOpen WebM directly

What You Will See

  1. Two valid customersBoth start checkout against the same last available quantity.
  2. Requests overlapNeither journey waits for the other at the browser level.
  3. One reservation succeedsThe guarded database mutation holds the unit and checkout continues.
  4. One request fails clearlyThe same predicate no longer matches; no second hold or false order is created.

Why It Matters

Correct availability is decided at the mutation boundary, not by who saw the product page first.

The customer-facing projection may be briefly stale without permitting oversell because Stock rechecks current database state.

The System Underneath

Shopper AReserve quantity 1
Atomic predicateavailable ≥ requested
Shopper BReserve quantity 1
Exactly one outcomeAccepted hold or insufficient stock
Idempotency prevents one checkout from reserving twice. The availability predicate prevents independent checkouts from owning the same final unit.

What This Story Proves

Visible proof

Two overlapping browser journeys receive one success and one sold-out result.

System proof

The real invariant sits in the guarded database update, not a test-only browser lock.

Mechanism reference: reservation concurrency.

AI engineering connectionExecutable feedback constrains autonomous change