Skip to content

Firestore (Desktop): send current user agent with every request - #1987

Merged
AustinBenoit merged 4 commits into
mainfrom
fix/firestore-desktop-user-agent
Nov 25, 2026
Merged

AustinBenoit merged 4 commits into
mainfrom
fix/firestore-desktop-user-agent

Conversation

@AustinBenoit

Copy link
Copy Markdown
Contributor

Description

On desktop, FirebaseMetadataProviderCpp previously sent the user agent stored inside today's heartbeat once per day and omitted x-firebase-client on subsequent requests. Because that heartbeat is logged during App::Create() before Firestore registers fire-fst, desktop Firestore usage was largely unattributed.

Match the Android and iOS metadata providers:

  • Send the current App::GetUserAgent() in x-firebase-client on every gRPC request.
  • Attach x-firebase-client-log-type: 2 at most once per day using GetAndResetTodaysStoredHeartbeats().

Testing

  • Compiled firebase_metadata_provider_desktop.cc.o locally on Linux (clang-19).
  • Passed scripts/gha/check_copyright.sh -g and scripts/format_code.py -git_diff -noformat_file.
  • Relying on CI for cross-platform builds and integration tests.

Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

The desktop metadata provider sent the user agent stored with the day's heartbeat, once a day, and nothing on other requests. That heartbeat is logged when the App is created, before Firestore registers fire-fst, so desktop Firestore usage was mostly unattributed.

Match the Android and iOS providers: flag one request per day as the heartbeat, and send the current App::GetUserAgent() on every request.

@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 updates the desktop Firestore metadata provider to always send the current Firebase user agent with each request, aligning its behavior with the Android and iOS SDKs, and updates the release notes. The review feedback correctly identifies a potential null pointer dereference risk if App::GetUserAgent() returns nullptr, recommending a defensive check before adding the user agent to the metadata.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Comment thread release_build_files/readme.md Outdated
## Release Notes
### Upcoming
- Changes
- Firestore (Desktop): Firestore now sends the current Firebase user

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.

I don't think change needs a readme change, since this shouldn't really impact users.

@AustinBenoit
AustinBenoit enabled auto-merge (squash) November 25, 2026 03:12
@AustinBenoit AustinBenoit added the skip-release-notes Skip release notes check label Nov 25, 2026
@AustinBenoit
AustinBenoit merged commit f98deb6 into main Nov 25, 2026
42 of 55 checks passed
@github-actions github-actions Bot added the tests: in-progress This PR's integration tests are in progress. label Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

✅  Integration test succeeded!

Requested by @AustinBenoit on commit f98deb6
Last updated: Tue Nov 24 21:07 PST 2026
View integration test log & download artifacts

@github-actions github-actions Bot added the tests: succeeded This PR's integration tests succeeded. label Nov 25, 2026
@firebase-workflow-trigger firebase-workflow-trigger Bot removed the tests: in-progress This PR's integration tests are in progress. label Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-release-notes Skip release notes check tests: succeeded This PR's integration tests succeeded.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants