Config schema is incorrect

Created on 18 March 2024, 9 months ago

Problem/Motivation

When importing a form_mode_control config change I get the following error:

The configuration property _core.default_config_hash doesn't exist.

Our config doesn't have _core.default_config_hash yet and core is trying to set it automatically. The problem is that in Drupal\Core\Config\Schema\ArrayElement::get(), line 64, there's a check to make sure default_config_hash is an instance of TypedConfigInterface. With this module's config present it's not, it's an instance of \Drupal\Core\TypedData\Plugin\DataType\StringData. This happens because config/schema/form_mode_control.settings.yml is telling Drupal that form_mode_control.settings is an sequence of only strings, but since Drupal adds a few default properties we can't make this assumption.

Proposed resolution

Nest the permissions under a parent key, e.g. permissions.

Remaining tasks

Update the schema, any places using the settings config and any existing config data to match the new structure.

πŸ› Bug report
Status

Active

Version

2.0

Component

Miscellaneous

Created by

πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

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

Merge Requests

Comments & Activities

  • Issue created by @dieterholvoet
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • πŸ‡ͺπŸ‡ΈSpain marthinal

    I have this error when updating Drupal core:

    >  [notice] Update started: system_post_update_add_langcode_to_all_translatable_config
    >  [notice] Processed 50 items of 1278.
    >  [notice] Processed 100 items of 1278.
    >  [notice] Processed 150 items of 1278.
    >  [notice] Processed 200 items of 1278.
    >  [notice] Processed 250 items of 1278.
    >  [notice] Processed 300 items of 1278.
    >  [notice] Processed 350 items of 1278.
    >  [notice] Processed 400 items of 1278.
    >  [notice] Processed 450 items of 1278.
    >  [notice] Processed 500 items of 1278.
    >  [notice] Processed 550 items of 1278.
    >  [notice] Processed 600 items of 1278.
    >  [notice] Processed 650 items of 1278.
    >  [notice] Processed 700 items of 1278.
    >  [notice] Processed 750 items of 1278.
    >  [error]  AssertionError: assert($typed_config instanceof Mapping) in assert() (line 264 of /var/www/html/docroot/core/modules/system/system.post_update.php) #0 /var/www/html/docroot/core/modules/system/system.post_update.php(264): assert(false, 'assert($typed_c...')
    

    I updated the schema + implemented hook_update_N

  • πŸ‡­πŸ‡ΊHungary balagan

    Confirming that patch in #5 solves that problem, but probably that should be a separate issue.

  • Status changed to Needs review 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States pianomansam

    Patch in #5 fixes this issue for me as well.

  • Status changed to Fixed 5 months ago
  • πŸ‡¨πŸ‡¦Canada mandclu

    I merged the patch in #5, but not 100% clear if that addresses the original issue here. The patch does resolve a fatal error when updating to Drupal 10.3, so wanted to make a new release with this fix. Feel free to reopen this issue if more work is needed.

  • Status changed to Needs work 5 months ago
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    The update hook in #5 does not work at all, there was no sequence key in the previous config schema. I'll update the patch, hopefully this hasn't been released yet.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    Looks like it has been released. I'll add a new update hook instead of fixing the existing one.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    The configuration form also hasn't been updated to work with the new config format. Kind of a shame that this has been released without proper testing.

  • Status changed to Needs review 5 months ago
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • Merge request !13Move config to form_modes subkey β†’ (Open) created by dieterholvoet
  • Status changed to Fixed 4 months ago
  • πŸ‡­πŸ‡ΊHungary balagan

    This is already merged in 2.4.

  • Status changed to Needs review 4 months ago
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    @balaganb you didn't read my comment in #10, this issue is not actually fixed.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    @mandclu would you mind having a look at this? The config form is still broken in the current release.

Production build 0.71.5 2024