Skip to content

[Bug] ScheduleOverlapPolicy has broken __eq__ #652

Open
@andersio

Description

@andersio

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions