Skip to content

Add applicability per root network tag on network modifications - #219

Open
flomillot wants to merge 7 commits into
mainfrom
florent/GRD-4941-modification-applicability
Open

Add applicability per root network tag on network modifications#219
flomillot wants to merge 7 commits into
mainfrom
florent/GRD-4941-modification-applicability

Conversation

@flomillot

@flomillot flomillot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

A network modification now carries its applicability per root network tag, next to its global activated flag: Map<String, Boolean> applicabilityByRootNetworkTag, where a tag without an entry is applicable.

isActivatedOn(rootNetworkTag) gathers the rule used by the servers when applying modifications: !stashed && activated && applicability.getOrDefault(tag, true). The stash is part of the rule so that every caller shares a single predicate; a stashed modification can no longer be applied to a network.

Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@flomillot, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c4da9ba-88c3-4ba0-9dcd-daa88f32e6dc

📥 Commits

Reviewing files that changed from the base of the PR and between 767099f and ceeca5e.

📒 Files selected for processing (2)
  • src/test/java/org/gridsuite/modification/dto/ModificationInfosTest.java
  • src/test/java/org/gridsuite/modification/modifications/TwoWindingsTransformerCreationNodeBreakerTest.java

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f6acba04-ac96-49c3-bdc5-ffa54ddc43cd

📥 Commits

Reviewing files that changed from the base of the PR and between d29b0e4 and 767099f.

📒 Files selected for processing (1)
  • src/main/java/org/gridsuite/modification/dto/ModificationInfos.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/org/gridsuite/modification/dto/ModificationInfos.java

📝 Walkthrough

Walkthrough

ModificationInfos now supports optional per-root-network applicability. Stashed or globally inactive modifications are not activated. Null, absent, and unmapped tags remain applicable unless explicitly mapped to false. Tests cover these rules.

Changes

Root-network applicability

Layer / File(s) Summary
Applicability contract and evaluation
src/main/java/org/gridsuite/modification/dto/ModificationInfos.java, src/test/java/org/gridsuite/modification/dto/ModificationInfosTest.java
Adds applicabilityByRootNetworkTag and isActivatedOn(String). The method rejects stashed or globally inactive modifications and tags explicitly mapped to false. Tests cover null, missing, and tag-specific applicability.

Suggested reviewers: etiennehomer

🚥 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 clearly and concisely describes the addition of per-root-network-tag applicability.
Description check ✅ Passed The description accurately explains the new applicability map and the isActivatedOn activation rule.
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.

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.

@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/dto/ModificationInfos.java`:
- Around line 165-167: Update the applicability check in ModificationInfos so a
null value for the rootNetworkTag entry is treated as applicable, with only an
explicit Boolean false disabling it; avoid returning a nullable Boolean that can
be unboxed. Add a regression test covering an applicabilityByRootNetworkTag
entry whose value is null.
🪄 Autofix

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 Plus

Run ID: 9a164320-11d9-46ea-8088-e0310a976005

📥 Commits

Reviewing files that changed from the base of the PR and between 1845908 and 3a0ef83.

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

Comment thread src/main/java/org/gridsuite/modification/dto/ModificationInfos.java Outdated
flomillot and others added 6 commits August 10, 2026 11:12
The method combines the global activation flag and the per root network tag
applicability, while being applicable refers to the tag alone.

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
A stashed modification is not activated on any root network: the stash is now
part of the activation rule instead of being checked separately by every
caller. An undefined stash flag keeps the default of the field, not stashed.

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
….java

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
A tag mapped to a null value reaches the DTO through deserialization. The map
lookup now tells it apart from an explicit false, and the test locks that in.

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
…string

The test compares a hardcoded toString, which lombok now renders with
applicabilityByRootNetworkTag between activated and description.

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
@sonarqubecloud

Copy link
Copy Markdown

assertEquals(
"TwoWindingsTransformerCreationInfos(super=BranchCreationInfos(super=EquipmentCreationInfos(super=EquipmentModificationInfos(super=ModificationInfos(uuid=null, "
+ "type=TWO_WINDINGS_TRANSFORMER_CREATION, date=null, stashed=false, messageType=null, messageValues=null, activated=true, description=a dummy description), "
+ "type=TWO_WINDINGS_TRANSFORMER_CREATION, date=null, stashed=false, messageType=null, messageValues=null, activated=true, applicabilityByRootNetworkTag=null, "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can applicabilityByRootNetworkTag be null ? for a modification stored in gridexplore for example ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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