amoghrajesh commented on PR #66002: URL: https://github.com/apache/airflow/pull/66002#issuecomment-4350491727
> The changes to the `Encoding` enum are due to this: https://github.com/apache/airflow/actions/runs/25040217658/job/73343984827?pr=66002 > > `_decode_start_trigger_args` previously called `BaseSerialization.deserialize()` on `trigger_kwargs` when loading a serialized DAG, which inflated the BaseSerialization-encoded dict back to Python objects before storing on StartTriggerArgs. This PR stops that deserialization and keeps trigger_kwargs as raw JSON. > > The raw JSON has Encoding enum instances as dict keys — that's how `BaseSerialization.serialize()` encodes dicts. When defer_task() passes `trigger_kwargs` to `Trigger(kwargs=...)`, `encrypt_kwargs` calls `serde.serialize()`, which converts dict keys via `str(k)`. > > Python 3.10+ > > ``` > str(Encoding.TYPE) > Out[3]: '__type' > ``` > > Python 3.10: > > ``` > Python 3.10.19 (main, Feb 12 2026, 00:36:33) [Clang 21.1.4 ] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> from enum import Enum, unique > >>> @unique > ... class Encoding(str, Enum): > ... TYPE = "__type" > ... VAR = "__var" > ... > >>> str(Encoding.TYPE) > 'Encoding.TYPE' > ``` > > On Python ≤3.10, str(Encoding.TYPE) returns "Encoding.TYPE" (the enum repr) instead of "__type" (its value), mangling the keys so the Triggerer cannot read them back. > > Adding `__str__` to Encoding makes `str(Encoding.TYPE)` return `"__type"` consistently across all Python versions, so serde's key conversion produces the right output. This is a pre-existing inconsistency that only became observable once we stopped deserializing trigger_kwargs early. Caused some side effects, writing a manual normalising code in `defer_task` instead -- 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]
