Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip models that don't have table #26

Merged
merged 2 commits into from
Oct 25, 2024
Merged

Conversation

hibariya
Copy link
Contributor

When I ran bin/rails orthoses:rails --trace on a Rails app, the following error was raised. It seems orthoses-rails is trying to generate RBS for ActionText::RichText the corresponding table of which does not exist. I think we better skip in that case.

/work/web$ bin/rails orthoses:rails --trace
** Invoke orthoses:rails (first_time)
** Execute orthoses:rails
W, [2024-10-22T21:41:55.025094 #566112]  WARN -- : [ActiveSupport::Delegation] Ignore since missing type for Class#:normalize_env in {:methods=>[:normalize_env], :to=>:class, :prefix=>nil, :allow_nil=>nil, :private=>nil}
W, [2024-10-22T21:41:55.082050 #566112]  WARN -- : [ActiveSupport::Delegation] Ignore since missing type for Class#:caching? in {:methods=>[:caching?], :to=>:class, :prefix=>nil, :allow_nil=>nil, :private=>nil}
W, [2024-10-22T21:41:55.158310 #566112]  WARN -- : [ActiveSupport::Delegation] Ignore since missing type for Class#:queue_adapter in {:methods=>[:queue_adapter], :to=>:class, :prefix=>nil, :allow_nil=>nil, :private=>nil}
W, [2024-10-22T21:41:55.474829 #566112]  WARN -- : [ActiveSupport::Delegation] Ignore since missing type for Class#:model_name in {:methods=>[:model_name], :to=>:class, :prefix=>nil, :allow_nil=>nil, :private=>nil}
W, [2024-10-22T21:41:55.477097 #566112]  WARN -- : [ActiveSupport::Delegation] Ignore since missing type for Class#:model_name in {:methods=>[:model_name], :to=>:class, :prefix=>nil, :allow_nil=>nil, :private=>nil}
W, [2024-10-22T21:41:55.541078 #566112]  WARN -- : [ActiveSupport::Delegation] Ignore since missing type for Class#:destroy_association_async_job in {:methods=>[:destroy_association_async_job], :to=>:class, :prefix=>nil, :allow_nil=>nil, :private=>nil}
W, [2024-10-22T21:41:55.544203 #566112]  WARN -- : [ActiveSupport::Delegation] Ignore since missing type for Class#:type_for_attribute in {:methods=>[:type_for_attribute, :column_for_attribute], :to=>:class, :prefix=>nil, :allow_nil=>nil, :private=>nil}
W, [2024-10-22T21:41:55.548555 #566112]  WARN -- : [ActiveSupport::Delegation] Ignore since missing type for Class#:column_for_attribute in {:methods=>[:type_for_attribute, :column_for_attribute], :to=>:class, :prefix=>nil, :allow_nil=>nil, :private=>nil}
W, [2024-10-22T21:41:55.557334 #566112]  WARN -- : [ActiveSupport::Delegation] Ignore since missing type for Class#:model_name in {:methods=>[:model_name], :to=>:class, :prefix=>nil, :allow_nil=>nil, :private=>nil}
W, [2024-10-22T21:41:55.725730 #566112]  WARN -- : Could not find table 'action_text_rich_texts'
W, [2024-10-22T21:41:55.726719 #566112]  WARN -- : Could not find table 'action_text_rich_texts'
W, [2024-10-22T21:41:55.728560 #566112]  WARN -- : Could not find table 'active_storage_variant_records'
W, [2024-10-22T21:41:55.729649 #566112]  WARN -- : Could not find table 'active_storage_attachments'
W, [2024-10-22T21:41:55.731315 #566112]  WARN -- : Could not find table 'active_storage_blobs'
W, [2024-10-22T21:41:55.732670 #566112]  WARN -- : Could not find table 'action_mailbox_inbound_emails'
bin/rails aborted!
ActiveRecord::StatementInvalid: Could not find table 'action_text_rich_texts' (ActiveRecord::StatementInvalid)
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:476:in `table_structure'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:109:in `columns'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/schema_cache.rb:345:in `block (2 levels) in columns'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:395:in `with_connection'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/schema_cache.rb:344:in `block in columns'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/schema_cache.rb:343:in `fetch'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/schema_cache.rb:343:in `columns'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/schema_cache.rb:354:in `block in columns_hash'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/schema_cache.rb:353:in `fetch'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/schema_cache.rb:353:in `columns_hash'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/schema_cache.rb:54:in `columns_hash'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/connection_adapters/schema_cache.rb:198:in `columns_hash'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/model_schema.rb:594:in `load_schema!'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/counter_cache.rb:187:in `load_schema!'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/encryption/encryptable_record.rb:127:in `load_schema!'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/model_schema.rb:541:in `block in load_schema'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/model_schema.rb:538:in `synchronize'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/model_schema.rb:538:in `load_schema'
/usr/local/bundle/gems/activerecord-7.2.1/lib/active_record/model_schema.rb:429:in `columns_hash'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/persistence.rb:16:in `block (2 levels) in call'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/persistence.rb:12:in `each'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/persistence.rb:12:in `block in call'
<internal:kernel>:90:in `tap'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/persistence.rb:11:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/has_one.rb:11:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/has_many.rb:11:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/generated_attribute_methods.rb:33:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/enum.rb:17:in `block in call'
<internal:trace_point>:261:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:50:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:74:in `trace_instance_method'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:58:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/call_tracer/lazy.rb:30:in `trace'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/enum.rb:16:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/delegated_type.rb:17:in `block in call'
<internal:trace_point>:261:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:50:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:74:in `trace_instance_method'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:58:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/call_tracer/lazy.rb:30:in `trace'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/delegated_type.rb:16:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_record/belongs_to.rb:11:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_model/has_secure_password.rb:19:in `block in call'
<internal:trace_point>:261:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:50:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:74:in `trace_instance_method'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:58:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/call_tracer/lazy.rb:30:in `trace'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_model/has_secure_password.rb:18:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_model/attributes.rb:31:in `block in call'
<internal:trace_point>:261:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:50:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:74:in `trace_instance_method'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/lazy_trace_point.rb:58:in `enable'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/call_tracer/lazy.rb:30:in `trace'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/active_model/attributes.rb:30:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/action_mailer/base.rb:11:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:57:in `call'
/usr/local/bundle/bundler/gems/orthoses-rails-0fde7870ae3e/lib/orthoses/rails/application.rb:47:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/missing_name.rb:10:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/outputable/avoid_recursive_ancestor_error.rb:13:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/outputable/constantizable_filter.rb:13:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/outputable/uniq_content_body.rb:13:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/create_file_by_name.rb:45:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/outputable.rb:22:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:23:in `call'
/usr/local/bundle/bundler/gems/orthoses-492cfc1772d8/lib/orthoses/builder.rb:57:in `call'
/work/web/lib/tasks/orthoses/rails.rake:36:in `block (2 levels) in <main>'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/task.rb:281:in `block in execute'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/task.rb:281:in `each'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/task.rb:281:in `execute'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/task.rb:199:in `synchronize'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/task.rb:188:in `invoke'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/application.rb:188:in `invoke_task'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/application.rb:138:in `block (2 levels) in top_level'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/application.rb:138:in `each'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/application.rb:138:in `block in top_level'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/application.rb:147:in `run_with_threads'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/application.rb:132:in `top_level'
/usr/local/bundle/gems/railties-7.2.1/lib/rails/commands/rake/rake_command.rb:27:in `block (2 levels) in perform'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/application.rb:214:in `standard_exception_handling'
/usr/local/bundle/gems/railties-7.2.1/lib/rails/commands/rake/rake_command.rb:27:in `block in perform'
/usr/local/bundle/gems/railties-7.2.1/lib/rails/commands/rake/rake_command.rb:44:in `block in with_rake'
/usr/local/bundle/gems/rake-13.2.1/lib/rake/rake_module.rb:59:in `with_application'
/usr/local/bundle/gems/railties-7.2.1/lib/rails/commands/rake/rake_command.rb:41:in `with_rake'
/usr/local/bundle/gems/railties-7.2.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/usr/local/bundle/gems/railties-7.2.1/lib/rails/command.rb:156:in `invoke_rake'
/usr/local/bundle/gems/railties-7.2.1/lib/rails/command.rb:73:in `block in invoke'
/usr/local/bundle/gems/railties-7.2.1/lib/rails/command.rb:149:in `with_argv'
/usr/local/bundle/gems/railties-7.2.1/lib/rails/command.rb:69:in `invoke'
/usr/local/bundle/gems/railties-7.2.1/lib/rails/commands.rb:18:in `<main>'
<internal:/usr/local/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/usr/local/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/usr/local/bundle/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => orthoses:rails

@ksss
Copy link
Owner

ksss commented Oct 25, 2024

@hibariya Thank you for reporting.
I will fix the problem.
As a temporary solution, you can use Orthoses::Filter to remove any model from the RBS generation target.

use Orthoses::Filter do |name, _content|
  name != "ActionText::RichText"
end

@ksss
Copy link
Owner

ksss commented Oct 25, 2024

What a surprise!
There was already a patch. Thank you!

@ksss
Copy link
Owner

ksss commented Oct 25, 2024

Failure of CI appears to be an existing problem. I will try to fix it.

Copy link
Owner

@ksss ksss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ksss ksss merged commit 5265637 into ksss:main Oct 25, 2024
12 checks passed
@ksss
Copy link
Owner

ksss commented Oct 25, 2024

v1.7.0 has been released!

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.

2 participants