Skip to content

fix(mpesa): insert Rack::Attack without the unsupported include? guard - #2

Merged
willymwai merged 1 commit into
mainfrom
fix/rack-attack-issue
Jun 30, 2026
Merged

fix(mpesa): insert Rack::Attack without the unsupported include? guard#2
willymwai merged 1 commit into
mainfrom
fix/rack-attack-issue

Conversation

@Elias-3817

Copy link
Copy Markdown
Contributor

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.

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.
Copilot AI review requested due to automatic review settings June 30, 2026 11:09
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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::Attack middleware without using the unsupported include? 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.

Comment thread lib/spree_mpesa/engine.rb
@willymwai
willymwai merged commit f5b3ad7 into main Jun 30, 2026
2 checks passed
@willymwai
willymwai deleted the fix/rack-attack-issue branch June 30, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants