-
Notifications
You must be signed in to change notification settings - Fork 121
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
Surprising resolution behavior when fixing versions (bug?) #379
Comments
If you'd like to debug it, here is a potential dependency example: com.google.cloud:
google-cloud-pubsub: # library D, see below
lang: java
version: "1.123.0"
google-cloud-storage: # library A
lang: java
version: "2.14.0"
com.github.fs2-blobstore: # library C
gcs:
lang: scala
version: "0.9.12" Here C would pull in The role of library B is played by
Library D was required to have another version from B; this ensures that the resolution comment is not |
If changing the resolution logic is not an option, which I would totally understand, I'd ask for fixing at least the resolution comment by adding the missing line - maybe with some addition that it was evicted. This would automatically fix the "downgraded" part as well, resulting in something like:
|
I'm not sure this is not because the following in // invariant: all of node's parents must be unambiguous
def fixVersion(node: Node): Table = { doesn't seem to be satisfied. When we call this method for |
If we look here: def disambiguateHelper(node: Node, visited: Set[Node]): Table =
table(node)
.map(_._1.map(_.unversioned))
.find(isAmbiguous) match {
case None => fixVersion(node) // note that parents are not ambiguous
case Some(None) => sys.error("unreachable, roots are never ambiguous")
case Some(Some(p)) => {
if (!visited.contains(p)) {
disambiguateHelper(p, visited + p)
} else {
// We found a cycle in the maven dependency graph. Maven is OK with this (why!?),
// but bazel won't be. However, this might be a cycle in the transitive dependency
// graph that won't be present in the BUILD files, so we'll allow it for now.
fixVersion(node)
}
}
} We see that we explicitly violate the "invariant" in the case that I wonder if we can see if this is the case in your example. e.g. we could print out if we are in that branch and what the set looks like in your case. Definitely, it seems like weird behavior. I would be in favor of fixing bugs. I think the key issue is: A rule I definitely think should be true: if you explicitly declare in the dependencies.yaml file all the transitively resolved dependencies and re-run, you should get the same result set. This is a form of normalization being idempotent or something. |
After digging through the code of As far as I see, and as it's shown on the above screenshots, the table entries are getting fixed for node |
I created #381 that adds the logic to filter out already evicted versions, so they won't contribute new versions of their children potentially. I'm curious what do you think about it. |
Just for reference, I checked what
|
I ran into a situation recently that pretty much surprised and given the circumstances I might call it a bug. The following happened.
Library A was pulling in library B. Unfortunately, I did not realize, that besides having a fixed version of A in my dependencies.yaml, it gets pulled in through another library C. But, of course, that version of A is different, and also it pulls in a different version of B obviously. Also, importantly, the A and B pulled in by C are having higher versions than what I fixed for A, and the version resolution strategy was set to "highest". Let's assume the following:
Now I get a resolution comment for B like:
There are 2 obvious problems with the resolution comment:
The reason for the second is, that the normalized graph doesn't contain A:2.0 as it was fixed to A:1.0, hence that edge falls out in a filter when the duplicates are being collected. The first is somewhat a side effect of this: the string "downgraded" is coming from an else branch of a condition which is not prepared for the case when the highest, chosen version is not present in the duplicate list.
I think this behavior is pretty much problematic as we chose the version of B based on a version of A that never gets effective. In my opinion, the fact that A's version was fixed to 1.0, should have had an effect on setting B's version, which should result in 1.0 in the above example.
(I checked out the repo ~3 days ago and used that version for investigations.)
The text was updated successfully, but these errors were encountered: