refactor(ECR-001): Phase F types/sdk 对齐并拆分超标 H5 页

抽出 OpenAPI DTO;将 Ask/Report/Profile/Star 等 8 页拆到 ≤400 行,并修 ScaleSummary、fortuneKey、Scale 选答与单测。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-05 18:19:34 +08:00
co-authored by Cursor
parent 19d3cd5945
commit e735aa43e3
64 changed files with 6198 additions and 4157 deletions
+1
View File
@@ -9,3 +9,4 @@
- **ECR-001 Phase B**:拆分 `HomePage` / `SynastryPage`(≤400 行);build + homeCatalog 单测绿
- **ECR-001 Phase A/C/D/E + ECR-002**membership 服务抽出;relation/star 引擎拆文件;`star/fortune``outlook`JSON 双写);integration 绿
- H5`/psy` baseURL + vite `/psy/api` 代理;首页 + 菜单 z-index 修复
- **ECR-001 Phase F + H5**types/sdk 对齐 OpenAPI;拆分 8 个超标页(均 ≤400);test:h5 35/35 绿
+53
View File
@@ -0,0 +1,53 @@
# CODE_REVIEW — ECR-001 Phase F + H5 splits
**Reviewer:** Cursor Agent (REVIEWER)
**Date:** 2026-08-05
**Decision:** **PASS**Should-fix 已修)
## Scope reviewed
- `packages/types` / `packages/sdk`DTO 抽出,路径不变
- H5 拆分:Ask / Report / Profile / StarProfile / Relation / Scale / ImageCard / LifeRhythm
- 配套 composables×8 + components×~36
- Spec 对齐:Ask / StarProfile / Membership
- **Follow-up fix(同切片):** ScaleSummary 收敛 · fortuneKey lifetime · ScaleAnswering emit · StarProfile 单测补强
## Evidence
| Check | Result |
|-------|--------|
| API URL / 方法名未改 | PASS |
| Page → composable → component 接线 | PASS |
| 页面与子组件 ≤400 行 | PASS |
| `ScaleSummary` = Go `ScaleListItem`slug/title/description | PASS |
| `fortuneKey``lifetime` | PASS |
| Scale 选答经 `@answer` emit,无 prop 深层 v-model | PASS |
| StarProfile 星盘相位 + 运势今日/一生断言 | PASS |
| `build:h5` + `test:h5` 35/35 | PASS |
## Findings
### Blockers
无。
### Should-fix
已全部修复(见 Follow-up)。
### Nits(不阻断)
1. Relation / ImageCard 单测 `router-link` 未 stub → Vue warn(既有)。
2. Commit message 需带 `ECR-001`;勿提交 `config.local.yaml` / `test-results/`
## Risk
**低。**
## Gate
- [x] Architecture / layering PASS
- [x] No API URL change
- [x] Tests green
- [x] Should-fix closed
- [ ] Human commit
**Decision: PASS**
@@ -0,0 +1,30 @@
# HANDOFF — ECR-001 Phase F + H5 → Reviewer
## From
Engineer
## To
Reviewer / Human
## Slice
ECR-001 Phase Ftypes/sdk 对齐)+ 超标 H5 页拆分
## Done
- types/sdk 与 OpenAPI 路径对齐;DTO 补齐
- 8 个超标页拆到 ≤400 行 + composables/components
- build:h5 + test:h5 全绿;TEST_REPORT 已写
## Not in scope
- 产品文案/交互改版
- API URL / 契约破坏性变更
- MembershipPage 拆分
- JSON `fortune` 旧键删除(ECR-002 后续)
## Ask
- Review 结构拆分是否无行为回归
- Human commit(勿纳入 `config.local.yaml` / `test-results/`
## Links
- TASK: `docs/TASKS/TASK-20260805-ECR001-phaseF-h5.yaml`
- TEST: `docs/TEST_REPORT/ECR-001-phaseF-h5.md`
- STATE: `docs/STATE/ECR-001.md`
+5 -4
View File
@@ -4,10 +4,10 @@
|-------|--------|
| ECR | ECR-001 (+ ECR-002) |
| Title | Structural realignment |
| Active slice | Phase AE 已编码 |
| Owner | release-readyCODE_REVIEW PASS |
| Phase | review PASS |
| Next | Human commit / 可选 Phase F |
| Active slice | Phase F + H5 超标页拆分 |
| Owner | reviewer → human |
| Phase | review PASS · awaiting commit |
| Next | Human commit |
| Updated | 2026-08-05 |
## History
@@ -17,3 +17,4 @@
| 2026-08-05 | Architect 诊断 + HANDOFF |
| 2026-08-05 | Phase B Home/Synastry;代理 baseURL 热修 |
| 2026-08-05 | Phase A 收口 · C membership · D engine 拆分 · E/ECR-002 outlook |
| 2026-08-05 | Phase F types/sdk;拆分 Star/Report/Profile/Ask/Relation/Scale/ImageCard/LifeRhythm |
@@ -0,0 +1,31 @@
# docs/TASKS/TASK-20260805-ECR001-phaseF-h5.yaml
task_id: ECR-001-phaseF-h5
role: engineer
phase: coding
tool: cursor
input:
- docs/ECR/ECR-001-structural-realignment.md
- docs/ENGINEERING_SPEC/ECR-001-structural-realignment.md
- proto/openapi.yaml
- .ai/coding.md
output:
- packages/types/**
- packages/sdk/**
- apps/user-h5/src/pages/*
- apps/user-h5/src/composables/*
- apps/user-h5/src/components/**
- docs/TEST_REPORT/ECR-001-phaseF-h5.md
forbidden:
- redesign_scope
- behavior_change
- api_url_change
next_agent: reviewer
status: coded
notes: >
Phase F packages align + continue H5 page splits for pages >400 lines.
No product behavior change. build:h5 + test:h5 PASS. See TEST_REPORT/ECR-001-phaseF-h5.md.
+44
View File
@@ -0,0 +1,44 @@
# Test Report — ECR-001 Phase F + H5 splits
## ECR
ECR-001 Phase F · H5 page splits(超标页)
## Change Level
L2(结构 · 无产品行为变更意图)
## Cases
- [x] Phase F`packages/types` 补齐 OpenAPI/SDK DTO`packages/sdk` 引用 types
- [x] H5 拆分(均 ≤400 行):StarProfile / Report / Profile / Ask / Relation / Scale / ImageCard / LifeRhythm
- [x] 抽离 `components/{star,report,profile,ask,relation,scale,imagecard,rhythm}/` + `composables/use*Page.ts`
- [x] 单测对齐现 UIAskPage / StarProfilePage / MembershipPage
- [x] `npm run build:h5` PASS
- [x] `npm run test:h5` PASS15 files / 35 tests
## Page line countspost-split
| Page | Lines |
|------|------:|
| StarProfilePage | 175 |
| ReportPage | 165 |
| ProfilePage | 152 |
| AskPage | 59 |
| RelationPage | 117 |
| ScalePage | 134 |
| ImageCardPage | 96 |
| LifeRhythmPage | 100 |
## Command
```bash
npm run build:h5
npm run test:h5
python scripts/ess-validate.py --phase coding --ecr ECR-001
```
## Residual Risk
- 拆分后部分子组件仍可能接近 400 行上限,后续可再切
- MembershipPage 未在本轮拆分(未超标或未纳入本 TASK)
- `router-link` 在 Relation 单测中有 Vue warn(既有 stub 缺口,非回归阻断)
## Gate
- [x] Phase F + H5 超标页拆分落地
- [ ] Reviewer / Human commit
+1
View File
@@ -6,4 +6,5 @@
| ECR-001 | structural realignment | Phase AE coded | PRODUCT_SPEC · ENGINEERING_SPEC · HANDOFF · ADR-0007 |
| ECR-001-B | H5 Home/Synastry split | PASS | TEST_REPORT/ECR-001-phaseB.md · CODE_REVIEW |
| ECR-001-A/C/D/E | docs · membership · engines · outlook | coded → review | TEST_REPORT/ECR-001-phaseA-E.md |
| ECR-001-F/H5 | types/sdk + 8 超标页拆分 | review PASS | TEST_REPORT · CODE_REVIEW/ECR-001-phaseF-h5.md |
| ECR-002 | fortune→outlook hygiene | Approved / coded | `docs/ECR/ECR-002-fortune-hygiene.md` |