potiuk opened a new pull request, #66737: URL: https://github.com/apache/airflow/pull/66737
## Summary Align custom deadline reference resolution with the existing plugin-registration pattern already used by [timetables](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/plugins_manager.py#L266) and [partition mappers](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/plugins_manager.py#L278). Before this change, `SerializedCustomReference.deserialize_reference()` resolved class paths via `import_string()` on the serialized `__class_path` value. After this change, custom deadline reference classes have to be registered via the new `deadline_references` attribute on `AirflowPlugin`, the same way custom timetables and custom partition mappers are registered. ## Files changed - `shared/plugins_manager/.../plugins_manager.py` — new `AirflowPlugin.deadline_references` attribute. - `airflow-core/.../plugins_manager.py` — new `get_deadline_references_plugins()`. - `airflow-core/.../serialization/helpers.py` — new `DeadlineReferenceNotRegistered` exception and `find_registered_custom_deadline_reference()`. - `airflow-core/.../serialization/definitions/deadline.py` — `SerializedCustomReference.deserialize_reference()` now uses the registry. - `airflow-core/tests/unit/serialization/test_deadline_reference_registry.py` — new tests covering registry hit/miss + serialization round-trip. - `airflow-core/docs/administration-and-deployment/plugins.rst` — document the new attribute. ## Migration Any project relying on inline DAG-author-defined custom deadline references will need to migrate to a registered plugin class. Core deadlines (`FixedDatetimeDeadline`, `DagRunLogicalDateDeadline`, `DagRunQueuedAtDeadline`, `AverageRuntimeDeadline`) are unaffected. ## Test plan - [ ] `uv run --project airflow-core pytest airflow-core/tests/unit/serialization/test_deadline_reference_registry.py -xvs` - [ ] `uv run --project airflow-core pytest airflow-core/tests/unit/models/test_deadline.py -xvs` - [ ] `prek run --from-ref upstream/main --stage pre-commit` - [ ] `uv run --project airflow-core --with "apache-airflow-devel-common[mypy]" mypy airflow-core/src/airflow/serialization/` ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Opus 4.7 (1M context) Generated-by: Claude Opus 4.7 (1M context) following the guidelines at https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions -- 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]
