bpmn-io / bpmnlint

Validate BPMN diagrams based on configurable lint rules.
MIT License
125 stars 37 forks source link

`conditional-flows` rule on multiple outgoing flows with no conditions #130

Closed deanmzamzow closed 7 months ago

deanmzamzow commented 7 months ago

Describe the Bug

The conditional-flows rule should invalidate flows when:

Currently, the rule does not invalidate these flows. However, on submitting the bpmn to Camunda, it is disallowed with response "Must have a condition or be default flow" for each outgoing flow of the exclusive or inclusive gateway.

Steps to Reproduce

Run the conditional-flows rule against a bpmn model with the following:

  <bpmn:process id="Process" isExecutable="true">
    <bpmn:exclusiveGateway id="Source">
      <bpmn:outgoing>Flow_1</bpmn:outgoing>
      <bpmn:outgoing>Flow_2</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:intermediateThrowEvent id="Target_1">
      <bpmn:incoming>Flow_1</bpmn:incoming>
    </bpmn:intermediateThrowEvent>
    <bpmn:sequenceFlow id="Flow_1" sourceRef="Source" targetRef="Target_1" />
    <bpmn:intermediateThrowEvent id="Target_2">
      <bpmn:incoming>Flow_2</bpmn:incoming>
    </bpmn:intermediateThrowEvent>
    <bpmn:sequenceFlow id="Flow_2" sourceRef="Source" targetRef="Target_2" />
  </bpmn:process>

image

Expected Behavior

Each flow with no condition should be invalid even when all flows do not have a condition.

Environment

nikku commented 7 months ago

Thanks for opening this issue! Let's examine what the rule does:

Ensures that conditions on sequence flows are consistently set. If a sequence flow outgoing from a conditional forking gateway or activity is default or any sequence flow has a condition attached, all others have to have to have respective condition meta-data attached, too.

In other words: If a user adds at least one condition or default flow then all of the respective flows must have a condition (or be default). On the other hand, if I decide to not add a condition at all (because I'm in modeling only, not for execution mode) then the diagram validates just fine. Focus is on consistently here.

Did you find a situation where what the rule does violates the constraint? If I understand you correctly then you want the rule to be more rigid. This would make it report tons of cases where folks happily use BPMN as a language to communicate process knowledge with no intend of implementing it.

deanmzamzow commented 7 months ago

I understand - I do want a more rigid rule, for the purpose of validating a diagram for execution.

If you like, I can create a separate rule for this validation. Otherwise, I can create such a rule in my local rule set instead.

nikku commented 7 months ago

What execution platform do you target?

deanmzamzow commented 7 months ago

We deploy these bpmn models to cloud-hosted operate.camunda.io for execution. Does that answer the question?

nikku commented 7 months ago

If your engine is Camunda 8, then I'd ask you to checkout bpmnlint-plugin-camunda-compat, an extension that validates your diagrams against Camunda 8 "readyness for execution".

nikku commented 7 months ago

I'm closing this issue as won't fix.