tapioca icon indicating copy to clipboard operation
tapioca copied to clipboard

Rails 7.2.1 to 7.2.1.1 upgrade: Unable to resolve constant GeneratedRelationMethods

Open lavoiesl opened this issue 1 year ago • 2 comments

We are trying to update from Rails 7.2.1 to 7.2.1.1.

Sorbet is failing:

$ bundle exec typecheck --did-you-mean=false --no-error-sections
sorbet/rbi/gems/[email protected]:42784: Unable to resolve constant GeneratedRelationMethods https://srb.help/5002
       42784 |  include ::ActiveRecord::Base::GeneratedRelationMethods
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/[email protected]:42784: Unable to resolve constant GeneratedRelationMethods https://srb.help/5002
       42784 |  include ::ActiveRecord::Base::GeneratedRelationMethods
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/[email protected]:42792: Unable to resolve constant GeneratedRelationMethods https://srb.help/5002
       42792 |  include ::ActiveRecord::Base::GeneratedRelationMethods
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/[email protected]:42792: Unable to resolve constant GeneratedRelationMethods https://srb.help/5002
       42792 |  include ::ActiveRecord::Base::GeneratedRelationMethods
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/[email protected]:42800: Unable to resolve constant GeneratedRelationMethods https://srb.help/5002
       42800 |  include ::ActiveRecord::Base::GeneratedRelationMethods
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/[email protected]:42800: Unable to resolve constant GeneratedRelationMethods https://srb.help/5002
       42800 |  include ::ActiveRecord::Base::GeneratedRelationMethods
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/[email protected]:42808: Unable to resolve constant GeneratedRelationMethods https://srb.help/5002
       42808 |  include ::ActiveRecord::Base::GeneratedRelationMethods
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/[email protected]:42808: Unable to resolve constant GeneratedRelationMethods https://srb.help/5002
       42808 |  include ::ActiveRecord::Base::GeneratedRelationMethods
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Errors: 8

Indeed, it can't be found:

$ grep GeneratedRelationMethods sorbet/rbi/annotations/activerecord.rbi

Investigation

bundle update --conservative sorbet sorbet-runtime sorbet-static sorbet-static-and-runtime tapioca
rm -rf sorbet/rbi/annotations sorbet/rbi/gems sorbet/rbi/dsl
bundle exec tapioca annotations
bundle exec tapioca gems
bundle exec tapioca dsl

Environment

$ sw_vers
ProductName:		macOS
ProductVersion:		14.6.1
BuildVersion:		23G93

$ ruby -v
ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [arm64-darwin23]

$ bundle list | grep -E 'sorbet|tapioca|rails|active'
  * accio-rails (2.5.1)
  * activejob (7.2.1.1)
  * activemodel (7.2.1.1)
  * activerecord (7.2.1.1)
  * activestorage (7.2.1.1)
  * activesupport (7.2.1.1)
  * ejson-rails (1.0.0)
  * factory_bot_rails (6.4.3)
  * flipper-active_record (1.3.1)
  * opentelemetry-instrumentation-active_record (0.7.4)
  * opentelemetry-instrumentation-active_support (0.6.0)
  * pry-rails (0.3.11)
  * quilt_rails (3.6.0)
  * rails (7.2.1.1)
  * rails-dom-testing (2.2.0)
  * rails-html-sanitizer (1.6.0)
  * rails-reverse-proxy (0.13.0)
  * rubocop-sorbet (0.8.6)
  * sorbet (0.5.11604)
  * sorbet-runtime (0.5.11604)
  * sorbet-static (0.5.11604)
  * sorbet-static-and-runtime (0.5.11604)
  * tapioca (0.16.3)
Gemfile.lock diff
diff --git Gemfile Gemfile
index 5bcfa6ab4..170a240a1 100644
--- Gemfile
+++ Gemfile
@@ -2,7 +2,7 @@
 
 source "https://rubygems.org"
 
-gem "rails", "7.2.1"
+gem "rails", "7.2.1.1"
 gem "bundler"
 gem "faraday"
 gem "faraday-retry"
