The compliance report view survives uninstall, broken

Problem / Motivation

Uninstalling the module can leave views.view.ai_disclosure_report behind, broken. The view still declares module: ai_disclosure among its dependencies and still carries the handlers the module provided, across fields and filters.

Steps to reproduce

Measured on Drupal 11.4.5.

  1. Install ai_disclosure and ai_disclosure_csv_export.
  2. Remove the uuid key from views.view.ai_disclosure_report in active configuration. On the site this came up on, the view was already in that state, and it was the only configuration object there without a uuid.
  3. drush pmu ai_disclosure -y.
  4. \Drupal\views\Entity\View::load('ai_disclosure_report') still returns the view.

With the uuid in place, the same steps delete the view.

Cause

ConfigManager::getConfigDependencyManager() keeps only configuration that carries a uuid, on the stated assumption that data with a uuid is a config entity. A report view without one is missing from the dependency graph, so findConfigEntityDependencies('module', ['ai_disclosure']) does not return it and the config cleanup never considers it. The module ships that view and relies on the graph to take it away.

The first reading of this issue blamed ai_disclosure_csv_export_uninstall(), which loads the view and saves it again. That save only explains the missing rest_export_1 display in what is left behind. With the submodule uninstalled in an earlier run, and out of the way, the view survives all the same.

Proposed resolution

ai_disclosure_uninstall() deletes the views the module ships, ai_disclosure_report and ai_disclosure_suggestions, instead of leaving them to the dependency graph. comment_uninstall() removes its own field storages on the same principle. The submodule stays as it is.

The fix comes with a test: strip the uuid, uninstall both modules, assert the report view is gone.

Edited by Giorgio Alfredo Pagano