diff --git a/CHANGELOG.md b/CHANGELOG.md index c1f3a60e..cca11b16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## [Unreleased] +## [1.20.1] - 2026-02-10 + +### Fixed + +- Ensure configuration is built correctly inside the `after_initialize` hooks (#208). + ## [1.20.0] - 2026-01-20 ### Added diff --git a/lib/rage/configuration.rb b/lib/rage/configuration.rb index 92c6fa9c..f275fe64 100644 --- a/lib/rage/configuration.rb +++ b/lib/rage/configuration.rb @@ -227,6 +227,7 @@ def internal # @private def run_after_initialize! run_hooks_for!(:after_initialize, self) + __finalize end class LogContext diff --git a/lib/rage/version.rb b/lib/rage/version.rb index 7ee629cb..12dda0a6 100644 --- a/lib/rage/version.rb +++ b/lib/rage/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Rage - VERSION = "1.20.0" + VERSION = "1.20.1" end diff --git a/spec/integration/test_app/app/telemetry/test_controller_observer.rb b/spec/integration/test_app/app/telemetry/test_controller_observer.rb new file mode 100644 index 00000000..8698d0ca --- /dev/null +++ b/spec/integration/test_app/app/telemetry/test_controller_observer.rb @@ -0,0 +1,9 @@ +class TestControllerObserver < Rage::Telemetry::Handler + handle "controller.action.process", with: :monitor_controllers + + def self.monitor_controllers(name:) + Rage.logger.tagged(name) do + yield + end + end +end diff --git a/spec/integration/test_app/app/telemetry/test_exception_recorder.rb b/spec/integration/test_app/app/telemetry/test_exception_recorder.rb new file mode 100644 index 00000000..8c36d03a --- /dev/null +++ b/spec/integration/test_app/app/telemetry/test_exception_recorder.rb @@ -0,0 +1,8 @@ +class TestExceptionRecorder < Rage::Telemetry::Handler + handle "controller.action.process", with: :record_exceptions + + def self.record_exceptions + result = yield + Rage.logger.error("telemetry recorded exception #{result.exception.message}") if result.error? + end +end diff --git a/spec/integration/test_app/config/application.rb b/spec/integration/test_app/config/application.rb index e9f23208..f9f95a02 100644 --- a/spec/integration/test_app/config/application.rb +++ b/spec/integration/test_app/config/application.rb @@ -18,25 +18,6 @@ def call(env) end end -class TestControllerObserver < Rage::Telemetry::Handler - handle "controller.action.process", with: :monitor_controllers - - def self.monitor_controllers(name:) - Rage.logger.tagged(name) do - yield - end - end -end - -class TestExceptionRecorder < Rage::Telemetry::Handler - handle "controller.action.process", with: :record_exceptions - - def self.record_exceptions - result = yield - Rage.logger.error("telemetry recorded exception #{result.exception.message}") if result.error? - end -end - Rage.configure do config.middleware.use TestMiddleware config.public_file_server.enabled = !!ENV["ENABLE_FILE_SERVER"] @@ -66,8 +47,10 @@ def self.record_exceptions end if ENV["ENABLE_TELEMETRY"] - config.telemetry.use TestControllerObserver - config.telemetry.use TestExceptionRecorder + config.after_initialize do + config.telemetry.use TestControllerObserver + config.telemetry.use TestExceptionRecorder + end end config.after_initialize do