REST: pull request files and compare return 0 additions, deletions and changes for files past a response's diff limit #213491
Replies: 1 comment
|
Thank you for your interest in contributing to our community! We currently only accept discussions created through the GitHub UI using our provided discussion templates. Please re-submit your discussion by navigating to the appropriate category and using the template provided. This discussion has been closed because it was not submitted through the expected format. If you believe this was a mistake, please reach out to the maintainers. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Bug
💬 Feature/Topic Area
API
Body
GET /repos/{owner}/{repo}/pulls/{pull_number}/filesreturns"additions": 0, "deletions": 0, "changes": 0and nopatchfor files that do have changes, once the patches already in the response add up to about 20,000 lines. The same files have correct counts on a smaller page. Nothing in the response marks these rows, so they look like files with no line changes, and summing the list undercounts the pull request.GET /repos/{owner}/{repo}/compare/{basehead}does the same.Seen 2026-11-19 on api.github.com, unauthenticated, with
X-GitHub-Api-Version: 2022-11-28and with2026-03-10(same bodies on both). Same bodies on repeated requests.Reproduce with the public pull request
alchemy-run/distilled1223 (25 files, +11332 -6193):The last 7 rows read
0 0 0 false. Withper_page=5(pages 1 to 5) all 25 rows have counts that matchgit diff --numstatbetween the merge base and head:status: modified)per_page=100andper_page=30per_page=5and gitpackages/aws/src/services/socialmessaging.tspackages/aws/src/services/supplychain.tspackages/aws/src/services/verifiedpermissions.tspackages/dev/src/codegen/cli.tspackages/dev/src/codegen/generator.tspackages/dev/src/codegen/operations.tspackages/dev/test/codegen/generator.test.tsA second case,
python/cpythonpull request 99061 (113 files):per_page=100page 1 returns rows 87 to 100 as 0 / 0 with no patch (for exampleLib/distutils/util.py, 562 deleted lines, andLib/test/test_check_c_globals.py, 5 added). Withper_page=10all 113 rows are correct.Where the cut falls. The
patchstrings before the first zeroed row total 19,742 lines (distilled) and 19,940 lines (cpython), and the next file's patch would take the total past 20,000. Every later row on the page is zeroed too, even files with a 2-line change that would fit. That reads like the 20,000-line pull request diff limit on the "Repository limits" docs page, applied per response; I am inferring that from the two boundaries. Counted changes (16,042 at the distilled cut) and patch bytes (721 KB and 767 KB) do not line up with the cut.The counts are available, they are just dropped:
packages/aws/src/services/datazone.tsin the same pull request (+2698 -2251) loses its patch for its own size, on every page size, but keeps its counts.GET /repos/alchemy-run/distilled/commits/695c288a2cb1537ab2d7b1a3e9bb613b2d54301f(the squash commit, same 25 files) zeroes onlysocialmessaging.tsand returns the 6 later files with correct counts and no patch. Itsstatssays 11332 additions and 6193 deletions, while itsfilessum to 10844 and 5875.Expected:
additions,deletionsandchangesstay correct whenpatchis left out, as they do fordatazone.ts, or the row says it was truncated. The endpoint's docs only mention the 3,000-file cap.All reactions