Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes introduce a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Documentation Updates 1 document(s) were updated by changes in this PR: OpenFGA's Space |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
pkg/go/graph/weighted_graph_node.go (1)
29-29: Minor typo in comment.The comment refers to "this maps" but the field is a slice (
[]string), not a map.- directAssigns []string // refers to the direct assignments that a node relation can have, this maps will allow to in o(1) know if a write is correct or a contextual tuple is correct + directAssigns []string // refers to the direct assignments that a node relation can have, this slice will allow to know if a write is correct or a contextual tuple is correct
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
pkg/go/graph/weighted_graph.go(3 hunks)pkg/go/graph/weighted_graph_builder.go(2 hunks)pkg/go/graph/weighted_graph_node.go(1 hunks)pkg/go/graph/weighted_graph_test.go(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
pkg/go/graph/weighted_graph_test.go (2)
pkg/go/transformer/dsltojson.go (1)
MustTransformDSLToProto(553-560)pkg/go/graph/weighted_graph_builder.go (1)
NewWeightedAuthorizationModelGraphBuilder(19-21)
pkg/go/graph/weighted_graph.go (2)
pkg/go/graph/weighted_graph_node.go (2)
WeightedAuthorizationModelNode(20-30)SpecificTypeAndRelation(9-9)pkg/go/graph/weighted_graph_edge.go (2)
WeightedAuthorizationModelEdge(60-78)DirectEdge(13-13)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (go)
🔇 Additional comments (8)
pkg/go/graph/weighted_graph_node.go (1)
37-39: LGTM!The accessor follows the established pattern of other getters in this struct.
pkg/go/graph/weighted_graph.go (3)
62-62: LGTM!Consistent initialization of
directAssignswith an empty slice.
74-74: LGTM!Consistent initialization of
directAssignsmatching the pattern inAddNode.
154-169: Verify the "unreachable" return statement.The comment at line 168 states "it will never get here", but if
len(node.directAssigns) == 1and the single direct edge is nested beyond operator nodes in a way that never gets found (e.g., only TTU or computed edges), the loop will exit withtraverseEdgesempty and returnnil.Confirm this is the intended behavior for such edge cases, or add defensive handling/logging if this represents an unexpected model state.
pkg/go/graph/weighted_graph_builder.go (1)
209-209: LGTM!Appending to
directAssignscorrectly tracks direct assignments for the parent relation node.pkg/go/graph/weighted_graph_test.go (3)
8-8: LGTM!Import alias
languageis clear and follows common Go conventions.
1356-1415: LGTM!Comprehensive test coverage for
directAssignsfield population across various relation configurations including simple relations, grouped direct assignments, recursive usersets, and cross-type references.
1417-1481: LGTM!Good test coverage for
GetDirectEdgesAssignationincluding:
- Direct edges on simple relations
- Grouped direct edges via
LogicalDirectGrouping- Nested operator scenarios
- Relations without direct assignments (verifier)
- But-not exclusion patterns (locator)
Weighted graph now supports functionality to be able to validate write tuples. We only allow writing tuples when direct edges exist, direct edges can be directly assigned to a node relation, or it can connect operational nodes. A new function was added to the weighted graph to return directly assigned edges that are defined by a node relation.
Description
What problem is being solved?
How is it being solved?
What changes are made to solve it?
References
Review Checklist
mainSummary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.