Throw exception when last candidate is removed and mandatory requirement#1094
Throw exception when last candidate is removed and mandatory requirement#1094laeubi wants to merge 7 commits into
Conversation
Currently it can happen that the resolver is removing a candidate but it is the last possible one to select. If the requirement is not optional this lead guaranteed to an unresolvable state and must be handled already on the call site. This adds throwing a runtime exception for this case to make sure such illegal modifications do not goes unnoticed and we can fix such places.
Test Results 807 files ±0 807 suites ±0 1h 19m 4s ⏱️ + 4m 29s For more details on these errors, see this check. Results for commit 9c36d0c. ± Comparison against base commit 4c55069. ♻️ This comment has been updated with latest results. |
|
Great (or not so great of course) we now have two test-cases failing here showing the problem:
that's really nasty as it blows up the search space by evicting valid solutions and instead running in circles to find alternatives! |
|
I'm now able to reproduce the problem with the reduction provided here and only three bundles (even though the error message seems wrong, or it shows that we are removing wrong things). |
|
I was now able to even further reduce the testcase and it is now quite minimal. |
|
I think I now understand what is happening here, we start for the testcase with this rather simple setup Because of the uses constraint we can reduce this is because Now the resolver begins and come to the conclusion that So I think this assumption taken here is only ever valid in special cases where the provider of the package was not previously ruled out, I also don't see why we should remove any higher ranked providers ... so this part must be changed to ignore/remove only the one provider regardless of where it is coming in the list! |
|
While working on this I came to the conclusion that there is another case where the Bundle
So while we have selected |
|
This now has lead me back to My rough idea here would be as follows:
This then has the advantage that many things become unique and we can even rule out other alternatives. My plan would be to make this extracted into an own class, so we can have an emergency switch in case something goes really wrong after the release as is is a quite fundamental change. |
|
In this example we see the following:
As the situation is known to be unsolvable we can actually maybe drop all permutations that have more failed resources than others currently in the list to cut down the work for the resolver. We just need to keep one in case there is no solution at all. |
|
Some improvements has already been merged and the testcase is added as part of: |
Currently it can happen that the resolver is removing a candidate but it is the last possible one to select. If the requirement is not optional this lead guaranteed to an unresolvable state and must be handled already on the call site.
This adds throwing a runtime exception for this case to make sure such illegal modifications do not goes unnoticed and we can fix such places.
Only a draft as it would be currently too dangerous to be merged but hopefully will fail some tests to further analyze the problem.