Skip to content

Con 1870 logging message for no file downloaded#94

Merged
az-smartling merged 9 commits into
masterfrom
CON-1870_Logging_Message_For_No_File_Downloaded
Nov 25, 2025
Merged

Con 1870 logging message for no file downloaded#94
az-smartling merged 9 commits into
masterfrom
CON-1870_Logging_Message_For_No_File_Downloaded

Conversation

@az-smartling

@az-smartling az-smartling commented Nov 20, 2025

Copy link
Copy Markdown
Contributor

Added logging message for no file downloaded
Changed calculation of progress
Smartling/api-sdk-go#23

@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 refines the file download process by improving how translation progress is calculated and managed. It introduces more robust parsing for progress parameters, updates the completion percentage calculation for files, and adds clear logging for files that are skipped because they do not meet the specified progress threshold. This enhances the transparency and reliability of the file pulling service.

Highlights

  • Progress Parameter Parsing: The parsing logic for the Progress parameter has been enhanced to more robustly handle input, specifically by trimming any trailing percentage symbols and ensuring a default value of '0' if empty.
  • File Completion Calculation: The method for calculating the completion percentage of a file (complete) has been updated to use locale.CompletedStringCount and locale.AuthorizedStringCount, providing a more accurate representation of translation progress.
  • Skipped File Tracking: A new mechanism has been introduced to track files that are skipped because their completion percentage falls below a specified threshold. These files are now stored in a persentByExcludedFile map.
  • Logging for Skipped Files: A new logging message has been added to explicitly inform users when files are skipped due to not meeting the required progress threshold, detailing the file path, its current percentage, and the threshold.
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 logging for skipped file downloads and modifies the progress calculation logic. My review focuses on improving the robustness of the new logic. I've identified a critical issue that could lead to a panic due to a potential division-by-zero error in the progress calculation. Additionally, I've found a bug in how the progress percentage string is parsed and a typo in a new variable name. Applying these suggestions will make the code more resilient and maintainable.

Comment thread services/files/run_pull.go Outdated
Comment thread services/files/run_pull.go Outdated
Comment on lines 90 to 93
if strings.HasSuffix(params.Progress, "%") {
params.Progress = strings.TrimSpace(strings.TrimSuffix(params.Progress, "%"))
}
params.Progress = strings.TrimSuffix(params.Progress, "%")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The logic for cleaning the params.Progress string is complex and has a bug. For example, if params.Progress is "50% " (with a trailing space), strings.HasSuffix will be false, and the trailing space will not be removed. This will cause strconv.ParseInt to fail later. This logic can be simplified and made more robust.

        params.Progress = strings.TrimSpace(params.Progress)
	params.Progress = strings.TrimSuffix(params.Progress, "%")

Comment thread services/files/run_pull.go Outdated
params.Progress = "0"
}

persentByExcludedFile := make(map[string]string)

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

There's a typo in the variable name persentByExcludedFile. It should be percentByExcludedFile. This typo is present in other parts of the code where this variable is used (lines 173 and 199).

        percentByExcludedFile := make(map[string]string)

Comment thread services/files/run_pull.go Outdated
if complete < percents {
continue
if total := locale.CompletedStringCount + locale.AuthorizedStringCount; total > 0 {
complete = int64(

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.

Pls add unit tests. The formula is tricky, especially rounding. Proposed tests cover this and other cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread services/files/run_pull.go Outdated

if percents > 0 {
if complete < percents {
percentByExcludedFile[path] = strconv.Itoa(int(complete))

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.

Why not simply call here fmt.Printf("skipped.... I don't understand how this construction works. But it is totally fine to mix downloaded and skipped messages.

Comment thread services/files/run_pull.go Outdated
Comment on lines +90 to +91
params.Progress = strings.TrimSpace(params.Progress)
params.Progress = strings.TrimSpace(strings.TrimSuffix(params.Progress, "%"))

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.

Just an idea. Instead of modifying the input object, I can propose to define a new local var progressThreshold. It has a better name and int type. So no guess if it string or something else.

@az-smartling az-smartling merged commit c56c7de into master Nov 25, 2025
@az-smartling az-smartling deleted the CON-1870_Logging_Message_For_No_File_Downloaded branch November 25, 2025 14:15
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