-
Notifications
You must be signed in to change notification settings - Fork 309
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
model: Serialize dependency graph edges in some explicit order #8696
Conversation
f54967c
to
23d9873
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8696 +/- ##
============================================
- Coverage 67.88% 67.86% -0.02%
Complexity 1165 1165
============================================
Files 244 244
Lines 7732 7734 +2
Branches 865 865
============================================
Hits 5249 5249
- Misses 2124 2126 +2
Partials 359 359
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
23d9873
to
6422045
Compare
@@ -102,7 +102,7 @@ data class DependencyGraph( | |||
* A list with the edges of this dependency graph. By traversing the edges, the dependencies of packages can be | |||
* determined. | |||
*/ | |||
val edges: List<DependencyGraphEdge>? = null | |||
val edges: Set<DependencyGraphEdge>? = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment in line 102 should now also say "set" instead of "list". Also, the commit message should probably also mention that order is not important either (even if a set usually maintains insertion order).
@@ -179,7 +179,7 @@ class DependencyGraphBuilder<D>( | |||
) | |||
} | |||
|
|||
private fun Collection<DependencyGraphEdge>.removeCycles(): List<DependencyGraphEdge> { | |||
private fun Set<DependencyGraphEdge>.removeCycles(): Set<DependencyGraphEdge> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the spirit of "be lenient when consuming, be strict when producing", should the receiver stay a Collection
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe in general it makes sense, in this case I decided against it so that one does not have to even think about what happens when input contains duplicates, because the API is private (small scope), and because there is no use besides the Sets one.
6422045
to
8787c8a
Compare
It is not necessary to allow for having multiple edges between any pair of nodes. So, always operate with sets to reflect that. Note that order of edges is not important either (even if a set usually maintains insertion order). Signed-off-by: Frank Viernau <[email protected]>
Improve human readability and make the serialized ordering independent from the insertion order. Signed-off-by: Frank Viernau <[email protected]>
Use the `RewriteTestAssetsCommand` to re-align the test assets with the new ordered serialization of `edges`. Signed-off-by: Frank Viernau <[email protected]>
8787c8a
to
e872dcf
Compare
Make serialized order independent of insertion order in order to remove the need to update the tests when changing insertion order in upcoming changes.
Part of #6235.