feat: add WithMaxRecvMsgSize option for gRPC connections#16
Merged
matthewmcneely merged 1 commit intoMay 27, 2026
Merged
Conversation
Routes through dgo.NewClient when set so callers can raise the default 4 MB gRPC receive limit for large query responses against remote Dgraph. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="client.go">
<violation number="1" location="client.go:356">
P2: Port parsing in `parseDgraphURI` rejects valid IPv6 endpoints when `WithMaxRecvMsgSize` is enabled.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| if !strings.Contains(u.Host, ":") { | ||
| return "", nil, errors.New("invalid connection string: host url must have both host and port") | ||
| } | ||
| if strings.Split(u.Host, ":")[1] == "" { |
There was a problem hiding this comment.
P2: Port parsing in parseDgraphURI rejects valid IPv6 endpoints when WithMaxRecvMsgSize is enabled.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client.go, line 356:
<comment>Port parsing in `parseDgraphURI` rejects valid IPv6 endpoints when `WithMaxRecvMsgSize` is enabled.</comment>
<file context>
@@ -308,6 +338,81 @@ func NewClient(uri string, opts ...ClientOpt) (Client, error) {
+ if !strings.Contains(u.Host, ":") {
+ return "", nil, errors.New("invalid connection string: host url must have both host and port")
+ }
+ if strings.Split(u.Host, ":")[1] == "" {
+ return "", nil, errors.New("invalid connection string: missing port after port-separator colon")
+ }
</file context>
Suggested change
| if strings.Split(u.Host, ":")[1] == "" { | |
| if u.Port() == "" { |
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.
Description
This change adds WithMaxRecvMsgSize(int) to modusgraph. When non-zero on a dgraph:// URI, NewClient parses the connection string itself (mirroring dgo.Open's auth/sslmode/namespace handling) and constructs the connection via dgo.NewClient with grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(size)) so large responses can exceed the default 4 MB gRPC limit.
Checklist
Summary by cubic
Adds
WithMaxRecvMsgSize(int)to configure the gRPC receive limit for remote Dgraph connections. When set,NewClientroutes throughdgo.NewClientwithgrpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(size))so responses can exceed the 4 MB default.file://URIs; defaults remain unchanged.dgraph://URIs (auth,sslmode,namespace) to mirrordgo.Open.maxRecvMsgSizein the client pool key to avoid mixing configurations.Written for commit af42adf. Summary will update on new commits. Review in cubic