Skip to content

Make root network applicabilities explicit - #932

Merged
flomillot merged 9 commits into
mainfrom
refactor/explicit-root-network-applicabilities
Oct 23, 2026
Merged

flomillot merged 9 commits into
mainfrom
refactor/explicit-root-network-applicabilities

Conversation

@flomillot

@flomillot flomillot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Upgrades network-modification to 2.3.0, which includes gridsuite/network-modification#249: a modification must hold an applicability for every root network tag it is applied on.

Written modifications (creation, duplication, group duplication, composite split and insertion) are associated with the root network tags of the application contexts before being applied, down to their content and the shared modifications they point to. A modification moved into a composite, or the content replacing the one of a composite, is associated with the tags of the composite; an assembled composite with the tags of its content. POST /groups/{uuid}/duplicate takes the rootNetworkTags of the target study.

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

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ef62d652-acd5-4ef8-8b96-144840bb12b5
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

…t-network-applicabilities

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

/**
* Makes the modification applicable on the root network tag, unless it already holds an applicability for it.

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.

Too verbose ?
The code is pretty self-explanatory here

}

/**
* @return the root network tags the modification is associated with, that is the ones it holds an applicability for

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.

Too verbose ?
The code is pretty self-explanatory here

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.

I think a sentence is faster to read but as discussed OK

AND NOT EXISTS (SELECT 1 FROM ModificationRootNetworkApplicabilityEntity a
WHERE a.modification = m AND a.rootNetworkTag = :tag)
""")
void setDefaultApplicabilityIfMissing(@Param("ids") Collection<UUID> ids, @Param("tag") String tag);

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.

Rather do this in java to simplify the code ?

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.

I don't think we need performance optimization here

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.

You're right it's useless here I remove it

if (sharedUuids.isEmpty()) {
return;
}
Set<UUID> sharedTreesUuids = getSharedModificationTreesFrom(sharedUuids).allUuids();

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.

You could do something like :

List<ModificationEntity> sharedTreeModifications = modificationRepository.findAllWithApplicabilitiesByIdIn(sharedTreesUuids);
        sharedTreeModifications.stream()
                .filter(modification -> !(modification instanceof ModificationReferenceEntity))
                .forEach(modification -> rootNetworkTags.forEach(modification::setDefaultApplicabilityIfMissing));

@etiennehomer etiennehomer Oct 20, 2026 •

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.

And with such code you could have only one method for modification and shared ones in setDefaultApplicabilitiesIfMissing(List<ModificationEntity> modificationEntities, Collection<String> rootNetworkTags)

@flomillot flomillot Oct 21, 2026 •

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.

Ok I merged them

Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
@flomillot
flomillot requested a review from EtienneLt as a code owner October 21, 2026 13:52
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
flomillot and others added 2 commits October 23, 2026 15:51
@sonarqubecloud

Copy link
Copy Markdown

@flomillot
flomillot merged commit 0d5deaa into main Oct 23, 2026
4 checks passed
@flomillot
flomillot deleted the refactor/explicit-root-network-applicabilities branch October 23, 2026 14:34
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