elsa-workflows / elsa-workflows/elsa-core

Flowchart and ForEach inconsistencies

Open
#7,308 0 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
7.9k
Forks
1.5k
Avg merge
15h 22m
Merged PRs (30d)
114

Description

## Description
Trying to gracefully handle exceptions led me to discover that I think are at least two bugs:

- TerminalNodes can skip to the next activity in a flowchart even if a previous one failed, since Flowchart.ProcessChildCompletedAsync completes an activity unconditionally, unlike the "normal" flow, where it is checked whether a previous activity failed (Flowchart.CompleteIfNoPendingWorkAsync / hasFaultedActivities)
- a ForEach containing such a "failed+continued" flowchart has broken iteration behavior, e.g. in my reproduction example the foreach iterates over the elements 1,3,3 (instead of 1,2,3)
- the third thing is that without a terminalnode the flowchart stil seems to continue execution, but the foreach then terminates after the first (failed) iteration goes through, e.g. in my example, without the `define USE_END`, after the "Fail" activity throws, the "Write" activity is executed afterwards for the first iteration, but then the foreach stops

## Steps to Reproduce
https://github.com/daef/ElsaIncidentFail/

as is it uses and "End" activity to demonstrate the behavior with terminalnodes, remove the comment in line 2 to undefine USE_END to study the behevior without terminalnode

**Reproduction Rate**: every time

## Expected Behavior
I would have loved to find a configuration s.t. workflows are resilient to unexpected activities failing using
ContinueWithIncidentsStrategy, which doesnt seem to be the intended behavior.
but the inconsistencies described above are still severe.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.