Skip to content

Update Pub/Sub SDK with improved structure and naming - #713

Open
ttypic wants to merge 5 commits into
integration/v2from
integration/renaming
Open

ttypic wants to merge 5 commits into
integration/v2from
integration/renaming

Conversation

@ttypic

@ttypic ttypic commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

This pull request introduces major structural and naming adjustments to the Pub/Sub SDK. It includes the following changes:

  • Unify package names: Renamed entry-point packages for device and server to pubsub, streamlining usage and reducing redundancy in import paths.
  • Module renaming: Updated the module path to ably-pubsub-go and flattened entry points, simplifying directory structure and imports.
  • Restrict internal API access: Moved implementation details to internal/ably to prevent direct imports and re-exported necessary symbols via pubsub/server and pubsub/device.
  • Renaming of public types: Renamed REST API symbols to HTTP* for consistency and replaced all related examples and tests.
  • Introduction of specialized packages:
    • /device for end-user device-specific clients.
    • /server for server-side clients with updated headers for classification.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 134 files, which is 34 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

Check out review usage here.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: fbe3739a-f530-4bc9-bdef-3a352ff5e6e1

📥 Commits

Reviewing files that changed from the base of the PR and between 24bd01a and 82657ad.

📒 Files selected for processing (134)
  • .github/workflows/check.yml
  • .github/workflows/docs.yml
  • .github/workflows/integration-test.yml
  • README.md
  • UPDATING.md
  • ably/generate.go
  • device/pubsub/api_gen.go
  • device/pubsub/api_test.go
  • device/pubsub/device.go
  • device/pubsub/device_test.go
  • examples/README.md
  • examples/http/history/main.go
  • examples/http/presence/main.go
  • examples/http/publish/main.go
  • examples/http/stats/main.go
  • examples/http/status/main.go
  • examples/realtime/presence/main.go
  • examples/realtime/pub-sub/main.go
  • examples/utils.go
  • go.mod
  • internal/ably/ably.go
  • internal/ably/ably_test.go
  • internal/ably/auth.go
  • internal/ably/auth_integration_test.go
  • internal/ably/auth_internal_test.go
  • internal/ably/auth_test.go
  • internal/ably/crypto.go
  • internal/ably/crypto_spec_test.go
  • internal/ably/doc.go
  • internal/ably/doc_test.go
  • internal/ably/error.go
  • internal/ably/error_internal_test.go
  • internal/ably/error_names.go
  • internal/ably/error_test.go
  • internal/ably/errors.go
  • internal/ably/event_emitter.go
  • internal/ably/event_emitter_integration_test.go
  • internal/ably/event_emitter_spec_integration_test.go
  • internal/ably/example_message_updates_test.go
  • internal/ably/export_test.go
  • internal/ably/generate.go
  • internal/ably/http_channel.go
  • internal/ably/http_channel_integration_test.go
  • internal/ably/http_channel_spec_integration_test.go
  • internal/ably/http_client.go
  • internal/ably/http_client_integration_test.go
  • internal/ably/http_client_test.go
  • internal/ably/http_paginated_response_integration_test.go
  • internal/ably/http_presence.go
  • internal/ably/http_presence_spec_integration_test.go
  • internal/ably/internal/ablyutil/idempotent.go
  • internal/ably/internal/ablyutil/merge.go
  • internal/ably/internal/ablyutil/msgpack.go
  • internal/ably/internal/ablyutil/msgpack_test.go
  • internal/ably/internal/ablyutil/regex.go
  • internal/ably/internal/ablyutil/regex_test.go
  • internal/ably/internal/ablyutil/strings.go
  • internal/ably/internal/ablyutil/strings_test.go
  • internal/ably/internal/ablyutil/time.go
  • internal/ably/logger.go
  • internal/ably/logger_test.go
  • internal/ably/main_integration_test.go
  • internal/ably/message_updates_integration_test.go
  • internal/ably/objects/liveobjects.go
  • internal/ably/options.go
  • internal/ably/options_test.go
  • internal/ably/os_version_other.go
  • internal/ably/os_version_unix.go
  • internal/ably/os_version_windows.go
  • internal/ably/paginated_result.go
  • internal/ably/proto_action.go
  • internal/ably/proto_channel_options.go
  • internal/ably/proto_channel_options_test.go
  • internal/ably/proto_channel_propeties.go
  • internal/ably/proto_crypto.go
  • internal/ably/proto_error.go
  • internal/ably/proto_error_test.go
  • internal/ably/proto_http.go
  • internal/ably/proto_message.go
  • internal/ably/proto_message_decoding_test.go
  • internal/ably/proto_message_delta_test.go
  • internal/ably/proto_message_doc.txt
  • internal/ably/proto_message_integration_test.go
  • internal/ably/proto_message_operations_test.go
  • internal/ably/proto_message_test.go
  • internal/ably/proto_presence_message.go
  • internal/ably/proto_presence_message_test.go
  • internal/ably/proto_protocol_message.go
  • internal/ably/proto_protocol_message_test.go
  • internal/ably/proto_stat.go
  • internal/ably/proto_types.go
  • internal/ably/proto_types_test.go
  • internal/ably/realtime_channel.go
  • internal/ably/realtime_channel_delta_integration_test.go
  • internal/ably/realtime_channel_integration_test.go
  • internal/ably/realtime_channel_internal_test.go
  • internal/ably/realtime_channel_spec_integration_test.go
  • internal/ably/realtime_channel_test.go
  • internal/ably/realtime_client.go
  • internal/ably/realtime_client_integration_test.go
  • internal/ably/realtime_client_internal_test.go
  • internal/ably/realtime_conn.go
  • internal/ably/realtime_conn_integration_test.go
  • internal/ably/realtime_conn_spec_integration_test.go
  • internal/ably/realtime_experimental_objects.go
  • internal/ably/realtime_experimental_objects_test.go
  • internal/ably/realtime_presence.go
  • internal/ably/realtime_presence_integration_test.go
  • internal/ably/realtime_presence_internal_test.go
  • internal/ably/recovery_context.go
  • internal/ably/recovery_context_test.go
  • internal/ably/state.go
  • internal/ably/state_test.go
  • internal/ably/token.go
  • internal/ably/transitioner_integration_test.go
  • internal/ably/vcdiff_plugin.go
  • internal/ably/vcdiff_plugin_test.go
  • internal/ably/websocket.go
  • internal/ably/websocket_internal_test.go
  • internal/ablytest/ablytest.go
  • internal/ablytest/fmt_test.go
  • internal/ablytest/logger.go
  • internal/ablytest/pagination.go
  • internal/ablytest/proxies.go
  • internal/ablytest/recorders.go
  • internal/ablytest/resultgroup.go
  • internal/ablytest/sandbox.go
  • internal/cmd/genapi/genapi_test.go
  • internal/cmd/genapi/main.go
  • pubsub/device/device.go
  • server/pubsub/api_gen.go
  • server/pubsub/api_test.go
  • server/pubsub/server.go
  • server/pubsub/server_test.go

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

