Repository navigation
Support Rails 8.1 (ENG-1567) - #3
Merged
Merged
Conversation
Rails 8.1 blockers: - Remove the unused protected_instance_variables setting from RocketPants::Base. It was declared with config_accessor, which controllers no longer have on Rails 8.1, so the gem failed to load. - Pass the options of the api/rocket_pants routes helper to scope as keywords. The positional hash form is deprecated in 8.1 and removed in 8.2, and apps that raise on deprecations failed at route load. Other changes: - JSONP is removed. It relied on after_filter, gone since Rails 5.1, so calling jsonp now raises NotImplementedError at class load with a message naming the controller. - RocketPants::Client unwraps the HTTParty response object, which is no longer a Hash. Tests: - Per-Rails gemfiles for 7.2, 8.0 and 8.1 under gemfiles/, run by bin/test. Ruby pinned to 3.3.13. - Every Rails deprecation raises in the specs. - New smoke suite that boots a real Rails application through the Railtie and asserts exact response bodies, instrumentation payloads and middleware order. - Repair the existing specs: rr 3 with its DSL included, an eager Active Record connection, and stale constants. - Drop the dead Travis configuration. Version 1.13.3.
Library: - The api/rocket_pants routes helper symbolises its option keys, so string-keyed options are no longer dropped by the keyword splat. - RocketPants::Client turns a malformed JSON body into the usual RocketPants::Error instead of leaking JSON::ParserError. - The JSONP error no longer tells the caller the feature "is unused". - The gemspec requires Ruby 3.3+ and Rails 7.2+, which is what the fork is tested on. Tests: - The smoke app eager loads, as central does, with its controllers under smoke/app. They now load at boot, after deprecations are set to raise. - New smoke cases: an exact body with HTML entities, a line separator and non-ASCII text, and the params controller key that central's metrics subscriber reads. - Client specs can no longer pass when nothing is raised, and cover HTML, malformed, empty and non-object bodies. - bin/test refuses to run on a Ruby other than .ruby-version. - GitHub Actions workflow running the three Rails gemfiles.
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.
Part of ENG-1567. Central cannot boot on Rails 8.1 until this gem loads there. The same ref must keep working on Rails 7.2, because central takes it before the Rails upgrade.
Rails 8.1 blockers fixed
config_accessoris gone on 8.1.RocketPants::Basedeclared an unusedprotected_instance_variablessetting with it, so the gem raisedNoMethodErrorat load. Nothing reads the setting, so the block is removed.scopewith a positional hash is deprecated in 8.1 and removed in 8.2. Theapi/rocket_pantsroutes helper used that form. Central raises on deprecations and usesapi version: 3, so it would have failed at route load. The options are now passed as keywords.Other changes
after_filter, which Rails removed in 5.1, so it has not worked for years. Callingjsonpnow raisesNotImplementedErrorwhen the controller class loads, naming the controller, so it cannot be enabled by mistake.RocketPants::Clientunwraps the HTTParty response object, which is no longer aHash.What must not change, and does not
The JSON envelope, the error format, the
process_action.rocket_pantsandstart_processing.rocket_pantsevent names, and the internals central calls directly (error_mapping,lookup_error_*,render_json,exception_notifier_callback).Tests
Before this change the suite had 89 failures out of 166 on every Rails version, so it proved nothing. Now:
gemfiles/has one gemfile each for Rails 7.2, 8.0 and 8.1, andbin/testruns the defaultraketask against all three on Ruby 3.3.13.smoke/suite boots a real Rails application through the Railtie, in its own process. It asserts exact response bodies, instrumentation payloads, the cache middleware position and its 304 path, HTTP basic auth, URL helpers and therocket_pants:errorsrake task. It fails on 8.1 if either blocker fix is reverted.Result on each of Rails 7.2.4, 8.0.5.2 and 8.1.4.1: 165 main examples, 30 smoke examples and 18 integration examples, 0 failures.
The kaminari and RSpec-matcher integration specs still fail, as they did before. They are unused by central, left out of the default
raketask, and noted in the README.After merge
Bump
rocket_pantsin central'sGemfileto version 1.13.3 and the merge commit, while central is still on Rails 7.2.