potiuk opened a new pull request, #70704: URL: https://github.com/apache/airflow/pull/70704
`Callback.get_callback_path` imports the module named by a dotted-path string in order to check that it resolves to a callable. That check is deliberately best effort — the `ImportError` is logged and swallowed and the path is returned either way, because the callable may only exist on the host that will eventually run it. Rebuilding a `Callback` from its serialized form went through that same path, so deserializing one imported the module named in the stored data. The path was already checked when the `Callback` was first created, and reconstruction happens in components that never invoke the callback themselves, so importing there is neither needed nor wanted — it runs module-level code of whatever the stored string happens to name. This carries a path read back from serialized data in a private `str` subclass and returns it unchanged instead of resolving it a second time. Construction from a Dag author's callable or dotted path is unaffected, including the existing import-based callable check. The dot-path shape check still applies to stored paths too, so a malformed stored path is still rejected. ### Test plan - [x] `test_init_imports_the_module_named_by_the_path` — positive control: Dag-author construction still resolves the path - [x] `test_deserialize_does_not_import_the_module_named_by_the_stored_path` — and the `AsyncCallback` equivalent - [x] `test_serde_deserialize_does_not_import_the_module_named_by_the_stored_path` — full route through serde - [x] `test_deserialize_rejects_a_path_which_is_not_a_dot_path` — shape check preserved on stored paths - [x] `test_deserialize_keeps_a_stored_path_which_no_longer_points_at_a_callable` - [x] Tests use a real fixture module whose import has an observable side effect, rather than mocking `import_string` ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Opus 5 (1M context) Generated-by: Claude Opus 5 (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]
