Skip to content

fix: nil meta becomes empty struct in send message conversion#105

Merged
yarolegovich merged 3 commits intomainfrom
yarolegovich/mix-grpc-meta
Nov 13, 2025
Merged

fix: nil meta becomes empty struct in send message conversion#105
yarolegovich merged 3 commits intomainfrom
yarolegovich/mix-grpc-meta

Conversation

@yarolegovich
Copy link
Copy Markdown
Member

pbconv.ToProtoSendMessageRequest was erroneously converting nil metadata to an empty map.
This PR fixes it and adds the method to test suite.

@yarolegovich yarolegovich requested a review from ishymko November 13, 2025 14:50
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @yarolegovich, 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 bug where nil metadata was incorrectly converted to an empty map during protobuf serialization within the pbconv package. The fix involves introducing a dedicated helper function for converting Go maps to protobuf structs, ensuring nil values are preserved as nil rather than being transformed into empty structures. Additionally, comprehensive test coverage has been extended to validate the correctness of this conversion process, guaranteeing data integrity during serialization and deserialization.

Highlights

  • Fixing Nil Metadata Conversion: The ToProtoSendMessageRequest function no longer erroneously converts nil metadata to an empty map, ensuring nil values are handled correctly during protobuf serialization.
  • Refactoring Metadata Conversion Logic: The direct use of structpb.NewStruct for converting metadata, data parts, and agent extension parameters has been replaced with a new helper function, toProtoMap, promoting consistent and correct handling of nil values across various conversion functions.
  • Enhanced Test Coverage: A new test case has been added to TestFromProto_fromProtoSendMessageRequest to validate the round-trip conversion of SendMessageRequest objects, specifically ensuring that ToProtoSendMessageRequest correctly converts a2a.MessageSendParams back to the original protobuf request without data loss or alteration.
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
Copy Markdown
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 fixes an issue where nil metadata was being converted to an empty struct instead of nil. The introduction of the toProtoMap helper function is a good approach to centralize this logic, and the fix has been applied consistently. Additionally, enhancing the test suite with a round-trip check is a great way to ensure conversion correctness in both directions and prevent future regressions. I have a couple of minor suggestions to further refine the implementation.

@yarolegovich yarolegovich merged commit 60d3fcb into main Nov 13, 2025
4 checks passed
@yarolegovich yarolegovich deleted the yarolegovich/mix-grpc-meta branch November 13, 2025 15:11
yarolegovich pushed a commit that referenced this pull request Nov 13, 2025
🤖 I have created a release *beep* *boop*
---


## [0.3.1](v0.3.0...v0.3.1)
(2025-11-13)


### Bug Fixes

* nil meta becomes empty struct in send message conversion
([#105](#105))
([60d3fcb](60d3fcb))
* remove keep-alive messages
([#100](#100))
([493e497](493e497))
* use UUIDv7 in type ID generators
([#102](#102))
([3a809ea](3a809ea)),
closes [#101](#101)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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