Populate element names for result's variation id#171
Conversation
Signed-off-by: Thang PHAM <phamthang37@gmail.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds ResultUtils for UUID extraction/formatting/resolution, a DirectoryService to fetch element names, applies a varId setter on SensitivityOfTo, refactors builder usage to call ResultUtils, and integrates UUID→name resolution into SensitivityAnalysisService result population. ChangesUUID Resolution and Variation ID Formatting
Sequence DiagramssequenceDiagram
participant Client
participant SensitivityAnalysisService
participant Repository as Result Repository
participant ResultUtils
participant DirectoryService
Client->>SensitivityAnalysisService: getRunResult(runId)
SensitivityAnalysisService->>Repository: fetch SensitivityRunQueryResult
Repository-->>SensitivityAnalysisService: SensitivityRunQueryResult
SensitivityAnalysisService->>ResultUtils: extractUuidsFromVariationId(varId)
ResultUtils-->>SensitivityAnalysisService: List<UUID>
SensitivityAnalysisService->>DirectoryService: getElementNames(uuids)
DirectoryService-->>SensitivityAnalysisService: Map<UUID,String> names
SensitivityAnalysisService->>ResultUtils: resolveForVariationId(varId, names)
ResultUtils-->>SensitivityAnalysisService: resolved varId
SensitivityAnalysisService-->>Client: return enriched result
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/sensitivityanalysis/server/service/DirectoryService.java`:
- Around line 61-71: The directory lookup currently catches only
HttpClientErrorException and assumes restTemplate.exchange(...).getBody() is
non-null; update the try/catch in DirectoryService around the
restTemplate.exchange call to catch RestClientException (the common base for
HttpClientErrorException, HttpServerErrorException, ResourceAccessException,
etc.) and after calling getBody() check for null—if getBody() is null or an
exception is thrown, return Map.of() to preserve the graceful fallback behavior.
In
`@src/main/java/org/gridsuite/sensitivityanalysis/server/service/SensitivityAnalysisService.java`:
- Line 175: The call to populateResultWithElementNames is duplicating work
because getRunResult already enriches the result with element names; remove the
redundant populateResultWithElementNames invocation in the CSV export path (the
call at the location where you currently call populateResultWithElementNames
after getRunResult) so the export uses the already-enriched result returned by
getRunResult, or alternatively guard the call so it only runs when getRunResult
did not perform enrichment.
🪄 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: b3a97fe4-ed5f-4135-aa18-73cb7b4d84f1
📒 Files selected for processing (6)
src/main/java/org/gridsuite/sensitivityanalysis/server/dto/SensitivityOfTo.javasrc/main/java/org/gridsuite/sensitivityanalysis/server/service/DirectoryService.javasrc/main/java/org/gridsuite/sensitivityanalysis/server/service/SensitivityAnalysisInputBuilderService.javasrc/main/java/org/gridsuite/sensitivityanalysis/server/service/SensitivityAnalysisService.javasrc/main/java/org/gridsuite/sensitivityanalysis/server/util/ResultUtils.javasrc/main/resources/application-local.yaml
Signed-off-by: Thang PHAM <phamthang37@gmail.com>
Signed-off-by: Thang PHAM <phamthang37@gmail.com>
…/DirectoryService.java Good for me Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…/SensitivityAnalysisService.java Good for me Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Thang PHAM <phamthang37@gmail.com>
Signed-off-by: Thang PHAM <phamthang37@gmail.com>
Removed UUID_REGEX constant from SensitivityAnalysisService.
…riation_id' into populate_element_names_result_variation_id
Signed-off-by: Thang PHAM <phamthang37@gmail.com>
|



PR Summary
Back to the solution which uses the directory client service to resolve element names for the variationId in the result
[uuid1, uuid2] (REGULAR) => [name1, name2] (REGULAR)