Conversation
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
…onfig Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com> # Conflicts: # monitor-commons/src/main/java/org/gridsuite/monitor/commons/SecurityAnalysisConfig.java # monitor-server/src/main/java/org/gridsuite/monitor/server/entities/SecurityAnalysisConfigEntity.java # monitor-server/src/main/java/org/gridsuite/monitor/server/mapper/SecurityAnalysisConfigMapper.java # monitor-server/src/main/resources/db/changelog/db.changelog-master.yaml # monitor-server/src/test/java/org/gridsuite/monitor/server/MonitorIntegrationTest.java # monitor-server/src/test/java/org/gridsuite/monitor/server/controllers/ProcessConfigControllerTest.java
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
…config_uuid Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com> # Conflicts: # monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/SecurityAnalysisRestService.java
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
Don't set startedAt and completedAt for skipped step Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
Add process config id in the process execution entity Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
…en_getting_modifications
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds DTO NetworkModificationsWithMissingInfo and updates REST service, processing step, tests, and resources to return/consume this wrapper; processing now reports and fails when network composite modifications are missing before applying modifications. Changes
Sequence DiagramsequenceDiagram
participant Client as Client
participant Apply as ApplyModificationsStep
participant REST as NetworkModificationRestService
participant Report as ReportService
Client->>Apply: execute(context)
Apply->>REST: getModifications(modificationUuids)
REST-->>Apply: NetworkModificationsWithMissingInfo
alt missingCompositeModifications non-empty
Apply->>Report: createReportNode("monitor.worker.server.modifications.error", uuids)
Report-->>Apply: reportNode
Apply->>Apply: throw PowsyblException
Apply-->>Client: Exception
else no missing composites
Apply->>Apply: applyModifications(networkModifications)
Apply-->>Client: Success
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
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. Comment Tip You can customize the high-level summary generated by CodeRabbit.Configure the |
…config_uuid Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com> # Conflicts: # monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/StepExecutionService.java # monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/securityanalysis/steps/SecurityAnalysisRunComputationStepTest.java
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
…' into handle_errors_when_getting_modifications Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com> # Conflicts: # monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/StepExecutionService.java # monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java
…tting_modifications Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com> # Conflicts: # monitor-commons/src/main/java/org/gridsuite/monitor/commons/SecurityAnalysisConfig.java # monitor-commons/src/main/java/org/gridsuite/monitor/commons/steps/AbstractStepExecutor.java # monitor-commons/src/test/java/org/gridsuite/monitor/commons/steps/StepExecutorTest.java # monitor-server/src/main/java/org/gridsuite/monitor/server/controllers/MonitorController.java # monitor-server/src/main/java/org/gridsuite/monitor/server/mapper/ProcessExecutionMapper.java # monitor-server/src/main/java/org/gridsuite/monitor/server/mapper/SecurityAnalysisConfigMapper.java # monitor-server/src/main/java/org/gridsuite/monitor/server/services/MonitorService.java # monitor-server/src/main/resources/db/changelog/changesets/changelog_20260227T101113Z.xml # monitor-server/src/test/java/org/gridsuite/monitor/server/MonitorIntegrationTest.java # monitor-server/src/test/java/org/gridsuite/monitor/server/controllers/MonitorControllerTest.java # monitor-server/src/test/java/org/gridsuite/monitor/server/services/MonitorServiceTest.java # monitor-server/src/test/java/org/gridsuite/monitor/server/services/ProcessConfigServiceTest.java # monitor-worker-server/pom.xml # monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStep.java # monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/processes/securityanalysis/steps/SecurityAnalysisRunComputationStep.java # monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/ActionsRestService.java # monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/SecurityAnalysisParametersService.java # monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/SecurityAnalysisRestService.java # monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/StepExecutionService.java # monitor-worker-server/src/main/resources/org/gridsuite/monitor/worker/server/reports.properties # monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java # monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/securityanalysis/steps/SecurityAnalysisRunComputationStepTest.java # monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/ActionsRestServiceTest.java # monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/SecurityAnalysisRestServiceTest.java # monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/services/StepExecutionServiceTest.java
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java (1)
102-119: Consider asserting the specific exception type.The mocks are now properly set up (addressing previous feedback). However, the production code throws
PowsyblException(as seen inApplyModificationsStep.javaline 94), but the test assertsRuntimeException.class. While this works becausePowsyblExceptionextendsRuntimeException, using the specific type provides better test precision and ensures other runtime exceptions aren't inadvertently caught.♻️ Proposed fix for more precise assertion
- assertThrows(RuntimeException.class, () -> applyModificationsStep.execute(stepContext)); + assertThrows(PowsyblException.class, () -> applyModificationsStep.execute(stepContext));Add the import:
import com.powsybl.commons.PowsyblException;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java` around lines 102 - 119, Change the test to assert the specific PowsyblException instead of RuntimeException: in ApplyModificationsStepTest (method executeApplyModificationsFailWhenModificationsAreMissing) replace assertThrows(RuntimeException.class, ...) with assertThrows(PowsyblException.class, ...) and add the import com.powsybl.commons.PowsyblException; this aligns the test with the actual exception thrown by ApplyModificationsStep (PowsyblException).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java`:
- Around line 102-119: Change the test to assert the specific PowsyblException
instead of RuntimeException: in ApplyModificationsStepTest (method
executeApplyModificationsFailWhenModificationsAreMissing) replace
assertThrows(RuntimeException.class, ...) with
assertThrows(PowsyblException.class, ...) and add the import
com.powsybl.commons.PowsyblException; this aligns the test with the actual
exception thrown by ApplyModificationsStep (PowsyblException).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9611a4fb-9959-4409-8826-b085c9b2002e
📒 Files selected for processing (1)
monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
…tting_modifications
f84ea7c to
a5fdbb7
Compare
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
antoinebhs
left a comment
There was a problem hiding this comment.
I'm not sure to understand why we need this complexity?
On main, we know the ID we want:
networkModificationRestService.getModifications(modificationIds);
and the ID we get List modificationInfos.getUuid()
Why can't we deduce the missing modifications ?
| @@ -32,8 +32,6 @@ public void skipStep(ProcessStepExecutionContext<?> context, ProcessStep<?> step | |||
| .stepType(step.getType().getName()) | |||
| .stepOrder(context.getStepOrder()) | |||
| .status(StepStatus.SKIPPED) | |||
| .startedAt(context.getStartedAt()) | |||
| .completedAt(Instant.now()) | |||
There was a problem hiding this comment.
this helped to keep track of when it failed?
There was a problem hiding this comment.
I think it would be better to keep it to avoid null values?
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
…_modifications # Conflicts: # monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/process/commons/steps/ApplyModificationsStep.java # monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/services/SecurityAnalysisParametersService.java # monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/clients/NetworkModificationRestClientTest.java # monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/orchestrator/StepExecutionServiceTest.java # monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/process/commons/steps/ApplyModificationsStepTest.java
antoinebhs
left a comment
There was a problem hiding this comment.
Some maybe to discuss? let me know
| @@ -0,0 +1,18 @@ | |||
| /** | |||
There was a problem hiding this comment.
to put in the right subpackage
| @@ -32,8 +32,6 @@ public void skipStep(ProcessStepExecutionContext<?> context, ProcessStep<?> step | |||
| .stepType(step.getType().getName()) | |||
| .stepOrder(context.getStepOrder()) | |||
| .status(StepStatus.SKIPPED) | |||
| .startedAt(context.getStartedAt()) | |||
| .completedAt(Instant.now()) | |||
There was a problem hiding this comment.
I think it would be better to keep it to avoid null values?
| networkModificationService.applyModifications(network, modificationInfos, reportNode, filterService); | ||
| NetworkModificationsWithMissingInfo networkModificationsWithMissingInfo = networkModificationRestClient.getModifications(modificationIds); | ||
| if (networkModificationsWithMissingInfo == null) { | ||
| throw new PowsyblException("Failed to retrieve network modifications"); |
There was a problem hiding this comment.
Can't be null because it's an empty list in this case?
| .withUntypedValue("uuids", missingUuids) | ||
| .withSeverity(TypedValue.ERROR_SEVERITY) | ||
| .add(); | ||
| throw new PowsyblException("Some network composite modifications are missing !!"); |
| when(context.getProcessExecutionId()).thenReturn(executionId); | ||
| when(context.getStepExecutionId()).thenReturn(UUID.randomUUID()); | ||
| when(context.getStartedAt()).thenReturn(java.time.Instant.now()); | ||
| when(context.getStepOrder()).thenReturn(stepOrder); |
...va/org/gridsuite/monitor/worker/server/process/commons/steps/ApplyModificationsStepTest.java
Show resolved
Hide resolved
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
|
| when(stepContext.getReportInfos()).thenReturn(reportInfos); | ||
| when(networkModificationRestClient.getModifications(any(List.class))).thenReturn(networkModificationsWithMissingInfo); | ||
|
|
||
| assertThrows(RuntimeException.class, () -> applyModificationsStep.execute(stepContext)); |
There was a problem hiding this comment.
Check that it's a powsybl exception with the correct message?
| String stepType = applyModificationsStep.getType().getName(); | ||
| assertEquals("APPLY_MODIFICATIONS", stepType); |



PR Summary
Launch an security analysis process, using an existing config uuid
based on PR : #58
to be merged together with PR : gridsuite/network-modification-server#775