Repository navigation
Reject serde payloads newer than the uuid and datetime serializers - #72637
Closed
aniketwaghh wants to merge 2 commits into
Closed
aniketwaghh wants to merge 2 commits into
aniketwaghh wants to merge 2 commits into
Conversation
Registered serde serializers are responsible for their own version check: serde dispatches straight to _deserializers[classname].deserialize, and the version guard in serde/__init__.py covers only 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 and datetime did not, so a value written by a newer Airflow was read under the old assumptions instead of being refused. No payload in the wild carries a higher version today, since both serializers are at the version they ship with. This matters the next time either format changes, when the guard would reasonably be assumed to already exist. The datetime serializer keeps reading its version-1 payloads, legacy short-code timezones included; only versions above its current 2 are rejected.
aniketwaghh
requested review from
amoghrajesh,
ashb and
kaxil
as code owners
September 7, 2026 14:45
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
kaxil
reviewed
Sep 9, 2026
The rejection test called the serializer's deserialize() directly, which skipped the dispatch its own docstring describes, and carried an unused import silenced with noqa to paper over that. Encode the payload and go through serde.deserialize() instead, matching test_deserialize_datetime_v1. Drop test_deserialize_still_accepts_the_current_and_legacy_versions. The existing tests already cover in-use versions and now dispatch through the new check: making the guard reject version >= 1 fails 17 of them, including test_deserialize_datetime_v1 and test_datetime.
Contributor
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes: #72636
Registered serde serializers own their version check.
serde/__init__.pydispatches straight to_deserializers[classname].deserialize(cls, version, ...), and theversion > class_versionguard 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.pyanddatetime.pydid not, so a value written by a newer Airflow was read under the old assumptions rather than refused. (kubernetes.pyhas nodeserialize, so eleven is the relevant set.)On
main, deserializing aversion=99payload: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
datetimeserializer 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_versioncovers uuid, timedelta and datetime and fails onmainfor all three.test_deserialize_still_accepts_the_current_and_legacy_versionspins 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-sdksuite on this branch and onmainat123b1be658, 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.ruff0.16.4, the version.pre-commit-config.yamlpins, is clean on the three changed files.^ Add meaningful description above