**The design is sound enough to start building tomorrow, provided you fold in two small changes first: guard the status changes against running twice, and say what the reconciliation job does when the provider has no record of a charge.** Both are a few lines in design.md, not a rework.

The core is right: stock reservation is atomic and cannot oversell, the charge happens outside the transaction, the provider deduplicates retries on the order id, and unknown outcomes are settled by a job rather than guessed.

## Fix before building

**1. Status changes are not guarded, so stock can be restored twice (high)**
- **Evidence:** Context says two instances run. Step 6 runs the reconciliation job every 5 minutes, and nothing says only one instance runs it or that settling is conditional on the order still being `PENDING`.
- **Concrete case:** an order for 3 units of SKU A sits `PENDING` and the provider reports it declined. Both instances' jobs pick it up, and each marks it `FAILED` and adds 3 back. Stock is now 3 too high, and the next customer can buy units that do not exist.
- **Fix:** make every transition `UPDATE orders SET status = ... WHERE id = :id AND status = 'PENDING'`, and restore stock only if that update changed a row. This applies to steps 4, 5 and 6.

**2. Reconciliation has no rule for "provider has never heard of this charge" (high)**
- **Evidence:** step 6 says the job settles orders as `PAID` or `FAILED` from the provider's status. If an instance crashes after step 2 commits but before step 3 reaches the provider, there is no charge to look up.
- **Concrete case:** the order stays `PENDING` forever and its stock stays reserved. The 30-minute alert fires, but someone has to fix it by hand.
- **Fix:** state that "no charge found" settles as `FAILED`. Also state that `FAILED` from reconciliation restores stock, as step 5 does; step 6 does not say so.

## Fix during the build

**3. Idempotency key is unique globally, not per customer (medium)**
- **Evidence:** step 1 puts the key "under a unique constraint" and returns the existing order on a repeat.
- **Concrete case:** customer B sends a key that customer A already used and gets A's order back.
- **Fix:** make it unique on `(customer_id, idempotency_key)`. Also decide what happens when the same key arrives with a different cart; I would return `422`.

**4. Test plan misses the riskiest paths (medium)**
- **Evidence:** the Tests section covers the request path only.
- **Missing:** the reconciliation job (paid, declined, no charge found, provider still unreachable), two jobs settling the same order, two concurrent buyers for the last unit, and stock being restored exactly once on decline.

**5. Multi-item carts can deadlock (low)**
- **Evidence:** step 2 updates stock rows in cart order.
- **Concrete case:** cart 1 holds A and B, cart 2 holds B and A. Postgres kills one and that customer gets a 500.
- **Fix:** update SKUs in sorted order.

**6. Confirmation email can be lost (low)**
- **Evidence:** step 4 commits `PAID`, then queues the email. A crash between the two drops the email and nothing retries it.
- **Fix:** write an outbox row in the same transaction, or accept the loss and say so in the design.

**7. Data model gaps (low)**
- No primary keys are stated for `order_items` or `stock`.
- There is no `CHECK (available >= 0)` and no check constraint on `status`.
- There is no column for the provider's charge id, which support and refunds will need.

**8. No way for the client to learn the outcome after a `202` (low)**
- **Evidence:** step 6 returns `202`, but no `GET /orders/{id}` endpoint is defined.

## Speculative, worth a quick check

- **Price source:** the design does not say where `unit_price` and `total` come from. If they come from the client's cart, a customer can set their own price; they should come from a server-side source.
- **Request duration:** the worst case in step 3 is about 20 seconds plus backoff (four attempts at 5 s each). Check that the load balancer and client timeouts are longer, or the client will see a network error instead of the `202`.
- **Module boundary:** step 2 changes `stock` and `orders` in one transaction, while the Code structure section says no module reads another's tables. This works if the inventory module exposes a reserve function that accepts the caller's transaction, which is worth stating.

VERDICT: READY WITH CHANGES
