Skip to content

Conversation

@ttypic
Copy link
Contributor

@ttypic ttypic commented Jan 21, 2026

Renamed files for consistency across SDK

Summary by CodeRabbit

  • Refactor
    • Reorganized internal module structure to improve code maintainability and organization.
    • Consolidated channel configuration options into a dedicated types module.
    • Updated import paths across the codebase to reflect new module organization.

✏️ Tip: You can customize this high-level summary in your review settings.

@ttypic ttypic requested a review from owenpearson January 21, 2026 18:57
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

Warning

Rate limit exceeded

@ttypic has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

This pull request refactors module organization for consistency. It renames realtime_channel to channel, consolidates ChannelOptions into a new dedicated ably/types/channeloptions.py module, updates realtimepresence to presence, and corrects the default_vcdiff_decoder naming convention. All imports across the codebase are updated accordingly.

Changes

Cohort / File(s) Summary
Module Reorganization & Renaming
ably/__init__.py
Updated import path for AblyVCDiffDecoder from ably.vcdiff.default_vcdiff_decoder to ably.vcdiff.defaultvcdiffdecoder
Realtime Channel Import Updates
ably/realtime/realtime.py
Changed Channels import source from ably.realtime.realtime_channel to ably.realtime.channel
Presence Import Path Correction
ably/realtime/presence.py
Updated TYPE_CHECKING import for RealtimeChannel from ably.realtime.realtime_channel to ably.realtime.channel
ChannelOptions Class Consolidation
ably/realtime/channel.py
Removed local ChannelOptions definition; now imported from ably.types.channeloptions. Updated RealtimePresence import from ably.realtime.realtimepresence to ably.realtime.presence
New ChannelOptions Module
ably/types/channeloptions.py
New module introducing ChannelOptions class with constructor, cipher/params properties, equality/hash support, and to_dict/from_dict serialization methods. Validates that params is a dict if provided
Test Import Updates
test/ably/realtime/realtimechannel_publish_test.py,
test/ably/realtime/realtimechannel_test.py,
test/ably/realtime/realtimechannel_vcdiff_test.py,
test/ably/realtime/realtimeresume_test.py
Updated imports for ChannelOptions, ChannelState, and RealtimeChannel to reflect new module locations (ably.types.channeloptions, ably.realtime.channel, ably.realtime.presence)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 We hop through modules, reorganizing with care,
ChannelOptions finds its proper home to share,
Naming conventions now dance in perfect sync,
From realtime_channel to channel in a blink!
The warren's neater, the imports align,
A refactored codebase so clean and divine! 🌟

🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes out-of-scope changes: introducing a new ChannelOptions class in ably/types/channeloptions.py and relocating it, which extends beyond the stated objective of simply renaming files. Clarify whether ChannelOptions extraction to a new module is part of AIT-305 or should be separated into a distinct PR for better change isolation.
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: renaming realtime_channel.py and default_vcdiff_decoder.py files for consistency.
Linked Issues check ✅ Passed The PR successfully implements the file renames specified in AIT-305 (realtime_channel and default_vcdiff_decoder), plus refactors ChannelOptions location and import paths accordingly.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch AIT-305/rename-files

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot temporarily deployed to staging/pull/665/features January 21, 2026 18:58 Inactive
Copy link
Member

@owenpearson owenpearson left a comment

Choose a reason for hiding this comment

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

nice 👍

@ttypic ttypic requested a review from owenpearson January 22, 2026 11:00
@github-actions github-actions bot temporarily deployed to staging/pull/665/features January 22, 2026 11:01 Inactive
@ttypic ttypic force-pushed the AIT-305/rename-files branch from 08e12a1 to 154594a Compare January 22, 2026 11:01
@github-actions github-actions bot temporarily deployed to staging/pull/665/features January 22, 2026 11:02 Inactive
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/ably/realtime/realtimechannel_publish_test.py (1)

5-11: Fix import sorting to resolve linting failure.

The pipeline is failing due to unsorted imports (I001). The ably.* imports need to be alphabetically sorted.

Proposed fix
-from ably.realtime.connection import ConnectionState
 from ably.realtime.channel import ChannelState
+from ably.realtime.connection import ConnectionState
-from ably.types.channeloptions import ChannelOptions
 from ably.transport.websockettransport import ProtocolMessageAction
+from ably.types.channeloptions import ChannelOptions
 from ably.types.message import Message
 from ably.util.crypto import CipherParams
 from ably.util.exceptions import AblyException, IncompatibleClientIdException
🤖 Fix all issues with AI agents
In `@ably/realtime/realtime.py`:
- Around line 5-7: Reorder the ably imports in the realtime module to satisfy
I001 by sorting them alphabetically: import AblyRest from ably.rest.rest first,
then Channels from ably.realtime.channel, then Connection and ConnectionState
from ably.realtime.connection; update the import block in realtime.py to that
order so linters pass.

In `@ably/types/channeloptions.py`:
- Around line 62-66: The AblyException instantiation in ChannelOptions.from_dict
currently swaps the code and status_code arguments; update the call in from_dict
so the HTTP status code comes first and the Ably error code second (i.e.,
replace the current numeric order with 400 then 40000) so the exception becomes
AblyException("options must be a dictionary", 400, 40000).
- Around line 20-26: In ChannelOptions.__init__, the params validation
incorrectly uses a truthiness check which lets falsy non-dict values (like [])
pass and the AblyException is constructed with reversed arguments; change the
guard to "if self.__params is not None and not isinstance(self.__params, dict):"
and raise the exception with the correct argument order (swap the existing
arguments so the numeric code/status are passed in the expected positions) when
constructing AblyException for the params validation.

In `@test/ably/realtime/realtimechannel_test.py`:
- Around line 5-7: Reorder the imports to satisfy I001 by grouping and
alphabetizing them: place the ably.realtime.channel import (ChannelState,
RealtimeChannel) before ably.realtime.connection (ConnectionState), followed by
ably.types.channeloptions (ChannelOptions); adjust the import order so the three
from-import statements are in that alphabetical/grouped order.

In `@test/ably/realtime/realtimeresume_test.py`:
- Around line 5-7: Reorder the import statements so they satisfy I001 import
ordering: group and sort imports consistently (third-party first, then local)
and alphabetize within groups; specifically adjust the lines importing
ConnectionState, ChannelState, and ProtocolMessageAction so their modules are in
the correct order (e.g., import ProtocolMessageAction, then ConnectionState,
then ChannelState or alphabetically by module path) to eliminate the lint
error—update the three import lines around the references to ConnectionState,
ChannelState, and ProtocolMessageAction accordingly.
🧹 Nitpick comments (1)
ably/types/channeloptions.py (1)

32-35: Make params return type Optional for accuracy.

self.__params can be None, but the annotation says dict[str, str]. Consider reflecting the nullable return type.

♻️ Suggested tweak
-    def params(self) -> dict[str, str]:
+    def params(self) -> dict[str, str] | None:

Copy link
Member

@owenpearson owenpearson left a comment

Choose a reason for hiding this comment

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

looks good 👍

@ttypic ttypic merged commit 8e12d34 into main Jan 22, 2026
15 of 17 checks passed
@ttypic ttypic deleted the AIT-305/rename-files branch January 22, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants