F186 研究洞察 Tab 真栈化:itv 洞察库/未验证假设/survey 域无可复用只读算子(真实契约缺口,已按裁决停工上报)
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 969
Description
## 任务背景
人类直接指派(队列外的活,非 `pnpm harness readiness` 队列项):把项目工作台「研究洞察」Tab
从纯前端 mock(`apps/web/components/project/tab-research.tsx` + `apps/web/lib/mock/project.ts`
的 `INSIGHTS` / `INSIGHT_SOURCES` / `UNVERIFIED_HYPOTHESES`)做成真栈,约束是:
1. UI 复用已签核截图(`ui-preview/project-v2/uc-00-2-research-*` 十态 + Studio 侧 itv/survey/research 域已签核截图);
2. 后端只**读**已经签核且 **passing** 的 itv/survey/research 域算子做聚合投影,不新增写操作、不新增错误码/状态枚举;
3. 若发现某处必须引入新契约面,立即停止编码,把缺口写清楚,不要自己发明契约签过核。
## 实测结论:条件 2 在当前代码库上不成立,触发停工条款
开工前做了一轮代码库勘探(`Explore` agent 全文检索 + 手工核实迁移文件/controller 目录),
结论如下,逐条可复核:
### 「研究洞察」Tab 的三个内容板块,只有 1 个有真实可复用的只读算子
| 板块 | 对应 mock | 需要复用的域算子 | 实测状态 |
|---|---|---|---|
| 洞察来源分布 | `INSIGHT_SOURCES` | itv `listInterviews` | ✅ **真实、已 wired、passing**:`apps/api/src/interface/controllers/interview-scope.controller.ts` → `apps/api/src/application/interview/list-interviews.ts`,返回 `counts.human` / `counts.virtual`,按 `scope: {kind:"project", projectId}` 可查询 |
| 洞察库 | `INSIGHTS` | itv `confirmInsight` / `markStrongInsight` / `getEvidenceMatrix`(`packages/contracts/src/interview.ts`) | ❌ **契约已声明,零后端实现**——`grep` `apps/api/src/interface/controllers/` 与 `apps/api/src/application/interview/` 均无匹配;`phases/phase-01-run-a-project/contracts/interview/coverage.md` 第 147 行原文登记为缺口 **U-8「洞察库屏未建」** |
| 尚未验证的假设 | `UNVERIFIED_HYPOTHESES` | research `promoteConclusionToInsight` 等(`packages/contracts/src/research.ts`) | ❌ **契约已声明,零后端实现**——`apps/api/src/interface/controllers/` 下没有 `research.controller.ts`,只有 `guided-research.controller.ts`(单会话向导流程,非项目级聚合,用不上);数据库迁移里没有任何 insight/hypothesis 持久化表 |
| (上述两块共同依赖)问卷域 | — | survey 域任意读接口 | ❌ **survey 域不是一个真实后端域**——`packages/contracts/src/survey.ts` 只有裸 Zod schema,**没有 `operations` 导出**(没有任何 `method`/`path`);`apps/api` 里 `survey` 关键词零匹配 |
结论:三块内容里两块(洞察库、未验证假设)**背后没有任何一条「已签核且 passing」的读算子可复用**——
不是「算子存在但没接上」,是这些操作本身在 `apps/api` 从未被实现(无 application handler、无 controller、
无持久化表)。唯一真实可用的是 `listInterviews` 的 human/virtual 计数,只能部分支撑「洞察来源分布」一块
(且连它也不能还原 mock 里的「问卷」「深度研究」「数字人/画像」四类来源——那几类同样没有真实数据源)。
### 为什么这不能靠「聚合投影」绕过
- itv 的 `confirmInsight`/`getEvidenceMatrix` 不是「换个查询方式就能读到数据」——它们是**写路径**
(确认候选洞察、生成证据矩阵),没有对应的写实现,数据库里就不会有任何一行 Insight 记录,
无论怎么「只读聚合」都读不出真实内容。
- research 域同理:`promoteConclusionToInsight` 从未实现,没有产出可读。
- survey 域连契约的 `operations` 都没声明,无从复用。
也就是说,要把「洞察库」「尚未验证的假设」两块做成真栈,必须先在 itv / research / survey 域
**新增应用层实现**(handler + controller + repository,可能还要新增持久化表)——这已经超出
「只读已签核 passing 算子做聚合投影」的授权范围,属于本轮裁决明确要求停工上报的情形。
## 建议的处置路径(供人类裁决,未擅自选择)
- **方案 A**:先在 itv 域补齐 U-8(洞察库屏 + 后端),research 域补齐洞察沉淀的应用层实现,
作为独立 feature 排期,再回来做本 Tab 的真栈化——顺序对,但工作量远超本次授权范围。
- **方案 B**:本 Tab 缩小范围为「只做来源分布真实化(基于 `listInterviews`),洞察库/未验证假设
两块暂时展示『该数据源尚未上线』的诚实占位(不是 mock 假数据,是明确的未实现状态)」——
代价是无法在保真度评分上匹配原型截图里洞察库/假设列表的內容密度,`rev-uiux` 大概率打不到 9 分,
且『尚未上线』这类占位文案本身是否算「新设计面」也需要人类确认。
- **方案 C**:本次不动这个 Tab,把上述缺口记录留档,等人类决定要不要先排 itv/research 的后端 feature。
本 agent 未选择以上任何一项自行推进,因为都会触碰「不新增写操作 / 不擅自扩大授权」的边界,
按裁决要求原地停工上报。
## 复核路径
- itv listInterviews 真实性:`apps/api/src/interface/controllers/interview-scope.controller.ts`、
`apps/api/src/application/interview/list-interviews.ts`
- itv 洞察相关零实现:`grep -rn "confirmInsight\|markStrongInsight\|getEvidenceMatrix" apps/api/src/interface apps/api/src/application` 无匹配(只在 `packages/contracts/src/interview.ts` 与纯逻辑单测 `apps/api/src/domain/interview/candidate-insight.ts` / `insight-source-gate.ts` 中出现)
- U-8 缺口登记:`phases/phase-01-run-a-project/contracts/interview/coverage.md:147`
- research 域零 controller:`ls apps/api/src/interface/controllers | grep -i research` 只有 `guided-research.controller.ts`
- survey 域无 operations:`grep -n "operations" packages/contracts/src/survey.ts` 无匹配
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading apps/web/components/project/tab-research.tsx and apps/web/lib/mock/project.ts, then verify the cited controller, application, contract, and coverage paths. Do not implement until a human selects a scope; done requires following that decision without inventing contracts or writes, with the permitted research blocks backed by real passing operations or an explicitly approved placeholder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100