Skip to content

copy cut paste reference modification and add ref with target infos - #1058

Open
souissimai wants to merge 6 commits into
mainfrom
reference-modification-actions
Open

copy cut paste reference modification and add ref with target infos#1058
souissimai wants to merge 6 commits into
mainfrom
reference-modification-actions

Conversation

@souissimai

Copy link
Copy Markdown
Contributor

PR Summary

Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 1bab8d03-e8e2-4222-a20c-4480e710aa19

📥 Commits

Reviewing files that changed from the base of the PR and between 2d449d6 and 6a4fcce.

📒 Files selected for processing (1)
  • src/main/java/org/gridsuite/study/server/service/StudyService.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/org/gridsuite/study/server/service/StudyService.java

📝 Walkthrough

Walkthrough

duplicateNetworkModifications now retrieves modification references and registers shared-composite references for the destination node after duplication and exclusion mapping.

Changes

Network duplication

Layer / File(s) Summary
Register shared composite references
src/main/java/org/gridsuite/study/server/service/StudyService.java
The duplication workflow retrieves references, extracts referenced modification IDs, and registers them with the directory service for the target node and user.
Validate reference lookups
src/test/java/org/gridsuite/study/server/NetworkModificationTest.java
Duplication tests stub empty reference responses and verify lookup counts for same-study, child-mapping, and cross-study duplication.

Mergeability Score: ⚪ Minimal · up to 6a4fc

The change presents no actionable merge-blocking risk based on the available evidence and is ready for normal checks and review.

🚥 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 template comment and does not provide a meaningful summary of the changes. Replace the template with a concise summary of reference modification copying, cutting, pasting, and target information support.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title identifies the main change: copying, cutting, pasting reference modifications, and adding target information.
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

🧹 Nitpick comments (1)
src/main/java/org/gridsuite/study/server/service/StudyService.java (1)

2167-2175: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Add regression coverage for reference registration.

src/test/java/org/gridsuite/study/server/rootnetworks/ModificationToExcludeTest.java verifies exclusion mappings but not the new directory-server side effect. Add a test that stubs networkModificationService.getReferences(...) and verifies directoryService.createsReferencesToSharedComposites(...) receives the shared element UUID and targetNodeUuid. Cover multiple references and an empty result.

🤖 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 2167 - 2175, Add regression tests in ModificationToExcludeTest for the
reference-registration flow around createReferencesToSharedComposites: stub
networkModificationService.getReferences(...) and verify
directoryService.createsReferencesToSharedComposites(...) is called with each
shared element UUID and targetNodeUuid, covering multiple references and an
empty result with no calls.
🤖 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/service/StudyService.java`:
- Around line 2161-2165: The workflow around
networkModificationService.duplicateModifications must not depend on the local
transaction for remote directory-server writes. Make
createReferencesToSharedComposites idempotent and retryable, or track each
completed reference and compensate both those references and the duplicated
modifications on failure before propagating the error.

---

Nitpick comments:
In `@src/main/java/org/gridsuite/study/server/service/StudyService.java`:
- Around line 2167-2175: Add regression tests in ModificationToExcludeTest for
the reference-registration flow around createReferencesToSharedComposites: stub
networkModificationService.getReferences(...) and verify
directoryService.createsReferencesToSharedComposites(...) is called with each
shared element UUID and targetNodeUuid, covering multiple references and an
empty result with no calls.
🪄 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: b24090fe-464b-40e8-9a61-63b234061fd4

📥 Commits

Reviewing files that changed from the base of the PR and between fcd627b and dab4a3f.

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

Comment on lines +2161 to 2165
createReferencesToSharedComposites(networkModificationService.getReferences(modificationsUuids), userId, targetNodeUuid);
return networkModificationResults;
},
userId);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Do not rely on the local transaction to coordinate remote writes.

After networkModificationService.duplicateModifications(...) returns, this code issues one or more remote directory-server POST requests. The local @Transactional boundary cannot roll back a completed remote request. A failure after one request can leave copied modifications with incomplete directory references. Use an idempotent and retryable workflow, or compensate every completed reference and the duplicated modifications before returning an error.

🤖 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 2161 - 2165, The workflow around
networkModificationService.duplicateModifications must not depend on the local
transaction for remote directory-server writes. Make
createReferencesToSharedComposites idempotent and retryable, or track each
completed reference and compensate both those references and the duplicated
modifications on failure before propagating the error.

SOUISSI Maissa (Externe) added 3 commits August 12, 2026 22:16
SOUISSI Maissa (Externe)
fix
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>
Signed-off-by: SOUISSI Maissa (Externe) <souissimai@gm0winl878.bureau.si.interne>

@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/test/java/org/gridsuite/study/server/NetworkModificationTest.java`:
- Around line 2346-2350: Update the reference lookup stubs and verifications in
the affected duplication tests to match the expected original and copied UUID
query values explicitly, rather than accepting any uuids parameter. Verify each
duplication operation performs exactly one lookup with its correct UUIDs,
including the cases currently using aggregate counts, while preserving the
existing no-reference response behavior.
🪄 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: 172843bd-b608-4798-9bac-0691ad90f60c

📥 Commits

Reviewing files that changed from the base of the PR and between a421f4a and 11e5328.

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

Comment on lines +2346 to +2350
// no shared-composite reference among the duplicated modifications
wireMockServer.stubFor(WireMock.get(WireMock.urlPathEqualTo("/v1/references"))
.willReturn(WireMock.ok()
.withBody(mapper.writeValueAsString(Map.of()))
.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Assert the UUIDs used in each reference lookup.

The /v1/references stubs match any query, and the verifications accept any uuids value. These tests can pass when the service omits an ID, sends the wrong original or copied ID, or sends an empty value. At Line 2405, the aggregate count across two duplications also does not prove that each operation performs one lookup. Match the expected UUIDs for each request and verify the count per duplication operation.

Also applies to: 2405-2405, 2452-2457, 2475-2475, 2512-2515, 2538-2538

🤖 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/test/java/org/gridsuite/study/server/NetworkModificationTest.java` around
lines 2346 - 2350, Update the reference lookup stubs and verifications in the
affected duplication tests to match the expected original and copied UUID query
values explicitly, rather than accepting any uuids parameter. Verify each
duplication operation performs exactly one lookup with its correct UUIDs,
including the cases currently using aggregate counts, while preserving the
existing no-reference response behavior.

@sonarqubecloud

Copy link
Copy Markdown

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