You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "shubhamraj-git (via GitHub)" <gi...@apache.org> on 2026/02/16 19:40:11 UTC
[PR] Add readable dags checks for the dependencies endpoint [airflow]
shubhamraj-git opened a new pull request, #62046:
URL: https://github.com/apache/airflow/pull/62046
The dependencies endpoint returns the full Dag dependency graph without filtering by authorized Dag. This will add the filter to get the result based upon the authorized Dags.
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull request.
Write a good git commit message following this guide: http://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the documentation.
Feel free to ping (in general) for the review if you do not see reaction for a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR, please
change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
-->
- [ ] Yes (please specify the tool below)
<!--
Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
---
* Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment: `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
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] Add readable dags checks for the dependencies endpoint [airflow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #62046:
URL: https://github.com/apache/airflow/pull/62046#issuecomment-3921047742
### Backport failed to create: v3-1-test. View the failure log <a href='https://github.com/apache/airflow/actions/runs/22143072980'> Run details </a>
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-1-test</td>
<td><a href="https://github.com/apache/airflow/commit/9d7b2a1c19ef4adce9e9aadd1f7a036794f4483e"><img src='https://img.shields.io/badge/Commit-9d7b2a1-red' alt='Commit Link'></a></td>
</tr>
</table>
You can attempt to backport this manually by running:
```bash
cherry_picker 9d7b2a1 v3-1-test
```
This should apply the commit to the v3-1-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.
After you have resolved the conflicts, you can continue the backport process by running:
```bash
cherry_picker --continue
```
If you don't have cherry-picker installed, see the [installation guide](https://github.com/apache/airflow/blob/main/dev/README_AIRFLOW3_DEV.md#how-to-backport-pr-with-cherry-picker-cli).
--
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] Add readable dags checks for the dependencies endpoint [airflow]
Posted by "shubhamraj-git (via GitHub)" <gi...@apache.org>.
shubhamraj-git commented on code in PR #62046:
URL: https://github.com/apache/airflow/pull/62046#discussion_r2816742258
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dependencies.py:
##########
@@ -48,10 +49,14 @@
)
def get_dependencies(
session: SessionDep,
+ user: GetUserDep,
node_id: str | None = None,
dependency_type: Literal["scheduling", "data"] = "scheduling",
) -> BaseGraphResponse:
"""Dependencies graph."""
+ auth_manager = get_auth_manager()
Review Comment:
Sure, thats a better way to do.
--
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] Add readable dags checks for the dependencies endpoint [airflow]
Posted by "shubhamraj-git (via GitHub)" <gi...@apache.org>.
shubhamraj-git commented on code in PR #62046:
URL: https://github.com/apache/airflow/pull/62046#discussion_r2818426050
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_dependencies.py:
##########
@@ -258,7 +258,7 @@ def test_with_node_id_filter_with_asset(
(asset1_id, expected_primary_component_response),
(asset2_id, expected_secondary_component_response),
):
- with assert_queries_count(5):
+ with assert_queries_count(6):
Review Comment:
Makes sense, let me add it.
--
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] Add readable dags checks for the dependencies endpoint [airflow]
Posted by "shubhamraj-git (via GitHub)" <gi...@apache.org>.
shubhamraj-git commented on PR #62046:
URL: https://github.com/apache/airflow/pull/62046#issuecomment-3921040792
Thank you @pierrejeambrun @vincbeck @Srabasti for your reviews!
--
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] Add readable dags checks for the dependencies endpoint [airflow]
Posted by "shubhamraj-git (via GitHub)" <gi...@apache.org>.
shubhamraj-git commented on code in PR #62046:
URL: https://github.com/apache/airflow/pull/62046#discussion_r2818423432
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dependencies.py:
##########
@@ -48,10 +48,14 @@
)
def get_dependencies(
session: SessionDep,
+ user: GetUserDep,
+ auth_manager: AuthManagerDep,
node_id: str | None = None,
dependency_type: Literal["scheduling", "data"] = "scheduling",
) -> BaseGraphResponse:
"""Dependencies graph."""
+ readable_dag_ids = auth_manager.get_authorized_dag_ids(method="GET", user=user)
Review Comment:
Sure
--
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] Add readable dags checks for the dependencies endpoint [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #62046:
URL: https://github.com/apache/airflow/pull/62046#discussion_r2817436098
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dependencies.py:
##########
@@ -48,10 +48,14 @@
)
def get_dependencies(
session: SessionDep,
+ user: GetUserDep,
+ auth_manager: AuthManagerDep,
node_id: str | None = None,
dependency_type: Literal["scheduling", "data"] = "scheduling",
) -> BaseGraphResponse:
"""Dependencies graph."""
+ readable_dag_ids = auth_manager.get_authorized_dag_ids(method="GET", user=user)
Review Comment:
Can you use the dependency `ReadableDagsFilterDep` instead.
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_dependencies.py:
##########
@@ -258,7 +258,7 @@ def test_with_node_id_filter_with_asset(
(asset1_id, expected_primary_component_response),
(asset2_id, expected_secondary_component_response),
):
- with assert_queries_count(5):
+ with assert_queries_count(6):
Review Comment:
We need an extra test, where we mock the `auth_manager.get_authorized_dag_ids` to return only some dag ids and verify that the response doesn't contain unwanted nodes or edges.
--
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] Add readable dags checks for the dependencies endpoint [airflow]
Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on code in PR #62046:
URL: https://github.com/apache/airflow/pull/62046#discussion_r2817436098
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dependencies.py:
##########
@@ -48,10 +48,14 @@
)
def get_dependencies(
session: SessionDep,
+ user: GetUserDep,
+ auth_manager: AuthManagerDep,
node_id: str | None = None,
dependency_type: Literal["scheduling", "data"] = "scheduling",
) -> BaseGraphResponse:
"""Dependencies graph."""
+ readable_dag_ids = auth_manager.get_authorized_dag_ids(method="GET", user=user)
Review Comment:
Can you use the dependency `readable_dags_filter: ReadableDagsFilterDep,` instead. then `readable_dags_filter.values` will give you the dag ids.
--
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] Add readable dags checks for the dependencies endpoint [airflow]
Posted by "vincbeck (via GitHub)" <gi...@apache.org>.
vincbeck commented on code in PR #62046:
URL: https://github.com/apache/airflow/pull/62046#discussion_r2814163648
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/dependencies.py:
##########
@@ -48,10 +49,14 @@
)
def get_dependencies(
session: SessionDep,
+ user: GetUserDep,
node_id: str | None = None,
dependency_type: Literal["scheduling", "data"] = "scheduling",
) -> BaseGraphResponse:
"""Dependencies graph."""
+ auth_manager = get_auth_manager()
Review Comment:
You can also use `AuthManagerDep` to get the auth manager
--
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] Add readable dags checks for the dependencies endpoint [airflow]
Posted by "shubhamraj-git (via GitHub)" <gi...@apache.org>.
shubhamraj-git merged PR #62046:
URL: https://github.com/apache/airflow/pull/62046
--
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