Skip to content

Fix invalidated multiroot studies blocked nodes#1007

Merged
Meklo merged 4 commits into
mainfrom
marcellinh/fix-multiroot-study-invalidation-blocked-node
Jun 10, 2026
Merged

Fix invalidated multiroot studies blocked nodes#1007
Meklo merged 4 commits into
mainfrom
marcellinh/fix-multiroot-study-invalidation-blocked-node

Conversation

@Meklo

@Meklo Meklo commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

PR Summary

Unblock node tree only after all root networks have been invalidated. The previous approach oversaw that doUnbuildNodeTree locks all root networks so after unlocking the first root network it was getting locked again one the second pass

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Meklo, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 47 minutes and 24 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3147cf0f-e975-44d9-8e50-a6008a54884b

📥 Commits

Reviewing files that changed from the base of the PR and between 25131b1 and 1b7a40b.

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

Walkthrough

The PR refactors error handling for node tree unblocking across two service methods. SupervisionService.invalidateStudy adds a try/finally wrapper around its multi-root-network invalidation loop to guarantee unblockNodeTree always executes. Correspondingly, StudyService.invalidateStudyRootNetwork removes its own try/finally wrapper, simplifying its logic since the guarantee moves to the caller.

Changes

Error handling refactor for node tree unblocking

Layer / File(s) Summary
Move unblock guarantee from StudyService to SupervisionService
src/main/java/org/gridsuite/study/server/service/SupervisionService.java, src/main/java/org/gridsuite/study/server/service/StudyService.java
SupervisionService.invalidateStudy wraps the root network invalidation loop in try/finally to ensure unblockNodeTree is always called using the study's root node UUID. StudyService.invalidateStudyRootNetwork removes its own try/finally wrapper, trusting the caller to handle the unblock guarantee.

Test expansion for multi-root-network invalidation

Layer / File(s) Summary
Add second root network and assertions
src/test/java/org/gridsuite/study/server/SupervisionControllerTest.java
Test imports and fixtures updated; new helper addSecondRootNetwork; testInvalidateStudy extended to create a second root network, verify two remote invalidation calls, assert both remote deletions, and check node infos for both root networks have blockedNode == false.

Suggested reviewers

  • SlimaneAmar
  • AbdelHedhili
  • dbraquart
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing blocked nodes in multiroot studies after invalidation.
Description check ✅ Passed The description directly explains the fix: unblocking node tree after all root networks are invalidated, addressing the issue of premature unlocking.
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.


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.

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

3706-3710: Unblock contract is enforced by the only in-repo caller

StudyService.invalidateStudyRootNetwork(...) is called only from SupervisionService.invalidateStudy(...), and invalidateStudy(...) unblocks the tree in a finally block via studyService.unblockNodeTree(...). The tree won’t remain blocked on exceptions from invalidateStudyRootNetwork(...) when used this way.

Since invalidateStudyRootNetwork(...) is still public, consider reducing visibility or documenting that callers must always unblock (unblockNodeTree(...)) on failure.

🤖 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 3706 - 3710, The method StudyService.invalidateStudyRootNetwork(...) is
public but its unblock contract is enforced only by the in-repo caller
SupervisionService.invalidateStudy(...), which calls
studyService.unblockNodeTree(...) in a finally; to avoid accidental blocking
leaks either reduce the visibility of invalidateStudyRootNetwork(...) (make it
package-private or private) so it cannot be called externally without the
unblock guarantee, or explicitly document the requirement in the method javadoc
that callers MUST call unblockNodeTree(...) on failure; update the method
signature visibility and/or add a clear javadoc comment referencing
unblockNodeTree(...) and SupervisionService.invalidateStudy(...) so callers know
to unblock the tree on exceptions.
🤖 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.

Nitpick comments:
In `@src/main/java/org/gridsuite/study/server/service/StudyService.java`:
- Around line 3706-3710: The method StudyService.invalidateStudyRootNetwork(...)
is public but its unblock contract is enforced only by the in-repo caller
SupervisionService.invalidateStudy(...), which calls
studyService.unblockNodeTree(...) in a finally; to avoid accidental blocking
leaks either reduce the visibility of invalidateStudyRootNetwork(...) (make it
package-private or private) so it cannot be called externally without the
unblock guarantee, or explicitly document the requirement in the method javadoc
that callers MUST call unblockNodeTree(...) on failure; update the method
signature visibility and/or add a clear javadoc comment referencing
unblockNodeTree(...) and SupervisionService.invalidateStudy(...) so callers know
to unblock the tree on exceptions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b2ff5abb-4493-4c48-9126-ce22d22877d5

📥 Commits

Reviewing files that changed from the base of the PR and between 172e4a7 and 96a0ce1.

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

@etiennehomer etiennehomer left a comment

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.

We should execute testInvalidateStudy() with 2 root networks and check that all nodes are unblocked

@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/test/java/org/gridsuite/study/server/SupervisionControllerTest.java (1)

80-81: ⚡ Quick win

Unused constant SECOND_CASE_UUID.

The constant SECOND_CASE_UUID is declared but never referenced. Consider either using it in the addSecondRootNetwork helper (lines 173, 181) or removing it if not needed.

🤖 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/SupervisionControllerTest.java`
around lines 80 - 81, SECOND_CASE_UUID is declared but unused; update
addSecondRootNetwork to use this constant for the second case's UUID (e.g., when
constructing or setting up the Case/CaseEntity in addSecondRootNetwork) so the
test references the declared constant, or remove the SECOND_CASE_UUID
declaration if you prefer not to reference a specific UUID; ensure the symbol
SECOND_CASE_UUID is either consumed by addSecondRootNetwork or deleted to
eliminate the unused constant.
🤖 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/SupervisionControllerTest.java`:
- Around line 167-183: In addSecondRootNetwork, the two RootNetworkInfos
builders use UUID.randomUUID() separately for CaseInfos causing inconsistent
case IDs; replace both UUID.randomUUID() calls with the shared SECOND_CASE_UUID
constant so the CaseInfos passed to
rootNetworkService.insertCreationRequest(...) and
studyService.createRootNetwork(...) use the same UUID (update the CaseInfos(...)
constructors in both builder invocations).

---

Nitpick comments:
In `@src/test/java/org/gridsuite/study/server/SupervisionControllerTest.java`:
- Around line 80-81: SECOND_CASE_UUID is declared but unused; update
addSecondRootNetwork to use this constant for the second case's UUID (e.g., when
constructing or setting up the Case/CaseEntity in addSecondRootNetwork) so the
test references the declared constant, or remove the SECOND_CASE_UUID
declaration if you prefer not to reference a specific UUID; ensure the symbol
SECOND_CASE_UUID is either consumed by addSecondRootNetwork or deleted to
eliminate the unused constant.
🪄 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: b184152a-e491-44ed-875a-5fbff4084a09

📥 Commits

Reviewing files that changed from the base of the PR and between 96a0ce1 and 25131b1.

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

@sonarqubecloud

Copy link
Copy Markdown

@Meklo Meklo requested a review from etiennehomer June 10, 2026 12:43
@Meklo Meklo merged commit 4c32ece into main Jun 10, 2026
5 checks passed
@Meklo Meklo deleted the marcellinh/fix-multiroot-study-invalidation-blocked-node branch June 10, 2026 13:18
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