GraphQL ExternallyPaginatedArrayExtension with `First/Last` query parameters don't give correct counts
Summary
Some graphQL endpoints don't properly show the counts when combined with first/last
query parameters.
These endpoints use non-standard keyset/offset pagination, for example ExternallyPaginatedArrayExtension
that won't work well with counting.
This is made even weirder as count(limit: 2)
can take in a limit argument... and does some more funky stuff
Steps to reproduce
https://gitlab.com/-/graphql-explorer
{
package(id: "gid://gitlab/Packages::Package/25063456") {
pipelines(first: 0) {
count
}
}
}
Example Project
What is the current bug behavior?
The count returned 0. This is being limited by the first
argument. It's much more prominent if you can find a package that has multiple pipelines. The first
argument value will always be the max count.
What is the expected correct behavior?
The count should not change from the query params.
For example, pipeline_schedules. The count is 5 regardless of the param
{
project(fullPath: "gitlab-org/gitlab"){
pipelineSchedules(first: 1) {
count
}
}
}
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: \\\`sudo gitlab-rake gitlab:env:info\\\`) (For installations from source run and paste the output of: \\\`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production\\\`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of: \`sudo gitlab-rake gitlab:check SANITIZE=true\`) (For installations from source run and paste the output of: \`sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true\`) (we will only investigate if the tests are passing)
Possible fixes
Edited by Max Fan