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] = $value write to Views' own DisplayPluginBase::overrideOption(), which correctly clears the inheritance flag before writing.
  • tests/src/Kernel/Integration/CreateAdminAuditViewTest.php (new): added testAgentTools(), proving with real, differently-privileged user accounts that access genuinely 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 on row to check only its type key - style and row are a linked defaultable pair in Views, so overriding style now also completes row's schema-declared options default, 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 UpdateViewPluginsTest suite (14 tests, 116 assertions) confirmed unaffected.
  • phpcs --standard=Drupal,DrupalPractice and phpstan 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.)

Merge request reports

Loading
Loading