Skip to content

Conversation

@TristonianJones
Copy link
Collaborator

Round-tripping from a protoreflect.FileDescriptor to a FileDescriptorProto and back results in a protoreflect.FileDescriptor value which is incompatible with the original. This is by design. Based on this choice, all protoreflect.FileDescriptor values must be checked to see if they are also defined in the protoregistry.GlobalFiles and if so, sourced from the global proto registry rather than taken as-is.

// Note: Proto reflection relies on descriptor values being object equal rather than object
// equivalence. This choice means that a FieldDescriptor generated from a FileDescriptorProto
// will be incompatible with the FieldDescriptor in the global registry and any message created
// from that global registry.
Copy link
Contributor

Choose a reason for hiding this comment

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

Document somewhere the internal constraint that the cel library must not register anything in protoregistry.GlobalFiles as doing so might violate the isolation needed by ExprService.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@TristonianJones TristonianJones merged commit ec83087 into google:master Jan 29, 2021
@TristonianJones TristonianJones deleted the descriptor-caching branch January 29, 2021 18:44
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