Repository navigation
fix(rails): don't load ActionController::Live before initialization - #3109
Merged
sl0thentr0py merged 1 commit intoOct 28, 2026
Merged
Conversation
sl0thentr0py
approved these changes
Oct 28, 2026
Referencing ActionController::Live in the railtie loads ActionDispatch::Response before the application has initialized, which Rails 8.1 warns about when eager loading is off. Use the :action_controller_live load hook that Rails 8.1.4 added, and keep the direct reference on older versions.
sl0thentr0py
force-pushed
the
fix-rails-live-load-hook
branch
from
October 28, 2026 13:48
2e45071 to
1e7e1b1
Compare
Member
|
thx @ajaynomics ! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3109 +/- ##
==========================================
+ Coverage 90.13% 90.19% +0.05%
==========================================
Files 132 155 +23
Lines 5301 6455 +1154
==========================================
+ Hits 4778 5822 +1044
- Misses 523 633 +110
🚀 New features to boost your workflow:
|
3 tasks done
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.
Description
Under Rails 8.1 with
eager_loadoff (rake tasks, console, most dev boots), sentry-rails makes Rails print:The railtie referenced
ActionController::Liveinside the:action_controllerload hook to prependStreamingReporter. That reference autoloadsActionController::Live, which loadsActionDispatch::Responsetoo early, and Rails warns.Rails 8.1.4 added an
:action_controller_liveload hook. This PR prepends the reporter from that hook, so nothing touchesActionController::Liveuntil the app does. On older Rails the direct reference stays.Tested with a new isolated spec,
sentry-rails/spec/isolated/streaming_reporter_spec.rb. It asserts the reporter is still prepended, and boots a bare app in a child process to assert initialization leavesActionController::Liveunloaded. The second example fails on master and passes here.spec/isolatedandspec/sentrypass on theruby-3.4_rails-8.1.3cell; RuboCop is clean on both files.