Files
vmall/openspec/changes/archive/2026-09-17-replace-mock-api-wave-2/proposal.md
T
james 2136a48fbe chore(openspec): archive the mock-migration waves and green the spec set
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.
2026-09-17 16:36:10 +00:00

1.9 KiB

Proposal

Why

Auth is the last thing between the mall and real accounts. The fixed-data adapter accepts any credentials and always returns the same demo user, so login, register and "me" are theatre — and every domain needing a bearer token (cart, orders, invoices) is pinned behind them. shop-admin and admin already authenticate against the live backend.

What Changes

  • Flip the auth domain to live via liveDomains; cart, orders, shipments and invoices stay on fixed data.
  • Align the client password rule with the API: the panels require 6 characters, but /auth/register requires 8 and answers 400 (apps/api/src/routes/auth.rs:32).
  • Map real failures to distinct messages — 401 for bad credentials, 409 when an email is taken — instead of one generic "request failed".
  • Drop the register SMS-code field: its button only runs a countdown, there is no endpoint, and the value is never sent, so it is a mandatory no-op once auth is real.
  • Validate a stored token through /auth/me on load rather than trusting localStorage alone.
  • BREAKING (auth UX): the demo's "log in as anyone, any password" behaviour ends; wrong credentials now fail.

Capabilities

New Capabilities

(none)

Modified Capabilities

  • frontend-mall: the "Auth and buyer center" requirement stops being backed by deterministic mock auth and uses the live auth API.

Impact

apps/mall/plugins/api.ts and apps/mall/nuxt.config.ts (liveDomains), pages/login.vue, pages/register.vue, stores/session.ts, middleware/auth.ts, and locales-extra.ts for the new error strings. No backend or shop-admin/admin change.

Non-goals

Cart, orders, shipments and invoices stay on fixed data: the mock adapter holds cart -> orders -> shipments as one shared state, so flipping cart alone would fail checkout with EMPTY_CART. They move together in a later wave. No store, address, favourite or coupon work.