Skip to content

Node Activity - #1046

Open
ayolab wants to merge 30 commits into
mainfrom
ayolab/node-activity
Open

Node Activity#1046
ayolab wants to merge 30 commits into
mainfrom
ayolab/node-activity

Conversation

@ayolab

@ayolab ayolab commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Important

  • 🔍 Trigger review

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

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 622d262e-ae15-449d-902e-52cadcb537b1

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: ac131944-5537-4df9-a655-e562b8db63ef

📥 Commits

Reviewing files that changed from the base of the PR and between 32b60f6 and a667eb0.

📒 Files selected for processing (31)
  • src/main/java/org/gridsuite/study/server/controller/loadflow/LoadFlowStudyParametersController.java
  • src/main/java/org/gridsuite/study/server/service/StudyService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationRestService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationRestService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/impl/DynamicSimulationRestServiceImpl.java
  • src/main/java/org/gridsuite/study/server/service/loadflow/LoadFlowRestService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinRestService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitRestService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationRestService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitRestService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitService.java
  • src/main/resources/db/changelog/db.changelog-master.yaml
  • src/test/java/org/gridsuite/study/server/controller/loadflow/LoadFlowStudyParametersControllerTest.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFlowTest.java
  • src/test/java/org/gridsuite/study/server/rootnetworks/RootNetworkTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationServiceTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisRestServiceTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationRestServiceTest.java
  • src/test/java/org/gridsuite/study/server/studycontroller/StudyTest.java
  • src/test/java/org/gridsuite/study/server/utils/TestUtils.java
🚧 Files skipped from review as they are similar to previous changes (29)
  • src/main/resources/db/changelog/db.changelog-master.yaml
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationRestService.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationRestServiceTest.java
  • src/main/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationRestService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitRestService.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/impl/DynamicSimulationRestServiceImpl.java
  • src/main/java/org/gridsuite/study/server/service/loadflow/LoadFlowRestService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitRestService.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisService.java
  • src/test/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationServiceTest.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationRestService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationService.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisRestServiceTest.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisRestService.java
  • src/test/java/org/gridsuite/study/server/rootnetworks/RootNetworkTest.java
  • src/test/java/org/gridsuite/study/server/studycontroller/StudyTest.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinRestService.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFlowTest.java
  • src/test/java/org/gridsuite/study/server/utils/TestUtils.java
  • src/main/java/org/gridsuite/study/server/service/StudyService.java

📝 Walkthrough

Walkthrough

The application replaces blocked-node state with persisted node activities. Controllers and asynchronous consumers track edits, builds, imports, and computations. Notifications, cleanup scheduling, database migrations, and tests now use the activity model.

Changes

Node activity coordination

