Skip to content

Fix: Handle large PR commit lists - #310

Merged
askb merged 1 commit into
dcoapp:mainfrom
tykeal:fix/large-pull-request-commits
Jul 29, 2026
Merged

askb merged 1 commit into
dcoapp:mainfrom
tykeal:fix/large-pull-request-commits

Conversation

@tykeal

@tykeal tykeal commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Bug

GitHub caps the pull request commits endpoint at 250 commits, and pagination does not lift that cap. For pull requests with more than 250 commits, the app evaluated only the first 250 and reported a verdict as though the entire list had been seen. A commit missing its sign-off beyond position 250 was never examined, so the app could report a passing DCO check for a pull request that does not actually pass. That is a silent false pass on a compliance gate.

Fix

REST pulls.listCommits remains the primary path. When it returns exactly 250 commits, which is the truncation signal, the app escalates to the paginated GraphQL PullRequest.commits connection, which has no 250 cap, and evaluates the complete list. GraphQL commits are mapped into the same shape lib/dco.js already consumes so downstream behavior is unchanged.

Fail-closed guarantee

If a complete, self-consistent commit list cannot be obtained, the app never reports a pass. It rejects a GraphQL totalCount below 250, which would contradict what REST already proved, a totalCount that changes between pages, duplicate commit SHAs, a cursor that does not advance, pagination exceeding the expected page count, and any GraphQL error or partial response. Completeness is validated on the count of unique commit SHAs, not merely the array length.

No new permissions are required; GraphQL uses the existing pull_requests: read permission.

The merge_group / compareCommits path is deliberately unchanged in this PR.

Closes #308

@tykeal
tykeal requested review from a team and Copilot July 29, 2026 19:21
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

@tykeal is attempting to deploy a commit to the DCO App Team on Vercel.

A member of the Team first needs to authorize it.

This comment was marked as outdated.

Escalate pull request commit gathering to GraphQL when the REST
commit list reaches GitHub's 250-commit cap. Validate GraphQL
pagination returns the full commit count before evaluating DCO.

Incomplete lists now fail closed instead of passing silently.

Closes dcoapp#308

Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
Copilot AI review requested due to automatic review settings July 29, 2026 19:30
@tykeal
tykeal force-pushed the fix/large-pull-request-commits branch from 91e6355 to de0c47e Compare July 29, 2026 19:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

test/index.test.js:308

  • This test mocks the REST pulls.listCommits call as returning all 250 commits in a single response. In practice the endpoint is requested with per_page=100, so Octokit’s paginate() will only reach 250 via multiple pages + Link headers. Mocking pagination here would better exercise the real REST->GraphQL escalation trigger and avoid a false-positive test that would still pass even if pagination behavior regressed.
        .get("/repos/robotland/test/pulls/113/commits")
        .query({ per_page: "100" })
        .reply(200, restCommits)

@vercel

vercel Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview Jul 29, 2026 8:20pm

@askb askb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@askb
askb merged commit c05016a into dcoapp:main Jul 29, 2026
7 of 8 checks passed
@tykeal
tykeal deleted the fix/large-pull-request-commits branch July 29, 2026 22:13

This branch was successfully deployed

1 active deployment
Preview — de0c47ef Deployed Jul 29, 2026 by vercel[bot]
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.

Pull requests with more than 250 commits are only partially checked

4 participants