修复: status→enum + type alias(SMELL-P1-6)
This commit is contained in:
@@ -284,7 +284,7 @@ pub async fn create_task(
|
||||
project_id: input.project_id,
|
||||
title: input.title,
|
||||
description: input.description,
|
||||
status: "todo".to_string(),
|
||||
status: TaskStatus::Todo,
|
||||
priority: input.priority,
|
||||
branch_name: input.branch_name,
|
||||
assignee: input.assignee,
|
||||
@@ -314,7 +314,7 @@ pub async fn create_task(
|
||||
Some("task"),
|
||||
Some(&record.id),
|
||||
None,
|
||||
Some(&record.status),
|
||||
Some(record.status.as_str()),
|
||||
)
|
||||
.await;
|
||||
Ok(record)
|
||||
@@ -466,8 +466,8 @@ pub async fn advance_task(
|
||||
"task_advanced",
|
||||
Some("task"),
|
||||
Some(&updated.id),
|
||||
from_state.as_deref(),
|
||||
Some(&updated.status),
|
||||
from_state.as_ref().map(TaskStatus::as_str),
|
||||
Some(updated.status.as_str()),
|
||||
)
|
||||
.await;
|
||||
|
||||
@@ -505,7 +505,7 @@ async fn recompute_parent_status(state: &State<'_, AppState>, parent_id: &str) -
|
||||
.get_by_id(parent_id)
|
||||
.await
|
||||
.map_err(err_str)?
|
||||
.map(|t| t.status)
|
||||
.map(|t| t.status.as_str().to_string())
|
||||
.ok_or_else(|| format!("父任务 {parent_id} 不存在"));
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ async fn recompute_parent_status(state: &State<'_, AppState>, parent_id: &str) -
|
||||
.await
|
||||
.map_err(err_str)?
|
||||
.ok_or_else(|| format!("父任务 {parent_id} 不存在"))?;
|
||||
if current.status == new_status {
|
||||
if current.status.as_str() == new_status {
|
||||
return Ok(new_status);
|
||||
}
|
||||
state
|
||||
@@ -688,13 +688,13 @@ pub async fn move_task_queue(
|
||||
"backlog" => "todo".to_string(),
|
||||
"active" => {
|
||||
if ACTIVE_OK_STATUSES.contains(¤t.status.as_str()) {
|
||||
current.status.clone() // 已在执行中三态,保留
|
||||
current.status.as_str().to_string() // 已在执行中三态,保留
|
||||
} else {
|
||||
"in_progress".to_string() // 否则强制进 in_progress(执行中池默认执行态)
|
||||
}
|
||||
}
|
||||
"todo" => "todo".to_string(), // 待办池任务 status 强制=todo(从 active 退回 todo 池即重置执行态)
|
||||
"decision" => current.status.clone(), // 待决策池保留当前 status(暂停推进不重置执行态)
|
||||
"decision" => current.status.as_str().to_string(), // 待决策池保留当前 status(暂停推进不重置执行态)
|
||||
_ => unreachable!("validate_queue 已收口"),
|
||||
};
|
||||
|
||||
@@ -708,7 +708,7 @@ pub async fn move_task_queue(
|
||||
.map_err(err_str)?;
|
||||
}
|
||||
// 写 status(专用 set_status_for_aggregation 绕过 status 收口,move_task_queue 是合法非状态机路径)
|
||||
if current.status != new_status {
|
||||
if current.status.as_str() != new_status {
|
||||
state
|
||||
.tasks
|
||||
.set_status_for_aggregation(&id, &new_status)
|
||||
|
||||
Reference in New Issue
Block a user