Skip to content

fix(api): paginate Airflow REST responses past the first page#2174

Open
m1racoli wants to merge 1 commit into
mainfrom
m1racoli/fix-issue-2173
Open

fix(api): paginate Airflow REST responses past the first page#2174
m1racoli wants to merge 1 commit into
mainfrom
m1racoli/fix-issue-2173

Conversation

@m1racoli

@m1racoli m1racoli commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Description

The generic --paginate/--slurp path only understood the Astro/Houston envelope (totalCount/limit/offset in the response body), so astro api airflow get_dags --paginate --slurp stopped 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 from totalCount or total_entries, and the page size is read from the limit response field when present, otherwise derived from the number of items in the page's array field (e.g. dags). A shared findArrayField helper 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 -l now returns the full count (matching .total_entries) instead of capping at 100.
  • go test ./cmd/api/ passes, including the new TestExecutePaginatedRequest_AirflowEnvelope regression test (250 DAGs across 3 pages) and TestExtractPageInfo table test; existing Astro-envelope pagination tests still pass.

📸 Screenshots

N/A — CLI behavior change.

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Ran make test before taking out of draft
  • Added/updated applicable tests

🤖 Generated with Claude Code

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>
@m1racoli m1racoli requested a review from a team as a code owner June 17, 2026 01:39
@coveralls-official

Copy link
Copy Markdown

Coverage Report for CI Build 27659993930

Coverage increased (+0.02%) to 45.111%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: 1 uncovered change across 1 file (44 of 45 lines covered, 97.78%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
cmd/api/request.go 45 44 97.78%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
cmd/api/request.go 1 89.28%

Coverage Stats

Coverage Status
Relevant Lines: 56388
Covered Lines: 25437
Line Coverage: 45.11%
Coverage Strength: 8.0 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

astro api airflow --paginate --slurp stops after first page (caps at 100 records)

1 participant