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

   mysqlclient 2.3.1 changed `Connection.literal()` to apply built-in `str` 
handling only to exact `str` instances, so `str`-subclass Enums are now escaped 
via `str()`. Members without `__str__` are written as e.g. 
`'CallbackType.TRIGGERER'`. On MySQL, `callback.type` (`String(20)`) is then 
truncated to `'CallbackType.TRIGGER'`, which matches no polymorphic identity, 
and the scheduler crash-loops on the deadline query. Details and a production 
repair are in #76926.
   
   This gives the four `str`-Enums that are written to DB columns without 
`.value` a `__str__` returning their value, matching `CallbackState`, 
`TaskInstanceState` and the other state enums:
   
   - `CallbackType` (`callback.type`, via `polymorphic_identity`)
   - `CallbackFetchMethod` (`callback.fetch_method`)
   - `ReprocessBehavior` (`backfill.reprocess_behavior`)
   - `BackfillDagRunExceptionReason` (`backfill_dag_run.exception_reason`)
   
   `DagWarningType` is already safe because `get_warning_type_value` stores 
`.value`. Other `str`-Enums without `__str__` (API datamodels, serialization, 
trigger/workload kinds) are not bound to DB columns.
   
   The tests assert `str(member) == member.value` for every member: they fail 
on `main` (11 failed) and pass with this change. On a production DB that ran 
mysqlclient 2.3.1 for ~17h, `callback.type` and `callback.fetch_method` were 
the only short-string columns with `Cls.MEMBER` values. The backfill columns 
are covered by the same code path.
   
   closes: #76926
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Claude Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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