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.
2.9 KiB
2.9 KiB
Tasks
1. Adapter and configuration
- 1.1 Add
authto the defaultliveDomainsinapps/mall/nuxt.config.tsand confirmLIVE_PICKS.authinapps/mall/plugins/api.tsalready coversregister/login/me; verify a sign-in request reaches:8080whilegetCartstill resolves from fixed data - 1.2 Confirm the rollback path: with
NUXT_PUBLIC_LIVE_DOMAINSset to catalog and currency only, sign-in returns the fixed demo user again; verify by signing in with any password
2. Session and route guard
- 2.1 Add a session action that validates a restored token through
$api.me(), clearing the stored session and returning to sign-in on 401/403 but leaving the session intact when the API is merely unreachable; verify with a tamperedvmall.tokenand again with the backend stopped - 2.2 Make
middleware/auth.tsrely on the validated session rather thanlocalStoragealone; verify a shopper with a stale token lands on/loginwhile a valid one reaches/user - 2.3 Render the session-dependent header and profile name client-only (
components/shell/TopBar.vue,pages/user.vue); added during implementation because validating the session before hydration made thoselocalStorage-backed branches report hydration mismatches that the pre-change code did not; verified by A/B that the sign-in flow now produces no mismatch warnings
3. Sign-in panel
- 3.1 Map failures on
ApiError.status/codeso a 401 reports invalid credentials rather than the current generic message, adding the key toapps/mall/locales/auth.tsin en and zh (the per-domain module behindlocales-extra.ts); verify with a deliberately wrong password
4. Registration panel
- 4.1 Raise the client password rule to 8 characters with its own message; verify a 7-character password is refused without any network call.
apps/mall/pages/forgot-password.vuewas aligned to the same rule because it shares thevalidationPasswordmessage - 4.2 Remove the verification-code field and its countdown so the form no longer requires it; verify registration submits with display name, email and password only
- 4.3 Report a duplicate email (409) distinctly from other failures, adding the key to
apps/mall/locales/auth.tsin en and zh; verify by registering an address that already exists
5. Verification
- 5.1 Run
pnpm --filter @vmall/mall buildand confirm it passes - 5.2 With the backend running and seeded, verify in a browser: sign in as
customer@vmall.local, see the utility-bar welcome/sign-out state, reach/user, and confirm the only console entries are the deliberately triggered 401/409 responses plus a pre-existing hydration warning on the unauthenticated/userredirect (A/B verified identical before this change) - 5.3 With every domain set to fixed data and the backend stopped, verify sign-in and browsing still work, so the rollback path is intact