Skip to content

Conversation

@Marenz
Copy link
Contributor

@Marenz Marenz commented May 14, 2025

fixes #162

Copilot AI review requested due to automatic review settings May 14, 2025 07:56
@Marenz Marenz requested review from a team as code owners May 14, 2025 07:56
@github-actions github-actions bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:dispatcher labels May 14, 2025
@Marenz Marenz removed the request for review from daniel-zullo-frequenz May 14, 2025 07:57
@Marenz Marenz enabled auto-merge May 14, 2025 07:57
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

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.

@Marenz Marenz force-pushed the fix_end_time_none_handling branch from 4d1c605 to 4410ade Compare May 14, 2025 07:59
@Marenz Marenz force-pushed the fix_end_time_none_handling branch from 4410ade to 03610c5 Compare May 14, 2025 08:03
Copy link
Contributor Author

@Marenz Marenz left a comment

Choose a reason for hiding this comment

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

LGTM

@Marenz Marenz disabled auto-merge May 14, 2025 08:36
@Marenz Marenz merged commit cc3e2d6 into frequenz-floss:v0.x.x May 14, 2025
5 checks passed
@Marenz Marenz deleted the fix_end_time_none_handling branch May 14, 2025 08:36
Copy link
Contributor

@llucax llucax left a 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")
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:dispatcher part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix flaking tests (probably due to end_time)

2 participants