Skip to content

protoregistry: Refactor code to retrieve Protobuf fields tagged with extensions

This MR refactors the protoregistry package to use Protobuf-based reflection instead of generic reflection to access fields tagged with extensions. This MR serves multiple different purposes:

  • It simplifies the code significantly and removes much of the "dark elf magic" that was the previous code that used generic reflection. Instead, we now use the tools provided to use by the upstream Protobuf dependency.
  • It fixes a segfault when trying to access oneOf fields that contain a nested tagged field in case they aren't set.
  • It lifts the restriction that fields tagged with the additional_repository extension must be set.

The last two goals are direct prerequisites for CreateFork is slow and duplicates all objects (#3377), where I want to introduce a oneOf mode that may or may not be set and that contains an additional_repository.

Merge request reports