Repository navigation
Fix self-referencing file dependency - #91
mjheilmann merged 3 commits into
Conversation
A message that refers to itself, or a nested type that refers back to its enclosing message, left the file listed in its own dependencies, because shrink_cycles only merges cycles of two or more files. A client resolves every dependency before using a file, so grpcurl overflowed its stack. Drop a file's own name from its dependencies in resolve_dependencies. Adds a self_reference fixture and tests (see elixir-grpc#90). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
mjheilmann
left a comment
There was a problem hiding this comment.
This looks pretty good, thanks!
I see this only covers the "descriptor is present" code path, but grpc-reflection now also generates the descriptor payload to enable reflection when the protos schema is compiled without descriptors. I would appreciate it if you covered that case as well in this PR, but I can also do a followup and cover it myself if you cannot.
Take a peek at test/case/no_descriptor/recursive_message_test.exs and the NoDescriptor.* modules to see how we currently test that code path.
Just let me know whether to keep this PR open and to expect those changes from your side, or if I can merge this and then close the descriptor-less gaps myself before making a patch release. Thanks again.
Run the self-reference case against the NoDescriptor modules too. The nested back-reference case moves to its own proto and is skipped in the descriptor-less pass: the synthesizer does not support nested messages yet, so that case fails regardless of this fix. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The descriptor-less coverage is pushed: a One thing I ran into: the descriptor-less path doesn't support nested messages yet. The synthesizer emits nested types as top-level messages, so a field still points at |
100% agree. Thanks for pointing this out. I'll get this merged, and open a new issue around that problem. Issue created at #92 to track |
Fixes #90
A message that refers to itself, or a nested type that refers back to its enclosing message, left its file listed in its own
dependency.shrink_cyclesonly merges cycles of two or more files, so nothing removed it. A client resolves every dependency before using a file, so grpcurl overflowed its stack.Drop a file's own name from its dependencies in
Builder.resolve_dependencies/1.Tests
self_referencefixture: a self-referencing message (also through arepeatedfield) and a nested type that points back at its parent.test/case/self_reference_test.exsruns against v1 and v1alpha: lists the service, asserts no file depends on itself, and traverses the graph with grpcurl.🤖 Generated with Claude Code