Skip to content

Conversation

@jason810496
Copy link
Member

@jason810496 jason810496 commented Mar 2, 2025

related: #42360

What

I have added the requires_access_dag dependency for the Import Error endpoints as well.

However, the implementation still depends on the ongoing discussion in #47062 (comment). ( I'm not sure if such granularity is needed for the Simple Auth Manager. If it is, I will add the necessary logic for get_readable_dags as well. )

For reference, here are the Import Error implementations in the Legacy API:
https://github.com/apache/airflow/blob/v2-10-test/airflow/api_connexion/endpoints/import_error_endpoint.py

Update:
Yes, we should respect readable_dag_ids, so this PR is still depends on AIP-84 | Add Auth for Dags #47433 as it introduce ReadableDagsFilterDep.

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Mar 2, 2025
@jedcunningham jedcunningham added the AIP-84 Modern Rest API label Mar 4, 2025
@jason810496 jason810496 force-pushed the feature/AIP-84/auth/import_error branch from 98c6342 to 06de40c Compare March 11, 2025 02:57
@jason810496 jason810496 marked this pull request as ready for review March 11, 2025 02:57
@Lee-W
Copy link
Member

Lee-W commented Mar 11, 2025

@jason810496 looks like the on-going discussion has been resolved. Could you please confirm? if that's the case, let's update the description 🙂

@jason810496
Copy link
Member Author

@jason810496 looks like the on-going discussion has been resolved. Could you please confirm? if that's the case, let's update the description 🙂

Oh yes, the discussion I mentioned has been resolved.
However, this PR is still depends on AIP-84 | Add Auth for Dags #47433
( as it introduce ReadableDagsFilterDep ), I will update the description of this PR.
Thanks for the reminder !

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, need the dagId filter indeed.

@jason810496 jason810496 marked this pull request as draft March 11, 2025 10:12
@Lee-W Lee-W force-pushed the feature/AIP-84/auth/import_error branch from 06de40c to 8de5122 Compare March 11, 2025 14:40
@Lee-W
Copy link
Member

Lee-W commented Mar 11, 2025

just rebase with the latest main, we should be able to use ReadableDagsFilterDep now

@Lee-W Lee-W force-pushed the feature/AIP-84/auth/import_error branch from 8de5122 to 53d25ff Compare March 13, 2025 09:41
@Lee-W
Copy link
Member

Lee-W commented Mar 13, 2025

Hey @jason810496 , just rebased and resolved conflicts. will you have some bandwidth to wrap it up? if not, I'll take a look tomorrow. Thanks!

@jason810496
Copy link
Member Author

Hey @jason810496 , just rebased and resolved conflicts. will you have some bandwidth to wrap it up? if not, I'll take a look tomorrow. Thanks!

I might not be able to do it today, but I will be available tomorrow to work on it.

I will ping you before I start working on it!

@Lee-W
Copy link
Member

Lee-W commented Mar 13, 2025

No worries. Just want to ensure we don’t work on the same thing. Will comment before I start working on it as well 🙂

@jason810496
Copy link
Member Author

Hi @Lee-W I start working on it.

@jason810496 jason810496 force-pushed the feature/AIP-84/auth/import_error branch from 53d25ff to ada4066 Compare March 14, 2025 04:14
@jason810496 jason810496 marked this pull request as ready for review March 14, 2025 06:52
@Lee-W Lee-W force-pushed the feature/AIP-84/auth/import_error branch from bdc8188 to cd4e2db Compare March 14, 2025 08:06
@Lee-W Lee-W force-pushed the feature/AIP-84/auth/import_error branch from cd4e2db to 3a30770 Compare March 14, 2025 09:50
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, just a few suggestions, but looking good.

@jason810496 jason810496 force-pushed the feature/AIP-84/auth/import_error branch from 3a30770 to 98c11f2 Compare March 16, 2025 05:53
@jason810496
Copy link
Member Author

Thanks @Lee-W and @pierrejeambrun for the review, I just resolved all comments and refactored the logic in router and the test as well.

Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a quick review. The test is failing. I'll try to fix it later today if it hasn't been addressed yet. Thanks!

@Lee-W Lee-W force-pushed the feature/AIP-84/auth/import_error branch 3 times, most recently from 2d852fb to d30e259 Compare March 17, 2025 11:14
jason810496 and others added 10 commits March 17, 2025 19:51
- Remove requires_access_dag depends
- Refactor get_file_dag_ids helper
- Rename get_permitted_dag_ids to get_authorized_dag_ids
- Refactor get_import_errors
    - Early return if the user has access to all DAGs
    - Add subquery to get corresponding file_dag_ids for each fileloc in single query
- Make test more readable by adding separate comment
- Add set auth_manager attribute helper
- Refactor test setup
@Lee-W Lee-W force-pushed the feature/AIP-84/auth/import_error branch 2 times, most recently from bbc3c17 to 4cf5554 Compare March 17, 2025 12:04
@Lee-W Lee-W force-pushed the feature/AIP-84/auth/import_error branch from 4cf5554 to 0741dab Compare March 17, 2025 12:09
@pierrejeambrun pierrejeambrun merged commit 2bc6f09 into apache:main Mar 17, 2025
89 checks passed
@jason810496
Copy link
Member Author

Thanks @Lee-W for the final test refactor !

agupta01 pushed a commit to agupta01/airflow that referenced this pull request Mar 21, 2025
* AIP-84 | Add Auth for Import Error

* fix: remove outdated requires_access_view

* Add permitted dags with import_error

* Add test for import error

* Refactor import_error
- Remove requires_access_dag depends
- Refactor get_file_dag_ids helper
- Rename get_permitted_dag_ids to get_authorized_dag_ids
- Refactor get_import_errors
    - Early return if the user has access to all DAGs
    - Add subquery to get corresponding file_dag_ids for each fileloc in single query

* Refactor test_import_error
- Make test more readable by adding separate comment
- Add set auth_manager attribute helper
- Refactor test setup

* Remove get_file_dag_ids helper

* Remove 403 in api doc, early return for get_import_error router

* feat(import_error): rewrite groupby logic as array_agg is only supported in pg

* test(api_fastapi): refactor test cases

* style: fix type checking

---------

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
nailo2c pushed a commit to nailo2c/airflow that referenced this pull request Apr 4, 2025
* AIP-84 | Add Auth for Import Error

* fix: remove outdated requires_access_view

* Add permitted dags with import_error

* Add test for import error

* Refactor import_error
- Remove requires_access_dag depends
- Refactor get_file_dag_ids helper
- Rename get_permitted_dag_ids to get_authorized_dag_ids
- Refactor get_import_errors
    - Early return if the user has access to all DAGs
    - Add subquery to get corresponding file_dag_ids for each fileloc in single query

* Refactor test_import_error
- Make test more readable by adding separate comment
- Add set auth_manager attribute helper
- Refactor test setup

* Remove get_file_dag_ids helper

* Remove 403 in api doc, early return for get_import_error router

* feat(import_error): rewrite groupby logic as array_agg is only supported in pg

* test(api_fastapi): refactor test cases

* style: fix type checking

---------

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AIP-84 Modern Rest API area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants