Skip to content

Fix two issues by including the ruby platform variants in the lock file#9556

Open
rwstauner wants to merge 2 commits into
ruby:masterfrom
Shopify:rwstauner/ruby-platform-lock
Open

Fix two issues by including the ruby platform variants in the lock file#9556
rwstauner wants to merge 2 commits into
ruby:masterfrom
Shopify:rwstauner/ruby-platform-lock

Conversation

@rwstauner
Copy link
Copy Markdown
Contributor

What was the end-user or developer problem that led to this PR?

2 issues:

  • When the lock file only contains platform specific variants but install is being done by a version of ruby that doesn't work with the platform version bundler will install the ruby variant... but then at setup time it errors because it looks for the platform variant and it isn't there. bundler doesn't need to install an alternative that doesn't satisfy it's own requirements. The first commit adds a test that verifies this behavior (the second commit updates the test to fail earlier but with a suggestion people can use to resolve the issue).
  • It's been a long standing issue that you can't easily retain the ruby platform variant of some gems (by adding "ruby" to the list of platforms) if not all gems support it. This separates those two concepts by locking the ruby platform variant without requiring all gems to support the "ruby" platform. By updating your lockfile this way you can resolve the previous issue (and also stop having to edit the lock file by hand).

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

@rwstauner rwstauner force-pushed the rwstauner/ruby-platform-lock branch 2 times, most recently from ace8709 to ae929fb Compare May 21, 2026 03:34
@rwstauner rwstauner marked this pull request as ready for review May 21, 2026 14:54
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!
@rwstauner rwstauner force-pushed the rwstauner/ruby-platform-lock branch from ae929fb to 5d97916 Compare May 23, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant