sarugaku / resolvelib

Resolve abstract dependencies into concrete ones
ISC License
138 stars 31 forks source link

Backjumping failures #154

Closed notatallshaw closed 1 month ago

notatallshaw commented 2 months ago

Here are two tests (I may add more) that fail because of backjumping.

None of these tests are fixed by https://github.com/sarugaku/resolvelib/pull/152 because that is only able to recover the situation if each requirement has remaining unchecked candidates, but backjumping can backtrack to the root requirement, incorrectly, and if, for example, that requirement has only one candidate then there can be an erroneous ResolutionImpossible.

I believe the issue is that backjumping sets up an implicit contract, caused by this, between itself and the provider. That the provider should always prefer direct conflicts over any other candidate. However, resolvelib does not enforce or document this, and the provider can prefer any unsatisfied name, and therefore the algorithm is currently unsound, for example pip does not prefer directly conflicting packages, at least not yet.

@uranusjr @frostming @bennati IMO either backjumping should be reverted, or it should be made opt-in for providers who "know what they are doing".

notatallshaw commented 1 month ago

I have put these test cases into: https://github.com/sarugaku/resolvelib/pull/155