**Mostly ready.** The flow is sound: stock is reserved and committed before payment, the charge is made outside any transaction, and the provider gets the order id as its idempotency key. But a few gaps would cause real bugs if you build exactly as written, so I'd fix them in the doc before starting. I'd call it **ready with changes**, and all of them are small edits to design.md.

## Should fix before building

**1. High: the reconciliation job can restore stock twice, or never.**
- Step 5 restores stock when a charge is declined. Step 6 says the reconciler settles orders as `PAID` or `FAILED`, but never says it restores stock.
- Concrete case: the charge times out, the order stays `PENDING`, the provider later says it declined, and the reconciler marks it `FAILED`. The stock stays reserved forever.
- You run two instances, and the doc doesn't stop both from running the job at once. Both could settle the same order and restore its stock twice.
- Fix: say that every move out of `PENDING` is a conditional update (`UPDATE orders SET status=... WHERE id=:id AND status='PENDING'`). Only the caller whose update changed a row restores stock or sends the email. That also covers a request thread racing the reconciler. Also say which module owns the shared "settle as FAILED" logic, so steps 5 and 6 use one code path.

**2. Medium: orders that were never charged have no outcome.**
- If an instance crashes between the step 2 commit and the charge call, the order is `PENDING` and the provider has no record of it.
- Step 6 doesn't say what the reconciler does when the provider answers "not found". Today it would loop until the 30-minute alert fires, and the stock stays held.
- Fix: define "not found after N minutes" as `FAILED` plus stock restore. Or re-attempt the charge, which is safe because the order id is the idempotency key.

**3. Medium: the reconciler isn't in the test list.**
- It is the recovery path for every ambiguous case, and none of the six integration tests exercise it.
- Add tests for: settle as `PAID`, settle as `FAILED` with stock restored, the provider returning "not found", two reconcilers racing, and decline restoring stock. The decline test is listed, but it should assert the stock count.
- Also add a concurrent duplicate `POST /orders` test (see item 4).

**4. Medium: the duplicate-key path is only described for the sequential case.**
- With two simultaneous requests carrying the same key, the second one hits the unique-constraint error at the order insert in step 2. The design says it rolls back, but not that it then returns the existing order instead of an error.
- The data model also doesn't show the unique index on `idempotency_key`. Say whether it is unique globally or per customer.

**5. Medium: where the price comes from is not stated.**
- The doc doesn't say who sets `unit_price` and `total`. If the client's cart supplies them, a client can send its own prices.
- State that the server looks up prices and computes the total.

## Minor

- **Deadlock risk (low):** the step 2 stock updates should run in sorted `sku` order. Two carts with the same items in different order can deadlock otherwise.
- **Lost email (low):** a crash between the `PAID` commit and queuing the email loses the confirmation. Also, the reconciler path doesn't say it queues the email. Either write the email request in the same transaction as the status change, or accept the gap and document it.
- **Missing keys (low):** `stock` and `order_items` have no primary key or unique constraint. `stock.sku` should be the primary key. Add an index on `orders(status, created_at)` for the reconciler.
- **Retry timing (low):** 4 attempts at 5 s plus backoff is a long time for a request thread to hold. Pin down the backoff values and confirm the total stays well under the 2-minute reconciler threshold. Otherwise the reconciler can settle an order while the original request is still retrying, which item 1's conditional update would also cover.

## Speculative, not blocking

- The provider's idempotency-key retention window might be shorter than your reconciliation timeline. Check their docs.
- A cap on the stuck-order reaper isn't needed at 2,000 orders a day.

With the conditional-update rule and the reconciler outcomes written down, you can start building tomorrow. The tests in item 3 are a good first thing to write.

VERDICT: READY WITH CHANGES
