8000
Skip to content

dataconnect(change): Implement FetchPolicy.SERVER_ONLY - #7887

Merged
dconeybe merged 8 commits into
mainfrom
dconeybe/dataconnect/FetchPolicy4
Mar 9, 2026
Merged

dataconnect(change): Implement FetchPolicy.SERVER_ONLY#7887
dconeybe merged 8 commits into
mainfrom
dconeybe/dataconnect/FetchPolicy4

Conversation

@dconeybe
@dconeybe dconeybe commented Mar 9, 2026
Copy link
Copy Markdown
Contributor

This PR implements the dataconnect SERVER_ONLY fetch policy for the executeQuery method. This ensures that queries executed with this policy will strictly retrieve data from the server, while correctly interacting with the local cache by updating it and bypassing any previously cached results.

Highlights

  • Implement SERVER_ONLY policy: Added support for FetchPolicy.SERVER_ONLY in DataConnectGrpcRPCs.kt when executing queries, guaranteeing that it fetches results from the server instead of the local cache.
  • Expanded integration tests: Added tests to QueryCachingIntegrationTest.kt to ensure SERVER_ONLY correctly returns server data regardless of cache age or availability.
  • Updated unit tests: Modified DataConnectGrpcRPCsUnitTest.kt to verify that SERVER_ONLY bypasses the cache, properly updates cached entities, and correctly retrieves both non-normalized and normalized results.
Changelog
  • CHANGELOG.md
    • Updated the changelog entry to include the PR number.
  • QueryCachingIntegrationTest.kt
    • Added integration tests verifying FetchPolicy.SERVER_ONLY behavior under various cache conditions (e.g., maxAge limits, missing cache data).
    • Refactored executeCreateQueryUpdateQueryTest to use a data class for strings, and simplified the verification logic to accommodate the new fetch policy.
  • DataConnectGrpcRPCs.kt
    • Updated executeQuery to accept and process FetchPolicy.SERVER 8000 _ONLY.
    • Adjusted the execution flow so that queries using SERVER_ONLY skip pulling from the cache, while still proceeding to update the cache when a result is received from the server.
  • DataConnectGrpcRPCsUnitTest.kt
    • Renamed the test class to DataConnectGrpcRPCsUnitTest for consistency.
    • Replaced assumeTrue stubs with actual unit tests verifying the behavior of SERVER_ONLY.
    • Added toExecuteQueryResponse extension methods for configuring mock responses in tests.

@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.

@dconeybe
dconeybe commented Mar 9, 2026
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 successfully implements the SERVER_ONLY fetch policy for executeQuery. The changes correctly bypass the cache for reads while still updating it with server results. The accompanying tests are thorough, covering both the new policy's behavior and its interaction with the cache. I've made a couple of suggestions to improve the clarity of test names for better maintainability, but overall this is a solid contribution.

@github-actions
github-actions Bot commented Mar 9, 2026
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 March 9, 2026 23:26
@dconeybe
dconeybe merged commit 171b67c into main Mar 9, 2026
43 checks passed
@dconeybe
dconeybe deleted the dconeybe/dataconnect/FetchPolicy4 branch March 9, 2026 23:26
@github-actions github-actions Bot mentioned this pull request Mar 10, 2026
@firebase firebase locked and limited conversation to collaborators Apr 9, 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

0