Problem/Motivation
The excluded modules feature just removes all config that depends directly or indirectly on the excluded modules from the exported config. This works great for the intended use-case of excluding development modules such as devel. Because devel doesn't add third party settings to all of the config.
But conceptually the operation should be equivalent to uninstalling the modules, exporting the config and then installing the modules again and configuring the modules the same way again.
Steps to reproduce
Install Umami
$settings['config_exclude_modules'] = ['menu_ui'];
Export config
Discover all of the recipe content type is missing.
(This is because node.type.recipe depends on menu_ui because it has third_party_settings for it.)
With this issue the third_party_settings for menu_ui would be removed from node.type.recipe on export and added again on import.
Proposed resolution
Removing the things is easy, adding it back is hard without predictable sorting. (We can maybe sort by the active config)
(see an experiment in contrib: #3170204: Add option to remove modules as if they were uninstalled)
Remaining tasks
tbd,
User interface changes
none
API changes
none
Data model changes
none
Release notes snippet
Excluded modules change the configuration as if they had been uninstalled instead of removing all dependent config.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3230825-exclude_config_dependency-8.patch | 1.69 KB | holo96 |
Comments
Comment #3
ressaReproduce with Views UI
$settings['config_exclude_modules'] = ['views_ui'];Check "Administer views" for "Content Editor"
Export config
Discover that the "Content Editor" role was removed on next
config:import:Comment #4
benjifisherAccording to #2571235-245: [regression] Roles should depend on objects that are building the granted permissions,
This affects Drupal 9.3.0, the first full release including #2571235.
Comment #5
johnpitcairn commentedYes, and any previously exported config for the role will be deleted. This could bite hard when upgrading from 9.2.x.
Comment #8
holo96 commentedI guess we will need tests for this
Maybe even to update existing ones
But let's first do maual testing.
PS. Roles are also updated at least in drupal 10 where I tested this.
Comment #9
holo96 commentedComment #11
holo96 commentedComment #12
bircherThe patch in 8 is a good start, but it is far from complete. It currently does the removing only. It also needs to put the removed config back in a "patch" way, otherwise on an import the removed things will not be added again. I think it would be best to start with a test here.
The test would have a config which changes when a module is excluded. (such as a role having the permission removed)
The test should assert that the permission is not present in the exported config, but when importing the config again the permission should be set again. At the very least. There are other cases we should test too but this would be a good start.
Comment #14
seanrI can confirm patch in #8 only partially fixes it. It's a damned good thing I watch those config diffs like a hawk. 🤣 FWIW, I'm now using https://www.drupal.org/project/config_ignore and I recommend that anyway as it's targeted to specific configs rather than the whole module.