Read policy store policies from the GraphQL connection nodes

What does this MR do and why?

MR1 changed organization.policyStore.policies from a plain list to a connection. This MR updates the frontend to read from the connection. That makes the policy store list and the single policy read work again.

Changes:

  • The shared query, ee/app/assets/javascripts/policy_store/graphql/get_policy_store_policies.query.graphql, now selects policies(ids:, first:, after:) { nodes { ... } pageInfo { hasNextPage endCursor } } and accepts $first and $after.
  • toListPolicies and fetchStorePolicy in ee/app/assets/javascripts/policy_store/policies.js now read policies.nodes.
  • ee/spec/frontend/policy_store/components/list/app_spec.js and ee/spec/frontend/policy_store/policies_spec.js move their fixtures to { nodes, pageInfo }.
  • The null-connection permission case is kept. A null connection, not an empty one, is the resolver's permission signal.
  • Permission detection in app.vue is unchanged.

After this MR, the list shows up to 100 policies, the field's default, and still truncates silently beyond that. pageInfo is fetched but not used yet. The Load more control is a separate MR.

This MR targets MR1's branch, 628956-policy-store-policies-connection, and only makes sense once MR1 merges. Until then, MR1 alone leaves the policy store list and the single policy read broken for opted-in organizations. These two MRs, and the following Load more MR, should merge in order, close together.

References

Screenshots or screen recordings

Not applicable. This MR has no visible UI change.

How to set up and validate locally

  1. Check out this branch together with MR1.
  2. Open /-/security/policy_store for an opted-in organization with more than 20 policies. Expect up to 100 rows.
  3. Open one policy's detail or editor page. Expect it to load.

Verification

jest ee/spec/frontend/policy_store/components/list/app_spec.js ee/spec/frontend/policy_store/policies_spec.js passed: 26 passed.

The query document was validated against a fresh schema dump using the graphql npm package. Eslint and prettier are clean.

Adversarial review

This MR was reviewed as part of MR1's review. Verdict: pass with findings.

The frontend-relevant checks passed:

  • Null-versus-empty permission detection is intact.
  • No other consumer of the field was found.
  • The guarded result hook is untouched.

Pipeline status

The graphql-verify job does not run on this merge request because the change only touches frontend files. This merge request updates the query document to select nodes and pageInfo and updates the mapper to read from nodes, matching the schema change introduced in !255370 (merged). The combined tree of both merge requests was checked locally against a fresh schema dump using the graphql npm package and it passed without errors. Once this merge request lands on top of the schema change, the job passes on master.

MR acceptance checklist

Evaluated against the MR acceptance checklist.

🤖 Generated with Claude Code

Edited by Artur Fedorov

Merge request reports

Loading
Loading