Files
vmall/openspec/changes/archive/2026-09-17-replace-mock-api-wave-1/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

2.1 KiB

Proposal

Why

The mall is the only frontend still on the fixed-data mock adapter; shop-admin and admin run live. Every mall catalog surface also bypasses the @vmall/shared contract — 18 files import ~/mock/data and no $api catalog call exists. The storefront cannot outgrow demo data, and no later domain can flip until real SKU ids come from the live catalog.

What Changes

  • Replace the all-or-nothing mockApi boolean with a per-domain switch; Wave 1 flips catalog and currency, leaving auth, cart, orders, shipments and invoices on mock.
  • Rewire the browse surfaces (home floors, /search, /goods/[id], category menu) from ~/mock/data onto listCategories, listProducts and getProduct.
  • BREAKING (browse UX): remove the brand facet and the sales/comments sorts, which have no backing model; add sort=price with order=asc|desc.
  • Filter public product listing by category subtree, as the mock does today, instead of exact category_id.
  • Grow scripts/seed-demo.mjs to parity: categories with children and grandchildren, ~24 bilingual products, 4 shops (live: 3 childless categories, 4 products, 1 shop).
  • Banners, promos, quick links and floor art stay local.

Capabilities

New Capabilities

(none)

Modified Capabilities

  • catalog: add a public browse requirement — category subtree filtering and an optional price sort on /api/products.
  • frontend-mall: "Mock API adapter" becomes a per-domain switch with catalog and currency live; browse surfaces re-sourced from the API without the brand facet or non-price sorts.

Impact

apps/mall/plugins/api.ts; 18 files under apps/mall/{pages,components}; apps/mall/mock/data.ts (marketing content only); packages/shared/src/api.ts (ProductListQuery gains sort/order); apps/api/src/routes/catalog.rs; scripts/seed-demo.mjs. The shared contract change means all three frontends must rebuild.

Non-goals

Auth, cart, orders, shipments and invoices stay mock. No backend capability for brands, storefront content, store directory, favorites, coupons or addresses; those stay mock. No change to money handling, i18n storage or the other apps.