Fix second init on spark account not allowing choosing a sql instance#9504
Fix second init on spark account not allowing choosing a sql instance#9504
Conversation
Summary of ChangesHello @tammam-g, 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 an issue within the Spark account initialization process where users faced difficulties in selecting a SQL instance, particularly during a second initialization. The changes refine the user experience by providing more informative prompts regarding billing requirements for new CloudSQL instances and by ensuring that appropriate upgrade instructions are presented at the correct stage when a free trial has been utilized and a billing account is necessary. Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request refactors the Cloud SQL instance selection flow during firebase init dataconnect for users on the Spark plan. The changes correctly move the logic for handling billing requirements to a later stage, only after the user explicitly chooses to create a new paid instance. Additionally, the user-facing prompt is improved for clarity. The overall change improves the user experience and fixes the described issue. I have one minor suggestion to improve code clarity by removing a redundant fallback.
| setup.instructions.push( | ||
| upgradeInstructions(setup.projectId || "your-firebase-project", true), | ||
| ); |
There was a problem hiding this comment.
The promptForCloudSQL function includes a guard at the beginning (if (!setup.projectId) { return; }), which ensures that setup.projectId is always defined at this point in the code. Consequently, the fallback to "your-firebase-project" is redundant.
Removing this fallback and relying on the established contract that setup.projectId exists will make the code cleaner and prevent the generation of a non-functional URL in the unlikely scenario that the initial guard is removed and setup.projectId is falsy.
| setup.instructions.push( | |
| upgradeInstructions(setup.projectId || "your-firebase-project", true), | |
| ); | |
| setup.instructions.push( | |
| upgradeInstructions(setup.projectId!, true), | |
| ); |
…#9504) * Starting to make billing optional * Finish removing billing requirements * Fixing tests * Clean up * Format * One more usage of removed variable * Improve gating for when to indicate a free trial is avaialbe + format fixes * Fix inversed if statement * improves when messages show about free trial availability * Use expirement flag and make flow identical when flag is disabled * fix formatting * fix tests * cleanup * Fix tests * format fix * Fix init flow to allow choosing a free instance on repeated inits on spark accounts --------- Co-authored-by: Joe Hanley <joehanley@google.com>
Spark account can choose to use existing free instance or choose a new instance to be provisioned later

If new instance is chosen and free trial is used we will print upgrade instructions at the end