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

feat: improve handling of compensation association #2039

Merged
merged 19 commits into from
Dec 22, 2023
Merged

Conversation

smbea
Copy link
Contributor

@smbea smbea commented Dec 1, 2023

  • Allow to connect compensate boundary event to activity, turning it into compensation activity.
  • Turn sequence flow connected to boundary event into compensation association
    when boundary event is turned replaced with compensate boundary event.

Closes #2038

@bpmn-io-tasks bpmn-io-tasks bot added the in progress Currently worked on label Dec 1, 2023
@smbea smbea changed the base branch from develop to master December 1, 2023 17:45
@smbea smbea marked this pull request as ready for review December 1, 2023 17:46
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Dec 1, 2023
@smbea smbea requested review from a team, philippfromme and marstamm and removed request for a team December 1, 2023 17:46
nikku
nikku previously requested changes Dec 4, 2023
Copy link
Member

@nikku nikku left a comment

Choose a reason for hiding this comment

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

I integration tested this and indeed it feels like an overall less blocking UX, which is a major improvement.

What I found is a couple of quirks:

When transforming to a compensation boundary event the connection turns into an undirected association, where I'd expect a directed association. Expected: We use directed association and the task turns into a compensation task.

capture qX9Taq_optimized

Existing sequence flows are not removed, despite being illegal for compensation tasks. Expected: Remove all other existing connections.

Expected: Preview reflects future association layout.

capture fGgdTQ_optimized

@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Dec 4, 2023
@smbea
Copy link
Contributor Author

smbea commented Dec 4, 2023

Thanks for looking into this @nikku. I'm going to look into all these details tomorrow

@smbea
Copy link
Contributor Author

smbea commented Dec 11, 2023

When transforming to a compensation boundary event the connection turns into an undirected association, where I'd expect a directed association. Expected: We use directed association and the task turns into a compensation task.

✅ This was a bug fixed via aa2fd41

Existing sequence flows are not removed, despite being illegal for compensation tasks. Expected: Remove all other existing connections.

Expected: Preview reflects future association layout.

drawPreview is being called so I'm still not sure what the issue here is. Will have to look into the connection preview to understand more of how it works. I accept pointers if you have them @nikku 😅

This likely prevents connecting event sub processes to text annotations?

Nope, doesn't affect text annotations

Copy link
Member

@nikku nikku left a comment

Choose a reason for hiding this comment

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

I really like the UX progress you made 🎉

capture UoeTgS_optimized

Feels really good. Let's ignore the preview bug for now.

@smbea
Copy link
Contributor Author

smbea commented Dec 15, 2023

Agreed with @barmac that he would take a look at this

@barmac barmac self-assigned this Dec 15, 2023
@barmac
Copy link
Member

barmac commented Dec 18, 2023

If there are more than one outgoing sequence flows, we end up with incorrect diagram:

image

My proposal is to convert only if there is a single sequence flow, and otherwise remove all of the connections.

@barmac
Copy link
Member

barmac commented Dec 18, 2023

Another edge case found ;):

Screen.Recording.2023-12-18.at.18.34.41.mov

@barmac
Copy link
Member

barmac commented Dec 18, 2023

There is more:

Screen.Recording.2023-12-18.at.18.37.29.mov

@barmac
Copy link
Member

barmac commented Dec 18, 2023

However, I got the basic interaction to work:

Screen.Recording.2023-12-18.at.18.40.07.mov

@barmac
Copy link
Member

barmac commented Dec 18, 2023

There is more:

Screen.Recording.2023-12-18.at.18.37.29.mov

This is an old issue, so I will create a separate issue for this.

@barmac barmac changed the base branch from main to develop December 21, 2023 08:05
@barmac
Copy link
Member

barmac commented Dec 21, 2023

I retargetted this to develop as it's more a feature than a fix.


// newSource no longer valid
if (isForCompensation(target) && !isCompensationBoundaryEvent(newSource)) {
removeIsForCompensationProperty(target);
Copy link
Member

Choose a reason for hiding this comment

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

What scenario did we not cover here?

Copy link
Member

Choose a reason for hiding this comment

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

I am sorry, I don't understand the question. Can you make it more verbose?

Copy link
Member

Choose a reason for hiding this comment

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

This line is not covered by tests, so I wonder which scenario this line represents that we do not not cover through tests.

Copy link
Member

Choose a reason for hiding this comment

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

I will add test cases for that.

Copy link
Member

Choose a reason for hiding this comment

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

This allowed to detect another last bug.

image

Copy link
Member

@barmac barmac Dec 22, 2023

Choose a reason for hiding this comment

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

However, this can be recreated only when we forcefully reconnect start. It's not allowed by the rules.

Copy link
Member

Choose a reason for hiding this comment

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

I will leave it out of scope, and remove the respective source code.


// newSource valid
if (canBeForCompensation(target) && isCompensationBoundaryEvent(newSource)) {
addIsForCompensationProperty(target);
Copy link
Member

Choose a reason for hiding this comment

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

What scenario did we not cover here?

Copy link
Member

Choose a reason for hiding this comment

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

OK so I debugged it and source changes are handled via ReplaceConnectionBehavior. We don't need explicit compensation-specific code.

Association removal is handled in CompensateBoundaryEventBehavior.
@barmac barmac requested a review from nikku December 21, 2023 15:21
@nikku nikku dismissed their stale review December 21, 2023 16:52

Thinks look good!

Copy link
Member

@nikku nikku left a comment

Choose a reason for hiding this comment

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

This works great!

@nikku nikku self-requested a review December 21, 2023 16:56
@nikku
Copy link
Member

nikku commented Dec 21, 2023

From my point of view you can go ahead and merge this. Consider cleaning up the commits before.

@barmac
Copy link
Member

barmac commented Dec 22, 2023

image
image

Let's 🎃 it!

@barmac barmac merged commit 3dbaf50 into develop Dec 22, 2023
12 checks passed
@barmac barmac deleted the fix-compensation branch December 22, 2023 14:00
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Dec 22, 2023
@barmac barmac changed the title fix: add isForCompensation on connect feat: improve handling of compensation association Dec 22, 2023
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.

Compensation Activity Cannot Be Appended Through Append Feature
4 participants