Skip to content

dataconnect(feature): AuthUserChangedException added - #8604

Merged
dconeybe merged 10 commits into
mainfrom
dconeybe/dataconnect/AuthUserChangedException
Sep 16, 2026
Merged

dconeybe merged 10 commits into
mainfrom
dconeybe/dataconnect/AuthUserChangedException

Conversation

@dconeybe

@dconeybe dconeybe commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

This PR augments the Data Connect public API with a deterministic way for applications to identify "user change" errors during realtime streaming query subscriptions. It replaces the internal FirebaseUserChangedException with a new public exception, AuthUserChangedException. This allows developers using the Android SDK to reliably and safely implement automatic re-subscription when the Firebase Auth user signs in or out, rather than relying on fragile exception message scraping.

Googlers see go/data-connect-firebase-user-changed-exception-api-proposal

Highlights

  • New Public Exception: Introduced AuthUserChangedException as a subclass of DataConnectException for explicitly bubbling up errors caused by a Firebase Auth user change mid-stream.
  • Error Handling Updates: Replaced internal usages of FirebaseUserChangedException in GRPC streaming logic with AuthUserChangedException.
  • Semantic Version Bump: Bumped the major version in gradle.properties since this introduces a semantic breaking change to error handling logic.
  • Test Updates: Updated query subscription unit tests to expect and assert AuthUserChangedException instead of the internal exception when auth states change.
Changelog
  • CHANGELOG.md
    • Tweaked to document the new AuthUserChangedException as a semantic change.
  • api.txt
    • Added formatting and API text update for AuthUserChangedException.
  • gradle.properties
    • Bumped major version since this is a semantic breaking change.
  • AuthIntegrationTest.kt
    • Updated to reflect changes to auth error handling logic.
  • AuthUserChangedException.kt
    • Introduced public AuthUserChangedException along with detailed KDoc comments.
  • DataConnectBidiConnectStream.kt
    • Updated stream error site to throw the new AuthUserChangedException code.
  • DataConnectGrpcRPCs.kt
    • Replaced internal usages of FirebaseUserChangedException with AuthUserChangedException and removed the old internal exception class.
  • QuerySubscriptionImplUnitTest.kt
    • Updated query subscription flow tests to verify that AuthUserChangedException is emitted when the auth UID changes mid-stream or during reconnection.

This replace the internal FirebaseUserChangedException with public AuthUserChangedException
to enable reliably detecting when a realtime streaming connection fails due to a change in the Firebase Auth user.

TAG=agy
CONV=a7a30ca1-060f-4738-b204-3fb32afda5d6
…ngedException

TAG=agy
CONV=a7a30ca1-060f-4738-b204-3fb32afda5d6
@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@dconeybe

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the public AuthUserChangedException class to replace the internal FirebaseUserChangedException, enabling clients to reliably detect when a realtime streaming connection fails due to a change in the Firebase Auth user. Corresponding updates have been made to the public API, tests, and core connection logic, along with a major version bump to 18.0.0. The feedback suggests removing the open modifier from AuthUserChangedException to make it final, as there is no current need for subclassing.

@github-actions

Copy link
Copy Markdown
Contributor

📝 PRs merging into main branch

Our main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released.

@dconeybe
dconeybe marked this pull request as ready for review September 16, 2026 00:12
Comment thread firebase-dataconnect/CHANGELOG.md
@dconeybe
dconeybe merged commit 842da43 into main Sep 16, 2026
49 checks passed
@dconeybe
dconeybe deleted the dconeybe/dataconnect/AuthUserChangedException branch September 16, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants