Skip to content

Conversation

@genevanmeter
Copy link
Contributor

Summary

Updates the protobuf descriptor to send only the subset of descriptors needed to describe a given protobuf publisher message.

I had a internal crate that had a large number of protobuf message definitions all under the same protobuf package. My naive initial implementation would send the entire descriptor pool of every message for every publisher 😬. Besides being overly verbose it would confuse ecal_mon_gui when trying to parse the messages.

There was also a large amount of comments from the original .proto (prost_types::FileDescriptorProto::source_code_info) that was being send along with the descriptor which is not needed. Also the documentation states it can be removed. https://docs.rs/prost-types/latest/prost_types/struct.FileDescriptorProto.html#structfield.source_code_info Now the descriptor more closely aligns to the form of C++ ecal_sample_person_send.

Related Issues / Discussions

Related to #80

Checklist

  • I have tested this change locally
  • I have documented any public APIs or CLI changes
  • I have added appropriate examples or comments
  • The code builds and passes all checks (cargo check, cargo test)
  • I have updated the changelog if applicable

@rex-schilasky
Copy link
Collaborator

Great how you fixed your own extension. Didn't check the descriptor size. Thank you.

@rex-schilasky rex-schilasky requested a review from Copilot August 30, 2025 18:25
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 optimizes protobuf descriptor handling by sending only the subset of descriptors needed for a specific message type, rather than the entire descriptor pool. This reduces verbosity and prevents confusion in ecal_mon_gui when parsing messages.

Key changes:

  • Filter descriptor pool to include only relevant file descriptors for the specific message type
  • Remove source_code_info from descriptors to eliminate unnecessary comments from original .proto files
  • Add proper type name extraction using the message descriptor

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

.to_string(),
);

// Filter the pool to the set of file decriptors needed
Copy link

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

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

There's a typo in the comment: 'decriptors' should be 'descriptors'.

Suggested change
// Filter the pool to the set of file decriptors needed
// Filter the pool to the set of file descriptors needed

Copilot uses AI. Check for mistakes.
Comment on lines +71 to +73
descriptor_pool
.add_file_descriptor_proto(file_descriptor_proto)
.unwrap();
Copy link

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

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

Using unwrap() here could cause a panic if adding the file descriptor fails. Consider handling this error more gracefully or at least documenting when this could fail.

Copilot uses AI. Check for mistakes.
@rex-schilasky rex-schilasky self-requested a review August 30, 2025 18:28
@rex-schilasky rex-schilasky merged commit 89a81c2 into eclipse-ecal:main Aug 30, 2025
7 checks passed
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