`design.md` is sound enough to start building tomorrow, provided you settle three gaps in it first. Each is a few lines of design text, not a rethink. The core shape is right: reserve stock in one transaction, charge outside any transaction with the order id as the provider idempotency key, and reconcile unknown results.

## Fix before building

1. **An order can be settled twice, which restores its stock twice.** Nothing says the move out of `PENDING` is conditional, and the reconciliation job has no stated single-runner rule across the two instances.
   - **Failing case:** an order for 1 unit is declined. The request path (step 5) and the reconciliation job, or the job on both instances, each mark it `FAILED` and each add 1 back.
   - **Result:** `stock.available` ends 1 higher than reality and you oversell later.
   - **Fix:** settle with `UPDATE orders SET status = … WHERE id = … AND status = 'PENDING'`, and restore stock in the same transaction only if that update changed a row.

2. **Reconciliation has no rule for an order the provider has never heard of.** Step 6 says the job settles orders as `PAID` or `FAILED`, but not what happens when there is no charge to look up.
   - **Failing case:** the instance crashes after step 2 commits and before the charge call in step 3. The order is `PENDING`, the stock is reserved, and the provider has no charge.
   - **Result:** as written, the order stays `PENDING` forever, the stock stays locked, and the 30-minute alert fires with no defined remedy.
   - **Fix:** treat "no charge found" as `FAILED` and restore stock. Also state that the request path never attempts a charge after the 2-minute cutoff, so a late charge cannot land on an order already marked `FAILED`. Worst-case retry time today is about 30 s, so this holds if the backoff is capped.

3. **The idempotency key's uniqueness is not scoped to the customer.**
   - **Failing case:** customer B sends a key that customer A already used.
   - **Result:** B gets A's order back.
   - **Fix:** make the constraint unique on `(customer_id, idempotency_key)`. Also decide what a repeated key with a different cart returns; I suggest `422`.

## Smaller additions

- **Deadlocks:** two carts holding the same SKUs in different order can deadlock in step 2. Update stock rows in sorted SKU order.
- **Price source:** the design does not say where `unit_price` and `total` come from. State that the server computes them from its own prices and never takes them from the client's cart.
- **Constraints:** add a primary key on `order_items (order_id, sku)`, a primary key on `stock.sku`, and `CHECK (available >= 0)` as a backstop.
- **Email:** a crash between the `PAID` commit and the enqueue in step 4 loses the confirmation email. Either accept that explicitly or write the email job in the same transaction.
- **Scope:** there is no cancel or refund state. That is fine for a first version if it is deliberate; say so in the doc.

## Tests to add

The test list never covers the reconciliation job. Add these cases:

- Reconciliation settles an order as `PAID`.
- Reconciliation settles an order as `FAILED` and restores stock.
- Reconciliation handles "provider has no record" after a crash between reserve and charge.
- Reconciliation racing the request path restores stock exactly once.
- Two concurrent `POST /orders` with the same key create one order.
- Two concurrent buyers of the last unit get one success and one `409`.
- A decline restores stock.

VERDICT: READY WITH CHANGES
