Skip to content

transmit CompositesToBeInserted to network modifications server#1004

Draft
Mathieu-Deharbe wants to merge 4 commits into
mainfrom
transmit-composites-to-be-inserted
Draft

transmit CompositesToBeInserted to network modifications server#1004
Mathieu-Deharbe wants to merge 4 commits into
mainfrom
transmit-composites-to-be-inserted

Conversation

@Mathieu-Deharbe

Copy link
Copy Markdown
Contributor

PR Summary

Signed-off-by: Mathieu DEHARBE <[email protected]>
@Mathieu-Deharbe Mathieu-Deharbe self-assigned this Jun 4, 2026
@Mathieu-Deharbe Mathieu-Deharbe marked this pull request as draft June 4, 2026 15:57
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c169bc1a-d4e1-4754-8f57-07f460614284

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This pull request generalizes the composite modifications insertion payload contract from a strictly-typed List<Pair<UUID, String>> to a generic List<Object> across the REST controller, study service, and network modification service layers, allowing more flexible payload handling throughout the insertion workflow.

Changes

Composite Modifications Payload Generalization

Layer / File(s) Summary
Payload contract generalization across call chain
src/main/java/org/gridsuite/study/server/controller/StudyController.java, src/main/java/org/gridsuite/study/server/service/StudyService.java, src/main/java/org/gridsuite/study/server/service/NetworkModificationService.java
The insertCompositeModifications REST endpoint changes its request body parameter from @RequestBody List<Pair<UUID, String>> modificationsToInsert to @RequestBody List<Object> compositesToBeInserted, and the helper method forwards the new payload type. StudyService.insertCompositeNetworkModifications(...) updates its compositesInfos parameter from List<Pair<UUID, String>> to List<Object>, and NetworkModificationService.insertCompositeModifications(...) changes its paired payload structure from Pair<List<Pair<UUID, String>>, List<ModificationApplicationContext>> to Pair<List<Object>, List<ModificationApplicationContext>>, with the HttpEntity generic type updated accordingly.

Suggested Reviewers

  • Meklo
  • SlimaneAmar
  • souissimai
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is empty and contains no substantive information about the changes made. Provide a detailed description explaining the rationale for changing from List<Pair<UUID, String>> to List, impact on callers, and testing performed.
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating the composite insertion mechanism to pass composites as a generic list to the network modifications server.
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.

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


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.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/org/gridsuite/study/server/service/StudyService.java (1)

2337-2346: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Replace List<Object> with a typed/validated payload contract for composite network modifications.

