Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pushed date loading for PRs with large merges #493

Merged
merged 1 commit into from
Nov 4, 2022

Conversation

bluekeyes
Copy link
Member

When GitHub does not propagate pushed dates to the PR APIs in time, we fall back to the repository commit APIs to load the dates instead. Previously, we stopped iterating through commit history as soon as we loaded enough pages of commits (with 100 commits per page) to account for the number of input commits.

For PRs with large merge commits from the target branch, the commits included by the merge appear in the branch history, but not in the pull request. This caused the loop to exit before listing enough history and return an error claiming commits were missing.

This was usually a temporary error because re-evaluating the PR would find the pushed dates using the PR APIs and not fallback.

To fix this, iterate through commit history until we find all input commits or run out of history on the branch. The commits should always be present, but there may be edge cases that lead to the full listing. I could not think of a way to avoid the full listing without imposing some arbitrary constraint on the size of merges.

When GitHub does not propagate pushed dates to the PR APIs in time, we
fall back to the repository commit APIs to load the dates instead.
Previously, we stopped iterating through commit history as soon as we
loaded enough pages of commits (with 100 commits per page) to account
for the number of input commits.

For PRs with large merge commits from the target branch, the commits
included by the merge appear in the branch history, but not in the pull
request. This caused the loop to exit before listing enough history and
return an error claiming commits were missing.

This was usually a temporary error because re-evaluating the PR would
find the pushed dates using the PR APIs and not fallback.

To fix this, iterate through commit history until we find all input
commits or run out of history on the branch. The commits should always
be present, but there may be edge cases that lead to the full listing. I
could not think of a way to avoid the full listing without imposing some
arbitrary constraint on the size of merges.
@bluekeyes bluekeyes requested a review from a team November 4, 2022 20:58
@bluekeyes bluekeyes merged commit e3f46af into develop Nov 4, 2022
@bluekeyes bluekeyes deleted the bkeyes/fix-merge-pushed-at branch November 4, 2022 22:07
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.

2 participants