Update Compliance Center GraphQL queries to use approvalPolicies instead of scanResultPolicies
## Overview As part of the deprecation of the `scanResultPolicies` GraphQL field, the Compliance Center needs to update its GraphQL queries to use the replacement field `approvalPolicies`. ## Context - Related issue: [gitlab-com/Product#14441](https://gitlab.com/gitlab-com/Product/-/work_items/14441) - Deprecate scanResultPolicies GraphQL field - The `scanResultPolicies` field is being removed for better consistency with front-end, docs, and product terminology - The migration is straightforward: swap any integrations with the API to use the supported field ## Tasks - [ ] Identify all GraphQL queries in Compliance Center using `scanResultPolicies` - [ ] Update queries to use `approvalPolicies` instead - [ ] Test the changes to ensure functionality is preserved - [ ] Verify no other parts of the codebase are affected ## Technical Proposal ### Summary This is a GraphQL API migration task where the Compliance Center feature needs to update its queries to use the newer `approvalPolicies` field instead of the deprecated `scanResultPolicies` field. According to the GitLab GraphQL documentation, `scanResultPolicies` was deprecated in GitLab 16.9 in favor of `approvalPolicies`. ### Field Interchangeability **Good news:** The fields are **completely interchangeable** from a data perspective. According to the GraphQL documentation: - Both fields return the same type structure: `ApprovalScanResultPolicy` objects - Both support the same arguments: `deduplicatePolicies`, `includeUnscoped`, and `relationship` - The data returned (policy name, approvals required, report type) is identical **No additional changes needed** beyond the field name replacement. ### Files That Need to Be Updated Based on the codebase structure, you'll need to find and update: 1. **Frontend GraphQL Query Files** (`.graphql` or `.gql` files): - Search in: `app/assets/javascripts/` for any Compliance Center related directories - Look for files containing `scanResultPolicies` in GraphQL query definitions - Typical locations: `app/assets/javascripts/compliance_center/` or similar feature directories 2. **Backend GraphQL Type Definitions**: - File: `app/graphql/types/` - Look for approval/policy related type files - Search for any Ruby files that define fields returning `scanResultPolicies` - These would be in files like `approval_rule_type.rb` or similar 3. **Test Files**: - Search in: `spec/` directory with matching paths to the code being tested - Look for test files that mock or assert on `scanResultPolicies` queries ### Step-by-Step Approach for the Junior Engineer 1. **Search the codebase** for all occurrences of `scanResultPolicies`: - Use your IDE's find-in-files feature or `grep -r "scanResultPolicies" app/` - Document each file location and line number 2. **For each file found:** - Replace `scanResultPolicies` with `approvalPolicies` - Ensure the surrounding query structure remains unchanged - Keep all arguments and nested field selections the same 3. **Run tests** to verify: - Execute the existing test suite for the Compliance Center feature - Verify that no API errors occur when the updated queries are executed - Check that the UI still displays policies correctly 4. **Manual testing:** - Navigate to the Compliance Center in the UI - Verify that policies load and display correctly - Check that all policy-related functionality works as expected
issue