Skip to content

Add types for actioncable v8.1 - #1091

Merged
github-actions[bot] merged 6 commits into
ruby:mainfrom
amatsuda:actioncable-8.1
Oct 14, 2026
Merged

github-actions[bot] merged 6 commits into
ruby:mainfrom
amatsuda:actioncable-8.1

Conversation

@amatsuda

Copy link
Copy Markdown
Member

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::Base and Channel::Base classes. 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.rbs comes from rbs prototype rb run on lib, then post-processed:

  • Drop members that core, dependencies, or the hand-written RBS already define
  • Fill missing type arguments of generic classes with untyped
  • Drop mixins and superclasses that can't be resolved
  • Add accessors defined with class_attribute, mattr_accessor, and cattr_accessor, and methods defined with delegate
  • Make the generated classes extend the ClassMethods of the concerns they include, directly or through other concerns, as ActiveSupport::Concern does. For example, Channel::TestCase and Connection::TestCase get tests

The channel generators in lib/rails are left out, since their superclass comes from railties, which actioncable doesn't depend on.

Hand-written RBS

The empty declarations of Connection::Base and Channel::Base are replaced with the ClassMethods of the concerns they include, so connections and channels have identified_by, periodically, broadcast_to, rescue_from, and the callbacks.

Return types

ActionCable.server, a channel's params (HashWithIndifferentAccess), connection, identifier, channel_name, and broadcasting_for, and a connection's request and cookies.

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_from and stream_for with a callback or none, and assert_no_broadcasts without a block.

Tests

Each commit that changes types adds tests that fail without it. bin/test gems/actioncable/8.1 and RuboCop's strict cops pass on every commit from the generation commit onward.

🤖 Generated with Claude Code

amatsuda and others added 6 commits October 13, 2026 19:18
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>
@github-actions

Copy link
Copy Markdown

@amatsuda Thanks for your contribution!

Please follow the instructions below for each change.
See also: https://github.com/ruby/gem_rbs_collection/blob/main/docs/CONTRIBUTING.md

Available commands

You can use the following commands by commenting on this PR.

  • /merge: Merge this PR if CI passes

actioncable

You changed RBS files for an existing gem.
You need to get approval from the reviewers of this gem.

@ksss, @tk0miya, please review this pull request.
If this change is acceptable, please make a review comment including APPROVE from here.
Screen Shot 2024-03-19 at 14 13 36

After that, the PR author or the reviewers can merge this PR.
Just comment /merge to merge this PR.

@ksss ksss left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

APPROVE

@github-actions

Copy link
Copy Markdown

Thanks for your review, @ksss!

@amatsuda, @ksss This PR is ready to be merged.
Just comment /merge to merge this PR.

@amatsuda

Copy link
Copy Markdown
Member Author

/merge

@github-actions
github-actions Bot merged commit 9db27f6 into ruby:main Oct 14, 2026
7 checks passed
@amatsuda
amatsuda deleted the actioncable-8.1 branch October 14, 2026 11:38
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