Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions saas/lib/fizzy/saas/engine.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require_relative "transaction_pinning"
require_relative "true_client_ip"
require_relative "signup"
require_relative "authorization"
require_relative "gvl_instrumentation"
Expand Down Expand Up @@ -61,6 +62,10 @@ class Engine < ::Rails::Engine
app.config.middleware.insert_after(ActiveRecord::Middleware::DatabaseSelector, TransactionPinning::Middleware)
end

initializer "fizzy_saas.true_client_ip" do |app|
app.config.middleware.insert_before ActionDispatch::RemoteIp, TrackTrueClientIp
end
Comment on lines +65 to +67

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new engine initializer inserts TrackTrueClientIp into the middleware stack, but the added test only exercises the middleware’s behavior in isolation. Since the main change in this PR is where/when the middleware is installed, consider adding a saas-mode test that asserts Rails.application.middleware includes TrackTrueClientIp before ActionDispatch::RemoteIp (and ideally doesn’t get inserted twice).

Copilot uses AI. Check for mistakes.

initializer "fizzy_saas.gvl_instrumentation" do |app|
app.config.middleware.insert_before(Rack::Runtime, GvlInstrumentation)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ def call(env)
@app.call(env)
end
end

Rails.application.config.middleware.insert_before ActionDispatch::RemoteIp, TrackTrueClientIp
File renamed without changes.