[PP-1] olivero.settings config schema is wrong

Created on 20 November 2023, 12 months ago
Updated 29 August 2024, 3 months 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

Postponed

Version

11.0 πŸ”₯

Component
OliveroΒ  β†’

Last updated 2 days 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 12 months ago
  • Status changed to Needs work 12 months 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).

  • Status changed to Needs review 12 months ago
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • Status changed to RTBC 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Ah good find!

  • Status changed to Needs review 12 months 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 12 months 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 10 months 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 :(

Production build 0.71.5 2024