Skip to content

Replicate composite submodifications root network applicability after copy#984

Open
Meklo wants to merge 2 commits intomainfrom
marcellinh/fix-composite-modification-to-exclude-copy
Open

Replicate composite submodifications root network applicability after copy#984
Meklo wants to merge 2 commits intomainfrom
marcellinh/fix-composite-modification-to-exclude-copy

Conversation

@Meklo
Copy link
Copy Markdown
Contributor

@Meklo Meklo commented Apr 29, 2026

PR Summary

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

📝 Walkthrough

Walkthrough

Adds a new NetworkModificationService method to fetch children UUIDs as a List, changes StudyService.copyModificationsToExclude to include descendant mappings by pairing original and copied descendant UUID lists, and updates tests to use repeated uuids query parameters and list literals.

Changes

Cohort / File(s) Summary
New UUID retrieval method
src/main/java/org/gridsuite/study/server/service/NetworkModificationService.java
Adds public List<UUID> findAllChildrenUuids(List<UUID> compositeUuids): early-return on empty input, builds children-uuids path with uuids query params, performs restTemplate.exchange, returns response body.
Modification copy mapping logic
src/main/java/org/gridsuite/study/server/service/StudyService.java
Updates copyModificationsToExclude to first map root-level copied UUIDs, then retrieve descendant UUID lists for both original and copied sets and pair them positionally up to the smaller list size to extend mappingModificationsUuids.
Tests: WireMock and list literals
src/test/java/org/gridsuite/study/server/NetworkModificationTest.java
Replaces Arrays.asList(...) with List.of(...), adjusts WireMock stubs/verification to accept ?uuids=x&uuids=y repeated query params and verifies the children-uuids endpoint is invoked for both original and copied requests; switches PUT assertions to WireMockUtilsCriteria.verifyPutRequest.

Suggested reviewers

  • Mathieu-Deharbe
  • SlimaneAmar
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Description check ❓ Inconclusive The description contains only a placeholder template with no actual content describing the changes or their purpose. Provide a meaningful description explaining what was changed, why it was changed, and any relevant implementation details or context for reviewers.
✅ Passed checks (3 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title accurately describes the main change: adding support to replicate composite submodifications' applicability after copy operations, which is implemented through the new method and enhanced copying logic.

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

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: 1

🤖 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/study/server/service/StudyService.java`:
- Around line 2504-2509: Don't zip descendant UUID lists positionally; instead,
for each original descendant UUID from
networkModificationService.findAllChildrenUuids(modificationsUuids) locate its
correct copy and populate mappingModificationsUuids. Concretely: iterate
originalChildren, for each originalChildUuid determine its parent/original
identity, use the existing mappingModificationsUuids to find the corresponding
copy-parent, then find the matching child UUID within the copy subtree (by
stable identifier such as externalId/name+type or by checking parent link) and
put(originalChildUuid, foundCopyChildUuid). Remove the Math.min positional zip
and ensure copyModificationsToExcludeFromTags(...) consumes this explicit
mapping so copies aren't mis-mapped or dropped.
🪄 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: 21700046-e332-4e12-9dc2-54cfad004b05

📥 Commits

Reviewing files that changed from the base of the PR and between bbc1053 and c94c353.

📒 Files selected for processing (2)
  • src/main/java/org/gridsuite/study/server/service/NetworkModificationService.java
  • src/main/java/org/gridsuite/study/server/service/StudyService.java

Comment thread src/main/java/org/gridsuite/study/server/service/StudyService.java
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.

🧹 Nitpick comments (1)
src/test/java/org/gridsuite/study/server/NetworkModificationTest.java (1)

2135-2139: Strengthen validation of repeated uuids semantics and descendant mapping behavior.

These assertions currently validate call count and a generic uuids presence, but they don’t prove repeated-query formatting or that original/copy descendant UUID sets are actually propagated. Consider asserting concrete query values per call (original UUIDs vs copied UUIDs) with non-empty children responses to fully cover the PR objective.

Also applies to: 2158-2159, 2216-2220, 2239-2240

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/test/java/org/gridsuite/study/server/NetworkModificationTest.java` around
lines 2135 - 2139, The test stubs and verifications need to explicitly validate
repeated uuids query formatting and that descendant UUIDs are propagated; update
the WireMock stubs and verifications in NetworkModificationTest so the
children-uuids endpoint returns non-empty lists and use query-param matching
(e.g., replace broad urlPathMatching-only stubs with
urlPathEqualTo("/v1/network-composite-modifications/children-uuids") plus
WireMock.withQueryParam("uuids", WireMock.equalTo(...)) or verify calls with
WireMock.verify(getRequestedFor(urlPathEqualTo(...)).withQueryParam("uuids",
equalTo(...))) to assert the first call carries the original UUID set and the
second call carries the copied UUID set, and adjust the stubbed responses
(mapper.writeValueAsString(List.of(...))) accordingly; apply the same change
pattern to the other occurrences noted around the test (the other children-uuids
stubs/verifications).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/test/java/org/gridsuite/study/server/NetworkModificationTest.java`:
- Around line 2135-2139: The test stubs and verifications need to explicitly
validate repeated uuids query formatting and that descendant UUIDs are
propagated; update the WireMock stubs and verifications in
NetworkModificationTest so the children-uuids endpoint returns non-empty lists
and use query-param matching (e.g., replace broad urlPathMatching-only stubs
with urlPathEqualTo("/v1/network-composite-modifications/children-uuids") plus
WireMock.withQueryParam("uuids", WireMock.equalTo(...)) or verify calls with
WireMock.verify(getRequestedFor(urlPathEqualTo(...)).withQueryParam("uuids",
equalTo(...))) to assert the first call carries the original UUID set and the
second call carries the copied UUID set, and adjust the stubbed responses
(mapper.writeValueAsString(List.of(...))) accordingly; apply the same change
pattern to the other occurrences noted around the test (the other children-uuids
stubs/verifications).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cdc991f7-7cbc-4606-973e-f6e1c78607ea

📥 Commits

Reviewing files that changed from the base of the PR and between c94c353 and 0c45d13.

📒 Files selected for processing (1)
  • src/test/java/org/gridsuite/study/server/NetworkModificationTest.java

@Meklo Meklo changed the title Replicate composite submodifications applicability after copy Replicate composite submodifications root network applicability after copy Apr 29, 2026
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
78.9% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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