修复: execution_id String→ExecutionId 类型别名 + 更新待决策状态

This commit is contained in:
2026-06-28 03:50:25 +08:00
parent 8723075360
commit 7e3fe1961a
5 changed files with 20 additions and 20 deletions

View File

@@ -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)

View File

@@ -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(),

View File

@@ -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,
/// 节点状态机(用于检查取消状态)