-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TTCRes is generated with a status IT issues on CE side when rao failed or loadflow diverged on network with Pra #219
Conversation
…d or loadflow diverged on network with Pra
WalkthroughThis pull request enhances error handling in the application’s TTC processing workflow. In the runner service, an additional condition has been introduced to detect IT-related failures and save a failed TTC result accordingly. The TTC result service’s main method now includes a try-catch block to catch load flow computation exceptions, saving a failed result when necessary and throwing a custom exception. Test cases have been updated to reflect these changes, and a new test class along with a sample network XML file has been added. Additionally, an enum value now includes a descriptive message. Changes
Sequence Diagram(s)sequenceDiagram
participant Runner as CseRunner
participant Service as TtcResultService
participant DB as Database
Runner ->> Runner: Check multipleDichotomyResult.isRaoFailed()
alt IT issue detected
Runner ->> Service: saveFailedTtcResult(cseRequest, firstShiftNetworkName, IT_ISSUE)
Service ->> DB: Save failed TTC result
DB -->> Service: ttcResultUrl
Service -->> Runner: Return ttcResultUrl
Runner ->> Runner: Set finalCgmUrl = firstShiftNetworkName
end
sequenceDiagram
participant Service as TtcResultService
participant Network as NetworkComputation
participant DB as Database
Service ->> Network: Process TTC result
alt Computation successful
Network -->> Service: Return successful result
else LoadflowComputationException thrown
Network -->> Service: Exception raised
Service ->> Service: Catch LoadflowComputationException
Service ->> Service: Call saveFailedTtcResult(cseRequest, ..., IT_ISSUE)
Service ->> DB: Save failed result
DB -->> Service: Return ttcResultUrl
Service -->> Caller: Throw CseInternalException with message
end
Possibly related PRs
Suggested reviewers
Poem
Tip 🌐 Web search-backed reviews and chat
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/services/CseRunnerTest.java (1)
207-207
: LGTM! Consider adding more test scenarios.The change correctly verifies that RAO failures are now treated as IT issues, which aligns with the PR objectives. However, consider adding test cases for edge cases:
- Multiple consecutive RAO failures
- RAO failure with partial results
cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/services/TtcResultatServiceTest.java (2)
47-67
: LGTM! Consider adding more test cases.The test case effectively verifies the error handling for loadflow divergence. However, consider adding more test cases to cover:
- Successful TTC result generation
- Other failure scenarios
- Edge cases with different input parameters
69-94
: Consider simplifying test request builder.The test request builder method contains many null parameters. Consider:
- Creating a builder pattern for
CseRequest
- Using a test data factory
- Extracting test resource paths to constants
cse-cc-import-runner-app/src/test/resources/com/farao_community/farao/cse/import_runner/app/services/networkKO.xiidm (1)
58-59
: Consider documenting the divergence trigger.Line L3 has an extremely high resistance value that would cause loadflow divergence. Consider adding a comment to document this intentional configuration.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/services/CseRunner.java
(1 hunks)cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/services/TtcResultService.java
(3 hunks)cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/services/CseRunnerTest.java
(1 hunks)cse-cc-import-runner-app/src/test/java/com/farao_community/farao/cse/import_runner/app/services/TtcResultatServiceTest.java
(1 hunks)cse-cc-import-runner-app/src/test/resources/com/farao_community/farao/cse/import_runner/app/services/networkKO.xiidm
(1 hunks)cse-lib/data/src/main/java/com/farao_community/farao/cse/data/ttc_res/TtcResult.java
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- cse-lib/data/src/main/java/com/farao_community/farao/cse/data/ttc_res/TtcResult.java
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (2)
cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/services/TtcResultService.java (1)
56-85
: LGTM! Error handling is well-implemented.The error handling for loadflow computation exceptions is appropriate, with proper:
- Exception catching
- Failed result saving
- Exception propagation
cse-cc-import-runner-app/src/main/java/com/farao_community/farao/cse/import_runner/app/services/CseRunner.java (1)
162-168
: LGTM! RAO failure handling is well-implemented.The new condition for handling RAO failures is appropriate and maintains the existing error handling flow.
Please check if the PR fulfills these requirements (please use
'[x]'
to check the checkboxes, or submit the PR and then click the checkboxes)Does this PR already have an issue describing the problem ? If so, link to this issue using
'#XXX'
and skip the restWhat kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
What is the new behavior (if this is a feature change)?
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
Other information:
(if any of the questions/checkboxes don't apply, please delete them entirely)
Summary by CodeRabbit
Bug Fixes
Tests