Fix two issues by including the ruby platform variants in the lock file#9556
Fix two issues by including the ruby platform variants in the lock file#9556rwstauner wants to merge 3 commits into
Conversation
ace8709 to
ae929fb
Compare
5d97916 to
c2fdb38
Compare
c2fdb38 to
ef4429d
Compare
This fixes two issues: If a lockfile has a platform variant only bundler will install the ruby variant but then fail at setup time because it only looks for the platform version. The solution to that is to keep ruby platform variants in the lockfile even if ruby is not (or cannot) be added to the PLATFORMS. Now you will get an error if you need the ruby variant but it isn't in the lockfile, and you can actually resolve the issue by putting the ruby variant in the lockfile!
a9c3f37 to
56841bb
Compare
|
@hsbt What do you think about this? |
|
@rwstauner Thanks! I'd like to confirm my understanding of what this PR intends. First, the goal is that when a locked platform-specific variant becomes unusable, for example precompiled gems like grpc that declare an upper bound on required_ruby_version, bundler can fall back to the ruby variant because it is now locked as a fallback. Is that right? If so, this matches the direction I want Bundler to take. Users should be able to use a gem even when precompiled binaries restrict them, so I'd like to support this work. Second, instead of adding "ruby" to PLATFORMS, which requires every gem in the bundle to support the ruby platform, the ruby variant is kept per gem for any gem that has one and whose dependencies resolve, so gems like sorbet-static no longer block this. Correct? Third, since this changes lockfile contents on the next re-resolution and would flip-flop when older bundler versions re-lock the same file, I'm thinking this should ship in 4.1 rather than a 4.0.x patch release. Any concerns with that? |
|
Yes, indeed, thank you. This keeps the ruby platform variant in the lockfile as a fallback without needing This makes it easier to use a different ruby version and/or platform without needing to disable frozen/deployment mode. I have a setup where I dynamically set A similar situation happens for all of our gems when attempting to upgrade ruby. Some precompiled gems may support 3.4 but not 4.0. As long as the ruby variant is present this is not an issue. Even more so for testing against development ruby versions. I currently need to unset DEPLOYMENT mode for that just so that it can discard the precompiled versions and switch to all the ruby variants, but that shouldn't be necessary if the lockfile retains all that information. I don't believe changing bundler versions would introduce any conflicts in the lockfile, it's just saving additional information. All that said I don't have a strong opinion on what version of ruby this should be released with. If I can use it, even by pointing at a development version of bundler, I will. |
|
I suppose we could also consider putting the behavior behind a config flag so that we can opt into it, and we change it to the default behavior in 4.1 |
|
Maybe I should clarify: Are we talking about ruby 4.1 or bundler 4.1? Is the intention to keep those aligned? |
What was the end-user or developer problem that led to this PR?
2 issues:
What is your fix for the problem, implemented in this PR?
Keep the ruby variants and their dependencies in the lockfile when they would be useful as a fallback regardless of whether the ruby platform is included.
Make sure the following tasks are checked