Skip to content

dataconnect: wire up DataSource for caching and extract entity IDs from response extensions#7814

Merged
dconeybe merged 7 commits into
mainfrom
dconeybe/dataconnect/DataSourcePropagation
Feb 20, 2026
Merged

dataconnect: wire up DataSource for caching and extract entity IDs from response extensions#7814
dconeybe merged 7 commits into
mainfrom
dconeybe/dataconnect/DataSourcePropagation

Conversation

@dconeybe
Copy link
Copy Markdown
Contributor

@dconeybe dconeybe commented Feb 18, 2026

This PR wires up the DataSource to indicate the origin of query results (cache or server) and implements the logic to extract entity paths and IDs from the GraphQL response extensions. These changes are critical for enabling fine-grained entity-level caching and normalization.

Highlights

  • DataSource Tracking: The QueryResult now includes a dataSource field, allowing consumers to know if the data was fetched from the CACHE or SERVER.
  • Entity Path Extraction: Implemented the logic to parse data_connect extensions in the GraphQL response to extract entity IDs and their corresponding paths. This enables the cache to correctly store and look up individual entities.
  • Test Coverage: Added new unit tests in DataConnectGrpcRPCsUnitTest.kt to verify the entity path extraction logic and cache behavior. Existing tests were updated to reflect the DataSource changes.
Changelog
  • CHANGELOG.md
    • Added an entry for wiring up DataSource and extracting entity paths.
  • DataConnectGrpcClient.kt
    • Updated OperationResult to include a source of type DataSource.
    • The source is now passed when creating OperationResult.
  • DataConnectGrpcRPCs.kt
    • Implemented getEntityIdForPathFunction to extract entity IDs and paths from the ExecuteQueryResponse extensions.
  • QueryRefImpl.kt
    • Updated execute to handle the new DataSourcePair returned from queryManager and pass the dataSource to QueryResultImpl.
  • Tests
    • Added DataConnectGrpcRPCsUnitTest.kt to test entity path extraction.
    • Updated DataConnectGrpcClientUnitTest.kt, MutationRefImplUnitTest.kt and QueryRefImplUnitTest.kt to reflect the DataSource in OperationResult.

…a server or cache, and implements getEntityIdForPathFunction to extract entity ID mapping from GraphQL response extensions.
@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

Customization

To customize 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 counter productive. 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 18, 2026

📝 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
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

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

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 wires up DataSource for caching and extracts entity IDs from response extensions, which is a significant step towards enabling offline caching. The changes correctly plumb the DataSource information through various layers of the architecture. The core logic for extracting entity IDs from ExecuteQueryResponse extensions is well-implemented in DataConnectGrpcRPCs.kt. The addition of new tests to cover this functionality is also a great inclusion. I have a few minor suggestions for refactoring to improve code clarity and conciseness.

@dconeybe dconeybe marked this pull request as ready for review February 18, 2026 20:40
aashishpatil-g
aashishpatil-g previously approved these changes Feb 18, 2026
@dconeybe dconeybe merged commit 9abe6f3 into main Feb 20, 2026
43 checks passed
@dconeybe dconeybe deleted the dconeybe/dataconnect/DataSourcePropagation branch February 20, 2026 21:41
@github-actions github-actions Bot mentioned this pull request Feb 21, 2026
@firebase firebase locked and limited conversation to collaborators Mar 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants