Problem/Motivation
When comparing extension-provided configuration to the installed version to determine if there are changes, certain forms of normalization are necessary. Certain properties, such as a top-level uuid and _core property, are set on install and therefore are not present in the configuration as provided. Various programmatic changes are made to extension-provided config at install time or post-install that will show up as changes when comparing against the active configuration storage. Specific cases are listed as sub-issues of #3007481: Assess and address changes applied at install time. Also, there may be insignificant differences in sorting.
Normalization is needed to avoid spurious diffs when answering questions such as:
- Is the provided configuration the same as that saved to the active configuration storage?
- What configuration updates are available?
A current use case in core is in the Distributions and Recipes initiative, see #3283900-6: Define recipe runtime configuration update requirements.
The ConfigDiffer class in Configuration Update Manager partially addresses this need.
A more comprehensive contrib approach (though still incomplete, see open issues on the module) is in th 8.x-1.x branch of Configuration Normalizer.
However, both of these approaches are workarounds. Config Normalizer, in particular, needs to special-case specific config entity types by writing plugins to address their particular quirks.
Proposed resolution
Add a ::normalize() method to config entities. When called, it makes changes that prepare config for comparison.
Implement the method in config entity types as needed.
Comments
Comment #10
nedjoRequired for #2960999: Support updating extension-provided config via configuration synchronization API and UI.
Comment #11
nedjoComment #12
nedjoComment #13
nedjoMoving into the Distributions and Recipes initiative as a child of #3283900: Define recipe runtime configuration update requirements.
Comment #14
nedjoSpecific use cases are listed as sub-issues of #3007481: Assess and address changes applied at install time.
Comment #15
thejimbirch commentedComment #16
bsnodgrass commentedmoved to Drupal Core, per https://www.drupal.org/project/distributions_recipes/issues/3513044