Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
76 lines
5.1 KiB
Markdown
76 lines
5.1 KiB
Markdown
# Tasks: add-zh-cn-messages
|
|
|
|
Design: `design.md` and `docs/superpowers/specs/2026-12-02-zh-cn-messages-design.md`. Every task is TDD: list the babyboo rules it ports, turn them into failing tests, then build. The owner said no workers (2026-12-02), so everything runs serially in the main session with a self-review per task.
|
|
|
|
Verify commands:
|
|
- **Backend:** `mvn -T 1C -B -q -pl <modules> -am verify`.
|
|
- **Portal:** `cd solvway-admin-portal && npx vitest run; echo VITEST=$? && npx tsc --noEmit && npm run lint` (check the vitest exit code).
|
|
|
|
## 1. Data
|
|
|
|
- [x] 1.1 SQL: `sql/01-locales.sql` (`supported_locale` with the five languages, English and 简体中文 enabled; `catalog_meta` at version 0), `sql/02-modules.sql` (`BO_MESSAGES`, `BO_LOCALES` under System, no role) and `sql/99-rollback.sql`. Append `01` and `02` to `local/seed/03-colite.sql`.
|
|
- Verify: load the seed into a throwaway local MySQL volume and list the tables and modules.
|
|
|
|
## 2. services-system
|
|
|
|
- [x] 2.1 Language registry: entity, repository, service and `/locale/*` controller, with the duplicate, code-locked, English-locked and last-enabled refusals, and the catalog version bump on save and update.
|
|
- Verify: `mvn -T 1C -B -q -pl solvway-services-system -am verify`
|
|
- [x] 2.2 Messages:
|
|
- `catalog_meta` with `/message/catalogVersion`;
|
|
- `/message/search` (searchKey over code, `en_US`, `zh_CN`; missingLocale; area; paging);
|
|
- save refusals (`MsgsCodeAreaLocked`, `MsgsDuplicateCode`);
|
|
- the version bump on every save and none on a refusal.
|
|
- Verify: as 2.1.
|
|
|
|
## 3. Gateway
|
|
|
|
- [x] 3.1 Narrow the token bypass from any `/message/` URL to the exact read paths in use (grep the callers first), plus `/locale/findAllEnabled`. Tests cover open reads and token-gated writes. Security code: read the whole diff.
|
|
- Found in the live check: the gateway had no `/locale/**` route, so the registry answered 404. Added the route with a test.
|
|
- Verify: `mvn -T 1C -B -q -pl solvway-api-gateway -am verify`
|
|
|
|
## 4. mobile-api
|
|
|
|
- [x] 4.1 `AdminLocaleController` and the public `/api/public/locales`. Refusals pass through as 409 with the reason; locale writes are audited.
|
|
- [x] 4.2 `AdminMessageController`: catalog and catalog-version (API key, no session); list and search; detail; `PUT` (the path id wins); export (audited as a sensitive read); import (match by code ignoring case, per-row summary, audited); module `BO_MESSAGES`; no create and no delete mapping.
|
|
- Verify (4.1 and 4.2): `mvn -T 1C -B -q -pl solvway-mobile-api -am verify`
|
|
|
|
## 5. Portal
|
|
|
|
- [x] 5.1 Route handlers `app/api/locales/**` and `app/api/messages/**`, `routeModules`, sidebar System entries with icons. The language list reloads after sign-in.
|
|
- [x] 5.2 Languages page `/locales`: list, add, edit label and order, code read-only on edit, guarded switch with confirm, inline refusals.
|
|
- [x] 5.3 Translations page `/messages`:
|
|
- list with code, English and Chinese;
|
|
- search, the Missing Chinese filter and its badge;
|
|
- the edit panel: placeholder checks, unsaved guard, code read-only;
|
|
- export download, and import with preview and summary;
|
|
- no add or delete.
|
|
- Verify (5.1 to 5.3): portal verify.
|
|
|
|
## 6. Chinese
|
|
|
|
- [x] 6.1 `zh_CN.seed.json` for every `defaultMessages.ts` key, following the glossary in design decision 7. Guard tests: full coverage, equal placeholders, no extra keys.
|
|
- [x] 6.2 Generator `npm run i18n:sql` writing `sql/03-zh-cn-messages.sql`. It upserts zh_CN, inserts missing rows with English, aligns the four English rows and bumps the version. A test checks the committed SQL matches the generator. Mirror it into `local/seed/04-zh-cn-messages.sql`.
|
|
- Verify: portal verify, then apply the SQL to the local DB and confirm the catalog endpoint returns Chinese for a sample of keys.
|
|
|
|
## 7. Release
|
|
|
|
- [x] 7.1 `docs/deployment.md`: the SQL order, the modules, the first-pass note for the native-speaker review, and the gateway narrowing.
|
|
- [x] 7.2 Live Playwright check on the local stack, at 1280 and 360 px:
|
|
- switch to 简体中文 and walk every sidebar page;
|
|
- English unchanged after sign-in ("Log in");
|
|
- edit a translation and see it on the next load;
|
|
- a placeholder mismatch blocks Save;
|
|
- Missing Chinese filter;
|
|
- export, then import with the preview;
|
|
- Languages: the English switch is disabled, switching 简体中文 off asks first (cancel);
|
|
- a user without the modules gets the not-authorised page.
|
|
- Done 2026-12-02 on port 3012 as the local super admin. Everything above passed except the last item: no local user without the modules exists, so it is covered by unit tests only.
|
|
- Found and fixed in the check: the sign-in page had no language picker (added), and "关闭" for Switch off clashed with the dialog's Close button (now "确认关闭").
|
|
- Open: Translations lists about 3,400 inherited Tastefully labels, so the Missing Chinese filter shows 1,739 rows that Co-Lite never displays.
|
|
- [x] 7.3 Whole-branch self-review, then the PR to main and the merge.
|
|
|
|
## Workflow follow-up
|
|
|
|
- Archive after `add-whatsapp-inbox` is archived, since both modify the sidebar requirement.
|
|
- Tell the owner the Chinese is ready for the native-speaker review, and which screen to use.
|