martinweiler opened a new pull request, #7298:
URL: https://github.com/apache/incubator-kie/pull/7298

   Closes: https://github.com/apache/incubator-kie/issues/7297
   
   **Problem**
   An ad hoc subprocess with completion condition `autocomplete` is closed by 
the first unrelated event, such as a variable update, if it has no active child 
at that moment. A typical case is a stage that contains only a milestone 
without auto start, followed by a human task. The stage completes before the 
main process can trigger the milestone, so the milestone and its follow-up task 
are never created. In jBPM 7.x, `autocomplete` was evaluated only when a child 
node completed, so such a stage stayed open.
   
   **Cause**
   `DynamicNodeInstance` has a `completeEventListener` that runs on every 
`afterNodeLeft` and `afterVariableChanged` event. It calls `canComplete()`, and 
for `autocomplete` that is true whenever there are no active child node 
instances. This listener was introduced as a field by the change for #1944 
(kogito-runtimes #3912).
   
   **Fix**
   Skip `autocomplete` in `completeEventListener`. An `autocomplete` subprocess 
is still completed by `nodeInstanceCompleted()` when its last child finishes. 
Subprocesses with an explicit completion condition keep being evaluated by the 
listener.
   
   **Test**
   - 
`StandaloneBPMNProcessTest#testAdHocSubProcessAutoCompleteStaysOpenWhileEmpty` 
uses a new `BPMN2-AdHocSubProcessAutoCompleteEmptyStage.bpmn2`, with an 
`autocomplete` ad hoc subprocess containing a user task that has no auto start.
   - **Steps:** it starts the process, updates a variable, and asserts the 
process is still ACTIVE. It then triggers the task, completes it, and asserts 
the process is COMPLETED.
   - **Before the fix:** the test fails at the first ACTIVE assertion (status 
`COMPLETED`, `2`, instead of `ACTIVE`, `1`).
   - **After the fix:** `StandaloneBPMNProcessTest` and `ActivityTest` pass.
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to