Skip to content

Script to update max RPC versions supported in AK #5023

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emasab
Copy link
Contributor

@emasab emasab commented Apr 7, 2025

No description provided.

@Copilot Copilot AI review requested due to automatic review settings April 7, 2025 11:01
@emasab emasab requested a review from a team as a code owner April 7, 2025 11:01
@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

packaging/tools/update_rpcs_max_versions.py:61

  • [nitpick] The variable 'pipe_char' is reused across different contexts to compute multiple column widths. Consider using more descriptive names (e.g., first_pipe_index, second_pipe_index) to improve readability.
pipe_char = line.find('|')

Comment on lines 75 to 93
with open(f'./clients/src/main/resources/common/message/{api}Request.json',
'r') as f:
text = f.readlines()
text = "".join([line for line in text
if '#' not in line and '//' not in line])
json_object = json.loads(text)
max_version = json_object["validVersions"].split("-")[-1]
print('| ', end='')
print(str(api_num).ljust(max_first_column), end='')
print('| ', end='')
print(api.ljust(max_second_column), end='')
print('| ', end='')
print(str(max_version).ljust(max_third_column) + '|')
Copy link
Preview

Copilot AI Apr 7, 2025

Choose a reason for hiding this comment

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

Consider adding error handling for file I/O operations. If the JSON file is missing or unreadable, an unhandled exception will occur.

Suggested change
with open(f'./clients/src/main/resources/common/message/{api}Request.json',
'r') as f:
text = f.readlines()
text = "".join([line for line in text
if '#' not in line and '//' not in line])
json_object = json.loads(text)
max_version = json_object["validVersions"].split("-")[-1]
print('| ', end='')
print(str(api_num).ljust(max_first_column), end='')
print('| ', end='')
print(api.ljust(max_second_column), end='')
print('| ', end='')
print(str(max_version).ljust(max_third_column) + '|')
try:
with open(f'./clients/src/main/resources/common/message/{api}Request.json',
'r') as f:
text = f.readlines()
text = "".join([line for line in text
if '#' not in line and '//' not in line])
json_object = json.loads(text)
max_version = json_object["validVersions"].split("-")[-1]
print('| ', end='')
print(str(api_num).ljust(max_first_column), end='')
print('| ', end='')
print(api.ljust(max_second_column), end='')
print('| ', end='')
print(str(max_version).ljust(max_third_column) + '|')
except FileNotFoundError:
print(f"Error: File {api}Request.json not found.", file=sys.stderr)
except IOError:
print(f"Error: Could not read file {api}Request.json.", file=sys.stderr)
except json.JSONDecodeError:
print(f"Error: JSON decode error in file {api}Request.json.", file=sys.stderr)

Copilot uses AI. Check for mistakes.

@airlock-confluentinc airlock-confluentinc bot force-pushed the dev_script_to_update_ak_max_versions branch from 9bea0f9 to 8002f73 Compare April 7, 2025 11:22
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