From 018a33b4567c38510ec7f793fb30b564cc9e5882 Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 00:05:36 +0100 Subject: [PATCH 01/12] Pin json below 3.1 on Ruby 3.0 activesupport 7.1, the newest release installable on Ruby 3.0, passes `quirks_mode:` to `JSON.generate`, which json 3.1 removed. Any `Hash#to_json` then raises `ArgumentError: unknown keyword: quirks_mode`. Newer activesupport releases are not affected, so the pin only applies to Ruby 3.0 and the library's own json requirements stay open. --- Gemfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index c3a69c5..f796c35 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,10 @@ gemspec group :development, :test do gem 'bundler' + # activesupport 7.1 (the newest on Ruby 3.0) passes `quirks_mode:` to JSON.generate, which json 3.1 removed + gem 'json', '< 3.1' if RUBY_VERSION < '3.1' gem 'maruku' + gem 'ostruct' # no longer a default gem in Ruby 4.0 gem 'pry' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx') gem 'pry-byebug' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx') gem 'rack-test' From c1d5206f6d9ff2a54817318a223e2572ab798b1e Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 00:05:36 +0100 Subject: [PATCH 02/12] Add Ruby 4.0 to the CI matrix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 994925a..ec1258b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: needs: ['rubocop'] strategy: matrix: - ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4'] + ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', '4.0'] steps: - name: Check out branch uses: actions/checkout@v7 From 8b9d95169696928bcc93e85311e22d29dbb89fd5 Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 00:05:50 +0100 Subject: [PATCH 03/12] Add CHANGELOG entries --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d997acc..ab3507f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,12 @@ #### Fixes +* [#411](https://github.com/ruby-grape/grape-entity/pull/411): Pin `json` below 3.1 on Ruby 3.0 in the test bundle to avoid the `quirks_mode` incompatibility with activesupport 7.1 - [@numbata](https://github.com/numbata). * Your contribution here. #### Features +* [#411](https://github.com/ruby-grape/grape-entity/pull/411): Add Ruby 4.0 to the CI matrix - [@numbata](https://github.com/numbata). * Your contribution here. From 08641f6c0938e4ebc9ac4fceb80a2eb2c98c04a2 Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 00:07:21 +0100 Subject: [PATCH 04/12] Fix Style/DirectiveScope offenses from newer RuboCop CI resolves the latest RuboCop, which now flags disable/enable pairs around a single statement and fails the rubocop job before rspec runs. Use rubocop:disable-next instead. --- lib/grape_entity/entity.rb | 3 +-- .../exposure/nesting_exposure/nested_exposures.rb | 3 +-- spec/grape_entity/entity_spec.rb | 6 ++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/grape_entity/entity.rb b/lib/grape_entity/entity.rb index 4b409c1..93c87c0 100644 --- a/lib/grape_entity/entity.rb +++ b/lib/grape_entity/entity.rb @@ -190,7 +190,7 @@ def self.inherited(subclass) # field, typically the value is a hash with two fields, type and desc. # @option options :merge This option allows you to merge an exposed field to the root # - # rubocop:disable Layout/LineLength + # rubocop:disable-next Layout/LineLength def self.expose(*args, &block) options = merge_options(args.last.is_a?(Hash) ? args.pop : {}) @@ -217,7 +217,6 @@ def self.expose(*args, &block) @nesting_stack ||= [] args.each { |attribute| build_exposure_for_attribute(attribute, @nesting_stack, options, block) } end - # rubocop:enable Layout/LineLength def self.build_exposure_for_attribute(attribute, nesting_stack, options, block) exposure_list = nesting_stack.empty? ? root_exposures : nesting_stack.last.nested_exposures diff --git a/lib/grape_entity/exposure/nesting_exposure/nested_exposures.rb b/lib/grape_entity/exposure/nesting_exposure/nested_exposures.rb index 80076ed..7275237 100644 --- a/lib/grape_entity/exposure/nesting_exposure/nested_exposures.rb +++ b/lib/grape_entity/exposure/nesting_exposure/nested_exposures.rb @@ -36,7 +36,7 @@ def clear @exposures.clear end - # rubocop:disable Style/DocumentDynamicEvalDefinition + # rubocop:disable-next Style/DocumentDynamicEvalDefinition %i[ each to_ary to_a @@ -56,7 +56,6 @@ def #{name}(*args, &block) end RUBY end - # rubocop:enable Style/DocumentDynamicEvalDefinition # Determine if we have any nesting exposures with the same name. def deep_complex_nesting?(entity) diff --git a/spec/grape_entity/entity_spec.rb b/spec/grape_entity/entity_spec.rb index aa49785..446b30e 100644 --- a/spec/grape_entity/entity_spec.rb +++ b/spec/grape_entity/entity_spec.rb @@ -33,13 +33,12 @@ end it 'makes sure that :format_with as a proc cannot be used with a block' do - # rubocop:disable Style/BlockDelimiters + # rubocop:disable-next Style/BlockDelimiters expect { subject.expose :name, format_with: proc {} do p 'hi' end }.to raise_error ArgumentError - # rubocop:enable Style/BlockDelimiters end it 'makes sure unknown options are not silently ignored' do @@ -2294,12 +2293,11 @@ class FriendEntity < Grape::Entity end end - # rubocop:disable Lint/EmptyBlock + # rubocop:disable-next Lint/EmptyBlock fresh_class.class_eval do expose :first_friend, using: EntitySpec::FriendEntity do |_user, _opts| end end - # rubocop:enable Lint/EmptyBlock rep = subject.value_for(:first_friend) expect(rep).to be_kind_of EntitySpec::FriendEntity From 8363bae887673999a57faa2366a7cd8855bed28e Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 00:09:56 +0100 Subject: [PATCH 05/12] Pin json below 3.0, not 3.1, on Ruby 3.0 json 3.0 already removed the `quirks_mode:` keyword, so json 3.0.2 still fails with activesupport 7.1 on Ruby 3.0. Only json 2.x works. --- CHANGELOG.md | 2 +- Gemfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab3507f..3b0812f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ #### Fixes -* [#411](https://github.com/ruby-grape/grape-entity/pull/411): Pin `json` below 3.1 on Ruby 3.0 in the test bundle to avoid the `quirks_mode` incompatibility with activesupport 7.1 - [@numbata](https://github.com/numbata). +* [#411](https://github.com/ruby-grape/grape-entity/pull/411): Pin `json` below 3.0 on Ruby 3.0 in the test bundle to avoid the `quirks_mode` incompatibility with activesupport 7.1 - [@numbata](https://github.com/numbata). * Your contribution here. #### Features diff --git a/Gemfile b/Gemfile index f796c35..e765730 100644 --- a/Gemfile +++ b/Gemfile @@ -6,8 +6,8 @@ gemspec group :development, :test do gem 'bundler' - # activesupport 7.1 (the newest on Ruby 3.0) passes `quirks_mode:` to JSON.generate, which json 3.1 removed - gem 'json', '< 3.1' if RUBY_VERSION < '3.1' + # activesupport 7.1 (the newest on Ruby 3.0) passes `quirks_mode:` to JSON.generate, which json 3.0 removed + gem 'json', '< 3.0' if RUBY_VERSION < '3.1' gem 'maruku' gem 'ostruct' # no longer a default gem in Ruby 4.0 gem 'pry' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx') From c4027a2413b2816dacbb6c4b77c88d59a0353ad5 Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 00:25:05 +0100 Subject: [PATCH 06/12] Pin git below 6 so Danger can load danger 9.6 references Git::Base, which git 6.0 no longer loads eagerly, so the Danger job fails with an uninitialized constant before running. --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index e765730..90ededf 100644 --- a/Gemfile +++ b/Gemfile @@ -24,6 +24,7 @@ group :test do gem 'danger', require: false gem 'danger-changelog', require: false gem 'danger-pr-comment', require: false + gem 'git', '< 6' # danger 9.6 references Git::Base, which git 6 no longer loads eagerly gem 'growl' gem 'guard' gem 'guard-bundler' From a879e680c666069082da398aa4d1919016fac704 Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 00:27:38 +0100 Subject: [PATCH 07/12] Bump danger-pr-comment workflows from 0.1.0 to 0.1.1 Absorbs the Dependabot updates for both Danger workflows (#409, #410). --- .github/workflows/danger-comment.yml | 2 +- .github/workflows/danger.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/danger-comment.yml b/.github/workflows/danger-comment.yml index 8e15cb6..02a589d 100644 --- a/.github/workflows/danger-comment.yml +++ b/.github/workflows/danger-comment.yml @@ -7,5 +7,5 @@ on: jobs: comment: - uses: numbata/danger-pr-comment/.github/workflows/danger-comment.yml@v0.1.0 + uses: numbata/danger-pr-comment/.github/workflows/danger-comment.yml@v0.1.1 secrets: inherit diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index bd89a88..c510cda 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -6,7 +6,7 @@ on: jobs: danger: - uses: numbata/danger-pr-comment/.github/workflows/danger-run.yml@v0.1.0 + uses: numbata/danger-pr-comment/.github/workflows/danger-run.yml@v0.1.1 secrets: inherit with: ruby-version: '3.4' From 0bb0579ff1567b8a45f3097ec776cf890fedf297 Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 00:27:38 +0100 Subject: [PATCH 08/12] Label the unreleased CHANGELOG section so Danger recognizes it danger-changelog only treats a section as unreleased when its heading contains "(Next)" or "[Unreleased]"; "Next release" matched neither, so every new entry was reported as outside the unreleased section. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b0812f..5702c4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### Next release +### 1.1.1 (Next) #### Fixes From bd42276947b7ca10bcceb1dad8b3d9bbc7788bf2 Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 00:29:36 +0100 Subject: [PATCH 09/12] Keep a single CHANGELOG line for this PR --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5702c4e..8442405 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,11 @@ #### Fixes -* [#411](https://github.com/ruby-grape/grape-entity/pull/411): Pin `json` below 3.0 on Ruby 3.0 in the test bundle to avoid the `quirks_mode` incompatibility with activesupport 7.1 - [@numbata](https://github.com/numbata). +* [#411](https://github.com/ruby-grape/grape-entity/pull/411): Fix CI on Ruby 3.0 (pin `json` below 3.0, `git` below 6, newer RuboCop directives), add Ruby 4.0 to the test matrix - [@numbata](https://github.com/numbata). * Your contribution here. #### Features -* [#411](https://github.com/ruby-grape/grape-entity/pull/411): Add Ruby 4.0 to the CI matrix - [@numbata](https://github.com/numbata). * Your contribution here. From cc3df517a9d25bab51a3fcf392ffb442c971b2b6 Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 00:52:09 +0100 Subject: [PATCH 10/12] Address review: require RuboCop 1.90, update release docs The disable-next directives need RuboCop 1.90, so the Gemfile now says so. The release docs still described the old "Next Release" heading that Danger does not recognize; they now use the "(Next)" form. Also makes the Ruby version check a Gem::Version comparison and notes when the git pin can go. --- CONTRIBUTING.md | 2 +- Gemfile | 6 +++--- RELEASING.md | 11 ++++++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6023a84..77750c1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,7 +52,7 @@ Document any external behavior in the [README](README.md). #### Update Changelog -Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Make it look like every other line, including your name and link to your Github account. +Add a line to [CHANGELOG](CHANGELOG.md) under the unreleased `(Next)` section. Make it look like every other line, including your name and link to your Github account. #### Commit Changes diff --git a/Gemfile b/Gemfile index 90ededf..5572767 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gemspec group :development, :test do gem 'bundler' # activesupport 7.1 (the newest on Ruby 3.0) passes `quirks_mode:` to JSON.generate, which json 3.0 removed - gem 'json', '< 3.0' if RUBY_VERSION < '3.1' + gem 'json', '< 3.0' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1') gem 'maruku' gem 'ostruct' # no longer a default gem in Ruby 4.0 gem 'pry' unless RUBY_PLATFORM.eql?('java') || RUBY_ENGINE.eql?('rbx') @@ -15,7 +15,7 @@ group :development, :test do gem 'rack-test' gem 'rake' gem 'rspec', '~> 3.9' - gem 'rubocop', '~> 1.0' + gem 'rubocop', '~> 1.90' # the disable-next directive needs 1.90 gem 'yard' end @@ -24,7 +24,7 @@ group :test do gem 'danger', require: false gem 'danger-changelog', require: false gem 'danger-pr-comment', require: false - gem 'git', '< 6' # danger 9.6 references Git::Base, which git 6 no longer loads eagerly + gem 'git', '< 6' # danger 9.6 references Git::Base, which git 6 no longer loads eagerly; drop once danger supports git 6 gem 'growl' gem 'guard' gem 'guard-bundler' diff --git a/RELEASING.md b/RELEASING.md index 85d736d..3a0f3fa 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -19,7 +19,7 @@ Increment the version, modify [lib/grape-entity/version.rb](lib/grape-entity/ver * Increment the third number if the release has bug fixes and/or very minor features, only (eg. change `0.5.1` to `0.5.2`). * Increment the second number if the release contains major features or breaking API changes (eg. change `0.5.1` to `0.4.0`). -Change "Next Release" in [CHANGELOG.md](CHANGELOG.md) to the new version. +Change the "(Next)" heading in [CHANGELOG.md](CHANGELOG.md) to the new version and release date. ``` 0.4.0 (2014-01-27) @@ -52,8 +52,13 @@ Pushed grape-entity 0.4.0 to rubygems.org. Add the next release to [CHANGELOG.md](CHANGELOG.md). ``` -Next Release -============ +### X.Y.Z (Next) + +#### Fixes + +* Your contribution here. + +#### Features * Your contribution here. ``` From 1ea8d3f9797e98d13cff843cf3b2869b8ab6802b Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 00:54:11 +0100 Subject: [PATCH 11/12] Wrap the git pin comment to satisfy Layout/LineLength --- Gemfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 5572767..79caf54 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,8 @@ group :test do gem 'danger', require: false gem 'danger-changelog', require: false gem 'danger-pr-comment', require: false - gem 'git', '< 6' # danger 9.6 references Git::Base, which git 6 no longer loads eagerly; drop once danger supports git 6 + # danger 9.6 references Git::Base, which git 6 no longer loads eagerly; drop once danger supports git 6 + gem 'git', '< 6' gem 'growl' gem 'guard' gem 'guard-bundler' From 8fd5763f93a78681d1a349d340c50a8de675109d Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Thu, 29 Oct 2026 01:23:41 +0100 Subject: [PATCH 12/12] Pin CI runners to ubuntu-24.04 ubuntu-latest migrates to Ubuntu 26.04, but there are no prebuilt Ruby 3.0 or 3.1 packages for that image, so those matrix jobs and the rubocop job (Ruby 3.0) would fail at setup. Pin 24.04 until older Rubies are dropped or built for 26.04. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec1258b..7b2d8a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ permissions: jobs: rubocop: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 # no ubuntu-26.04 builds of Ruby 3.0/3.1 yet; revisit when ubuntu-latest moves steps: - uses: actions/checkout@v7 - uses: ruby/setup-ruby@v1 @@ -24,7 +24,7 @@ jobs: run: bundle exec rubocop --parallel --format progress rspec: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 # no ubuntu-26.04 builds of Ruby 3.0/3.1 yet; revisit when ubuntu-latest moves needs: ['rubocop'] strategy: matrix: