Skip to content
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

[Bug] ScheduleOverlapPolicy has broken __eq__ #652

Open
andersio opened this issue Sep 27, 2024 · 1 comment
Open

[Bug] ScheduleOverlapPolicy has broken __eq__ #652

andersio opened this issue Sep 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@andersio
Copy link

andersio commented Sep 27, 2024

What are you really trying to do?

In a deployment script, compare a Schedule on the server to a proposed Schedule, and skip schedule updates as needed.

Describe the bug

When comparing two Schedules that differ only in their ScheduleOverlapPolicy, Schedule.__eq__ returns true.

This seems to be caused by ScheduleOverlapPolicy, where every enum case apparently equals to any cases according to ScheduleOverlapPolicy.__eq__, even though the underlying values are different.

For some reason, ScheduleOverlapPolicy is both a dataclass and an IntEnum. Seems like the rare combination might have caused the behaviour here?

Minimal Reproduction

from temporalio.client import ScheduleOverlapPolicy

print(ScheduleOverlapPolicy.SKIP == ScheduleOverlapPolicy.TERMINATE_OTHER)
# console: True

print(int(ScheduleOverlapPolicy.SKIP) == int(ScheduleOverlapPolicy.TERMINATE_OTHER))
# console: False

print(ScheduleOverlapPolicy.SKIP.value == ScheduleOverlapPolicy.TERMINATE_OTHER.value)
# console: False

Environment/Versions

Python 3.11.7

 name         : temporalio             
 version      : 1.7.0                  
 description  : Temporal.io Python SDK 

dependencies
 - protobuf >=3.20
 - types-protobuf >=3.20
 - typing-extensions >=4.2.0,<5.0.0

Additional context

@andersio andersio added the bug Something isn't working label Sep 27, 2024
@andersio andersio changed the title [Bug] Some SDK types have broken __eq__ [Bug] A subset of SDK types seem to have broken __eq__ Sep 27, 2024
@andersio andersio changed the title [Bug] A subset of SDK types seem to have broken __eq__ [Bug] A subset of SDK types seems to have broken __eq__ Sep 27, 2024
@andersio andersio changed the title [Bug] A subset of SDK types seems to have broken __eq__ [Bug] ScheduleOverlapPolicy has broken __eq__ Sep 27, 2024
@cretz
Copy link
Member

cretz commented Sep 27, 2024

For some reason, ScheduleOverlapPolicy is both a dataclass and an IntEnum

This was a mistake on our part and was fixed in #628 and therefore the fix is in 1.7.1. Can you confirm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants