修复: 工作流审批闭环(execution_id 下沉 + 共享状态机 + HumanNode 真审批)

- B-06: DagExecutor 接收 execution_id 下沉到 NodeContext,消除 dummy-execution-id 硬编码
- B-07: NodeContext.node_status 共享 self.state_machine.clone()(is_cancelled 可工作)
- B-03a: HumanNode execute 重写为 subscribe→send→select! 循环(响应/超时/取消 + execution_id+node_id 双键 + Lagged 容忍),删假返回"同意"
- eventbus.rs 删 try_recv_human_approval 死代码
- 新增 human_node 7 单测(正常/双键过滤/超时/非法决策/自由文本)

照 B-03-人工审批响应机制.md 设计。cargo check 0 error,df-nodes 14 + df-workflow 11 test 全过
This commit is contained in:
2026-06-14 14:27:08 +08:00
parent 02ff88fc61
commit 22964a2e20
4 changed files with 254 additions and 39 deletions

View File

@@ -2,7 +2,7 @@
use tokio::sync::broadcast;
use tokio::sync::broadcast::error::SendError;
use df_core::events::{WorkflowEvent, HumanApprovalResponse};
use df_core::events::WorkflowEvent;
/// 事件总线
#[derive(Debug)]
@@ -44,13 +44,6 @@ impl EventBus {
pub fn emit_human_approval_request(&self, event: WorkflowEvent) -> Result<usize, SendError<WorkflowEvent>> {
self.sender.send(event)
}
/// 尝试获取人工审批响应(简化版本,实际需要实现状态存储)
pub fn try_recv_human_approval(&self, _execution_id: &str, _node_id: &str) -> Option<HumanApprovalResponse> {
// TODO: 实现审批响应的存储和检索
// 目前返回 None需要配合前端实现
None
}
}
impl Default for EventBus {