feat: create deterministic name to the operator nodes - #640
Conversation
WalkthroughThe weighted graph builder now generates deterministic operator node labels using a per-relation index ( ChangesDeterministic Operator Node Labels
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/go/graph/weighted_graph_builder.go (1)
106-108: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueStale comment: the edge is always added and
operatorNodeis never nil.
GetOrAddNodealways returns a non-nil node andAddEdgeruns unconditionally, so the note about a niloperationNode/ an edge that "won't be added" no longer reflects the code and is misleading.♻️ Suggested comment cleanup
- // add one edge "relation" -> "operation that defined the operator" - // Note: if this is a composition of operators, operationNode will be nil and this edge won't be added. + // add one edge "relation" -> "operator node" wg.AddEdge(parentNode.GetUniqueLabel(), operatorNodeName, RewriteEdge, parentNodeName, "", nil)The deterministic labeling logic itself looks correct.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/go/graph/weighted_graph_builder.go` around lines 106 - 108, The comment near wg.AddEdge in weighted_graph_builder.go is stale because operatorNode is always present and the edge is added unconditionally. Update or remove the note in the relevant AddEdge/GetOrAddNode block so it accurately describes the current behavior, and make sure any mention of a nil operationNode or a skipped edge is removed from the surrounding comments.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pkg/go/graph/weighted_graph_builder.go`:
- Around line 106-108: The comment near wg.AddEdge in weighted_graph_builder.go
is stale because operatorNode is always present and the edge is added
unconditionally. Update or remove the note in the relevant AddEdge/GetOrAddNode
block so it accurately describes the current behavior, and make sure any mention
of a nil operationNode or a skipped edge is removed from the surrounding
comments.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 23e69bce-165e-46df-8c60-d30d9e0c8409
📒 Files selected for processing (2)
pkg/go/graph/weighted_graph_builder.gopkg/go/graph/weighted_graph_builder_test.go
There was a problem hiding this comment.
Pull request overview
This PR updates the Go weighted-graph builder to generate deterministic operator-node unique labels (instead of ULID-based labels), improving reproducibility of graph output and allowing error messages/tests to reference stable node identifiers.
Changes:
- Replace ULID-based operator node labels with deterministic labels of the form
type#relation:operator:indexusing a per-relation DFS counter. - Thread a per-relation
operatorIndexthrough rewrite parsing so nested operators get stable, unique IDs. - Update/add Go graph-builder tests to assert deterministic operator labels and to check error messages that include the stable operator-node label.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/go/graph/weighted_graph_builder.go | Switch operator-node naming from ULID to deterministic type#relation:operator:index via a per-relation DFS counter. |
| pkg/go/graph/weighted_graph_builder_test.go | Update existing assertions and add new tests to validate deterministic operator-node labels and topology. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
What problem is being solved?
How is it being solved?
What changes are made to solve it?
References
Review Checklist
mainSummary by CodeRabbit
Bug Fixes
Tests