Skip to content

refactor(client-presence): Remove all usage of audience #24879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

WillieHabi
Copy link
Contributor

Description

We currently use audience.removeMember in presence to track when remote clients disconnect. To move off this dependency, we use a combination of ClientLeave signals sent from service and Quroum removeMember events to track the disconnections of read and write clients respectively.

We also remove the checks we make against audience to verify connection status of remote clients in system workspace. We instead mark remote disconnections within the datastore to know which connectionIds are inactive.

@Copilot Copilot AI review requested due to automatic review settings June 19, 2025 22:30
@github-actions github-actions bot added area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: loader Loader related issues area: runtime Runtime related issues base: main PRs targeted against main branch labels Jun 19, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the client presence logic by removing all dependencies on the “audience” API and introducing a remoteDisconnected signal alongside datastore flags to track client disconnections.

  • Emit a new remoteDisconnected event from the runtime on incoming ClientLeave signals.
  • Remove getAudience calls and replace audience.removeMember with remoteDisconnect.
  • Expand the datastore schema to mark connections as disconnected instead of querying audience membership.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/runtime/container-runtime/src/containerRuntime.ts Added inbound signal handler to emit remoteDisconnected.
packages/runtime/container-runtime-definitions/src/containerExtension.ts Removed getAudience, added remoteDisconnected to the event interface.
packages/loader/container-loader/src/deltaManager.ts (Unintentional) stray empty string literal inserted.
packages/framework/presence/src/test/presenceManager.spec.ts Updated tests to call remoteDisconnect instead of removeMember.
packages/framework/presence/src/test/mockEphemeralRuntime.ts Removed MockAudience support and added remoteDisconnect logic.
packages/framework/presence/src/systemWorkspace.ts Removed audience import, added disconnected flag to state and logic.
packages/framework/presence/src/presenceManager.ts Switched from audience removeMember listener to remoteDisconnected.
packages/framework/presence/src/datastorePresenceManagerFactory.ts Removed getAudience binding.

WillieHabi and others added 2 commits June 19, 2025 18:30
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions bot removed the area: loader Loader related issues label Jun 20, 2025
@WillieHabi WillieHabi changed the title Draft - refactor(client-presence): Remove all usage of audience refactor(client-presence): Remove all usage of audience Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: runtime Runtime related issues base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant