Repository navigation
Description
Problem Description
Since #5070, devops gh api <endpoint> --paginate reads a REST GET through the GitHub session. gh adds per_page=100 to a paginated REST read when the endpoint has no per_page (addPerPage in pkg/cmd/api; the installed gh binary holds the symbol github.com/cli/cli/v2/pkg/cmd/api.addPerPage). The session path does not add it. GitHub then sends its default page size of 30. This gives 3 problems:
- A read with no
per_pagesends about 3.3 times more requests than the gh path did. - The
--jqoutput of each page is different from gh's output, because the pages are different. GitHubSession._followraiseslisting_past_page_capafterDEFAULT_GH_MAX_PAGINATED_PAGES(100) pages. At 30 items for each page, a listing of more than 3,000 items now fails withGitHubUnreadError. gh read it in pages of 100. For example,repos/dan-petty/devops-cli/issues?state=allholds about 5,000 items: about 170 pages of 30, but about 51 pages of 100.
In src/devops_cli/github/api_pages.py, listing_text sends session_path(endpoint) with no change, and session_path only adds a leading slash. RestTransport.read_page and SessionGitHubAPI.read_page add no per_page. The module docstring and the github-api-metrics requirement say that the pages print as gh prints them. The tests and the live check of #5070 always give per_page (1 or 100), so they did not find this difference.
Reproduction Steps
- On main at 8a7b113, run
devops gh api 'repos/dan-petty/devops-cli/labels' --paginate --jq length. - Run the same command at 16356d8, before fix(github): count each page of a paginated GitHub read #5070 (the gh path).
Expected vs Actual Behavior
Expected: the session path sends per_page=100 when the endpoint query has no per_page, as gh does. The command prints 95 from 1 request.
Actual: the command prints 30, 30, 30 and 5 from 4 requests. The output with no filter is the same on both paths (95 items).
Fix: in session_path (or listing_text), add per_page=DEFAULT_GH_REST_PER_PAGE when the query has no per_page. Read and write the query with urllib.parse, not with string checks. Add a command test that reads an endpoint with no per_page and asserts that the first request URL holds per_page=100. Add the rule to the requirement "A paginated devops gh api read of a REST GET counts each page".
Environment Diagnostics
devops-cli main at 8a7b113 (2026-11-12), devcontainer, the installed gh binary, jq.py 1.13.0.
Logs, Traces, or Terminal Output
$ devops gh api 'repos/dan-petty/devops-cli/labels' --paginate --jq length # main, session path
30
30
30
5
$ devops gh api 'repos/dan-petty/devops-cli/labels' --paginate --jq length # before #5070, gh path
95
Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Source: #5070
Activity
dan-petty commentedon Nov 12, 2026
A regression from #5070 breaks listings over 3000 items and changes output versus gh.Both deal with per_page=100 in paginated gh api reads, but 228 fixes the page-number substitution loop while this adds per_page to the query string when absent.devops-cli-service commentedon Nov 12, 2026
Released in v0.120.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.120.1
devops-cli-service commentedon Nov 12, 2026
Live since 2026-11-12 17:00 UTC