Show the group's evaluations count on the group policy list
What does this MR do and why?
Summary
This change extends the policy evaluation statistics (the "recent evaluations" count shown on the policy list page) to work for groups, not just organizations. Previously, this count was intentionally skipped for group pages because no group-level data source existed. A new GraphQL query was added to fetch evaluation counts scoped to a specific group, and the page now uses whichever query is appropriate depending on whether you're viewing an organization or a group.
A small cleanup was also made to the Apollo cache configuration: the merge rule that prevents concurrent data fetches from overwriting each other was broadened to cover both organizations and groups (previously it only covered organizations), and the rule is now defined in one shared place rather than duplicated.
The test suite was updated to cover the new group evaluations behavior, including verifying the correct count is displayed, that a loading state appears while data is fetched, that failures are reported quietly without breaking the policy list, and that retrying refreshes the data with an up-to-date time window.
Verification
jest ee/spec/frontend/policy_store/components/list/app_spec.js ee/spec/frontend/policy_store/evaluations_spec.js → Tests: 43 passed, 43 total
jest ee/spec/frontend/policy_store → 692 passed
eslint + prettier on the changed files → clean
new document validated against public/-/graphql/introspection_result.json → validReferences
Resolves https://gitlab.com/gitlab-org/gitlab/-/work_items/630067
Approved plan: https://gitlab.com/gitlab-org/gitlab/-/work_items/630067#note_3923003182
Backend dependency: !256763 (merged)
Screenshots or screen recordings
No layout change. On group pages the tile shows the group's count for the last 7 days where it previously showed a placeholder.
| Namespace | Before | After |
|---|---|---|
| Group | placeholder (query skipped) |
How to set up and validate locally
-
In a rails console:
Feature.enable(:security_policies_v2, Group.find_by_full_path('<group-path>')) Gitlab::CurrentSettings.update!(policy_store_experiment_enabled: true) Group.find_by_full_path('<group-path>').update!(policy_store_experiment_enabled: true) -
Make sure the group has at least one policy and some evaluations recorded in the last 7 days (for example via the seeded policy store data). Otherwise the tile shows 0.
-
Visit
http://gdk.test:3000/groups/<group-path>/-/security/policy_store. Expected: the "Evaluations (last 7 days)" tile shows a number instead of the placeholder, and the network tab shows agetGroupPolicyEvaluationsCountrequest withfullPathandevaluatedAftervariables. -
Visit the organization list page
http://gdk.test:3000/o/<org-path>/security/policy_storeand confirm the tile still works and the request is stillgetPolicyEvaluationsCountwith the organization id. -
Cross-check with GraphQL explorer at
/-/graphql-explorer:query { group(fullPath: "<group-path>") { policyStore { policyEvaluations(evaluatedAfter: "2026-09-22T00:00:00Z", first: 0) { count } } } }
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.