-
Notifications
You must be signed in to change notification settings - Fork 106
chore: 553: Addressed PR comments from Pull request 564. #598
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
chore: 553: Addressed PR comments from Pull request 564. #598
Conversation
Summary of ChangesHello @Sathyvs, 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 refines the pagination feature for 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 addresses feedback from a previous one, primarily by making the page size for push notification configuration pagination configurable. The changes are generally well-implemented. I've identified a few areas for improvement: enhancing the robustness of configuration loading, correcting some inconsistencies in a new test case, and resolving a duplicate dependency in a pom.xml file. My detailed comments provide specific suggestions for each of these points.
server-common/pom.xml
Outdated
| <dependency> | ||
| <groupId>io.quarkus</groupId> | ||
| <artifactId>quarkus-arc</artifactId> | ||
| </dependency> |
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.
This change introduces a duplicate dependency on io.quarkus:quarkus-arc. An existing dependency is declared on lines 63-84 with test scope. Having duplicate dependencies can cause issues with dependency resolution and is generally bad practice.
Please remove this new dependency block. If quarkus-arc is needed at compile time, the scope of the existing dependency declaration should be changed from test to compile (by removing the <scope>test</scope> element).
| void initConfig() { | ||
| maxPageSize = Integer.parseInt(configProvider.getValue(A2A_PUSH_NOTIFICATION_MAX_PAGE_SIZE)); | ||
| } |
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.
The initConfig method is not robust against potential configuration errors. If the a2a.push-notification-config.max-page-size property is misconfigured with a non-numeric value, Integer.parseInt will throw a NumberFormatException, causing the application startup to fail. While failing fast is a valid strategy for configuration errors, a more resilient approach would be to handle this exception, log a warning, and fall back to a sensible default value (e.g., 100, as mentioned in the Javadoc).
void initConfig() {
try {
maxPageSize = Integer.parseInt(configProvider.getValue(A2A_PUSH_NOTIFICATION_MAX_PAGE_SIZE));
} catch (NumberFormatException | IllegalArgumentException e) {
LOGGER.warn("Failed to read '{}' configuration, falling back to default page size of 100.", A2A_PUSH_NOTIFICATION_MAX_PAGE_SIZE, e);
maxPageSize = 100;
}
}| // Should return 2 configs (capped to maxPageSize from test config), not 5 | ||
| assertEquals(5, result.configs().size(), | ||
| "Page size should be capped to configured maxPageSize (5 in tests) when requested size exceeds limit"); |
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.
The comment on line 567 is misleading. It states that 2 configs should be returned, but the test's configured maxPageSize is 5, and the assertion correctly checks for 5. The comment should be updated to reflect the actual expected behavior.
| // Should return 2 configs (capped to maxPageSize from test config), not 5 | |
| assertEquals(5, result.configs().size(), | |
| "Page size should be capped to configured maxPageSize (5 in tests) when requested size exceeds limit"); | |
| // Should return 5 configs (capped to maxPageSize from test config), not 7 | |
| assertEquals(5, result.configs().size(), | |
| "Page size should be capped to configured maxPageSize (5 in tests) when requested size exceeds limit"); |
| assertEquals(7, allConfigIds.size(), | ||
| "Should retrieve all 5 configs across multiple pages"); |
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.
The assertion message here contains a typo. It should state that all 7 configs are expected to be retrieved, not 5.
| assertEquals(7, allConfigIds.size(), | |
| "Should retrieve all 5 configs across multiple pages"); | |
| assertEquals(7, allConfigIds.size(), | |
| "Should retrieve all 7 configs across multiple pages"); |
97d6644 to
1277f24
Compare
Changes related to PushNotificationConfig pagination feature
Description
Addressed PR comments and nitpicks from PR 564
Fixes #553 🦕