Scope CA plugin stubs by Ruby ABI - #192
Merged
girachawda merged 1 commit intoSep 1, 2026
Merged
Conversation
girachawda
force-pushed
the
gc/ca-plugin-abi-stubs
branch
from
September 1, 2026 14:30
a559828 to
8381383
Compare
There was a problem hiding this comment.
Pull request overview
This pull request updates RubyGems’ plugin stub install and load behavior so content-addressed (CA/skinny) gems write plugin stubs under an ABI-scoped plugin directory (e.g., plugins/3.4/), while preserving the existing root plugins/ stubs as a fat/non-CA fallback. Gem.load_plugins is updated to load both locations and to prefer ABI-scoped stubs when duplicates exist.
Changes:
- Install CA gem plugin stubs under
plugins/<ruby_abi>/and generaterequire_relativepaths relative to that ABI directory. - Update
Gem.load_pluginsto scan bothplugins/andplugins/<current_ruby_abi>/, preferring ABI-scoped stubs when the same stub filename exists in both. - Add test coverage for ABI-preference plugin loading and ABI-scoped stub generation/removal for CA gems.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/rubygems/test_gem.rb | Adds a regression test ensuring ABI-scoped plugin stubs shadow same-named root stubs and unrelated ABIs are ignored. |
| test/rubygems/test_gem_installer.rb | Adds installer tests ensuring CA plugin stubs are written/removed under plugins/<ruby_abi>/ and still allow a root fallback stub to coexist. |
| lib/rubygems/installer_uninstaller_utils.rb | Routes CA plugin stub generation/removal to an ABI-scoped plugin directory and fixes require_relative computation accordingly. |
| lib/rubygems.rb | Updates plugin discovery/loading to include ABI-scoped stubs and prefer ABI-specific stubs over root when both exist. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
jenshenny
reviewed
Sep 1, 2026
jenshenny
left a comment
There was a problem hiding this comment.
Great work!! Just a few minor details I wanted to raise
girachawda
force-pushed
the
gc/ca-plugin-abi-stubs
branch
from
September 1, 2026 18:56
8381383 to
60b4d97
Compare
girachawda
force-pushed
the
gc/ca-plugin-abi-stubs
branch
from
September 1, 2026 19:24
60b4d97 to
f1cae41
Compare
jenshenny
reviewed
Sep 1, 2026
girachawda
force-pushed
the
gc/ca-plugin-abi-stubs
branch
from
September 1, 2026 20:04
f1cae41 to
deeff6a
Compare
Assisted-By: devx/7307f7b7-fac2-4c30-9651-f8ce7643f65c
girachawda
force-pushed
the
gc/ca-plugin-abi-stubs
branch
from
September 1, 2026 20:27
deeff6a to
51ba7c2
Compare
jenshenny
approved these changes
Sep 1, 2026
girachawda
merged commit Sep 1, 2026
1821756
into
feature-branch-ca-changes-rubygems
106 checks passed
This was referenced Sep 2, 2026
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.
What
This updates RubyGems plugin stub handling for content-addressed (CA/skinny) gems so ABI-specific plugin stubs are installed under an ABI-scoped plugin directory.
A regular non-CA gem continues to write its generated plugin stub to:
A CA gem for Ruby ABI
3.4now writes its generated plugin stub to:Gem.load_pluginsnow checks both the root plugin directory and the current Ruby ABI plugin directory:When RubyGems regenerates a plugin stub, it also removes stale same-gem stubs from the other plugin location. That means installing a CA gem removes an older root stub for that gem, and installing a non-CA gem removes older ABI-scoped stubs for that gem.
Why
CA/skinny gems can be Ruby ABI-specific, but plugin loading currently is not.
RubyGems loads plugin stubs by scanning
plugins/*.rb. If a CA gem for Ruby 3.4 installsplugins/foo_plugin.rb, then any older Ruby sharing thatGEM_HOMEcan load and execute that ABI-specific plugin code, even if the gem should not apply to that Ruby.Installing CA plugin stubs under
plugins/<ruby_abi>/keeps them invisible to older RubyGems, while new RubyGems can explicitly load only the current Ruby ABI’s plugin stubs.The cleanup is needed so plugin loading follows the gem RubyGems selected when regenerating plugins, instead of leaving an older root or ABI-scoped stub behind for the same gem name.
Tophat
Script
Output