fix(review): load GitCode PR files as one bounded response - #2463
Merged
Conversation
GitCode returns pull request files as a single response truncated at 3,000 entries without pagination or a total header. Replace the per-page fetch for review targets, file diffs, and the detail Files section with one bounded request, slice pages client-side, and avoid claiming an exact total when the response is truncated. Also prefer old_path and new_file/deleted_file/renamed_file flags when mapping files, and accept a nested patch.diff payload.
3 tasks
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GitCode returns
GET /pulls/{number}/filesas a single response that is truncated at 3,000 entries, with no usable pagination and no total-count header (see theGITCODE_PULL_REQUEST_FILES_RESPONSE_LIMITcontract). The previous code split this endpoint into per-page GitHub-style requests that never paginated effectively, silently losing files on larger PRs.Changes
gitcode_review_target_parts/gitcode_review_file_parts: replace the per-page bounded fetch with a single bounded request (4 MB), keep the 1,000-item review-target cap, and apply file-derived change stats to the pull request.gitcode_files_pagination+slice_page), and stop claiming an exact total when the response is at the truncation limit.gitcode_file_from_value: preferold_path, infer status fromnew_file/deleted_file/renamed_fileflags, and parse a nestedpatch.diffpayload.Apierror instead of a generic parse failure.Notes
file_page_hintis retained in the trait surface but is no longer used by the GitCode path.