Shopify / Shopify/tapioca

Tapioca v0.17.2 fails to generate signature for `AbstractController::Collector#turbo_stream`

Open
#2,334 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

After upgrading Tapioca to 0.17.2 (or more recent) and regenerating the RBI for actionpack, the signature for AbstractController::Collector#turbo_stream is missing.

The AbstractController::Collector methods are dynamically generated based on Mime::SET: https://github.com/rails/rails/blob/v8.0.2/actionpack/lib/abstract_controller/collector.rb#L18-L20

The turbo-rails gem registers the turbo_stream format in a Rails initializer: https://github.com/hotwired/turbo-rails/blob/v2.0.16/lib/turbo/engine.rb#L102-L104

So it looks like something changed in 0.17.2 that causes the Rails initializer to no longer be executed.

This is problematic for us because we have code in controllers like this:

respond_to do |format|
  format.turbo_stream do
    render(turbo_stream: ...)
  end
end

and after regenerating the RBI for actionpack, the code above produces a Sorbet error:

Method `turbo_stream` does not exist on `ActionController::MimeResponds::Collector`

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

Reproduce the missing signature by regenerating actionpack's RBI, then inspect actionpack/lib/abstract_controller/collector.rb and turbo-rails/lib/turbo/engine.rb to trace how turbo_stream is registered. Compare initializer execution around Tapioca 0.17.2 and verify that the generated RBI contains AbstractController::Collector#turbo_stream and the example controller no longer raises the Sorbet error.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.