Workspace query broken for filtering userIDs
MR: Pending
Description
The GraphQL query for filtering workspaces based on userID is broken because it is defined incorrectly as project id in our GraphQL definitions - https://gitlab.com/gitlab-org/gitlab/-/blob/cfad2a8f224c324eeac2edc2201d7663ca9db81b/ee/app/graphql/resolvers/remote_development/workspaces_for_query_root_resolver.rb#L22
Steps to reproduce
GraphQL Query to get current user's ID
query currentUser {
currentUser {
id
}
}
GraphQL Query to get workspaces of particular user
query workspaces {
workspaces(userIds: ["gid://gitlab/User/10764887"]) {
nodes {
id
name
namespace
url
desiredState
actualState
editor
maxHoursBeforeTermination
devfile
deploymentResourceVersion
projectId
clusterAgent {
clusterAgentId: id
name
}
user {
id
}
}
}
}
Expected a list of workspaces created by the user but it returns the following error -
{
"errors": [
{
"message": "\"gid://gitlab/User/10764887\" does not represent an instance of Project",
"locations": [
{
"line": 40,
"column": 3
}
],
"path": [
"query workspaces",
"workspaces",
"userIds"
],
"extensions": {
"code": "argumentLiteralsIncompatible",
"typeName": "CoercionError"
}
}
]
}
Implementation plan
- Update https://gitlab.com/gitlab-org/gitlab/-/blob/cfad2a8f224c324eeac2edc2201d7663ca9db81b/ee/app/graphql/resolvers/remote_development/workspaces_for_query_root_resolver.rb#L22 to
argument :user_ids, [::Types::GlobalIDType[User]]
- Update GraphQL documentation and schema definitions - https://docs.gitlab.com/ee/development/rake_tasks.html#update-graphql-documentation-and-schema-definitions by running
bundle exec rake gitlab:graphql:update_all
Acceptance Criteria
-
The above GraphQL query should work
Edited by Vishal Tak