Skip to content

feat: add WithMaxRecvMsgSize option for gRPC connections#16

Merged
matthewmcneely merged 1 commit into
mainfrom
matthewmcneely/add-grpc-message-size-support
May 27, 2026
Merged

feat: add WithMaxRecvMsgSize option for gRPC connections#16
matthewmcneely merged 1 commit into
mainfrom
matthewmcneely/add-grpc-message-size-support

Conversation

@matthewmcneely
Copy link
Copy Markdown
Owner

@matthewmcneely matthewmcneely commented May 27, 2026

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

  • Code compiles correctly and linting passes locally

Summary by cubic

Adds WithMaxRecvMsgSize(int) to configure the gRPC receive limit for remote Dgraph connections. When set, NewClient routes through dgo.NewClient with grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(size)) so responses can exceed the 4 MB default.

  • New Features
    • Ignored for file:// URIs; defaults remain unchanged.
    • Parses dgraph:// URIs (auth, sslmode, namespace) to mirror dgo.Open.
    • Includes maxRecvMsgSize in the client pool key to avoid mixing configurations.

Written for commit af42adf. Summary will update on new commits. Review in cubic

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>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread client.go
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] == "" {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() == "" {

@matthewmcneely matthewmcneely merged commit 6640e0a into main May 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant