Skip to content

Add line segment infos line modification#175

Open
basseche wants to merge 1 commit intoadd_LineSegmentInfos_LineCreationfrom
add_LineSegmentInfos_LineModification
Open

Add line segment infos line modification#175
basseche wants to merge 1 commit intoadd_LineSegmentInfos_LineCreationfrom
add_LineSegmentInfos_LineModification

Conversation

@basseche
Copy link
Copy Markdown
Contributor

PR Summary

Add line segment infos into LineModificationInfos

@basseche basseche self-assigned this Mar 31, 2026
@basseche basseche changed the base branch from main to add_LineSegmentInfos_LineCreation March 31, 2026 15:30
@basseche basseche changed the base branch from add_LineSegmentInfos_LineCreation to main March 31, 2026 15:31
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: de0aca3f-66e5-4ad2-a949-113aeb336c16

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR introduces a new LineSegmentInfos record with five immutable fields and adds a lineSegments field to both LineCreationInfos and LineModificationInfos DTOs, enabling support for line segments in line creation and modification operations.

Changes

Cohort / File(s) Summary
New Line Segment Data Model
src/main/java/org/gridsuite/modification/dto/LineSegmentInfos.java
Introduced a new public record with five immutable fields: segmentTypeId, segmentDistanceValue, area, temperature, and shapeFactor to represent line segment information.
DTO Extensions for Line Segments
src/main/java/org/gridsuite/modification/dto/LineCreationInfos.java, src/main/java/org/gridsuite/modification/dto/LineModificationInfos.java
Added lineSegments field of type List<LineSegmentInfos> with OpenAPI schema documentation to both creation and modification DTOs, supporting segment-based line configuration.
🚥 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 'Add line segment infos line modification' is directly related to the main change, which adds line segment information to line modification structures.
Description check ✅ Passed The description 'Add line segment infos into LineModificationInfos' is related to the changeset and accurately describes the primary addition of the PR.

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

@basseche basseche changed the base branch from main to add_LineSegmentInfos_LineCreation March 31, 2026 15:32
Signed-off-by: basseche <bassel.el-cheikh_externe@rte-france.com>
@basseche basseche force-pushed the add_LineSegmentInfos_LineModification branch from 4d4295f to 4fb2cf6 Compare March 31, 2026 15:34
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: 2

🤖 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: LineCreationInfos exposes the new field lineSegments but
the LineCreation class (methods check() and apply()) ignores it; either wire
lineSegments into the creation flow by validating and converting
LineCreationInfos.getLineSegments() in LineCreation.check()/apply() and using
those segments instead of the current generated segments (e.g., map
LineSegmentInfos -> domain segment objects and enforce limits/constraints), or
explicitly reject/handle the field by adding validation in LineCreation.check()
to throw a clear client error when lineSegments is non-empty (or
populate/normalize it back into the response) so clients are not silently
ignored.

In `@src/main/java/org/gridsuite/modification/dto/LineModificationInfos.java`:
- Around line 50-51: The new DTO field LineModificationInfos.lineSegments is
never consumed by the modification logic; update LineModification.apply() and/or
modifyLine() to read and use lineSegments from the provided
LineModificationInfos when computing segment-based limits (e.g., pass the list
into the existing limit-generation or segment-matching code paths) so the API
field takes effect, or alternatively add explicit validation in
LineModification.apply() that rejects requests containing non-empty lineSegments
with a clear error (throwing an exception or returning a validation failure) to
avoid silently ignored input; locate usages by the class/method names
LineModification, apply(), modifyLine(), and the DTO class LineModificationInfos
and incorporate the field into the limit calculation or validation flow
accordingly.
🪄 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: 7144ece6-2787-450a-9c6d-6872e1bb61ef

📥 Commits

Reviewing files that changed from the base of the PR and between db04ff4 and 4d4295f.

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

Comment on lines 50 to 51
@Schema(description = "Segments used from catalogue")
private List<LineSegmentInfos> lineSegments;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

lineSegments is currently a silent no-op in line creation flow.

LineCreationInfos now exposes lineSegments, but the execution path in src/main/java/org/gridsuite/modification/modifications/LineCreation.java (Line 33-75 snippet) does not consume it in check()/apply(). So clients can send segment data that is silently ignored.

Please either wire this field into creation logic (limit generation path) or reject/populate it explicitly until supported.

🤖 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 - 51, LineCreationInfos exposes the new field lineSegments but the
LineCreation class (methods check() and apply()) ignores it; either wire
lineSegments into the creation flow by validating and converting
LineCreationInfos.getLineSegments() in LineCreation.check()/apply() and using
those segments instead of the current generated segments (e.g., map
LineSegmentInfos -> domain segment objects and enforce limits/constraints), or
explicitly reject/handle the field by adding validation in LineCreation.check()
to throw a clear client error when lineSegments is non-empty (or
populate/normalize it back into the response) so clients are not silently
ignored.

Comment on lines +50 to +51
@Schema(description = "segments used from catalog to generate limits")
private List<LineSegmentInfos> lineSegments;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

lineSegments is not applied in line modification execution.

The added DTO field is not used by src/main/java/org/gridsuite/modification/modifications/LineModification.java (Line 28-77 snippet): apply() and modifyLine() never read lineSegments. This makes the new API field ineffective at runtime.

Please connect this field to the modification logic (or block unsupported input) to avoid false feature signaling.

🤖 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/LineModificationInfos.java`
around lines 50 - 51, The new DTO field LineModificationInfos.lineSegments is
never consumed by the modification logic; update LineModification.apply() and/or
modifyLine() to read and use lineSegments from the provided
LineModificationInfos when computing segment-based limits (e.g., pass the list
into the existing limit-generation or segment-matching code paths) so the API
field takes effect, or alternatively add explicit validation in
LineModification.apply() that rejects requests containing non-empty lineSegments
with a clear error (throwing an exception or returning a validation failure) to
avoid silently ignored input; locate usages by the class/method names
LineModification, apply(), modifyLine(), and the DTO class LineModificationInfos
and incorporate the field into the limit calculation or validation flow
accordingly.

@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant