Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add completionCondition + cancelRemainingInstances properties to ad-hoc subprocess #1114

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

maff
Copy link

@maff maff commented Mar 4, 2025

Proposed Changes

Adds support to configure completionCondition (expression) and cancelRemainingInstances (boolean) for ad-hoc subprocesses.

BPMN implementation
image

Zeebe specific implementation
image

Related to camunda/camunda-modeler#4850.

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

@bpmn-io-tasks bpmn-io-tasks bot added the in progress Currently worked on label Mar 4, 2025
@maff maff force-pushed the feature/4850-add-ad-hoc-completion-condition-handling branch 2 times, most recently from 574938c to e4f2342 Compare March 4, 2025 15:36
* @param {string} newValue
* @param {BpmnFactory} bpmnFactory
*/
function updateFormalExpression(element, propertyName, newValue, bpmnFactory) {
Copy link
Author

Choose a reason for hiding this comment

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

There is a certain amount of duplication across other properties which handle expressions - this one was mostly adapted from the MultiInstanceProps. Do we have a preference on duplication vs. extracting into reusable utils/helpers?

Copy link
Member

Choose a reason for hiding this comment

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

Given that this is the third place where we can update formal expression (multiinstance, sequence flow condition, ad-hoc subprocess), having a util in https://github.com/bpmn-io/bpmn-js-properties-panel/tree/main/src/utils is a good idea.

Copy link
Author

Choose a reason for hiding this comment

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

Refactored into a utility in 68d86a8 and adapted the 2 new AdHoc props implementations to use that one. I would create a follow-up PR to adapt the other code parts as well to not expand the scope of this PR.

Copy link
Member

Choose a reason for hiding this comment

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

Refactored into a utility in 68d86a8 and adapted the 2 new AdHoc props implementations to use that one. I would create a follow-up PR to adapt the other code parts as well to not expand the scope of this PR.

As long as you clearly separate refactoring and your improvement in separate commits we're fine. We don't have limits in terms of size of a PR, what we ask for is that the commits are semantically structured. Your changes will also not be squashed, so whatever work you structure will be "followable" later on in the commit history.

Copy link
Author

Choose a reason for hiding this comment

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

Fully agree on the semantically structured commits. I'm open to both - the follow-up PR would make it easier to follow the refactoring-only change on unrelated components with a dedicated PR description, but on the other hand changing other components here makes it easier to verify that the abstraction of the helper works properly for multiple use cases 😉

I now updated the MultiInstanceProps to use the new helper in 533f220 but kept the sequence flow as it was as its logic seems a bit different than the other 2.

@maff maff force-pushed the feature/4850-add-ad-hoc-completion-condition-handling branch from fef86fa to 68d86a8 Compare March 5, 2025 16:15
@maff maff marked this pull request as ready for review March 5, 2025 16:27
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Mar 5, 2025
@maff maff requested review from nikku and barmac March 6, 2025 12:02
@barmac
Copy link
Member

barmac commented Mar 7, 2025

Is it the logical order in which I configure an ad-hoc subprocess? Initially, I thought that I'd first define which activities will be activated when element is reached, and only then I'd define the completion condition. However, the condition can be independent from the actions that the ad-hoc subprocess executor can take. I think the order is correct, but still want to flag it for discussion.
image

@maff
Copy link
Author

maff commented Mar 7, 2025

Is it the logical order in which I configure an ad-hoc subprocess? Initially, I thought that I'd first define which activities will be activated when element is reached, and only then I'd define the completion condition. However, the condition can be independent from the actions that the ad-hoc subprocess executor can take. I think the order is correct, but still want to flag it for discussion.

💡 That's a very good point. I think they can independent, but it may be more logical to move the completion condition below the active elements when thinking at the flow of the process (first activate, then complete). I'll try to update it accordingly.

@maff
Copy link
Author

maff commented Mar 7, 2025

Updated to reorder the groups in 1ab3114:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Review pending
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ad-Hoc Subprocess: Support completionCondition and cancelRemainingInstances attributes
3 participants