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

🐛 Resolve Deppy error check todo #535

Merged

Conversation

m1kola
Copy link
Member

@m1kola m1kola commented Nov 10, 2023

Description

We already have a version which contains the fix and can revert to a simpler check.

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 10, 2023
@m1kola m1kola marked this pull request as ready for review November 10, 2023 15:01
@m1kola m1kola requested a review from a team as a code owner November 10, 2023 15:01
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 10, 2023
@m1kola m1kola force-pushed the resolve-deppy-error-check-todo branch from 262f36f to 088c9b7 Compare November 10, 2023 15:10
Copy link

codecov bot commented Nov 10, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (f147e61) 84.72% compared to head (7fb8b6d) 84.53%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #535      +/-   ##
==========================================
- Coverage   84.72%   84.53%   -0.19%     
==========================================
  Files          23       23              
  Lines         910      912       +2     
==========================================
  Hits          771      771              
- Misses         95       96       +1     
- Partials       44       45       +1     
Flag Coverage Δ
e2e 66.11% <66.66%> (-0.15%) ⬇️
unit 79.32% <66.66%> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
internal/controllers/operator_controller.go 80.16% <66.66%> (-0.66%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

func prettyUnsatMessage(err error) string {
unsat := deppy.NotSatisfiable{}
if !errors.As(err, &unsat) {
panic("we must always receive deppy.NotSatisfiable 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'm always hesitant about introducing panics in code, could you explain the benefit?

Copy link
Member Author

Choose a reason for hiding this comment

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

prettyUnsatMessage is a workaround operator-framework/deppy#142 (there is a comment about it above, not in the diff). It will go away and we will be doing something like this in controller code eventually:

setResolvedStatusConditionFailed(&op.Status.Conditions, err.Error(), op.GetGeneration())

I was thinking failing laudly given that this is a temporary code and this condition should never happen unless we introduce a regression. But now I'm thinking about it again - yes, probably there is not much benefit in this and we can do just something like this:

unsat := deppy.NotSatisfiable{}
if !errors.As(err, &unsat) {
	return err.Error()
}

I'll update.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

We already have a version which contains the fix
and can revert to a simpler check.

Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
@m1kola m1kola force-pushed the resolve-deppy-error-check-todo branch from 088c9b7 to 7fb8b6d Compare November 10, 2023 15:35
@m1kola m1kola requested a review from awgreene November 10, 2023 15:53
Copy link
Member

@awgreene awgreene left a comment

Choose a reason for hiding this comment

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

Nice work!

@m1kola m1kola added this pull request to the merge queue Nov 10, 2023
Merged via the queue into operator-framework:main with commit 3373785 Nov 10, 2023
13 of 15 checks passed
@m1kola m1kola deleted the resolve-deppy-error-check-todo branch November 10, 2023 16:26
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.

None yet

2 participants