Repository navigation
codegen: check message and enum names against service-derived items - #333
Merged
Merged
Conversation
In connectrpc-build output the service stubs share a Rust module with what buffa puts at the package root: the top-level messages and enums, and a `pub use` of each message's view types. `message GreetClient` next to `service Greet` failed in rustc with E0428, and `service PingView` next to `message Ping` with E0255. List those names per package before the per-service pass, following buffa's rule for which re-exports it keeps. A service type with one of the names is a generation error that gives both proto declarations. An `OwnedFooView` alias with one of the names, or with the name of a service, is left out, as it already is when two aliases collide. Fixes #330. Signed-off-by: Iain McGinniss <309153+iainmcgin@users.noreply.github.com>
iainmcgin
marked this pull request as ready for review
October 13, 2026 23:30
iainmcgin
enabled auto-merge
October 13, 2026 23:53
azdagron
approved these changes
Oct 14, 2026
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.
Fixes #330.
In
connectrpc-buildoutput the service stubs share a Rust module with what buffa puts at the package root: the top-level messages and enums, and apub useof each message's*View,*OwnedViewand, withlazy_views,*LazyView.message GreetClientnext toservice Greetfailed in rustc with E0428, andservice PingViewnext tomessage Pingwith E0255.A pre-pass lists those names per package, following buffa 0.9.2's rule for which re-exports it keeps;
root_types_match_what_buffa_generatescompares the list with buffa's output, so a buffa bump that changes the rule fails that test. The list is empty forgenerate_services, where messages are in another tree.A service type with one of those names is a generation error:
An
OwnedFooViewalias with one of those names is left out, as it already is when two aliases collide, somessage OwnedFooViewandmessage OwnedFoonow compile. The alias is also left out when a service has the name (service OwnedFooView), in both layouts.OwnedFooViewthen resolves to that other item, so a handler that uses it as the alias gets an error about the other type; the guide says so.Every schema that is now rejected failed to compile before, with one exception:
message FooClientnext toservice Foocompiled undergate_client_featurewhile the consumer'sclientfeature was off.The
# Errorssections ofgenerate_files,generate_servicesandConfig::compilealso gain conditions that predate this change (a twice-listed file, an invalid client feature name, a badBUFFA_ELEMENT_MEMORY_LIMIT).Config::buffa_confignow says that it resetsgenerate_json, which thetype_name_prefixremedy runs into. The[#75]links in the doc comments this touches now point atconnectrpc/connect-rust.