fix(review): load GitCode PR files as one bounded response - #2
Closed
bobleer wants to merge 2 commits into
Closed
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.
The review-target path replaced the provider change counts with sums over the first 1,000 mapped files, so a pull request with more changed files than that budget reported a file count equal to the budget and an omitted count of 1. Reuse the shared GitCode change-stats rule, which reads the whole files response, keeps the provider count when it is larger, and already refuses to claim truncated totals. Size the GitCode files request against the documented 3,000-entry single response instead of the pull request detail budget. The 4 MB detail limit turned file lists that previously loaded under the 16 MB default into a hard failure. Co-authored-by: Bob Lee <liwenbo628@gmail.com>
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
Carries the change from GCWing#2463 (
fix(review): load GitCode PR files as one bounded response) plus two review fixes found while reviewing it.From the original commit: GitCode answers
GET /pulls/{number}/fileswith a single response truncated at 3,000 entries, with no usable pagination and no total-count header (theGITCODE_PULL_REQUEST_FILES_RESPONSE_LIMITcontract). The previous code split that endpoint into per-page GitHub-style requests that never paginated, so it re-fetched the same payload for every page and, in the detail Files section, returned the whole list for every page instead of the requested slice.Review fixes added on top:
changed_filesequal to the budget, which madereview_target_from_partscomputeomitted_file_count = 1instead of the real number of dropped files. It now reusesapply_gitcode_pull_request_change_stats, the rule that already reads the whole files response, keeps the provider count when it is larger, and refuses to claim truncated totals.MAX_REVIEW_TARGET_RESPONSE_BYTES(4 MB), the pull request detail budget.send_json_responsealready allowed 16 MB, so file lists between 4 MB and 16 MB that used to load became a hardApierror. The GitCode files request now has its own budget sized against the documented 3,000-entry single response.Fixes #
Type and Areas
Type: bug fix
Areas: Rust services (
bitfun-services-integrations, review-platform provider)Motivation / Impact
GitCode pull requests silently lost files on larger changes, and the detail Files section paged against parameters the provider ignores. After this change:
provider_file_list_incompletelimitation describe what was really left out.gitcode_file_from_valueprefersold_path, infers status from thenew_file/deleted_file/renamed_fileflags, and parses a nestedpatch.diffpayload.Apierror instead of a generic parse failure.GitHub and GitLab flows are untouched. No persisted shape, DTO, Tauri command, or wire protocol changes, so nothing here affects upgrade compatibility or cross-version negotiation.
Verification
Remote scenarios: this is provider HTTP mapping inside a service crate, reached identically from desktop, CLI, mobile web, and dispatch targets. No host-specific API, no new blocking interaction, and no new desktop command, so the remote workspace policy table and the peer-device deny lists are unchanged.
Reviewer Notes
file_page_hintstays in the trait surface for GitHub and GitLab; the GitCode path documents why it cannot use it.patch.diffand flag-based status mapping, truncation-aware pagination that drops the exact total, the oversized-response error text, and a capped review target that still reports 1,500 omitted files out of a 2,500-file pull request.Checklist