**Not quite ready to start tomorrow, but close.** The design has four gaps that would either charge customers without an order or oversell stock. Each can be settled with a few decisions in the document, which should take an hour or two. I'd settle them before writing code.

## Fix before building

1. **A retry after buying the last unit gets a 409.**
   - Step 2 reserves stock before it checks the idempotency key.
   - Case: a customer buys the last unit and the response is lost in transit. The client retries with the same key. Stock is now 0, so the update changes no row and returns `409 out of stock`. The order actually exists.
   - Expected: the retry returns the existing order.
   - Fix: look up the key first, or insert the order first and treat a unique violation as "return the existing order". Add "retry of the last-unit purchase" to the tests. Your two separate tests (duplicate POST, last unit) don't cover the combination.
   - The unique constraint is on the key alone. Two customers whose clients generate the same key would get each other's order. Scope it to `(customer_id, idempotency_key)`.

2. **The reconciler can mark a paid order `FAILED`.**
   - The doc never says what the reconciler does when the provider answers "no such charge".
   - Case: the service crashes after step 2 commits and before the charge is sent, so the provider has no charge. The reconciler has to decide: fail it and release the stock, or retry the charge. The doc doesn't say.
   - The reverse case is worse. The reconciler sees "not found" while a slow request is still retrying and about to succeed. The order becomes `FAILED`, the stock is released, and then the charge lands. The customer is charged for a failed order.
   - Decide that "not found" means retry the charge with the same order-id key, and only a definitive decline means `FAILED`. Also check that the 2-minute threshold is longer than the worst-case retry window (4 attempts × 5 s plus backoff).

3. **Stock can be restored twice.**
   - Step 5 (decline) and step 6 (reconciler) both restore stock, and nothing says the transition is guarded.
   - Case: a request is declined and marks `FAILED`. The reconciler read the order as `PENDING` a moment earlier and does the same. Stock is restored twice and you oversell.
   - Fix: make every status change `UPDATE … WHERE status = 'PENDING'`, and restore stock only if that update changed a row. Add a test for it.

4. **The reconciler runs on both instances.**
   - There are two instances and the job runs on each, so both settle the same orders at once. Use `SELECT … FOR UPDATE SKIP LOCKED`, or run it on one node. Combined with item 3, the guarded updates make this safe, but say it explicitly.

## Smaller gaps to settle in the doc

- **Module boundaries contradict step 2.** "No module reads another module's tables" conflicts with one transaction that updates `stock` and inserts into `orders`. Pick one approach and name it, for example inventory exposes `reserve(tx, items)` and the caller owns the transaction.
- **Email can be lost.** If the process dies between the `PAID` commit and queueing the email, no email is sent. Write an outbox row in the same transaction as `PAID`. The doc also doesn't name the queue.
- **Schema is underspecified.**
  - No primary keys or foreign keys.
  - Nothing prevents `stock.available` going negative; add `CHECK (available >= 0)`.
  - `idempotency_key` should be `NOT NULL`.
  - No index for the reconciler query on `status` and `created_at`.
- **Price and total.** Say that `unit_price` and `total` are computed server-side from the catalog, not taken from the cart.
- **Payment details.** Say what is sent to the provider besides the order id: payment method, amount and currency.
- **Deadlocks.** Reserve items in sorted SKU order so two multi-item carts can't deadlock.
- **Synchronous wait.** The worst case request time is about 25 s or more. Confirm the load balancer and client timeouts allow it.
- **Decline versus error.** Say that a provider 5xx or network error is "unknown", not "declined".

## What's good

The scale assumptions are realistic, and the single-database design is right for 2,000 orders a day. Taking the charge outside the transaction is correct. Using the order id as the provider idempotency key is correct. The `202` path with reconciliation and a 30-minute alert is the right shape, and the test list covers the main flows.

VERDICT: READY WITH CHANGES
