Skip to content

Initialize a new function as part of init dataconnect:resolver#9794

Open
rosalyntan wants to merge 14 commits intomainfrom
rosalyntan.resolver
Open

Initialize a new function as part of init dataconnect:resolver#9794
rosalyntan wants to merge 14 commits intomainfrom
rosalyntan.resolver

Conversation

@rosalyntan
Copy link
Member

@rosalyntan rosalyntan commented Jan 23, 2026

Description

In firebase init dataconnect:resolver, also initialize a new functions codebase with sample code demonstrating the use of the onGraphRequest method.

Note: As part of this change, I've also refactored the legacy doSetup method for the firebase init functions flow into separate askQuestions and actuate steps, which aligns with other products' init flows.

Future work: If there are existing Cloud Run functions already deployed, allow the user to select a function URL to be associated with their custom resolver schema and bypass initializing a new functions codebase.

Scenarios Tested

Typescript (with eslint): https://paste.googleplex.com/4671059091652608
Typescript (without eslint): https://paste.googleplex.com/4716839617822720

Javascript: (with eslint): https://paste.googleplex.com/6309290279305216
Javascript (without eslint): https://paste.googleplex.com/5223639467294720

Regression testing (firebase init functions): http://paste.googleplex.com/4665756417654784

Sample Commands

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @rosalyntan, 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 introduces a significant refactoring of the Firebase Functions initialization process, breaking down the monolithic doSetup function into distinct askQuestions and actuate phases. This modularization enables other Firebase initialization features, specifically dataconnect:resolver, to seamlessly incorporate the Functions setup flow, improving code organization and reusability across the firebase-tools project.

Highlights

  • Functions Initialization Refactoring: The functions initialization logic has been refactored, splitting the doSetup function into askQuestions and actuate to separate user interaction from execution.
  • Integration with DataConnect Resolver: The dataconnect:resolver initialization process now integrates the new functions.askQuestions and functions.actuate calls, allowing for a combined setup flow.
  • Simplified Internal Function Signatures: Several internal helper functions within the functions module (initNewCodebase, overwriteCodebase, languageSetup) have had their config parameter removed, streamlining their interfaces.
  • Module Export Updates: The src/init/features/index.ts and src/init/index.ts files have been updated to reflect the new askQuestions and actuate exports for the functions feature.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 refactors the Cloud Functions initialization feature to align with the askQuestions/actuate pattern, which is a good improvement for consistency. This change enables the dataconnect:resolver initialization to correctly trigger the functions setup flow. The refactoring is well-executed and the logic seems sound. I have one minor suggestion to improve code clarity by updating a comment that became misleading after the changes.

@rosalyntan
Copy link
Member Author

/gemini review

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 introduces a significant and well-executed refactoring of the functions initialization feature, splitting it into askQuestions and actuate phases. This change enables the primary goal of the PR: to initialize a new Cloud Function with sample code for onGraphRequest as part of the firebase init dataconnect:resolver flow. The changes are logical, the tests have been updated to reflect the new structure, and new templates for the resolver function are included. My main feedback is regarding a small amount of code duplication that could be addressed to improve long-term maintainability.

@rosalyntan rosalyntan marked this pull request as ready for review January 30, 2026 21:52
Copy link
Contributor

@fredzqm fredzqm left a comment

Choose a reason for hiding this comment

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

Didn't have time to do full review today.

Thinking of ways to make it easier:

  • Are there refactors on functions and genkit part that could be split out?
    Those part I don't feel less comfortable reviewing.
    Maybe we can square them away with eyes from their team.

  • The FDC part of the change is actually quite small, looks pretty reasonable to me at high-level. Since it's flag gated, we can certainly check them in, bugbash and iterate on it.

@inlined
Copy link
Member

inlined commented Feb 1, 2026

Can we set up a short meeting to discuss what you're doing? I have some thoughts and questions:

  1. Is it your desire that the canonical style of resolvers is to have a separate codebase, or is this specifically just a new template you can init with?
  2. If the latter, I'm wondering if I should pick back up a project I had on my backburner for 2025 before I left. I was going to generalize the normal functions init so that it could have a dialog asking you what kind of project you would init. We can have "hello world", "AI backend", "DataConnect resolver" etc. The plan of record was to rewrite init genkit to short circuit some of the new logic in that streamlined workflow. Would that work for you too? (I would assume you don't want to wait until I could create such a utility)

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.

3 participants