From 308775cf4de6fe66c18e27c3f4eb1277966b2750 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=BB=9D=E5=B0=98?= <237809796@qq.com>
Date: Fri, 26 Jun 2026 20:27:58 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20=E7=81=B5=E6=84=9F?=
=?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=95=B0=E6=8D=AE=E5=AE=89=E5=85=A8=20+=20?=
=?UTF-8?q?=E5=BB=BA=E7=AB=8B=E6=95=B4=E4=BD=93=E4=BB=BB=E5=8A=A1=E5=9B=BE?=
=?UTF-8?q?=E8=B0=B1DAG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- IDEA-FIX-02: ideas 白名单移除 id/created_at(对标 tasks B-260616-16,防主键/创建时间篡改)
- IDEA-FIX-03: create_idea 加 priority ∈ 0..=3 值域校验(对标 tasks B-260615-15,防越界静默吞)
- docs/todo.md: 建立整体任务图谱(DAG·有方向有状态),整合知识图谱设计+22条待办+G1
- 核销 BUG-260620-05 层1: 已被 F-260619-03 方案①弱化取代(default_with_root 空,reload 不塞 workspace_root),层2 黑名单制仍待决策
---
crates/df-storage/src/crud/settings.rs | 6 ++-
docs/todo.md | 71 ++++++++++++++++++++++++++
src-tauri/src/commands/idea.rs | 9 ++++
3 files changed, 84 insertions(+), 2 deletions(-)
diff --git a/crates/df-storage/src/crud/settings.rs b/crates/df-storage/src/crud/settings.rs
index d183f93..dce8f5a 100644
--- a/crates/df-storage/src/crud/settings.rs
+++ b/crates/df-storage/src/crud/settings.rs
@@ -119,8 +119,10 @@ impl SettingsRepo {
pub fn allowed_columns_for(table: &str) -> Option<&'static [&'static str]> {
Some(match table {
"ideas" => &[
- "id", "title", "description", "status", "priority", "score", "tags", "source",
- "promoted_to", "ai_analysis", "scores", "related_ids", "created_at", "updated_at",
+ // IDEA-FIX-02: id\created_at 不列入 — 主键与创建时间不可通过通用 update_field 改写
+ // (对标 tasks 白名单 B-260616-16 同款防护,防篡改主键/伪造创建时间)
+ "title", "description", "status", "priority", "score", "tags", "source",
+ "promoted_to", "ai_analysis", "scores", "related_ids", "updated_at",
],
"projects" => &[
"id", "name", "description", "status", "idea_id", "path", "stack", "created_at",
diff --git a/docs/todo.md b/docs/todo.md
index d65f145..1a80aef 100644
--- a/docs/todo.md
+++ b/docs/todo.md
@@ -8,6 +8,77 @@
---
+## 🎯 统一规划(2026-06-26 全景)
+
+> 整合知识图谱设计 + 22 条未完成项 + G1 目标钉扎(✅落地待实测) + 多工程方案。
+> **核心主线:AI Working** — AI 拥有项目知识图谱,自主分解/编排/执行/自检,人只决策。
+> **执行策略(两阶段)**:① 先攒批无冲突小 bug/小调整 → 提交;② workflow 编排相关任务批量推进大重构(减少文件读取/LLM 交互,提高上下文效率)。
+
+### 主线脉络
+```
+G1目标钉扎(✅落地,待实测) → 知识图谱Phase1(任务网络,AI编排地基)
+ ↓ ↓
+实测验证 Phase4注入(复用G1的system_prompt注入基建)
+ ↓ ↑
+F-09多会话B(立项) ────────────────┘ (Phase4前置:多会话各自注入)
+```
+
+### 任务图谱(DAG · 有方向有状态)
+
+> 节点=任务(着色=状态),边=依赖方向(前置 → 后继)。**推进时更新状态**(CLI/edit 同步此表 + Mermaid)。
+> 图例:✅完成 / 🔨进行中 / 📋待办 / 🚫阻塞
+
+```mermaid
+graph TD
+ classDef done fill:#bfb,stroke:#393,stroke-width:2px
+ classDef doing fill:#ffd,stroke:#993,stroke-width:2px
+ classDef todo fill:#eef,stroke:#99c
+ classDef blocked fill:#fcc,stroke:#c33
+
+ G1["G1 目标钉扎
✅代码 8ce18cb / 🔨待实测"]:::doing
+ P1["父① 小bug攒批
✅①.2/①.3(①.1过时·①.4归⑤)"]:::done
+ P2["父② 知识图谱Phase1
📋待办"]:::todo
+ P3["父③ AI对话体验
📋待办"]:::todo
+ P4["父④ F-09 per-conv
📋待办"]:::todo
+ P5["父⑤ 灵感剩余
📋待办"]:::todo
+ P6["父⑥ Phase2-5
📋待办"]:::todo
+ P7["父⑦ 技术债
📋待办"]:::todo
+
+ P1 -.先行.-> P2
+ G1 ==基建==> P6
+ P2 ==> P6
+ P4 ==> P6
+ P2 -.task_links.-> P5
+```
+
+| 任务 | 状态 | 子项 | 依赖(前置) |
+|---|---|---|---|
+| **G1** 目标钉扎 | 🔨 代码✅`8ce18cb` 待实测 | G1/G2/G4 落地 | — |
+| **父①** 小bug攒批 | ✅ 完成 | ①.2 白名单✅(settings.rs) / ①.3 priority✅(idea.rs) / ①.1 BUG层1❌过时(F-260619-03 方案①取代,层2待决策) / ①.4 雷达图→归父⑤ | — |
+| **父②** 知识图谱Phase1 | 📋 待办 | ②.1 V28迁移(queue/parent_id/content_json/task_links) / ②.2 TaskRecord+TaskLinkRepo / ②.3 IPC+move_queue / ②.4 父聚合 / ②.5 AI工具12 | G1(弱) |
+| **父③** AI对话体验 | 📋 待办 | ③.1 B-260619-04 ToolCard / ③.2 REFACTOR-260619-04 审批状态机 | — |
+| **父④** F-09 per-conv | 📋 待办 | ④.1 streaming/currentText per-conv | — |
+| **父⑤** 灵感剩余 | 📋 待办 | ⑤.1 IDEA-FIX-01 软删除 / ⑤.2 #05-#10 P1 | ⑤.2#07→②.1 |
+| **父⑥** Phase2-5 | 📋 待办 | ⑥.1事件流 / ⑥.2基础设施 / ⑥.3注入 / ⑥.4前端 | ⑥→父②, ⑥.3→父②+父④+G1 |
+| **父⑦** 技术债 | 📋 待办 | SMELL-P1-6 / conditions / CR缓存 / UX分页 / 审批超时 / miniapp / 双监听器 | — (穿插) |
+
+> **推进路径**:父①先行(攒批提交)→ 父②主线 workflow → 父③/④并行 → 父⑤/⑥/⑦穿插。每父任务一个 workflow 批,子任务相关文件批量读改减少交互。**状态更新约定**:子项完成→父状态 🔨;全子完成→父 ✅;每批提交后同步此表。
+
+### 协同点(跨主题复用)
+1. **IDEA-FIX-07 关联单向 ↔ 知识图谱 `task_links`**:并入 Phase 1 用独立表(§2.2 论证 JSON 缺陷),别补 JSON 双向同步
+2. **G1 system_prompt 注入基建 ↔ Phase 4 L0 注入**:复用 `pinned_goal` 拼接链路
+3. **F-09 per-conv ↔ Phase 4 多会话注入**:F-09 前置
+4. **REFACTOR-260619-04 审批状态机 ↔ `queue=decision` 待决策池**:审批对齐
+
+### 待决策
+| 决策点 | 选项 |
+|---|---|
+| 多工程合并 | 方案 A 合并 V28(前提:确认子1 表设计,find 未找到独立文档)/ 知识图谱独立 Phase 1 |
+| conditions 启用 | 启用求值 / 保留观察 |
+| BUG-260620-05 层2 | workspace_root 外默认放行(黑名单制)?— 详见 `## 🔴 2026-06-20 BUG-260620-05` |
+
+---
+
## 交接状态(2026-06-14)
**代码健康度**:`cargo test --workspace` 全过、`npx vue-tsc --noEmit` 0 error(主代理独立验证,非 mission 自报)。
diff --git a/src-tauri/src/commands/idea.rs b/src-tauri/src/commands/idea.rs
index 1040966..e0ff1a4 100644
--- a/src-tauri/src/commands/idea.rs
+++ b/src-tauri/src/commands/idea.rs
@@ -73,6 +73,15 @@ pub async fn create_idea(
state: State<'_, AppState>,
input: CreateIdeaInput,
) -> Result {
+ // IDEA-FIX-03: priority 值域校验 ∈ 0..=3 (对标 tasks B-260615-15)。
+ // priority_from_i32 对越界值兜底归并(>=3→Critical),但 IPC 入口应显式拒非法值,
+ // 防 LLM/前端传 99 等被静默吞为 Critical。
+ if !(0..=3).contains(&input.priority) {
+ return Err(format!(
+ "priority 必须在 0..=3 (Low=0/Medium=1/High=2/Critical=3),收到 {}",
+ input.priority
+ ));
+ }
let now = now_millis();
let record = IdeaRecord {
id: new_id(),