修复: record_to_idea 读真实 status/related_ids(父⑤⑤.2 #5)
IDEA-FIX-05: record_to_idea 原 status 硬编码 Draft / related_ids 硬编码空, 评估时丢失真实上下文。改读 record.status(加 status_from_str 映射 DB snake_case → IdeaStatus 枚举,fallback Draft)+ related_ids(parse JSON Vec,同 tags 模式)。 scores/time 不改(注释明示评估不用)。
This commit is contained in:
@@ -58,7 +58,7 @@ graph TD
|
|||||||
| **父②** 知识图谱Phase1 | 📋 待办 | ②.1 V28迁移(queue/parent_id/content_json/task_links) / ②.2 TaskRecord+TaskLinkRepo / ②.3 IPC+move_queue / ②.4 父聚合 / ②.5 AI工具12 | G1(弱) |
|
| **父②** 知识图谱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 审批状态机 | — |
|
| **父③** AI对话体验 | 📋 待办 | ③.1 B-260619-04 ToolCard / ③.2 REFACTOR-260619-04 审批状态机 | — |
|
||||||
| **父④** F-09 per-conv | 📋 待办 | ④.1 streaming/currentText per-conv | — |
|
| **父④** F-09 per-conv | 📋 待办 | ④.1 streaming/currentText per-conv | — |
|
||||||
| **父⑤** 灵感模块 | 🔨 进行中 | ⑤.1 软删除✅(V28+Repo+IPC+6测试) / ①.4 雷达图✅ / ⑤.2 #05-#10 P1待办(#07→父②) | ⑤.2#07→②.1 |
|
| **父⑤** 灵感模块 | 🔨 进行中 | ⑤.1 软删除✅ / ①.4 雷达图✅ / ⑤.2 #05 record_to_idea✅ / #06 配置化·#09·#10 表单待办 / #07 promote补偿待定(soft_delete 污染回收站 vs purge 内部回滚干净?) | ⑤.2#07→②.1 |
|
||||||
| **父⑥** Phase2-5 | 📋 待办 | ⑥.1事件流 / ⑥.2基础设施 / ⑥.3注入 / ⑥.4前端 | ⑥→父②, ⑥.3→父②+父④+G1 |
|
| **父⑥** Phase2-5 | 📋 待办 | ⑥.1事件流 / ⑥.2基础设施 / ⑥.3注入 / ⑥.4前端 | ⑥→父②, ⑥.3→父②+父④+G1 |
|
||||||
| **父⑦** 技术债 | 📋 待办 | SMELL-P1-6 / conditions / CR缓存 / UX分页 / 审批超时 / miniapp / 双监听器 | — (穿插) |
|
| **父⑦** 技术债 | 📋 待办 | SMELL-P1-6 / conditions / CR缓存 / UX分页 / 审批超时 / miniapp / 双监听器 | — (穿插) |
|
||||||
|
|
||||||
|
|||||||
@@ -398,16 +398,28 @@ fn record_to_idea(record: &IdeaRecord) -> Idea {
|
|||||||
},
|
},
|
||||||
None => Vec::new(),
|
None => Vec::new(),
|
||||||
};
|
};
|
||||||
|
// IDEA-FIX-05: 读真实 related_ids(原硬编码 Vec::new() 丢关联上下文)。解析同 tags 模式。
|
||||||
|
let related_ids: Vec<String> = match record.related_ids.as_deref() {
|
||||||
|
Some(r) => match serde_json::from_str::<Vec<String>>(r) {
|
||||||
|
Ok(v) => v,
|
||||||
|
Err(e) => {
|
||||||
|
tracing::warn!(error = %e, idea_id = %record.id, "[ideas] related_ids JSON 解析失败,降级空");
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => Vec::new(),
|
||||||
|
};
|
||||||
Idea {
|
Idea {
|
||||||
id: record.id.clone(),
|
id: record.id.clone(),
|
||||||
title: record.title.clone(),
|
title: record.title.clone(),
|
||||||
description: record.description.clone(),
|
description: record.description.clone(),
|
||||||
status: df_types::types::IdeaStatus::Draft,
|
// IDEA-FIX-05: 读真实 status(原硬编码 Draft 丢真实状态,评估上下文完整性)
|
||||||
|
status: status_from_str(&record.status),
|
||||||
priority: priority_from_i32(record.priority),
|
priority: priority_from_i32(record.priority),
|
||||||
scores: None,
|
scores: None,
|
||||||
tags,
|
tags,
|
||||||
source: record.source.clone(),
|
source: record.source.clone(),
|
||||||
related_ids: Vec::new(),
|
related_ids,
|
||||||
created_at: chrono::Utc::now(),
|
created_at: chrono::Utc::now(),
|
||||||
updated_at: chrono::Utc::now(),
|
updated_at: chrono::Utc::now(),
|
||||||
}
|
}
|
||||||
@@ -423,6 +435,21 @@ fn priority_from_i32(p: i32) -> Priority {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// IDEA-FIX-05: idea status 字符串(DB snake_case)→ IdeaStatus 枚举。
|
||||||
|
/// record_to_idea 读真实 status 用(原硬编码 Draft 丢真实状态)。未知值 fallback Draft(同原行为)。
|
||||||
|
fn status_from_str(s: &str) -> df_types::types::IdeaStatus {
|
||||||
|
use df_types::types::IdeaStatus;
|
||||||
|
match s {
|
||||||
|
"draft" => IdeaStatus::Draft,
|
||||||
|
"pending_review" => IdeaStatus::PendingReview,
|
||||||
|
"approved" => IdeaStatus::Approved,
|
||||||
|
"rejected" => IdeaStatus::Rejected,
|
||||||
|
"promoted" => IdeaStatus::Promoted,
|
||||||
|
"archived" => IdeaStatus::Archived,
|
||||||
|
_ => IdeaStatus::Draft,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Recommendation → 前端 assessmentLabel 期望的全小写空格分隔(匹配 map key)
|
/// Recommendation → 前端 assessmentLabel 期望的全小写空格分隔(匹配 map key)
|
||||||
fn recommendation_str(r: &df_ideas::adversarial::Recommendation) -> &'static str {
|
fn recommendation_str(r: &df_ideas::adversarial::Recommendation) -> &'static str {
|
||||||
use df_ideas::adversarial::Recommendation::*;
|
use df_ideas::adversarial::Recommendation::*;
|
||||||
|
|||||||
Reference in New Issue
Block a user