dgvj-work opened a new pull request, #71458: URL: https://github.com/apache/airflow/pull/71458
Fix `only_new` clear silently missing newly added tasks after a prior `run_on_latest_version` clear. `_get_new_task_ids` previously diffed the latest Dag against `created_dag_version_id`. Clearing a running/queued DagRun with `run_on_latest_version=True` bumps that pointer to latest without creating TaskInstances for tasks added between the original version and latest, so the diff became empty even when tasks were truly missing. This change determines missing tasks from the DagRun's actual TaskInstance rows instead. closes: #71455 ## Testing - `uv run --project airflow-core pytest airflow-core/tests/unit/models/test_cleartasks.py::TestClearTasks::test_clear_only_new_after_partial_run_on_latest_version airflow-core/tests/unit/models/test_cleartasks.py::TestClearTasks::test_clear_only_new_tasks airflow-core/tests/unit/models/test_cleartasks.py::TestClearTasks::test_clear_only_new_tasks_dry_run airflow-core/tests/unit/models/test_cleartasks.py::TestClearTasks::test_clear_only_new_no_new_tasks -q` --- ##### Was generative AI tooling used to co-author this PR? - [ ] Yes (please specify the tool below) --- * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Made with [Cursor](https://cursor.com) -- 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]
