Skip to content

Temporary fix to handle "null" subject names in security analysis result#244

Merged
antoinebhs merged 1 commit into
mainfrom
fix-null-string
May 19, 2026
Merged

Temporary fix to handle "null" subject names in security analysis result#244
antoinebhs merged 1 commit into
mainfrom
fix-null-string

Conversation

@antoinebhs
Copy link
Copy Markdown
Contributor

@antoinebhs antoinebhs commented May 19, 2026

PR Summary

In powsybl, limit violation can be created with "null" or null subject name. This is an issue for our code where we try to make distinct pairs relying on subjectid/subjectname (null is considered different to "null").
This fix can be reverted once powsybl/powsybl-core#3922 is merged.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4ca4f5d6-2e01-4f9d-99ec-566e3d760dec

📥 Commits

Reviewing files that changed from the base of the PR and between c6766fb and 4aae9d2.

📒 Files selected for processing (2)
  • src/main/java/org/gridsuite/securityanalysis/server/entities/SecurityAnalysisResultEntity.java
  • src/test/java/org/gridsuite/securityanalysis/server/SecurityAnalysisResultEntityTest.java

📝 Walkthrough

Walkthrough

SecurityAnalysisResultEntity adds a normalization helper that converts the literal string "null" to actual null when building the unique subject violations list. A new test validates that two limit violations—one with null and one with "null"—are properly deduplicated in the resulting entity.

Changes

Subject Name Normalization

Layer / File(s) Summary
Subject name normalization helper
src/main/java/org/gridsuite/securityanalysis/server/entities/SecurityAnalysisResultEntity.java
Added normalizeSubjectName method that converts the literal "null" string to actual null when mapping subject names for unique SubjectLimitViolationEntity entries. FIXME comment marks the normalization location.
Normalization behavior test
src/test/java/org/gridsuite/securityanalysis/server/SecurityAnalysisResultEntityTest.java
Test validates that toEntity(...) correctly deduplicates limit violations by normalizing subject names, collapsing a null and "null" entry into a single subject violation.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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: normalizing 'null' subject names in security analysis results to handle a specific powsybl issue.
Description check ✅ Passed The description clearly explains the problem (powsybl creating limit violations with 'null' or null subject names), the solution, and that it's a temporary fix pending an upstream PR merge.
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.

@antoinebhs antoinebhs requested a review from etiennehomer May 19, 2026 09:37
@sonarqubecloud
Copy link
Copy Markdown

@antoinebhs antoinebhs merged commit fce3055 into main May 19, 2026
4 checks passed
@antoinebhs antoinebhs deleted the fix-null-string branch May 19, 2026 12:41
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