postponed on #2991683: Move configuration transformation API in \Drupal\Core\Config namespace

Problem/Motivation

We added the config_exclude feature to the config_environment module in #3077504: Add config_exclude functionality to core because the API was added to the experimental module waiting for an implementation. Now we have a use for it and both can move to their intended places.

Once in core and available to everyone, we of course need to update the default settings.php with documentation and an example.

Proposed resolution

Move \Drupal\config_environment\EventSubscriber\ExcludedModulesEventSubscriber to core.services.
Add documentation.

Remaining tasks

write patch.
decide on documentation.

User interface changes

none

API changes

config_exclude functionality available to everyone no experimental module needed.
This means the functionality is outside of the scope of the experimental config_environment module and is considered stable.

Data model changes

none

Release notes snippet

Modules can be excluded from the configuration synchronisation. See the change notice for more details.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bircher created an issue. See original summary.

bircher’s picture

Issue summary: View changes
bircher’s picture

Status: Active » Postponed
FileSize
1.14 KB

postponed on #3077504: Add config_exclude functionality to core and #2991683: Move configuration transformation API in \Drupal\Core\Config namespace

I would vote for doing it in two steps.

My proposal for the documentation in example.settings.local.php:

/**
 * Exclude modules from configuration synchronisation.
 *
 * Excluded modules and all the configuration that directly and indirectly
 * depends on them are not exported when exporting all configuration. When
 * importing the configuration the excluded modules and their configuration
 * are not removed.
 *
 * Drupal does not validate or sanity check the list of excluded modules. It is
 * possible to exclude required modules, which means that the exported
 * configuration can not be imported any more.
 *
 * Note: This is an advanced feature and using it means opting out of some of
 * the guarantees the configuration synchronisation provides.
 * It is not recommended to use this feature with modules that affect Drupal in
 * a major way such as the language or field module.
 */
# $settings['config_exclude_modules'] = ['devel', 'stage_file_proxy'];

Ok might as well make a patch for that...

Other wording or entirely other ideas are welcome too!

marcvangend’s picture

Some thoughts about the documentation text:

Excluded modules [...] are not exported when exporting all configuration.

Technically speaking, modules are never exported; What happens is that the enabled-status of an excluded module is not exported. But probably if we write that, we would be over-complicating things?

It is possible to exclude required modules [...]

To me, the phrase "it is possible" sounds as if it could be considered in certain situations. However, I think you intend to explain why people should never do this, right? I suggest something like "While it is technically possible to exclude required modules, that would mean that the exported configuration can not be imported anymore." Or maybe even "For instance, it is your own responsibility to never exclude required modules, because it would mean that the exported configuration can not be imported anymore." (PS. "anymore" is one word in this context.)

I don't think the third paragraph needs the "Note:" prefix, the text is just as good without it. I would even argue that it is more important than the second paragraph, so the 2nd and 3rd could be swapped around.

bircher’s picture

Issue summary: View changes
ricardoamaro’s picture

https://www.drupal.org/project/drupal/issues/2991683 is now in "Reviewed & tested by the community" state.

++ for config_exclude functionality available to everyone with no experimental module needed !

Keep me posted for when we need to review this one also. :)

bircher’s picture

Issue summary: View changes
Status: Postponed » Needs review
Issue tags: +8.8.0 highlights
FileSize
6.05 KB
40.58 KB

As discussed with alexpott and moshe on the CMI 2 call today.
Attached are two patches, one to review and one including the RTBC patch form #2991683: Move configuration transformation API in \Drupal\Core\Config namespace.

Here we need to add the documentation and we can review this already independently.

This issue adds the thought after feature as stable to core.

Status: Needs review » Needs work

The last submitted patch, 7: 3079029-7.patch, failed testing. View results

bircher’s picture

Status: Needs work » Needs review
FileSize
7.52 KB
42.18 KB

Oh nice, I missed updating both files, good for the test bot to catch that!

bircher’s picture

FileSize
45.56 KB

re-rolled patch for manual testing. the review patch is un-touched from #9

ricardoamaro’s picture

Reviewed 3079029-9-review-do-not-test.patch looks fine.

ricardoamaro’s picture

Manual review and test

