修复: execution_id String→ExecutionId 类型别名 + 更新待决策状态
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::NodeId;
|
||||
use crate::types::{ExecutionId, NodeId};
|
||||
|
||||
/// 人工审批选择类型(F-260615-01)
|
||||
/// - Single: 单选(decision 单值),缺省值,向后兼容现有调用方
|
||||
@@ -24,7 +24,7 @@ pub enum SelectType {
|
||||
/// 旧调用方仍可只填 decision,HumanNode 下游兼容两者。
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct HumanApprovalResponse {
|
||||
pub execution_id: String,
|
||||
pub execution_id: ExecutionId,
|
||||
pub node_id: NodeId,
|
||||
pub decision: String,
|
||||
#[serde(default)]
|
||||
@@ -81,7 +81,7 @@ pub enum WorkflowEvent {
|
||||
/// #[serde(default)] 向后兼容: 老事件/老 DB 反序列化(无 execution_id)填空串不炸。
|
||||
WorkflowCompleted {
|
||||
#[serde(default)]
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
total_duration_ms: u64,
|
||||
},
|
||||
/// 工作流执行失败
|
||||
@@ -89,13 +89,13 @@ pub enum WorkflowEvent {
|
||||
/// B-03b-R10 ③(波17 治本): execution_id 字段标识本次终态事件归属的工作流执行(同 WorkflowCompleted)。
|
||||
WorkflowFailed {
|
||||
#[serde(default)]
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
error: String,
|
||||
failed_node: NodeId,
|
||||
},
|
||||
/// 人工审批请求
|
||||
HumanApprovalRequest {
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
node_id: NodeId,
|
||||
title: String,
|
||||
description: String,
|
||||
@@ -106,7 +106,7 @@ pub enum WorkflowEvent {
|
||||
},
|
||||
/// 人工审批响应
|
||||
HumanApprovalResponse {
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
node_id: NodeId,
|
||||
decision: String,
|
||||
/// F-260615-01: 多选结果(Single 模式长度=1,Multiple 模式长度≥1)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use df_types::events::WorkflowEvent;
|
||||
use df_types::types::NodeId;
|
||||
use df_types::types::{ExecutionId, NodeId};
|
||||
|
||||
use crate::conditions::ConditionEngine;
|
||||
use crate::dag::Dag;
|
||||
@@ -18,7 +18,7 @@ pub struct DagExecutor {
|
||||
/// 节点状态机
|
||||
state_machine: StateMachine,
|
||||
/// 工作流执行 ID(由调用方传入,下沉到每个 NodeContext)
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
}
|
||||
|
||||
impl DagExecutor {
|
||||
@@ -26,7 +26,7 @@ impl DagExecutor {
|
||||
///
|
||||
/// `execution_id` 为本次工作流执行的唯一标识,会下沉到每个节点的 NodeContext,
|
||||
/// 用于节点内的事件关联、审计追踪等。
|
||||
pub fn new(event_bus: EventBus, execution_id: String) -> Self {
|
||||
pub fn new(event_bus: EventBus, execution_id: ExecutionId) -> Self {
|
||||
Self {
|
||||
event_bus,
|
||||
state_machine: StateMachine::new(),
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use async_trait::async_trait;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use df_types::types::NodeId;
|
||||
use df_types::types::{ExecutionId, NodeId};
|
||||
|
||||
use super::eventbus::EventBus;
|
||||
use super::state::StateMachine;
|
||||
@@ -18,7 +18,7 @@ pub struct NodeContext {
|
||||
/// 节点配置参数
|
||||
pub config: serde_json::Value,
|
||||
/// 工作流执行 ID
|
||||
pub execution_id: String,
|
||||
pub execution_id: ExecutionId,
|
||||
/// 事件总线
|
||||
pub event_bus: EventBus,
|
||||
/// 节点状态机(用于检查取消状态)
|
||||
|
||||
10
docs/todo.md
10
docs/todo.md
@@ -86,11 +86,11 @@ graph TD
|
||||
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` |
|
||||
| 决策点 | 选项 | 状态 |
|
||||
|--------|------|------|
|
||||
| 多工程合并 | ✅ 已决:知识图谱独立 Phase 1(V29),多工程 V30+ | ✅ 已归档 |
|
||||
| conditions 启用 | ✅ 已决:conditions-eval feature 默认开,引擎已完成,前端 UI 待列待办 | ✅ 已实施 |
|
||||
| BUG-260620-05 层2 | workspace_root 外默认放行(黑名单制)? 详见 `## 🔴 2026-06-20 BUG-260620-05` | 🟡 待决策 |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use tauri::{AppHandle, Emitter, State};
|
||||
use tokio::sync::broadcast::error::RecvError;
|
||||
|
||||
use df_types::events::{WorkflowEvent, HumanApprovalResponse, SelectType};
|
||||
use df_types::types::{new_id, NodeStatus};
|
||||
use df_types::types::{new_id, ExecutionId, NodeStatus};
|
||||
use df_nodes::task_advance_node::advance_task_atomic;
|
||||
// F-260616-06 ②-4: 工作流失败时按 target_status 推算任务退回态。
|
||||
// regression_target 已收敛到 df-nodes::task_state_machine(状态机业务契约,单一可信源),
|
||||
@@ -29,7 +29,7 @@ use super::{err_str, now_millis};
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
struct WorkflowEventPayload {
|
||||
/// 工作流执行记录 ID
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
/// 原始工作流事件(serde tag = "type")
|
||||
event: WorkflowEvent,
|
||||
}
|
||||
@@ -385,7 +385,7 @@ pub async fn get_workflow_execution(
|
||||
pub async fn approve_human_approval(
|
||||
app: AppHandle,
|
||||
state: State<'_, AppState>,
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
node_id: String,
|
||||
decision: String,
|
||||
// F-260615-01: 多选结果数组,缺省空数组(单选调用方不传)
|
||||
@@ -466,7 +466,7 @@ pub async fn approve_human_approval(
|
||||
#[tauri::command]
|
||||
pub async fn cancel_workflow_node(
|
||||
state: State<'_, AppState>,
|
||||
execution_id: String,
|
||||
execution_id: ExecutionId,
|
||||
node_id: String,
|
||||
) -> Result<(), String> {
|
||||
// 经 execution_id 取执行器状态机(与 NodeContext.node_status 共享同一 HashMap)
|
||||
|
||||
Reference in New Issue
Block a user