Initial refactor for moving secret logic to index.ts#10010
Conversation
Summary of ChangesHello, 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 focuses on improving the modularity and maintainability of the secret management functionality. By centralizing the Highlights
🧠 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. Changelog
Activity
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 logic for the apphosting:secrets:set command by moving it from the command definition file into a reusable action function in src/apphosting/secrets/index.ts. This is a good change that improves code organization and testability. The signature of selectBackendServiceAccounts was also improved to be more type-safe, removing an any type. I've found a couple of issues related to handling non-interactive mode in the new action function, which could cause the command to hang or fail when run in a CI/CD environment. My suggestions address these issues.
| const type = await prompt.select({ | ||
| message: "Is this secret for production or only local testing?", | ||
| choices: [ | ||
| { name: "Production", value: "production" }, | ||
| { name: "Local testing only", value: "local" }, | ||
| ], | ||
| }); |
There was a problem hiding this comment.
This prompt.select call does not handle non-interactive mode. If this command is run with a --non-interactive flag (for example, in a CI environment), it will throw an error because there is no default value provided. You should pass the nonInteractive flag and provide a sensible default.
const type = await prompt.select({
message: "Is this secret for production or only local testing?",
choices: [
{ name: "Production", value: "production" },
{ name: "Local testing only", value: "local" },
],
nonInteractive: !!nonInteractive,
default: "production",
});| const emailList = await prompt.input({ | ||
| message: | ||
| "Please enter a comma separated list of user or groups who should have access to this secret:", | ||
| }); |
There was a problem hiding this comment.
Similar to the previous prompt, this prompt.input call does not handle non-interactive mode and will cause an error. You should pass the nonInteractive flag and provide a default value.
const emailList = await prompt.input({
message:
"Please enter a comma separated list of user or groups who should have access to this secret:",
nonInteractive: !!nonInteractive,
default: "",
});
joehan
left a comment
There was a problem hiding this comment.
This change looks good to me, tho it seems like there are some existing issues that you could fix in the drive-by if you want
|
LGTM, we discussed non-interactive mode offline and agreed about the defaults for prod vs local |
Initial refactor for moving secret logic to index.ts (#10010)
Initial refactor for moving secret logic to index.ts