Skip to content

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

@olivier-thatch

Description

@olivier-thatch

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`

Metadata

Metadata

Assignees

No one assigned

    Labels

    help-wantedWe support this change, and welcome community contributions for it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions