Pranaykarvi opened a new pull request, #63443:
URL: https://github.com/apache/airflow/pull/63443

   ## Problem
   
   After migrating from Airflow 3.1 to 3.2, DAGs containing `DeadlineAlert` 
fail to serialize with:
   ```AttributeError: 'dict' object has no attribute 'replace```
   This occurs in `SerializedDagModel._try_reuse_deadline_uuids` because after 
migration, existing deadline UUIDs stored in the database may be dicts instead 
of plain strings. The original code assumed all entries were strings and passed 
them directly to `UUID()`, which fails on dicts.
   
   ## Fix
   
   Replaced the single-line list comprehension with a loop that defensively 
handles both formats:
   - Plain UUID strings → parsed directly with `UUID(uid)`
   - Dicts with a `"uuid"` or `"id"` key → UUID extracted and parsed
   - Any other dict (e.g. legacy encoded alert without a UUID key) → returns 
`None` to safely regenerate UUIDs instead of crashing
   
   Only the UUID-parsing logic was changed. No other behavior in the method was 
modified.
   
   ## Testing
   
   Added `test_try_reuse_deadline_uuids_handles_string_and_dict_formats` to 
`airflow-core/tests/unit/models/test_serialized_dag.py` which verifies:
   - String UUIDs are reused correctly
   - Dict UUIDs with `"uuid"` key are reused correctly  
   - Legacy dicts without a UUID key return `None` safely
   
   Fixes #63438


-- 
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]

Reply via email to