-
Couldn't load subscription status.
- Fork 4
Fix end_time not handling None values correctly
#164
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
Fix end_time not handling None values correctly
#164
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 the issue where a None value for end_time was not handled correctly during protobuf conversions. The changes ensure that end_time is properly converted to/from protobuf when its value is None.
- Added a test case to verify that Dispatch instances correctly handle end_time = None.
- Updated both from_protobuf and to_protobuf methods to conditionally process end_time.
- Updated RELEASE_NOTES to document the bug fix.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_proto.py | Added a test case for Dispatch with a None end_time. |
| src/frequenz/client/dispatch/types.py | Updated protobuf conversions for end_time with a conditional check for None. |
| RELEASE_NOTES.md | Documented the bug fix for end_time handling. |
4d1c605 to
4410ade
Compare
Signed-off-by: Mathias L. Baumann <[email protected]>
4410ade to
03610c5
Compare
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
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, but I think the release notes could be improved. It is more useful to describe the user-visible effect of the bug. As a user I have no idea about how this bug manifested.
| end_time=to_datetime(pb_object.metadata.end_time), | ||
| end_time=( | ||
| to_datetime(pb_object.metadata.end_time) | ||
| if pb_object.metadata.HasField("end_time") |
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.
I think we have this bug in many places in all API clients. We need to be more careful about optional/non-existing fields... For sure I've seen it in the microgrid API, but I think we are lucky there because most stuff we should check if they exist is always filled by the server, so we are not seeing the effect of the bug there.
fixes #162