StudyService.insertCompositeNetworkModifications(...) now takes compositesInfos as List<Object> and forwards it unchanged into NetworkModificationService.insertCompositeModifications(...) as Pair<List<Object>, List<ModificationApplicationContext>>, which then sends it to the network-modification-server. This removes the study-server boundary schema/type guarantees, so malformed JSON array elements will only surface downstream at runtime rather than being rejected/validated early (e.g., StudyService.java:2337-2346, NetworkModificationService.java:285-296).
Define explicit DTO(s (or use JsonNode with per-shape validation) for the supported composite item structures before forwarding.

🤖 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/study/server/service/StudyService.java` around
lines 2337 - 2346, StudyService.insertCompositeNetworkModifications currently
accepts compositesInfos as List<Object] and forwards it to
NetworkModificationService.insertCompositeModifications, losing type guarantees;
replace the raw List<Object> with a typed DTO (or JsonNode with validation)
representing the allowed composite item shapes, update the method signature and
call sites (StudyService.insertCompositeNetworkModifications,
duplicateModificationsOrInsertComposites invocation, and
NetworkModificationService.insertCompositeModifications) to use
List<YourCompositeDto> (or List<JsonNode> plus explicit per-item validation),
add validation logic to reject/transform malformed items before constructing the
Pair passed to networkModificationService, and adjust any downstream handling to
consume the new DTO type.
🧹 Nitpick comments (1)
src/main/java/org/gridsuite/study/server/controller/StudyController.java (1)

693-695: ⚡ Quick win

Make the request-body schema explicit in docs despite using List<Object>.

The Javadoc mentions List<CompositesToBeInserted>, but the actual method signature is List<Object>. Add explicit OpenAPI schema/examples for this endpoint so client contract remains clear and codegen/documentation do not degrade into “array of any”.

🤖 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/study/server/controller/StudyController.java`
around lines 693 - 695, The endpoint currently takes List<Object> (parameter
compositesToBeInserted) which yields an "array of any" in docs; annotate the
controller method in StudyController to provide an explicit OpenAPI request-body
schema by adding `@io.swagger.v3.oas.annotations.parameters.RequestBody` on the
method (or parameter) and supply Content with mediaType "application/json" and
an ArraySchema whose schema points to a concrete documentation-only type (e.g.
CompositesToBeInsertedDoc) or an inline `@Schema` describing expected properties;
if no runtime DTO exists create a small static inner class
CompositesToBeInsertedDoc with the fields used by network-modification-server
and reference it via
`@ArraySchema`(schema=`@Schema`(implementation=CompositesToBeInsertedDoc.class)) and
add an `@ExampleObject` to show a sample payload so codegen/docs produce a clear
contract despite the handler using List<Object>.
🤖 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/study/server/controller/StudyController.java`:
- Around line 699-715: The controller currently accepts List<Object>
compositesToBeInserted and forwards it to
handleInsertCompositeNetworkModifications without structural checks; add a
strict payload-shape validation step (either in insertCompositeModifications
before calling handleInsertCompositeNetworkModifications or at the top of
handleInsertCompositeNetworkModifications before calling
studyService.invalidateNodeTreeWithLF) that iterates compositesToBeInserted and
verifies each element matches the expected shape/type (e.g., Pair or Map with
required keys/types and any enum values), and if any element is invalid
immediately throw a 4xx (ResponseStatusException with BAD_REQUEST) so invalid
requests fail fast and prevent node-tree invalidation; reference the parameter
compositesToBeInserted, the controller method insertCompositeModifications, and
the helper handleInsertCompositeNetworkModifications when adding this guard.

---

Outside diff comments:
In `@src/main/java/org/gridsuite/study/server/service/StudyService.java`:
- Around line 2337-2346: StudyService.insertCompositeNetworkModifications
currently accepts compositesInfos as List<Object] and forwards it to
NetworkModificationService.insertCompositeModifications, losing type guarantees;
replace the raw List<Object> with a typed DTO (or JsonNode with validation)
representing the allowed composite item shapes, update the method signature and
call sites (StudyService.insertCompositeNetworkModifications,
duplicateModificationsOrInsertComposites invocation, and
NetworkModificationService.insertCompositeModifications) to use
List<YourCompositeDto> (or List<JsonNode> plus explicit per-item validation),
add validation logic to reject/transform malformed items before constructing the
Pair passed to networkModificationService, and adjust any downstream handling to
consume the new DTO type.

---

Nitpick comments:
In `@src/main/java/org/gridsuite/study/server/controller/StudyController.java`:
- Around line 693-695: The endpoint currently takes List<Object> (parameter
compositesToBeInserted) which yields an "array of any" in docs; annotate the
controller method in StudyController to provide an explicit OpenAPI request-body
schema by adding `@io.swagger.v3.oas.annotations.parameters.RequestBody` on the
method (or parameter) and supply Content with mediaType "application/json" and
an ArraySchema whose schema points to a concrete documentation-only type (e.g.
CompositesToBeInsertedDoc) or an inline `@Schema` describing expected properties;
if no runtime DTO exists create a small static inner class
CompositesToBeInsertedDoc with the fields used by network-modification-server
and reference it via
`@ArraySchema`(schema=`@Schema`(implementation=CompositesToBeInsertedDoc.class)) and
add an `@ExampleObject` to show a sample payload so codegen/docs produce a clear
contract despite the handler using List<Object>.
🪄 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: 486782b0-1382-4c22-9d7f-3f2d0c6c0474

📥 Commits

Reviewing files that changed from the base of the PR and between 9d8849b and b04a6a2.

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

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