Skip to content

Pin json gem to ~> 2.3 - #2865

Merged
mroderick merged 1 commit into
masterfrom
chore/pin-json-gem
Sep 10, 2026
Merged

Pin json gem to ~> 2.3#2865
mroderick merged 1 commit into
masterfrom
chore/pin-json-gem

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

Pin json gem to ~> 2.3

Why

Dependabot group PR #2864 is red across all six test groups. The PR body lists four gems (haml, image_processing, bullet, webmock), but the lockfile diff contains a fifth, unadvertised change: json 2.21.2 → 3.0.2, a major release pulled in transitively by rubocop's json >= 2.3 constraint.

json 3.0 (released 2026-09-07) made JSON.parse keyword-only and now raises on options it doesn't recognise instead of ignoring them. Rails 8.1's ActiveSupport::JSON.decode calls ::JSON.parse(json, options) with a positional hash. Ruby 4.0 cannot promote an empty positional hash to keywords, so json 3.0.2 raises:

ArgumentError: wrong number of arguments (given 2, expected 1)
  json-3.0.2/lib/json/common.rb:296 in 'JSON.parse'
  activesupport-8.1.3.1 .../messages/metadata.rb:129 deserialize_from_json
  actionpack-8.1.3.1 .../cookie_store.rb ... get_cookie

Every request that reads the encrypted session cookie crashes, which is why the failure signature (session.key? in ApplicationController#current_user) appears in nearly every feature and controller spec.

The fix

Pin json ~> 2.3 in the Gemfile. The lockfile resolves back to json 2.21.2 and Dependabot will stop bumping it in the ruby-deps group.

Verification

Once Rails supports json 3.x, drop the pin.

json 3.0 (pulled in transitively by rubocop's json >= 2.3) made
JSON.parse keyword-only. ActiveSupport::JSON.decode passes an options
hash positionally, so every session-cookie decryption raises
ArgumentError and all specs that touch a session fail.

Pinned until Rails supports json 3.x. Also stops Dependabot re-bumping
json in the ruby-deps group (ref #2864).
@mroderick
mroderick marked this pull request as ready for review September 10, 2026 06:29
@mroderick
mroderick merged commit 56397f6 into master Sep 10, 2026
10 checks passed
@mroderick
mroderick deleted the chore/pin-json-gem branch September 10, 2026 06:48
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