diff --git Gemfile.lock Gemfile.lock
index 89b7e1168..080f96b6d 100644
--- Gemfile.lock
+++ Gemfile.lock
@@ -187,29 +187,29 @@ GEM
 GEM
   remote: https://rubygems.org/
   specs:
-    actioncable (7.2.1)
-      actionpack (= 7.2.1)
-      activesupport (= 7.2.1)
+    actioncable (7.2.1.1)
+      actionpack (= 7.2.1.1)
+      activesupport (= 7.2.1.1)
       nio4r (~> 2.0)
       websocket-driver (>= 0.6.1)
       zeitwerk (~> 2.6)
-    actionmailbox (7.2.1)
-      actionpack (= 7.2.1)
-      activejob (= 7.2.1)
-      activerecord (= 7.2.1)
-      activestorage (= 7.2.1)
-      activesupport (= 7.2.1)
+    actionmailbox (7.2.1.1)
+      actionpack (= 7.2.1.1)
+      activejob (= 7.2.1.1)
+      activerecord (= 7.2.1.1)
+      activestorage (= 7.2.1.1)
+      activesupport (= 7.2.1.1)
       mail (>= 2.8.0)
-    actionmailer (7.2.1)
-      actionpack (= 7.2.1)
-      actionview (= 7.2.1)
-      activejob (= 7.2.1)
-      activesupport (= 7.2.1)
+    actionmailer (7.2.1.1)
+      actionpack (= 7.2.1.1)
+      actionview (= 7.2.1.1)
+      activejob (= 7.2.1.1)
+      activesupport (= 7.2.1.1)
       mail (>= 2.8.0)
       rails-dom-testing (~> 2.2)
-    actionpack (7.2.1)
-      actionview (= 7.2.1)
-      activesupport (= 7.2.1)
+    actionpack (7.2.1.1)
+      actionview (= 7.2.1.1)
+      activesupport (= 7.2.1.1)
       nokogiri (>= 1.8.5)
       racc
       rack (>= 2.2.4, < 3.2)
@@ -218,35 +218,35 @@ GEM
       rails-dom-testing (~> 2.2)
       rails-html-sanitizer (~> 1.6)
       useragent (~> 0.16)
-    actiontext (7.2.1)
-      actionpack (= 7.2.1)
-      activerecord (= 7.2.1)
-      activestorage (= 7.2.1)
-      activesupport (= 7.2.1)
+    actiontext (7.2.1.1)
+      actionpack (= 7.2.1.1)
+      activerecord (= 7.2.1.1)
+      activestorage (= 7.2.1.1)
+      activesupport (= 7.2.1.1)
       globalid (>= 0.6.0)
       nokogiri (>= 1.8.5)
-    actionview (7.2.1)
-      activesupport (= 7.2.1)
+    actionview (7.2.1.1)
+      activesupport (= 7.2.1.1)
       builder (~> 3.1)
       erubi (~> 1.11)
       rails-dom-testing (~> 2.2)
       rails-html-sanitizer (~> 1.6)
-    activejob (7.2.1)
-      activesupport (= 7.2.1)
+    activejob (7.2.1.1)
+      activesupport (= 7.2.1.1)
       globalid (>= 0.3.6)
-    activemodel (7.2.1)
-      activesupport (= 7.2.1)
-    activerecord (7.2.1)
-      activemodel (= 7.2.1)
-      activesupport (= 7.2.1)
+    activemodel (7.2.1.1)
+      activesupport (= 7.2.1.1)
+    activerecord (7.2.1.1)
+      activemodel (= 7.2.1.1)
+      activesupport (= 7.2.1.1)
       timeout (>= 0.4.0)
-    activestorage (7.2.1)
-      actionpack (= 7.2.1)
-      activejob (= 7.2.1)
-      activerecord (= 7.2.1)
-      activesupport (= 7.2.1)
+    activestorage (7.2.1.1)
+      actionpack (= 7.2.1.1)
+      activejob (= 7.2.1.1)
+      activerecord (= 7.2.1.1)
+      activesupport (= 7.2.1.1)
       marcel (~> 1.0)
