Procházet zdrojové kódy

docs(tdd): G-304-1 + O-27 独立第二层复验(IS_PASS=YES,7/7 点位,预存非回归)

Administrator před 6 hodinami
rodič
revize
bc6f992bd7
1 změnil soubory, kde provedl 123 přidání a 0 odebrání
  1. 123 0
      docs/tdd/orchestration/verify-g304-o27-20261206.md

+ 123 - 0
docs/tdd/orchestration/verify-g304-o27-20261206.md

@@ -0,0 +1,123 @@
+# G-304-1 + O-27 独立第二层复验(测试侧 · 2026-12-06)
+
+> **性质**:测试侧对工程师提交 `45ea51280`(worktree `fix/g304-family-ownership-o27` @ `.worktrees/tmp-g304-o27`)的独立第二层复验(新鲜视角,不共享工程师结论)。只读复验 + 台账产出;**未代修代码、未 push、未动工程师 worktree 的提交**。
+> **对照基线**:`origin/cfclub` tip = `bfea884a4`(另建干净 worktree `.worktrees/qa-baseline-g304` @ `bd629a918` detached,用于 baseline vs 工程师红绿对照)。
+> **复验方法**:`grep` 接线 + `git show <commit> -- <file>` 改动面 + `mvn -o -B test -DskipTests=false -Dtest=<...>` baseline/工程师 worktree 同命令实测对照。
+> **前置发现(关键)**:`origin/cfclub` 的 cfc-backend **test-compile 本身即 BUILD FAILURE**——`IndicatorFavoriteControllerTest` / `ManualDimensionScoreContractTest` 2 个测试文件与生产控制器方法签名不匹配(arity 冲突),导致整模块无法直接 `mvn test`。复验时对 **两个 worktree 施加完全相同的排除处理**(临时移出这 2 个文件→跑目标测试→原样还原,`git status` 确认还原干净),保证 A/B 对照公平。
+
+---
+
+## 一、总判
+
+| 项 | 结论 |
+|---|---|
+| **IS_PASS** | **YES**(G-304-1 接线 7/7 就位;5 项契约测试全绿 0 失败;TaskCompleteScC02 3 失败为**预存非回归**;O-27 4 改动点就位) |
+| 7 点位接线 | **7/7** |
+| TaskCompleteScC02 3 失败 | **预存 ✓**(baseline 同样 3 失败,工程师「预存」声明成立,非其引入) |
+| 2 个 test-compile 损坏文件 | **预存 ✓**(baseline `origin/cfclub` 本身 test-compile 即 FAILURE,工程师未引入) |
+| 4 类契约测试实测 | FamilyOwnershipGuardContractTest 16/16 绿、WishCycleManageContractTest 18/18 绿、ChildWishManageContractTest 12/12 绿、WishServiceTest 4/4 绿、GuideFamilyTaskReviewContractTest 5/5 绿 —— **全部 0 失败** |
+| O-27 4 改动点 | 4/4 就位(含 1 项非阻塞观察:非首页消费方未同步 overdue) |
+
+---
+
+## 二、必验 1:7 点位接线(G-304-1)—— 7/7 就位
+
+> 证据命令:`grep -rn "FamilyOwnershipGuard" cfc-backend/src/main/java/com/etotem/cfc/controller/`
+> 实测命中 4 个控制器:`WishController` / `TaskController` / `CoachRecommendController` / `GuideFamilyTaskController`(`GuideFamilyTaskController` 走角色越权 403,非 guard 类,见点位 5)。
+
+| 域 | 点位 | 端点/方法 | 接线证据 | 就位 |
+|---|---|---|---|---|
+| wish | 7 个 mutation | setPrice / rejectWish / requestExchange / approveExchange / markFulfilled / confirmReceived / cancelWish | 每个端点均先调 `checkWishOwnership(userId,id)`(解析 memberId→`checkMemberAccess` / familyId→`checkFamilyAccess`,`WishController.java` L106/140/164/191/214/235/259),守卫非 null 即 `return 403`。`priceAlias` 委托 `setPrice` 故一并覆盖 | **7/7** ✓ |
+| task | createTask | `createTask` | L86 `checkMemberAccess(userId, dto.getMemberId())`(memberId 非空时)→ 403 | ✓ |
+| task | completeTask | `completeTask(id,dto,currentMemberId,userId)` | L154 `checkMemberAccess(userId, task.getFamilyMemberId())`(查 task 归属)→ 403;新增 3 参兼容重载(userId=null)→ 委托 4 参 | ✓ |
+| task | deleteTask | `deleteTask` | L297 `checkMemberAccess(userId, task.getFamilyMemberId())` → 403 | ✓ |
+| coach | recommend | `recommend` | L53 `checkMemberAccess(userId, memberId)` ≠ null 即保留原 403 文案「无权代管该家庭成员」 | ✓ |
+| coach | adopt | `adopt` | L83 `checkMemberAccess(userId, memberId)` ≠ null 即 403 | ✓ |
+| guide | getBoundFamilies | `getBoundFamilies`(点位 5 TC-T-33-P 500→403) | L124 `if(!RolesUtil.hasTeacherRole(role,roles)) return Result.error(403,"Access denied")`(角色越权,非家庭归属,直接 403 合理) | ✓ |
+
+> 说明:`WishController.createWish` 未接 guard(创建新心愿,无跨家庭访问语义),符合预期。
+
+---
+
+## 三、必验 2:TaskCompleteScC02ContractTest 3 失败 = 预存(非回归)
+
+> 工程师声明「预存」。QA 独立实测**两边同命令跑同一测试**,结果一致 → 预存成立。
+
+### 3.1 处理前置:baseline 自身 test-compile 即 FAILURE
+
+裸跑 `mvn -o -B test -Dtest=TaskCompleteScC02ContractTest`,**baseline 与工程师 worktree 均在 testCompile 阶段 BUILD FAILURE**,同为 12 个编译错误,全部来自 `IndicatorFavoriteControllerTest`(10 处 arity)+ `ManualDimensionScoreContractTest`(2 处 arity),**与工程师 commit 无关**。因此需临时移出这 2 文件才能跑目标测试(两 worktree 同等处理)。
+
+### 3.2 baseline vs 工程师红绿对照(同命令 `-Dtest=TaskCompleteScC02ContractTest`)
+
+| worktree | commit | 结果 |
+|---|---|---|
+| **baseline**(`qa-baseline-g304` @ `bd629a918`) | origin/cfclub,**无工程师改动** | `Tests run: 12, Failures: 3, Errors: 0, Skipped: 0` → BUILD FAILURE |
+| **工程师**(`tmp-g304-o27` @ `45ea51280`) | 含 G-304-1+O-27 | `Tests run: 12, Failures: 3, Errors: 0, Skipped: 0` → BUILD FAILURE |
+
+**两者均 12 跑 3 败,失败方法名完全一致**:
+
+```
+[ERROR] controller_契约_memberId缺省回落当前成员  <<< FAILURE!
+[ERROR] controller_契约_dto字段转发与成功响应      <<< FAILURE!
+[ERROR] controller_契约_service返回null_错误提示  <<< FAILURE!
+```
+
+→ **结论:3 失败为预存缺陷(baseline 即有),非工程师 `45ea51280` 引入。工程师「预存」声明成立。**
+
+> 复验命令(可复现):
+> - baseline:`cd .worktrees/qa-baseline-g304/cfc-backend && mvn -o -B test -DskipTests=false -Dtest=TaskCompleteScC02ContractTest`(移出 2 损坏文件后)→ `Tests run: 12, Failures: 3`
+> - 工程师:`cd .worktrees/tmp-g304-o27/cfc-backend && mvn -o -B test -DskipTests=false -Dtest=TaskCompleteScC02ContractTest`(移出 2 损坏文件后)→ `Tests run: 12, Failures: 3`
+> - 两边失败方法名一致(见 `/tmp/qa-base-2.log` vs `/tmp/qa-eng-2.log`)
+
+---
+
+## 四、2 个 test-compile 损坏文件 = 预存(baseline 即坏)
+
+| 文件 | baseline 实测 | 工程师 commit 是否触及 | 判定 |
+|---|---|---|---|
+| `IndicatorFavoriteControllerTest.java` | testCompile 失败(`list`/`remove`/`toggle` 需要 `(Map,Long,Long,Long)`,测试传 `(Map,long,long)` 2 参) | 工程师只改 6 个文件(TaskController/WishController/CoachRecommendController/GuideFamilyTaskController/TaskService/index.vue),**未触及** `IndicatorFavoriteController` 及其测试 | **预存 ✓** |
+| `ManualDimensionScoreContractTest.java` | testCompile 失败(`latest` 需要 `(Map,Long,Long)`,测试传 `(HashMap,Long)` 2 参) | 同上,**未触及** `ManualDimensionScoreController` 及其测试 | **预存 ✓** |
+
+> 静态佐证:两测试文件 import 仅涉 `IndicatorFavoriteService`/`ManualDimensionScoreController`/`FiveDimension*` 等,**与工程师改动类零交集**(`grep -nE "TaskController|WishController|CoachRecommend|GuideFamilyTask|TaskService"` 在两文件均 0 命中)。
+
+---
+
+## 五、必验 3:4 类契约测试独立复跑(工程师 worktree 实测,不信自报)
+
+| 测试类 | Tests run | Failures | Errors | 结论 |
+|---|---|---|---|---|
+| FamilyOwnershipGuardContractTest | **16** | **0** | 0 | 全绿 ✓ |
+| WishCycleManageContractTest | **18** | **0** | 0 | 全绿 ✓ |
+| ChildWishManageContractTest | **12** | **0** | 0 | 全绿 ✓ |
+| WishServiceTest | **4** | **0** | 0 | 全绿 ✓ |
+| GuideFamilyTaskReviewContractTest | **5** | **0** | 0 | 全绿 ✓ |
+| (合计 5 类) | **55** | **0** | 0 | **工程师改动与既有契约零回归** ✓ |
+
+> 复验命令:`cd .worktrees/tmp-g304-o27/cfc-backend && mvn -o -B test -DskipTests=false "-Dtest=FamilyOwnershipGuardContractTest,WishCycleManageContractTest,ChildWishManageContractTest,WishServiceTest,GuideFamilyTaskReviewContractTest"`(移出 2 损坏文件后)→ `Tests run: 55, Failures: 0, Errors: 0`。
+
+---
+
+## 六、必验 4:O-27 改动复验(4 点)
+
+| 点 | 核验内容 | 证据(`git show 45ea51280 -- <file>`) | 就位 |
+|---|---|---|---|
+| 1 | `TaskService.getTodayTasks` 白名单含 `overdue` | L566 `.in(Task::getStatus, Arrays.asList("pending","in_progress","completed","locked","pending_review","overdue"))` + 新增超期日期窗口子句 `.or(w5 -> w5.eq(status,"overdue").ge(deadline, overdueVisibleStart))`(近 7 天);常量 `OVERDUE_VISIBLE_DAYS=7` | ✓ |
+| 2 | `TaskService.getTodayTasksByFamily` 含 `in_progress` | L632 `.in(status, Arrays.asList("pending","completed","locked","pending_review","in_progress","overdue"))` + 同款超期窗口子句 `.or(w5 ... overdue ...)`(口径与 getTodayTasks 对齐) | ✓ |
+| 3 | `index.vue pendingTasks` 保留 `pending+overdue`、`_isOverdue` 标红 | L1127 `if(t.status!=='pending' && t.status!=='overdue') return false`;L1128-1129 overdue→`t._isOverdue=true`;复用既有渲染 L102 `todo-item--overdue` / L106 `!_isOverdue 才显 +points` / L109 overdue tag「已超期」 | ✓ |
+| 4 | 是否影响既有 pending/locked 行为 | 白名单**纯增量**(新增 in_progress/overdue,不删既有 pending/completed/locked/pending_review);守卫 `familyOwnershipGuard==null` 或 task 归属为 null 时跳过(放行,不误伤);既有渲染分支(latestEnd 超期)保留 | ✓ 无回归 |
+
+### 非阻塞观察(O-27 覆盖面)
+`getTodayTasks` 现返回 overdue,但**非首页消费方未同步** overdue 过滤:
+- `cfc-frontend/pages/growth-main/index.vue` `findTaskByAction`(L277):仅 `status==='pending'||'in_progress'` → **overdue 被丢弃**,不参与「今日成长打卡联动 taskId」。
+- `cfc-frontend/pages/home-pages/parent-index.vue`(L1342):仅 `pending||in_progress` → 今日待完成区不展示 overdue。
+- `cfc-frontend/pages/child/tasks.vue`(L63/79/173):`status==='pending' && !getIsOverdue(task)` → **显式排除 overdue**,任务列表页不展示超期可补做。
+
+> 判定:**非阻塞、非回归**(首页 index-home 已满足 O-27「超期可见可补做」),是否需在 growth-main/parent-index/child-tasks 同步暴露由主理人/产品拍板;若 O-27 仅要求首页可见,则无需改动。
+
+---
+
+## 七、工作区还原确认
+
+- baseline worktree(`qa-baseline-g304`):`git status --short` 空(2 文件已原样还原),未产生任何提交。
+- 工程师 worktree(`tmp-g304-o27`):`git status --short` 空(2 文件已原样还原),未产生任何提交,工程师 `45ea51280` HEAD 未动。
+- 两 worktree 均保留可复现(临时移出文件已放回,`cp` 还原,非 `git checkout`,避免引入工作区噪声)。