Skip to content

remove Disconnector default value from create section#202

Open
EtienneLt wants to merge 1 commit into
mainfrom
remove-default-value-for-createSection
Open

remove Disconnector default value from create section#202
EtienneLt wants to merge 1 commit into
mainfrom
remove-default-value-for-createSection

Conversation

@EtienneLt

Copy link
Copy Markdown
Contributor

PR Summary

linked to powsybl/powsybl-core#3935

Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
@EtienneLt EtienneLt self-assigned this Jun 15, 2026
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

In CreateVoltageLevelSection, the builder configuration for leftSwitchKind and rightSwitchKind is changed so that absent values are passed as null instead of defaulting to SwitchKind.DISCONNECTOR.

Changes

Null Switch Kind Fallback

Layer / File(s) Summary
Null fallback for left/right switch kinds
src/main/java/org/gridsuite/modification/modifications/CreateVoltageLevelSection.java
leftSwitchKind and rightSwitchKind builder inputs now resolve to null when absent, removing the previous implicit SwitchKind.DISCONNECTOR default.
🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: removing the Disconnector default value from switch kind parameters in the CreateVoltageLevelSection class.
Description check ✅ Passed The description is concise but related to the changeset, explaining the change is linked to a corresponding modification in the powsybl-core repository.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 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/modification/modifications/CreateVoltageLevelSection.java`:
- Around line 87-88: The code now allows null values for leftSwitchKind and
rightSwitchKind to be passed through to withLeftSwitchKind and
withRightSwitchKind methods without defaulting to DISCONNECTOR. Add a new
regression test case that omits these switch-kind fields entirely (leaving them
null) to verify that null values are properly propagated through the
CreateVoltageLevelSection modification and that no implicit DISCONNECTOR
defaulting occurs. This test should validate the new null-handling contract
alongside the existing tests that cover explicit BREAKER and DISCONNECTOR
values.
🪄 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: 74d1b1bd-e6b5-46aa-aae6-559a6c5ce62f

📥 Commits

Reviewing files that changed from the base of the PR and between 76e5f3d and 05d7b1a.

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

Comment on lines +87 to +88
.withLeftSwitchKind(modificationInfos.getLeftSwitchKind() != null ? SwitchKind.valueOf(modificationInfos.getLeftSwitchKind()) : null)
.withRightSwitchKind(modificationInfos.getRightSwitchKind() != null ? SwitchKind.valueOf(modificationInfos.getRightSwitchKind()) : null)

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 | 🟡 Minor | ⚡ Quick win

Add a regression test for the new null switch-kind path.

This change intentionally alters defaulting semantics, but current referenced tests only cover explicit "BREAKER"/"DISCONNECTOR" inputs. Please add a test where leftSwitchKind and rightSwitchKind are omitted to lock the new contract (null propagated, no implicit DISCONNECTOR default).

🤖 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/main/java/org/gridsuite/modification/modifications/CreateVoltageLevelSection.java`
around lines 87 - 88, The code now allows null values for leftSwitchKind and
rightSwitchKind to be passed through to withLeftSwitchKind and
withRightSwitchKind methods without defaulting to DISCONNECTOR. Add a new
regression test case that omits these switch-kind fields entirely (leaving them
null) to verify that null values are properly propagated through the
CreateVoltageLevelSection modification and that no implicit DISCONNECTOR
defaulting occurs. This test should validate the new null-handling contract
alongside the existing tests that cover explicit BREAKER and DISCONNECTOR
values.

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