-
Notifications
You must be signed in to change notification settings - Fork 27
fix: Return default value for OSPowerSavingState when device is power… #2277
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
Conversation
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.
Pull request overview
This PR fixes a bug in the power state endpoint to return a default value of 0 for OSPowerSavingState when the device is powered off or the value cannot be retrieved. The changes include refactoring code formatting across multiple files to improve readability by splitting long function calls across multiple lines.
Key changes:
- Modified
getPowerState.tsto handle null/missingOSPowerSavingStatevalues by defaulting to 0 - Added comprehensive test coverage for various error scenarios in
OSPowerSavingStateretrieval - Reformatted long function calls across multiple files for better readability
Reviewed changes
Copilot reviewed 8 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/routes/amt/getPowerState.ts | Fixed bug by returning default value of 0 for OSPowerSavingState when unavailable and simplified conditional logic |
| src/routes/amt/getPowerState.test.ts | Added four new test cases covering error scenarios, null responses, missing fields, and timeouts for OSPowerSavingState |
| src/utils/wsRedirect.test.ts | Reformatted long test assertions to multi-line format for improved readability |
| src/routes/devices/index.ts | Reformatted route definition to multi-line format |
| src/routes/amt/index.ts | Reformatted route definition to multi-line format |
| src/routes/amt/certificates/delete.ts | Reformatted find() predicate to multi-line format |
| src/routes/amt/certificates/delete.test.ts | Reformatted long test assertions to multi-line format |
| src/index.ts | Reformatted import statement and logger.warn call to multi-line format |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ed9346b to
2587ec9
Compare
2587ec9 to
51eb271
Compare
graikhel-intel
left a comment
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.
LGTM!
## [2.25.3](v2.25.2...v2.25.3) (2026-01-05) ### Bug Fixes * Return default value for OSPowerSavingState when device is powered off ([#2277](#2277)) ([f7a0adf](f7a0adf))
|
🎉 This PR is included in version 2.25.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
…ed off
PR Checklist
What are you changing?
Anything the reviewer should know when reviewing this PR?
If the there are associated PRs in other repositories, please link them here (i.e. device-management-toolkit/repo#365 )