Fix DagRun.get_task_instances state type hint to accept a single state#67654
Open
bmaquet wants to merge 5 commits into
Open
Fix DagRun.get_task_instances state type hint to accept a single state#67654bmaquet wants to merge 5 commits into
bmaquet wants to merge 5 commits into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
jscheffl
approved these changes
Jun 2, 2026
Contributor
jscheffl
left a comment
There was a problem hiding this comment.
Looks reasonable as the logic was handling. As it is an interface/public API change would like to have another pair of eyes on this but see no harm in merging.
Author
|
It seems another PR to fix this issue was created after mine (#67880) and was merged before this one. I believe we can close this one then. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DagRun.get_task_instancesandDagRun.fetch_task_instancesalready accept a singleTaskInstanceStateat runtime via theisinstance(state, str)branch (Airflow's state enums inherit fromstr), but the type hint only declaresIterable[TaskInstanceState | None] | None.TaskInstanceState | Iterable[TaskInstanceState | None] | Noneto match existing runtime behavior. No behavior change.test_dagrun.pyto validateget_task_instancesaccepts either an iterable or a single instance ofTaskInstanceStateTest Plan
prek run mypy-airflow-core --files airflow-core/src/airflow/models/dagrun.pyuv run --project airflow-core pytest airflow-core/tests/unit/models/test_dagrun.py -xvscloses: #67653
Was generative AI tooling used to co-author this PR?
claude
{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.