Skip to content

Conversation

@lfse-slafleur
Copy link
Member

No description provided.

… messages with a message id vs without and ensure that to_dict is json serializable.
@lfse-slafleur lfse-slafleur self-assigned this Jul 31, 2025
@lfse-slafleur lfse-slafleur marked this pull request as ready for review July 31, 2025 11:42
Copy link
Contributor

@MauriceHendrix MauriceHendrix left a comment

Choose a reason for hiding this comment

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

looks plausable and if i understand it correctly the trick with message-id is noce, but I can't really oversee the consequences of the to_dict change

PowerMeasurement,
]

S2Message: TypeAlias = Union[
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this fix the issues we're having with subclassing and the message_id?
Do we have a testcase for it?

Copy link
Member Author

Choose a reason for hiding this comment

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

@MauriceHendrix What is the issue you have with subclassing? This allows us to refer to S2 messages which have a message id with S2MessageWithID and all S2 messages (even those without a message id) with S2Message. However, S2MessageWithID is currently not a type that is a result from any function in this library so it is up to the user to actually differentiate somewhere in their code if the message they are currently refering to is one with a message id or if it is unknown. It is a bit hard to test given it is a typing alias, but I provided some usage here: https://github.com/flexiblepower/s2-python/pull/134/files#diff-2149287ebe9503504f407458b92eea4f7e4bb7cffa11e936cab5730f40bf9a13R72

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that I think about it I think this was more of a problem in our Java code (which we did solve a while ago)

@lfse-slafleur
Copy link
Member Author

lfse-slafleur commented Aug 1, 2025

#134 (comment)

@MauriceHendrix In response to your latter comment: Yeah you are right. I thought we could get away with it as I was assuming to_dict isn't really used anywhere yet. So I added the mode anyways. Added a test case too to ensure json.dumps remains working.

Copy link
Collaborator

@VladIftime VladIftime left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for catching the issue

@jorritn
Copy link
Contributor

jorritn commented Aug 11, 2025

Other than the comment about the to_dict, looks perfectly fine.

@lfse-slafleur lfse-slafleur merged commit 21d5d66 into main Aug 11, 2025
19 checks passed
@lfse-slafleur lfse-slafleur deleted the fix_missing_message_id_override_on_ppbc branch August 11, 2025 10:09
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.

5 participants