Minimize panic path for power policy action#665
Merged
jerrysxie merged 2 commits intoOpenDevicePartnership:mainfrom Dec 24, 2025
Merged
Minimize panic path for power policy action#665jerrysxie merged 2 commits intoOpenDevicePartnership:mainfrom
jerrysxie merged 2 commits intoOpenDevicePartnership:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes a panic path from the power_capability() method in the Policy<ConnectedProvider> implementation by changing its return type from ProviderPowerCapability to Option<ProviderPowerCapability> and eliminating the .unwrap() call.
- Changed
power_capability()return type toOption<ProviderPowerCapability>to propagate the optional nature of the underlying device capability - Removed the
.unwrap()call that could cause panics when the provider capability is not available
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kurtjd
approved these changes
Dec 24, 2025
bramsdell-ms
approved these changes
Dec 24, 2025
Contributor
Author
|
Announced on Zulip: #embedded-controller > embedded-service power policy breaking change @ 💬 |
Contributor
Author
|
Bypassed policy since this change is minor and people are out on vacation. |
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.
This pull request makes a minor change to the
Policyimplementation, updating thepower_capabilitymethod to return anOption<ProviderPowerCapability>instead of unwrapping the result. This improves error handling by allowing callers to handle cases where the capability is unavailable.