ttypic and others added 5 commits September 24, 2026 11:19
The stateless client and the types reachable from it were named after
the Ably REST API they talk to rather than the transport they use,
which reads inconsistently beside Realtime and beside the already
HTTP-named pubsub/server aliases.

Rename REST -> HTTPClient, RESTChannels -> HTTPChannels, RESTChannel ->
HTTPChannel, RESTPresence -> HTTPPresence, RESTRequest -> HTTPRequest,
RESTPaginatedItems -> HTTPPaginatedItems, NewREST -> NewHTTPClient,
WithRESTHost -> WithHTTPHost and WithIdempotentRESTPublishing ->
WithIdempotentHTTPPublishing.

This is a breaking change: the old names are removed outright rather
than kept as deprecated aliases, so a /v2 module path is required
before release. Stats.REST keeps its name, because it mirrors the
"rest" field of the stats payload rather than naming a client type.

 - Extend pubsub/server with aliases for the types reachable through
   HTTPClient, so its users never name an ably.* type directly

 - Unexport ablytest's stdlib *http.Client helper, freeing the
   NewHTTPClient name for the sandbox helper that was ablytest.NewREST

 - Document the old-to-new mapping in UPDATING.md

Tests and examples follow the new names. No behaviour changes, so no
new coverage is added.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The SDK was entered through github.com/ably/ably-go/ably, which left the
pubsub packages as a thin veneer over an API users could equally import
directly, and gave them no way to see which half of it applied to them.

