Skip to content

Comments

refactor: move modificationUuids from ProcessConfig to ModifyingProcessConfig interface#43

Open
KoloMenek wants to merge 2 commits intomainfrom
marutk/refactor/make_process_config_generic
Open

refactor: move modificationUuids from ProcessConfig to ModifyingProcessConfig interface#43
KoloMenek wants to merge 2 commits intomainfrom
marutk/refactor/make_process_config_generic

Conversation

@KoloMenek
Copy link
Member

PR Summary

Moved modificationUuids from ProcessConfig to ModifyingProcessConfig interface in order to make the ProcessConfig interface more generic. It is required for further developments related to SnapshotRefinerServer's connection to monitor-server

@KoloMenek KoloMenek requested a review from antoinebhs February 17, 2026 09:29
@KoloMenek KoloMenek self-assigned this Feb 17, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

Introduces a new interface ModifyingProcessConfig (declaring List<UUID> modificationUuids()), removes that method from ProcessConfig, updates SecurityAnalysisConfig to implement ModifyingProcessConfig, adjusts ApplyModificationsStep generic bounds, and updates tests to exercise both modifying and non-modifying config paths.

Changes

Cohort / File(s) Summary
Interface Hierarchy
monitor-commons/src/main/java/org/gridsuite/monitor/commons/ModifyingProcessConfig.java, monitor-commons/src/main/java/org/gridsuite/monitor/commons/ProcessConfig.java, monitor-commons/src/main/java/org/gridsuite/monitor/commons/SecurityAnalysisConfig.java
Added ModifyingProcessConfig declaring List<UUID> modificationUuids(). Removed modificationUuids() from ProcessConfig. SecurityAnalysisConfig now implements ModifyingProcessConfig (signature change only).
Apply Modifications Step
monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStep.java
Changed generic type bound from C extends ProcessConfig to C extends ModifyingProcessConfig and updated imports/signature accordingly.
Tests
monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java
Replaced ProcessConfig usages with ModifyingProcessConfig in test fixtures. Added helper setUpModifyingStep and a new test verifying no interactions when config does not implement ModifyingProcessConfig. Adjusted imports (Mockito wildcard).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

I twitch my whiskers, nibble new traits,
Pulled modifications out into their crates.
Types now clearer, tests give a cheer,
A rabbit-hop refactor—light and sincere. 🐇✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: moving modificationUuids from ProcessConfig to ModifyingProcessConfig interface.
Description check ✅ Passed The description clearly explains the refactoring effort and its purpose, directly relating to the changeset modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch marutk/refactor/make_process_config_generic

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.

@KoloMenek KoloMenek changed the title refactor: move modificationUuids from ProcessConfig to ModifyingProcessConfig interface Moved modificationUuids from ProcessConfig to ModifyingProcessConfig interface in order to make the ProcessConfig interface more generic. It is required for further developments related to SnapshotRefinerServer's connection to monitor-server refactor: move modificationUuids from ProcessConfig to ModifyingProcessConfig interface Feb 17, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java (1)

27-27: Redundant explicit import of Mockito.

The static wildcard import on line 35 (import static org.mockito.Mockito.*) already covers all static methods. You can replace Mockito.mock(ProcessConfig.class) on line 89 with just mock(ProcessConfig.class) and drop this import.

Proposed fix
-import org.mockito.Mockito;

And on line 89:

-        ProcessConfig processConfigMock = Mockito.mock(ProcessConfig.class);
+        ProcessConfig processConfigMock = mock(ProcessConfig.class);
🤖 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`
at line 27, Remove the redundant explicit import of org.mockito.Mockito and use
the existing static import of org.mockito.Mockito.*; replace usages like
Mockito.mock(ProcessConfig.class) in ApplyModificationsStepTest (e.g., the call
creating the ProcessConfig mock) with the shorter mock(ProcessConfig.class) so
the static import is used consistently and the explicit import can be deleted.
🤖 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`:
- Line 27: Remove the redundant explicit import of org.mockito.Mockito and use
the existing static import of org.mockito.Mockito.*; replace usages like
Mockito.mock(ProcessConfig.class) in ApplyModificationsStepTest (e.g., the call
creating the ProcessConfig mock) with the shorter mock(ProcessConfig.class) so
the static import is used consistently and the explicit import can be deleted.

