You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "jomarko (via GitHub)" <gi...@apache.org> on 2026/10/13 15:12:07 UTC
[PR] kie-tools-isses#4044: BPMN editor does not update BPMNPlane bpmnElement [incubator-kie-tools]
jomarko opened a new pull request, #4045:
URL: https://github.com/apache/incubator-kie-tools/pull/4045
Closes: https://github.com/apache/incubator-kie-tools/issues/4044
### Steps to reproduce
Open this file using new bpmn editor and change the process id `aclassic` to `aclassic-c2`
```
<?xml version="1.0" encoding="UTF-8" ?>
<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:drools="http://www.jboss.org/drools" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="_9fXTkalEED-Qp-6tKLclSw" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd http://www.omg.org/spec/DD/20100524/DC DC.xsd http://www.omg.org/spec/DD/20100524/DI DI.xsd " exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20" xmlns:di="http://www.omg.org/spec/DD/20100524/DI">
<bpmn2:collaboration id="_62584859-31EC-4324-A1D5-C51094CACF98" name="Default Collaboration">
<bpmn2:participant id="_51B4C7A1-40E3-4D2F-AB41-3EC6AA0304D8" name="Pool Participant" processRef="aclassic" />
</bpmn2:collaboration>
<bpmn2:process id="aclassic" drools:packageName="com.example" drools:version="1.0" drools:adHoc="false" name="aclassic-c1" isExecutable="true" processType="Public">
<bpmn2:task id="_EF6C9BCE-C4DA-49E0-9ED9-8780BB5AC4C2" name="Task">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue>Task</drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
</bpmn2:task>
</bpmn2:process>
<bpmndi:BPMNDiagram id="_79335080-7B8C-4B89-9C38-89A469EAE663">
<bpmndi:BPMNPlane bpmnElement="aclassic" id="_F2A396CB-964E-4E40-B298-808E99BD2FA0">
<bpmndi:BPMNShape id="shape__EF6C9BCE-C4DA-49E0-9ED9-8780BB5AC4C2" bpmnElement="_EF6C9BCE-C4DA-49E0-9ED9-8780BB5AC4C2">
<dc:Bounds height="102" width="154" x="143" y="185" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
<bpmn2:relationship type="BPSimData">
<bpmn2:extensionElements>
<bpsim:BPSimData>
<bpsim:Scenario id="default" name="Simulationscenario">
<bpsim:ScenarioParameters />
<bpsim:ElementParameters elementRef="_EF6C9BCE-C4DA-49E0-9ED9-8780BB5AC4C2">
<bpsim:TimeParameters>
<bpsim:ProcessingTime>
<bpsim:NormalDistribution mean="0" standardDeviation="0" />
</bpsim:ProcessingTime>
</bpsim:TimeParameters>
<bpsim:ResourceParameters>
<bpsim:Availability>
<bpsim:FloatingParameter value="0" />
</bpsim:Availability>
<bpsim:Quantity>
<bpsim:FloatingParameter value="0" />
</bpsim:Quantity>
</bpsim:ResourceParameters>
<bpsim:CostParameters>
<bpsim:UnitCost>
<bpsim:FloatingParameter value="0" />
</bpsim:UnitCost>
</bpsim:CostParameters>
</bpsim:ElementParameters>
</bpsim:Scenario>
</bpsim:BPSimData>
</bpmn2:extensionElements>
<bpmn2:source>_9fXTkalEED-Qp-6tKLclSw</bpmn2:source>
<bpmn2:target>_9fXTkalEED-Qp-6tKLclSw</bpmn2:target>
</bpmn2:relationship>
</bpmn2:definitions>
```
<img width="499" height="1030" alt="Screenshot 2026-10-13 170445" src="https://github.com/user-attachments/assets/cb3e552d-d71f-4322-b2b3-f4047086a758" />
### Before the fix
```
<bpmndi:BPMNPlane bpmnElement="aclassic" id="_F2A396CB-964E-4E40-B298-808E99BD2FA0">
```
remain unchanged
### After the fix
```
<bpmndi:BPMNPlane bpmnElement="aclassic-c2" id="_F2A396CB-964E-4E40-B298-808E99BD2FA0">
```
is updated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-tools-isses#4044: BPMN editor does not update BPMNPlane bpmnElement [incubator-kie-tools]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #4045:
URL: https://github.com/apache/incubator-kie-tools/pull/4045#discussion_r4261900634
##########
packages/bpmn-editor/src/mutations/renameGlobalProperties.ts:
##########
@@ -39,4 +39,12 @@ export function updateProcessId({
participant["@_processRef"] = newId;
}
}
+
+ // Keep the DI layer in sync, otherwise BPMNPlane.bpmnElement becomes a dangling IDREF.
+ definitions["bpmndi:BPMNDiagram"]?.forEach((diagram) => {
+ const plane = diagram["bpmndi:BPMNPlane"];
+ if (plane["@_bpmnElement"] === oldProcessId) {
+ plane["@_bpmnElement"] = newId;
+ }
Review Comment:
plane` is used without a null/undefined guard, so `plane["@_bpmnElement"]` will throw if a `bpmndi:BPMNDiagram` entry is missing `bpmndi:BPMNPlane` (or if parsing ever yields it as undefined). Add a guard (or early return/continue) before dereferencing `plane`, and also consider that `bpmndi:BPMNPlane` can be serialized as an array in some XML-to-JSON conversions—update all planes when it’s an array.
##########
packages/bpmn-editor/src/mutations/renameGlobalProperties.ts:
##########
@@ -39,4 +39,12 @@ export function updateProcessId({
participant["@_processRef"] = newId;
}
}
+
+ // Keep the DI layer in sync, otherwise BPMNPlane.bpmnElement becomes a dangling IDREF.
+ definitions["bpmndi:BPMNDiagram"]?.forEach((diagram) => {
Review Comment:
definitions["bpmndi:BPMNDiagram"]` is iterated assuming it’s always an array. In BPMN files, `BPMNDiagram` can be singular, and depending on the XML parser configuration it may deserialize as an object rather than an array. To make this mutation robust and easier to reuse for future DI updates, normalize `BPMNDiagram` to an array (e.g., wrap singletons) before iterating.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-tools-isses#4044: BPMN editor does not update BPMNPlane bpmnElement [incubator-kie-tools]
Posted by "Kusuma04-dev (via GitHub)" <gi...@apache.org>.
Kusuma04-dev merged PR #4045:
URL: https://github.com/apache/incubator-kie-tools/pull/4045
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-tools-isses#4044: BPMN editor does not update BPMNPlane bpmnElement [incubator-kie-tools]
Posted by "jomarko (via GitHub)" <gi...@apache.org>.
jomarko commented on code in PR #4045:
URL: https://github.com/apache/incubator-kie-tools/pull/4045#discussion_r4269610999
##########
packages/bpmn-editor/src/mutations/renameGlobalProperties.ts:
##########
@@ -39,4 +39,12 @@ export function updateProcessId({
participant["@_processRef"] = newId;
}
}
+
+ // Keep the DI layer in sync, otherwise BPMNPlane.bpmnElement becomes a dangling IDREF.
+ definitions["bpmndi:BPMNDiagram"]?.forEach((diagram) => {
Review Comment:
also on other places we assume `definitions["bpmndi:BPMNDiagram"]` is an array, see:
- packages/bpmn-editor/tests-e2e/__fixtures__/jsonModel.ts
- packages/bpmn-editor/src/store/computeDiagramData.ts
- packages/bpmn-editor/src/mutations/addOrGetProcessAndDiagramElements.ts
keeping the code as it is
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
Re: [PR] kie-tools-isses#4044: BPMN editor does not update BPMNPlane bpmnElement [incubator-kie-tools]
Posted by "jomarko (via GitHub)" <gi...@apache.org>.
jomarko commented on code in PR #4045:
URL: https://github.com/apache/incubator-kie-tools/pull/4045#discussion_r4269471516
##########
packages/bpmn-editor/src/mutations/renameGlobalProperties.ts:
##########
@@ -39,4 +39,12 @@ export function updateProcessId({
participant["@_processRef"] = newId;
}
}
+
+ // Keep the DI layer in sync, otherwise BPMNPlane.bpmnElement becomes a dangling IDREF.
+ definitions["bpmndi:BPMNDiagram"]?.forEach((diagram) => {
+ const plane = diagram["bpmndi:BPMNPlane"];
+ if (plane["@_bpmnElement"] === oldProcessId) {
+ plane["@_bpmnElement"] = newId;
+ }
Review Comment:
The plane is a single required element in the schema-generated types and `addOrGetProcessAndDiagramElements` already relies on it.
This is from `packages/bpmn-marshaller/dist/schemas/bpmn-2_0/ts-gen/types.d.ts`
<img width="484" height="138" alt="image" src="https://github.com/user-attachments/assets/fb7ce145-b92d-42e2-b360-f09390da842c" />
I am updating the codebase only in the following way:
```
definitions["bpmndi:BPMNDiagram"]?.forEach((diagram) => {
const plane = diagram["bpmndi:BPMNPlane"];
if (plane?.["@_bpmnElement"] === oldProcessId) {
plane["@_bpmnElement"] = newId;
}
});
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org