Browse Source

docs(tdd): 12-01 R1720 health-survey 增量保存+统一签名 需求文档侧发现(G-HSS-001~004)——只读发现,不改src/tests/API_REFERENCE/sc-key-map

zxyj-langgraph 35 minutes ago
parent
commit
1d8f4b09c3
1 changed files with 152 additions and 0 deletions
  1. 152 0
      docs/tdd/orchestration/discovery-2026-12-01-2046.md

+ 152 - 0
docs/tdd/orchestration/discovery-2026-12-01-2046.md

@@ -0,0 +1,152 @@
+# 需求/文档侧发现台账 — health-survey 增量保存+统一签名(2026-12-01)
+
+> **节点限定**:非浏览器任务,窗口 `87463aa53..HEAD` 内 health-survey 相关 src 提交。  
+> **范围**:docs/superpowers/api/API_REFERENCE.md / docs/tdd/SRS.md / docs/tdd/orchestration/sc-key-map.md / tests/test-cases/parent.md + Jest 契约单测。  
+> **纪律**:只读发现;不改 src、tests/e2e、API_REFERENCE、sc-key-map;不臆造证据。
+
+---
+
+## 一、目标段提交锚点
+
+| 提交 | 摘要 | 文件变更 |
+|------|------|---------|
+| `835c50075` | feat(health-survey): 健康问卷增量保存(只存变化成员)+ 统一签名(一次签名全员共用) | `cfc-frontend/pages/health/health-survey.vue` +115/-3;新增 `cfc-frontend/__tests__/pages/health/healthSurvey.incrementalSave.test.js`(216行) |
+| `034c36433` | merge 835c50075 into cfclub(QA PASS) | 同 835c50075(merge commit) |
+| `ac68da8a3` | report(dev) 引用前序已合入的 `86bf0990a feat(health-survey): 合并健康阅卷多成员保存` | 仅汇报文档,src 已由 `86bf0990a` 提前落地 |
+
+**关联前置提交**(同一特性族的上一轮,已在 HEAD 祖先中):
+- `86bf0990a feat(health-survey): 合并健康阅卷多成员保存` → 新增 `cfc-frontend/__tests__/pages/health/healthSurvey.reviewMultiMember.test.js`(207行)并改写 `health-survey.vue` 阅卷分支(多成员各写一条 `survey_records`)。
+
+---
+
+## 二、已有覆盖情况(事实核查)
+
+### 2.1 Jest 契约单测(已入库)
+
+| 文件 | 能力键(注释) | 条目数 | 覆盖点 |
+|------|-------------|-------|-------|
+| `cfc-frontend/__tests__/pages/health/healthSurvey.incrementalSave.test.js` | `health.survey.incrementalSave` | 4 | ① 增量判定 changed=true/false ② 归一化口径(number/string/数组顺序/null/空串/对象键序)③ 统一签名:内容仅存变化成员,签名落全体参与成员 ④ 全部未变化时零请求仍落签名 |
+| `cfc-frontend/__tests__/pages/health/healthSurvey.reviewMultiMember.test.js` | `health.survey.reviewMultiMember` | 4 | ① 账号级+B代填各发一次 submitSurvey 且 memberId 归属正确 ② answersJson.form 不含 memberId(row级放)③ 缓存成员空时过滤 ④ 无内容成员零调用正常退出 |
+
+### 2.2 设计文档(已定稿)
+
+| 文档 | 日期 | 覆盖范围 | 对本窗口的盲区 |
+|------|------|---------|--------------|
+| `specs/2026-10-16-comprehensive-health-survey-design.md` §五「合并式增量保存」 | 2026-10-16 | 模块级增量(只提交启用模块字段) | 仅描述 module-level 粒度;**未描述 member-level 去重(collectSaveMembers)、内容指纹归一化、一次签名全员共用** 语义 |
+| `specs/2026-11-23-health-survey-member-picker-design.md` | 2026-11-23 | 管理员代填、成员切换快照、账号级兜底 | §4.3 明确「主账号 health_status 走账号级不传 memberId」「签名在内容之后」,但**未描述统一签名共享(single signature per submit)与 collectSaveMembers 过滤逻辑** |
+| `specs/2026-11-07-health-plan-default-self-and-health-review.md` §需求3 | 2026-11-07 | 健康阅卷 source=health_review 单次写一条 survey_records | 设计为「**每条提交写一条 survey_records**」(单成员),与 `86bf0990a` 多成员各写一条实现不符;本文档**未同步更新**(待人工核实是否需修订) |
+
+### 2.3 API_REFERENCE.md 登记状态
+
+- `POST /api/health-status/save` — 仅登记「健康现状档案保存」,**无增量/成员过滤/幂等说明**。
+- `POST /api/health-status/signature` — body `{memberId, signature}`,**无全员共享签名批处理说明**。
+- `POST /api/survey/submit` — 登记于 §4.49 家庭归因闭环,**健康问卷阅卷分支**走的是 `utils/api.js` 的同名方法但 source 字段语义未在 API 层单独声明(前端内部透传)。
+
+### 2.4 sc-key-map.md / SRS.md / test-cases
+
+| 资源 | 当前状态 |
+|------|---------|
+| `docs/tdd/orchestration/sc-key-map.md` | **无任何** `health.survey.*` / 独立健康问卷场景 SC 条目(P段健康域仅 SC-P-20~30 报告/饮食推荐子集;SC-P-70 舌诊拍照;无问卷保存类 SC) |
+| `docs/tdd/SRS.md` | TDD 发现模式自动扫描生成;**健康问卷保存类行为未出现在任何已知能力键池**,SRS.md 无具体行号可引 |
+| `tests/test-cases/parent.md` | `TC-P-26-A` 描述「饮食推荐·健康问卷个性化调整」,但**未含独立健康问卷填写 + 多成员保存 + 统一签名的验收路径** |
+| `tests/e2e/` 目录 | **不存在** health-survey 端到端 Playwright spec(`ls tests/e2e/ | grep -i health` 仅产出 `health-knowledge-base.spec.js` / `health-report-audit.spec.js`) |
+
+---
+
+## 三、缺口项清单
+
+### G-HSS-001 · API 契约文档未登记多成员批量语义
+
+| 属性 | 值 |
+|------|-----|
+| **需求/能力键** | `health.survey.incrementalSave` / `health.survey.reviewMultiMember`(命名来自测试文件头部注释) |
+| **来源文件+章节** | `specs/2026-11-23-health-survey-member-picker-design.md` §4.3「主账号/其他成员保存路径分叉」+ commit `835c50075` message「一次签名全员共用」|
+| **是否已在 sc-key-map** | ✗ 无 |
+| **是否已在 API_REFERENCE** | ✗ 无(`POST /api/health-status/save` / `POST /api/health-status/signature` 均只有单成员描述) |
+| **是否已在 test-cases** | ✗ TC-P-xx 无对应条目 |
+| **是否已有 e2e spec** | ✗ `tests/e2e/` 下无对应 spec |
+| **缺口类型** | **接口文档与实现不一致**(API_REFERENCE 未升级描述)+ **无 e2e spec** |
+| **原文锚点** | `API_REFERENCE.md` L613「`POST /api/health-status/save \| 健康现状档案保存`」;L614「`POST /api/health-status/signature \| ...body: {memberId, signature}`」均未描述多成员调用时的 skip-unchanged / shared-signature 行为 |
+| **建议后续动作** | 补写 e2e spec:管理员登录 → 选 memberA/memberB → 改 A 不 改 B → 签名 → 断言 health_status/save 仅触发 memberA 一次、signature 对 A+B 各调一次且 payload 相同;同步升级 API_REFERENCE.md §4.x 新增「多成员批量」语义段(**仅建议,本任务不改文档**) |
+
+### G-HSS-002 · 成员级增量保存语义超出设计文档描述范围
+
+| 属性 | 值 |
+|------|-----|
+| **需求/能力键** | `health.survey.incrementalSave`(member-level content fingerprint) |
+| **来源文件+章节** | `specs/2026-10-16-comprehensive-health-survey-design.md` §五.2「模块级增量保存(只提交启用模块字段)」—— **此处"增量"是 module-level,非 member-level**;commit `835c50075` 引入 normVal/normArr/normObj/contentFingerprint/collectSaveMembers 属于 **behavioral extension** |
+| **是否已在 sc-key-map** | ✗ 无 |
+| **是否已在 API_REFERENCE** | ✗ 无 |
+| **是否已在 test-cases** | ✗ 无 |
+| **缺口类型** | **状态机未登记**(能力键 `health.survey.incrementalSave` 不在 sc-key-map 状态机登记中)+ **文档与实现不一致**(spec §五.2 "modules 粒度" vs 实现 "members 粒度") |
+| **原文锚点** | `specs/2026-10-16-comprehensive-health-survey-design.md` L109:「后端 `HealthStatusServiceImpl.saveForMember` 走 MyBatis-Plus `updateById`(默认只更新非 null 字段)→ 未调研模块的旧值自动保留」—— 该段仅讨论 single-member/module-level;**未涉及多成员 contentFingerprint + collectSaveMembers** |
+| **建议后续动作** | 评审 spec §五是否需要增补 member-level 增量块;若通过,登记能力键至 sc-key-map RED/YELLOW 池(**仅建议,本任务不代执行**) |
+
+### G-HSS-003 · 健康阅卷多成员契约与设计文档历史口径冲突
+
+| 属性 | 值 |
+|------|-----|
+| **需求/能力键** | `health.survey.reviewMultiMember` |
+| **来源文件+章节** | `specs/2026-11-07-health-plan-default-self-and-health-review.md` §需求3「每次提交生成一条 survey_records」(单成员语义)vs `86bf0990a` 实际多成员各写一条 |
+| **是否已在 sc-key-map** | ✗ 无 |
+| **是否已在 API_REFERENCE** | ✗ `POST /api/survey/submit` 未区分 source=health_review 多成员场景 |
+| **是否已在 test-cases** | ✗ 无 |
+| **是否已有 e2e spec** | ✗ 无 |
+| **缺口类型** | **文档与实现不一致** + **无 e2e spec** |
+| **原文锚点** | `specs/2026-11-07-health-plan-default-self-and-health-review.md` L85:「进入后可多次提交,每次生成一条 survey_records(source='health_review')记录」—— **单条语义**;实现(`healthSurvey.reviewMultiMember.test.js` L107 起):「所有已填写成员各写一条 survey_records」。另 `specs/2026-11-23-health-survey-member-picker-design.md` L79 也沿用「`submitSurvey({ memberId })`(单条)」表述,未提及多成员循环调用 |
+| **建议后续动作** | 确认 `specs/2026-11-07-health-plan-default-self-and-health-review.md` 是否需修订以对齐多成员语义(**待人工核实**);补 e2e spec:管理员登录 → 健康阅卷入口 → 选 m1/m2 → 填写并提交 → 查 `survey_records` 表至少两行且 source=health_review 且各自 memberId 不同 |
+
+### G-HSS-004 · 前端契约单测未在 sc-key-map / state.json 登记能力键
+
+| 属性 | 值 |
+|------|-----|
+| **能力键** | `health.survey.incrementalSave` / `health.survey.reviewMultiMember` |
+| **来源** | `cfc-frontend/__tests__/pages/health/healthSurvey.incrementalSave.test.js` L2-3;`healthSurvey.reviewMultiMember.test.js` L2-3(JSDoc 头部) |
+| **是否已在 sc-key-map** | ✗ 无(sc-key-map 中无此键字符串) |
+| **是否已在 SRS.md 能力键池** | ✗ 无(SRS.md 能力键池由 discovery.py 扫描后端控制器推导,前端 Jest 测试不落库于此池) |
+| **缺口类型** | **状态机未登记**(前端契约键未在 TDD 编排侧登记,导致此类键不参与三类流计数和派发) |
+| **原文锚点** | `cfc-frontend/__tests__/pages/health/healthSurvey.incrementalSave.test.js:3`「能力键:health.survey.incrementalSave」;`healthSurvey.reviewMultiMember.test.js:3`「能力键:health.survey.reviewMultiMember」 |
+| **建议后续动作** | 评估是否需要将前端契约键纳入 sc-key-map(YELLOW 待定)或在 `.tdd/state.json` 登记;或保持 jest-only 定位——**仅建议,需主理人裁决口径** |
+
+---
+
+## 四、窗口内其他 src 提交(与 health-survey 无关,如实写明)
+
+| 提交 sha | 说明 | 涉及文件 |
+|---------|------|---------|
+| `19d42599f` | Add RepeatTaskGeneratorTest + HealthPlanControllerPlanTasksPermissionTest | `cfc-backend/src/test/java/.../RepeatTaskGeneratorTest.java` / `HealthPlanControllerPlanTasksPermissionTest.java` |
+| `037db4e57` | fix(task-remind): 每日实例提醒 + 称呼串号三流 e2e | `tests/e2e/api/task-checkin-remind-18211a546.spec.js` |
+| `d75f0de6f` | feat(web,backend): 后台首页 KPI 新/总口径 + 跳转链接 | `cfc-backend/src/main/java/com/etotem/cfc/controller/stats/StatsController.java` / `cfc-backend/src/main/java/com/etotem/cfc/task/TaskCheckinWebhookReminderTask.java` / `TaskReminderScheduledTask.java` |
+
+上述三项均在 `87463aa53..HEAD` 范围内,但内容与 health-survey 无关,不属于本轮发现范围;其对应的 SC/测试缺口由其它节点另行追踪。
+
+---
+
+## 五、长期 blocker 现象登记(不改判)
+
+- **G-304-1(P0)**:跨家庭越权拒绝缺失。本窗口 health-survey 不涉及越权维度(纯前端行为),**不命中**;按纪律仅登记现象不改判。
+- **B-260-1 / B-325-1**:法务页 404 / lg 配额环境型失败。与本窗口 health-survey 无关,**不涉及**。
+
+---
+
+## 六、统计汇总
+
+| 类别 | 数量 |
+|------|------|
+| 新增发现项(G-xxx) | 4(G-HSS-001 ~ G-HSS-004) |
+| 其中「接口文档与实现不一致」 | 2(G-HSS-001、G-HSS-003) |
+| 其中「无 e2e spec」 | 3(G-HSS-001、G-HSS-003、G-HSS-004) |
+| 其中「状态机未登记」 | 2(G-HSS-002、G-HSS-004) |
+| 其中「待人工核实」 | 1(G-HSS-003 spec 历史口径冲突) |
+| 不涉及健康问卷的其他 src 提交 | 3(task-reminder、stats KPI) |
+
+---
+
+## 七、commit sha
+
+- 本次台账写入 SHA:`$(git rev-parse HEAD)` → 写完后的最新 HEAD(等待 commit 后回填)
+- 窗口关键提交锚点:`835c50075` / `034c36433` / `86bf0990a`
+
+---
+
+*只读发现,不代执行。全部 4 项均为建议,不修改任何 src/tests/docs 源码*。