bpmn-io / bpmn-js-token-simulation

A BPMN 2.0 specification compliant token simulator.
https://bpmn-io.github.io/bpmn-js-token-simulation/modeler.html?e=1&pp=1
MIT License
243 stars 69 forks source link

In OR gateway, check only incoming sequence flows which have not received token yet #143

Open barmac opened 7 months ago

barmac commented 7 months ago

What should we do?

Check out this conversation: https://camunda.slack.com/archives/CKGH9LR40/p1701443318328729?thread_ts=1701360376.758139&cid=CKGH9LR40

I've already done some work on this branch: https://github.com/bpmn-io/bpmn-js-token-simulation/tree/improve-inclusive-gateway The sequence flow provides itself as a source when another element is entered. What I haven't figured out yet is how to somehow store all the sources to know which scopes to exclude from the search.

Why should we do it?

Spec-compliant OR gateway FTW.


Related to https://github.com/bpmn-io/bpmn-js-token-simulation/issues/130

nikku commented 7 months ago

What I haven't figured out yet is how to somehow store all the sources to know which scopes to exclude from the search.

The idea is to tag all scopes with a "source" (that should already exist, I think). We can then check available scope instances for a node to see if there is one from each source where we expect a token.

barmac commented 7 months ago

Can we tag the scopes within the current API?

nikku commented 7 months ago

Not sure which API you refer to. But every scope has an initiator, giving you access to "who is the reason I exist".

We want to make sure it is appropriately set for sequence flow tokens entering the OR (or XOR) gateway, and to conduct the test using that information.

barmac commented 7 months ago

OK, so if I set the initiator from the sequence flow, all necessary information will be there.

nikku commented 7 months ago

Exactly.

nikku commented 7 months ago

If we fix this, consider fixing it for join (AND), too (https://github.com/bpmn-io/bpmn-js-token-simulation/issues/130):

capture YVN3RE_optimized

barmac commented 7 months ago

Thanks for your support. Indeed it would make sense to fix this for both gateways.