Skip to content

feat(automation): BPMN ⇄ structured-construct model mapping (ADR-0031, task 5) - #1500

Merged
os-zhuang merged 1 commit into
mainfrom
claude/bpmn-interop-mapping-adr0031
Jun 2, 2026
Merged

feat(automation): BPMN ⇄ structured-construct model mapping (ADR-0031, task 5)#1500
os-zhuang merged 1 commit into
mainfrom
claude/bpmn-interop-mapping-adr0031

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Implements ADR-0031 task 5 (issue #1479) — the BPMN ⇄ structured-construct mapping, completing the ADR-0031 roadmap.

Scope decision (long-term lens)

ADR-0031 makes the structured constructs the native model and BPMN interop-only ("Priority: Low"). The durable, reusable asset is the semantic mapping at the flow-model level — that logic is needed regardless of the wire format. So this PR delivers the model-level mapping (pure, no XML dependency); BPMN 2.0 XML (de)serialization layers on top and stays a plugin concern (per bpmn-interop.zod.ts), as a follow-up.

What's in this PR — @objectstack/specautomation/bpmn-mapping.ts (new)

Export — exportConstructsToBpmn(flow) expands each construct into its BPMN interchange shape so external BPM tools see a well-formed graph:

  • parallelparallel_gateway (AND-split) + branch regions + join_gateway (AND-join)
  • try_catch → the protected activity + an error boundary_event + the handler region
  • loop (with body) → its body marked with multi-instance loopCharacteristics

Each expansion's anchor node carries an osConstruct extension marker (the analogue of BPMN extensionElements).

Import — importBpmnToConstructs(flow) folds BPMN back into constructs:

  • Nodes with an osConstruct marker → exact reconstruction (so construct → BPMN → construct is identity)
  • Foreign BPMN (no marker) → best-effort structural fold of matched parallel_gateway/join_gateway pairs into a parallel block; shapes it can't safely fold (foreign boundary events, multi-instance markers) are left in place with diagnostics.

Both return a { flow, diagnostics, mappedCount, unmappedCount } result (mirrors BpmnInteropResultSchema).

Tests

automation/bpmn-mapping.test.ts9 tests: expansion shape + exact round-trips for parallel / try_catch (retry preserved) / loop, foreign gateway folding, and the two warning paths (foreign boundary event; gateway with no matching join). Spec tsc --noEmit clean; full automation suite 293.

Roadmap (#1479) — complete

https://claude.ai/code/session_012ti8cx3TkdiQdjCnZXZg2Q


Generated by Claude Code

…31, task 5)
Add the semantic bridge between the structured control-flow constructs (native
model) and the BPMN gateway/boundary/multi-instance vocabulary (interop only),
at the flow-model level — independent of any wire format.
spec (@objectstack/spec) — automation/bpmn-mapping.ts:
- exportConstructsToBpmn(flow): parallel -> parallel_gateway + branches +
join_gateway; try_catch -> protected activity + error boundary_event +
handler; loop -> body marked with multi-instance loopCharacteristics. Each
expansion's anchor carries an `osConstruct` extension marker.
- importBpmnToConstructs(flow): exact reconstruction from the marker (so
construct -> BPMN -> construct is identity), plus best-effort folding of
foreign parallel_gateway/join_gateway pairs, with diagnostics for shapes it
can't safely fold.
- 9 tests incl. exact round-trips (parallel/try_catch/loop) and foreign folding.
BPMN 2.0 XML (de)serialization layers on top and stays a plugin concern
(bpmn-interop.zod.ts) — out of scope here. ADR-0031 updated.
https://claude.ai/code/session_012ti8cx3TkdiQdjCnZXZg2Q
@vercel

vercelBot commented Jun 2, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJun 2, 2026 1:24am

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests tooling size/l labels Jun 2, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review June 2, 2026 01:43
@os-zhuang
os-zhuang merged commit b046ec2 into mainJun 2, 2026
12 checks passed
os-zhuang added a commit that referenced this pull request Jun 2, 2026
The structured control-flow constructs (loop/parallel/try-catch) and the BPMN
interop mapping are implemented and merged (#1482, #1489, #1499, #1500; docs
#1497). Flip ADR-0031 from Proposed to Accepted and record the implementing PRs
and the deferred follow-ups (#1504 BPMN XML plugin, #1505 region step logs).
https://claude.ai/code/session_012ti8cx3TkdiQdjCnZXZg2Q
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/lteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@os-zhuang@claude