Skip to content

Add product_init_mcp and fix param of product_init #8928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 6, 2025

Conversation

fredzqm
Copy link
Contributor

@fredzqm fredzqm commented Aug 2, 2025

In Google Analytics, products_initialized is always empty because the init() shifts it to an empty list in the end.

Want to figure out how many time init dataconnect was called.

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 addresses a bug where the products_initialized parameter in Google Analytics events was consistently empty. It resolves this by ensuring that the list of initialized products is captured at the appropriate time, before subsequent operations might clear or modify this data, thereby providing accurate analytics data for product initialization.

Highlights

  • Data Capture Correction: The productsInitialized string, representing the list of features, is now captured before the init function is executed. This ensures that the correct and complete list of products is recorded for analytics.
  • Analytics Parameter Fix: The products_initialized parameter sent to the trackGA4 function now correctly uses the pre-captured productsInitialized value, resolving an issue where this parameter was previously empty.
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 or fill out our survey to provide feedback.

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 a bug where the products_initialized analytics parameter was always being sent as an empty string. The issue was that the list of features was being read after the init function had already processed and cleared it. By capturing the feature list in a variable before calling init, the fix ensures the correct data is sent for analytics. The change is well-targeted and effective. I have one minor suggestion to improve code clarity.

@@ -249,6 +249,7 @@ export async function initAction(feature: string, options: Options): Promise<voi
setup.features = setup.features.filter((f) => f !== "hosting:github");
}

const productsInitialized = setup.features?.join(",") || "";
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While this is correct, the optional chaining (?.) and the fallback to an empty string (|| "") are redundant here.

Based on the control flow in this function:

  • setup.features is assigned a value at either line 209 or 211.
  • The check at line 229 ensures that setup.features is a non-empty array, otherwise an error is thrown.

Therefore, setup.features is guaranteed to be a string[] with at least one element at this point, so you can safely call .join(',') directly. This makes the code slightly cleaner.

Suggested change
const productsInitialized = setup.features?.join(",") || "";
const productsInitialized = setup.features.join(",");

@fredzqm
Copy link
Contributor Author

fredzqm commented Aug 4, 2025

@joehan Please take a look~ Simple PR to fix init's GA metrics.

I was trying to figure out how many people ran firebase init dataconnect

@fredzqm fredzqm changed the title Fix products_initialized param of products_initialized GA stats Add product_init_mcp and fix param of products_init Aug 6, 2025
@fredzqm fredzqm changed the title Add product_init_mcp and fix param of products_init Add product_init_mcp and fix param of product_init Aug 6, 2025
@fredzqm fredzqm merged commit 0341624 into master Aug 6, 2025
77 of 78 checks passed
@fredzqm fredzqm deleted the fz/products_initialized branch August 6, 2025 20:59
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions Aug 6, 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