aniketwaghh opened a new pull request, #72637:
URL: https://github.com/apache/airflow/pull/72637
closes: #72636
Registered serde serializers own their version check. `serde/__init__.py`
dispatches straight to `_deserializers[classname].deserialize(cls, version,
...)`, and the `version > class_version` guard further down applies only to the
attr/dataclass fallback, which a registered serializer never reaches.
Nine of the eleven serializers with a `deserialize()` raise when the payload
version exceeds their own. `uuid.py` and `datetime.py` did not, so a value
written by a newer Airflow was read under the old assumptions rather than
refused. (`kubernetes.py` has no `deserialize`, so eleven is the relevant set.)
On `main`, deserializing a `version=99` payload:
```
bignum (guarded) rejected (serialized 99 of decimal.Decimal > 1)
uuid (no guard) ACCEPTED ->
UUID('12345678-1234-5678-1234-567812345678')
datetime (no guard) ACCEPTED -> datetime.timedelta(seconds=60)
```
After, both are rejected with the message their siblings already use.
Nothing changes for any payload that exists today: both serializers are at
the version they ship with, so nothing in the wild carries a higher one. It
matters the next time either format changes, when whoever bumps `__version__`
would reasonably assume the guard was already there — and its absence would not
be visible in that diff.
The `datetime` serializer still reads its version-1 payloads, legacy
short-code timezones included; only versions above its current 2 are rejected.
Two tests. `test_deserialize_rejects_a_newer_version` covers uuid, timedelta
and datetime and fails on `main` for all three.
`test_deserialize_still_accepts_the_current_and_legacy_versions` pins the
versions that are in use, including the v1 legacy timezone path; it passes
either way, so it is a regression guard rather than a bug test.
`task-sdk` suite on this branch and on `main` at `123b1be658`, same machine:
17 failed / 2786 passed here against 17 failed / 2782 passed there, the four
extra passes being the parametrised cases above. The seventeen failures are the
same seventeen on both sides — deltalake serializers, provider-manager runtime,
and some param/supervisor/task-runner cases, all from optional dependencies
missing locally. `ruff` 0.16.4, the version `.pre-commit-config.yaml` pins, is
clean on the three changed files.
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
--
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]