Skip to content

feat(automation): add BPMN parallel gateway, default flow, boundary event, and wait event semantics#780

Merged
hotlong merged 3 commits into
mainfrom
copilot/enhance-bpmn-business-semantics
Feb 22, 2026
Merged

feat(automation): add BPMN parallel gateway, default flow, boundary event, and wait event semantics#780
hotlong merged 3 commits into
mainfrom
copilot/enhance-bpmn-business-semantics

Conversation

Copilot AI commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

Supplements the automation engine spec with high-value BPMN 2.0 business semantics: parallel split/join, default sequence flows, boundary events, and structured wait events. All additive, backward-compatible.

flow.zod.ts — Node & Edge Schema

  • 3 new node types in FlowNodeAction: parallel_gateway (AND-split), join_gateway (AND-join), boundary_event
  • waitEventConfig on FlowNodeSchema — typed event resumption for wait nodes (timer/signal/webhook/manual/condition), with timeout and onTimeout behavior
  • boundaryConfig on FlowNodeSchema — BPMN boundary event attachment to host nodes (error/timer/signal/cancel), interrupting flag
  • isDefault on FlowEdgeSchema — marks the fallback edge when no sibling conditions match
  • conditional edge type added alongside existing default/fault

execution.zod.ts — Checkpoint Reasons

  • Added parallel_join and boundary_event to CheckpointSchema.reason enum

Example: Parallel Approval Flow

const flow = defineFlow({
  name: 'parallel_approval',
  label: 'Parallel Approval',
  type: 'record_change',
  nodes: [
    { id: 'start', type: 'start', label: 'Start' },
    { id: 'fork', type: 'parallel_gateway', label: 'Fork' },
    { id: 'finance', type: 'connector_action', label: 'Finance Review' },
    { id: 'legal', type: 'connector_action', label: 'Legal Review' },
    { id: 'join', type: 'join_gateway', label: 'Join' },
    { id: 'end', type: 'end', label: 'End' },
  ],
  edges: [
    { id: 'e1', source: 'start', target: 'fork' },
    { id: 'e2', source: 'fork', target: 'finance' },
    { id: 'e3', source: 'fork', target: 'legal' },
    { id: 'e4', source: 'finance', target: 'join' },
    { id: 'e5', source: 'legal', target: 'join' },
    { id: 'e6', source: 'join', target: 'end' },
  ],
});

Tests

19 new tests covering parallel gateway flows, default branch decision routing, wait event configurations, boundary event attachment, and fault edge semantics. Full suite: 215 files, 6140 tests passing.

Original prompt

This section details on the original issue you should resolve

<issue_title>补充BPMN关键业务语义于自动化引擎(并行分支、汇聚、默认分支、边界事件等)</issue_title>
<issue_description>## 补充完善:BPMN业务语义借鉴

参考主流流程建模与执行标准 BPMN 2.0,对 ObjectStack 自动化引擎补齐并行分支与汇聚、默认分支、边界事件等高价值业务语义。以支持更丰富的流程场景,但不直接实现完整 BPMN 规范。


🏗️ 改进/扩展点清单

1. 并行分支与汇聚(Parallel Gateway语义)

  • 新增节点类型:parallel_gateway (AND分支)、join_gateway(并行汇聚)
  • 支持流程分裂(一个节点后多个下游节点并行执行,Promise.all实现)、汇聚(需所有分支完成后继续向单一节点流转)
  • DAG核心遍历与变量上下文隔离��化
  • 单元测试:并行任务场景,确保汇聚点等所有分支
  • Studio画布层UI控件支持(节点图形与交互)

2. 默认分支与条件生成(Default Sequence Flow)

  • FlowEdgeSchema增加 isDefault: true/false 字段,decision节点无匹配条件时走默认分支
  • DAG引擎实现决策逻辑补齐
  • 测试覆盖:多条件分支场景

3. 等待事件与中间触发(Intermediate Wait Event)

  • wait节点插件完善,支持流程暂停与外部事件唤醒
  • 边界事件基础处理
  • Studio交互与API对接(如外部 webhook/触发)

4. 流程边界错误事件 Catch/Fault Edge(Boundary Error)

  • fault边类型完善,用于关键节点挂载边界故障处理分支
  • DAG引擎激活fault分支处理(参考#769任务1,增强边界区分)

5. BPMN XML互操作(长期规划)

  • 作为插件支持 BPMN XML格式的流程导入/导出(可选功能,无需强制)

验收标准

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel

vercel Bot commented Feb 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-play Error Error Feb 22, 2026 2:49am
spec Error Error Feb 22, 2026 2:49am

Request Review

…ault flow, boundary events, wait events

- Add `parallel_gateway`, `join_gateway`, `boundary_event` node types to FlowNodeAction
- Add `isDefault` field and `conditional` edge type to FlowEdgeSchema
- Add `waitEventConfig` to FlowNodeSchema for external event wakeup
- Add `boundaryConfig` to FlowNodeSchema for BPMN boundary event pattern
- Add `parallel_join` and `boundary_event` checkpoint reasons to execution.zod.ts
- Add 19 comprehensive tests covering all new BPMN semantics

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Add missing `connector_action` and `screen` to both FlowNodeAction
and FlowNodeSchema 'accept all node types' tests for completeness.

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add BPMN key business semantics to automation engine feat(automation): add BPMN parallel gateway, default flow, boundary event, and wait event semantics Feb 22, 2026
Copilot AI requested a review from hotlong February 22, 2026 02:50
@hotlong
hotlong marked this pull request as ready for review February 22, 2026 02:54
Copilot AI review requested due to automatic review settings February 22, 2026 02:54
@hotlong
hotlong merged commit 5704a22 into main Feb 22, 2026
1 of 3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the ObjectStack automation engine with key BPMN 2.0 business semantics, enabling more sophisticated flow orchestration patterns such as parallel execution, default branching, boundary event handling, and structured wait states. The changes are entirely additive and backward-compatible, extending the existing flow schema without breaking changes.

Changes:

  • Added 3 new node types (parallel_gateway, join_gateway, boundary_event) to support BPMN parallel split/join and boundary event patterns
  • Introduced waitEventConfig and boundaryConfig as optional node configurations for event-driven flow control
  • Enhanced edge schema with isDefault field and conditional edge type for BPMN default sequence flow semantics
  • Extended checkpoint reasons to include parallel_join and boundary_event for proper execution state tracking

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/spec/src/automation/flow.zod.ts Core schema additions: 3 new FlowNodeAction types, waitEventConfig for timer/signal/webhook/manual/condition events, boundaryConfig for error/timer/signal/cancel boundary events, isDefault field and conditional edge type
packages/spec/src/automation/flow.test.ts Comprehensive test coverage with 19 new tests across 5 describe blocks validating parallel gateways, join gateways, default flows, wait events, boundary events, and fault edges
packages/spec/src/automation/execution.zod.ts Added parallel_join and boundary_event to CheckpointSchema.reason enum to support new execution patterns
packages/spec/src/automation/execution.test.ts Updated checkpoint reason validation tests to include new parallel_join and boundary_event reasons
ROADMAP.md Updated flow orchestration count from 14 to 18 node types and added 5 new roadmap items documenting BPMN capabilities

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.

补充BPMN关键业务语义于自动化引擎(并行分支、汇聚、默认分支、边界事件等)

3 participants