Skip to content

List workItems at the group level MVC 1

Mario Celi requested to merge 392812-list-namespace-work-items into master

What does this MR do and why?

We are allowing work_items/issues to be associated directly with groups. In the past, an issue would always be associated with a project.

This first iteration allows listing work items that are directly associated with a group. Currently no issues from that group's hierarchy are fetched, that will be worked on in later iterations.

Using a separate work items finder since changing the one we already have for project level issues might be affected by this changes. When this new query and finder reach parity with the project level work item finder, we will be able to merge them into a single finder.

New query behind the namespace_level_work_items feature flag

Database review

Query plans

https://console.postgres.ai/shared/3d0b1b0e-f34d-4645-9f58-dbbaa179a510

We can already create namespace level issues in .com, but there is no way to fetch them right now. For this reason the query returns no rows. I can see the query plan is not great, but I would prefer to add the appropriate indexes in the next iteration (query still behind a feature flag). This first MVC will allow us to integrate with the frontend and test this feature, but the intention is to fetch issues from the entire namespace hierarchy (now issues also belong to a project namespace). For this reason I would like to have a more defined version of how the final query will look, before we add indexes.

Test locally

Currently we won't have work items created at the group level, but we can create some for testing using the following GraphQL query

  1. Feature.enable(:namespace_level_work_items) in the rails console.
mutation {
  workItemCreate(input:{namespacePath: "flightjs", title: "test namespace", workItemTypeId: "gid://gitlab/WorkItems::Type/1"}) {
    workItem {
      title
      id
    }
    errors
  }
}

Then, to fetch work items at the group level you can use the following query

{
  group(fullPath: "flightjs") {
    workItems {
      nodes {
        id
        title
      }
    }
  }
}

Note: If you are using the root account you will get ALL the issues in the response since that's how the finder behaves

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #392812 (closed)

Edited by Mario Celi

Merge request reports