fix: #3621953 Fix update_view_plugins silently ineffective on non-default displays
Summary
The tool wrote display options directly into the raw config array. Most
options on a freshly created page/block/feed display are still inherited
("defaulted") from the default display until explicitly overridden. A raw
write left that inheritance flag untouched, so the new value sat in the
saved config while Views' own getOption()/getPlugin() kept resolving
to the default display's value at runtime - a page display's access,
cache, style, row, etc. could look correctly changed in a config
dump while every real request still used whatever the default display
already had.
This was the largest-blast-radius defect found while testing the shipped agent against a live LLM: confirmed via a functional access check (a privileged vs. unprivileged real user account) that a permission-gated admin view had no real access restriction at all, despite the saved config looking correct.
Changes
src/Plugin/AiFunctionCall/UpdateViewPlugins.php: switches from a raw$display['display_options'][$option] = $valuewrite to Views' ownDisplayPluginBase::overrideOption(), which correctly clears the inheritance flag before writing.tests/src/Kernel/Integration/CreateAdminAuditViewTest.php(new): addedtestAgentTools(), proving with real, differently-privileged user accounts thataccessgenuinely gates a non-default display, and that bulk-operations/operations fields resolve to real, working handlers when the view actually renders.tests/src/Kernel/Integration/CreateAdminViewTest.php: loosened one assertion onrowto check only itstypekey -styleandroware a linked defaultable pair in Views, so overridingstylenow also completesrow's schema-declaredoptionsdefault, a harmless completion of the same value rather than a different one.
Test plan
- New Integration test confirmed failing before the fix (access not enforced) and passing after.
- Full suite passes on this branch in isolation: 2/2 tests, 70
assertions across both Integration test files, no failures; the
pre-existing
UpdateViewPluginsTestsuite (14 tests, 116 assertions) confirmed unaffected. -
phpcs --standard=Drupal,DrupalPracticeandphpstan analyse(module config, level 1) clean on all changed PHP files.
Closes #3621953
AI-Generated: Yes (Used Claude Code to identify the bug while testing admin-view prompts against the shipped Views Agent, trace the root cause to Views' own defaultable-sections inheritance mechanism, implement the fix, and write the regression test with real differently-privileged user accounts.)