hwang-cadent opened a new pull request, #66564:
URL: https://github.com/apache/airflow/pull/66564
## Summary
`OperatorSerialization._deserialize_field_value` previously routed every
`*_date` field directly to `_deserialize_datetime`. When an operator stores a
date-suffixed field as `NOTSET` (an `ArgNotSet` sentinel meaning "use the
default at runtime"), the value is encoded as `{__type: ARG_NOT_SET}`. Passing
that encoding to `_deserialize_datetime` raises because it is not a datetime
payload, so deserializing such an operator (for example `TriggerDagRunOperator`
whose `logical_date` defaults to `NOTSET`) fails.
This PR short-circuits the ARG_NOT_SET case on date-suffixed fields and
restores the `NOTSET` singleton. `None` values and real datetimes keep their
existing behavior.
## Why a separate PR
This was originally bundled inside #56973 (dynamic `dag_id` resolution in
`TriggerDagRunOperator` links). Per reviewer feedback from @potiuk, splitting
it out keeps each concern independently reviewable, bisectable and
backportable. #56973 is being rebased to drop the serialization change once
this PR lands.
## Changes
- `airflow-core/src/airflow/serialization/serialized_objects.py`: handle
ARG_NOT_SET in `_deserialize_field_value` for date-suffixed fields.
- `airflow-core/tests/unit/serialization/test_serialized_objects.py`: add
`test_deserialize_field_value_with_arg_not_set_for_date_fields` covering
`logical_date`, `start_date`, `end_date`.
## Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
## Testing
- New direct unit test verifies `_deserialize_field_value` returns `NOTSET`
for `logical_date`, `start_date` and `end_date` when given an ARG_NOT_SET
encoding.
- The fix is also exercised indirectly by the `TriggerDagRunOperator`
round-trip tests on #56973.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]