Skip to content

v2/address-pr712-review - #728

Merged
ttypic merged 2 commits into
integration/v2from
v2/address-pr712-review
Nov 2, 2026
Merged

ttypic merged 2 commits into
integration/v2from
v2/address-pr712-review

Conversation

@ttypic

@ttypic ttypic commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Follow-ups to the review comments on #712.

getFallbackHosts no longer returns an error

  • getFallbackHosts now returns just []string.
  • validate() is removed. It existed only to return that error from NewHTTPClient.
  • The dead error handling in the HTTP fallback path and in realtime connect is removed. Realtime connect still tries the primary host first, then the shuffled fallbacks.

No behaviour change.

ErrChannelReleaseInvalidState is exported

  • ErrChannelReleaseInvalidState is now re-exported from both entry points, like the other Err… constants.
  • It's removed from the deliberate omissions in server/pubsub/reexport_test.go.
  • The Release doc comment and UPDATING.md now name the constant.

Summary by CodeRabbit

  • New Features
    • Added a named error code for attempts to release a channel that is not in a releasable state.
  • Documentation
    • Clarified that releasing a channel in an invalid state returns error 90011 with status 400, leaves the channel unchanged, and requires detaching it first.
  • Refactor
    • Simplified fallback host handling during client setup and connection.

ttypic and others added 2 commits November 2, 2026 15:02
Since the legacy host options were removed, getFallbackHosts has no
failing branch, so its error result was always nil. Drop it, along with
validate(), which only existed to surface that error from NewHTTPClient,
and the error handling at the call sites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Channels.Release returns 90011 when the channel isn't INITIALIZED,
DETACHED or FAILED, but the constant was the only error code kept out
of server/pubsub and device/pubsub, so callers had to compare against a
bare number. Re-export it from both entry points like the other error
codes, and name it in the Release doc comment and UPDATING.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ttypic
ttypic requested a review from splindsay-92 November 2, 2026 15:13
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2e57a5e0-0874-4f8c-b397-91759ad8386e
Commits

Reviewing files that changed from the base of the PR and between 6415cc6 and 06198ca.

Files selected for processing: 10
  • UPDATING.md
  • device/pubsub/api.go
  • internal/ably/export_test.go
  • internal/ably/http_client.go
  • internal/ably/options.go
  • internal/ably/options_test.go
  • internal/ably/realtime_channel.go
  • internal/ably/realtime_conn.go
  • server/pubsub/api.go
  • server/pubsub/reexport_test.go

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

The change removes the error result from fallback-host selection and its callers. It also exports ErrChannelReleaseInvalidState from both pubsub packages and updates the related release documentation and re-export test.

Changes

Fallback Host Selection

Layer / File(s) Summary
Fallback host lookup and callers
internal/ably/options.go, internal/ably/export_test.go, internal/ably/http_client.go, internal/ably/realtime_conn.go, internal/ably/options_test.go
getFallbackHosts and its test wrapper now return only host slices. HTTP and realtime connection code no longer handles lookup errors. Tests use the single-value result and retain their host assertions.

Channel Release Error Export

Layer / File(s) Summary
Release error documentation and exports
internal/ably/realtime_channel.go, device/pubsub/api.go, server/pubsub/api.go, server/pubsub/reexport_test.go, UPDATING.md
Both pubsub packages export ErrChannelReleaseInvalidState. The release documentation names the error constant, and the re-export test includes it in its checks.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

  • ably/ably-go#718: This PR adds the error constant to the same pubsub re-export contract.
  • ably/ably-go#719: This PR also changes fallback-host handling and removes a failing path from getFallbackHosts.

Suggested reviewers: sacoo7, lmars

Merge Risk: Minimal · up to 06198

The change preserves fallback behavior and consistently exposes the existing release error without establishing a material merge risk.

Pre-merge checks: Passed 3 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check Inconclusive The title identifies an internal review branch but does not describe the primary changes, such as simplifying fallback-host handling or re-exporting ErrChannelReleaseInvalidState. Replace the branch-style title with a concise summary of the main change, for example: "Simplify fallback host handling and re-export channel release error".
Passed Passed checks: 3 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 9 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the host list twice,
Then finds no error in the slice.
A named release code joins the line,
Through both pubsub doors it shines.
The docs now tell its code and state.

@splindsay-92 splindsay-92 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@ttypic
ttypic merged commit 02e6419 into integration/v2 Nov 2, 2026
9 checks passed
@ttypic
ttypic deleted the v2/address-pr712-review branch November 2, 2026 17:47
@ttypic ttypic mentioned this pull request Nov 2, 2026

This branch was successfully deployed

1 active deployment
staging/pull/728/godoc — 06198ca9 Deployed Nov 2, 2026 by github-actions[bot]
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.

2 participants