task: #3621965 Fix a partial 'expose' edit dropping a previously-set identifier
Summary
Found by an independent code review, specifically checking whether the
exposed-filter identifier auto-default could itself hide a different
problem. It could: UpdateViewHandlerOptions's $options + $configuration
merge is shallow and top-level, so a partial expose edit (for example,
changing only the label on an already-exposed filter) wholesale-replaced
the entire existing expose sub-array, silently dropping any other
already-set key in it - most importantly a previously-set custom
identifier. Before the identifier auto-default this at least failed
View::validate() ("identifier required"); after it, the dropped
identifier was silently replaced with the field ID instead, hiding the
loss rather than surfacing it.
Changes
src/Plugin/AiFunctionCall/UpdateViewHandlerOptions.php: merges theexposesub-array itself before the top-level merge, so a partial edit only changes the keys it actually names.tests/src/Kernel/Plugin/AiFunctionCall/UpdateViewHandlerOptionsTest.php: addedtestPartialExposeEditPreservesCustomIdentifier().
Test plan
- New regression test confirmed failing before the fix (custom identifier silently replaced) and passing after.
- Full test file passes on this branch in isolation: 11/11 tests, 89 assertions, no failures.
-
phpcs --standard=Drupal,DrupalPracticeandphpstan analyse(module config, level 1) clean on both changed PHP files.
Closes #3621965
AI-Generated: Yes (Used Claude Code to find this defect via an independent code review of the module's own recently-merged changes, implement the fix, and write the regression test.)