themill / wiz

Environment management framework
GNU Lesser General Public License v3.0
45 stars 4 forks source link

Encapsulate relinking errors #53

Closed buddly27 closed 3 years ago

buddly27 commented 3 years ago

Following Issue #46, we introduced a fix that revealed an undesired behavior: Variant conflicts highlighted when relinking nodes could potentially raise an error before attempting to resolve version conflicts.

Considering the following example:

    Root
     |
     |--(A[V3]): A[V3]==1.0.0
     |   |
     |   `--(B >=3, <4): B==3.0.0
     |
     `--(C): C
         |
         `--(A[V2]): A[V2]==1.0.0
             |
             `--(B >=1, <2): B==1.0.0

It will rightfully fail as A[V3] and A[V2] are conflicting. However, if we change the graph to introduce a version conflict:

    Root
     |
     |--(A[V3]): A[V3]==1.0.0
     |   |
     |   `--(B >=3, <4): B==3.0.0
     |
     |--(C >=1): C==2.0.0
     |   |
     |   `--(A[V2]): A[V2]==1.0.0
     |       |
     |       `--(B >=1, <2): B==1.0.0
     |
     `--(E): E
         |
         `--(C >=1, <2): C==1.5.0

C==2.0.0 and C==1.5.0 are conflicting and C==1.5.0 will be kept in the graph as it is the highest version compatible with both requirements. Therefore A[V2] is removed from the. graph and the variant conflicts should be ignored. But it won't.

To solve this issue, we should encapsulate relinking errorw in the graph, the same way we encapsulate errors when packages cannot be extracted from some node's requirements (https://github.com/themill/wiz/blob/master/source/wiz/graph.py#L2021)