Skip to content

Pin json below 3.0 for the test suite - #766

Merged
andrehjr merged 1 commit into
splitrb:mainfrom
snaka:fix/pin-json-below-3
Sep 27, 2026
Merged

andrehjr merged 1 commit into
splitrb:mainfrom
snaka:fix/pin-json-below-3

Conversation

@snaka

@snaka snaka commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

json 3.0.0 (released 2026-09-07) removed the quirks_mode option, but ActiveSupport 7.2.3.x still passes it to JSON.generate. Once ActiveSupport's JSON extensions are loaded, Hash#to_json raises:

ArgumentError:
  unknown keyword: quirks_mode
# .../json-3.0.2/lib/json/common.rb:382:in `generate'
# .../activesupport-7.2.3.2/lib/active_support/json/encoding.rb:110:in `stringify'

main has not changed since its last green run (2026-08-09, fa42fc0). That run predates json 3.0. Because Gemfile.lock is not committed, a new run on the same commit now resolves json 3.0.2.

Which jobs are affected

  • Ruby >= 3.2 with Rails 7.x: affected. ActiveSupport 7.2.4 no longer passes quirks_mode, but it caps connection_pool < 3. On Ruby >= 3.2, Bundler resolves connection_pool 3.x together with ActiveSupport 7.2.3.2 instead.
  • Ruby 3.1 with Rails 7.x: not affected. It resolves ActiveSupport 7.2.4.
  • Rails 8.x: not affected. ActiveSupport 8.1 does not pass quirks_mode.

The failure depends on spec order. ActiveSupport is only loaded when spec/persistence/cookie_adapter_spec.rb runs require "rails", so specs that serialize JSON fail only when that file runs earlier under the random order. Running cookie_adapter_spec.rb then experiment_storage_spec.rb with --order defined reproduces it consistently on Ruby 3.2 and 3.3 with Rails 7.x.

Change

This PR adds gem "json", "< 3" to the development Gemfile only. The gemspec is unchanged, so gem users are not affected.

Verification

  • Full CI matrix, all 18 jobs pass. It runs on my fork because the workflow only triggers on push: https://github.com/snaka/split/actions/runs/36289493495
  • Locally on unmodified main, Ruby 3.3 + RAILS_VERSION=7.1 fails with the error above. With this change, it passes (522 examples, 0 failures).

Note (not addressed here)

gem "rails", "~> #{ENV.fetch('RAILS_VERSION', '8.0')}" expands to ~> 7.1, which allows 7.2, so the "Rails 7.1" jobs actually resolve Rails 7.2.

🤖 Generated with Claude Code

json 3.0.0 removed the quirks_mode option, but ActiveSupport 7.2.3.x
still passes it to JSON.generate. Once ActiveSupport's JSON extensions
are loaded, Hash#to_json raises "ArgumentError: unknown keyword:
quirks_mode".

In the test suite ActiveSupport is only loaded when
spec/persistence/cookie_adapter_spec.rb requires "rails", so specs that
serialize JSON fail only when that file runs earlier in the random
order.

ActiveSupport 7.2.4 no longer passes quirks_mode, but it caps
connection_pool below 3. On Ruby >= 3.2, Bundler resolves
connection_pool 3.x with ActiveSupport 7.2.3.2 instead, so the affected
jobs are Ruby >= 3.2 with Rails 7.x. Ruby 3.1 resolves ActiveSupport
7.2.4, and Rails 8.x does not pass quirks_mode either.

This only affects the development Gemfile, not the gemspec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@snaka
snaka force-pushed the fix/pin-json-below-3 branch from c79a0cd to 1e107ea Compare September 27, 2026 02:46
andrehjr pushed a commit that referenced this pull request Sep 27, 2026
Gemfile.lock is not committed, so a new dependency release can break
the build while main stays unchanged. The json 3.0 release did exactly
that: it broke the Rails 7.x jobs on main (see #766), but no push to
main has happened since, so CI never showed it. Add a weekly scheduled
run so such breakage shows up without waiting for the next push.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andrehjr
andrehjr merged commit e0938db into splitrb:main Sep 27, 2026
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.

2 participants