Skip to content

refactor: adds dtos for hwinfo#833

Open
rsdmike wants to merge 2 commits intomainfrom
hwDtoFix
Open

refactor: adds dtos for hwinfo#833
rsdmike wants to merge 2 commits intomainfrom
hwDtoFix

Conversation

@rsdmike
Copy link
Member

@rsdmike rsdmike commented Mar 11, 2026

No description provided.

@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 71.42857% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.12%. Comparing base (534615b) to head (1bbb8f8).

Files with missing lines Patch % Lines
internal/mocks/wsman_mocks.go 0.00% 4 Missing ⚠️
internal/usecase/devices/info.go 88.23% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #833      +/-   ##
==========================================
+ Coverage   40.02%   40.12%   +0.09%     
==========================================
  Files         114      114              
  Lines       10785    10761      -24     
==========================================
+ Hits         4317     4318       +1     
+ Misses       6068     6042      -26     
- Partials      400      401       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rsdmike rsdmike marked this pull request as ready for review March 18, 2026 17:00
Copilot AI review requested due to automatic review settings March 18, 2026 17:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the WSMAN hardware/disk info retrieval path to return typed result structs instead of interface{}/map-based payloads, and updates the devices usecase + tests/mocks accordingly.

Changes:

  • Updated WSMAN Management APIs to return HWResults / DiskResults structs and removed the old map-shaping helpers.
  • Updated devices usecase DTO conversion to consume typed WSMAN results directly.
  • Regenerated/updated mocks and adjusted unit tests to match the new return types.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/usecase/devices/wsman/message_test.go Removes tests for the deleted physical-memory slice conversion helper.
internal/usecase/devices/wsman/message.go Changes GetHardwareInfo/GetDiskInfo to return typed results; removes map-conversion helpers.
internal/usecase/devices/wsman/interfaces.go Updates Management interface signatures to return typed results.
internal/usecase/devices/info.go Converts typed WSMAN results directly into v1 DTOs (no intermediate maps).
internal/usecase/devices/info_test.go Updates mocks/expectations and expected DTO shapes for HW/Disk info.
internal/mocks/wsman_mocks.go Updates generated gomock stubs for the new typed return values and generation command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +125 to +129
return uc.discInfoToDTO(diskInfo), nil
}

func (uc *UseCase) discInfoToDTO(discInfo interface{}) dto.DiskInfo {
result := dto.DiskInfo{}

info, ok := discInfo.(map[string]interface{})
if !ok {
return result
func (uc *UseCase) discInfoToDTO(diskInfo wsmanAPI.DiskResults) dto.DiskInfo {
return dto.DiskInfo{
Comment on lines +90 to 93
memoryItems := make([]interface{}, len(hw.PhysicalMemoryResult.Body.PullResponse.MemoryItems))
for i := range hw.PhysicalMemoryResult.Body.PullResponse.MemoryItems {
memoryItems[i] = hw.PhysicalMemoryResult.Body.PullResponse.MemoryItems[i]
}
Comment on lines +129 to +131
return dto.DiskInfo{
CIMMediaAccessDevice: dto.CIMResponse{Responses: []interface{}{diskInfo.MediaAccessPullResult.Body.PullResponse.MediaAccessDevices}},
CIMPhysicalPackage: dto.CIMResponse{Responses: []interface{}{diskInfo.PPPullResult.Body.PullResponse.PhysicalPackage}},
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