Skip to content

Conversation

@blakeli0
Copy link
Contributor

Filter out non-semver versions in update_generation_config.sh. This is a follow up fix for googleapis/google-cloud-java#11831. The original logic caused the generation PR googleapis/google-cloud-java#11822 on the main branch to get the RC version of gapic-generator-java and fail the compilation.

@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Dec 15, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @blakeli0, 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 critical issue in the version selection logic used for generating client libraries. By refining how the latest released version of gapic-generator-java is identified, it prevents the system from inadvertently picking up pre-release or non-standard versions. This ensures that only stable, production-ready versions are used, thereby improving the reliability and stability of the automated client library generation process and preventing build failures.

Highlights

  • Version Filtering Logic: Implemented a more robust version filtering mechanism in update_generation_config.sh to ensure only strictly semantic versions (e.g., X.Y.Z) are considered when determining the latest released version.
  • Bug Fix for Generation PRs: This change resolves an issue where previous logic could inadvertently select release candidate (RC) versions of gapic-generator-java, leading to compilation failures in automated generation pull requests.
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.

@blakeli0 blakeli0 requested a review from JoeWang1127 December 15, 2025 22:21
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 updates the script for finding the latest version of Maven artifacts to filter out pre-release versions. The change replaces xmllint with a shell pipeline using grep, sed, sort, and tail to parse versions from maven-metadata.xml.

My review suggests a significant simplification. Instead of manually parsing and filtering versions, the script can directly use the <release> tag from the Maven metadata. This tag is designed to provide the latest stable release version, which is exactly the goal here. This can be achieved with a single xmllint command, making the script more robust, maintainable, and aligned with Maven standards.

Comment on lines +22 to +30
# 1. Extract all version tags
# 2. Strip the XML tags to leave just the version numbers
# 3. Filter for strictly numbers.numbers.numbers (e.g., 2.54.0)
# 4. Sort by version (V) and take the last one (tail -n 1)
latest=$(echo "${xml_content}" \
| grep -oE '<version>[0-9]+\.[0-9]+\.[0-9]+</version>' \
| sed -E 's/<[^>]+>//g' \
| sort -V \
| tail -n 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This pipeline of grep, sed, sort, and tail to find the latest stable version is complex and potentially brittle. A much simpler and more robust approach is to leverage the <release> tag within the maven-metadata.xml file. According to the Maven metadata specification, the <release> tag contains the latest release version, which excludes pre-release versions like RCs and snapshots. This is exactly what's needed here.

You can replace this entire block with a single xmllint command, which is already a dependency for this script.

Suggested change
# 1. Extract all version tags
# 2. Strip the XML tags to leave just the version numbers
# 3. Filter for strictly numbers.numbers.numbers (e.g., 2.54.0)
# 4. Sort by version (V) and take the last one (tail -n 1)
latest=$(echo "${xml_content}" \
| grep -oE '<version>[0-9]+\.[0-9]+\.[0-9]+</version>' \
| sed -E 's/<[^>]+>//g' \
| sort -V \
| tail -n 1)
latest=$(xmllint --xpath 'string(metadata/versioning/release)' - <<< "${xml_content}")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The suggestion does not take pre-release versions like -rc into consideration.

@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed for 'java_showcase_integration_tests'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@blakeli0 blakeli0 merged commit 824008a into main Dec 16, 2025
60 checks passed
@blakeli0 blakeli0 deleted the blakeli0-patch-7 branch December 16, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants