The core of this design is solid, and it's close to buildable. The hard parts are already right: you reserve stock with a conditional update, call the payment provider outside the transaction, reuse the order id as the provider's idempotency key, queue the email after commit, and have a reconciliation job plus a stuck-order alert. What's left are four design decisions to settle before you write the code. None of them change the structure, and you could probably close all of them in an hour of editing design.md.

## High: decide before building

**1. Status updates aren't guarded, so two actors can settle the same order and restore its stock twice.** Both service instances will probably run the 5-minute reconciliation job.
- *Case:* order X (qty 1 of SKU A) is `PENDING` and the provider says declined. Both instances mark X `FAILED` and each restores stock. Expected: `available` +1. Actual: +2, so you can oversell.
- A late success on the request path can do the same thing after reconciliation has already marked the order `FAILED`.
- *Fix:* make every transition conditional, `UPDATE orders SET status=… WHERE id=:id AND status='PENDING'`, and only restore stock if that update changed a row. Also have the job take a Postgres advisory lock, or select with `FOR UPDATE SKIP LOCKED`.

**2. The design doesn't say where prices come from.** The data model has no price table, and `stock` holds no price, so `unit_price` and `total` appear to come from the client's cart.
- *Case:* a client sends `unit_price: 0.01` and gets charged a cent.
- *Fix:* state that the server prices the cart from a catalog source (name it) and computes `total` itself.

**3. Negative quantities increase stock.**
- *Case:* `quantity = -5`. The check `available >= -5` passes, `available - (-5)` adds 5 units, and the total goes negative.
- *Fix:* validate `quantity > 0`, and add `CHECK (quantity > 0)` and `CHECK (available >= 0)` as backstops.

**4. Reconciliation doesn't cover a charge the provider never received.**
- *Case:* an instance crashes after step 2 commits but before step 3, or every attempt fails with connection refused. Reconciliation asks the provider and gets "no such charge." Today the order stays `PENDING` forever and holds its stock; the alert fires but nothing resolves it.
- *Fix:* define the rule. Either mark it `FAILED` and restore stock, or retry the charge with the same key.

## Medium

5. **The confirmation email can be lost, and the reconciliation path never sends one.** Step 4 is commit, then enqueue, so a crash between the two drops the email. Orders that reconciliation marks `PAID` are never queued at all. Fix: insert the email job in the same transaction that sets `PAID` (an outbox table), on both paths.
6. **A client that gets `202` has no way to learn the outcome.** Add `GET /orders/{id}`.
7. **Duplicate requests that arrive at the same time aren't handled.**
   - Two simultaneous `POST`s with the same key: the second one hits the unique constraint and gets a `500` unless you catch that error, roll back, and return the existing order.
   - A reused key with a *different* cart silently returns the old order. Store a hash of the request and return `422` on mismatch.
8. **Multi-item carts can deadlock.** Carts [A, B] and [B, A] reserving at the same moment can deadlock each other. Update SKUs in sorted order.
9. **The test plan is missing the risky paths:**
   - two buyers racing for the last unit
   - concurrent duplicate `POST`s
   - decline restores stock
   - reconciliation outcomes: `PAID`, `FAILED`, not-found, and two overlapping runs
   - email failure doesn't fail the order
   - crash between commit and charge
   - negative or zero quantity
10. **Step 2 crosses module boundaries without saying how.** It updates inventory and orders in one transaction, which is fine, but the design should say how the transaction is shared (for example, inventory takes the caller's transaction or unit of work). Otherwise "no module reads another's tables" gets quietly broken.
11. **Retry rules and worst-case latency are unstated.** Say that retries happen only on timeouts, network errors and 5xx, never on declines. Four 5 s attempts plus backoff is about 30 s, which may exceed the load balancer's or client's timeout. That's survivable thanks to the idempotency key, but state it.

## Low

12. There's no column for the provider's charge id. You'll want it for support, refunds and reconciliation.
13. Some constraints aren't written down:
    - primary keys on `stock(sku)` and `order_items`
    - a foreign key from `order_items` to `orders`
    - a `CHECK` limiting `status` to its three values
    - an index on `orders(status, created_at)` for the reconciliation query
14. The idempotency key is globally unique. Consider scoping it per customer with a `(customer_id, idempotency_key)` constraint, and specify a `400` when the header is missing or malformed.
15. Check how long the provider remembers idempotency keys (often about 24 h). Reconciliation must never re-charge after that window.
16. Set a maximum age for orders the provider keeps reporting as "processing," and say what happens after it.

Given your timeline: items 1–4 are each a sentence or two in design.md plus a test. Items 5–9 can land in the first few days of building, if you write their tests first.

VERDICT: READY WITH CHANGES
