Skip to content

Conversation

@fredzqm
Copy link
Contributor

@fredzqm fredzqm commented Aug 29, 2025

While switching fdc generate to fdc sdk generate cmd, I found this bug.

fdc sdk generate --watch would hang with no output and wait for any file changes.

The previous behavior hangs because the cmd never exits.
This PR changed it to pipe stdout, so developers can see what it's doing behind the scenes.

Screenshot 2025-09-02 at 3 43 36 PM

Copy link
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.

Summary of Changes

Hello @fredzqm, 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 resolves a critical logging issue with the firebase dataconnect:sdk:generate --watch command, ensuring that all output from the SDK generation process is properly displayed. It also refactors the underlying SDK generation mechanism to be more efficient and aligned with the Data Connect toolkit's design, improving the overall developer experience when generating client SDKs.

Highlights

  • Fix dataconnect:sdk:generate --watch logging: Addresses a bug where the firebase dataconnect:sdk:generate --watch command would "swallow" or suppress logs from the underlying SDK generation process, making it difficult to see real-time output.
  • Improved SDK generation process: The SDK generation logic has been refactored to call the underlying Data Connect toolkit once per service that has declared SDKs, rather than iterating and calling it per connector. This streamlines the process and aligns with the toolkit's expected behavior.
  • Enhanced log streaming: The internal DataConnectEmulator.generate method now uses childProcess.spawn with stdio: "inherit". This change ensures that output from the external SDK generation tool is directly streamed to the console, resolving the log suppression issue.
  • Simplified generate arguments: The connectorId argument has been removed from the DataConnectGenerateArgs interface and subsequent calls, as the SDK generation process is now handled at the service level rather than per individual connector.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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
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 correctly fixes an issue where logs were being swallowed by the firebase dataconnect:sdk:generate --watch command. The change from a synchronous spawnSync to an asynchronous spawn with inherited stdio is the right approach. The related API changes are consistent and well-implemented. I have one suggestion to improve the clarity and consistency of the new asynchronous error handling.

@fredzqm fredzqm requested a review from joehan August 29, 2025 20:04
@fredzqm
Copy link
Contributor Author

fredzqm commented Aug 29, 2025

[not urgent] While swapping fdc generate to fdc sdk generate, I found this bug.

Please take a look~ Not in a rush

@fredzqm fredzqm requested a review from yuchenshi September 2, 2025 20:20
// Handle errors like command not found
reject(err);
});
} catch (e: any) {
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure errors like missing Rosetta will be caught by this block, not the proc.on("error") above? I doubt spawn throws synchronously (as opposed to spawnSync).

Consider rejecting all errors in the Promise constructor and chaining .catch(...) to handle errors there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This logic is copied from _runBinary here

To answer your question, honestly I am not sure. I don't know how to re-produce the original error.

We should probably extract a helper to run long-running emulator-ish binary process.

Can we do that separately? This bug here is pretty bad.

Copy link
Member

Choose a reason for hiding this comment

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

Okay fair enough. Feel free to split that into a follow-up

@github-project-automation github-project-automation bot moved this to Changes Requested [PR] in [Cloud] Extensions + Functions Sep 2, 2025
// Handle errors like command not found
reject(err);
});
} catch (e: any) {
Copy link
Member

Choose a reason for hiding this comment

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

Okay fair enough. Feel free to split that into a follow-up

@github-project-automation github-project-automation bot moved this from Changes Requested [PR] to Approved [PR] in [Cloud] Extensions + Functions Sep 2, 2025
@fredzqm fredzqm merged commit 59fa61e into master Sep 3, 2025
48 checks passed
@fredzqm fredzqm deleted the fz/sdk-cmd branch September 3, 2025 00:08
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants