The design is sound and you can start building tomorrow, provided you make one fix to how orders are settled and fill in three things the document leaves unspecified. The core shape is right for 2,000 orders a day: reserve stock and insert the order in one transaction, charge outside it with the order id as the provider idempotency key, and reconcile unknown results.

## Must fix before building

**1. A failed order can have its stock restored twice.**
Nothing in the design says "mark `FAILED` and restore stock" only happens if the order is still `PENDING`. You run two instances, so the reconciliation job runs on both unless you say otherwise.

- **Failing case:** order A holds 1 unit of SKU X, with `available = 0`, and the charge result is unknown. At the 5-minute tick both instances ask the provider, both hear "declined", and both run step 5.
- **Wrong result:** `available = 2`, so one unit that doesn't exist can be sold.
- **Expected result:** `available = 1`.
- **Fix:** make every status change conditional, `UPDATE orders SET status = :new WHERE id = :id AND status = 'PENDING'`, and restore stock only if that update changed a row. Apply the same guard to `PAID` in step 4, so that a late reconciliation and a late request handler cannot overwrite each other.

**2. The reconciliation job has no rule for "provider has no record of this charge".**
This happens if an instance crashes after step 2 commits and before step 3 reaches the provider. Step 6 only says orders are settled as `PAID` or `FAILED`. Without a rule, those orders hold stock until the 30-minute alert fires and someone fixes them by hand.

I recommend treating "not found" as `FAILED` and restoring stock. The 2-minute age threshold is safely longer than the roughly 30 seconds step 3 can take.

**3. The design doesn't say where `unit_price` and `total` come from.**
The client sends the cart, and there is no price table or catalog lookup in the design. If prices are taken from the request, a customer can set their own. State that the server looks up prices and computes the total, and name the source.

**4. The test plan has no tests for the reconciliation job or for concurrency.**
These are the parts most likely to be wrong. Add:

- Reconciliation settles an order as `PAID`.
- Reconciliation settles an order as `FAILED` and restores stock.
- Reconciliation handles "not found" at the provider.
- Reconciliation running twice on the same order restores stock once.
- Two simultaneous `POST /orders` with the same key produce one order and one stock decrement.
- Two simultaneous buyers of the last unit produce one success and one `409`.

## Decide while building

- **Concurrent duplicate `POST`:** the second request will decrement stock and then hit the unique constraint. Spell out that it rolls back and returns the existing order, rather than a 500.
- **Idempotency key scope:** make the unique constraint `(customer_id, idempotency_key)` so one customer's key cannot collide with or reveal another's order. Return `422` if the same key arrives with a different cart.
- **Deadlocks:** two orders containing the same two SKUs in opposite order can deadlock in step 2. Update stock rows in sorted SKU order.
- **Schema constraints:** add primary keys on `order_items` and `stock`, `CHECK (available >= 0)`, and `CHECK (quantity > 0)`. A negative quantity would otherwise increase stock.
- **Lost confirmation email:** a crash between the `PAID` commit and queuing the email in step 4 loses it. This is acceptable at launch if you note it as known debt; the cleanup is to write the email job in the same transaction as `PAID`.
- **Module boundary:** step 2 touches `stock` and `orders` in one transaction, while the code structure says no module reads another's tables. Say that `OrderCheckout` owns the transaction and calls the inventory module's interface inside it.

VERDICT: READY WITH CHANGES
