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

⚠️ Remove variable sources and make Deppy accept a slice of variables instead #160

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

m1kola
Copy link
Member

@m1kola m1kola commented Nov 15, 2023

Instead of a variable source make Deppy accept a slice of variables as an input.

Closes #153

@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 15, 2023
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

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

Comparison is base (11c5175) 65.52% compared to head (792c624) 63.90%.

Files Patch % Lines
cmd/dimacs/cmd.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #160      +/-   ##
==========================================
- Coverage   65.52%   63.90%   -1.63%     
==========================================
  Files          11       11              
  Lines         496      482      -14     
==========================================
- Hits          325      308      -17     
- Misses        152      155       +3     
  Partials       19       19              

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

Comment on lines 13 to 19
// Solution is returned by the Solver when the internal solver executed successfully.
// A successful execution of the solver can still end in an error when no solution can
// be found.
type Solution struct {
err error
selection map[deppy.Identifier]deppy.Variable
variables []deppy.Variable
}
Copy link
Member Author

@m1kola m1kola Nov 15, 2023

Choose a reason for hiding this comment

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

I think we can get rid of Solution completely (not in this PR). I do not see a lot of value in it.

And probably replace DeppySolver wrapper around internal package by exporting what we currently have in internal pacakge (with some modifications and also not in this PR).

This comment is for me to look into whether it makes sense and create issues for this.

Edit: created #161 for this

Copy link
Member

Choose a reason for hiding this comment

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

Structuring the logic to be helpers in generating the inputs to and consuming the outputs of the solver library sounds like a really good idea - lets folks use as much of or as little of this helpful logic as they need and doesn't bind them to what we happen to have or not to have wrapped at some moment in time.

@m1kola m1kola changed the title Remove variable sources ⚠️ Remove variable sources Nov 15, 2023
Comment on lines -119 to -121
if solutionOpts.addVariablesToSolution {
solution.variables = vars
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously variables were generated by a varaible soruce. So for cases where the calling code for some reason needed to access input variables - we had an option to add them into the Solution struct. Since now the calling code provides input variables - this seems like pointless option. So I removed it.

@@ -141,26 +116,6 @@ var _ = Describe("Entity", func() {
}))
})

It("should add all variables to solution if option is given", func() {
Copy link
Member Author

Choose a reason for hiding this comment

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

No longer have this option.

Expect(err).ToNot(HaveOccurred())
Expect(solution.Error()).To(HaveOccurred())
})

It("should return peripheral errors", func() {
Copy link
Member Author

Choose a reason for hiding this comment

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

No longer have a variable soruce to fail

@m1kola
Copy link
Member Author

m1kola commented Nov 16, 2023

I think this is ready, but I'll keep it in the draft because I want another PR to go in first so we can cut a release.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 16, 2023
Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 2023
@m1kola m1kola marked this pull request as ready for review November 17, 2023 14:52
@m1kola m1kola requested a review from a team as a code owner November 17, 2023 14:52
@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 17, 2023
@m1kola m1kola changed the title ⚠️ Remove variable sources ⚠️ Remove variable sources and make Deppy accept a slice of variables instead Nov 17, 2023
Instead of a variable source make Deppy accept
a slice of variables as an input.

Signed-off-by: Mikalai Radchuk <mradchuk@redhat.com>
Copy link

@everettraven everettraven 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 these changes look great and will make it easier to use, thanks @m1kola !

@m1kola m1kola added this pull request to the merge queue Nov 27, 2023
Merged via the queue into operator-framework:main with commit af7d9eb Nov 27, 2023
5 of 7 checks passed
@m1kola m1kola deleted the remove_variable_sources branch November 27, 2023 16:02
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.

Breaking change: remove variable sources and make Deppy accept a slice of variables instead
5 participants