Conversation
…y 3.4 and Rails 8.1.0.beta1
There was a problem hiding this comment.
Pull request overview
This PR updates the project to support newer Ruby/Rails versions (Ruby 4.0, Rails 8.1) while making RBS Inline / RuboCop / Steep tooling conditional on Ruby version to preserve compatibility across the CI matrix.
Changes:
- Expanded CI to include Ruby 4.0 and Rails 8.1 combinations.
- Updated Ruby version requirements (
.ruby-version, gemspec minimum Ruby) and adjusted dev tooling to enable RBS Inline/Steep only on Ruby 3.3+. - Added
.rubocop_rbs.ymland updated Rake/RuboCop invocation to select the appropriate config per Ruby version.
Reviewed changes
Copilot reviewed 18 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| structured_params.gemspec | Raises minimum supported Ruby and adds rbs_inline header. |
| .ruby-version | Sets default development Ruby to 4.0.0. |
| .github/workflows/main.yml | Expands Ruby/Rails CI matrix; exports env vars for steps. |
| Gemfile | Conditionally includes rbs-inline / rubocop-rbs_inline / steep for Ruby 3.3+. |
| Rakefile | Selects RuboCop config by Ruby version and conditionally enables Steep tasks. |
| .rubocop.yml | Removes rubocop-rbs_inline plugin from the default config. |
| .rubocop_rbs.yml | Adds a dedicated RuboCop config intended for Ruby 3.3+ with RBS Inline cops. |
| bin/rubocop | Adds wrapper to run RuboCop with the correct config by Ruby version. |
| bin/console | Adds rbs_inline header. |
| Steepfile | Adds rbs_inline header. |
| lib/structured_params/params.rb | Refines inline RBS annotations for structured validation helpers. |
| lib/structured_params/type/object.rb | Minor formatting tweak near RBS comment/delegate. |
| spec/spec_helper.rb | Adds rbs_inline header. |
| spec/params_spec.rb | Adds rbs_inline header. |
| spec/errors_spec.rb | Adds rbs_inline header. |
| spec/type/array_spec.rb | Adds rbs_inline header and a method signature for the dummy class name. |
| spec/type/object_spec.rb | Adds rbs_inline header and a method signature for the dummy class name. |
| spec/factories/user_parameters.rb | Adds rbs_inline header. |
| spec/factories/hobby_parameters.rb | Adds rbs_inline header. |
| spec/factories/address_parameters.rb | Adds rbs_inline header. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| inherit_from: .rubocop.yml | ||
|
|
||
| plugins: | ||
| - rubocop-rbs_inline | ||
|
|
There was a problem hiding this comment.
In .rubocop_rbs.yml, defining plugins: will override the plugins: list inherited from .rubocop.yml unless you explicitly merge. That can cause inherited cop configuration (e.g., RSpec/*) to become “unrecognized cop” when running with this config. Include the full plugin list here (rspec/rake/factory_bot + rbs_inline) or add an inherit_mode merge for plugins so all required plugins remain enabled.
| if RUBY_VERSION >= '3.3.0' | ||
| gem 'rbs-inline', require: false | ||
| gem 'rubocop-rbs_inline', require: false | ||
| gem 'steep', require: false | ||
| end |
There was a problem hiding this comment.
RUBY_VERSION >= '3.3.0' compares strings lexicographically, which can give incorrect results for versions like 3.10.0. Use Gem::Version comparisons (or a helper constant) for reliable version gating.
| rubocop_config = if RUBY_VERSION >= '3.3.0' | ||
| '.rubocop_rbs.yml' | ||
| else | ||
| '.rubocop.yml' | ||
| end |
There was a problem hiding this comment.
The RUBY_VERSION >= '3.3.0' check here is a lexicographic string comparison and can misbehave for versions like 3.10.0. Prefer Gem::Version comparisons for this gate.
| - name: Set Rails version | ||
| run: | | ||
| echo "RAILS_VERSION=${{ matrix.rails }}" >> $GITHUB_ENV | ||
| echo "RUBY_VERSION=${{ matrix.ruby }}" >> $GITHUB_ENV |
There was a problem hiding this comment.
RUBY_VERSION is exported to $GITHUB_ENV here, but the workflow doesn’t reference it later (matrix values are used directly). Consider removing this line to avoid unused configuration, or use it in subsequent steps if it’s intended for tooling.
| echo "RUBY_VERSION=${{ matrix.ruby }}" >> $GITHUB_ENV |
| if RUBY_VERSION >= '3.3.0' | ||
| require 'steep/rake_task' | ||
| Steep::RakeTask.new | ||
| default_tasks << :steep | ||
| end |
There was a problem hiding this comment.
The Ruby-version gate for enabling Steep uses RUBY_VERSION >= '3.3.0' (string comparison). Use Gem::Version comparisons so the condition stays correct across all future Ruby version formats.
This pull request introduces support for Ruby 4.0 and Rails 8.1, improves compatibility for RBS Inline type-checking (Ruby 3.3+), and refines development tooling configuration. The changes ensure that the codebase can be built and tested across multiple Ruby and Rails versions, and that static type checking and linting adapt automatically to the Ruby version in use.
Ruby and Rails version support:
.github/workflows/main.yml, ensuring tests run on the latest versions..ruby-versionto 4.0.0 and increased the minimum required Ruby version instructured_params.gemspecto 3.2.0. [1] [2]RBS Inline and static analysis tooling:
Gemfileand.rubocop.ymlto conditionally enablerbs-inline,rubocop-rbs_inline, andsteeponly for Ruby 3.3+; added a separate.rubocop_rbs.ymlfor RBS Inline configuration. [1] [2] [3]Rakefileto select the appropriate RuboCop config and enable Steep tasks only when running on Ruby 3.3+.General maintenance and annotation:
# rbs_inline: enabledcomments to key files for clarity and maintainability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]lib/structured_params/params.rband related specs. [1] [2] [3] [4] [5] [6]