GayathriSrividya opened a new pull request, #67640:
URL: https://github.com/apache/airflow/pull/67640

   When a single import-error file mapped to N DAGs, \`GET 
/api/v2/importErrors\` returned an inflated \`total_entries\` (N× the real 
count) and incorrect pagination behaviour.
   
   **Root cause**: The query JOINed \`ParseImportError\` with \`file_dags_cte\` 
(one row per DAG per file), producing N rows per import error. 
\`paginated_select\` counted those N rows and applied \`LIMIT\`/\`OFFSET\` 
against joined rows rather than distinct import-error objects.
   
   **Fix**: Two-query approach:
   1. \`dedup_stmt\` with \`.distinct()\` — one row per import error — fed to 
\`paginated_select\` for correct \`total_entries\` and pagination.
   2. \`import_errors_stmt\` — full JOIN restricted to the paginated IDs only — 
used to gather \`dag_id\` associations for auth checks and stacktrace redaction.
   
   **Tests**: Added regression test 
\`test_total_entries_counts_distinct_import_errors_when_file_has_multiple_dags\`
 that creates one \`ParseImportError\` with three associated \`DagModel\` rows 
and asserts \`total_entries == 1\` and the list endpoint returns exactly one 
entry with \`limit=1\`.
   
   closes: #67525
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — GitHub Copilot (Claude Sonnet 4.6)
   
   Generated-by: GitHub Copilot (Claude Sonnet 4.6) 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to