-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Instability with preferences and forks: Lockfile changes on the second run #5180
Comments
A detailed write-up on the problem can be found in astral-sh/packse#203. My plan to solve this is to:
|
Background reading: astral-sh/packse#203 The root problem is that preferences can influence which fork points we get and thereby which forks we have in the eventual merge resolution. In the worst case we could have a bistable system that flip-flops for every The solution is to lock store the forks in the lockfile and to start the resolution with the locked forks. For simplicity and to make it easier to understand for users why there are multiple versions per package in their lockfile, for each package with multiple versions, we write write the forks a version belongs to next to the fork. When we resolve, in each fork, we will find exactly one matching preference, the one that is the result in the fork in the previous resolution. This way, we get a stable resolution. We need to both start the resolution with the locked forks, because we may not see the same fork points again with preferences that skip over them (diverging or not), and have per-fork preferences to ensure that in each fork, we're doing the same resolution as before |
With our previous eager union, we were losing the fork markers. We now carry this information into the resolution graph construction and, in the next step, can read the markers there. Part of #5180 (comment)
Add tests for the instabilities fix Part of #5180 (comment)
Add tests for the instabilities fix Part of #5180 (comment)
Add tests for the instabilities fix Part of #5180 (comment)
Add tests for the instabilities fix Part of #5180 (comment)
Add tests for the instabilities fix Part of #5180 (comment)
Add tests for the instabilities fix Part of #5180 (comment)
Add the forks to the lockfile, without using them yet, which we'll add in the next PR. Please review commit-by-commit Part of #5180 (comment)
Add tests for the instabilities fix Part of #5180 (comment)
Add tests for the instabilities fix Part of #5180 (comment)
Add tests for the instabilities fix Part of #5180 (comment)
) By resolving for each fork from the lockfile individually and by adding using preferences for the current fork, we solve the instability #5180. I've tested the locally and will add the packse test scenarios upstack. Part of #5180 (comment)
Add tests for the instabilities fix Part of #5180 (comment)
The lockfile can change on the second
uv lock
, collapsing previously forking dependencies into a single one. I believe this due to how preferences are handled.Minimal example:
We have 3 different forkings until it converges:
I think we need #4926 (to not create duplicate dependencies in the first run) and we need to marker- or fork-tag preferences if that heuristic fails.
The text was updated successfully, but these errors were encountered: