Эх сурвалжийг харах

docs(tdd): 需求发现台账 discovery-2026-12-04-1748(锚点 28c0b523/b52b677a4/37c1c0901)

- 28c0b523 memberId/currentMemberId 五条成文约束 → sc-key-map/test-cases 逐条核对:5 条未映射 + audit-§4 CircleController 优先级相反登记
- b52b677a4 设计四档 A/B/C/D → 用例/e2e 缺口:超期零奖励与 TC-P-10-E/11-E 期望值口径冲突、achieved 全库零命中、executor_id 统一无迁移回归 e2e
- 37c1c0901 健康打卡 memberId 归一化 → 后端 4 Controller 口径一致(证据行);API_REFERENCE §4.7 未声明兜底 + 省略 memberId 路径无 e2e
- G-304-1/B-260-1/B-325-1/N-R373-1/2/G9 一律登记「承袭·未实测」,不改判
- 新增 0 能力键;改源码/测试/API_REFERENCE/.tdd 均为 0
orchestrator-discovery 4 цаг өмнө
parent
commit
8989db4a77

+ 113 - 0
docs/tdd/orchestration/discovery-2026-12-04-1748.md

@@ -0,0 +1,113 @@
+# 需求发现台账 discovery-2026-12-04-1748
+
+> **类型**:编排派发 · 需求发现(Requirement Discovery)· 只读文档产出
+> **节点**:lan-248(非浏览器)
+> **工作分支**:cfclub 工作树(HEAD `85de16990` = `origin/cfclub` tip;本地分支名 `discovery-2026-12-02-0925`,与 cfclub 同 commit)
+> **锚点提交**:`28c0b523d`(memberId 规范成文)/ `b52b677a4`(D 档 executor_id 统一 + 超期零奖励)/ `37c1c0901`(健康打卡 memberId 归一化)
+> **数据源读取口径**:本轮按锚点提交的全树 blob 读取(`git show <commit>:<path>`),因 `origin/cfclub` 当前 tracked 树仅 28 文件(26×`docs/tdd/orchestration/*` + 2×`docs/*.md`),完整树 11898 文件(含 SRS/specs/test-cases)位于 discovery-2026-12-02-0925 / feat/* / task/* 分支。本台账不改任何源码与测试文件。
+
+---
+
+## 〇、环境与可追溯性前置发现(影响后续所有发现的可读性)
+
+| # | 发现 | 锚点 | 缺口类型 | 建议后续动作 |
+|---|------|------|----------|--------------|
+| D0 | `origin/cfclub` tip `85de169908` tracked 树 = **28 文件**(`git ls-tree -r origin/cfclub \| wc -l`=28,全部为 `docs/tdd/orchestration/*` 26 个 + `docs/小程序-*.md` 2 个);`28c0b523d` 全树 = 11898 文件。SRS.md / docs/需求分析/ / docs/superpowers/specs/ / docs/superpowers/api/API_REFERENCE.md / sc-key-map.md / tests/test-cases/{parent,child}.md **均不在 cfclub tracked 树上**,仅存在于锚点/feature 分支 blob | `git ls-tree -r origin/cfclub`、`git ls-tree -r 28c0b523 \| wc -l` | 文档与实现分离(登记现象,非本轮处置范围) | 待人工核实:cfclub 稀疏化为既有约定(编排收割专用分支)还是漂移;本轮不改判 |
+
+---
+
+## 一、28c0b523 memberId / currentMemberId 规范 → sc-key-map / test-cases 映射核对
+
+### 1.1 规范原文锚点(`28c0b523d:docs/superpowers/api/API_REFERENCE.md`)
+- **§1.1(行 23)**:「成员身份参数 一律 `memberId`,值口径 = `family_members.id`;未传时后端从 JWT 解析 `currentMemberId` 兜底。」
+- **§1.2(行 25–55)五条成文约束**:
+  - (1) 行 32:参数名一律 `memberId`,值取 `family_members.id`,**禁止把 `userId` 当 `memberId` 传**。
+  - (2) 行 34:前端取值链 `URL memberId > currentChildId > currentMemberId`,**禁止用 `userId` 兜底**。
+  - (3) 行 36–50:请求未传 `memberId` 时,后端一律从 JWT 解析 `currentMemberId` 兜底(`JwtInterceptor.java:345-361`),标准写法 `ParamUtils.getLong(params.get("memberId"), currentMemberId)`。
+  - (4) 行 52:账号级本人操作前端不传 `memberId`,后端用 `currentMemberId` 兜底。
+  - (5) 行 54:例外——admin/规划师指定目标成员(kick/recycle/update、审批指定对象)**必须显式必传,不做 JWT 兜底**。
+- 配套审计稿:`28c0b523d:docs/superpowers/specs/memberid-currentmemberid-audit.md`(§2 本次补齐 19 文件/40 端点;§3 标注不加兜底;§4 一致性观察 2 项;§5 自验)。
+
+### 1.2 未映射能力键逐条核对
+
+| # | 能力键 / 规范条目 | 是否在 sc-key-map.md | 是否在用例台账 (tests/test-cases) | 缺口类型 | 建议后续动作 |
+|---|-------------------|----------------------|-----------------------------------|----------|--------------|
+| 1.2-(1) | identity.memberId.paramName(禁止 userId 当 memberId) | ❌ 未出现(全文仅 1 处 `memberId`,为 SC-T-17 行 230 URL 巧合提及 `GrowthPlanController /child/{memberId}/active`,非本规范映射) | ⚠️ 部分——parent.md/child.md 14 处 `memberId` 全为「传他人 memberId→403」越权用例(TC-P-94-P 行372 / TC-P-96-P 行374 / TC-P-12-P 行227 / TC-C-05-P 行93 / TC-C-N05 行168),**无一例断言「userId 传入 memberId 位被拒/被纠正」** | 无测试用例 | 补用例:userId 代入 memberId 位 → 断言不误读他人档案 |
+| 1.2-(2) | identity.memberId.frontendChain(取值链优先级、禁 userId 兜底) | ❌ 未登记 | ❌ 仅 `cfc-frontend/__tests__/utils/memberNormalize.resolveCheckin.test.js`(37c1c0901,jest 7/7,**属单测非 e2e**)覆盖饮食/运动/睡眠打卡页解析链;无跨页 e2e | 无 e2e spec | 建 e2e:验证各打卡/数据页取值链不落 userId |
+| 1.2-(3) | identity.memberId.jwtFallback(未传→currentMemberId 兜底) | ❌ 未出现 | ❌ **零覆盖**。28c0b523 审计 §2 补齐的 40 端点中,无一端点有用例断言「省略 memberId → 返回本人数据」 | 无测试用例 / 无 e2e spec | 建 e2e 契约:对 challenge/progress(审计点名 PurchaseController `member_id=null` 恒空静默失败)等补「省略 memberId→本人」断言 |
+| 1.2-(4) | identity.memberId.accountLevel(账号级本人操作不传) | ❌ 未出现 | ❌ 未出现 | 无测试用例 | 补用例:前端不传 memberId 时账号级视图口径 |
+| 1.2-(5) | identity.memberId.explicitOnly(admin/规划师指定目标成员显式必传) | ❌ 未出现 | ⚠️ 部分——audit §3.1 列出 20+ 显式必传端点,无对应用例断言「兜底被禁、缺参报错」 | 无 e2e spec | 建 e2e:抽查 Admin*/FamilyMembersController 显式必传端点缺参报错 |
+| audit-§4 | CircleController 一致性观察(`feed`/`post` 族采用 **JWT 优先于参数**,与 §1.2「参数优先、JWT 兜底」相反;`creatorId` null 仍回落 `userId`) | ❌ 未出现 | ❌ 未出现 | 接口文档与实现不一致(**登记现象,本轮不改判**)+ 无测试用例 | 建 RED 任务 + 登记待人工核实(改历史行为影响线上,需 go/no-go) |
+
+---
+
+## 二、b52b677a4(D 档 executor_id 统一 + 超期零奖励)→ 用例台账 / e2e spec 缺口
+
+### 2.1 设计原文锚点
+`28c0b523d:docs/superpowers/specs/2026-12-03-executor-type-unification-overdue-backfill-design.md`(状态「设计稿(待 go/no-go)」,b52b677a4 = 其中 D 档 TaskService/FamilyMemberService/提醒调度器 refactor)。验收四档:
+- **A**(§2-A):删 `TaskService.java:853-854` `latest_end` 硬闸 throw → 超期任务流到 `completeTaskWithoutRewards`(置 completed + 连续 + **零奖励**)。
+- **B**(§2-B):`tasks.achieved TINYINT`(达成/未达成)+ `CompleteTaskDTO.achieved`,未达成/超期 → 零奖励。
+- **C**(§2-C):家庭任务页「过期任务」区 + 补打卡按钮(首页保持不显示 overdue)。
+- **D**(§2-D):`tasks.executor_id` 一律 = `family_members.id`,12 处调用点反查 `users.id`。
+
+### 2.2 用例/e2e 缺口逐条
+
+| # | 设计项 | 用例台账现状 | e2e spec 现状 | 缺口类型 | 建议后续动作 |
+|---|--------|--------------|---------------|----------|--------------|
+| 2-A | 超期完成零奖励 | 🔴 **口径冲突**——`parent.md:128 TC-P-10-E`「超期任务拒绝提交」、`parent.md:130 TC-P-11-E`「超期任务审批被拒」与新设计 A「超期应记录完成只不给 CF」直接矛盾;未重定向 | ❌ 无(`git grep -l 'completeTaskWithoutRewards\|零奖励' -- tests/` 仅命中 task-reminder-v3-unit/v3,非超期完成) | **接口文档/用例与实现不一致** + 无 e2e spec | 建 RED 任务:先改 TC-P-10-E/11-E 期望值,再补「超期完成→completed+CF=0」e2e |
+| 2-B | achieved 达成/未达成 | ❌ 全库零命中(`git grep -l 'achieved' -- tests/` 无) | ❌ 无 | 无测试用例 / 无 e2e spec | 建 RED 任务:表列+DTO 落地后补三类流 |
+| 2-C | 过期补打卡(家庭页) | ❌ 无 | ❌ 无 | 无 e2e spec | 随 B 补 UI 契约 |
+| 2-D | executor_id 统一 family_members.id | ⚠️ 间接——task-reminder-v3 M6 反查(`v3-unit.md:178 UTC-273`/`:179 UTC-274` 成员→用户反查 + 回退)与 `:143 UTC-248 acceptTask/rejectTask executorId=null NPE`;无针对 D 档迁移「100% 命中 family_members.id」的全链路回归 | ❌ 无 | 状态机未登记 / 无 e2e spec | 建 RED 任务(高风险迁移,需备份+dry-run go/no-go)+ sc-key-map 登记 executor 语义键 |
+| sc-key-map | child.task.checkin 子语义 | sc-key-map.md:63 SC-C-05 / :66 SC-C-08 / :72 SC-C-14 均 RED,`三流证据`列未登记「超期零奖励/achieved」子语义 | — | 状态机未登记 | sc-key-map 对应行补子语义标注(建议) |
+
+---
+
+## 三、37c1c0901 健康打卡 memberId 归一化 → 接口文档与实现口径核对
+
+### 3.1 实现侧锚点(`37c1c0901` grep 证据,后端口径一致性通过)
+- `HealthCheckinController.java:32-33 / 44-47 / 97-98`:标准 `ParamUtils.getLong(params.get("memberId"), currentMemberId)` ✓
+- `HealthMealController.java:60-61 / 81-82 / 98-99 / 156-157 / 223-225` ✓
+- `HealthSleepController.java:48-49 / 60-62` ✓
+- `HealthExerciseController.java:65-66 / 77-79` ✓
+- 结论:饮食/睡眠/运动/行为打卡 4 个 Controller 全部已具 §1.2-(3) JWT 兜底,与 37c1c0901 前端「memberId 为 null 则省略该键、交由后端 JWT 兜底」形成**闭环口径一致**(现象登记,本轮未跑后端)。
+
+### 3.2 待核实 / 缺口项
+
+| # | 项 | 证据 | 缺口类型 | 建议后续动作 |
+|---|----|------|----------|--------------|
+| 3-(a) | API_REFERENCE §4.7 健康打卡段(行 627–690)`meal/create`/`sleep/create`/`exercise/create` **未逐条声明「未传 memberId→JWT currentMemberId 兜底」**,仅由 §1.2 通用规范覆盖 | `28c0b523d:docs/superpowers/api/API_REFERENCE.md:627-690` | 接口文档与实现不一致(文档侧补注,非代码) | 补 §4.7 各 create 行兜底说明(建议,本轮不改 API_REFERENCE 登记行) |
+| 3-(b) | 前端取值链新优先级 `options.memberId > currentChildId > currentMemberId > null`(去 userId 兜底) | 37c1c0901 `memberNormalize.js` diff;`growth-main/index.vue` 两处 onShow/onLoginSuccess 去 userId | 与 §1.2-(2) 一致 ✓ | 无需动作 |
+| 3-(c) | 「省略 memberId→账号级本人打卡」HTTP 契约无 e2e | `tests/e2e/api/sleep-checkin-sc-c26.spec.js:31/38/56/67` 全部显式传 `childId`/`18978`,无一例省略 memberId 走兜底 | 无 e2e spec | 建 e2e:省略 memberId→落本人档案(对齐 37c1c0901 前端行为) |
+| 3-(d) | jest 单测覆盖解析链但非 HTTP 契约 | `cfc-frontend/__tests__/utils/memberNormalize.resolveCheckin.test.js`(37c1c0901,7/7) | 单测已覆盖、e2e 缺(非新缺口,作对照登记) | 仅登记 |
+
+---
+
+## 四、命中 blocker:文档侧现象登记(一律「承袭·未实测」,不改判已解决)
+
+> 本轮环境:**公网健康探针 HTTP 200**;**本机 9082 / 9000 = 000(未在听)**;6h 窗口 47 提交中,对下列 blocker **定向 src 命中 0**。故全部按纪律标「承袭·未实测」,仅登记现象。
+
+| # | blocker | 现象(原文锚点) | 本轮状态 |
+|---|---------|------------------|----------|
+| 4.1 | **G-304-1**(P0 跨家庭越权) | `28c0b523d:docs/superpowers/plans/2026-11-20-auth-guard-security-change-submission.md:12`「`wish/task/coach/guide` 四域 7 个点位在跨家庭场景下应返回 403/401 却返回 200/500」;`:63`「闭环状态以 blockers.md origin/cfclub 版为准」 | 承袭·未实测(本机 9082=000 无法跑契约;定向 src 0 命中) |
+| 4.2 | **B-260-1**(P1 法务页生产 404) | `28c0b523d:docs/tdd/automation-run-2026-11-17-R263.md:56`「法务页 `privacy.html`/`agreement.html` 生产 404」;延续至 `automation-run-2026-11-21-R372.md:29` G11「法务 404」 | 承袭·未实测(公网探针仅 200 主路径,未逐页验法务页) |
+| 4.3 | **B-325-1**(langgraph 驻留进程强杀) | `28c0b523d:cfc-langgraph/AGENTS.md:48`「timeout 默认 600s——避免 B-325-1 驻留进程在 360s 时强杀于汇总前」;`cfc-langgraph/scripts/run_pytest.sh:6` | 承袭·未实测(本机 9000=000) |
+| 4.4 | **N-R373-1/2**(外部爱云医上游未验) | `28c0b523d:cfc-web/public/CHANGELOG-v1.0.md:383`「外部爱云医上游未验 N-R373-2 承袭·真实缺陷未修不造绿」;`:771`「长期 blocker(G-304-1/B-260-1/B-325-1/N-R373-1/2/G9/S1-1…)承袭未修,不造绿」 | 承袭·未实测 |
+| 4.5 | **G9**(cfc-web 覆盖率 <20% 门禁) | `28c0b523d:docs/tdd/automation-run-2026-11-12-R164.md:69`「cfc-web 9.95% <20% 门禁未达(G9 ❌)」→ `automation-run-2026-11-21-R372.md:29`「G9(web L11.46% 第 80 轮)」 | 承袭·未实测 |
+| 4.6 | **B-325-1** 同类(langgraph 上游 429/驻留) | CHANGELOG-v1.0.md:771 同行列 S1-1 / B-275-1 等 | 承袭·未实测 |
+
+---
+
+## 五、汇总
+
+| 维度 | 计数 |
+|------|------|
+| 新增发现条目(含环境前置 D0) | **16**(1.2-(1)(2)(3)(4)(5)+audit-§4 = 6;2-A~D+sc-key-map = 5;3-(a)(b)(c)(d) = 4;D0 = 1) |
+| 其中「无测试用例」 | 5(1.2-(1)(3)(4) / 2-B / audit-§4) |
+| 其中「无 e2e spec」 | 8(1.2-(2)(3)(5) / 2-A / 2-B / 2-C / 2-D / 3-(c)) |
+| 其中「状态机未登记」 | 2(2-D / sc-key-map child.task.checkin 子语义) |
+| 其中「接口文档与实现不一致」 | 3(audit-§4 CircleController 优先级相反、2-A TC-P-10-E/11-E 期望值与新设计冲突、3-(a) §4.7 未声明兜底) |
+| blocker 现象登记(承袭·未实测) | 6(G-304-1 / B-260-1 / B-325-1 / N-R373-1/2 / G9 / 同类 S1-1·B-275-1 行) |
+| 新增能力键 | **0**(严格遵守不臆造;仅建议补占位键,未写入 sc-key-map) |
+| 修改源码 / 测试 / e2e / API_REFERENCE / .tdd | **0** |
+
+**一句话总结**:28c0b523 成文的 memberId/currentMemberId 五条约束、b52b677a4 的超期零奖励/achieved/executor 统一、37c1c0901 的省略 memberId 兜底,**在 sc-key-map 与 test-cases 台账均零映射(后端实现口径已一致,仅缺用例与 e2e)**,且现有 TC-P-10-E/11-E 期望值与超期零奖励新设计直接冲突需重定向;全部 blocker 维持承袭·未实测,本轮纯文档零副作用。