Merge Request and Commit pipeline endpoints return the incorrect total count

Summary

Merge request pipelines and commit pipelines JSON endpoints do not return the proper count of total items across all pages.

Steps to reproduce

Merge Request Pipelines endpoint (https://gitlab.com/gitlab-org/gitlab/-/merge_requests/63777/pipelines.json?per_page=2) returns 2 items per page, with a total number of 9 pipelines. It returns the correct count with page 1 (default), but returns 0 for the 2nd page (https://gitlab.com/gitlab-org/gitlab/-/merge_requests/63777/pipelines.json?per_page=2&page=2).

Page 1 Page 2
Screenshot_2021-06-23_at_10.59.55 Screenshot_2021-06-23_at_11.00.14

A similar problem exists for a commit's pipelines endpoint (https://gitlab.com/gitlab-org/gitlab/-/commit/1c82f017bc4d1e58c747274b2dd39e423ff9220a/pipelines.json) although I didn't manage to find a commit with several pipelines to demonstrate it.

Unlike these two endpoints the https://gitlab.com/gitlab-org/gitlab/-/pipelines.json?per_page=2 returns a correct count.

Page 1 Page 2
Screenshot_2021-06-23_at_11.04.05 Screenshot_2021-06-23_at_11.04.23

Example Project

What is the current bug behavior?

The total count does not persist across different pages.

What is the expected correct behavior?

The total count should be the same across all the pages and should return the count of all (unpaginated) items.

Possible fixes

Change MR pipelines and Commit pipelines implementation to return the correct total counts, similar to Pipelines endpoint.

Edited Jun 23, 2021 by Vitali Tatarintev
Assignee Loading
Time tracking Loading