Update adminGroups GraphQL endpoint to return project statistics

Problem

When the adminGroups GraphQL endpoint was introduced in !202896 (merged), the projectStatistics sub-field was not properly returned. This occurred because the lookahead functionality in ResolvesGroups didn't handle queries with inline fragments (e.g. nodes { ... on Group { projectStatistics } }).

Solution

This MR updates the ResolvesGroup module to properly handle inline fragments by adding the selected_type: ::Types::GroupType argument to the .selects?(:project_statistics) call.

Changes

  • Updates the lookahead functionality in ResolvesGroups to correctly detect when projectStatistics is requested in inline fragments
  • Ensures the adminGroups GraphQL endpoint returns complete project statistics data
  • Adds tests to verify the functionality works as expected

References

Allow read-only access to `Admin Area > Project... (#557844 - closed)

Screenshots or screen recordings

Before After
Screenshot_2025-09-11_at_4.49.15_PM Screenshot_2025-09-11_at_4.48.41_PM

How to set up and validate locally

  1. Enable read_admin_groups feature flag
  2. Login with an admin
  3. Go to Admin area groups page and verify that groups display project storage size
# To update the storage size of a project
> Project.find(<project_id>).statistics.update!(storage_size: 100.megabytes)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Eugie Limpin

Merge request reports

Loading