**The design is not ready to build from. It has a double-charge bug, and it can lose a charge record when the service crashes.** The module structure is fine. The checkout flow isn't. Everything below comes from `design.md` alone.

## Blockers (fix before writing code)

1. **Retrying the charge can bill a customer twice.**
   - Step 4 retries on a 5 s timeout, up to 3 times. A timeout doesn't mean the charge failed. The provider may have charged the card and answered slowly.
   - Failing case: attempt 1 times out but succeeds at the provider. Attempt 2 charges again. The customer pays twice for one order.
   - Expected: every charge attempt for an order carries the same idempotency key, such as the order id, so the provider treats retries as one charge. The design doesn't mention one.

2. **A crash or failure after the charge loses all record of it.**
   - The order is only committed after the charge succeeds (step 5), and a failure rolls back the `PENDING` row (step 6).
   - Failing case: the charge succeeds, then the commit fails or the process dies. The customer has been billed and the database holds nothing.
   - The same happens when all 3 retries time out. You roll back and tell the client "error", but the charge may have gone through. Nothing in the design reconciles this.
   - Expected: commit `PENDING` first, charge outside the transaction, then update the status. Add a reconciliation job (or a provider webhook) that settles orders stuck in `PENDING`.

3. **The database transaction stays open during the payment call.**
   - A slow provider can hold a connection and row locks for 15 s or more (3 × 5 s plus the retries).
   - On a single Postgres instance, a provider slowdown can use up the connection pool and take down the whole service. This is the same fix as blocker 2.

4. **A client retry creates a duplicate order.**
   - `POST /orders` has no client idempotency key.
   - Failing case: a mobile client times out after 10 s and resubmits. That creates two orders and two charges.

5. **Nightly backups on one instance can lose up to 24 hours of paid orders.** For a payments system, that is a loss of money records. You need point-in-time recovery (WAL archiving) at minimum, and a stated recovery target.

## Serious gaps (decide before building)

6. **Stock is checked but never reserved.**
   - The cache is up to 5 minutes stale, and the design never says the check decrements anything. Two customers can both buy the last unit.
   - The design doesn't say what happens when the warehouse later says the item is out. Choose between backorder, cancel and refund, or a short reservation. At 2,000 orders a day a hot item can still oversell.
   - The 800 ms argument only justifies the cache for browsing. It doesn't justify skipping a reservation at checkout.

7. **The confirmation email is sent inline, with no failure handling.** If the send fails after commit, you either error on a paid order or silently skip the email. Use an outbox row and a worker that sends it.

8. **There is no order state machine.** The design only names `PENDING` and `PAID`. It doesn't cover `PAYMENT_FAILED`, `CANCELLED`, `REFUNDED`, or how long an order may stay `PENDING`.

9. **Worst-case request latency is over 15 s.** The client's timeout and behaviour for this aren't specified. Consider returning `202` with the order id and letting the client poll or wait for a webhook.

10. **The design is silent on these:**
    - Authentication.
    - Who computes the price. It must not come from the client's cart.
    - Currency and tax.
    - Input validation.
    - Refunds.
    - Payment provider outages (circuit breaker, or a clear error to the user).

11. **The test plan is too thin.** It has unit tests per module and one happy-path integration test. This design's risks are all failure paths, so add tests for:
    - A timeout that actually succeeded at the provider (no double charge).
    - A crash between charge and commit, recovered by reconciliation.
    - A duplicate client submit.
    - Concurrent orders for the last unit in stock.
    - An email failure.

    Per your TDD standard, write these failing tests first.

12. **Observability is only logging.** Add metrics and alerts for payment failure rate, orders stuck in `PENDING`, and the reconciliation backlog. Logging with an order id on every line is fine, but it won't tell you when charges and orders disagree.

## What's fine

- Separate modules with no cross-module table reads.
- Thin routes with an `OrderCheckout` service.
- Structured logging with the order id.
- Staying on a single Postgres instance is reasonable at 2,000 orders a day. The problems are backups and holding transactions open, not scale.

## Suggested next step

Revise the flow to this shape, then add the failure-path tests:

```mermaid
flowchart TD
  A[POST /orders with client idempotency key] --> B[Validate, price server-side, reserve stock]
  B --> C[Commit order as PENDING + outbox row]
  C --> D[Charge provider with idempotency key = order id, outside any transaction]
  D -->|success| E[Mark PAID, outbox sends email]
  D -->|definite failure| F[Mark PAYMENT_FAILED, release stock]
  D -->|timeout / unknown| G[Stay PENDING]
  G --> H[Reconciliation job asks provider, settles to PAID or PAYMENT_FAILED]
```

A revised design with these changes should take about a day. Building the current one means shipping a double-charge bug.

VERDICT: NOT READY
