**Not ready to build tomorrow.** The payment step in `design.md` can charge a customer twice or charge them and keep no order. Both can happen in normal operation, and both need a design decision before you write code.

## Must fix before building

**1. Retrying the charge can double-charge (step 4).**
- A timeout doesn't mean the charge failed.
- Case: the provider charges the card at 4.9 s, and your 5 s timer fires first. You retry, and the customer is charged twice, up to three times.
- Fix: send an idempotency key with every charge call, for example the order id. Retries then return the original result.
- After the final timeout, don't treat the outcome as a failure. Look up the charge by key, or mark the order `PAYMENT_UNKNOWN` and reconcile it.

**2. A crash can charge the customer and keep no order (steps 3–6).**
- Nothing is saved until the commit in step 5, and the commit comes after the charge.
- Case: the charge succeeds, the process dies (deploy, OOM, or the commit fails), and the transaction rolls back. The customer has paid and you have no order and no record of the payment.
- The same happens when step 6 rolls back after an ambiguous timeout.
- Fix:
  1. Commit the `PENDING` order first.
  2. Charge outside any transaction.
  3. Update the order to `PAID` or `FAILED` in a second short transaction.
  4. Run a reconciler that resolves `PENDING` orders older than N minutes against the provider.

**3. The transaction stays open during the payment call.**
- It holds a database connection for up to about 15 s (3 × 5 s) per order.
- At 2,000 orders a day this is survivable. It will cause trouble the first time the provider is slow and a burst arrives.
- Fixing item 2 also removes this problem.

**4. Stock checking can oversell, and the design doesn't say what happens then (step 2).**
- The cache is up to 5 minutes old, and nothing reserves or decrements stock.
- Case: 1 unit is left and 3 customers order within the same refresh window. All three pass the check and all three are charged.
- You may well accept staleness. The design still needs a stated policy for the loser: refund and apologise, backorder, or something else.
- The "800 ms is too slow" argument is weak at 200 to 2,000 orders a day. Checkout is not a latency-critical path, so a direct call or a reservation call may be better.
- Whichever you choose, write down the oversell policy.

**5. There's no duplicate-order protection on `POST /orders`.** A client retry after a network blip creates a second order. Require a client-supplied idempotency key, with a unique constraint on it.

**6. The test plan skips every failure path.**
- One happy-path integration test doesn't cover items 1, 2 and 5, which are the places this design breaks.
- Minimum tests:
  - Timeout on the first attempt followed by success: exactly one charge.
  - Crash between charge and commit: the reconciler recovers the order.
  - Duplicate request key: one order.
  - Oversell: the stated policy runs.
  - Payment declined: the order ends in `FAILED`.
- This conflicts with your own test-first standard, so write these tests first.

## Should fix, but can be decided early in the build

- **Backups:** nightly backups on a single instance mean you can lose up to 24 hours of orders and payments. Turn on WAL archiving or point-in-time recovery, and test a restore once.
- **Email:** it is sent inline after the commit. If it fails, either the request errors for an order that is already paid, or the email is silently lost. Write it to an outbox table and send it from a worker.
- **Price trust:** the doc doesn't say the server reprices the cart. Never trust client-supplied prices or totals.
- **Order lifecycle:** you need an explicit state machine (`PENDING`, `PAID`, `FAILED`, `PAYMENT_UNKNOWN`, and later `REFUNDED`) with its allowed transitions. The doc only names `PENDING` and `PAID`.
- **Module boundary:** "no module reads another's tables" is good, but `OrderCheckout` currently spans modules inside one transaction. Once the transaction is split (item 2), state which module owns which write.
- **Missing topics:** authentication, refunds and cancellation, payment webhooks (providers often confirm asynchronously), and metrics and alerts. Your logging plan covers logs, but not alerting on stuck `PENDING` orders.

## What's good

- The module separation, thin routes and the `OrderCheckout` service are sound.
- Putting the order id on every log line is a good choice.
- Scoping to a single Postgres instance fits the volume.

The fixes are modest, and a revised flow would take you about half a day. Once items 1 to 6 are in the doc, I'd re-review it, since the revised flow is new and untested.

VERDICT: NOT READY
