Compare against a config snapshot when (re)applying a recipe

Created on 20 August 2022, over 2 years ago
Updated 21 May 2024, 7 months ago

Problem/Motivation

From @alexpott in #3283900-6: Define recipe runtime configuration update requirements β†’ . When we apply or reapply a recipe:

what is happening at the moment is that if the configuration doesn't exist all good... we can let the recipe create it. If the configuration does exist that we'll do a comparison (after removing the UUID, _core and dependencies) if the config matches then we'll allow the recipe to be applied - if not then we throw an exception - see https://git.drupalcode.org/project/distributions_recipes/-/blob/10.0.x/c... - yes we can probably improve how this comparison is done but it is working nicely atm and tested.

The introduction of config actions means this approach is no longer sufficient. This is true because config actions modify config as provided. For example, a user role provided by a recipe is designed to be used in many recipes and modified by each through config actions that add permissions. We're seeing this in the work in #3301370: Model core's standard install profile as recipes β†’ . Many recipes run a basic recipe that installs the "content editor" role and then apply actions that add permissions to that role. Under the current approach, the second recipe to do so will trigger an exception, since the role config as provided won't match the config in the active storage.

Instead, we need to compare against a snapshot of the config as installed and altered through config actions.

Steps to reproduce

Create three recipes:

  1. editor_role that provides an "editor" user role
  2. article_content_type that applies editor_role and provides a config action that adds permissions to the role installed by editor_role
  3. page_content_type that (like article_content_type) applies editor_role and provides a config action that adds permissions to the role installed by editor_role.

Apply article_content_type.
Apply page_content_type. Result: exception is thrown because "editor" user role as provided doesn't match user role as saved to the active config storage, which has config actions applied.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Active

Version

11.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada nedjo

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