Skip to content

Support Ruby 3.3, 3.4, 4.0 and Rails 8.1, and fix rake api_spec on Rails 7.0+ - #20

Draft
snhrm wants to merge 4 commits into
masterfrom
chore/support-ruby-4-0-rails-8-1
Draft

snhrm wants to merge 4 commits into
masterfrom
chore/support-ruby-4-0-rails-8-1

Conversation

@snhrm

@snhrm snhrm commented Oct 30, 2026

Copy link
Copy Markdown

Why

  • アプリを Ruby 3.4 / 4.0、Rails 8.1 に上げられるようにするため。現在の 0.6.1 は actionpack / railties < 7.2 になっている
  • rake api_spec が Rails 7.0 以降、NoMethodError: undefined method 'type' for an instance of ActionDispatch::Journey::Ast で失敗する

What

  • RoutesFinder が route.path.ast ではなく route.path.spec を使うように直す
    • Rails 7.0 以降の Pattern#ast は Journey::Ast というラッパーを返し、eager_load! の後は nil になる
    • Pattern#spec は Rails 5.0〜8.1 のどの版でも、生のノードツリーを返す
  • Rails が実際に描いた RouteSet を使う spec を追加する。既存の spec は Rails を全部 mock しているので、この不具合を検出できなかった
  • actionpack / railties の上限を < 8.2 にし、open_api >= 0.6.3 を必須にする
  • 開発依存の bundler ~> 2.0 を削除し、CI を Ruby 3.3 / 3.4 / 4.0 と Rails 7.0〜8.1 にし、Code Climate を削除する。どれも Support Ruby 3.3, 3.4, 4.0 and Rails 8.1 open_api#18 と同じ内容
  • 0.6.2 に上げ、CHANGELOG を追記する

確認したこと

  • spec が全件通る (13 examples, 0 failures)
    • 対象は、Ruby 3.3 / 3.4 / 4.0 × Rails 7.0〜8.1
    • open_api はローカルの 0.6.3 を使った
  • 追加した spec は、.ast / .ast.root に戻す変異や、パラメータを落とす変異で落ちる
  • ダミーの Rails アプリで rake api_spec を実行した
    • 対象は、Rails 7.0〜8.1 × Ruby 3.3 / 3.4 / 4.0、eager_load の有無の両方
    • 生成された YAML は、Rails 6.1 で修正前のコードが出したものと一致した

merge の順番

  1. Support Ruby 3.3, 3.4, 4.0 and Rails 8.1 open_api#18 を merge して、0.6.3 をリリースする
  2. この PR の CI を再実行する。0.6.3 が公開されるまでは、open_api >= 0.6.3 を解決できずに全セルが失敗する
  3. merge して bundle exec rake release を実行する

snhrm added 4 commits October 29, 2026 23:22
Since Rails 7.0, Journey::Path::Pattern#ast returns a Journey::Ast wrapper
(and is cleared on eager_load!), so PathResolver failed on ast.type.
Pattern#spec returns the raw node tree on every Rails version.
- Relax actionpack / railties upper bound to < 8.2
- Require open_api >= 0.6.3, the first version allowing activesupport 7.2+
- Drop bundler ~> 2.0 dev dependency, which conflicts with Bundler 4 bundled with Ruby 4.0
- Test Ruby 3.3, 3.4, 4.0 and Rails 7.0 to 8.1 on CI
- Remove Code Climate coverage upload, whose API was shut down
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