Skip to content

chore: move parameters to internal/util#1907

Merged
Yuan325 merged 2 commits into
mainfrom
move-parameters
Nov 13, 2025
Merged

chore: move parameters to internal/util#1907
Yuan325 merged 2 commits into
mainfrom
move-parameters

Conversation

@Yuan325

@Yuan325 Yuan325 commented Nov 8, 2025

Copy link
Copy Markdown
Contributor

To facilitate the transition of moving invocation implementation to Source, we will have to move parameter to internal/util. This approach is crucial because certain parameters may not be fully resolvable pre-implementation. Since both internal/sources and internal/tools will need access to parameters, it will be more relevant to move parameters implementation to utils.

@Yuan325 Yuan325 requested a review from a team November 8, 2025 03:00
@Yuan325 Yuan325 force-pushed the move-parameters branch 2 times, most recently from bf0569f to 018963f Compare November 13, 2025 00:43
@Yuan325 Yuan325 added the release candidate Use label to signal PR should be included in the next release. label Nov 13, 2025
@Yuan325 Yuan325 enabled auto-merge (squash) November 13, 2025 21:33
@Yuan325 Yuan325 merged commit 4aabb4a into main Nov 13, 2025
11 checks passed
@Yuan325 Yuan325 deleted the move-parameters branch November 13, 2025 21:37
rahulpinto19 pushed a commit that referenced this pull request Nov 18, 2025
To facilitate the transition of moving invocation implementation to
Source, we will have to move parameter to `internal/util`. This approach
is crucial because certain parameters may not be fully resolvable
pre-implementation. Since both `internal/sources` and `internal/tools`
will need access to `parameters`, it will be more relevant to move
parameters implementation to utils.
@Yuan325

Yuan325 commented Nov 25, 2025

Copy link
Copy Markdown
Contributor Author

/gemini help review this PR

@gemini-code-assist

Copy link
Copy Markdown
Contributor
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.

@Yuan325

Yuan325 commented Nov 25, 2025

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 codebase to move the parameters implementation to internal/util, making it accessible to both internal/sources and internal/tools. The changes are extensive and mostly correct. However, I've identified two critical copy-paste errors that introduce duplicate parameters in alloydbcreateuser and alloydbgetinstance tools, which would likely cause runtime failures. My review includes suggestions to remove the redundant code.

tools.NewStringParameterWithRequired("password", "A secure password for the new user. Required only for ALLOYDB_BUILT_IN userType.", false),
tools.NewArrayParameterWithDefault("databaseRoles", []any{}, "Optional. A list of database roles to grant to the new user (e.g., ['pg_read_all_data']).", tools.NewStringParameter("role", "A single database role to grant to the user (e.g., 'pg_read_all_data').")),
tools.NewStringParameter("userType", "The type of user to create. Valid values are: ALLOYDB_BUILT_IN and ALLOYDB_IAM_USER. ALLOYDB_IAM_USER is recommended."),
parameters.NewStringParameter("project", "The GCP project ID."),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

There is a duplicate project parameter being added to allParameters. The projectParam variable is already being added on line 83. This line is redundant and will cause issues with parameter parsing, such as panics due to duplicate keys in maps.

Comment on lines +87 to +89
parameters.NewStringParameter("location", "The location of the instance (e.g., 'us-central1')."),
parameters.NewStringParameter("cluster", "The ID of the cluster."),
parameters.NewStringParameter("instance", "The ID of the instance."),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

The parameters location, cluster, and instance are duplicated. This appears to be a copy-paste error and will cause issues with parameter parsing, such as panics due to duplicate keys in maps.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 codebase to move the parameters implementation to internal/util to facilitate its use across different packages. The changes are extensive, touching many files to update import paths and type references. Overall, the refactoring is well-executed. However, I've identified a couple of critical copy-paste errors that introduce duplicate parameters, which would lead to runtime panics. These need to be addressed to ensure the stability of the application.

tools.NewStringParameterWithRequired("password", "A secure password for the new user. Required only for ALLOYDB_BUILT_IN userType.", false),
tools.NewArrayParameterWithDefault("databaseRoles", []any{}, "Optional. A list of database roles to grant to the new user (e.g., ['pg_read_all_data']).", tools.NewStringParameter("role", "A single database role to grant to the user (e.g., 'pg_read_all_data').")),
tools.NewStringParameter("userType", "The type of user to create. Valid values are: ALLOYDB_BUILT_IN and ALLOYDB_IAM_USER. ALLOYDB_IAM_USER is recommended."),
parameters.NewStringParameter("project", "The GCP project ID."),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

This line duplicates the project parameter. projectParam is already added to allParameters on the preceding line. This duplication will cause a runtime error when initializing the tool. Please remove this line.

Comment on lines +87 to +89
parameters.NewStringParameter("location", "The location of the instance (e.g., 'us-central1')."),
parameters.NewStringParameter("cluster", "The ID of the cluster."),
parameters.NewStringParameter("instance", "The ID of the instance."),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

critical

These lines are duplicates of the location, cluster, and instance parameters defined on lines 84-86. This duplication will cause a runtime error. Please remove these duplicated lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release candidate Use label to signal PR should be included in the next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants