vatsrahul1001 opened a new pull request, #71366:
URL: https://github.com/apache/airflow/pull/71366

   The Dags list supports two run-state filters: `last_dag_run_state` (the 
Dag's latest run is in the state) and `dag_run_state` (the Dag has any run in 
the state). Applying both at once (e.g. `failed` + `failed`) returned a **500** 
instead of the intersection.
   
   **Cause:** the any-run filter (`_AnyDagRunStateFilter`) built its `EXISTS` 
subquery with an un-aliased `DagRun`. When the outer query also references 
`DagRun` (the `last_dag_run_state` filter adds `WHERE DagRun.state == …`), 
SQLAlchemy auto-correlates the subquery's `DagRun` to the outer one, stripping 
the subquery's FROM and raising `InvalidRequestError` -> 500. Each filter alone 
worked, which is why it slipped through.
   
   **Fix:** alias `DagRun` in the subquery so it resolves its own runs 
independently of the outer query. The combined filter now returns the 
intersection.
   
   Added a regression test covering the combined case (the existing tests only 
exercised each filter separately).
   
   The any-run-state filter is new (related: #70292, #70293), so this needs to 
ride along to 3.3.1 via the backport label.
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 4.8)
   
   Generated-by: Claude Code (Opus 4.8) following [the 
guidelines](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]

Reply via email to