Yes, you can start tomorrow. Make a few changes to the doc first; most of them take a sentence or two. The core design is solid: the stock reservation can't oversell, the provider call happens outside any transaction, the order id is the provider idempotency key, and orders with an unknown result stay `PENDING` for the reconciliation job instead of being guessed. Those are the hard parts and you have them right. What's missing is mostly at the edges: two copies of the reconciliation job running at once, where prices come from, and a few failure cases with no defined outcome.

## High (fix in the doc before building)

1. **The reconciliation job can restore stock twice.** You run two instances, and nothing says only one runs the job. Example: order A is stuck `PENDING` and the provider says "declined". Both instances pick it up in the same 5-minute run, and each one marks it `FAILED` and adds the stock back. A 2-unit order adds back 4 units, so you've invented 2 units you can oversell later.
   - **Fix:** make every status change conditional, e.g. `UPDATE orders SET status='FAILED' WHERE id=:id AND status='PENDING'`. Only restore stock if that update changed a row.
   - Also have the job claim orders with `FOR UPDATE SKIP LOCKED` or a Postgres advisory lock.
   - This guard also covers a slow request racing the job.

2. **The doc doesn't say where prices come from.** `POST /orders` takes "the cart", and `order_items.unit_price` and `orders.total` get filled in somehow. There is no price or catalog table. If the price comes from the client, a client can send `unit_price: 0.01`. State that the service looks up prices from a trusted source and calculates `total` itself.

3. **No outcome when the provider has no record of the charge.** Example: the service commits the `PENDING` order and then crashes, or the first attempt times out before reaching the provider. Reconciliation then asks about the charge and gets "not found", which is neither `PAID` nor `FAILED`.
   - Decide the rule. For example: not found after N minutes means `FAILED` and stock is restored. Since the provider idempotency key is the order id, a late charge can't create a second one.
   - Check how long the provider keeps idempotency keys, so that rule stays safe.

## Medium

4. **The module rule contradicts the shared transactions.** "No module reads another module's tables" doesn't fit with step 2 (reserve stock and insert the order in one transaction) or step 5 (mark the order `FAILED` and restore stock in one transaction). Name the mechanism: for example, inventory exposes `reserve(tx, items)` and `release(tx, items)`, and `OrderCheckout` owns the transaction. Otherwise someone will break the rule or break atomicity.

5. **A crash can lose the confirmation email.** If the process dies after the `PAID` commit but before the email is queued, the email never goes out. Write the email job in the same transaction as the `PAID` update, using a transactional outbox table. Also say that reconciliation sends the email when it settles an order as `PAID`. Right now only the request path does.

6. **A client that gets `202` has no way to find out the final status.** Add `GET /orders/{id}`, or say that a repeated `POST` with the same key returns the current status.

7. **The idempotency key's scope and payload checks are missing.**
   - Scope the unique constraint to `(customer_id, idempotency_key)`, so two customers who happen to send the same key don't get each other's orders.
   - Reject a reused key that arrives with a different cart (`422`).
   - Say what happens to the losing request when two duplicates arrive at the same moment: catch the unique violation and return the existing order. Its stock changes roll back with it, which is correct.

8. **The retry policy doesn't say which errors to retry.** Retry only timeouts, network errors and 5xx. A decline or other 4xx is final. Worst case, the request takes about 20 s plus backoff, so check that the load balancer and client timeouts allow that.

9. **Tests are missing for the riskiest paths:**
   - Reconciliation settling `PAID`, `FAILED` and "not found"
   - Two job runs on the same order (issue 1)
   - A decline restores stock
   - Two buyers going for the last unit *at the same time* (the current test may be run one after the other)
   - Two duplicate `POST`s at the same time
   - Email failure doesn't affect the order
   - Crash between the order commit and the charge call

## Low

10. **Possible deadlocks.** Two orders that touch the same SKUs in opposite order can deadlock. Sort SKUs before the `UPDATE`s. It costs nothing to add now.
11. **Missing keys and constraints:**
    - `stock.sku` needs a primary key, and `order_items` needs one too, e.g. `(order_id, sku)`.
    - Add foreign keys.
    - Add `CHECK (available >= 0)` and `CHECK (quantity > 0)`.
    - Add a `CHECK` or enum on `status`.
12. **The provider's charge id isn't stored.** Put it on `orders`. You'll need it for support, refunds and reconciliation.
13. **Two small API details.** Say which SKU caused the `409`, and what happens when the `Idempotency-Key` header is missing (probably `400`).
14. **No stated scope.** Note that refunds, cancellation and abandoned `PENDING` orders are out of scope for now, so nobody assumes they're covered.

Once fixes 1 and 3 are in, every order status change is a guarded one-way move:

```mermaid
stateDiagram-v2
    [*] --> PENDING: stock reserved + order inserted
    PENDING --> PAID: charge succeeded (request or reconciliation)
    PENDING --> FAILED: declined or not found (stock restored once)
    PAID --> [*]
    FAILED --> [*]
```

Items 1–3 change behaviour, so write them into the doc before you start. Items 4–9 can go in alongside the first pull requests, and 10–14 as you build.

VERDICT: READY WITH CHANGES
