fix(mpesa): insert Rack::Attack without the unsupported include? guard - #2
Merged
Conversation
The rack_attack initializer guarded middleware insertion with app.middleware.include?(Rack::Attack), but Rails::Configuration::MiddlewareStackProxy does not implement include? on Rails 8.1. Booting in production therefore raised NoMethodError and broke asset precompilation in the deploy image. The guard also protected against a double insertion the host never performs. Insert Rack::Attack unconditionally, matching the standard Spree engine idiom. Bump the gemspec version to 1.0.1.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
Pull request overview
Fixes a Rails 8.1 boot failure caused by calling include? on Rails::Configuration::MiddlewareStackProxy when inserting Rack::Attack, which broke production boot and asset precompilation.
Changes:
- Insert
Rack::Attackmiddleware without using the unsupportedinclude?guard. - Bump gem version to
1.0.1.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
spree_mpesa.gemspec |
Bumps the gem version to ship the Rails 8.1 boot fix. |
lib/spree_mpesa/engine.rb |
Adjusts Rack::Attack middleware insertion to avoid include? on the middleware proxy. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
willymwai
approved these changes
Jun 30, 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.
The rack_attack initializer guarded middleware insertion with app.middleware.include?(Rack::Attack), but Rails::Configuration::MiddlewareStackProxy does not implement include? on Rails 8.1. Booting in production therefore raised NoMethodError and broke asset precompilation in the deploy image. The guard also protected against a double insertion the host never performs.
Insert Rack::Attack unconditionally, matching the standard Spree engine idiom. Bump the gemspec version to 1.0.1.