Skip to content

Conversation

@kabir
Copy link
Collaborator

@kabir kabir commented Nov 20, 2025

This came up in a Gemini review on the backport to 0.3.x

This is a follow up for PR #468 and issue #467

This came up in a Gemini review on the backport to 0.3.x
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kabir, 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 addresses a code quality improvement by extracting hardcoded configuration property keys into dedicated private static final String constants. This change significantly enhances the maintainability and readability of the codebase by providing a single, type-safe source of truth for configuration property names, thereby mitigating potential runtime errors caused by mistyped strings. It is a follow-up action based on a previous review and related issues.

Highlights

  • Configuration Key Refactoring: Replaced hardcoded string literals used for configuration property keys with private static final String constants across multiple classes.
  • Improved Maintainability: Centralizing configuration property names into constants enhances code readability, simplifies future modifications, and reduces the risk of typographical errors.
  • Consistency Across Modules: This refactoring was applied to components within the task-store-database-jpa, microprofile-config (tests), and server-common modules, promoting a consistent approach to configuration access.
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 is a good step towards improving code maintainability by replacing hardcoded configuration property keys with constants. The changes are applied consistently across several files.

I have a few suggestions to further improve the code by reducing duplication:

  • In AsyncExecutorProducer.java, I suggest making the new constants public to allow reuse.
  • In MicroProfileConfigProviderTest.java, this would allow removing duplicated constant definitions and an unused import.

This will centralize the constants, reduce duplication, and make future changes easier.

Also, there's a small typo in the pull request title ('confg' instead of 'config').

Comment on lines +20 to +22
private static final String A2A_EXECUTOR_CORE_POOL_SIZE = "a2a.executor.core-pool-size";
private static final String A2A_EXECUTOR_MAX_POOL_SIZE = "a2a.executor.max-pool-size";
private static final String A2A_EXECUTOR_KEEP_ALIVE_SECONDS = "a2a.executor.keep-alive-seconds";
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

These constants are duplicates of those defined in AsyncExecutorProducer. To improve maintainability, you can remove them and instead import the public constants from AsyncExecutorProducer (as suggested in another comment).

After removing these lines, you can add static imports like this at the top of the file:

import static io.a2a.server.util.async.AsyncExecutorProducer.*;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I decided I didn't want to make them public, since the javadoc becomes a bit strange then. It is already written on the fields where this ends up.

Comment on lines +25 to +27
private static final String A2A_EXECUTOR_CORE_POOL_SIZE = "a2a.executor.core-pool-size";
private static final String A2A_EXECUTOR_MAX_POOL_SIZE = "a2a.executor.max-pool-size";
private static final String A2A_EXECUTOR_KEEP_ALIVE_SECONDS = "a2a.executor.keep-alive-seconds";
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

These constants are also defined in MicroProfileConfigProviderTest. To avoid duplication, you could change their visibility to public. This would allow them to be reused in the test class, creating a single source of truth for these property keys and improving maintainability.

Suggested change
private static final String A2A_EXECUTOR_CORE_POOL_SIZE = "a2a.executor.core-pool-size";
private static final String A2A_EXECUTOR_MAX_POOL_SIZE = "a2a.executor.max-pool-size";
private static final String A2A_EXECUTOR_KEEP_ALIVE_SECONDS = "a2a.executor.keep-alive-seconds";
public static final String A2A_EXECUTOR_CORE_POOL_SIZE = "a2a.executor.core-pool-size";
public static final String A2A_EXECUTOR_MAX_POOL_SIZE = "a2a.executor.max-pool-size";
public static final String A2A_EXECUTOR_KEEP_ALIVE_SECONDS = "a2a.executor.keep-alive-seconds";

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as above

@ehsavoie ehsavoie merged commit f7530b7 into a2aproject:main Nov 20, 2025
10 checks passed
@jmesnil jmesnil added this to the 1.0.0 milestone Dec 11, 2025
kabir added a commit to kabir/a2a-java that referenced this pull request Dec 23, 2025
This came up in a Gemini review on the backport to 0.3.x

This is a follow up for PR a2aproject#468 and issue a2aproject#467
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.

4 participants