Set node column position when creation#995
Conversation
…into set_node_column_position_when_creation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds column-position tracking: repository queries expose column positions and child UUIDs; service returns node-info and computes/assigns columnPosition for CHILD/BEFORE/AFTER insertions; tests updated to assert columnPosition across insertion, cut/paste, and duplication flows. ChangesColumn Position Tracking for Network Modification Nodes
Suggested Reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
Actionable comments posted: 1
🤖 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.
Inline comments:
In
`@src/main/java/org/gridsuite/study/server/service/NetworkModificationTreeService.java`:
- Around line 151-159: getNextColumnPosition currently computes next sibling
columnPosition in-memory using
networkModificationNodeInfoRepository.findColumnPositionsByUuidIn(nodesRepository.findChildrenUuids(parentNodeId))
and returns max+1, which is race-prone; change it to perform the max calculation
inside a single transactional DB operation (e.g. a repository method that runs
SELECT MAX(column_position) FROM ... WHERE parent_id = :parentNodeId FOR UPDATE
or an equivalent DB-side atomic increment) or add a unique constraint on
(parent_id, column_position) and implement a retry-on-constraint-violation
strategy; ensure the new repository method is used in getNextColumnPosition and
that the surrounding service call is annotated/handled with a transaction to
prevent concurrent duplicates.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 243a4303-d277-4f19-a49a-beb510f44a97
📒 Files selected for processing (6)
src/main/java/org/gridsuite/study/server/repository/networkmodificationtree/NetworkModificationNodeInfoRepository.javasrc/main/java/org/gridsuite/study/server/repository/networkmodificationtree/NodeRepository.javasrc/main/java/org/gridsuite/study/server/service/NetworkModificationTreeService.javasrc/test/java/org/gridsuite/study/server/NetworkModificationTreeTest.javasrc/test/java/org/gridsuite/study/server/studycontroller/NodeControllerTest.javasrc/test/java/org/gridsuite/study/server/studycontroller/StudyTestBase.java
…into set_node_column_position_when_creation
…into set_node_column_position_when_creation
|



PR Summary