Skip to content

Comments

Fix create suggestions#3

Open
lietho wants to merge 1 commit intoBaseledger:developfrom
lietho:fix_create_suggestion
Open

Fix create suggestions#3
lietho wants to merge 1 commit intoBaseledger:developfrom
lietho:fix_create_suggestion

Conversation

@lietho
Copy link

@lietho lietho commented May 28, 2022

When creating suggestions with NEXTWORKSTEP and FINALWORKSTEP the code acts a little bit strange in my opinion. The recipient of the new suggestion is taken form the latest trustmesh entry. Unfortunately, this prevents both parties from changing the workflow state.

For example: Alice sends an initial suggestion to Bob. Bob accepts the message and sends a positive feedback. Now both parties have a latest trustmesh entry with Sender=Bob. If Bob now wants to execute the next workstep and sends a suggestion with workstep type NEXTWORKSTEP or FINALWORKSTEP, the code will send the suggestion to Bob.

I have fixed this issue by taking the recipient from the DTO instead from the latest trustmesh entry.

Copy link
Contributor

@skosito skosito left a comment

Choose a reason for hiding this comment

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

I think this seems logical, but have to be tested and confirmed.
It looks like we supported communication in a way that A sends suggestions, B provides feedbacks. This PR is giving possibility that next workstep suggestion can be sent by B. I can not remember if we did this intentionally or this is a bug. I we did this intentionally bug is that B can do it, we should at least prevent it somehow.

@lietho What happens with new version if B tries to send it in same scenario? I see code is the same there.
To proceed with this merge, we should make sure all current e2e tests are green, and we need to add new test that covers this scenario. What do you think?

cc: @ognjenkurtic

@lietho
Copy link
Author

lietho commented Jun 9, 2022

Hi @skosito. I left the code for createNewVersionSuggestionRequestFromLatestTrustmeshEntry as it is because it makes sense for this workflow type. If Alice sent a suggestion and Bob rejected it, then the new version can again have Bob as recipient.

But maybe there should be another check for NEWVERSION to prevent Bob from creating a new version. To my understanding it is currently possible for Bob to create a new version even he himself rejected the previous suggestions by Alice. This results in a message to Bob, what seems to be an inconsistent state. So maybe we should check if the sender of a NEWVERSION is the same as for the rejected suggestion. What do you think?

@skosito
Copy link
Contributor

skosito commented Jun 9, 2022

Yes we should do that. But I think both new cases should be covered with new e2e tests and making sure existing ones are still green.

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.

2 participants