feat(canvas): backflow —— UC-7.4 回流知识图谱,契约已签、缺后端实现
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 969
Description
## 背景
同 #1464 的调查结论:`batchConfirmAndWriteBackToBrain` / `mergeIntoPlenaryGraph` / `confirmNode` / `getNodeProvenance` 在 `packages/contracts/src/canvas.ts` 里已签核(`design-signoff.md` confirmed 2026-07-31)。domain 层已有 `apps/api/src/domain/canvas/backflow.ts` 可复用,**但没有 controller 路由、没有 application use case**。
前端 `apps/web/components/canvas/knowledge-backflow.tsx` 是纯 mock 原型,未接任何真实数据。
## ⚠️ 实现前必须先裁决的开放点
- **C_CANVAS_5**:`instantiateForSegment` 的"材料清单"、回流后"方法环节格回填"两个端口**契约里故意留空**(形态未定),backflow 若牵涉这两处需要人类先裁决形态,不能在实现时顺手定义。
- **C_CANVAS_4**:canvas 审计事件"写得下、查不着"——查询面被 defer 到 provenance 束,backflow 涉及的 `getNodeProvenance` 若依赖查询面,需先确认 provenance 束现状。
- I-28/I-29(来源链断裂拒绝写回、未确认节点服务端闸门)——契约层不变量已明确,实现时必须遵守,不是可选项。
## 任务
1. 先确认 C_CANVAS_5 / C_CANVAS_4 两个开放点是否阻塞本次实现范围(backflow 核心链路可能不依赖它们,需要先判断)。
2. 后端:application use case + controller 路由 + repository(复用 `backflow.ts` domain 逻辑)。
3. 前端:`knowledge-backflow.tsx` 去 mock。
4. 真栈 e2e 覆盖:来源链完整才允许写回(I-28)、组长确认后才写大脑(I-29)、留白告警不算失败(I-25 的姊妹条款)。
## 验收
- 来源链断裂时 `SOURCE_CHAIN_BROKEN`,真实拒绝写回,不是前端置灰。
- `knowledge-backflow.tsx` 依赖树零 `lib/mock/canvas` 边。
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading packages/contracts/src/canvas.ts and apps/api/src/domain/canvas/backflow.ts, then determine whether C_CANVAS_5 and C_CANVAS_4 block the core path. Trace the application, controller, repository, and apps/web/components/canvas/knowledge-backflow.tsx entry points, using real-stack e2e coverage for I-28, I-29, and the I-25 sibling rule. Done means broken source chains are rejected with SOURCE_CHAIN_BROKEN and the component has no lib/mock/canvas dependency.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design, frontend, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100