Repository navigation
ably: make Channels.Release return an error unless the channel is detached (RTS4c-e) - #717
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. Walkthrough
ChangesRealtime channel release
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Release now rejects channels that are not detached, as intended for the breaking API change. No concrete defects remain. Releasing a channel from its detached event handler does not deadlock. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. A rabbit checks each channel’s state Comment |
…ached (RTS4c-e) Spec 6.3.0 replaces RTS4a with RTS4c-e. Release previously detached the channel and removed it once the detach completed, so a Get for the same name in that window returned the channel that was about to be removed, which then received no further messages. It also failed to release a FAILED channel, since detaching one is an error (RTL5b). Release now removes a channel in the INITIALIZED, DETACHED or FAILED state immediately, and for any other state returns an ErrorInfo with code 90011 and statusCode 400 without changing the channel or the collection. As it no longer blocks, it no longer takes a context. This is a breaking change: callers must call RealtimeChannel.Detach and wait for it to return before calling Channels.Release(name). ErrChannelReleaseInvalidState is added by hand to error_names.go. 90011 is registered in ably-common, but the common pin is not bumped: the errors.go generator cannot parse the current errors.json format. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
e5a6dfc to
1c4eaf0
Compare
Implements RTS4c–e from spec 6.3.0 (ably/specification#557) for the next major version.
Breaking change.
RealtimeChannels.Releaseis nowRelease(name string) error:Releasereturns (RTS4d).*ably.ErrorInfowith code 90011 (ably.ErrChannelReleaseInvalidState) and statusCode 400, and the channel and collection are left unchanged (RTS4e). It no longer detaches the channel for you.context.Context.Why: under the old behaviour the channel stayed in the collection while the detach was in flight. A
Getfor the same name in that window returned the channel that was about to be removed, which then received no further messages. Releasing a FAILED channel also failed, since detaching a FAILED channel is an error.Migration: detach and wait before releasing.
90011 is registered in ably/ably-common#367, but the
commonsubmodule pin isn't bumped here, becausescripts/errorscan't parse the currenterrors.jsonformat. The constant is added by hand toerror_names.go.The current-major deprecation is in #716. Reference ably-js PRs: ably/ably-pubsub-js#2322 (deprecation) and ably/ably-pubsub-js#2323 (next major).
🤖 Generated with Claude Code
Summary by CodeRabbit