workItemSavedViewUpdate fails when filters is null

Summary

filters is nullable in WorkItemSavedViewUpdateInput, but sending filters: null currently results in an internal server error.

API clients can send a schema-valid Work Item Saved View update that results in an internal server error.

Steps to reproduce

  1. Create a Work Item Saved View with non-empty filters.

  2. Send this mutation:

    mutation updateSavedView($input: WorkItemSavedViewUpdateInput!) {
      workItemSavedViewUpdate(input: $input) {
        savedView {
          id
          name
        }
        errors
      }
    }
  3. Use variables that include an updated name and explicit null filters:

    {
      "input": {
        "id": "gid://gitlab/WorkItems::SavedViews::SavedView/<id>",
        "name": "Updated name",
        "filters": null
      }
    }

Example Project

An example project is not required. The behavior reproduces in a GraphQL request spec with a project Saved View.

What is the current bug behavior?

The request returns HTTP 500 with a top-level GraphQL error. The supplied name and existing filters are not partially persisted.

What is the expected correct behavior?

Under the current Work Item Saved View update semantics, explicit null should behave like an omitted filter update and preserve existing filters. filters: {} remains the supported way to clear them. Other supplied valid attributes should update normally.

Relevant logs and/or screenshots

Internal server error: unknown attribute 'filters' for WorkItems::SavedViews::SavedView.

Screenshots are not applicable to this API-only bug.

Output of checks

Reproduced on canonical master 7034e264e20623fb0059e015eba0981b105fa6ef through the real GraphQL request stack. The affected source is unchanged on current canonical master 3072b63a2040a8a4e22fbf6a947aa41b7ebf5de2 (19.5.0-pre).

Results of GitLab environment info

Not applicable. Reproduced in the GitLab source test environment.

Results of GitLab application Check

Not applicable. The relevant source test suites pass after the proposed fix.

Possible fixes

filters is a virtual service parameter translated to filter_data. Remove the virtual key before model mass assignment even when its value is nil, while retaining normalization for empty and populated objects.

Edited by 🤖 GitLab Bot 🤖