**The design is sound enough to start building tomorrow, provided you settle three gaps in the spec first: two in the reconciliation job and one about where prices come from.** The core flow needs no rework. Stock is reserved atomically, the payment call sits outside any transaction, and the provider de-duplicates charges on the order id.

## Fix before you start

**1. Two reconciliation runs can restore the same stock twice (high).**
- **Evidence:** There are two instances, and the design does not say where the 5-minute job runs or that status changes check the current status.
- **Failing case:** An order for 1 unit of SKU A is stuck `PENDING` and the provider says the charge was declined. Both instances' jobs read it as `PENDING`, and both mark it `FAILED` and add 1 back. `available` rises by 2 when only 1 was reserved, so you later sell a unit that does not exist.
- **Same cause, other symptom:** Two runs that both settle an order as `PAID` send two confirmation emails.
- **Fix:** Make every status change conditional (`UPDATE orders SET status = ... WHERE id = :id AND status = 'PENDING'`), and restore stock or queue the email only if that update changed a row. This applies to steps 4 and 5 as well as the job.

**2. The reconciliation job's outcomes are under-specified (high).**
Step 6 says it settles orders as `PAID` or `FAILED`, but leaves three cases open:
- **Provider has no record of the charge.** This happens if the instance crashes after step 2 commits and before step 3 calls the provider. The order would sit `PENDING` holding stock until the 30-minute alert fires. Decide whether to mark it `FAILED` or attempt the charge.
- **Provider says the charge is still processing.** The order should stay `PENDING` for the next run.
- **Side effects on settling.** Step 6 does not say that `FAILED` restores stock or that `PAID` queues the confirmation email. Both should reuse the code paths from steps 4 and 5.

**3. The source of `unit_price` and `total` is not stated (high if prices come from the client, otherwise a non-issue).**
Step 1 says the client sends "the cart". If the cart carries prices, a customer can set their own. State that the server looks prices up and computes `total`, and name which module owns prices, since no module may read another's tables.

## Fix during the build

| # | Issue | Severity | Evidence and fix |
|---|---|---|---|
| 4 | Idempotency key is unique across all customers | Medium | Step 1 returns "the existing order" for a repeated key. If customer B sends a key customer A used, B gets A's order. Make the constraint `(customer_id, idempotency_key)`. |
| 5 | Same key with a different cart is undefined | Low | Step 1 would silently return the old order. Return `422`, or document that the first cart wins. |
| 6 | Multi-item orders can deadlock | Low | Step 2 updates one stock row per item. Orders for (A, B) and (B, A) at the same moment lock in opposite order, and Postgres aborts one as a 500. Update in sorted `sku` order. |
| 7 | Confirmation email can be lost | Low | Step 4 commits `PAID` and then queues the email. A crash in between means no email, and nothing retries because the order is no longer `PENDING`. Write an outbox row in the same transaction, or accept and document it. |
| 8 | Data model omits keys and constraints | Low | No primary keys are listed, and `order_items` has no key or foreign key. Add `CHECK (available >= 0)`, a check on `status` values, and a primary key on `stock.sku`. |
| 9 | Test plan misses the riskiest paths | Medium | The list has no test for the reconciliation job (each outcome in issue 2, and two runs at once), two simultaneous `POST /orders` with the same key, two buyers racing for the last unit, or stock restored after a decline. |

## Speculative, worth a quick check

- **Request duration.** Four attempts at 5 s plus backoff can hold the request for about 30 s. If the load balancer's timeout is shorter, the client sees a gateway error instead of the `202`.
- **Reading an order back.** After a `202` the client needs a way to learn the result. The design names no `GET /orders/:id` or equivalent.
- **Provider lookup.** Step 6 assumes the provider can look up a charge by your idempotency key (the order id). If it only looks up by its own charge id, you need a column to store that id.

VERDICT: READY WITH CHANGES
