shubhamraj-git commented on code in PR #73087:
URL: https://github.com/apache/airflow/pull/73087#discussion_r4084498696
##########
task-sdk/src/airflow/sdk/definitions/dag.py:
##########
@@ -1177,6 +1177,22 @@ def _check_adjacent_tasks(task_id, current_task):
else:
path_stack.append(child_to_check)
+ task_group_dict = self.task_group.get_task_group_dict()
+ for task_group in task_group_dict.values():
+ try:
+ task_group.topological_sort(group_dict=task_group_dict)
Review Comment:
Non-blocking: I found a case where the full Dag passes this validation, but
filtering it still causes Graph and Grid to return HTTP 500.
```python
from airflow.providers.standard.operators.empty import EmptyOperator
from airflow.sdk import DAG, TaskGroup
with DAG("filter_cycle", schedule=None) as dag:
with TaskGroup("g"):
first = EmptyOperator(task_id="first")
second = EmptyOperator(task_id="second")
guard = EmptyOperator(task_id="guard")
guard >> second
bridge = EmptyOperator(task_id="bridge")
first >> bridge >> second
```
Tested in Breeze on `f0677f67705`, using SQLite and the actual FastAPI
routes:
- Parsing and `dag.check_cycle()` succeed; unfiltered Graph and Grid
requests return 200.
- Adding `root=g.first&include_downstream=true` makes both requests return
500. With server exceptions enabled, both raise `ValueError("A cyclic
dependency occurred in dag: ...")`.
Filtering removes `g.guard`, so `g.second` becomes a group root and the
projected dependencies become `g ↔ bridge`. I also executed the same dependency
shape with four PythonOperator tasks: all succeeded, but the filtered requests
still failed afterwards.
A control using the base revision's `DAG.check_cycle()` reproduces the same
failure, so this is pre-existing, not a regression introduced by this PR. Would
you consider this filtered-view case in scope here, or leave it for a separate
follow-up?
---
Drafted-by: Codex (GPT-5); reviewed by @shubhamraj-git before posting
--
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]