…ssConfig interface

Moved modificationUuids from ProcessConfig to ModifyingProcessConfig interface in order to make the ProcessConfig interface more generic. It is required for further developments related to SnapshotRefinerServer's connection to monitor-server

Signed-off-by: Kamil MARUT <kamil.marut@rte-france.com>
@KoloMenek KoloMenek force-pushed the marutk/refactor/make_process_config_generic branch from 22145fd to 9a1cc12 Compare February 17, 2026 10:05
@@ -0,0 +1,14 @@
package org.gridsuite.monitor.commons;
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing license

*/
@Component
public class ApplyModificationsStep<C extends ProcessConfig> extends AbstractProcessStep<C> {
public class ApplyModificationsStep<C extends ModifyingProcessConfig> extends AbstractProcessStep<C> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I pushed a change here to avoid the instanceof 169bcd9

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me know what you think

@sonarqubecloud
Copy link

Copy link

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In
`@monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java`:
- Around line 85-95: Rename the test method to reflect the actual behavior under
test: change the method name
executeDoesNothingWhenConfigNotModifyingProcessConfig to
executeDoesNothingWhenModificationUuidsEmpty in ApplyModificationsStepTest;
ensure the test still creates a ModifyingProcessConfig mock, stubs
stepContext.getConfig(), calls applyModificationsStep.execute(stepContext), and
verifies no interactions with networkModificationService,
networkModificationRestService, and filterService, and update any references
(e.g., test runner or IDE-run configurations) to the new method name so the test
suite remains discoverable; this aligns the name with the guard in
ApplyModificationsStep.execute() that checks modificationUuids().

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a1cc12 and 169bcd9.

📒 Files selected for processing (2)
  • monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStep.java
  • monitor-worker-server/src/test/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStepTest.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • monitor-worker-server/src/main/java/org/gridsuite/monitor/worker/server/processes/commons/steps/ApplyModificationsStep.java

Comment on lines +85 to +95
@Test
void executeDoesNothingWhenConfigNotModifyingProcessConfig() {
ModifyingProcessConfig processConfigMock = mock(ModifyingProcessConfig.class);
when(stepContext.getConfig()).thenReturn(processConfigMock);

applyModificationsStep.execute(stepContext);

verifyNoInteractions(networkModificationService);
verifyNoInteractions(networkModificationRestService);
verifyNoInteractions(filterService);
}
Copy link

@coderabbitai coderabbitai bot Feb 24, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

fd -e java "ApplyModificationsStep.java" --exec cat -n {} \;

Repository: gridsuite/monitor-core

Length of output: 3106


Test name is misleading — rename to reflect actual behavior.

The test exercises the "does nothing" path, which is guarded by empty modificationUuids() (line 47 of ApplyModificationsStep.execute()), not by the config type. Rename from executeDoesNothingWhenConfigNotModifyingProcessConfig to executeDoesNothingWhenModificationUuidsEmpty to accurately describe what the test verifies.

🤖 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 85 - 95, Rename the test method to reflect the actual behavior
under test: change the method name
executeDoesNothingWhenConfigNotModifyingProcessConfig to
executeDoesNothingWhenModificationUuidsEmpty in ApplyModificationsStepTest;
ensure the test still creates a ModifyingProcessConfig mock, stubs
stepContext.getConfig(), calls applyModificationsStep.execute(stepContext), and
verifies no interactions with networkModificationService,
networkModificationRestService, and filterService, and update any references
(e.g., test runner or IDE-run configurations) to the new method name so the test
suite remains discoverable; this aligns the name with the guard in
ApplyModificationsStep.execute() that checks modificationUuids().

Copy link
Contributor

@antoinebhs antoinebhs Feb 24, 2026

Choose a reason for hiding this comment

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

@KoloMenek maybe test to remove or update?

Copy link

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

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