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

Better linting for ad-hoc subprocess #4811

Open
jarekdanielak opened this issue Jan 24, 2025 · 8 comments
Open

Better linting for ad-hoc subprocess #4811

jarekdanielak opened this issue Jan 24, 2025 · 8 comments
Assignees
Labels
BPMN Camunda 8 Flags an issue as related to Camunda 8 enhancement New feature or request in progress Currently worked on linting

Comments

@jarekdanielak
Copy link
Contributor

jarekdanielak commented Jan 24, 2025

Problem you would like to solve

There is no linting for ad-hoc subprocess except for checking for Camunda version >= 8.7.

Proposed solution

Add linting for ad-hoc subprocess.

Ensure BPMN specification constraints (bpmn-lint):

  • Contains only: Activities, Sequence Flows, Gateways, Intermediate Events, Data Objects and Data Associations. *
  • Intermediate Event must have an outgoing Sequence Flow.

* we also allow artifacts, following our logic for a regular subprocess (comment)

Ensure Camunda constraints (bpmnlint-plugin-camunda-compat):

  • Must have at least one activity.

The following Camunda constraints are enforced by BPMN standard:

  • Must not have start events or end events.
  • Any intermediate catch event must have an outgoing sequence flow.

Additional context

@jarekdanielak jarekdanielak added BPMN Camunda 8 Flags an issue as related to Camunda 8 enhancement New feature or request linting labels Jan 24, 2025
@jarekdanielak jarekdanielak self-assigned this Jan 24, 2025
@nikku
Copy link
Member

nikku commented Jan 24, 2025

To consider: What is Camunda specific, what is core, and hence shall be validated via bpmnlint.

@barmac
Copy link
Collaborator

barmac commented Jan 27, 2025

This is coming from BPMN:

An Ad-Hoc Sub-Process or Process contains a number of embedded inner Activities and is intended to be executed
with a more flexible ordering compared to the typical routing of Processes. Unlike regular Processes, it does not
contain a complete, structured BPMN diagram description—i.e., from Start Event to End Event. Instead the Ad-Hoc
Sub-Process contains only Activities, Sequence Flows, Gateways, and Intermediate Events. An Ad-Hoc
Sub-Process MAY also contain Data Objects and Data Associations. The Activities within the Ad-Hoc Sub-
Process are not REQUIRED to have incoming and outgoing Sequence Flows. However, it is possible to specify
Sequence Flows between some of the contained Activities. When used, Sequence Flows will provide the same
ordering constraints as in a regular Process. To have any meaning, Intermediate Events will have outgoing
Sequence Flows and they can be triggered multiple times while the Ad-Hoc Sub-Process is active.

Too bad the spec lacks MUST in this clause.

Source: https://www.omg.org/spec/BPMN/2.0/PDF#page=461

@jarekdanielak
Copy link
Contributor Author

I updated the top comment with BPMN and Camunda constraints which should be implemented. @barmac could you confirm it's correct?

@jarekdanielak jarekdanielak added the backlog Queued in backlog label Feb 10, 2025
@nikku
Copy link
Member

nikku commented Feb 11, 2025

@jarekdanielak I can confirm that above thing is correct/a great start.

@barmac
Copy link
Collaborator

barmac commented Feb 13, 2025

Contains only: Activities, Sequence Flows, Gateways, Intermediate Events, Data Objects and Data Associations.

From the context, I think we can assume that this is the limitation for the flow objects. I'd rather not disallow artifacts in an ad-hoc subprocess (text annotations, groups).

@jarekdanielak jarekdanielak added the ready Ready to be worked on label Feb 14, 2025 — with bpmn-io-tasks
@jarekdanielak jarekdanielak removed the backlog Queued in backlog label Feb 14, 2025
@barmac
Copy link
Collaborator

barmac commented Feb 14, 2025

Interesting point brought today by @jarekdanielak: Should we disallow Data Store Reference in an ad-hoc subprocess? While the spec seems to be clear about this (allows explicitly data object and data associations but misses data storage), I'd rather not enforce it in the tooling. The only thing relevant for the execution in Camunda context is the flow objects set, and out of these the spec disallows start and end events only. The artifacts and item aware elements should be ignored.

@nikku
Copy link
Member

nikku commented Feb 14, 2025

We allow data stores outside of pools, too, for modeling convenience. Hence I'd argue for 👍, handle data stores in a forgiving way, allow them inside ad-hoc sub-processes, too.

@jarekdanielak
Copy link
Contributor Author

So the linting rule for an ad-hoc subprocess will only extend the existing rule for a regular subprocess by disallowing start and end events.

Additionally, in Camunda linting we enforce it has at least one activity.

jarekdanielak added a commit to bpmn-io/bpmnlint that referenced this issue Feb 14, 2025
Verify that an ad-hoc sub-process only contains valid elements:

* Does not contain start or end events.
* Every intermediate event has an outgoing sequence flow.

Related to camunda/camunda-modeler#4811
jarekdanielak added a commit to bpmn-io/bpmnlint that referenced this issue Feb 14, 2025
Verify that an ad-hoc sub-process is valid:

* Must not contain start or end events.
* Every intermediate event must have an outgoing sequence flow.

Related to camunda/camunda-modeler#4811
@jarekdanielak jarekdanielak added the in progress Currently worked on label Feb 14, 2025 — with bpmn-io-tasks
@jarekdanielak jarekdanielak removed the ready Ready to be worked on label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BPMN Camunda 8 Flags an issue as related to Camunda 8 enhancement New feature or request in progress Currently worked on linting
Projects
None yet
Development

No branches or pull requests

3 participants