aniketwaghh commented on code in PR #72637:
URL: https://github.com/apache/airflow/pull/72637#discussion_r3964500015
##########
task-sdk/tests/task_sdk/serde/test_serializers.py:
##########
@@ -267,6 +268,43 @@ def test_numpy_deserialize_errors(self, klass, ver, value,
msg):
with pytest.raises(TypeError, match=msg):
deserialize(klass, ver, value)
+ @pytest.mark.parametrize(
+ ("klass", "ver", "value"),
+ [
+ pytest.param(uuid.UUID, 999,
"12345678-1234-5678-1234-567812345678", id="uuid"),
+ pytest.param(datetime.timedelta, 999, 60.0, id="timedelta"),
+ pytest.param(datetime.datetime, 999, {"timestamp": 1767268800.0,
"tz": None}, id="datetime"),
+ ],
+ )
+ def test_deserialize_rejects_a_newer_version(self, klass, ver, value):
+ """A payload written by a newer Airflow must not be read under the old
assumptions.
+
+ The framework does not check on a registered serializer's behalf:
serde dispatches
+ straight to ``_deserializers[classname].deserialize`` and its own
version guard covers
+ only the attr/dataclass fallback. uuid and datetime were the two
serializers missing it.
+ """
+ from airflow.sdk.serde import deserialize as _ # noqa: F401
Review Comment:
Good catch — that import was doing nothing and the noqa hid it. Rewritten in
32708bf to encode the payload and go through `serde.deserialize()`, so it
exercises the dispatch the docstring talks about instead of stepping around it.
Still fails on main for all three cases.
--
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]