In connectrpc-build output a package's messages and enums share a Rust module with its service stubs. check_module_collisions (#280) compares the identifiers derived from one service with those derived from another, and does not look at message or enum names. A message named like a service-derived item is accepted at generation time, and the generated code then fails to compile:
service Greet {
rpc Say(SayRequest) returns (SayResponse);
}
message GreetClient {}
error[E0428]: the name `GreetClient` is defined multiple times
The types a service Greet derives are Greet, GreetExt, GreetServer, GreetClient and GreetRegisterMarker. Its constants are values, which a message or enum does not collide with. The Owned<Message>View aliases are types in the same module, so message OwnedSayRequestView collides with the alias for SayRequest; the alias check from #77 compares aliases with each other only.
The split layout (buf generate with separate proto and connect trees) is not affected, because messages are in a different module there.
Proposed: before the per-service pass, record the package's top-level message and enum names in BatchState::module_idents, so that the existing check reports the pair with both proto names, as it does for two services. Only the unified layout needs it.
#329 documents the limit in docs/guide.md; the fix removes that sentence.
In
connectrpc-buildoutput a package's messages and enums share a Rust module with its service stubs.check_module_collisions(#280) compares the identifiers derived from one service with those derived from another, and does not look at message or enum names. A message named like a service-derived item is accepted at generation time, and the generated code then fails to compile:The types a service
Greetderives areGreet,GreetExt,GreetServer,GreetClientandGreetRegisterMarker. Its constants are values, which a message or enum does not collide with. TheOwned<Message>Viewaliases are types in the same module, somessage OwnedSayRequestViewcollides with the alias forSayRequest; the alias check from #77 compares aliases with each other only.The split layout (
buf generatewith separateprotoandconnecttrees) is not affected, because messages are in a different module there.Proposed: before the per-service pass, record the package's top-level message and enum names in
BatchState::module_idents, so that the existing check reports the pair with both proto names, as it does for two services. Only the unified layout needs it.#329 documents the limit in
docs/guide.md; the fix removes that sentence.