新增: 项目状态机分层+任务状态枚举合并
真分层(df-project): - ProjectManager 加 can_transition/transition/is_terminal 状态机 - 创建加 EmptyName 校验,返回 Result 而非裸实体 - 新增 ProjectTransitionError 三种错误变体 - 调用方(idea.rs promote_idea)适配 Result 传播 双源合并: - TaskStatus::as_str 改为 const fn(允许 const 上下文调用) - task_state_machine 字符串常量从 TaskStatus enum 派生 - IdeaStatus/ProjectStatus as_str 同步改为 const fn(一致性) 架构债设计方案: - #8 IPC 错误结构化迁移路径(IpcError enum + 前端消费) - #15 AI 状态机抽离 df-ai-session(4 阶段) - #18 配置四源统一(AppConfig 单例 + 环境变量覆盖) - #19 SQLite 连接池(r2d2)
This commit is contained in:
@@ -22,27 +22,29 @@
|
||||
//! - cancelled → 终态
|
||||
|
||||
// ============================================================
|
||||
// 状态字符串常量 — 与 df-types::TaskStatus::as_str 一一对应
|
||||
// 状态字符串常量 — 从 df-types::TaskStatus::as_str 派生(单一真相源)
|
||||
// ============================================================
|
||||
//
|
||||
// 不复用 df-types::TaskStatus enum(独立模块定位 + 避免推进链判定耦合存储枚举类型),
|
||||
// 但字符串值严格对齐(df-types::TaskStatus::as_str 产出的小写 snake_case),
|
||||
// 保证状态机判定的 from/to 与数据库 status 列存值语义一致。
|
||||
// 任务 #17 合并:字符串常量不再独立定义,直接从 `TaskStatus::as_str()` 派生。
|
||||
// 消除 df-nodes 字符串常量与 df-types enum 之间的双源问题—— 任一处修改 enum 的
|
||||
// as_str 输出,本模块常量自动同步,编译期即可发现柡移。
|
||||
|
||||
use df_types::types::TaskStatus;
|
||||
|
||||
/// 待开始
|
||||
pub const TODO: &str = "todo";
|
||||
pub const TODO: &str = TaskStatus::Todo.as_str();
|
||||
/// 进行中
|
||||
pub const IN_PROGRESS: &str = "in_progress";
|
||||
pub const IN_PROGRESS: &str = TaskStatus::InProgress.as_str();
|
||||
/// 代码审查中
|
||||
pub const IN_REVIEW: &str = "in_review";
|
||||
pub const IN_REVIEW: &str = TaskStatus::InReview.as_str();
|
||||
/// 测试中
|
||||
pub const TESTING: &str = "testing";
|
||||
pub const TESTING: &str = TaskStatus::Testing.as_str();
|
||||
/// 已完成(终态)
|
||||
pub const DONE: &str = "done";
|
||||
pub const DONE: &str = TaskStatus::Done.as_str();
|
||||
/// 已阻塞
|
||||
pub const BLOCKED: &str = "blocked";
|
||||
pub const BLOCKED: &str = TaskStatus::Blocked.as_str();
|
||||
/// 已取消(终态)
|
||||
pub const CANCELLED: &str = "cancelled";
|
||||
pub const CANCELLED: &str = TaskStatus::Cancelled.as_str();
|
||||
|
||||
/// 全部合法状态值(供输入校验与错误提示复用)
|
||||
pub const ALL_STATES: &[&str] = &[
|
||||
|
||||
Reference in New Issue
Block a user