fix(goctl): include nested client aliases#5627
Merged
kevwan merged 3 commits intoJun 27, 2026
Merged
Conversation
fc9b29a to
b19df40
Compare
In v1.10.1 the per-service alias filter introduced by zeromicro#5482 only collected direct RequestType/ReturnsType names. Message types referenced by fields inside those request/response messages (e.g. a repeated item type inside a response) were silently dropped, breaking callers that used the generated type aliases after upgrading. Fix: replace the flat two-type collect with collectServiceUsedTypes, which does a recursive DFS over the proto message graph so all transitively- referenced same-file message types are aliased in the generated client file. The per-service scope (cross-service isolation) is fully preserved. Fixes zeromicro#5618 Tests added: - 7 unit tests for collectServiceUsedTypes covering: direct-only, NormalField, MapField value type, Oneof fields, multi-level transitive chain, cycle detection, and cross-service exclusion - 4 integration tests via genCallGroup covering: NormalField + cross-service isolation, MapField, Oneof, and multi-level transitive chain Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add coverage for transitive alias collection across normal fields, map value types, oneof branches, multi-level dependencies, cycle handling, and cross-service isolation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
kevwan
approved these changes
Jun 27, 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 #5618
This updates multi-service RPC client generation so per-service aliases still stay scoped to the service, but also include same-file message types referenced by that service's request/response messages.
The regression test extends the existing per-service alias coverage with a response message that contains an item type, and verifies only the owning service client exports that item alias.
Tests: