Archive the three completed changes behind replace-mock-api-wave-1/2/3. Each merge applied cleanly to the main specs: - catalog gains the Public product browse requirement (subtree filtering and price sort) - frontend-mall picks up the per-domain adapter, the pinned home page, the discovery-page changes, the live auth panels and the live transaction flows - cart's Server-side cart requirement now documents the shop and stock carried by every line Also replace the TBD Purpose placeholder in all eleven specs with a one-line description of what each capability covers. Those placeholders predate this work and were the only reason `openspec validate --all --strict` reported 0 passed / 11 failed; it now reports 11 passed / 0 failed.
1.8 KiB
1.8 KiB
Proposal
Why
Cart, orders, shipments and invoices are the last mocked domains, and they cannot move one at a time: the fixed-data adapter keeps cart -> orders -> shipments in one shared state, so a live cart with a mock checkout dies on EMPTY_CART and mock invoices 404 on live order ids.
What Changes
- Flip
cart,orders,shipmentsandinvoicesto live together, so one purchase runs end to end. - BREAKING (data): cart and order state moves from
localStorageto Redis/Postgres; existing mock carts and orders do not carry over. - Extend the cart line with its shop and stock so the cart keeps grouping per shop and the stepper caps at real stock;
CartItemViewalready joins both (apps/api/src/cart.rs:68-74). - Ask an anonymous shopper to sign in rather than fail: a live
addCartItemanswers 401 on a public page, which redirects to/login?redirect=…. - Stop the shared contract lying:
Shipment.itemsis required in TS but never returned, andInvoice.invoice_nois nullable live but non-null in TS. - Keep
MOCK_ADDRESSESbehind checkout: live checkout takes the address in the request body.
Capabilities
New Capabilities
(none)
Modified Capabilities
cart: the cart view carries each line's shop and current stock.frontend-mall: the shopping and transaction flows run against the live API, and an anonymous add-to-cart prompts sign-in.
Impact
apps/api/src/cart.rs; packages/shared/src/{api,types}.ts; the mall's plugins/api.ts, nuxt.config.ts, cart/checkout/order/invoice pages and middleware/auth.ts. The contract change means all three frontends rebuild.
Non-goals
No addresses, favourites, coupons or storefront content. No stock check on add-to-cart; checkout stays the authority. Store names on order surfaces keep their generic fallback until Wave 4.