Shopify / Shopify/tapioca

RBIs for different Rails gems are referencing each other even though there is no dependency

Open
#2,196 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
873
Forks
164
Avg merge
4d 27m
Merged PRs (30d)
9

Description

I'm trying to build an app that doesn't require all of Rails but only specific parts, e.g. activerecord.

According to its gem spec it only depends on activesupport and activemodel (with no further transitive dependencies into Rails).

However, running bin/srb tc on the RBIs generated by tapioca I'm getting the following errors:

$ bin/srb tc
sorbet/rbi/gems/activerecord@8.0.1.rbi:8297: Unable to resolve constant ActionText https://srb.help/5002
    8297 |  include ::ActionText::Encryption
                    ^^^^^^^^^^^^

sorbet/rbi/gems/activerecord@8.0.1.rbi:8297: Unable to resolve constant ActionText https://srb.help/5002
    8297 |  include ::ActionText::Encryption
                    ^^^^^^^^^^^^

sorbet/rbi/gems/activerecord@8.0.1.rbi:8359: Unable to resolve constant ActiveStorage https://srb.help/5002
    8359 |  include ::ActiveStorage::Attached::Model
                    ^^^^^^^^^^^^^^^

sorbet/rbi/gems/activerecord@8.0.1.rbi:8359: Unable to resolve constant ActiveStorage https://srb.help/5002
    8359 |  include ::ActiveStorage::Attached::Model
                    ^^^^^^^^^^^^^^^

sorbet/rbi/gems/activerecord@8.0.1.rbi:8360: Unable to resolve constant ActiveStorage https://srb.help/5002
    8360 |  include ::ActiveStorage::Reflection::ActiveRecordExtensions
                    ^^^^^^^^^^^^^^^

sorbet/rbi/gems/activerecord@8.0.1.rbi:8360: Unable to resolve constant ActiveStorage https://srb.help/5002
    8360 |  include ::ActiveStorage::Reflection::ActiveRecordExtensions
                    ^^^^^^^^^^^^^^^

sorbet/rbi/gems/activerecord@8.0.1.rbi:8361: Unable to resolve constant ActionText https://srb.help/5002
    8361 |  include ::ActionText::Attribute
                    ^^^^^^^^^^^^

[...]

Is this a known limitation that Rails can only be used as a whole with tapioca or something that can/should be fixed?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Rails activerecord.gemspec dependency declaration linked in the issue and the generated sorbet/rbi/gems/activerecord@8.0.1.rbi entries reported by bin/srb tc. Compare the generated references with the declared gem dependencies and determine whether generation should account for optional Rails components. Done means the dependency behavior is documented or corrected and bin/srb tc no longer reports these unresolved constants for a partial Rails installation.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.