Layer / File(s) Summary
Activity model and persistence
src/main/java/org/gridsuite/study/server/nodeactivity/*, src/main/java/org/gridsuite/study/server/repository/nodeactivity/*, src/main/resources/db/changelog/*
Adds activity types, entities, conflict rules, repositories, database schema, notifications, and abandoned-activity cleanup.
Workflow integration
src/main/java/org/gridsuite/study/server/controller/*, src/main/java/org/gridsuite/study/server/service/*
Wraps study edits and computation endpoints with node activities. Consumer workflows remove activities on completion, failure, or cancellation.
Legacy state and notification removal
src/main/java/org/gridsuite/study/server/networkmodificationtree/*, src/main/java/org/gridsuite/study/server/notification/*, src/main/java/org/gridsuite/study/server/error/*
Removes blocked-node and BUILDING state handling. Consolidates modification and event notifications.
Validation updates
src/test/java/org/gridsuite/study/server/*, src/test/java/org/gridsuite/study/server/nodeactivity/*
Adds activity conflict and service tests. Updates workflow tests and shared notification consumption helpers.

Suggested reviewers: klesaulnier

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided, so it does not explain the changeset. Add a brief description of the node activity system, including activity tracking, conflict handling, cleanup, and notification changes.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title identifies the main change: introducing node activity handling across study operations.
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.

@ayolab
ayolab force-pushed the ayolab/node-activity branch from 3031954 to 6ed5000 Compare August 4, 2026 08:21

@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: 5

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/ConsumerService.java (1)

415-452: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Fix unsafe studyUuid resolution in the error-cleanup paths.

In consumeCalculationStopped, studyUuid is declared before try (Line 458) and assigned inside try (Line 461). If networkModificationTreeService.getStudyUuidForNodeId throws there (for example, the node was deleted concurrently), studyUuid stays null. The finally block still runs endComputationActivity(studyUuid, receiverObj, computationType) with a null studyUuid (Line 481), because the guard only checks receiverObj != null. This can silently fail to remove the node activity, or throw an unrelated NullPointerException that hides the original failure.

consumeCalculationFailed has a related risk: it resolves studyUuid entirely inside finally (Line 439). If that lookup throws, the finally block aborts before quota release (Line 443) and before emitStudyError (Line 448) run. The user never receives the failure notification.

Guard the null case explicitly, and keep the original defensive intent (always attempt cleanup even if earlier steps failed).

🛡️ Proposed fix for consumeCalculationStopped
             } catch (JsonProcessingException e) {
                 LOGGER.error(e.toString());
             } finally {
-                if (receiverObj != null) {
+                if (receiverObj != null && studyUuid != null) {
                     endComputationActivity(studyUuid, receiverObj, computationType);
+                } else if (receiverObj != null) {
+                    LOGGER.error("Could not resolve study for node '{}'; computation activity not released", receiverObj.getNodeUuid());
                 }
             }

Run the following to confirm how removeNodeActivity behaves with a null study identifier:

#!/bin/bash
rg -n -B3 -A15 'void removeNodeActivity' src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java

Also applies to: 454-485

🤖 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/ConsumerService.java` around
lines 415 - 452, Harden the finally cleanup in consumeCalculationStopped and
consumeCalculationFailed against getStudyUuidForNodeId failures or null results.
Resolve studyUuid defensively, call endComputationActivity and emitStudyError
only when a valid studyUuid is available, and structure cleanup so quota release
still runs independently even if study lookup or notification cleanup fails.
Preserve the existing receiverObj guard and ensure earlier failures are not
masked by null-related 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.

Inline comments:
In `@src/main/java/org/gridsuite/study/server/controller/StudyController.java`:
- Around line 1322-1327: Update the build flow around StudyController’s
isNodeBuilt check and setNodeActivityUntilResult call so the built-state
decision and BUILD activity acquisition occur atomically, preventing a second
request from launching a duplicate build. Add a no-launch path that returns
without retaining an activity when the node is already built, while preserving
normal activity cleanup for launched builds, and add a concurrent regression
test covering this race.

In
`@src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java`:
- Around line 100-113: Serialize activity admission on a stable study-level
resource before the read and insert in NodeActivityService, ensuring concurrent
requests cannot both pass assertNoConflict; alternatively use serializable
admission with retry. In NodeActivityEntity, retain or update the database
uniqueness backstop so nullable all-root scopes are treated as non-distinct
duplicates, using matching Liquibase DDL where required. Apply changes at
src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java
lines 100-113 and
src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityEntity.java
lines 28-30.
- Around line 106-108: Deduplicate nodeUuids before conflict detection and
persistence in the activity-creation flow surrounding NodeActivityEntity.from
and saveAllAndFlush. Use the normalized UUID collection for both
existing-activity checks and entity creation, preserving one activity per unique
node UUID and preventing duplicate entries from being reported as
NODE_ACTIVITY_CONFLICT.

In `@src/main/java/org/gridsuite/study/server/service/StudyService.java`:
- Around line 1500-1507: Update getFirstLevelChildrenToBuild to clamp the value
returned by getAllowedBuildNodesUpToQuota to zero with Math.max before passing
it to Stream.limit, preventing negative limits while preserving the existing
child filtering and quota behavior.

In `@src/test/java/org/gridsuite/study/server/WorkflowTest.java`:
- Around line 84-85: Add assertions in WorkflowTest for result consumption to
verify node activity cleanup: after consuming the build or computation result,
assert nodeActivityRepository.count() and/or the matching activity rows are
zero. Keep the existing NodeActivityService mock setup for rerun-start
verification and use the repository-backed flow to validate creation and
clearance.

---

Outside diff comments:
In `@src/main/java/org/gridsuite/study/server/service/ConsumerService.java`:
- Around line 415-452: Harden the finally cleanup in consumeCalculationStopped
and consumeCalculationFailed against getStudyUuidForNodeId failures or null
results. Resolve studyUuid defensively, call endComputationActivity and
emitStudyError only when a valid studyUuid is available, and structure cleanup
so quota release still runs independently even if study lookup or notification
cleanup fails. Preserve the existing receiverObj guard and ensure earlier
failures are not masked by null-related exceptions.
🪄 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 Plus

Run ID: 3bbe96bf-43e8-46a6-9640-6b349aa61241

📥 Commits

Reviewing files that changed from the base of the PR and between 1fdb9a1 and 3031954.

📒 Files selected for processing (71)
  • src/main/java/org/gridsuite/study/server/StudyApplication.java
  • src/main/java/org/gridsuite/study/server/controller/NodeActivityController.java
  • src/main/java/org/gridsuite/study/server/controller/StudyController.java
  • src/main/java/org/gridsuite/study/server/controller/loadflow/LoadFlowController.java
  • src/main/java/org/gridsuite/study/server/controller/loadflow/LoadFlowParametersController.java
  • src/main/java/org/gridsuite/study/server/controller/pccmin/PccMinController.java
  • src/main/java/org/gridsuite/study/server/controller/securityanalysis/SecurityAnalysisController.java
  • src/main/java/org/gridsuite/study/server/controller/sensitivityanalysis/SensitivityAnalysisController.java
  • src/main/java/org/gridsuite/study/server/controller/shortcircuit/ShortCircuitController.java
  • src/main/java/org/gridsuite/study/server/controller/stateestimation/StateEstimationController.java
  • src/main/java/org/gridsuite/study/server/controller/voltageinit/VoltageInitController.java
  • src/main/java/org/gridsuite/study/server/dto/InvalidateNodeTreeParameters.java
  • src/main/java/org/gridsuite/study/server/error/StudyBusinessErrorCode.java
  • src/main/java/org/gridsuite/study/server/error/StudyExceptionHandler.java
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/BuildStatus.java
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/NodeBuildStatus.java
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/entities/RootNetworkNodeInfoEntity.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityEntity.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityInfos.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityLabel.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityType.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/ScheduledNodeActivitySweep.java
  • src/main/java/org/gridsuite/study/server/notification/NotificationService.java
  • src/main/java/org/gridsuite/study/server/repository/nodeactivity/NodeActivityRepository.java
  • src/main/java/org/gridsuite/study/server/repository/rootnetwork/RootNetworkNodeInfoRepository.java
  • src/main/java/org/gridsuite/study/server/service/ConsumerService.java
  • src/main/java/org/gridsuite/study/server/service/NetworkModificationTreeService.java
  • src/main/java/org/gridsuite/study/server/service/RebuildNodeService.java
  • src/main/java/org/gridsuite/study/server/service/RootNetworkNodeInfoService.java
  • src/main/java/org/gridsuite/study/server/service/StudyService.java
  • src/main/java/org/gridsuite/study/server/service/SupervisionService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/impl/DynamicSimulationServiceImpl.java
  • src/main/java/org/gridsuite/study/server/service/loadflow/LoadFlowRestService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinRestService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitRestService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationRestService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitRestService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitService.java
  • src/main/resources/db/changelog/changesets/changelog_20260803T101500Z.xml
  • src/main/resources/db/changelog/db.changelog-master.yaml
  • src/test/java/org/gridsuite/study/server/NetworkModificationTest.java
  • src/test/java/org/gridsuite/study/server/NetworkModificationTreeTest.java
  • src/test/java/org/gridsuite/study/server/NetworkModificationUnitTest.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicMarginCalculationTest.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicSecurityAnalysisTest.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicSimulationTest.java
  • src/test/java/org/gridsuite/study/server/StudyServiceTest.java
  • src/test/java/org/gridsuite/study/server/SupervisionControllerTest.java
  • src/test/java/org/gridsuite/study/server/VoltageInitTest.java
  • src/test/java/org/gridsuite/study/server/WorkflowTest.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFLowIntegrationTest.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFLowUnitTest.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFlowTest.java
  • src/test/java/org/gridsuite/study/server/networkmodificationtree/dto/BuildStatusTest.java
  • src/test/java/org/gridsuite/study/server/nodeactivity/NodeActivityRulesTest.java
  • src/test/java/org/gridsuite/study/server/rootnetworks/RootNetworkTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationServiceTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisServiceTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationServiceTest.java
  • src/test/java/org/gridsuite/study/server/studycontroller/NodeControllerTest.java
💤 Files with no reviewable changes (31)
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/entities/RootNetworkNodeInfoEntity.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinRestService.java
  • src/test/java/org/gridsuite/study/server/SupervisionControllerTest.java
  • src/test/java/org/gridsuite/study/server/networkmodificationtree/dto/BuildStatusTest.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisService.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationServiceTest.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitService.java
  • src/main/java/org/gridsuite/study/server/repository/rootnetwork/RootNetworkNodeInfoRepository.java
  • src/test/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationServiceTest.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitService.java
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/BuildStatus.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisRestService.java
  • src/test/java/org/gridsuite/study/server/rootnetworks/RootNetworkTest.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisRestService.java
  • src/test/java/org/gridsuite/study/server/studycontroller/NodeControllerTest.java
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/NodeBuildStatus.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitRestService.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFLowUnitTest.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitRestService.java
  • src/main/java/org/gridsuite/study/server/service/NetworkModificationTreeService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationRestService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/impl/DynamicSimulationServiceImpl.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisServiceTest.java
  • src/main/java/org/gridsuite/study/server/service/loadflow/LoadFlowRestService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinService.java
  • src/main/java/org/gridsuite/study/server/service/RootNetworkNodeInfoService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisService.java

Comment thread src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java Outdated
Comment thread src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java Outdated
Comment thread src/main/java/org/gridsuite/study/server/service/StudyService.java
Comment thread src/test/java/org/gridsuite/study/server/WorkflowTest.java Outdated
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
@ayolab
ayolab force-pushed the ayolab/node-activity branch from 6ed5000 to 00c16be Compare August 4, 2026 10:11

@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/main/java/org/gridsuite/study/server/nodeactivity/ScheduledNodeActivityCleaner.java`:
- Around line 35-37: Update removeAbandonedNodeActivities and the underlying
nodeActivityService cleanup so activities still awaiting an in-flight result are
excluded from age-based removal; use the activity’s completion/result state
alongside startedAt when applying the abandonedAfter cutoff, or renew eligible
activities before cleanup. Preserve removal of genuinely abandoned activities.
🪄 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: 06b0eaf3-96be-4e70-8181-209126988549

📥 Commits

Reviewing files that changed from the base of the PR and between 3031954 and 00c16be.

📒 Files selected for processing (73)
  • src/main/java/org/gridsuite/study/server/StudyApplication.java
  • src/main/java/org/gridsuite/study/server/controller/NodeActivityController.java
  • src/main/java/org/gridsuite/study/server/controller/StudyController.java
  • src/main/java/org/gridsuite/study/server/controller/loadflow/LoadFlowController.java
  • src/main/java/org/gridsuite/study/server/controller/loadflow/LoadFlowParametersController.java
  • src/main/java/org/gridsuite/study/server/controller/pccmin/PccMinController.java
  • src/main/java/org/gridsuite/study/server/controller/securityanalysis/SecurityAnalysisController.java
  • src/main/java/org/gridsuite/study/server/controller/sensitivityanalysis/SensitivityAnalysisController.java
  • src/main/java/org/gridsuite/study/server/controller/shortcircuit/ShortCircuitController.java
  • src/main/java/org/gridsuite/study/server/controller/stateestimation/StateEstimationController.java
  • src/main/java/org/gridsuite/study/server/controller/voltageinit/VoltageInitController.java
  • src/main/java/org/gridsuite/study/server/dto/InvalidateNodeTreeParameters.java
  • src/main/java/org/gridsuite/study/server/error/StudyBusinessErrorCode.java
  • src/main/java/org/gridsuite/study/server/error/StudyExceptionHandler.java
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/BuildStatus.java
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/NodeBuildStatus.java
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/entities/RootNetworkNodeInfoEntity.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityEntity.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityInfos.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityLabel.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityType.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/ScheduledNodeActivityCleaner.java
  • src/main/java/org/gridsuite/study/server/notification/NotificationService.java
  • src/main/java/org/gridsuite/study/server/repository/nodeactivity/NodeActivityRepository.java
  • src/main/java/org/gridsuite/study/server/repository/rootnetwork/RootNetworkNodeInfoRepository.java
  • src/main/java/org/gridsuite/study/server/service/ConsumerService.java
  • src/main/java/org/gridsuite/study/server/service/NetworkModificationTreeService.java
  • src/main/java/org/gridsuite/study/server/service/RebuildNodeService.java
  • src/main/java/org/gridsuite/study/server/service/RootNetworkNodeInfoService.java
  • src/main/java/org/gridsuite/study/server/service/StudyService.java
  • src/main/java/org/gridsuite/study/server/service/SupervisionService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/impl/DynamicSimulationServiceImpl.java
  • src/main/java/org/gridsuite/study/server/service/loadflow/LoadFlowRestService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinRestService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitRestService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationRestService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitRestService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitService.java
  • src/main/resources/application-local.yml
  • src/main/resources/config/application.yaml
  • src/main/resources/db/changelog/changesets/changelog_20260803T101500Z.xml
  • src/main/resources/db/changelog/db.changelog-master.yaml
  • src/test/java/org/gridsuite/study/server/NetworkModificationTest.java
  • src/test/java/org/gridsuite/study/server/NetworkModificationTreeTest.java
  • src/test/java/org/gridsuite/study/server/NetworkModificationUnitTest.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicMarginCalculationTest.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicSecurityAnalysisTest.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicSimulationTest.java
  • src/test/java/org/gridsuite/study/server/StudyServiceTest.java
  • src/test/java/org/gridsuite/study/server/SupervisionControllerTest.java
  • src/test/java/org/gridsuite/study/server/VoltageInitTest.java
  • src/test/java/org/gridsuite/study/server/WorkflowTest.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFLowIntegrationTest.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFLowUnitTest.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFlowTest.java
  • src/test/java/org/gridsuite/study/server/networkmodificationtree/dto/BuildStatusTest.java
  • src/test/java/org/gridsuite/study/server/nodeactivity/NodeActivityRulesTest.java
  • src/test/java/org/gridsuite/study/server/rootnetworks/RootNetworkTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationServiceTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisServiceTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationServiceTest.java
  • src/test/java/org/gridsuite/study/server/studycontroller/NodeControllerTest.java
💤 Files with no reviewable changes (31)
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitService.java
  • src/test/java/org/gridsuite/study/server/SupervisionControllerTest.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationRestService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisService.java
  • src/test/java/org/gridsuite/study/server/studycontroller/NodeControllerTest.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/impl/DynamicSimulationServiceImpl.java
  • src/test/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationServiceTest.java
  • src/main/java/org/gridsuite/study/server/service/NetworkModificationTreeService.java
  • src/test/java/org/gridsuite/study/server/networkmodificationtree/dto/BuildStatusTest.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/loadflow/LoadFlowRestService.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/RootNetworkNodeInfoService.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisServiceTest.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitRestService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitRestService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinService.java
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/BuildStatus.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationServiceTest.java
  • src/main/java/org/gridsuite/study/server/repository/rootnetwork/RootNetworkNodeInfoRepository.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFLowUnitTest.java
  • src/main/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationService.java
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/entities/RootNetworkNodeInfoEntity.java
  • src/main/java/org/gridsuite/study/server/networkmodificationtree/dto/NodeBuildStatus.java
  • src/test/java/org/gridsuite/study/server/rootnetworks/RootNetworkTest.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinRestService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationService.java
🚧 Files skipped from review as they are similar to previous changes (38)
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicSecurityAnalysisTest.java
  • src/main/java/org/gridsuite/study/server/notification/NotificationService.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicSimulationTest.java
  • src/test/java/org/gridsuite/study/server/NetworkModificationUnitTest.java
  • src/main/java/org/gridsuite/study/server/controller/loadflow/LoadFlowController.java
  • src/main/java/org/gridsuite/study/server/error/StudyExceptionHandler.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicMarginCalculationTest.java
  • src/main/java/org/gridsuite/study/server/service/SupervisionService.java
  • src/main/java/org/gridsuite/study/server/controller/stateestimation/StateEstimationController.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFlowTest.java
  • src/main/java/org/gridsuite/study/server/controller/pccmin/PccMinController.java
  • src/main/java/org/gridsuite/study/server/controller/loadflow/LoadFlowParametersController.java
  • src/main/java/org/gridsuite/study/server/controller/NodeActivityController.java
  • src/test/java/org/gridsuite/study/server/VoltageInitTest.java
  • src/main/java/org/gridsuite/study/server/repository/nodeactivity/NodeActivityRepository.java
  • src/main/java/org/gridsuite/study/server/controller/sensitivityanalysis/SensitivityAnalysisController.java
  • src/main/java/org/gridsuite/study/server/service/RebuildNodeService.java
  • src/test/java/org/gridsuite/study/server/StudyServiceTest.java
  • src/test/java/org/gridsuite/study/server/NetworkModificationTest.java
  • src/main/java/org/gridsuite/study/server/service/ConsumerService.java
  • src/main/resources/db/changelog/db.changelog-master.yaml
  • src/main/resources/db/changelog/changesets/changelog_20260803T101500Z.xml
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityEntity.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityInfos.java
  • src/main/java/org/gridsuite/study/server/service/StudyService.java
  • src/test/java/org/gridsuite/study/server/WorkflowTest.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityType.java
  • src/main/java/org/gridsuite/study/server/error/StudyBusinessErrorCode.java
  • src/main/java/org/gridsuite/study/server/StudyApplication.java
  • src/main/java/org/gridsuite/study/server/controller/voltageinit/VoltageInitController.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityLabel.java
  • src/test/java/org/gridsuite/study/server/NetworkModificationTreeTest.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFLowIntegrationTest.java
  • src/test/java/org/gridsuite/study/server/nodeactivity/NodeActivityRulesTest.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java
  • src/main/java/org/gridsuite/study/server/controller/shortcircuit/ShortCircuitController.java
  • src/main/java/org/gridsuite/study/server/controller/securityanalysis/SecurityAnalysisController.java
  • src/main/java/org/gridsuite/study/server/dto/InvalidateNodeTreeParameters.java

Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>

@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/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java`:
- Around line 105-114: Propagate a stable activity ID from request creation
through result handling, and update NodeActivityService.removeNodeActivity to
delete only that correlated activity row rather than all rows in the
node/root-network scope. In NodeActivityRepository, remove the scope-wide
deletion methods used by this lifecycle path and add or use an activity-ID-based
delete operation; update all affected callers and preserve notification
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: 9e591b90-5119-4986-aecb-905f8cee8987

📥 Commits

Reviewing files that changed from the base of the PR and between 00c16be and 3a41994.

📒 Files selected for processing (24)
  • src/main/java/org/gridsuite/study/server/controller/StudyController.java
  • src/main/java/org/gridsuite/study/server/controller/loadflow/LoadFlowController.java
  • src/main/java/org/gridsuite/study/server/controller/loadflow/LoadFlowParametersController.java
  • src/main/java/org/gridsuite/study/server/controller/pccmin/PccMinController.java
  • src/main/java/org/gridsuite/study/server/controller/securityanalysis/SecurityAnalysisController.java
  • src/main/java/org/gridsuite/study/server/controller/sensitivityanalysis/SensitivityAnalysisController.java
  • src/main/java/org/gridsuite/study/server/controller/shortcircuit/ShortCircuitController.java
  • src/main/java/org/gridsuite/study/server/controller/stateestimation/StateEstimationController.java
  • src/main/java/org/gridsuite/study/server/controller/voltageinit/VoltageInitController.java
  • src/main/java/org/gridsuite/study/server/error/StudyBusinessErrorCode.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityEntity.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityInfos.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityRules.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityType.java
  • src/main/java/org/gridsuite/study/server/repository/networkmodificationtree/NodeRepository.java
  • src/main/java/org/gridsuite/study/server/repository/nodeactivity/NodeActivityRepository.java
  • src/main/java/org/gridsuite/study/server/service/ConsumerService.java
  • src/main/java/org/gridsuite/study/server/service/NetworkModificationTreeService.java
  • src/main/java/org/gridsuite/study/server/service/RebuildNodeService.java
  • src/main/java/org/gridsuite/study/server/service/StudyService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitRestService.java
  • src/test/java/org/gridsuite/study/server/WorkflowTest.java
  • src/test/java/org/gridsuite/study/server/nodeactivity/NodeActivityRulesTest.java
💤 Files with no reviewable changes (4)
  • src/main/java/org/gridsuite/study/server/service/NetworkModificationTreeService.java
  • src/test/java/org/gridsuite/study/server/WorkflowTest.java
  • src/main/java/org/gridsuite/study/server/error/StudyBusinessErrorCode.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitRestService.java
🚧 Files skipped from review as they are similar to previous changes (11)
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityInfos.java
  • src/main/java/org/gridsuite/study/server/controller/voltageinit/VoltageInitController.java
  • src/main/java/org/gridsuite/study/server/controller/securityanalysis/SecurityAnalysisController.java
  • src/main/java/org/gridsuite/study/server/controller/pccmin/PccMinController.java
  • src/main/java/org/gridsuite/study/server/controller/sensitivityanalysis/SensitivityAnalysisController.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityEntity.java
  • src/main/java/org/gridsuite/study/server/controller/stateestimation/StateEstimationController.java
  • src/main/java/org/gridsuite/study/server/service/RebuildNodeService.java
  • src/main/java/org/gridsuite/study/server/controller/shortcircuit/ShortCircuitController.java
  • src/main/java/org/gridsuite/study/server/service/ConsumerService.java
  • src/main/java/org/gridsuite/study/server/service/StudyService.java

Comment thread src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java Outdated
ayolab and others added 5 commits August 6, 2026 08:41
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
@ayolab
ayolab force-pushed the ayolab/node-activity branch from 711f1a3 to c7085fa Compare August 7, 2026 08:26
ayolab added 2 commits August 12, 2026 02:56
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>

@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: 3

Caution

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

⚠️ Outside diff range comments (2)
src/main/java/org/gridsuite/study/server/controller/StudyController.java (1)

254-255: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Track the destination anchor for every tree insertion. For CHILD insertion, reparentedNodes returns an empty list. The affected flows then create no activity for the node whose children they modify. A conflicting delete, stash, or tree edit on that anchor can run concurrently.

  • src/main/java/org/gridsuite/study/server/controller/StudyController.java#L254-L255: include referenceNodeUuid for CHILD node duplication.
  • src/main/java/org/gridsuite/study/server/controller/StudyController.java#L345-L346: include referenceNodeUuid when moving a subtree.
  • src/main/java/org/gridsuite/study/server/controller/StudyController.java#L362-L363: wrap subtree duplication in EDIT_TREE activity tracking for referenceNodeUuid.
  • src/main/java/org/gridsuite/study/server/controller/StudyController.java#L1133-L1135: include referenceId for CHILD node creation.
  • src/main/java/org/gridsuite/study/server/controller/StudyController.java#L1150-L1152: wrap sequence creation in EDIT_TREE activity tracking for referenceId.
🤖 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 254 - 255, Update StudyController at
src/main/java/org/gridsuite/study/server/controller/StudyController.java:254-255
to include referenceNodeUuid for CHILD node duplication; at 345-346 include
referenceNodeUuid when moving a subtree; at 362-363 wrap subtree duplication in
EDIT_TREE activity tracking for referenceNodeUuid; at 1133-1135 include
referenceId for CHILD node creation; and at 1150-1152 wrap sequence creation in
EDIT_TREE activity tracking for referenceId. Ensure every insertion tracks the
destination anchor even when reparentedNodes returns no affected nodes.
src/main/java/org/gridsuite/study/server/service/ConsumerService.java (1)

498-500: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Correlate every terminal message with the activity that it ends. These cleanup calls identify an activity only by node and root network. If an old terminal message is delayed or replayed after a later operation starts, it can remove the later operation's activity and admit conflicting work.

  • src/main/java/org/gridsuite/study/server/service/ConsumerService.java#L498-L500: require an activity or operation correlation identifier before deleting a computation activity.
  • src/main/java/org/gridsuite/study/server/service/ConsumerService.java#L135-L136: apply the same correlation check to successful build cleanup.
  • src/main/java/org/gridsuite/study/server/service/ConsumerService.java#L202-L208: apply the same correlation check to failed or cancelled build cleanup.
  • src/main/java/org/gridsuite/study/server/service/ConsumerService.java#L393-L396: apply the same correlation check to reimport cleanup.
🤖 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/ConsumerService.java` around
lines 498 - 500, Require and validate an activity or operation correlation
identifier before removing computation activities, ensuring each terminal
message cleans up only the activity it ends. Apply this consistently in
ConsumerService.java at lines 498-500 (endComputationActivity), 135-136
(successful build cleanup), 202-208 (failed or cancelled build cleanup), and
393-396 (reimport cleanup); reject or skip cleanup when the identifier does not
match the active operation.
🤖 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/nodeactivity/ScheduledNodeActivityCleaner.java`:
- Around line 40-49: Update removeAbandonedNodeActivities and its surrounding
cleanup flow so selecting abandoned activities, releasing them, and calling
StudyService.invalidateAbandonedNode occur within one transaction. Move the
invalidation into the transactional service operation or otherwise ensure the
transaction remains active through the forEach loop, preventing new activity
creation between NodeActivityService.removeAbandonedNodeActivities and
invalidation.

In
`@src/test/java/org/gridsuite/study/server/NetworkVisualizationParamsTest.java`:
- Line 159: Restore or define the 1000 ms TIMEOUT constants in
NetworkVisualizationParamsTest, SingleLineDiagramTest, and
SpreadsheetConfigCollectionTest where removed, then update every listed
receiveStudyUpdate or study-update event read in
src/test/java/org/gridsuite/study/server/NetworkVisualizationParamsTest.java
(83-83, 159-159), PccMinTest.java (227-227, 240-240, 422-422, 519-523),
SensitivityAnalysisTest.java (264-264, 285-295, 513-513, 582-582, 647-653,
687-687, 837-837), ShortCircuitTest.java (224-228, 618-618, 629-629, 768-778,
890-890), SingleLineDiagramTest.java (529-529),
SpreadsheetConfigCollectionTest.java (497-497), StateEstimationTest.java
(238-238, 313-313, 459-463), StudyControllerDynamicSecurityAnalysisTest.java
(214-214, 256-256, 276-276, 288-288, 361-361, 381-390, 437-437, 457-457,
545-549), and StudyControllerDynamicSimulationTest.java (243-243, 284-284,
304-304, 316-316, 389-389, 409-418, 465-465, 485-485, 683-691, 703-711) to pass
TIMEOUT, using an explicit 1000 ms value only where specified.

In `@src/test/java/org/gridsuite/study/server/studycontroller/StudyTest.java`:
- Around line 657-665: Update the study-creation message drain in the test block
around the existing TestUtils.receiveStudyUpdate calls to use
TestUtils.receiveStudyUpdate with output, studyUpdateDestination, and TIMEOUT *
3 instead of plain output.receive. Keep the surrounding message-draining order
unchanged and align it with the equivalent block.

---

Outside diff comments:
In `@src/main/java/org/gridsuite/study/server/controller/StudyController.java`:
- Around line 254-255: Update StudyController at
src/main/java/org/gridsuite/study/server/controller/StudyController.java:254-255
to include referenceNodeUuid for CHILD node duplication; at 345-346 include
referenceNodeUuid when moving a subtree; at 362-363 wrap subtree duplication in
EDIT_TREE activity tracking for referenceNodeUuid; at 1133-1135 include
referenceId for CHILD node creation; and at 1150-1152 wrap sequence creation in
EDIT_TREE activity tracking for referenceId. Ensure every insertion tracks the
destination anchor even when reparentedNodes returns no affected nodes.

In `@src/main/java/org/gridsuite/study/server/service/ConsumerService.java`:
- Around line 498-500: Require and validate an activity or operation correlation
identifier before removing computation activities, ensuring each terminal
message cleans up only the activity it ends. Apply this consistently in
ConsumerService.java at lines 498-500 (endComputationActivity), 135-136
(successful build cleanup), 202-208 (failed or cancelled build cleanup), and
393-396 (reimport cleanup); reject or skip cleanup when the identifier does not
match the active operation.
🪄 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: 482f63c8-14b6-4f26-bd4a-bfadb6847ff7

📥 Commits

Reviewing files that changed from the base of the PR and between 3a41994 and 32b60f6.

📒 Files selected for processing (75)
  • src/main/java/org/gridsuite/study/server/controller/StudyController.java
  • src/main/java/org/gridsuite/study/server/controller/dynamicmargincalculation/DynamicMarginCalculationController.java
  • src/main/java/org/gridsuite/study/server/controller/dynamicsecurityanalysis/DynamicSecurityAnalysisController.java
  • src/main/java/org/gridsuite/study/server/controller/dynamicsimulation/DynamicSimulationController.java
  • src/main/java/org/gridsuite/study/server/controller/dynamicsimulation/DynamicSimulationEventsController.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityInfos.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityRules.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/NodeActivityService.java
  • src/main/java/org/gridsuite/study/server/nodeactivity/ScheduledNodeActivityCleaner.java
  • src/main/java/org/gridsuite/study/server/notification/NotificationService.java
  • src/main/java/org/gridsuite/study/server/repository/networkmodificationtree/NodeRepository.java
  • src/main/java/org/gridsuite/study/server/service/ConsumerService.java
  • src/main/java/org/gridsuite/study/server/service/NetworkModificationTreeService.java
  • src/main/java/org/gridsuite/study/server/service/RootNetworkNodeInfoService.java
  • src/main/java/org/gridsuite/study/server/service/StudyService.java
  • src/main/java/org/gridsuite/study/server/service/SupervisionService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationRestService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationRestService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationService.java
  • src/main/java/org/gridsuite/study/server/service/dynamicsimulation/impl/DynamicSimulationRestServiceImpl.java
  • src/main/java/org/gridsuite/study/server/service/loadflow/LoadFlowRestService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinRestService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitRestService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationRestService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitRestService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitService.java
  • src/main/resources/db/changelog/changesets/changelog_20260812T035357Z.xml
  • src/main/resources/db/changelog/db.changelog-master.yaml
  • src/test/java/org/gridsuite/study/server/ComputationResultFiltersTest.java
  • src/test/java/org/gridsuite/study/server/NetworkModificationTest.java
  • src/test/java/org/gridsuite/study/server/NetworkModificationTreeTest.java
  • src/test/java/org/gridsuite/study/server/NetworkModificationUnitTest.java
  • src/test/java/org/gridsuite/study/server/NetworkVisualizationParamsTest.java
  • src/test/java/org/gridsuite/study/server/PccMinTest.java
  • src/test/java/org/gridsuite/study/server/RebuildNodeServiceTest.java
  • src/test/java/org/gridsuite/study/server/SensitivityAnalysisTest.java
  • src/test/java/org/gridsuite/study/server/ShortCircuitTest.java
  • src/test/java/org/gridsuite/study/server/SingleLineDiagramTest.java
  • src/test/java/org/gridsuite/study/server/SpreadsheetConfigCollectionTest.java
  • src/test/java/org/gridsuite/study/server/SpreadsheetConfigTest.java
  • src/test/java/org/gridsuite/study/server/StateEstimationTest.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicMarginCalculationTest.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicSecurityAnalysisTest.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicSimulationTest.java
  • src/test/java/org/gridsuite/study/server/VoltageInitTest.java
  • src/test/java/org/gridsuite/study/server/WorkspaceConfigTest.java
  • src/test/java/org/gridsuite/study/server/config/DisableJpa.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFLowIntegrationTest.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFLowUnitTest.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFlowTest.java
  • src/test/java/org/gridsuite/study/server/nodeactivity/NodeActivityRulesTest.java
  • src/test/java/org/gridsuite/study/server/nodeactivity/NodeActivityServiceTest.java
  • src/test/java/org/gridsuite/study/server/rootnetworks/RootNetworkControllerTest.java
  • src/test/java/org/gridsuite/study/server/rootnetworks/RootNetworkTest.java
  • src/test/java/org/gridsuite/study/server/rootnetworks/SecurityAnalysisTest.java
  • src/test/java/org/gridsuite/study/server/service/ReportServiceTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationServiceTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsecurityanalysis/DynamicSecurityAnalysisRestServiceTest.java
  • src/test/java/org/gridsuite/study/server/service/dynamicsimulation/DynamicSimulationRestServiceTest.java
  • src/test/java/org/gridsuite/study/server/studycontroller/NodeControllerTest.java
  • src/test/java/org/gridsuite/study/server/studycontroller/StudyControllerCreationTest.java
  • src/test/java/org/gridsuite/study/server/studycontroller/StudyControllerRebuildNodeTest.java
  • src/test/java/org/gridsuite/study/server/studycontroller/StudyTest.java
  • src/test/java/org/gridsuite/study/server/studycontroller/StudyTestBase.java
  • src/test/java/org/gridsuite/study/server/utils/TestUtils.java
🚧 Files skipped from review as they are similar to previous changes (24)
  • src/main/java/org/gridsuite/study/server/service/RootNetworkNodeInfoService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinRestService.java
  • src/test/java/org/gridsuite/study/server/service/dynamicmargincalculation/DynamicMarginCalculationServiceTest.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationService.java
  • src/main/resources/db/changelog/db.changelog-master.yaml
  • src/main/java/org/gridsuite/study/server/service/loadflow/LoadFlowRestService.java
  • src/main/java/org/gridsuite/study/server/service/stateestimation/StateEstimationRestService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisService.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitRestService.java
  • src/main/java/org/gridsuite/study/server/service/securityanalysis/SecurityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/pccmin/PccMinService.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitService.java
  • src/test/java/org/gridsuite/study/server/NetworkModificationUnitTest.java
  • src/main/java/org/gridsuite/study/server/service/sensitivityanalysis/SensitivityAnalysisRestService.java
  • src/main/java/org/gridsuite/study/server/service/SupervisionService.java
  • src/test/java/org/gridsuite/study/server/StudyControllerDynamicMarginCalculationTest.java
  • src/main/java/org/gridsuite/study/server/service/voltageinit/VoltageInitService.java
  • src/test/java/org/gridsuite/study/server/rootnetworks/RootNetworkTest.java
  • src/main/java/org/gridsuite/study/server/service/shortcircuit/ShortCircuitRestService.java
  • src/main/java/org/gridsuite/study/server/service/NetworkModificationTreeService.java
  • src/test/java/org/gridsuite/study/server/nodeactivity/NodeActivityRulesTest.java
  • src/test/java/org/gridsuite/study/server/loadflow/LoadFLowIntegrationTest.java
  • src/main/java/org/gridsuite/study/server/service/StudyService.java

ayolab added 2 commits August 12, 2026 08:18
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
@ayolab
ayolab force-pushed the ayolab/node-activity branch from a667eb0 to a3ceee8 Compare August 12, 2026 07:25
ayolab and others added 5 commits August 20, 2026 08:55
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
@SlimaneAmar

Copy link
Copy Markdown
Contributor

Remove assertIsNodeNotReadOnly ?

Slimane AMAR and others added 4 commits August 20, 2026 13:55
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Warning

Your free Security trial is over. An organization admin can activate billing to continue.

ayolab and others added 5 commits August 21, 2026 15:32
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
Comment thread src/main/java/org/gridsuite/study/server/controller/StudyController.java Outdated
Comment thread src/main/java/org/gridsuite/study/server/service/ConsumerService.java Outdated
Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
@sonarqubecloud

Copy link
Copy Markdown

Signed-off-by: Ayoub LABIDI <ayoub.labidi@protonmail.com>
@ayolab
ayolab force-pushed the ayolab/node-activity branch from 1db4e8c to 5d9cf39 Compare August 21, 2026 16:50
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