perf(api): optimize redfish action device lookup#1049
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR optimizes Redfish system-action flows by validating system existence through the local devices repository (when available) instead of triggering WS-MAN hydration via the ComputerSystem repository.
Changes:
- Added a
DeviceLookupRepositorydependency andEnsureSystemExistshelper toComputerSystemUseCaseto support lightweight existence checks. - Updated multiple Redfish action handlers (Reset / KVM consent actions) to pre-validate system existence before executing the action.
- Wired the device-lookup dependency during Redfish component initialization and updated action-handler tests to provide a lookup repo.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| redfish/internal/usecase/computer_system.go | Introduces DeviceLookupRepository, adapter, and EnsureSystemExists; token generation now uses the new existence-check path. |
| redfish/internal/controller/http/v1/handler/systems_actions.go | Adds EnsureSystemExists checks before executing several system action endpoints. |
| redfish/internal/controller/http/v1/handler/systems_actions_test.go | Updates tests to provide a device lookup repo to the use case so action endpoints can validate existence. |
| redfish/component.go | Wires DeviceRepo (devices use case in real mode; adapter in mock mode) into ComputerSystemUseCase. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## redfish #1049 +/- ##
===========================================
+ Coverage 42.79% 42.98% +0.19%
===========================================
Files 153 153
Lines 14804 14853 +49
===========================================
+ Hits 6335 6385 +50
+ Misses 7890 7888 -2
- Partials 579 580 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
09a0c99 to
f5312f0
Compare
f5312f0 to
f168de8
Compare
amarnath-ac
approved these changes
Jun 4, 2026
Contributor
amarnath-ac
left a comment
There was a problem hiding this comment.
LGTM, tested changes, no delay in fetching redirection token.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PR introduces an optimization w.r.t device lookup where instead of query for the validate device-id (UUID) through WS-MAN API's we query with the local device repo.