Move the implementation to internal/ably, where nothing outside this
module can import it, and have pubsub/server and pubsub/device re-export
the part of it their users need. The re-exports are type aliases, so the
types stay identical across both packages.

Generate the re-exports rather than listing them, since a hand-written
mirror of ~200 declarations drifts the first time internal/ably changes.
internal/cmd/genapi aliases every exported type by default — an
incomplete walk of the API can then only over-expose, never silently
drop — and emits a function or constant once every ably type in its
signature is aliased too. pubsub/device additionally drops what only an
HTTPClient can reach, which a device client has no way to obtain.

Three consequences worth knowing, all recorded in UPDATING.md:

 - LiveObjects types take an Objects prefix, because objects.Message and
   ably.Message cannot share a package

 - WithDial is not re-exported: its signature names an unexported type,
   so no external caller could ever supply an argument to it

 - internal/ably/http_{client,channel,presence}.go are the former rest_*
   files, renamed to match the types they hold

api_test.go in each package exercises a broad slice of the re-exported
surface, so a symbol dropped from the generated set fails here rather
than in a user's build. genapi_test.go fails when the generated files
no longer match the generator, alongside the existing ci-generate.sh
check that go generate leaves a clean tree.

Examples now use pubsub/server, and examples/rest is examples/http.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The pubsub directory added a path segment that said nothing the module
path did not already say, and the SDK is no longer an ably-go: after the
previous commit it exposes only the Pub/Sub entry points.

Rename the module to github.com/ably/ably-pubsub-go and lift the two
entry-point packages to the repository root, so that they are imported
as .../ably-pubsub-go/server and .../ably-pubsub-go/device. The module
rename stands in for the /v2 path suffix this release would otherwise
need, so there is no ably-go/v2.

genapi needed more than a path rewrite: its repoRoot walked up looking
for the literal old module line in go.mod, so `go generate` failed until
it was pointed at the new path. Both that lookup and its error message
now come from one modulePath constant.

The repository has not moved yet, so github.com/ably/ably-go URLs are
left alone and the README says the new path does not resolve until it
does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
server and device named the package after its directory, so the same
call read as server.NewRealtimeClient in one and device.NewClient in the
other. Which side an application runs on is already settled by the
import path it chose; repeating it on every call added nothing.

Name both packages pubsub. Only the import path now distinguishes them,
and moving an application between the two is a one-line change to that
path rather than a rewrite of every call site. Note that a bare import
of either path binds pubsub, not server or device, since the identifier
comes from the package clause and not the last path element; the package
docs and the migration guide both say so, and no import aliases the name
back to its directory.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The previous commit named both entry-point packages pubsub while leaving
them in server and device, so the identifier an import bound differed
from the last element of its path. Go tooling and readers expect the two
to match, and the docs had to warn about it.

Move the packages one level down, to .../server/pubsub and
.../device/pubsub. The server or device segment still says which side
the code runs on, and the package name now follows the path. The genapi
targets, go generate hints, examples and docs follow the new paths, and
the warning about the mismatch is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
staging/pull/713/godoc — 82657adf Deployed Sep 24, 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.

1 participant