Fix reflection FileDescriptorResponse dropping all but the last descriptor#117
Merged
Merged
Conversation
…iptor The gRPC reflection protocol defines FileDescriptorResponse.file_descriptor_proto as `repeated bytes`, carrying the requested file plus all its transitive imports. proteus modeled it as a singular Array[Byte], so decoding a response with N descriptors collapsed to last-wins and silently dropped every descriptor but one, making the dependency set impossible to reconstruct. Model it as List[Array[Byte]] so all repeated entries are retained.
f7e199a to
a0a8f7f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The gRPC reflection protocol (
grpc.reflection.v1) defines:When a reflection server answers a
FileContainingSymbol/FileByFileNamerequest, it returns one response whosefile_descriptor_protorepeated field carries the requested file's descriptor plus all its transitively-imported files' descriptors — field number 1 emitted N times on the wire.proteus modeled this as a singular
Array[Byte]. Decoding N occurrences of a wire field into a singular register follows protobuf last-wins semantics, so every descriptor but the last was silently discarded. A caller could no longer rebuild the full descriptor set viaFileDescriptor.buildFrombecause the imported dependencies were missing.The existing backend reflection tests only query
grpc.reflection.v1.ServerReflection, whose.protohas no imports (exactly one descriptor returned), so the multi-descriptor collapse was never exercised.Fix
Model the field as
List[Array[Byte]]so the codec decodes all repeatedfile_descriptor_protoentries. Existing backend tests remain compatible (they assert_.nonEmpty, which holds forListtoo).