fix: Update invocation metadata from grpc.aio.ServicerContext to use the correct syntax#635
fix: Update invocation metadata from grpc.aio.ServicerContext to use the correct syntax#635jubonni wants to merge 6 commits intoa2aproject:mainfrom
grpc.aio.ServicerContext to use the correct syntax#635Conversation
Summary of ChangesHello @jubonni, 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 addresses a critical bug in the gRPC server's request handling where invocation metadata was not being correctly retrieved. By adjusting how Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a bug where invocation_metadata was accessed as a property instead of a method on grpc.aio.ServicerContext. The changes in the application code and the corresponding test mocks are accurate and address the issue effectively. I've added one minor suggestion to make the code in _get_metadata_value more concise. Overall, this is a good fix.
grpc.aio.ServicerContext to use the correct syntax
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
| if isinstance(md, Metadata): | ||
| raw_values = md.get_all(key) | ||
| elif isinstance(md, Sequence): | ||
| lower_key = key.lower() | ||
| raw_values = [e for (k, e) in md if k.lower() == lower_key] |
There was a problem hiding this comment.
Are you sure this needs to be removed?
From the docs invocation_metadata() can return Sequence, looks like this check was for this exactly.
Description
invocation_metadata from grpc.aio.ServicerContext was treated as a property instead of a method which prevented extracting the invocation metadata
CONTRIBUTINGGuide.fix:which represents bug fixes, and correlates to a SemVer patch.feat:represents a new feature, and correlates to a SemVer minor.feat!:, orfix!:,refactor!:, etc., which represent a breaking change (indicated by the!) and will result in a SemVer major.bash scripts/format.shfrom the repository root to format)Fixes #<issue_number_goes_here> 🦕