-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
There was a problem hiding this 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 theinit
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 thetrackGA4
function now correctly uses the pre-capturedproductsInitialized
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
-
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. ↩
There was a problem hiding this 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.
src/commands/init.ts
Outdated
@@ -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(",") || ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
const productsInitialized = setup.features?.join(",") || ""; | |
const productsInitialized = setup.features.join(","); |
@joehan Please take a look~ Simple PR to fix init's GA metrics. I was trying to figure out how many people ran |
products_initialized
param of products_initialized GA statsproduct_init_mcp
and fix param of products_init
product_init_mcp
and fix param of products_init
product_init_mcp
and fix param of product_init
In Google Analytics,
products_initialized
is always empty because theinit()
shifts it to an empty list in the end.Want to figure out how many time
init dataconnect
was called.