-    activesupport (7.2.1)
+    activesupport (7.2.1.1)
       base64
       bigdecimal
       concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -673,20 +673,20 @@ GEM
     rackup (2.1.0)
       rack (>= 3)
       webrick (~> 1.8)
-    rails (7.2.1)
-      actioncable (= 7.2.1)
-      actionmailbox (= 7.2.1)
-      actionmailer (= 7.2.1)
-      actionpack (= 7.2.1)
-      actiontext (= 7.2.1)
-      actionview (= 7.2.1)
-      activejob (= 7.2.1)
-      activemodel (= 7.2.1)
-      activerecord (= 7.2.1)
-      activestorage (= 7.2.1)
-      activesupport (= 7.2.1)
+    rails (7.2.1.1)
+      actioncable (= 7.2.1.1)
+      actionmailbox (= 7.2.1.1)
+      actionmailer (= 7.2.1.1)
+      actionpack (= 7.2.1.1)
+      actiontext (= 7.2.1.1)
+      actionview (= 7.2.1.1)
+      activejob (= 7.2.1.1)
+      activemodel (= 7.2.1.1)
+      activerecord (= 7.2.1.1)
+      activestorage (= 7.2.1.1)
+      activesupport (= 7.2.1.1)
       bundler (>= 1.15.0)
-      railties (= 7.2.1)
+      railties (= 7.2.1.1)
     rails-dom-testing (2.2.0)
       activesupport (>= 5.0.0)
       minitest
@@ -697,9 +697,9 @@ GEM
     rails-reverse-proxy (0.13.0)
       actionpack
       addressable
-    railties (7.2.1)
-      actionpack (= 7.2.1)
-      activesupport (= 7.2.1)
+    railties (7.2.1.1)
+      actionpack (= 7.2.1.1)
+      activesupport (= 7.2.1.1)
       irb (~> 1.13)
       rackup (>= 1.0.0)
       rake (>= 12.2)
@@ -928,7 +928,7 @@ DEPENDENCIES
   puma (~> 6.4)
   quilt_rails (>= 3.4.0)
   rack-mini-profiler (~> 3.3)
-  rails (= 7.2.1)
+  rails (= 7.2.1.1)
   redis (>= 5.0.6)
   redis-session-store
   rubocop-shopify (~> 2.15.1)

The RBI files that were updated:

M       sorbet/rbi/annotations/actionpack.rbi
M       sorbet/rbi/annotations/activerecord.rbi
M       sorbet/rbi/annotations/activesupport.rbi
R096    sorbet/rbi/gems/[email protected]   sorbet/rbi/gems/[email protected]
R085    sorbet/rbi/gems/[email protected] sorbet/rbi/gems/[email protected]
R092    sorbet/rbi/gems/[email protected]  sorbet/rbi/gems/[email protected]
R098    sorbet/rbi/gems/[email protected]    sorbet/rbi/gems/[email protected]
R077    sorbet/rbi/gems/[email protected]    sorbet/rbi/gems/[email protected]
R097    sorbet/rbi/gems/[email protected]    sorbet/rbi/gems/[email protected]
R098    sorbet/rbi/gems/[email protected]     sorbet/rbi/gems/[email protected]
R099    sorbet/rbi/gems/[email protected]   sorbet/rbi/gems/[email protected]
R098    sorbet/rbi/gems/[email protected]  sorbet/rbi/gems/[email protected]
R070    sorbet/rbi/gems/[email protected] sorbet/rbi/gems/[email protected]
R099    sorbet/rbi/gems/[email protected] sorbet/rbi/gems/[email protected]
R100    sorbet/rbi/gems/[email protected] sorbet/rbi/gems/[email protected]
R098    sorbet/rbi/gems/[email protected]      sorbet/rbi/gems/[email protected]

lavoiesl avatar Oct 16 '24 13:10 lavoiesl

This seems to be another case of https://github.com/Shopify/tapioca/issues/2016. We're looking into it.

dirceu avatar Oct 16 '24 20:10 dirceu

https://github.com/Shopify/tapioca/pull/2050 fixes it

lavoiesl avatar Oct 22 '24 18:10 lavoiesl