Prevent Shadowenv from mutating BUNDLE_GEMFILE #2874
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
I finally understood the issue we were seeing of some folks requiring completely incompatible versions of add-ons.
If they used Shadowenv to override BUNDLE_GEMFILE, then it would cause the LSP to skip composing the bundle, which then leads to finding add-ons with
Gem.find_files
without having setup the bundle first.That results in finding all
addon.rb
files defined by every installed gem, which might be ordered alphabetically and then results in requiring an old and incompatible Rails add-on version.Implementation
We cannot let Shadowenv override
BUNDLE_GEMFILE
because that fully messes up our entire composed bundle setup. I started deleting that key from the activated environment.