Not quite ready to start, but it's close. The design is sound for 200 to 2,000 orders a day, and every gap below can be settled in a short edit before you begin. Items 1 to 3 are the ones to fix first.

## Fix before building

1. **Reconciliation (step 6) doesn't say what "settle" does.** It needs to do everything steps 4 and 5 do:
   - When it settles an order as `FAILED`, it must restore the stock.
   - When it settles an order as `PAID`, it must queue the confirmation email.
   - As written, an order that times out and is later confirmed by the job never gets its email. If the job settles it as `FAILED`, the stock stays reserved forever.

2. **The request path and the reconciliation job can both settle the same order.**
   - Example: the 4th retry succeeds at the same moment the job reads the order as `PENDING` and the provider says "declined". The result is a stock restore on an order that is now `PAID`, or a double restore.
   - Make every status change a compare-and-set, such as `UPDATE orders SET status = 'FAILED' WHERE id = :id AND status = 'PENDING'`. Restore stock only if one row changed.
   - Add a test for this.

3. **A crash between step 2 and step 3 leaves a `PENDING` order the provider has never heard of.**
   - When the job asks the provider about it, the provider answers "no such charge". The design doesn't say what to do with that answer.
   - Decide between retrying the charge and failing the order with a stock restore. Retrying the charge is safe, because the order id is the idempotency key.
   - Without a decision, these orders just trip the 30-minute alert and sit there.

4. **There are two service instances, so the reconciliation job will run twice every 5 minutes.**
   - Add a Postgres advisory lock or `SELECT … FOR UPDATE SKIP LOCKED` to the design.
   - Item 2's compare-and-set makes the double run safe. The lock stops the wasted provider calls.

5. **The idempotency key handling is incomplete.**
   - Scope the unique constraint to `(customer_id, idempotency_key)`, so one customer's key can't collide with another's.
   - Specify what happens when the key is reused with a different cart. The usual answer is `422`.
   - Two concurrent requests with the same key will hit the unique constraint at insert time. That violation must roll back the stock reservation and return the existing order. Add a test for this concurrent case. The current duplicate-`POST` test probably only covers sequential requests.

6. **The "no module reads another module's tables" rule conflicts with step 2.** Step 2 reserves stock (inventory) and inserts the order (orders) in one transaction. Choose how `OrderCheckout` passes one transaction to both modules, for example a unit-of-work or a transaction handle passed in. Then write the choice into the design.

## Smaller items to settle now

- **Where `unit_price` and `total` come from.** The design should say the server computes them from a catalog, not from the client's cart. No catalog is mentioned.
- **Constraints.** Add a primary key on `stock.sku`, `CHECK (available >= 0)`, a primary key on `order_items`, and the unique index from item 5.
- **Deadlocks.** Reserve stock in sorted `sku` order. Otherwise two carts with the same items in different order can deadlock.
- **Request latency.** Five retries at 5 seconds each can hold `POST /orders` open for more than 20 seconds. That may be acceptable, but state the client timeout and whether `202` is expected sooner.
- **Lost email.** A crash after the `PAID` commit but before queueing loses the email. At this volume you could accept that, but note it as a known limit, or write the email row in the same transaction.
- **Tests.** Add cases for two settlers racing (item 2), reconciliation settling as `PAID` and as `FAILED` with the right email and stock effects (item 1), the "provider has no such charge" answer (item 3), and a concurrent duplicate key (item 5). The existing list is otherwise good.

VERDICT: READY WITH CHANGES
