Skip to content

Support Rails 8.1 (ENG-1567) - #3

Merged
lvangool merged 2 commits into
masterfrom
hotfix/eng-1567-rails-8-1
Nov 11, 2026
Merged

lvangool merged 2 commits into
masterfrom
hotfix/eng-1567-rails-8-1

Conversation

@lvangool

Copy link
Copy Markdown
Member

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_accessor is gone on 8.1. RocketPants::Base declared an unused protected_instance_variables setting with it, so the gem raised NoMethodError at load. Nothing reads the setting, so the block is removed.
  • scope with a positional hash is deprecated in 8.1 and removed in 8.2. The api / rocket_pants routes helper used that form. Central raises on deprecations and uses api version: 3, so it would have failed at route load. The options are now passed as keywords.

Other changes

  • JSONP is removed (breaking). It relied on after_filter, which Rails removed in 5.1, so it has not worked for years. Calling jsonp now raises NotImplementedError when the controller class loads, naming the controller, so it cannot be enabled by mistake.
  • RocketPants::Client unwraps the HTTParty response object, which is no longer a Hash.
  • Version is now 1.13.3.

What must not change, and does not

The JSON envelope, the error format, the process_action.rocket_pants and start_processing.rocket_pants event 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, and bin/test runs the default rake task against all three on Ruby 3.3.13.
  • Every Rails deprecation raises in the specs, as it does in central.
  • A new 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 the rocket_pants:errors rake 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 rake task, and noted in the README.

After merge

Bump rocket_pants in central's Gemfile to version 1.13.3 and the merge commit, while central is still on Rails 7.2.

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.
@linear

linear Bot commented Nov 11, 2026

Copy link
Copy Markdown

ENG-1567

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.
@lvangool
lvangool merged commit 7e84560 into master Nov 11, 2026
3 checks passed
@lvangool
lvangool deleted the hotfix/eng-1567-rails-8-1 branch November 11, 2026 13:05
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.

1 participant