Conversation
Signed-off-by: basseche <bassel.el-cheikh_externe@rte-france.com>
📝 WalkthroughWalkthroughAdded a new immutable DTO Changes
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 the current code and only fix it if needed.
Inline comments:
In `@src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java`:
- Around line 50-51: The new DTO field lineSegments
(LineCreationInfos.lineSegments / getLineSegments()) is accepted but never used
in LineCreation.check() or LineCreation.apply(), causing a silent no-op; add a
fail-fast validation in LineCreation.check() that detects a non-null/non-empty
dto.getLineSegments() and throws a clear validation exception (or
IllegalArgumentException/ValidationException consistent with existing error
handling) stating that lineSegments is not yet supported, so callers receive an
immediate, descriptive error instead of the field being ignored.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f034b298-8b98-46f7-83b8-6477b1c9c752
📒 Files selected for processing (2)
src/main/java/org/gridsuite/modification/dto/LineCreationInfos.javasrc/main/java/org/gridsuite/modification/dto/LineSegmentInfos.java
src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java
Outdated
Show resolved
Hide resolved
src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java
Outdated
Show resolved
Hide resolved
….java Co-authored-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
|
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java (1)
50-52:⚠️ Potential issue | 🟠 Major
lineSegmentsis exposed in DTO but still not applied during line creation.Lines [50]-[52] add a new input field, but the current execution path (
LineCreation.check/applyandModificationUtils.createLineAdder) does not consume it, so callers can send data that is silently ignored. Please fail fast until full processing is implemented.Proposed minimal safeguard
diff --git a/src/main/java/org/gridsuite/modification/modifications/LineCreation.java b/src/main/java/org/gridsuite/modification/modifications/LineCreation.java @@ public void check(Network network) throws NetworkModificationException { + if (modificationInfos.getLineSegments() != null && !modificationInfos.getLineSegments().isEmpty()) { + throw new NetworkModificationException(CREATE_LINE_ERROR, + "Line '" + modificationInfos.getEquipmentId() + "' : lineSegments are not yet supported"); + } if (network.getLine(modificationInfos.getEquipmentId()) != null) { throw new NetworkModificationException(LINE_ALREADY_EXISTS, modificationInfos.getEquipmentId()); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java` around lines 50 - 52, The new DTO field LineCreationInfos.lineSegments is accepted but not used; add a fail-fast validation so callers can't silently provide it: in LineCreation.check (and/or at the entry point in ModificationUtils.createLineAdder) detect a non-null/non-empty lineSegments on the incoming LineCreationInfos and throw a clear validation/illegal-argument exception (e.g., IllegalArgumentException or a domain ValidationException) with a message referencing "lineSegments" so the request is rejected until LineCreation.apply and ModificationUtils.createLineAdder are updated to consume the field.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java`:
- Around line 50-52: The new DTO field LineCreationInfos.lineSegments is
accepted but not used; add a fail-fast validation so callers can't silently
provide it: in LineCreation.check (and/or at the entry point in
ModificationUtils.createLineAdder) detect a non-null/non-empty lineSegments on
the incoming LineCreationInfos and throw a clear validation/illegal-argument
exception (e.g., IllegalArgumentException or a domain ValidationException) with
a message referencing "lineSegments" so the request is rejected until
LineCreation.apply and ModificationUtils.createLineAdder are updated to consume
the field.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d5ee7c68-03c0-447b-96e2-7639a955fa56
📒 Files selected for processing (1)
src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java



PR Summary
Add Line segments infos to line creation infos