Skip to content

CON-1846 Validate params#92

Merged
az-smartling merged 6 commits into
masterfrom
validate_params
Nov 25, 2025
Merged

CON-1846 Validate params#92
az-smartling merged 6 commits into
masterfrom
validate_params

Conversation

@az-smartling

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @az-smartling, 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 significantly improves the robustness of the application by introducing comprehensive validation for critical identifiers such as account and file UIDs. These changes ensure that all necessary parameters are correctly formatted and valid before processing, thereby preventing potential errors and enhancing the reliability of both detection and translation operations. Additionally, it updates a key API SDK dependency.

Highlights

  • Parameter Validation: Implemented validation for the AccountUID parameter in the resolution logic for both detect and translate commands.
  • File UID Validation: Added validation for FileUID after file upload operations in both the detect and translate services to ensure valid identifiers.
  • Translation ID Validation: Enhanced MtUID validation during the translation initiation process, replacing a simple empty string check with a dedicated validation method for improved robustness.
  • Dependency Update: Updated the github.com/Smartling/api-sdk-go module to a newer version, reflecting potential API changes or improvements.
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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 introduces parameter validation in several places, which significantly improves the robustness and reliability of the CLI commands. The changes are well-implemented, adding checks for accountUID, FileUID, and MtUID. The fix for the octal literal representation for file permissions is also a good improvement. I have a couple of suggestions related to code duplication that has become more apparent with these changes. Extracting the duplicated logic into helper functions would further improve the maintainability of the code. Please see my detailed comments.

Comment thread cmd/mt/detect/resolve.go Outdated
Comment on lines +37 to +40
accountUID := api.AccountUID(accountUIDParam)
if err := accountUID.Validate(); err != nil {
return srv.DetectParams{}, err
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This validation is a good addition for robustness. The surrounding logic for resolving accountUIDParam and this new validation block are duplicated in cmd/mt/translate/resolve.go. This would be a good opportunity to extract the entire accountUID resolution and validation logic into a shared helper function to keep the codebase DRY and improve maintainability.

Comment thread services/mt/run_detect.go
Comment on lines +49 to +51
if err := uploadFileResponse.FileUID.Validate(); err != nil {
return nil, err
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This validation logic is a great addition. However, the file upload logic (lines 45-48) and this new validation are also present in services/mt/run_translate.go. Now that validation is part of this block, it might be a good opportunity to refactor the entire upload-and-validate sequence into a shared helper method to improve code reuse and maintainability.

@az-smartling az-smartling changed the title Validate params CON-1846 Validate params Nov 21, 2025

@dimitrystd dimitrystd 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.

Agree with gemini comments

# Conflicts:
#	go.mod
#	go.sum
@az-smartling az-smartling merged commit 9b5ded6 into master Nov 25, 2025
@az-smartling az-smartling deleted the validate_params branch November 25, 2025 14:13
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.

2 participants