Skip to content

chore: restore nightly protobuf compatibility check#13884

Draft
whowes wants to merge 1 commit into
mainfrom
whowes/restore-proto-compat-check
Draft

chore: restore nightly protobuf compatibility check#13884
whowes wants to merge 1 commit into
mainfrom
whowes/restore-proto-compat-check

Conversation

@whowes

@whowes whowes commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

WIP

@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 nightly downstream Protobuf compatibility scripts to test local monorepo submodules directly instead of cloning them from GitHub, removing the special-casing for the google-cloud-java repository. Feedback on these changes recommends using standard CLI commands to retrieve tool versions rather than manually parsing versions.txt, redirecting error messages to standard error (>&2), and appending || exit 1 to pushd commands to ensure the scripts terminate safely if directory changes fail.

# The grep query tries to match `{artifact_id}:{released_version}:{current_version}`.
# The artifact_id must be exact otherwise multiple entries may match
version=$(cat "versions.txt" | grep -E "^${artifact_id}:.*:.*$" | cut -d ':' -f3)
version=$(cat "${monorepoRoot}/versions.txt" | grep -E "^${artifact_id}:.*:.*$" | cut -d ':' -f3)

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.

medium

Prefer using standard CLI commands to retrieve tool versions rather than manually parsing configuration files, unless performance or latency issues are actively observed.

Suggested change
version=$(cat "${monorepoRoot}/versions.txt" | grep -E "^${artifact_id}:.*:.*$" | cut -d ':' -f3)
version=$(librarian config get version "${artifact_id}")
References
  1. Prefer using standard CLI commands (such as librarian config get version) to retrieve tool versions rather than manually parsing configuration files, unless performance or latency issues are actively observed.

mvn clean install -B -V -ntp -T 1C -DskipTests -Dclirr.skip -Denforcer.skip -Dmaven.javadoc.skip
repo_dir="${monorepoRoot}/${repo}"
if [ ! -d "${repo_dir}" ]; then
echo "Directory ${repo_dir} does not exist. Skipping or failed."

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.

medium

Error messages should be redirected to standard error (>&2) instead of standard output.

Suggested change
echo "Directory ${repo_dir} does not exist. Skipping or failed."
echo "Directory ${repo_dir} does not exist. Skipping or failed." >&2

exit 1
fi

pushd "${repo_dir}"

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.

medium

It is safer to append || exit 1 to pushd to ensure the script terminates if the directory change fails, preventing subsequent commands (like mvn clean install) from running in the wrong directory.

Suggested change
pushd "${repo_dir}"
pushd "${repo_dir}" || exit 1

pushd "$repo"
repo_dir="${monorepoRoot}/${repo}"
if [ ! -d "${repo_dir}" ]; then
echo "Directory ${repo_dir} does not exist. Skipping or failed."

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.

medium

Error messages should be redirected to standard error (>&2) instead of standard output.

Suggested change
echo "Directory ${repo_dir} does not exist. Skipping or failed."
echo "Directory ${repo_dir} does not exist. Skipping or failed." >&2

exit 1
fi

pushd "${repo_dir}"

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.

medium

It is safer to append || exit 1 to pushd to ensure the script terminates if the directory change fails, preventing subsequent commands from running in the wrong directory.

Suggested change
pushd "${repo_dir}"
pushd "${repo_dir}" || exit 1

@whowes
whowes force-pushed the whowes/restore-proto-compat-check branch from e8628bf to 9d06d44 Compare July 23, 2026 23:49
@whowes
whowes force-pushed the whowes/restore-proto-compat-check branch from 9d06d44 to dbc6eee Compare July 24, 2026 00:03
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant