Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdded an eligibility pre-check in the StudyController unbuild endpoint and narrowed exception handling in ConsumerService so only JSON parsing errors are caught during build-result processing. Changes
🚥 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. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.42.1)src/main/java/org/gridsuite/study/server/controller/StudyController.javaThanks 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/main/java/org/gridsuite/study/server/controller/StudyController.java`:
- Line 1678: The current call
rootNetworkNodeInfoService.assertNoBuildingNode(rootNetworkUuid,
List.of(nodeUuid)) only checks the single target node; change it to collect all
UUIDs for the whole branch/path that could be affected (e.g. via the service
that resolves branch nodes — for example getBranchNodeUuids(rootNetworkUuid,
nodeUuid) or traverse parents/children) and pass that full list into
rootNetworkNodeInfoService.assertNoBuildingNode; update the code around the call
in StudyController (method handling the unbuild operation) to compute
relatedBranchUuids and call assertNoBuildingNode(rootNetworkUuid,
relatedBranchUuids) so concurrent BUILDING states on any branch node are
guarded.
In `@src/main/java/org/gridsuite/study/server/service/ConsumerService.java`:
- Around line 133-135: handleBuildSuccess(...) is currently invoked before
handleBuildResultWorkflow(...) and only JsonProcessingException is caught, so
runtime errors from workflow metadata parsing (e.g., WorkflowType.valueOf) can
crash the consumer after the build side-effects have been applied; wrap the call
to handleBuildResultWorkflow(studyUuid, receiverObj.getNodeUuid(),
receiverObj.getRootNetworkUuid(), message) in its own try/catch (catch broad
RuntimeException or IllegalArgumentException/IllegalStateException as
appropriate) so parsing or workflow-specific errors are logged/handled without
propagating and without undoing the successful path performed by
studyService.handleBuildSuccess(...).
🪄 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: fcb67c53-9d5a-4f4d-9761-276dd18b55c9
📒 Files selected for processing (2)
src/main/java/org/gridsuite/study/server/controller/StudyController.javasrc/main/java/org/gridsuite/study/server/service/ConsumerService.java
| studyService.handleBuildSuccess(studyUuid, receiverObj.getNodeUuid(), receiverObj.getRootNetworkUuid(), networkModificationResult); | ||
| handleBuildResultWorkflow(studyUuid, receiverObj.getNodeUuid(), receiverObj.getRootNetworkUuid(), message); | ||
| } catch (Exception e) { | ||
| } catch (JsonProcessingException e) { |
There was a problem hiding this comment.
Isolate workflow-header failures from the successful build path.
At Line 133, handleBuildSuccess(...) commits side effects before workflow handling. With Line 135 now catching only JsonProcessingException, runtime failures from workflow metadata parsing (e.g., WorkflowType.valueOf) can bubble up and fail the consumer after success was already applied.
💡 Proposed fix
UUID studyUuid = networkModificationTreeService.getStudyUuidForNodeId(receiverObj.getNodeUuid());
studyService.handleBuildSuccess(studyUuid, receiverObj.getNodeUuid(), receiverObj.getRootNetworkUuid(), networkModificationResult);
- handleBuildResultWorkflow(studyUuid, receiverObj.getNodeUuid(), receiverObj.getRootNetworkUuid(), message);
+ try {
+ handleBuildResultWorkflow(studyUuid, receiverObj.getNodeUuid(), receiverObj.getRootNetworkUuid(), message);
+ } catch (JsonProcessingException | IllegalArgumentException e) {
+ LOGGER.warn("Ignoring malformed workflow metadata for node '{}'", receiverObj.getNodeUuid(), e);
+ }
} catch (JsonProcessingException e) {
LOGGER.error(e.toString());
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| studyService.handleBuildSuccess(studyUuid, receiverObj.getNodeUuid(), receiverObj.getRootNetworkUuid(), networkModificationResult); | |
| handleBuildResultWorkflow(studyUuid, receiverObj.getNodeUuid(), receiverObj.getRootNetworkUuid(), message); | |
| } catch (Exception e) { | |
| } catch (JsonProcessingException e) { | |
| studyService.handleBuildSuccess(studyUuid, receiverObj.getNodeUuid(), receiverObj.getRootNetworkUuid(), networkModificationResult); | |
| try { | |
| handleBuildResultWorkflow(studyUuid, receiverObj.getNodeUuid(), receiverObj.getRootNetworkUuid(), message); | |
| } catch (JsonProcessingException | IllegalArgumentException e) { | |
| LOGGER.warn("Ignoring malformed workflow metadata for node '{}'", receiverObj.getNodeUuid(), e); | |
| } | |
| } catch (JsonProcessingException e) { |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/main/java/org/gridsuite/study/server/service/ConsumerService.java` around
lines 133 - 135, handleBuildSuccess(...) is currently invoked before
handleBuildResultWorkflow(...) and only JsonProcessingException is caught, so
runtime errors from workflow metadata parsing (e.g., WorkflowType.valueOf) can
crash the consumer after the build side-effects have been applied; wrap the call
to handleBuildResultWorkflow(studyUuid, receiverObj.getNodeUuid(),
receiverObj.getRootNetworkUuid(), message) in its own try/catch (catch broad
RuntimeException or IllegalArgumentException/IllegalStateException as
appropriate) so parsing or workflow-specific errors are logged/handled without
propagating and without undoing the successful path performed by
studyService.handleBuildSuccess(...).
Signed-off-by: basseche <bassel.el-cheikh_externe@rte-france.com>
|



PR Summary
Robustify node building :