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

[FIX] cannot end a flowchart when a End is Then Activity in If #5899

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

Conversation

iio888
Copy link

@iio888 iio888 commented Aug 14, 2024

fix #5823
Welcome to post suggestions.


This change is Reviewable

iio888 added 2 commits August 14, 2024 15:18
Send BreakSignal when executing End Activity
Check isBreaking when a child completed in Flowchart
@iio888
Copy link
Author

iio888 commented Aug 14, 2024

@dotnet-policy-service agree

iio888 added 6 commits August 14, 2024 15:36
Add test case of Breaking from a While which includes a Flowchart
Add test case of ending a flowchart when the end activity is nested in a If.
Add test case
Copy link
Member

@sfmskywalker sfmskywalker left a comment

Choose a reason for hiding this comment

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

It makes sense. Only thing I'm unsure of is whether we should reuse the BreakSignal, or if it would be better to create a dedicated EndSignal. The former is intended to break out of a "scope" such as a for-each activity's Body, while the latter would be intended to complete the closest flowchart activity containing the End activity.

Thoughts?

@iio888
Copy link
Author

iio888 commented Aug 17, 2024

Good idea! The EndSignal is better than BreakSignal exactly.
I’ll modify my code. Thanks for your advice

@iio888 iio888 requested a review from sfmskywalker August 19, 2024 03:23
@iio888
Copy link
Author

iio888 commented Aug 19, 2024

Now the End Activity will ends all the parent flowcharts. Is it will be better that just ends the last flowchart and stop propagation? @sfmskywalker

@sfmskywalker
Copy link
Member

Yes, the End activity should only end the current Flowchart and not all of its ancestors. This is in contrast to the Finish activity, which is intended to finish the workflow from anywhere in the graph.

@iio888 iio888 marked this pull request as draft August 20, 2024 01:22
@iio888 iio888 marked this pull request as ready for review August 20, 2024 02:49
@iio888 iio888 marked this pull request as draft September 2, 2024 12:12
@iio888 iio888 marked this pull request as ready for review September 5, 2024 12:40
@iio888 iio888 requested a review from sfmskywalker September 9, 2024 01:25
@iio888
Copy link
Author

iio888 commented Sep 21, 2024

@sfmskywalker Hi. Any thoughts about this pr?

@@ -27,6 +27,9 @@ public Flowchart([CallerFilePath] string? source = default, [CallerLineNumber] i
OnSignalReceived<ScheduleActivityOutcomes>(OnScheduleOutcomesAsync);
OnSignalReceived<ScheduleChildActivity>(OnScheduleChildActivityAsync);
OnSignalReceived<CancelSignal>(OnActivityCanceledAsync);

OnSignalReceived<BreakSignal>(OnBreakSignalReceived);
Copy link
Member

Choose a reason for hiding this comment

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

Why does the Flowchart activity need to handle the Break signal?

@bobhauser
Copy link
Contributor

bobhauser commented Sep 25, 2024

I am concerned about this PR and how it would adversely affect existing workflows. The way that I expect End activities to work is for them to end the current flow. If there is a single flow in the process, then it would effectively end the process. But if there are concurrent flows, only the flow that reached an End should stop - the other concurrent flows should continue until they reach their respective End activities (or complete all activities if no explicit End).

This would be a very breaking change for many workflows in our organization. And it would go against how End activities are treated in BPMN.

Perhaps there should be a new Terminate activity or something if this new behaviour is required.

I think that the current Elsa End activity would be equivalent to then BPMN None End.

The proposed new End behaviour would be equivalent to the BPMN Terminate End.

@sfmskywalker
Copy link
Member

@bobhauser Thanks for chiming in. You're right, actually. The description of the End activity states as much: it's a milestone event, and an explicit way to mark the end of a sequence.

@iio888 what do you think of the suggestion to introduce a new activity called Terminate? Its effect should be equivalent to that of the BPMN's Terminate End, which (I think) is essentially the same behavior as the one you implemented for the End activity in this PR.

@iio888
Copy link
Author

iio888 commented Oct 12, 2024

Maybe there is something mistakes in my code. What I want to fix is equivalent to None End actually. As in #5823, I found some potential problems when I am using End and If and I have no idea to change the original functionality of End.

Thanks for your suggestions.

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

Successfully merging this pull request may close these issues.

[BUG]Cannot break a Flowchart in While
3 participants