fix(api): paginate Airflow REST responses past the first page#2174
Open
m1racoli wants to merge 1 commit into
Open
fix(api): paginate Airflow REST responses past the first page#2174m1racoli wants to merge 1 commit into
m1racoli wants to merge 1 commit into
Conversation
The generic pagination path only understood the Astro/Houston envelope (totalCount/limit/offset in the body), so `astro api airflow --paginate --slurp` stopped after the first page (capped at Airflow's default 100 records). The Airflow REST API reports the total under `total_entries` and treats limit/offset as request parameters, not response fields. Teach the pagination layer about both envelopes: read the total from totalCount or total_entries, and derive the page size from the `limit` response field when present, otherwise from the number of items in the page's array field. Extract a shared findArrayField helper so the loop-termination and slurp-combine paths agree on which field holds the records. Fixes #2173 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Coverage Report for CI Build 27659993930Coverage increased (+0.02%) to 45.111%Details
Uncovered Changes
Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The generic
--paginate/--slurppath only understood the Astro/Houston envelope (totalCount/limit/offsetin the response body), soastro api airflow get_dags --paginate --slurpstopped after the first page and capped output at Airflow's default 100 records. This teaches the pagination layer about the Airflow REST envelope too: the total is read fromtotalCountortotal_entries, and the page size is read from thelimitresponse field when present, otherwise derived from the number of items in the page's array field (e.g.dags). A sharedfindArrayFieldhelper now backs both the loop-termination and slurp-combine paths so they agree on which field holds the records.🎟 Issue(s)
Fixes #2173
🧪 Functional Testing
astro api airflow get_dags -d <deployment-id> --paginate --slurp --jq '.dags[].dag_id' | wc -lnow returns the full count (matching.total_entries) instead of capping at 100.go test ./cmd/api/passes, including the newTestExecutePaginatedRequest_AirflowEnveloperegression test (250 DAGs across 3 pages) andTestExtractPageInfotable test; existing Astro-envelope pagination tests still pass.📸 Screenshots
📋 Checklist
make testbefore taking out of draft🤖 Generated with Claude Code