[Bug] Compliance violations pagination doesn't show expected results
Summary
When sorting on the compliance violations report the pagination results aren't as expected. For example MERGED_AT_ASC
returns results in the order of 1 day ago
, 2 weeks ago
and then 1 week ago
on the next page.
Steps to reproduce
- Have a GitLab Ultimate license.
- Checkout the branch from this MR !82989 (merged)
- Follow the setup steps in the MR above.
- View the report at
[GDK_HOST]/groups/[GROUP]/-/security/compliance_dashboard
- Sort by
Merged at
and go to the next page and observe the results. - Repeat the last step.
What is the expected correct behavior?
The results should be ordered as expected. For example 1 day ago
, 1 week ago
and 2 weeks ago
.
Possible fixes
Due to how our keyset pagination works we need to update the resolver to use offset pagination for merge request title and merged at sorting.
Implementation plan
backend -
- Update http://gitlab.com/gitlab-org/gitlab/blob/master/ee/app/graphql/resolvers/compliance_management/merge_requests/compliance_violation_resolver.rb to fallback to offset pagination for certain sort options just like http://gitlab.com/gitlab-org/gitlab/blob/8b37e5107af85fc234ab8644bc98587b1cd94ef3/app/graphql/resolvers/base_issues_resolver.rb#L25-25.
- Update specs to make sure it works.
Edited by Robert Hunt