Skip to content

引入skipped机制并且完善多节点的断流问题#604

Open
swfnotswift wants to merge 18 commits intoModelEngine-Group:hzjh-mainfrom
swfnotswift:swf-final2
Open

引入skipped机制并且完善多节点的断流问题#604
swfnotswift wants to merge 18 commits intoModelEngine-Group:hzjh-mainfrom
swfnotswift:swf-final2

Conversation

@swfnotswift
Copy link
Copy Markdown

@swfnotswift swfnotswift commented Apr 27, 2026

🔗 相关问题 / Related Issue

Issue 链接 / Issue Link: #{$IssueNumber} 👈👈

  • 我已经创建了相关 Issue 并进行了讨论 / I have created and discussed the related issue
  • 这是一个微小的修改(如错别字),不需要 Issue / This is a trivial change (like typo fix) that doesn't need an issue

📋 变更类型 / Type of Change

  • 🐛 Bug 修复 / Bug fix (non-breaking change which fixes an issue)
  • ✨ 新功能 / New feature (non-breaking change which adds functionality)
  • 💥 破坏性变更 / Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 文档更新 / Documentation update
  • 🔧 重构 / Refactoring (no functional changes)
  • ⚡ 性能优化 / Performance improvement
  • 📦 依赖升级 / Dependency upgrade (update dependencies to newer versions)
  • [ √] 🚀 功能增强 / Feature enhancement (improve existing functionality without breaking changes)
  • 🧹 代码清理 / Code cleanup

📝 变更目的 / Purpose of the Change

本文档详细说明 Waterflow 流程引擎中引入的 Skipped 机制以及 多 END 节点断流逻辑的设计与实现。该机制解决了以下两个核心问题:

  1. 并发环境下 Condition 节点另一条分支"饿死"问题:当 Condition 节点存在多条分支时,未匹配条件的分支在某些并发场景下无法正确参与后续汇聚,导致流程状态不一致。

  2. 多 END 节点场景下断流信号丢失问题:配置了多个 END 节点的流程在执行时,部分 END 节点的触发无法正确入库,导致终止信号无法发送,前端无法收到流程结束通知。

1.2 涉及范围

模块 文件
流程状态枚举 FlowNodeStatus.java
流程上下文 FlowContext.java
条件节点处理器 ConditionsNode.java
条件节点定义 FlowConditionNode.java
流程定义 FlowNode.java
边处理器 When.java, To.java
上下文仓库 FlowContextMemoRepo.java, FlowContextPersistRepo.java
流程运行时服务 FlowRuntimeServiceImpl.java
重启恢复调度 RestartContextSchedule.java
常量定义 Constant.java
END 节点回调 AippFlowEndCallback.java
SQL 映射 EndNodeStatusMapper.xml

📋 主要变更 / Brief Changelog

文件路径 变更类型
Constant.java 新增 INTERNAL_SKIPPED_SIGNAL_KEY 常量;更新状态互斥表
FlowNodeStatus.java 新增 SKIPPED 枚举值
FlowContext.java 新增 markSkippedSignal()isSkippedSignal()fork() 方法
ConditionsNode.java 新增 enableConditionSkip 参数及分支分发逻辑
FlowConditionNode.java 启用 condition 分支跳过机制
When.java 支持 SKIPPED 状态透传
To.java 同时拉取 PENDING 和 SKIPPED 状态;生成 skipped 输出
FlowContextMemoRepo.java 查询支持 SKIPPED 状态
FlowContextPersistRepo.java 新增 getPendingAndSkippedBySubscriptions() 方法
FlowRuntimeServiceImpl.java 运行态统计支持 SKIPPED
RestartContextSchedule.java 重启恢复支持 SKIPPED
AippFlowEndCallback.java 多 END 节点分支添加入库调用
EndNodeStatusMapper.xml terminal_sent 直接写死为 false

🧪 验证变更 / Verifying this Change

QQ_1777294821763 如图所示skipped未命中分支目前也会向后传递 QQ_1777295246923 如图所示目前也支持了多end节点的到达,同时也修改了断流机制

测试步骤 / Test Steps

测试覆盖 / Test Coverage

  • 我已经添加了单元测试 / I have added unit tests
  • [ √] 所有现有测试都通过 / All existing tests pass
  • 我已经进行了手动测试 / I have performed manual testing

📸 截图 / Screenshots

✅ 贡献者检查清单 / Contributor Checklist

请确保你的 Pull Request 符合以下要求 / Please ensure your Pull Request meets the following requirements:

基本要求 / Basic Requirements:

  • 确保有 GitHub Issue 对应这个变更(微小变更如错别字除外)/ Make sure there is a Github issue filed for the change (trivial changes like typos excluded)
  • 你的 Pull Request 只解决一个 Issue,没有包含其他不相关的变更 / Your PR addresses just this issue, without pulling in other changes - one PR resolves one issue
  • PR 中的每个 commit 都有有意义的主题行和描述 / Each commit in the PR has a meaningful subject line and body

代码质量 / Code Quality:

  • 我的代码遵循项目的代码规范 / My code follows the project's coding standards
  • 我已经进行了自我代码审查 / I have performed a self-review of my code
  • 我已经为复杂的代码添加了必要的注释 / I have commented my code, particularly in hard-to-understand areas

测试要求 / Testing Requirements:

  • 我已经编写了必要的单元测试来验证逻辑正确性 / I have written necessary unit-tests to verify the logic correction
  • 当存在跨模块依赖时,我尽量使用了 mock / I have used mocks when cross-module dependencies exist
  • 基础检查通过:mvn -B clean package -Dmaven.test.skip=truenpm install --force && npm run build:pro / Basic checks pass
  • 单元测试通过:mvn clean install / Unit tests pass

文档和兼容性 / Documentation and Compatibility:

  • 我已经更新了相应的文档 / I have made corresponding changes to the documentation
  • 如果有破坏性变更,我已经在 PR 描述中详细说明 / If there are breaking changes, I have documented them in detail
  • 我已经考虑了向后兼容性 / I have considered backward compatibility

📋 附加信息 / Additional Notes


审查者注意事项 / Reviewer Notes:

@swfnotswift swfnotswift changed the title Swf final2 引入skipped机制并且完善多节点的断流问题 Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant