Skip to content

Fix undefined framework_id error when unassigning framework

Sashi Kumar Kumaresan requested to merge sk/428491-fix-exception into master

What does this MR do and why?

This MR fixes an exception raised when a project's compliance framework is unassigned when there is no compliance_framework_setting for the project. It is not straight forward to reproduce the issue, but it can be reproduced by calling the setComplianceFramework graphql mutation.

Screenshots or screen recordings

Before

Screenshot_2023-11-30_at_5.30.41_PM

After

Screenshot_2023-11-30_at_5.31.20_PM

How to set up and validate locally

  • Create a top level group and create a compliance framework
  • Create a project within the group
  • Assign the compliance framework to one of the projects in the group (Settings -> General -> Compliance Frameworks)
  • Go to graphql-explorer and execute the mutation twice and observe that there are no errors:
mutation {
  projectSetComplianceFramework(input:{projectId:"gid://gitlab/Project/<id>", complianceFrameworkId:null}) {
    project {
      complianceFrameworks {
        nodes {
          id
        }
      }
    }
  }
}

MR acceptance checklist

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

Merge request reports

Loading