From 82c1e8e4bb60d71fa88199e999142c3b3bdff85f Mon Sep 17 00:00:00 2001 From: Zhang Chengdong Date: Fri, 18 Sep 2026 12:43:18 +0000 Subject: [PATCH] chore(openspec): archive add-points-mall Sync the points-mall capability plus the frontend-mall and frontend-admin requirements into the main specs, and write the capability Purpose the archive leaves as a placeholder. --- .../.openspec.yaml | 0 .../2026-09-18-add-points-mall}/design.md | 0 .../2026-09-18-add-points-mall}/proposal.md | 0 .../specs/frontend-admin/spec.md | 0 .../specs/frontend-mall/spec.md | 0 .../specs/points-mall/spec.md | 0 .../2026-09-18-add-points-mall}/tasks.md | 12 +++---- openspec/specs/frontend-admin/spec.md | 12 +++++++ openspec/specs/frontend-mall/spec.md | 7 ++++ openspec/specs/points-mall/spec.md | 35 +++++++++++++++++++ 10 files changed, 60 insertions(+), 6 deletions(-) rename openspec/changes/{add-points-mall => archive/2026-09-18-add-points-mall}/.openspec.yaml (100%) rename openspec/changes/{add-points-mall => archive/2026-09-18-add-points-mall}/design.md (100%) rename openspec/changes/{add-points-mall => archive/2026-09-18-add-points-mall}/proposal.md (100%) rename openspec/changes/{add-points-mall => archive/2026-09-18-add-points-mall}/specs/frontend-admin/spec.md (100%) rename openspec/changes/{add-points-mall => archive/2026-09-18-add-points-mall}/specs/frontend-mall/spec.md (100%) rename openspec/changes/{add-points-mall => archive/2026-09-18-add-points-mall}/specs/points-mall/spec.md (100%) rename openspec/changes/{add-points-mall => archive/2026-09-18-add-points-mall}/tasks.md (76%) create mode 100644 openspec/specs/points-mall/spec.md diff --git a/openspec/changes/add-points-mall/.openspec.yaml b/openspec/changes/archive/2026-09-18-add-points-mall/.openspec.yaml similarity index 100% rename from openspec/changes/add-points-mall/.openspec.yaml rename to openspec/changes/archive/2026-09-18-add-points-mall/.openspec.yaml diff --git a/openspec/changes/add-points-mall/design.md b/openspec/changes/archive/2026-09-18-add-points-mall/design.md similarity index 100% rename from openspec/changes/add-points-mall/design.md rename to openspec/changes/archive/2026-09-18-add-points-mall/design.md diff --git a/openspec/changes/add-points-mall/proposal.md b/openspec/changes/archive/2026-09-18-add-points-mall/proposal.md similarity index 100% rename from openspec/changes/add-points-mall/proposal.md rename to openspec/changes/archive/2026-09-18-add-points-mall/proposal.md diff --git a/openspec/changes/add-points-mall/specs/frontend-admin/spec.md b/openspec/changes/archive/2026-09-18-add-points-mall/specs/frontend-admin/spec.md similarity index 100% rename from openspec/changes/add-points-mall/specs/frontend-admin/spec.md rename to openspec/changes/archive/2026-09-18-add-points-mall/specs/frontend-admin/spec.md diff --git a/openspec/changes/add-points-mall/specs/frontend-mall/spec.md b/openspec/changes/archive/2026-09-18-add-points-mall/specs/frontend-mall/spec.md similarity index 100% rename from openspec/changes/add-points-mall/specs/frontend-mall/spec.md rename to openspec/changes/archive/2026-09-18-add-points-mall/specs/frontend-mall/spec.md diff --git a/openspec/changes/add-points-mall/specs/points-mall/spec.md b/openspec/changes/archive/2026-09-18-add-points-mall/specs/points-mall/spec.md similarity index 100% rename from openspec/changes/add-points-mall/specs/points-mall/spec.md rename to openspec/changes/archive/2026-09-18-add-points-mall/specs/points-mall/spec.md diff --git a/openspec/changes/add-points-mall/tasks.md b/openspec/changes/archive/2026-09-18-add-points-mall/tasks.md similarity index 76% rename from openspec/changes/add-points-mall/tasks.md rename to openspec/changes/archive/2026-09-18-add-points-mall/tasks.md index adca72f..745d957 100644 --- a/openspec/changes/add-points-mall/tasks.md +++ b/openspec/changes/archive/2026-09-18-add-points-mall/tasks.md @@ -6,16 +6,16 @@ ## 2. Contract and backend proof -- [ ] 2.1 Register customer and platform routes with appropriate roles and add shared types, client methods, locales, and fixed-data adapter parity. +- [x] 2.1 Register customer and platform routes with appropriate roles and add shared types, client methods, locales, and fixed-data adapter parity. - [x] 2.2 Add integration tests for unpublished-product rejection, insufficient points rollback, concurrent final stock, ownership filtering, and fulfillment transition validation. ## 3. Application surfaces -- [ ] 3.1 Add platform-admin points-product and redemption-order management screens and admin nav entries using the shared client. -- [ ] 3.2 Replace mall points fixtures with live catalog, address-aware redemption, refreshed balance, and customer redemption history. -- [ ] 3.3 Remove `INTEGRAL_PRODUCTS` and `USER_STATS` page imports without deleting fixed-data adapter support. +- [x] 3.1 Add platform-admin points-product and redemption-order management screens and admin nav entries using the shared client. +- [x] 3.2 Replace mall points fixtures with live catalog, address-aware redemption, refreshed balance, and customer redemption history. +- [x] 3.3 Remove `INTEGRAL_PRODUCTS` and `USER_STATS` page imports without deleting fixed-data adapter support. ## 4. Verification and specification -- [ ] 4.1 Seed deterministic points products and credit demo customer points through the archived customer-accounts credit path (append-only entry, never an absolute balance write). Browser-smoke admin publication and customer redemption. -- [ ] 4.2 Run cargo test for vmall-api, builds for mall and admin, and strict validation for this OpenSpec change. +- [x] 4.1 Seed deterministic points products and credit demo customer points through the archived customer-accounts credit path (append-only entry, never an absolute balance write). Browser-smoke admin publication and customer redemption. +- [x] 4.2 Run cargo test for vmall-api, builds for mall and admin, and strict validation for this OpenSpec change. diff --git a/openspec/specs/frontend-admin/spec.md b/openspec/specs/frontend-admin/spec.md index 3d5b8ec..bf61885 100644 --- a/openspec/specs/frontend-admin/spec.md +++ b/openspec/specs/frontend-admin/spec.md @@ -2,7 +2,9 @@ ## Purpose The platform console for managing users, shops and currencies. + ## Requirements + ### Requirement: Platform user and shop management Platform admins SHALL assign user roles (with shop scope), create shops, and suspend/activate shops. Suspended shops' products MUST NOT be purchasable (enforced by API, reflected in UI). @@ -17,3 +19,13 @@ Platform admins SHALL view currencies and update exchange rates; new rates affec - **WHEN** an admin updates CNY rate_to_base - **THEN** the mall conversion endpoint returns amounts computed with the new rate +### Requirement: Platform points mall management +Platform admins SHALL manage points products and inspect and fulfill redemption orders through the admin console using the shared API contract. Admin SHALL expose points-mall navigation beside existing platform operations. + +#### Scenario: manage a redemption catalog item +- **WHEN** a platform admin publishes a configured points product +- **THEN** it becomes available in the customer points mall + +#### Scenario: points mall appears in admin navigation +- **WHEN** an authenticated platform admin opens the admin console +- **THEN** points-product and redemption-order management are reachable from the console nav diff --git a/openspec/specs/frontend-mall/spec.md b/openspec/specs/frontend-mall/spec.md index 0122516..66baada 100644 --- a/openspec/specs/frontend-mall/spec.md +++ b/openspec/specs/frontend-mall/spec.md @@ -174,3 +174,10 @@ The mall SHALL load a product's currently claimable shop coupons and the signed- #### Scenario: order shows realized discount - **WHEN** checkout succeeds with a coupon on one shop order - **THEN** that order's payment and detail views show the server discount and reduced total without a client-calculated amount + +### Requirement: Live points mall +The mall SHALL display live published points products and the signed-in customer's live points balance, allow redemption with a shipping address, and show the customer's redemption history on the points route. It SHALL replace `INTEGRAL_PRODUCTS` and `USER_STATS` imports on the points route. + +#### Scenario: redeem available product +- **WHEN** a signed-in shopper with enough points redeems a published in-stock product +- **THEN** the mall shows the created redemption order and refreshed points balance diff --git a/openspec/specs/points-mall/spec.md b/openspec/specs/points-mall/spec.md new file mode 100644 index 0000000..6a4818a --- /dev/null +++ b/openspec/specs/points-mall/spec.md @@ -0,0 +1,35 @@ +# points-mall Specification + +## Purpose +Offer a platform-owned catalog of rewards a customer can redeem for loyalty points, with its own order lifecycle kept separate from cash orders and merchant SKU inventory. Redemption reserves product stock, debits the points ledger atomically with the order as reference, and snapshots the product and shipping address; platform operators publish the catalog and move redemptions to fulfilled or cancelled. + +## Requirements + +### Requirement: Platform points product catalog +Platform admins SHALL create, update, publish, unpublish, and list points products with localized user-facing content, integer points price, stock, images, and recommendation order. Customers SHALL discover only published products. + +#### Scenario: unpublished product is unavailable +- **WHEN** an admin unpublishes a points product +- **THEN** customers cannot discover or redeem it + +### Requirement: Atomic points redemption +An authenticated customer SHALL redeem a published points product using a quantity and shipping address. The server SHALL atomically validate stock, debit points through customer accounts, create a redemption order with immutable product and address snapshots, and decrement stock. + +#### Scenario: insufficient points +- **WHEN** a customer redeems a product costing more points than available +- **THEN** the API returns 409 and creates no redemption order or stock change + +#### Scenario: final stock contention +- **WHEN** concurrent redemptions request the final product stock +- **THEN** only requests covered by stock succeed and no negative stock is stored + +### Requirement: Redemption history and fulfillment +Customers SHALL list only their redemption orders. Platform admins SHALL list redemption orders and transition pending fulfillment to fulfilled or cancelled with validated current status. Demo seed SHALL credit points through customer accounts so at least one published product can be redeemed in the live mall. + +#### Scenario: fulfill redemption +- **WHEN** a platform admin fulfills a pending redemption order +- **THEN** its status becomes fulfilled and the customer sees that status in history + +#### Scenario: seeded points are spendable +- **WHEN** a seeded demo customer with a seed ledger credit redeems an in-stock published product they can afford +- **THEN** the redemption succeeds and the points summary decreases by the product price