You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "vatsrahul1001 (via GitHub)" <gi...@apache.org> on 2026/08/10 10:23:13 UTC

[PR] Fix 500 when combining last-run and any-run Dag state filters [airflow]

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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix 500 when combining last-run and any-run Dag state filters [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #71366:
URL: https://github.com/apache/airflow/pull/71366#issuecomment-5239352697

   ### Backport successfully created: v3-3-test
   
   Note: As of [Merging PRs targeted for Airflow 3.X](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#merging-prs-targeted-for-airflow-3x)
   the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.
   
   In matter of doubt please ask in [#release-management](https://apache-airflow.slack.com/archives/C03G9H97MM2) Slack channel.
   
   <table>
           <tr>
           <th>Status</th>
           <th>Branch</th>
           <th>Result</th>
       </tr>
       <tr>
           <td>✅</td>
           <td>v3-3-test</td>
           <td><a href="https://github.com/apache/airflow/pull/71371"><img src="https://img.shields.io/badge/PR-71371-blue" alt="PR Link"></a></td>
       </tr>
   </table>


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix 500 when combining last-run and any-run Dag state filters [airflow]

Posted by "vatsrahul1001 (via GitHub)" <gi...@apache.org>.
vatsrahul1001 merged PR #71366:
URL: https://github.com/apache/airflow/pull/71366


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org