**Short answer:** the core flow is sound and you can start tomorrow, but settle the first three items below before you code step 6 and its tests. I read all 51 lines of `design.md`, and every point cites the section it comes from.

The good parts: the stock reservation is atomic (`available >= :qty`). The charge happens outside the database transaction. The order id is the provider idempotency key. Unknown outcomes land in `PENDING` and get reconciled. This is a solid design for 2,000 orders a day.

## Issues to fix (supported by the text)

| # | Severity | Issue | Evidence |
|---|---|---|---|
| 1 | High | **Stock can be restored twice.** Step 5 (decline) and step 6 (reconciler) both set `FAILED` and restore stock. Neither is said to be conditional on `status = 'PENDING'`. | Example: a request is slow, the reconciler settles the order as `FAILED` and restores 2 units, then the original request gets its decline and restores 2 more. Stock is now 2 too high, and the last-unit test won't catch it. Fix: make every status change `UPDATE … WHERE status = 'PENDING'`, and restore stock only if a row changed. |
| 2 | High | **The reconciler's rules are underspecified.** Step 6 says it "settles" orders but doesn't say it restores stock when it settles `FAILED`. It also doesn't say what to do when the provider has no record of the charge. | If the service crashes after step 2 commits but before the first charge call, the provider has never heard of the order. The text doesn't say whether that means `FAILED` plus restore, or keep waiting. As written, the stock stays held until the 30-minute alert fires. |
| 3 | High | **The reconciler is untested.** The Tests section lists six scenarios and none covers the job. | Missing: a `PENDING` order settled as `PAID`, one settled as `FAILED` with stock restored, provider "not found", and the race in item 1. This is the riskiest code in the design. |
| 4 | Medium | **The reconciler runs on both instances.** The design has two instances, and nothing says only one runs the job. | Both pick up the same `PENDING` order every 5 minutes. Item 1's guard makes this safe, but it still doubles the provider calls. Use `FOR UPDATE SKIP LOCKED` or an advisory lock. |
| 5 | Medium | **A confirmation email can be lost.** Step 4 commits `PAID`, then queues the email as a separate action. | If the process dies between the commit and the queue call, the order is `PAID` and no email is ever sent. The "retried from the queue" guarantee only covers failures after queuing. The fix is a transactional outbox, or a documented acceptance of the loss. |
| 6 | Medium | **Modules and transactions conflict.** The Code structure section says modules never read each other's tables. Step 2 needs one transaction that updates `stock` and inserts into `orders`. | The design doesn't say how inventory and orders share a transaction. Name the choice, for example a unit-of-work passed in by `OrderCheckout`. |
| 7 | Low | **Deadlock risk when reserving several SKUs.** Step 2 updates stock rows in cart order. | Cart A (sku1, sku2) and cart B (sku2, sku1) can lock in opposite order. Sort SKUs before updating. |
| 8 | Low | **Data model gaps.** | No primary key or index is stated on `stock.sku` or `order_items`. No index is stated for the reconciler's query on `status, created_at`. The unique constraint on `idempotency_key` is described in the flow but not in the table. |
| 9 | Low | **Idempotency edge cases.** | The same key sent with a different cart is not addressed (return the old order, or `422`?). A concurrent duplicate hitting the unique violation needs to roll back and then return the existing order. The test list has "duplicate POST" but not "concurrent duplicate". |
| 10 | Low | **Decline vs. provider error.** Step 5 assumes the service can tell a decline from a 5xx or malformed response. | A 5xx must not mark the order `FAILED`. State the mapping. |

## Speculative (not supported by the document, so check, don't assume)
- **Price source:** the doc doesn't say whether `unit_price` and `total` come from the client's cart or from the server. If from the client, that's a tampering risk.
- **Client wait:** with a 5 s timeout, 3 retries and backoff, a request can hold the connection for about 30 s or more before it returns `202`. That may exceed the load balancer timeout.
- **Auth and authorization** on `POST /orders` aren't mentioned. They may live elsewhere.

## Before you build
1. Add one paragraph that states the status transition rules (items 1 and 2).
2. Add reconciler tests to the Tests section (item 3).

The remaining items can be handled as you build. Items 5 and 6 are quick decisions to write down.

VERDICT: READY WITH CHANGES
