Repository navigation
Avoid loading unused ActiveSupport::Configurable during reflection - #2748
Open
thomasklemm wants to merge 2 commits into
Open
thomasklemm wants to merge 2 commits into
thomasklemm wants to merge 2 commits into
Conversation
Leave the deprecated Rails 8.1 API pending instead of triggering its load-time deprecation while eager loading or compiling gem symbols. Keep explicit usage warnings and already-loaded APIs intact.
thomasklemm
force-pushed
the
fix/skip-unused-active-support-configurable
branch
from
October 20, 2026 12:59
b308489 to
272facd
Compare
This branch has not been deployed
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.
Motivation
On Rails 8.1, generating gem RBIs can emit
ActiveSupport::Configurable is deprecated without replacement, and will be removed in Rails 8.2even when the application never uses that API. With deprecations configured to raise, generation fails instead.Rails deliberately removed Configurable from its eager autoloads in rails/rails#55943: its plain autoload must remain available, but loading the file emits the deprecation. Tapioca's autoload tracker currently forces it anyway. This reproduces on current main and 0.20.0; it is a different mechanism from the deprecated constant proxies addressed in #2701.
Minimal reproduction with Tapioca and Active Support 8.1.4 in the bundle:
Implementation
Leave the Rails 8.1+ Configurable autoload pending when reflecting on its fully qualified name or descendants. Do not remove the constant, silence deprecations, or skip already-loaded Configurable APIs. Rails 8.0 keeps its existing behavior.
The guard lives immediately before
const_getinRuntime::Reflection.constantize, rather than only in the autoload tracker. I tested a tracker-only skip first: eager loading then succeeded, but realtapioca gem activesupportstill failed inGem::Pipeline#on_symbol. The gem compiler separately resolves statically discovered symbols and subconstants through the same reflection helper, so protecting the common lookup avoids another forced load later in generation.No configuration or new public API is added. Other autoloads still load normally. Explicit application usage still emits the Rails deprecation and generates Configurable RBIs; namespaced lookups for unrelated constants remain unaffected.
Tests
ActiveSupport::DeprecationExceptionbefore the fix and passes after it.bin/test spec/tapioca/runtime spec/tapioca/cli/gem_spec.rb): 79 tests, 571 assertions, no failures/errors, one pre-existing skip.bin/test spec/tapioca/runtime/*_spec.rb: 31 tests, 71 assertions, no failures/errors/skips. Runtime specs were run explicitly because the Rails runner's directory expansion only matches_test.rb, not_spec.rb.bin/test spec/tapioca/dsl/compilers/active_support_concern_spec.rb: 12 tests, 42 assertions, no failures/errors/skips.bin/style lib/tapioca/runtime/reflection.rb spec/tapioca/cli/gem_spec.rb: no offenses.bin/typecheck: no errors. Ruby syntax checks andgit diff --checkalso pass.bundle exec tapioca gems --all --no-doc --no-loc --workers 1succeeds with deprecations set to raise, generates 73 RBI files, and leaves Configurable pending while loading BacktraceCleaner.Local verification used Ruby 4.0.7 and the repository lockfile (Rails 8.1.4); the full hosted Ruby/Rails matrix is left to CI. A maintainer will need to add the
bugfixrelease label.