fix(bpmn): keep subprocess bodies through the document PUT - #8077
Merged
Merged
Conversation
BpmnDefinitions lists only top-level processes: Bpmn.Interchange carries the body of an embedded subprocess, transaction or event subprocess as the subprocess element's NestedProcess work binding. The document GET therefore never returned the bodies, and the PUT wrote the posted document without any bindings, so BpmnXmlWriter wrote every subprocess empty and the re-import replaced the definition with one whose subprocesses were empty. The PUT now re-reads the stored source and hands the writer the stored body of every subprocess element the posted document still declares, matched by element id, together with everything bound inside it (a call activity's vw:waitForCompletion lives only on its CallProcess binding). A removed subprocess's body is never written back, not even under a new element that reuses its bindingRef, and a subprocess with a stored body but no bindingRef is refused rather than emptied. The GET body, the ETag and the error codes are unchanged; nested content stays uneditable through the document. Bpmn.Interchange 0.2.0 also retains a copy of a subprocess's interpreted multiInstanceLoopCharacteristics inside its body. Handed back verbatim, that copy would override a posted marker on the next read and add another copy on every PUT, so the PUT drops it wherever the element carries a marker in the model. The D4 round-trip test now covers subprocess-boundary-events.bpmn and transaction-compensation.bpmn, copied from Studio's fixtures, plus two nested-scope assets, going through the endpoints' JSON options. Refs #8072 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
This was referenced Sep 12, 2026
sfmskywalker
added a commit
to elsa-workflows/elsa-studio
that referenced
this pull request
Sep 12, 2026
* feat(workflows): save BPMN documents with subprocesses elsa-core now keeps a subprocess's stored body and bindings across the document PUT (elsa-workflows/elsa-core#8077), so Studio no longer needs to refuse saving a BPMN document that declares one. Removes BpmnDocumentFailureReason.SubProcessContentNotCarried, the SubProcessIds check, and the "Performed by" panel's CanEdit/Save gating and info alert. Editing an element inside a subprocess is still refused, since its body still isn't part of the document, and now names that as a server limitation tracked in elsa-workflows/elsa-core#8076 instead of implying a Studio one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * style(workflows): drop a stray blank line Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(workflows): cite the subprocess limitation only for elements in a subprocess Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 12, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8072. Part of #7909.
Problem
PUT bpmn/definitions/{id}/documentwrote the postedBpmnDefinitionsthroughBpmnXmlWriter.Write(document)with no bindings. In Bpmn.Interchange 0.2.0, the bodies of subprocesses, transactions and event subprocesses live only in the reader'sNestedProcessbindings, so every PUT of a document declaring one emptied it. On a second PUT, an emptied event subprocess disappeared entirely.Fix (option 2 from the issue)
The PUT now re-reads the stored
Bpmn:SourceXml. For each subprocess-type element the posted document still declares, matched by element id, it writes that element's stored body and every stored binding inside that scope, recursively, under the posted element'sbindingRef. The call isBpmnXmlWriter.Write(definitions, bindings).bindingRefinherits nothing.NestedProcess. Otherwise a nested call activity'svw:waitForCompletion="false", which exists only on itsCallProcessbinding, would silently turn into a waiting call.nullbindingRefis refused with the existing uncoded 400 path rather than emptied. Studio never produces this, because it echoesbindingRefs.No contract change. The GET body, the ETag formula and the 428/412/404 and
BpmnErrorResponsecodes are unchanged, so the Studio client (elsa-workflows/elsa-studio#1031) works as is.Why not option 1
BpmnWorkBindinghas no JSON contract in the library: no property names, no polymorphism, and it is not inbpmn-payload.schema.json. Carrying nested bodies to the client would need an Elsa-owned DTO that restates the library's addressing. That gap is filed as #8076, blocked by valence-works/bpmn#22.Library workaround
Bpmn.Interchange 0.2.0 also keeps an interpreted
multiInstanceLoopCharacteristicsinside the retained nested content (valence-works/bpmn#21). Handing stored bodies back unfiltered would add a copy on every PUT and let the stale copy override a client's changed or removed marker. The PUT drops the retained copy wherever the model carries the marker. It keeps the copy only when it is the sole record of a marker the reader degraded, for example a Camunda-authored one. The workaround is marked for removal.Tests
camunda-order-process;subprocess-boundary-eventsandtransaction-compensation, copied byte-identical from Studio's W9a fixtures;nested-subprocessesandcamunda-multi-instance-subprocess.DocumentPut_OfUnchangedContent_ReturnsTheETagTheGetReturnedis a four-fixture theory.bindingRef;bindingRefrefusal;Follow-ups filed
🤖 Generated with Claude Code