Skip to content

refactor(realtime)!: internalize RealtimePresence - #1707

Merged
spydon merged 2 commits into
feat/realtime-streams-v3from
lukasklingsbo/sdk-1477-v3-internalize-realtimepresence-and-its-callback
Aug 14, 2026
Merged

refactor(realtime)!: internalize RealtimePresence#1707
spydon merged 2 commits into
feat/realtime-streams-v3from
lukasklingsbo/sdk-1477-v3-internalize-realtimepresence-and-its-callback

Conversation

@spydon

@spydon spydon commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What

Marks RealtimePresence, its helper types (PresenceOptions, PresenceEvents, PresenceChooser, PresenceOnJoinCallback, PresenceOnLeaveCallback), and the RealtimeChannel.presence field as @internal, and stops exporting them from the barrel (realtime_presence.dart now only exports the Presence payload class, which stays public).

Why

RealtimePresence is presence bookkeeping that leaked into the public API, and it hides a footgun: onJoin / onLeave / onSync are single-slot callback setters, and the constructor installs the forwarders that feed the channel presence streams through those same slots. A user calling channel.presence.onJoin(...) therefore silently disabled the channel's onPresenceJoin / onPresenceLeave / onPresenceSync events.

Everything the class offered is available on the channel: the presence streams for events and presenceState() for the current state. A migration entry documents the before/after.

Notes

Tests

All realtime unit tests (195) and the integration suite (both protocol versions, run locally against a real Realtime server) pass, plus supabase (134) and analyzer/DCM across the workspace.

Resolves SDK-1477

BREAKING CHANGE: RealtimePresence, PresenceOpts, PresenceEvents,
PresenceChooser, PresenceOnJoinCallback, PresenceOnLeaveCallback, and
the RealtimeChannel.presence field are internal. Registering a callback
through channel.presence silently disabled the channel presence streams
because the internal forwarders occupied the same single callback slot.
Use RealtimeChannel.onPresenceSync/onPresenceJoin/onPresenceLeave and
presenceState() instead. The Presence payload class stays public.
@spydon
spydon requested a review from a team as a code owner August 13, 2026 13:59
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 970e5573-6c98-4ba9-9be1-58788598ac2f

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@spydon
spydon merged commit f8ed2bb into feat/realtime-streams-v3 Aug 14, 2026
36 checks passed
@spydon
spydon deleted the lukasklingsbo/sdk-1477-v3-internalize-realtimepresence-and-its-callback branch August 14, 2026 09:52
spydon added a commit that referenced this pull request Aug 14, 2026
## What

Marks `Binding` and `BindingCallback` as `@internal` and removes them
from the barrel export of `realtime_client`.

## Why

They are the raw registration primitives underneath the channel
listeners, and their only consumers, `RealtimeChannel.onEvents` and
`RealtimeChannel.off`, have always been `@internal`. The raw-callback
escape hatch underneath the v3 stream API should not be public. This
also removed a stray import of the package barrel from
`lib/src/message.dart`.

The ticket also covered `RealtimeChannel.joinPush` leaking the internal
`Push` type, but that field is already annotated `@internal`, so no
change was needed there.

## Notes

- Stacked on #1706; based on `feat/realtime-streams-v3`. Independent of
#1707.
- Deregisters the `Binding` symbols from `sdk-compliance.yaml`; local
symbol and drift checks pass.
- Adds a migration entry.

## Tests

All realtime unit tests (195) and the integration suite (both protocol
versions, run locally against a real Realtime server) pass, plus
`supabase` (134) and analyzer/DCM across the workspace.

Resolves SDK-1478
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