优化: DOC-12 DEVFLOW-1~4/Phase1/Phase2据源码核对标完成(保留原文)+ARCHITECTURE §5.4 ModelRouter保留补提交(reset漏staged)

This commit is contained in:
2026-06-15 13:37:24 +08:00
parent b9bdd2eb8b
commit fb68c731a4
7 changed files with 92 additions and 31 deletions

View File

@@ -1,6 +1,15 @@
# DEVFLOW-1 CRUD 层实施
> 创建: 2026-06-10 | 状态: 待实施
> 创建: 2026-06-10 | 状态: ✅ 已完成2026-06-15 核对源码据实标注)
**完成简述**(核对 `crates/df-storage/src/`,非原计划文案):
- `crud.rs`**13 个 Repo** = 12 个 `impl_repo!` 宏展开IdeaRepo / ProjectRepo / TaskRepo / BranchRepo / ReleaseRepo / WorkflowRepo / NodeExecutionRepo / AiProviderRepo / AiToolExecutionRepo / AiConversationRepo / KnowledgeRepo / KnowledgeEventRepo+ 1 个手写 `SettingsRepo`KV`app_settings` 表,不走宏)。
- `models.rs`**12 个 `*Record` 结构体** 对应 12 张业务表。
- `migrations.rs`**V1V13 共 13 个迁移版本**,建 **14 张业务表**ideas / projects / tasks / releases / workflow_executions / node_executions / branches / ai_conversations / knowledges / ai_providers / ai_tool_executions / knowledge_events / app_settings另含 schema_version
- 事务支持:`crud.rs:701-711` 已用 `guard.transaction()` + `tx.commit()` 实现(如 `AiToolExecutionRepo` 原子写入)。
- 单元测试:`crud.rs`**22 个 `#[test]` / `#[tokio::test]`**
- 偏差说明:原计划列的 `workflow_defs`/`workflow_runs`/`artifacts` 表名在源码中实际为 `workflow_executions`/`node_executions`/`releases`(表名经设计调整),且实际多覆盖了 AI 对话 / 知识库 / AI Provider / KV 设置等领域,超出原计划范围。
---
@@ -10,19 +19,19 @@
## 目标
- [ ] 定义泛型 `Repository<T>` trait
- [ ] 实现 ideas 表 CRUD
- [ ] 实现 projects 表 CRUD
- [ ] 实现 tasks 表 CRUD
- [ ] 实现 workflow_defs 表 CRUD
- [ ] 实现 workflow_runs 表 CRUD
- [ ] 实现 artifacts 表 CRUD
- [ ] 事务支持
- [ ] 单元测试
- [x] 定义泛型 `Repository<T>` trait(实际:以 `impl_repo!` 宏统一生成 insert/get_by_id/list_all/update_field/update_full/delete配合手写 KV Repo
- [x] 实现 ideas 表 CRUD
- [x] 实现 projects 表 CRUD
- [x] 实现 tasks 表 CRUD
- [x] 实现 workflow_defs 表 CRUD(实际表名 `workflow_executions`
- [x] 实现 workflow_runs 表 CRUD(实际对应 `node_executions`
- [x] 实现 artifacts 表 CRUD(实际对应 `releases`
- [x] 事务支持`crud.rs:701-711`
- [x] 单元测试22 个)
## 实施记录
*(待填写)*
原计划表名(`workflow_defs`/`workflow_runs`/`artifacts`)在落地时调整为 `workflow_executions`/`node_executions`/`releases`见上方「完成简述」。CRUD 层已超出原计划覆盖 AI 对话、知识库、AI Provider、KV 设置等领域。
## 变更文件