olivero.settings config schema is wrong

Created on 20 November 2023, over 1 year ago

Problem/Motivation

While working on test coverage for configuration schema improvements, I stumbled upon olivero.settings behaving weirdly.

turns out it's because its config schema is wrong, it does:

olivero.settings:
  type: theme_settings
  label: 'olivero settings'
  mapping:
    third_party_settings:
      type: mapping
      label: 'Third party settings'
      mapping:
        shortcut:
          type: mapping
          label: 'Shortcut'
          mapping:
            module_link:
              type: boolean
              label: 'Module Link'
    mobile_menu_all_widths:
      …
    site_branding_bg_color:
      …
    base_primary_color:
      …

but
theme_settings already has

theme_settings:
…
    third_party_settings:
      # Third party settings are always optional: they're an optional extension
      # point.
      requiredKey: false
      type: sequence
      label: 'Third party settings'
      sequence:
        type: theme_settings.third_party.[%key]

which combined with shortcut.schema.yml's

# Schema for theme settings.
theme_settings.third_party.shortcut:
  type: mapping
  label: 'Shortcut settings'
  mapping:
    module_link:
      type: boolean
      label: 'Add shortcut link'

Means that the entirety of that override should be removed.

Raised in #3111409-123: Add new Olivero frontend theme to Drupal 9.1 core as beta β†’ by @catch but it was never answered.

Steps to reproduce

Proposed resolution

Remove the pointless overrides.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
OliveroΒ  β†’

Last updated about 7 hours ago

Created by

πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

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

Merge Requests

Comments & Activities

  • Issue created by @wim leers
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • Status changed to Needs review over 1 year ago
  • Pipeline finished with Failed
    over 1 year ago
    Total: 933s
    #52940
  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Surprised that removing that cause all those failures. Is it a dependency thing where those other schemas aren't getting loaded?

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Is it a dependency thing where those other schemas aren't getting loaded?

    Quite possibly the Shortcut module must be installed in all those failing tests.

    I see lots of migration test failures. 90% likely that the migration is wrong (i.e. assumes the Shortcut module is installed, which is not guaranteed).

  • Pipeline finished with Success
    over 1 year ago
    Total: 641s
    #52991
  • Status changed to Needs review over 1 year ago
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • Status changed to RTBC over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Ah good find!

  • Status changed to Needs review over 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    What about existing sites? Do we need to clean up if Olivero is installed but Shortcut is not?

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    You are correct. Did a standard install, uninstalled shortcut, config export and still see that third_party_setting in the yml file.

    _core:
      default_config_hash: 1TswGK46jyu77aIM7Z-0JVQs5bxHmo-gtgrvrQGMXxc
    favicon:
      use_default: true
    features:
      comment_user_picture: true
      comment_user_verification: true
      favicon: true
      node_user_picture: false
    logo:
      use_default: false
    third_party_settings:
      shortcut:
        module_link: true
    mobile_menu_all_widths: 0
    site_branding_bg_color: default
    base_primary_color: '#1b9ae4'
    
    
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    Most sites don't need an update path, for two reasons:

    1. 99% of sites have the Shortcut module installed, which means they'll have type: theme_settings.third_party.shortcut, and hence their config is valid
    2. We should keep 100% of the sites that have Shortcut installed working the exact same way in Olivero, which means: not modifying their configuration

    That means we need to write an update path for the remaining 1% of sites that use Olivero but have the Shortcut module uninstalled, because in those cases, the third party settings in olivero.settings are meaningless noise.

    (Sorry for maybe stating the obvious, but I was thinking it through so might as well write it up.)

    olivero_post_update_add_olivero_primary_color() and OliveroPostUpdateTest already exist and provide a decent example :) At the start of the post-update function, we'd need something like:

      $module_handler = \Drupal::moduleHandler();
      if ($module_handler->moduleExists('shortcut')) {
        // No config to update.
        return;
      }
    

    (example of that: help_post_update_help_topics_search())

  • Status changed to Postponed over 1 year ago
  • πŸ‡§πŸ‡ͺBelgium borisson_ Mechelen, πŸ‡§πŸ‡ͺ

    Postponing this on πŸ“Œ [PP-1] Add validation constraints to olivero.settings Postponed , which adds more validation.

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • πŸ‡¦πŸ‡ΉAustria hudri Austria

    This bug is a bit annoying.

    Contrib (e.g. Gin) is now copying this bug into their own codebase, just to make Config inspector shut up. And this again breaks theme 3rd party settings for everybody else :(

  • Status changed to Needs work 13 days ago
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Issue itr was postponed on was fixed, this can actually be worked on.

  • Pipeline finished with Success
    12 days ago
    Total: 541s
    #471864
  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Added an update hook and test, also tested it locally on a clean install.

  • Pipeline finished with Failed
    12 days ago
    Total: 187s
    #471881
  • Pipeline finished with Failed
    12 days ago
    Total: 630s
    #471883
  • Pipeline finished with Success
    12 days ago
    Total: 549s
    #471886
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    So tested this one with 2 separate sites, 1 I had shortcuts installed the other I did not

    First site
    > Shortcut remained

    Second site
    > Shortcut was removed

    Problem though, on the site that remained the validation went down because the third_party_settings schema is gone.

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    What was the message there?

    The validation should still be OK, since:

    olivero.settings:
      type: theme_settings
    

    Which means core.data_types.schema.yml

    theme_settings:
      type: config_object
      mapping:
    ...
        third_party_settings:
          # Third party settings are always optional: they're an optional extension
          # point.
          requiredKey: false
          type: sequence
          label: 'Third party settings'
          sequence:
            type: theme_settings.third_party.[%key]
    

    Which then should resolve into:

    shortcut.schema.yml

    # Schema for theme settings.
    theme_settings.third_party.shortcut:
      type: mapping
      label: 'Shortcut settings'
      mapping:
        module_link:
          type: boolean
          label: 'Add shortcut link'
    

    I also tried to proove the issue in the test, but seems fine. I'm confused.

  • Pipeline finished with Failed
    9 days ago
    Total: 506s
    #474103
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Don't have that branch up right now but validation had gone down for me because third_party_settings was no longer validated

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Can you help me reproduce locally?

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    So I apply the MR and run the update when I go to olivero.settings

    I see that the percentage went down to 94% and

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    Ahh, there.

    Hmm, ok, seems weird but can look into that. I'd assume that is validated since it is not overwritten for the theme_settings type.

    Thanks, I cab work with this.

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands

    I should confess i first read your message as the validation crashed, but you mean it is not 100% :)

    This goed a little deeper. I dont see any third_party_settings validated in other config, only the actualyl settings when set, so this seems expected. There is also;

    πŸ› third_party_settings in THEME.settings.yml cannot be dependency managed Needs work
    ✨ 3rd party should be allowed to add config dependencies Active

    Which expose some issues around third part settings. So i don't think we should block on the fact the parent key is not validated.

  • πŸ‡³πŸ‡±Netherlands bbrala Netherlands
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Alright that was the only issue I found

Production build 0.71.5 2024