merge_requests (v4) api endpoint missing entries when using approver_ids parameters
Summary
When using the approver_ids[]=...
parameter on the merge_requests (v4) api endpoint, not all expected results are returned.
Steps to reproduce
I made a call to https://gitlab.com/api/v4/merge_requests?scope=all&state=opened&search=rerun%20ui%20diff&per_page=100&page=1
and received 3 results, one if which is a MR with id 34758940.
I then made a call to https://gitlab.com/api/v4/merge_requests?scope=all&state=opened&search=rerun%20ui%20diff&approver_ids[]=3495269&per_page=100&page=1
and got zero results (3495269 is my user id).
If I make a call to https://gitlab.com/api/v4/merge_requests?scope=all&state=opened&approver_ids[]=3495269&per_page=100&page=1
, I currently get 27 results, and 34758940 is not one of them.
I verified that I am an approver on MR 34758940, and am listed in this call https://gitlab.com/api/v4/projects/13330622/merge_requests/6/approvals
in both the approved_by list and the approvers list.
I also verified in the website that I am a member of that project (owner), and also listed as a required approver on that MR.
What is the current bug behavior?
A call to https://gitlab.com/api/v4/merge_requests?scope=all&state=opened&approver_ids[]=3495269&per_page=100&page=1
is missing an entry for some MRs that I'm an approver on (MR id 34758940 for example).
What is the expected correct behavior?
A call to https://gitlab.com/api/v4/merge_requests?scope=all&state=opened&approver_ids[]=3495269&per_page=100&page=1
should list all MRs that I'm an approver on (up to 100).
Relevant logs and/or screenshots
Thu 08-22 14:11:38 :~
> echo $GITLAB_USER_ID
3495269
Thu 08-22 14:11:42 :~
> mrs_page_uid=$( curl -s --header "PRIVATE-TOKEN: $GITLAB_PRIVATE_TOKEN" "https://gitlab.com/api/v4/merge_requests?scope=all&state=opened&approver_ids\[\]=$GITLAB_USER_ID&per_page=100&page=1") && echo -E "$mrs_page_uid" | jq ' .[] | .id ' | grep --silent "34758940" && echo "34758940 is in the list."
Thu 08-22 14:11:52 :~
> mrs_page_search=$( curl -s --header "PRIVATE-TOKEN: $GITLAB_PRIVATE_TOKEN" "https://gitlab.com/api/v4/merge_requests?scope=all&state=opened&search=rerun%20ui%20diff&per_page=100&page=1") && echo -E "$mrs_page_search" | jq ' .[] | .id ' | grep --silent "34758940" && echo "34758940 is in the list."
34758940 is in the list.
Thu 08-22 14:12:03 :~
> mr_project_id=$( echo -E "$mrs_page_search" | jq ' .[] | select( .id == 34758940 ) | .project_id ' ) && echo "$mr_project_id"
13330622
Thu 08-22 14:12:10 :~
> mr_iid=$( echo -E "$mrs_page_search" | jq ' .[] | select( .id == 34758940 ) | .iid ' ) && echo "$mr_iid"
6
Thu 08-22 14:12:19 :~
> mr_approvals=$( curl -s --header "PRIVATE-TOKEN: $GITLAB_PRIVATE_TOKEN" "https://gitlab.com/api/v4/projects/$mr_project_id/merge_requests/$mr_iid/approvals" )
Thu 08-22 14:12:27 :~
> echo -E "$mr_approvals" | jq ' .approved_by[] | select( .user.id == 3495269 ) | "approved_by: " + (.user.id | tostring) '
"approved_by: 3495269"
Thu 08-22 14:12:36 :~
> echo -E "$mr_approvals" | jq ' .approvers[] | select( .user.id == 3495269 ) | "approver: " + ( .user.id | tostring ) '
"approver: 3495269"
Thu 08-22 14:12:42 :~
> echo -E "$mr_approvals" | jq ' .suggested_approvers[] | select( .id == 3495269 ) | "suggested approver: " + (.user.id | tostring) '
Thu 08-22 14:12:48 :~
> echo -E "$mr_approvals" | jq ' .approvers | "There are " + ( length | tostring ) + " approver(s)" '
"There are 1 approver(s)"
Thu 08-22 14:12:53 :~
> echo -E "$mr_approvals" | jq ' .approved_by | "Approved by " + ( length | tostring ) + " user(s)" '
"Approved by 6 user(s)"
Thu 08-22 14:12:59 :~
> echo -E "$mr_approvals" | jq ' .suggested_approvers | "There are " + ( length | tostring ) + " suggested approver(s)" '
"There are 5 suggested approver(s)"
Thu 08-22 14:13:03 :~
>
Output of checks
This bug happens on GitLab.com.