Codingaditya17 commented on issue #67525:
URL: https://github.com/apache/airflow/issues/67525#issuecomment-4544000595

   I opened a PR for this here: https://github.com/apache/airflow/pull/67550
   
   The fix updates `/api/v2/importErrors` so `total_entries` counts distinct 
`ParseImportError.id` values after applying the filename filters, instead of 
counting the raw joined rows from the `ParseImportError` to `DagModel` join.
   
   The route still uses the joined query for fetching rows and preserving the 
existing per-file authorization / stacktrace redaction behavior, but the count 
now matches the number of distinct import-error objects returned by the API.
   
   I also added a regression test for the reported shape: one import-error file 
associated with three DAGs. In that case, the endpoint now returns one 
import-error object and `total_entries` is `1`, instead of being inflated by 
the joined DAG rows.
   
   Local validation:
   
   `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`
   
   `uv run pytest 
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_import_error.py 
-q`  
   Result: `32 passed, 1 warning`
   
   `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]

Reply via email to