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

[MRESOLVER-345] Conflict resolution in verbose mode is sensitive to version ordering #271

Merged
merged 14 commits into from
Mar 24, 2023

Conversation

cstamas
Copy link
Member

@cstamas cstamas commented Mar 22, 2023

Our two collector implementations produce slightly different dirty trees when in transitive dependencies ranges are in use. The new BF produces (w/ and w/o skipper) produces this dirty tree:

menforcer426:aid:ext:1 compile
+- menforcer426:bid:ext:1 compile
|  +- menforcer426:cid:ext:3 compile
|  +- menforcer426:cid:ext:2 compile
|  \- menforcer426:cid:ext:1 compile
+- menforcer426:cid:ext:3 compile
+- menforcer426:cid:ext:2 compile
\- menforcer426:cid:ext:1 compile

The "old" DF produces this one:

menforcer426:aid:ext:1 compile
+- menforcer426:bid:ext:1 compile
|  +- menforcer426:cid:ext:1 compile
|  +- menforcer426:cid:ext:2 compile
|  \- menforcer426:cid:ext:3 compile
+- menforcer426:cid:ext:1 compile
+- menforcer426:cid:ext:2 compile
\- menforcer426:cid:ext:3 compile

Spot the difference: the two dirty trees are "semantically" (or content-wise?) equal/same, except for the artifact ordering, where there was a version range (collector in this case discovers available versions that "fits" range and created nodes for them, one for each version that lies within version constraint). DF collector relies and provides "metadata based" ordering (as metadata contained the versions), while BF explicitly sorts them in descending order (for internal optimization purposes). Point is, both dirty trees are ok.

But, Conflict resolver in verbose mode for two inputs above produces different outputs. For DF with "divergence found", while for BF "no divergence found" (correctly).

Overall changes in this PR:

  • most are test and test related resources
  • cosmetic changes like javadoc typos, adding override etc
  • added reusable DependencyGraphDumper
  • key changes are in ConflictResolver covered by ConflictResolverTest UT changes
  • overall fix is to make ConflictResolver insensitive to input dirty tree version ordering, make sure output is same for "semantically" (or content-wise?) same inputs.

How tested this:

Just realized how enforcer ITs are good source of inspiration for resolver use cases, so many if not all of new tests are actually inspired by enforcer ITs.


https://issues.apache.org/jira/browse/MRESOLVER-345

The two collector behave differently when in transitive
dependencies ranges are in use.

---

https://issues.apache.org/jira/browse/MRESOLVER-345
@cstamas cstamas self-assigned this Mar 22, 2023
@cstamas cstamas changed the title [MRESOLVER-345] BD and DF collect differences with ranges [MRESOLVER-345] Conflict resolution in verbose mode is sensitive to version ordering Mar 22, 2023
*/
public class ConsoleDependencyGraphDumper implements DependencyVisitor {
public class DependencyGraphDumper implements DependencyVisitor {
Copy link
Member

Choose a reason for hiding this comment

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

👍 - we have similar implementation in many places

@cstamas cstamas merged commit 267d288 into apache:master Mar 24, 2023
@cstamas cstamas deleted the MRESOLVER-345-collect-w-ranges branch March 24, 2023 12:52
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