Drop Grape::Middleware::Globals#2714
Merged
Merged
Conversation
c205733 to
268e2c4
Compare
Danger ReportNo issues found. |
dblock
reviewed
May 14, 2026
268e2c4 to
98de963
Compare
Grape::Middleware::Globals and its three env keys (Grape::Env::GRAPE_REQUEST, GRAPE_REQUEST_HEADERS, GRAPE_REQUEST_PARAMS) have been dead code for years. The middleware was introduced in 2013 (commit 9987090, bundled awkwardly into an oauth2 change) and was never mounted by Grape's own stack — Endpoint builds its Grape::Request directly. Nothing in lib/ reads grape.request* either; the env keys had no internal consumers. Outside lib/ the only reference was the file's own spec. README and UPGRADING never mentioned the class. Removing the class, the spec, and the three constants. The original implementation is preserved in git history at https://github.com/ruby-grape/grape/blob/6b4111b3/lib/grape/middleware/globals.rb. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
98de963 to
0ee6584
Compare
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.
Summary
Grape::Middleware::Globalsand the three env constants it sets (Grape::Env::GRAPE_REQUEST,Grape::Env::GRAPE_REQUEST_HEADERS,Grape::Env::GRAPE_REQUEST_PARAMS) have been dead code for years. Removing the class, its spec, and the constants.Why
lib/. Nouse Grape::Middleware::Globalsanywhere in production code.Grape::Endpoint#build_stackdoes not include it.lib/readsenv['grape.request'],env['grape.request.headers'], orenv['grape.request.params'].Grape::Endpointbuilds itsGrape::Requestdirectly (endpoint.rb:151), bypassing the middleware entirely.9987090b("Add required option for oauth2 middleware") — bundled into an unrelated oauth2 change.Breaking change
Anyone who mounted
Grape::Middleware::Globalsin their own custom Rack stack (to populateenv['grape.request']for downstream middleware) will lose it. UPGRADING includes a self-contained replacement snippet they can drop into their app.The original implementation is preserved in git history at
6b4111b3:lib/grape/middleware/globals.rb.Test plan
bundle exec rspec— 2288 examples, 0 failures (5 fewer than before; those were the deletedglobals_spec.rb)🤖 Generated with Claude Code