-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: remove obsolete parseTriggers fallback #9521
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
base: next
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @taeold, 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 significantly refactors the function trigger parsing mechanism by removing an obsolete fallback that supported older versions of the Firebase Functions SDK. By dropping support for SDK versions prior to 3.20.0, the codebase is streamlined, and a more robust error-handling approach is implemented for incompatible SDK versions. This change ensures that the system operates with modern SDK features and reduces technical debt. 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.
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 effectively removes the obsolete parseTriggers fallback mechanism for older Firebase Functions SDK versions. The changes are clean and focused, including the removal of related files and tests. A new test has been added to ensure that an error is thrown for unsupported SDK versions, which is a great addition. My only concern is a small, potentially out-of-scope change in the webpack configuration that should be clarified.
a60738d to
e8ef72d
Compare
e8ef72d to
bf66853
Compare
|
/gemini review |
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 effectively removes the obsolete parseTriggers fallback mechanism, which simplifies the codebase by deleting several files and their associated tests. The logic is correctly updated to enforce a minimum Firebase Functions SDK version by throwing an error instead of falling back, which is a sound approach for a major version update. The changes are clean and well-tested. I have one minor suggestion to improve code readability.
| if (!semver.valid(this.sdkVersion)) { | ||
| logger.debug( | ||
| `Could not parse firebase-functions version '${this.sdkVersion}' into semver. Falling back to parseTriggers.`, | ||
| ); | ||
| return parseTriggers.discoverBuild(this.projectId, this.sourceDir, this.runtime, config, env); | ||
| } | ||
| if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION)) { | ||
| logLabeledWarning( | ||
| "functions", | ||
| `You are using an old version of firebase-functions SDK (${this.sdkVersion}). ` + | ||
| `Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION}`, | ||
| ); | ||
| return parseTriggers.discoverBuild(this.projectId, this.sourceDir, this.runtime, config, env); | ||
| } | ||
| // Perform a check for the minimum SDK version that added annotation support for the `Build.extensions` property | ||
| // and log to the user explaining why they need to upgrade their version. | ||
| if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES)) { | ||
| logLabeledBullet( | ||
| "functions", | ||
| `You are using a version of firebase-functions SDK (${this.sdkVersion}) that does not have support for the newest Firebase Extensions features. ` + | ||
| `Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES} to use them correctly`, | ||
| ); | ||
| logger.debug(`Could not parse firebase-functions version '${this.sdkVersion}' into semver.`); | ||
| } else { | ||
| if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION)) { | ||
| throw new FirebaseError( | ||
| `You are using an old version of firebase-functions SDK (${this.sdkVersion}). ` + | ||
| `Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION}`, | ||
| ); | ||
| } | ||
| // Perform a check for the minimum SDK version that added annotation support for the `Build.extensions` property | ||
| // and log to the user explaining why they need to upgrade their version. | ||
| if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES)) { | ||
| logLabeledBullet( | ||
| "functions", | ||
| `You are using a version of firebase-functions SDK (${this.sdkVersion}) that does not have support for the newest Firebase Extensions features. ` + | ||
| `Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES} to use them correctly`, | ||
| ); | ||
| } | ||
| } |
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.
For better readability, you could invert the if/else to handle the valid semver case first. This avoids nesting the main logic within an else block and follows a more common pattern of handling the success path before the error/edge case path.
| if (!semver.valid(this.sdkVersion)) { | |
| logger.debug( | |
| `Could not parse firebase-functions version '${this.sdkVersion}' into semver. Falling back to parseTriggers.`, | |
| ); | |
| return parseTriggers.discoverBuild(this.projectId, this.sourceDir, this.runtime, config, env); | |
| } | |
| if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION)) { | |
| logLabeledWarning( | |
| "functions", | |
| `You are using an old version of firebase-functions SDK (${this.sdkVersion}). ` + | |
| `Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION}`, | |
| ); | |
| return parseTriggers.discoverBuild(this.projectId, this.sourceDir, this.runtime, config, env); | |
| } | |
| // Perform a check for the minimum SDK version that added annotation support for the `Build.extensions` property | |
| // and log to the user explaining why they need to upgrade their version. | |
| if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES)) { | |
| logLabeledBullet( | |
| "functions", | |
| `You are using a version of firebase-functions SDK (${this.sdkVersion}) that does not have support for the newest Firebase Extensions features. ` + | |
| `Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES} to use them correctly`, | |
| ); | |
| logger.debug(`Could not parse firebase-functions version '${this.sdkVersion}' into semver.`); | |
| } else { | |
| if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION)) { | |
| throw new FirebaseError( | |
| `You are using an old version of firebase-functions SDK (${this.sdkVersion}). ` + | |
| `Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION}`, | |
| ); | |
| } | |
| // Perform a check for the minimum SDK version that added annotation support for the `Build.extensions` property | |
| // and log to the user explaining why they need to upgrade their version. | |
| if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES)) { | |
| logLabeledBullet( | |
| "functions", | |
| `You are using a version of firebase-functions SDK (${this.sdkVersion}) that does not have support for the newest Firebase Extensions features. ` + | |
| `Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES} to use them correctly`, | |
| ); | |
| } | |
| } | |
| if (semver.valid(this.sdkVersion)) { | |
| if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION)) { | |
| throw new FirebaseError( | |
| `You are using an old version of firebase-functions SDK (${this.sdkVersion}). ` + | |
| `Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION}`, | |
| ); | |
| } | |
| // Perform a check for the minimum SDK version that added annotation support for the `Build.extensions` property | |
| // and log to the user explaining why they need to upgrade their version. | |
| if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES)) { | |
| logLabeledBullet( | |
| "functions", | |
| `You are using a version of firebase-functions SDK (${this.sdkVersion}) that does not have support for the newest Firebase Extensions features. ` + | |
| `Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION_FOR_EXTENSIONS_FEATURES} to use them correctly`, | |
| ); | |
| } | |
| } else { | |
| logger.debug(`Could not parse firebase-functions version '${this.sdkVersion}' into semver.`); | |
| } |
This PR removes the obsolete
parseTriggers.tsand related files (triggerParser.js,extractTriggers.js), which were used as a fallback for parsing function triggers in older versions of the Firebase Functions SDK.This is part of a major version update and drops support for SDK versions older than 3.20.0.