Skip to content

feat(data-connect): refactor streaming tests and ensure synchronicity of invokeQuery/invokeMutation#9723

Merged
stephenarosaj merged 23 commits intopasta/mainfrom
pasta/pre-orzo
Mar 17, 2026
Merged

feat(data-connect): refactor streaming tests and ensure synchronicity of invokeQuery/invokeMutation#9723
stephenarosaj merged 23 commits intopasta/mainfrom
pasta/pre-orzo

Conversation

@stephenarosaj
Copy link
Copy Markdown
Contributor

@stephenarosaj stephenarosaj commented Mar 16, 2026

Refactor streaming tests before adding further functionality. Also called out the assumption that invokeQuery and invokeMutation must make tracking state changes synchronously and re-ordered operations within these methods to lower the chances of future changes introducing asynchronous functionality which prevents tracking from happening before a promise is returned to the caller.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 16, 2026

🦋 Changeset detected

Latest commit: 1ca6d55

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@firebase/data-connect Minor
firebase Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the existing streaming tests to enhance their structure, readability, and maintainability. The primary goal is to prepare the test suite for future feature additions by improving its organization and clarity, without altering any existing application behavior. This includes minor adjustments to variable names, test ordering, and the nesting of test descriptions.

Highlights

  • Test Refactoring: The streaming tests have been refactored for improved readability and maintainability, including adjustments to variable names and test structure.
  • No Functional Changes: This pull request introduces no changes to the existing functionality of the application; it strictly focuses on test code improvements.
  • Method Signature Update: The sendMessage method in TestStreamTransport and TransportWithInternals was updated to return Promise<void> instead of void.
  • Test Cleanup: An afterEach hook was added to restore Sinon spies after each test, ensuring a clean test environment.
  • Test Organization: Test descriptions (describe blocks) were further nested to logically group related tests, enhancing the overall structure of the test suite.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • packages/data-connect/test/unit/streamTransport.test.ts
    • Updated the sendMessage method signature in TestStreamTransport and TransportWithInternals to return Promise<void>.
    • Added an afterEach hook to restore Sinon spies after each test.
    • Introduced new mutationName constants for use in tests.
    • Restructured test descriptions by nesting describe blocks for invokeQuery, invokeMutation, invokeSubscribe, and invokeUnsubscribe within 'Incoming Requests from Transport Layer' and 'Incoming Responses from Server' sections.
    • Adjusted the invokeQuery tracking and invokeMutation tracking tests to ensure that maps are cleaned up correctly after responses are received.
    • Added an afterEach hook to reset spy history in the invokeSubscribe tracking tests.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
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 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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 refactors the streaming transport tests by improving test structure, adding cleanup hooks, and enhancing assertions. While these are positive changes, there's a critical issue where the sendMessage method signature in the test transport implementation was changed to be async, making it incompatible with the synchronous signature in the abstract base class. This will cause a compilation failure and needs to be addressed by either reverting the change or updating the base class and all its call sites to be asynchronous.

Comment thread packages/data-connect/test/unit/streamTransport.test.ts
@stephenarosaj stephenarosaj marked this pull request as ready for review March 16, 2026 17:11
Comment thread packages/data-connect/test/unit/streamTransport.test.ts Outdated
Comment thread packages/data-connect/test/unit/streamTransport.test.ts Outdated
Comment thread packages/data-connect/test/unit/streamTransport.test.ts
@stephenarosaj stephenarosaj changed the title feat(fdc): refactor streaming tests feat(fdc): refactor streaming tests and ensure synchronicity of invokeQuery/invokeMutation Mar 16, 2026
Comment thread packages/data-connect/test/unit/streamTransport.test.ts Outdated
Comment thread packages/data-connect/test/unit/streamTransport.test.ts Outdated
@stephenarosaj stephenarosaj requested review from a team as code owners March 17, 2026 15:10
@stephenarosaj stephenarosaj merged commit dd8c159 into pasta/main Mar 17, 2026
29 checks passed
@stephenarosaj stephenarosaj deleted the pasta/pre-orzo branch March 17, 2026 15:23
@stephenarosaj stephenarosaj changed the title feat(fdc): refactor streaming tests and ensure synchronicity of invokeQuery/invokeMutation feat(data-connect): refactor streaming tests and ensure synchronicity of invokeQuery/invokeMutation Apr 7, 2026
@firebase firebase locked and limited conversation to collaborators Apr 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants