Handle null filters in saved view updates
What does this MR do and why?
WorkItemSavedViewUpdateInput.filters is nullable. Explicit null currently skips both filter normalization and
cleanup of the virtual parameter, causing it to reach model mass assignment and raise
ActiveModel::UnknownAttributeError.
This change always removes the virtual parameter before model update while preserving the existing filter semantics:
omitted -> unchanged
null -> unchanged
{} -> clear
object -> normalized replacementThe change adds a real GraphQL request regression for explicit null and protects the empty-object clear path.
Scope is limited to the parameter boundary and request coverage. There is no schema, database, authorization, frontend, query, finder, rescue, or normal filter-normalization change.
References
Closes #630217 (closed)
Screenshots or screen recordings
Not applicable. This MR has no UI changes.
How to set up and validate locally
-
Run the focused GraphQL regression:
bin/rspec spec/requests/api/graphql/mutations/work_items/saved_views/update_spec.rb \ --example "filters input" -
Run the full relevant request and service specs:
bin/rspec \ spec/requests/api/graphql/mutations/work_items/saved_views/update_spec.rb \ spec/services/work_items/saved_views/update_service_spec.rb \ spec/services/work_items/saved_views/filter_normalizer_service_spec.rb -
Run RuboCop:
bundle exec rubocop \ app/services/work_items/saved_views/update_service.rb \ spec/requests/api/graphql/mutations/work_items/saved_views/update_spec.rb
MR acceptance checklist
- The real GraphQL regression reproduces the pre-fix failure.
- Existing authorization examples remain green.
- Existing normalization errors and model validation errors remain unchanged.
- No database, query, schema, frontend, or documentation change is needed.
- The focused regression, relevant suites, RuboCop, syntax checks, and
git diff --checkpass.
AI assistance
AI tooling was used to assist with investigation and drafting. The contributor independently reviewed the implementation, reproduced the bug locally, verified the regression test and fix, and takes responsibility for the submitted changes.