Clean orphans when updating composite modifications#843
Conversation
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe repository's updateCompositeModification method now deletes a composite's previously held child modifications before reassigning the new ordered modification list. CompositeControllerTest is updated to use a dedicated networkModificationRepository for most stored-data queries while using modificationRepository specifically to verify deletion of stale child modifications. ChangesComposite update deletion fix and test verification
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/test/java/org/gridsuite/modification/server/CompositeControllerTest.java (1)
334-346: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winGood regression test for the orphan-cleanup fix.
Capturing the composite's actual cloned child UUIDs before update and asserting their deletion via
modificationRepository.findAllByIdIn(...)correctly targets the fix inNetworkModificationRepository.updateCompositeModification.This only covers flat/leaf sub-modifications though. Given the nested-composite orphan gap flagged in
NetworkModificationRepository.java(Lines 183-186), consider adding a variant where one of the composite's children is itself a nested composite, and assert its descendants are also deleted after the update.🤖 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 `@src/test/java/org/gridsuite/modification/server/CompositeControllerTest.java` around lines 334 - 346, Add a regression test that covers the nested-composite orphan cleanup gap in addition to the existing flat child case. In CompositeControllerTest, reuse the composite update flow around get(URI_GET_COMPOSITE_NETWORK_MODIF_CONTENT) and put(URI_COMPOSITE_NETWORK_MODIF_BASE, ...) but build a child structure where one child is itself a composite, then capture both the nested composite UUID and its descendant UUIDs before the update. After calling the update, assert via modificationRepository.findAllByIdIn(...) that the nested child and its descendants are all deleted, so the test exercises the behavior fixed in NetworkModificationRepository.updateCompositeModification.
🤖 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
`@src/test/java/org/gridsuite/modification/server/CompositeControllerTest.java`:
- Around line 334-346: Add a regression test that covers the nested-composite
orphan cleanup gap in addition to the existing flat child case. In
CompositeControllerTest, reuse the composite update flow around
get(URI_GET_COMPOSITE_NETWORK_MODIF_CONTENT) and
put(URI_COMPOSITE_NETWORK_MODIF_BASE, ...) but build a child structure where one
child is itself a composite, then capture both the nested composite UUID and its
descendant UUIDs before the update. After calling the update, assert via
modificationRepository.findAllByIdIn(...) that the nested child and its
descendants are all deleted, so the test exercises the behavior fixed in
NetworkModificationRepository.updateCompositeModification.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8357d15a-7348-4b0d-98a1-28cc8a761552
📒 Files selected for processing (2)
src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.javasrc/test/java/org/gridsuite/modification/server/CompositeControllerTest.java
Mathieu-Deharbe
left a comment
There was a problem hiding this comment.
Code OK, test OK.
|



PR Summary