Codingaditya17 opened a new pull request, #67550: URL: https://github.com/apache/airflow/pull/67550
## Why `/api/v2/importErrors` can inflate `total_entries` when one import-error file maps to multiple DAGs. The route joins `ParseImportError` with DAG IDs so it can apply per-file authorization and stacktrace redaction. However, `paginated_select()` counts the joined rows before the route groups them back into one import-error object per file. As a result, one `ParseImportError` row can be counted multiple times when the same file contains multiple DAGs. ## What changed This updates the import errors list endpoint to count distinct `ParseImportError.id` values after applying the filename filters, instead of using the raw joined row count. The route still uses the joined statement for fetching rows and authorization/redaction behavior, but `total_entries` now reflects the number of distinct import-error objects returned by the API. ## Tests Added a regression test where one import-error file maps to three DAGs. The API now returns one import-error object and `total_entries` is `1`. Ran: `uv run pytest airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_import_error.py::TestGetImportErrors::test_total_entries_counts_distinct_import_errors_when_file_has_multiple_dags -q` Result: `1 passed, 1 warning` Ran: `uv run pytest airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_import_error.py -q` Result: `32 passed, 1 warning` Ran: `uv run prek run --files airflow-core/src/airflow/api_fastapi/core_api/routes/public/import_error.py airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_import_error.py` Result: mypy and formatting passed locally. `generate-openapi-spec` could not run locally because Docker is not running on my machine. -- 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]
