Skip to content

Conversation

@jnmt
Copy link
Collaborator

@jnmt jnmt commented Nov 10, 2025

Description

This PR adds missing mapping from ScalarDL status code to gRPC status code. Although it doesn't cause a serious issue, i.e., showing warnings like "SECRET_NOT_FOUND is not mapped to gRPC status code" in a log, we should avoid it. I needed to care about it when adding the status code in #302.

Related issues and/or PRs

Changes made

  • Added missing status codes

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

N/A

Release notes

Fixed status code handling.

Copilot AI review requested due to automatic review settings November 10, 2025 07:38
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @jnmt, 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 service's error handling by correctly mapping specific internal status codes to their appropriate gRPC equivalents. This ensures that clients receive more accurate and standardized error responses, improving the clarity and consistency of error interpretation, especially for issues related to invalid arguments and missing secrets.

Highlights

  • Status Code Mapping for INVALID_ARGUMENT: The internal INVALID_ARGUMENT status code is now explicitly mapped to the gRPC INVALID_ARGUMENT status, ensuring consistent error reporting for invalid input.
  • Status Code Mapping for SECRET_NOT_FOUND: The internal SECRET_NOT_FOUND status code has been added to the group of 'not found' errors, which are mapped to the gRPC NOT_FOUND status.
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.

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 correctly adds handling for INVALID_ARGUMENT and SECRET_NOT_FOUND status codes in the gRPC status conversion logic, preventing them from being incorrectly mapped to an INTERNAL error. My review includes one suggestion to improve code maintainability by keeping the case statements sorted numerically, which is consistent with the existing style in this file.

Copy link

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.

Pull Request Overview

This PR adds mappings for two new status codes (INVALID_ARGUMENT and SECRET_NOT_FOUND) to the gRPC status conversion logic in the CommonService class. These status codes are mapped to their appropriate gRPC equivalents.

  • Maps INVALID_ARGUMENT to io.grpc.Status.INVALID_ARGUMENT
  • Maps SECRET_NOT_FOUND to io.grpc.Status.NOT_FOUND

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jnmt jnmt self-assigned this Nov 10, 2025
@jnmt jnmt added the bugfix label Nov 10, 2025
@jnmt jnmt requested review from choplin and feeblefakie November 10, 2025 07:51
Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

Copy link

@choplin choplin left a comment

Choose a reason for hiding this comment

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

LGTM! Sorry for the late review.

JFYI, we can make missing of an enum variant in a switch statment compile error using ErrorProne. This could help you avoid missing this type of error.
https://errorprone.info/bugpattern/MissingCasesInEnumSwitch

@jnmt
Copy link
Collaborator Author

jnmt commented Dec 3, 2025

LGTM! Sorry for the late review.

JFYI, we can make missing of an enum variant in a switch statment compile error using ErrorProne. This could help you avoid missing this type of error. https://errorprone.info/bugpattern/MissingCasesInEnumSwitch

@choplin Thanks! We've already used ErrorProne, but unfortunately, MissingCasesInEnumSwitch doesn't seem to be warned when the switch has default, like this case.

@jnmt jnmt merged commit 8458852 into master Dec 3, 2025
10 checks passed
feeblefakie pushed a commit that referenced this pull request Dec 3, 2025
feeblefakie pushed a commit that referenced this pull request Dec 3, 2025
feeblefakie pushed a commit that referenced this pull request Dec 3, 2025
feeblefakie pushed a commit that referenced this pull request Dec 3, 2025
feeblefakie pushed a commit that referenced this pull request Dec 3, 2025
@jnmt jnmt deleted the fix-status-code-handling branch December 3, 2025 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants