Skip to content

add Line segments infos#172

Open
basseche wants to merge 4 commits intomainfrom
add_LineSegmentInfos_LineCreation
Open

add Line segments infos#172
basseche wants to merge 4 commits intomainfrom
add_LineSegmentInfos_LineCreation

Conversation

@basseche
Copy link
Copy Markdown
Contributor

@basseche basseche commented Mar 24, 2026

PR Summary

Add Line segments infos to line creation infos

Signed-off-by: basseche <bassel.el-cheikh_externe@rte-france.com>
@basseche basseche self-assigned this Mar 24, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

Added a new immutable DTO LineSegmentInfos and a lineSegments List field on LineCreationInfos to carry segment details for line creation modifications.

Changes

Cohort / File(s) Summary
New Line Segment Data Structure
src/main/java/org/gridsuite/modification/dto/LineSegmentInfos.java
Added public record LineSegmentInfos(String segmentTypeId, Integer segmentDistanceValue, String area, String temperature, Double shapeFactor) representing individual line segment details.
Line Creation Enhancement
src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java
Added private List<LineSegmentInfos> lineSegments with @Schema(description = "Segments used from catalog"); Lombok-generated accessors remain.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding LineSegmentInfos to the line creation DTO structure.
Description check ✅ Passed The description is directly related to the changeset, explaining that line segment information is being added to line creation infos.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 38f7d60 and 7d8a9dd.

📒 Files selected for processing (2)
  • src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java
  • src/main/java/org/gridsuite/modification/dto/LineSegmentInfos.java

basseche and others added 2 commits March 31, 2026 17:31
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java (1)

50-52: ⚠️ Potential issue | 🟠 Major

lineSegments is 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/apply and ModificationUtils.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

📥 Commits

Reviewing files that changed from the base of the PR and between f7d3479 and ec44af5.

📒 Files selected for processing (1)
  • src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants