Skip to content

refactor: clean-up WorkflowReconcileResult and Condition #1388

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

Merged
merged 7 commits into from
Aug 29, 2022
Merged

Conversation

metacosm
Copy link
Collaborator

@metacosm metacosm commented Aug 8, 2022

  • fix: grammar
  • refactor: clean up WorkflowReconcileResult
  • refactor: make it easier to create Conditions

@metacosm metacosm self-assigned this Aug 8, 2022
@metacosm metacosm requested a review from csviri August 8, 2022 16:59

@SuppressWarnings("rawtypes")
Class<? extends Condition> deletePostcondition() default VoidCondition.class;
Class<? extends Condition> deletePostcondition() default Condition.class;
Copy link
Collaborator

Choose a reason for hiding this comment

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

TBH before it was more expressive before, kinda describing that what is there it is a special value - so presumably handled specially subsequently. Taking a look on this is little confusing? maybe document it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think we lost any expressiveness with this change: the default is the non-instantiable interface so it fulfils the same role as a default value (i.e. we can effectively check that the provided value is not the default one) without the need to create an additional class.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, not sure, I mean VoidCondition has explicitly in it's name that it is about not having a condition. Byt fine by me also this way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The problem with VoidCondition is that it is still an implementation, meaning that if we somehow forget to check for it in the code that processes the annotation then you get a valid condition which is not what you want. Condition itself cannot be instantiated so if we don't process it, this will lead to a quick exception making it easier to figure out what is wrong as opposed to tracking down why some events are processed when they should not be because we forgot to check for VoidCondition somewhere.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Making VoidCondition abstract would help with that, since it would instantly fail. Also now it throws always an exception, so it will instantly recognized in any test something is wrong.

But again I'm fine with both, I like that there are no more dedicated classes, just needs to be documented that this is the intention putting the interface there as default, that is a good enough alternative for me :)

@metacosm metacosm changed the base branch from main to next August 26, 2022 14:31
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 9 Code Smells

61.7% 61.7% Coverage
0.0% 0.0% Duplication

@metacosm metacosm merged commit e2e3d77 into next Aug 29, 2022
@metacosm metacosm deleted the managed-result branch August 29, 2022 10:08
csviri pushed a commit that referenced this pull request Aug 30, 2022
Should make it easier to handle Conditions and Filters.
csviri pushed a commit that referenced this pull request Sep 5, 2022
Should make it easier to handle Conditions and Filters.
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