Repository navigation
fix(gitlab): preserve MR pagination when totals are missing - #34171
Conversation
When total headers are absent, a full response advertises another page to probe and a short response ends pagination. Keep the existing header precedence and unknown total count. Tracked in #33800
|
No actionable comments were generated in the recent review.
|
|
GitLab can return a full merge-request page without either total header. Orca treated the missing total as zero and reported one page, so API consumers could stop early. The MR list now advertises one more page after a full response and stops after a short or empty response. Valid total headers keep their existing precedence, and the result shape is unchanged. Current desktop/mobile Tasks and search screens still request page 1 and ignore this metadata. This PR corrects the API result; it does not add later-page browsing to those screens. Full-path correctness, consumer, architecture, final readiness and performance checks found no production defects or negative user-facing trade-offs. Consumer verification was added to existing test harnesses. CI caught a double cast in a touched RPC fixture; it was replaced with typed runtime fixtures and spies. No production findings were deferred. The contributor-authored fix remains intact. Verified: direct MR regression (failed against main), full/short/empty pages and authoritative-header precedence; combined-list metadata; IPC/RPC/web/owner forwarding; desktop Tasks and workspace-search rows; Cmd-J; mobile search/schema and mounted Tasks rows, refresh errors and page-1-only requests. Named local tests passed through tc-gate, and final CI passed on For Brennan's review: missing-total fallback and combined-list contract. The common exhaustion rule is adapted to the existing numeric paging contract; retaining exact header precedence is intended for API compatibility. |
GitLab sometimes returns a full page of merge requests without either total header. Orca treated the missing total as zero and reported exactly one page, even when more results could exist. The MR listing API now advertises one more page to probe after a full response and stops after a short or empty response, matching the existing issue-list and local CLI fallback rule.
Known totals retain their existing precedence:
x-total-pages, thenx-total. An unknowntotalCountremains zero and the response shape stays unchanged. The common pattern uses observed page exhaustion; retaining our existing page-count contract is intended for compatibility with current IPC/RPC callers.Reachability: this corrects API pagination metadata; no reachable shipped UI was found that uses this MR
totalPagesvalue to advance pages. Desktop Tasks (use-task-page-gitlab-loading.ts) requests page 1 with 50 items and discards the count; its MR list has no pager. Desktop workspace search and Cmd-J also request page 1 and consume items only. Mobile Tasks and workspace search callgitlab.listWorkItemswith page 1 and consume items only. The combined list forwards the MR page count. Desktop IPC (gitlab:listMRs) and paired-server RPC (gitlab.listMRs,gitlab.listWorkItems) expose the corrected metadata, and the web bridge forwards it. No GitLab MR-list command or pagination reader was found in the CLI. This PR does not enable browsing beyond the first page in those screens.Verification: the new missing-total regression failed against main (full page 3 expected
totalPages: 4, received1) and now passes. Coverage includes full first/later pages, short/empty exhaustion, unknown count, total-count fallback and page-header precedence. The full review added consumer assertions in existing harnesses for combined lists, IPC/RPC/web forwarding, desktop Tasks/search, Cmd-J, mobile search and mounted mobile Tasks. The mounted mobile file passed all 19 tests in Mobile verify. Final CI is green on37e1ce9b99d, including static analysis/typechecking, unit shards, mobile bundle and Linux/Windows packaging. Full correctness, architecture, consumer, readiness and performance reviews found no production defect or negative user-facing trade-off. Tests-only QA applies; no running-app check or screenshot is required for unchanged screens.Review path: full.
Builds on #33801 by @Hotragn — thank you! The contributor's fix and regression were cherry-picked with authorship preserved; the regression was extended with first-page, empty-page, and header-precedence controls.
Tracked in #33800
Tracked in STA-12217