Backport 9614 to 4.0#9621
Open
hsbt wants to merge 3 commits into
Open
Conversation
An inert placeholder source that stands in for a plugin source whose handling plugin is not loaded, so that a lockfile referencing it can still be parsed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Third-party tools like bundler-audit read lockfiles through Bundler::LockfileParser without evaluating the Gemfile, and a PLUGIN SOURCE block whose plugin isn't installed locally aborted the whole parse with UnknownSourceError, taking even DEPENDENCIES down with it. Fall back to the inert UnloadedSource placeholder instead, which also lets bundle install converge away a plugin source that was removed from the Gemfile. #9614 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR backports the fix from #9620 onto the 4.0 branch to ensure Bundler::LockfileParser can parse lockfiles containing PLUGIN SOURCE entries even when the corresponding source plugin is not installed locally (addressing #9614).
Changes:
- Add
Bundler::Plugin::UnloadedSourceas an inert placeholder for plugin-handled sources when the plugin isn’t available. - Update
Bundler::Plugin.from_lockto fall back toUnloadedSourceinstead of raisingUnknownSourceErrorduring lockfile parsing. - Add specs to cover the new fallback behavior in both
Plugin.from_lockandLockfileParser.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Manifest.txt | Includes the newly added unloaded_source.rb file in the manifest. |
| bundler/lib/bundler/plugin.rb | Makes from_lock return UnloadedSource when a plugin source type isn’t installed. |
| bundler/lib/bundler/plugin/unloaded_source.rb | Adds placeholder source class with ==/hash including source type. |
| bundler/spec/bundler/plugin_spec.rb | Adds unit coverage for Plugin.from_lock fallback to UnloadedSource. |
| bundler/spec/bundler/lockfile_parser_spec.rb | Adds integration coverage ensuring parsing continues and specs/deps are readable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport of #9620 to the 4.0 branch, fixing #9614.
Make sure the following tasks are checked