Lee-W commented on code in PR #73748:
URL: https://github.com/apache/airflow/pull/73748#discussion_r4440734900
##########
task-sdk/tests/task_sdk/serde/test_serializers.py:
##########
@@ -164,6 +164,71 @@ def test_deserialize_legacy_datetime_bare_timestamp(self):
nested = deserialize({"moment": legacy})
assert nested["moment"].timestamp() == moment.timestamp()
+ def test_naive_datetime_serde_roundtrip(self):
+ """End-to-end: a naive datetime survives a serde round-trip
unchanged."""
+ naive = datetime.datetime(2026, 3, 15, 12, 0, 0)
+ assert deserialize(serialize(naive)) == naive
+
+ def test_naive_datetime_v3_roundtrip_independent_of_os_timezone(self,
monkeypatch):
+ """v3 naive datetimes round-trip regardless of the process OS timezone
(see #72635)."""
+ import os
+ import time
+
+ from airflow.sdk.serde.serializers import datetime as serde_datetime
Review Comment:
I think we can move these import to the top and this alias is not needed
##########
airflow-core/src/airflow/serialization/dag_version_diff.py:
##########
@@ -884,10 +884,10 @@ def _canonicalize_value(value: Any, *, path: tuple[str,
...]) -> Any:
value = {"name": None, **value}
interval = value.get("interval")
if isinstance(interval, (int, float)) and not isinstance(interval,
bool):
- # Diff schema v1 uses the SDK's version-2 timedelta encoding
for legacy seconds.
+ # Diff schema v1 uses the SDK's version-3 timedelta encoding
for legacy seconds.
value["interval"] = {
"__classname__": "datetime.timedelta",
- "__version__": 2,
+ "__version__": 3,
Review Comment:
The canonical timedelta is now `__version__: 3`, but migration
`0117_3_3_0_change_deadline_interval_to_json.py` (and Dags serialized before
the upgrade) store `__version__: 2`. The timedelta format did not change, so
the same interval now compares unequal and shows up as a spurious deadline
diff. Keep the literal 2 (or normalize `__version__` on `datetime.timedelta`
nodes before comparing) and add a test where a stored v2 and a stored v3
interval compare equal.
--
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]