Skip to content

Fix CallbackKey type for more accurate type checking#66973

Open
ferruzzi wants to merge 2 commits into
apache:mainfrom
aws-mwaa:ferruzzi/callbacks/fix-id-class
Open

Fix CallbackKey type for more accurate type checking#66973
ferruzzi wants to merge 2 commits into
apache:mainfrom
aws-mwaa:ferruzzi/callbacks/fix-id-class

Conversation

@ferruzzi
Copy link
Copy Markdown
Contributor

@ferruzzi ferruzzi commented May 15, 2026

Using a UUID stored as a raw string for the CallbackKey was short-sighted and almost bit us with #62343 also using a raw string for their id. If any future workloads also use a raw string, it would break all sorts of stuff. I'm following my own advice there and making CallbackKey a dataclass. This also lets us tighten up some other type checks where we assume "if it's not a TaskInstanceKey then it must be a CallbackKey".

Added some unit testing, tightened up some existing tests with our new and improved type-checking, and also manually tested by running a Dag with a synchronous deadline callback.

Tangentially related to #63491 but I don't think it'll cause any issues.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@boring-cyborg boring-cyborg Bot added area:Executors-core LocalExecutor & SequentialExecutor area:Scheduler including HA (high availability) scheduler labels May 15, 2026
@ferruzzi ferruzzi requested a review from vincbeck May 15, 2026 00:33
@ferruzzi ferruzzi changed the title Fix CallbackType for more accurate type checking Fix CallbackKey type for more accurate type checking May 15, 2026
@ferruzzi
Copy link
Copy Markdown
Contributor Author

Tagging @dondaum for eyes since you've been doing a lot of work in this area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Executors-core LocalExecutor & SequentialExecutor area:Scheduler including HA (high availability) scheduler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants