Closed deepyaman closed 3 days ago
Also let's update the Changelog entry to:
Fixed a bug where using the
&
or|
operators onAutomationConditions
with labels would cause that label to be erased.
before merging
This looks great! Not a blocker, but just because it's only a few extra lines of code, might be worth adding a test for both the first and second operands being labeled
Sounds good, will do!
Summary & Motivation
Imagine you have:
The implementation of
__and__
automatically transformsAnd(And(c1, c2), c3)
intoAnd(c1, c2, c3)
. This process is generally desirable, as this reduces the number of levels in the hierarchy, making it easier to parse and understand expressions.However, if an expression has a label, then this indicates that it has its own semantic meaning, which gets erased by this process.
We should prevent this automatic collapsing in cases where the existing condition's label is not
None
.The same applies to
__or__
!How I Tested These Changes
Added unit tests in python_modules/dagster/dagster_tests/definitions_tests/declarative_automation_tests/automation_condition_tests/fundamentals/test_automation_condition.py.
Changelog
Fixed a bug where using the
&
or|
operators onAutomationCondition
s with labels would cause that label to be erased.