Repository navigation
Add types for actioncable v8.1 - #1091
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
7.1 had only empty declarations of Connection::Base and Channel::Base. 8.1 adds signatures generated with `rbs prototype rb` from the actioncable 8.1.4 source and post-processed the same way as the other Rails 8.1 gems: drop members already defined elsewhere, fill missing type arguments, and add accessors defined with class_attribute, mattr_accessor, and cattr_accessor and methods defined with delegate. The channel generators in lib/rails are left out, as their superclass comes from railties, which actioncable doesn't depend on. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…s include Replace the empty declarations of Connection::Base and Channel::Base, which the generated RBS now has, with the ClassMethods of the concerns they include, so connections and channels have identified_by, periodically, broadcast_to, rescue_from, and the callbacks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
rbs prototype marks a block as required unless the method checks it. These forward the block or store it: the callbacks with method names (after_subscribe :foo, before_command :foo), stream_from and stream_for with a callback or none, assert_no_broadcasts, and a few internal methods. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ActionCable.server, a channel's params, connection, identifier, channel_name, and broadcasting_for, and a connection's request and cookies. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…lasses include The generated classes now extend the ClassMethods of the concerns they include, directly or through other concerns, as ActiveSupport::Concern does. Channel::TestCase and Connection::TestCase get tests, for example. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
@amatsuda Thanks for your contribution! Please follow the instructions below for each change. Available commandsYou can use the following commands by commenting on this PR.
|
Member
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds signatures for actioncable 8.1, based on 8.1.4.
The latest version in this repository was actioncable 7.1, which only declared empty
Connection::BaseandChannel::Baseclasses. This PR adds signatures generated from the 8.1.4 source, the same way as the other Rails 8.1 gems (#1084, #1086, #1087).How it is made
actioncable-generated.rbscomes fromrbs prototype rbrun onlib, then post-processed:untypedclass_attribute,mattr_accessor, andcattr_accessor, and methods defined withdelegateClassMethodsof the concerns they include, directly or through other concerns, asActiveSupport::Concerndoes. For example,Channel::TestCaseandConnection::TestCasegettestsThe channel generators in
lib/railsare left out, since their superclass comes from railties, which actioncable doesn't depend on.Hand-written RBS
The empty declarations of
Connection::BaseandChannel::Baseare replaced with theClassMethodsof the concerns they include, so connections and channels haveidentified_by,periodically,broadcast_to,rescue_from, and the callbacks.Return types
ActionCable.server, a channel'sparams(HashWithIndifferentAccess),connection,identifier,channel_name, andbroadcasting_for, and a connection'srequestandcookies.Optional blocks
All required blocks were checked against the source, and the 15 that only forward or store the block were made optional: for example,
after_subscribe :method_name,before_command :method_name,stream_fromandstream_forwith a callback or none, andassert_no_broadcastswithout a block.Tests
Each commit that changes types adds tests that fail without it.
bin/test gems/actioncable/8.1and RuboCop's strict cops pass on every commit from the generation commit onward.🤖 Generated with Claude Code