$ git apply 3079029-10-full.patch
$ drush cr
Cache rebuild complete.                                                                                                                                                                                                                              [ok]
$ drush cex
The active configuration is identical to the configuration in the export directory (sites/default/files/config/sync).                                                                                                                                [ok]
$ rm -rf sites/default/files/config/sync/*
$ drush cex
Configuration successfully exported to sites/default/files/config/sync.                                                                                                                                                                              [success]
$ ls sites/default/files/config/sync | wc -l
320

Also the site functionality seems to be working fine.

ricardoamaro’s picture

Status: Needs review » Reviewed & tested by the community
catch’s picture

#2991683: Move configuration transformation API in \Drupal\Core\Config namespace is in.

I haven't reviewed the full patch here, but I can't see anything yet to uninstall / deprecate config_environment module.

We would want to do something like the following:

1. Mark it hidden
2. system_update_N() to uninstall it
3. hook_requirements() to prevent it being reinstalled.

Or if sites already using the module need to take action, we might want to do only #3 (with an additional runtime warning when it's installed).

Also a follow-up to actually remove it wholesale in 9.0.x

edit: spoke to bircher in slack. While config_environment will be empty after this patch, there's still a use for it as an alpha experimental module for more config_environment work still to do. So what we actually want to do is completely remove it from 8.8.x and recommit it to 8.9.x/9.0.x as an empty alpha experimental module again. That means the patch here is fine, but I think we should have an explicit followup for the removal since it's an unusual reason to remove an alpha module (normally we'd do that if development is abandoned or it's been deprecated).

bircher’s picture

Created the followup #3086465: Remove config_environmment from 8.8.0 and add it to 8.9.x.

Attached is the RTBC patch to make sure it is the last patch on the issue, renamed so that the testbot likes it.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/assets/scaffold/files/example.settings.local.php
    @@ -129,3 +129,25 @@
    + * Excluded modules and all the configuration that directly and indirectly
    + * depends on them are not exported when exporting all configuration. When
    + * importing the configuration the excluded modules and their configuration
    + * are not removed when they currently exist in the active config but are not
    + * part of the configuration to import. This affects only the configuration
    + * synchronisation, single import and export of configuration is not affected.
    
    +++ b/sites/example.settings.local.php
    @@ -129,3 +129,25 @@
    + * Excluded modules and all the configuration that directly and indirectly
    + * depends on them are not exported when exporting all configuration. When
    + * importing the configuration the excluded modules and their configuration
    + * are not removed when they currently exist in the active config but are not
    + * part of the configuration to import. This affects only the configuration
    + * synchronisation, single import and export of configuration is not affected.
    

    I think this can be a bit clearer. Something like:

     * Excluded modules and all the configuration that directly and indirectly
     * depends on them are not exported when exporting all configuration. When
     * importing configuration, if excluded modules are installed, they are not
     * uninstalled and their configuration is not removed from active config. This
     * affects only configuration synchronisation, single import and export of
     * configuration are not affected.
    
  2. +++ b/core/assets/scaffold/files/example.settings.local.php
    @@ -129,3 +129,25 @@
    + * This is an advanced feature and using it means opting out of some of the
    + * guarantees the configuration synchronisation provides.
    + * It is not recommended to use this feature with modules that affect Drupal in
    + * a major way such as the language or field module.
    
    +++ b/sites/example.settings.local.php
    @@ -129,3 +129,25 @@
    + * This is an advanced feature and using it means opting out of some of the
    + * guarantees the configuration synchronisation provides.
    + * It is not recommended to use this feature with modules that affect Drupal in
    + * a major way such as the language or field module.
    

    Let's re-flow this comment. to make use of the space.

     * This is an advanced feature and using it means opting out of some of the
     * guarantees the configuration synchronisation provides. It is not recommended
     * to use this feature with modules that affect Drupal in a major way such as
     * the language or field module.
    
bircher’s picture

Status: Needs work » Needs review
FileSize
7.43 KB
3.39 KB
bircher’s picture

some more improvements form a slack conversation with @alexpott.
I don't know how to improve this further but maybe someone with a fresh look has an even better idea.

catch’s picture

+++ b/sites/example.settings.local.php
@@ -133,12 +133,11 @@
+ * When exporting configuration, excluded modules and all dependent
+ * configuration are not included. When importing configuration, if excluded

'excluded [..] are not included' is a bit tautological.

What about 'When exporting configuration, the configuration objects and core.extension.list items for excluded modules will be removed from the final export.

+++ b/core/assets/scaffold/files/example.settings.local.php
@@ -129,3 +129,24 @@
+ * configuration are not included. When importing configuration, if excluded
+ * modules are installed, they are not uninstalled and their configuration is
+ * not removed from the active configuration. This affects only configuration
+ * synchronisation; single import and export of configuration are not affected.
+ *

Also 'if excluded modules are already installed' might be better here. Otherwise it sounds like excluded modules are being installed when configuration is imported.

bircher’s picture

yes that sounds better!

wouter.adem’s picture

As an outsider I find this explanation a bit confusing.

+++ b/sites/example.settings.local.php
@@ -133,12 +133,11 @@
+ * When exporting configuration, excluded modules and all dependent
+ * configuration are not included. When importing configuration, if excluded
+ * modules are installed, they are not uninstalled and their configuration is
+ * not removed from the active configuration. This affects only configuration
+ * synchronisation; single import and export of configuration are not affected.

I'd keep it (maybe to) simple:

On config export sync, no config or dependent config of any excluded module is exported.
On config import sync, any config of any installed excluded module is ignored.
bircher’s picture

#21 is maybe too simple, but I would leave that to someone else to decide.
I added a documentation stub here: https://www.drupal.org/node/3086573

catch’s picture

hmm I actually like #21 but we might want to do a combination of both, something like this:

"On config export sync, no config or dependent config of any excluded module is exported.
On config import sync, any config of any installed excluded module is ignored.

In exported configuration, it will be as if the excluded module had never been installed. When syncing configuration, if an excluded module is installed, it will not be uninstalled by the configuration sync, and dependent configuration will remain intact."

bircher’s picture

the latest proposal.

wouter.adem’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 1d8712f and pushed to 8.8.x. Thanks!

Credited everyone for the discussion on the comment.

Yay CMI 2.0 has got something in core as stable. win! Great work everyone!

  • alexpott committed 1d8712f on 8.8.x
    Issue #3079029 by bircher, ricardoamaro, catch, wouter.adem, marcvangend...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.