08 定向 Bug Hunt + 架构文档刷新
## 08 定向 Bug Hunt(3.5) - Bug 1: 侧栏「复制页面」从 `/api/documents/duplicate` 迁移到 `copyTreeCommand()` → `/api/tree/commands`(`tree.subtree.copy`) - Bug 2: 侧栏「清空垃圾箱」标注 TODO,等待 Rust `tree.trash.empty` - Bug 3: 文档页「应用模板」标注 TODO,等待 Rust `tree.page.template` - Bug 4: 删除 `createChildDocumentCommand` 死代码(函数 + 类型 + 旧 Next.js `/api/documents/create-child` 路由) - 归档 4 份 bug 文档到 `bugs/04-tree-domain/done/` 和 `bugs/05-editor-mainline/done/` ## 架构文档刷新 - ARCHITECTURE.md: MVP 状态标记、三层树模型(§6.4)、8.4 AI 方向按 7-14 v2 修正、新增 8.5 定向 Bug Hunt 节、刷新 §5 和 §9 卡点描述 - AGENTS.md: 匹配 ARCHITECTURE.md 的 AI 方向和三层模型口径 - 08 checklist: 标记 7-14 v2 影响(Phase A/B/C 重命名、新增 9 项 checklist) 关联设计稿: 7-14 v2, 08
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# 4-43 [done] 侧栏「复制页面」从 `/api/documents/duplicate` 迁移到 `/api/tree/commands`
|
||||
|
||||
> 更新时间:2026-05-16
|
||||
>
|
||||
> 状态:`done`
|
||||
|
||||
## 问题
|
||||
|
||||
`sidebar.tsx:924` 的 `handleDuplicateDocument` 直接 `fetch("/api/documents/duplicate")`,走旧 Next.js compat 路由,不经过 Rust tree command 链,不生成 tree domain event。
|
||||
|
||||
## 修复
|
||||
|
||||
改为调用 `tree-command-client.ts` 中已有的 `copyTreeCommand`,POST 到 `/api/tree/commands`,使用 `action: "copy"` + Rust `tree.subtree.copy` 命令。
|
||||
|
||||
## 证据
|
||||
|
||||
- `wolai-frontend/src/components/sidebar/sidebar.tsx`:`handleDuplicateDocument` 改为 `copyTreeCommand({ targetParentId: null, items: [{ documentId: node.id, recursive: true }] })`
|
||||
- `wolai-frontend/src/components/sidebar/sidebar.tsx`:import 新增 `copyTreeCommand`
|
||||
- 验证:单页面复制后 `/api/tree/commands` 应收到 `action: "copy"`,不走 `/api/documents/duplicate`
|
||||
@@ -0,0 +1,18 @@
|
||||
# 4-44 [done] 侧栏「清空垃圾箱」标注 TODO 等待 Rust `tree.trash.empty` 命令
|
||||
|
||||
> 更新时间:2026-05-16
|
||||
>
|
||||
> 状态:`done`
|
||||
|
||||
## 问题
|
||||
|
||||
`sidebar.tsx:2637` 的垃圾桶清空调用仍走旧 Next.js `/api/documents/empty-trash`。Rust 侧当前支持逐条 `purge`(`tree.node.purge`),但无批量 `empty_trash` 命令。
|
||||
|
||||
## 处理
|
||||
|
||||
- 代码中已添加 `// TODO: Rust tree.trash.empty 命令就绪后切到 /api/tree/commands` 标注
|
||||
- 当前行为不变:仍走 `/api/documents/empty-trash` → `page-command-adapter.ts` → Rust bridge(`documents.emptyTrashByWorkspace` alias),功能正常但命令名不统一
|
||||
|
||||
## 后续
|
||||
|
||||
Rust `tree.trash.empty` action 就绪后执行迁移。
|
||||
@@ -0,0 +1,22 @@
|
||||
# 4-45 [done] `createChildDocumentCommand` 死代码清理
|
||||
|
||||
> 更新时间:2026-05-16
|
||||
>
|
||||
> 状态:`done`
|
||||
|
||||
## 问题
|
||||
|
||||
`tree-command-client.ts:225` 定义的 `createChildDocumentCommand` 导出但从未被任何模块 import。它 POST 到 `/api/documents/create-child` 旧 Next.js 路由。指向 `page-command-adapter.ts` 使用 `documents.create` compat alias。
|
||||
|
||||
## 修复
|
||||
|
||||
- 删除 `createChildDocumentCommand` 函数
|
||||
- 删除 `DocumentCreateChildCommandResult` 类型(仅被该函数使用)
|
||||
- 删除 `CreateChildDocumentInput` 类型(仅被该函数使用)
|
||||
- 删除 `/api/documents/create-child/route.ts` Next.js 路由文件
|
||||
- 调用者应使用已存在的 `createDocumentCommand(parentId)` → `/api/tree/commands`(`tree.node.create`)
|
||||
|
||||
## 验证
|
||||
|
||||
- `grep -rn "createChildDocumentCommand\|DocumentCreateChildCommandResult\|CreateChildDocumentInput"` 确认无源文件引用
|
||||
- `pnpm test` 中相关测试不应因死代码删除而失败
|
||||
Reference in New Issue
Block a user