feat: add managed reverse edge and validator support#6
Merged
matthewmcneely merged 7 commits intomainfrom Jan 24, 2026
Merged
Conversation
There was a problem hiding this comment.
4 issues found across 9 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="query_test.go">
<violation number="1" location="query_test.go:429">
P3: These assertions assume a deterministic ordering of reverse-edge results, which Dgraph does not guarantee without an explicit order clause. This can make the test flaky. Consider asserting the set of names instead of positional order (or add an orderasc clause to the query).</violation>
</file>
<file name="client.go">
<violation number="1" location="client.go:316">
P2: validateStruct can panic on nil input because it calls Elem() on a nil pointer. Guard against nil pointers and return a validation error instead of panicking.</violation>
<violation number="2" location="client.go:323">
P2: validateStruct can panic when a slice contains a nil pointer element. Add a nil check before calling Elem() on slice elements.</violation>
</file>
<file name="client_test.go">
<violation number="1" location="client_test.go:342">
P2: TestUser is missing the required DType field (`dgraph.type`), so inserts/updates can create untyped nodes or fail type-based expectations. Add DType to match the required node structure.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="client_test.go">
<violation number="1" location="client_test.go:347">
P2: `DType` is now marked as `validate:"required"`, but the test’s “valid user” never sets `DType`. Because validation runs before Insert, this makes the supposed valid insert fail. Set `DType` on the test data (and any other inserts/updates) or relax the validator tag.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
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 PR adds "managed reverse edges" which allows for more natural treatment of reverse edges in go structs when using modusgraph. It also adds support for automatic struct validation when mutating the graph.
Checklist
Summary by cubic
Adds managed reverse edges and optional struct validation. This makes reverse relationships easier to model in Go structs and blocks invalid data during mutations.
New Features
Dependencies
Written for commit 8ce0f40. Summary will update on new commits.