Importing configs doesn't handle inter-module dependencies properly.

Created on 10 November 2021, over 3 years ago
Updated 5 May 2023, about 2 years ago

Problem/Motivation

In #3248590: Flushing caches during preUpdate hook should set maintenance mode. , I detailed a complex scenario where 2 target modules have interdependent configs, and a quirk of WxT triggers a cache-rebuild just before a hook_update() that would enable the dependencies to be satisfied, but instead resulted in Config Enforce being triggered to sync updated configs into active before their dependencies were installed by the second module being enabled.

In the course of troubleshooting this, we noticed that a drush cim --partial in lieu of the usual config_enforce mechanism would cause a similar problem, but would complain about the dependencies issue, whereas Config Enforce was silently importing the updated config (with broken dependencies, or maybe ignored?) and leaving the system in a volatile state where a subsequent second cache-rebuild would trigger further dependencies errors that we couldn't easily resolve.

Looking into the difference between how the drush mechanism worked, we noticed that where Config Enforce simply calls:

$this->getConfigImporter($storage_comparer)->import();

at the relevant point where it wants to import a bunch of config it's determined needs syncing, the drush cim command has a much more complex algorithm, copied from /core/modules/config/src/Form/ConfigSync:submitForm().

Patch forthcoming with an re-implementation of this logic in Config Enforce, to replace the simple import() call. We should keep an eye on these core/upstream implementations of this import logic, as it's likely to change as Drupal 9 and the CMI system evolve.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇨🇦Canada spiderman Halifax, NS

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024