Add validation constraints to system.theme

Created on 17 April 2024, 7 months ago
Updated 12 August 2024, 3 months ago

Problem/Motivation

system.theme has 2 property path that are not yet validatable:

./vendor/bin/drush config:inspect --filter-keys=system.theme --detail --list-constraints
โžœ  ๐Ÿค– Analyzingโ€ฆ

 Legend for Data: 
  โœ…โ“  โ†’ Correct primitive type, detailed validation impossible.
  โœ…โœ…  โ†’ Correct primitive type, passed all validation constraints.
 ----------------------------------------- --------- ------------- ------ -------------------------------------------- 
  Key                                       Status    Validatable   Data   Validation constraints                      
 ----------------------------------------- --------- ------------- ------ -------------------------------------------- 
  system.theme                              Correct   60%           โœ…โ“   ValidKeys: '<infer>'                        
                                                                           LangcodeRequiredIfTranslatableValues: null  
   system.theme:                            Correct   Validatable   โœ…โœ…   ValidKeys: '<infer>'                        
                                                                           LangcodeRequiredIfTranslatableValues: null  
   system.theme:_core                       Correct   Validatable   โœ…โœ…   ValidKeys:                                  
                                                                             - default_config_hash                     
   system.theme:_core.default_config_hash   Correct   Validatable   โœ…โœ…   NotNull: {  }                               
                                                                           Regex: '/^[a-zA-Z0-9\-_]+$/'                
                                                                           Length: 43                                  
                                                                           โ†ฃ PrimitiveType: {  }                       
   system.theme:admin                       Correct   NOT           โœ…โ“   โš ๏ธ  @todo Add validation constraints here   
   system.theme:default                     Correct   NOT           โœ…โ“   โš ๏ธ  @todo Add validation constraints here   
 ----------------------------------------- --------- ------------- ------ -------------------------------------------- 

Steps to reproduce

  1. Get a local git clone of Drupal core 11.x.
  2. composer require drupal/config_inspector โ€” or manually install https://www.drupal.org/project/config_inspector/releases/2.1.5 โ†’ or newer (which supports Drupal 11!)
  3. composer require drush/drush
  4. vendor/bin/drush config:inspect --filter-keys=system.theme --detail --list-constraints

Proposed resolution

Add validation constraints to:

  1. system.theme:admin
  2. system.theme:default

For examples, search *.schema.yml files for the string constraints: ๐Ÿ˜Š

Reach out to @borisson_ or @wimleers in the #distributions-and-recipes.

Remaining tasks

User interface changes

None.

API changes

Data model changes

More validation ๐Ÿš€

Release notes snippet

None.

๐Ÿ“Œ Task
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Systemย  โ†’

Last updated 2 days ago

No maintainer
Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia narendraR Jaipur, India

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

Merge Requests

Comments & Activities

  • Issue created by @narendraR
  • Merge request !7647Added code from 3441503 โ†’ (Open) created by narendraR
  • Pipeline finished with Failed
    7 months ago
    Total: 594s
    #153318
  • Pipeline finished with Failed
    7 months ago
    Total: 535s
    #154006
  • Pipeline finished with Failed
    7 months ago
    Total: 4883s
    #154066
  • Pipeline finished with Failed
    7 months ago
    Total: 1079s
    #154171
  • Pipeline finished with Success
    7 months ago
    Total: 987s
    #155654
  • Pipeline finished with Failed
    7 months ago
    Total: 1510s
    #155671
  • Pipeline finished with Success
    7 months ago
    Total: 1109s
    #156203
  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia narendraR Jaipur, India
  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Looking great! Exciting for all these. Can the MR be updated for 11.x though

  • Pipeline finished with Canceled
    7 months ago
    Total: 817s
    #159384
  • Pipeline finished with Failed
    7 months ago
    Total: 502s
    #159390
  • Pipeline finished with Success
    7 months ago
    Total: 6302s
    #159412
  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia narendraR Jaipur, India
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Wim Leers โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    99% ready! :)

  • Pipeline finished with Success
    7 months ago
    Total: 725s
    #159632
  • Pipeline finished with Success
    7 months ago
    Total: 5245s
    #159669
  • Status changed to Needs review 7 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia narendraR Jaipur, India
  • Status changed to RTBC 7 months ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • Status changed to Needs work 7 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    This needs the same upgrade path approach as ๐Ÿ“Œ Add validation constraints to core.menu.schema.yml Needs work - install profiles routinely ship with this file, and if they only specify the front end theme, I would expect that to fail validation? So we need to auto-fix it when config is saved, but also trigger a deprecation when that happens outside of the upgrade path.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Good call here too ๐Ÿซฃ

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar.podey

    omkar.podey โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    7 months ago
    Total: 165s
    #167383
  • Pipeline finished with Failed
    7 months ago
    Total: 240s
    #167410
  • Pipeline finished with Failed
    7 months ago
    Total: 269s
    #167492
  • Pipeline finished with Failed
    7 months ago
    Total: 172s
    #168436
  • Pipeline finished with Failed
    7 months ago
    Total: 502s
    #168442
  • Pipeline finished with Failed
    7 months ago
    Total: 998s
    #168571
  • Pipeline finished with Failed
    7 months ago
    Total: 1153s
    #168592
  • Pipeline finished with Failed
    7 months ago
    Total: 575s
    #169439
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar.podey

    Right now \Drupal\FunctionalTests\Core\Recipe\StandardRecipeInstallTest::testStandard is failing and I think it is because of the changes in core/modules/system/config/schema/system.schema.yml as we have a empty profile in the test and stark theme isn't installed.

    So what should we do here ?, just install stark at the start (which seems difficult without the container) and i was wondering would we encounter a similar problem while using recipes on a real site using the empty profile.

  • Pipeline finished with Failed
    6 months ago
    Total: 176s
    #171538
  • First commit to issue fork.
  • Pipeline finished with Failed
    6 months ago
    Total: 546s
    #171735
  • Pipeline finished with Failed
    6 months ago
    Total: 1629s
    #172164
  • Pipeline finished with Failed
    6 months ago
    Total: 532s
    #172241
  • Pipeline finished with Failed
    6 months ago
    Total: 631s
    #172308
  • Pipeline finished with Failed
    5 months ago
    Total: 670s
    #195428
  • Pipeline finished with Failed
    5 months ago
    Total: 226s
    #195444
  • Pipeline finished with Failed
    5 months ago
    Total: 539s
    #195448
  • Pipeline finished with Failed
    5 months ago
    Total: 591s
    #196143
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kunal.sachdev

    kunal.sachdev โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    5 months ago
    Total: 550s
    #197056
  • Pipeline finished with Failed
    5 months ago
    Total: 659s
    #197256
  • Pipeline finished with Failed
    5 months ago
    Total: 620s
    #198609
  • Pipeline finished with Failed
    5 months ago
    Total: 544s
    #198766
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kunal.sachdev

    The test is failing because in RecipeRunner::installTheme() we do

    \Drupal::service('theme_installer')->install([$theme]);
    

    and in ThemeInstaller we have

    $extension_config
            ->set("theme.$key", 0)
            ->save(TRUE);
    

    which also tries to validate the config and it breaks for ExtensionExistsContraint with error message 'Theme stark is not installed', which is true.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    That's why I wonder if ExtensionExists really makes sense in the context of core.extension.

    The core.extension config is the source of truth about what extensions are installed. ExtensionExists is basically validating against that, at the end of the day, and therefore it doesn't make a ton of sense for core.extension to have that constraint, does it?

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kunal.sachdev

    @phenaproxima I think this comment ( #18 ๐Ÿ“Œ Add validation constraints to system.theme Needs work ) was meant for ๐Ÿ“Œ Add validation constraints to core.extension Needs review .

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia yash.rode pune

    yash.rode โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    5 months ago
    Total: 469s
    #213574
  • Pipeline finished with Failed
    4 months ago
    Total: 540s
    #224421
  • Pipeline finished with Failed
    4 months ago
    Total: 462s
    #224454
  • Pipeline finished with Failed
    4 months ago
    Total: 476s
    #224577
  • Pipeline finished with Success
    4 months ago
    Total: 925s
    #224609
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia yash.rode pune

    In this commit I have added fix from ๐Ÿ“Œ Add validation constraints to core.extension Needs review . We do not need to block this issue on it as whichever gets merged first is fine.

  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Coming along, but I think we can tighten it up a bit.

  • Pipeline finished with Failed
    4 months ago
    Total: 157s
    #226229
  • Pipeline finished with Failed
    4 months ago
    Total: 825s
    #226246
  • Pipeline finished with Success
    4 months ago
    Total: 918s
    #226272
  • Pipeline finished with Success
    4 months ago
    Total: 961s
    #226514
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia yash.rode pune
  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Looking pretty good; a few more suggestions. I think we also need test coverage of the changes to ExtensionExistsConstraintValidator.

  • Pipeline finished with Failed
    4 months ago
    Total: 173s
    #227519
  • Pipeline finished with Success
    4 months ago
    Total: 462s
    #227531
  • Pipeline finished with Success
    4 months ago
    Total: 489s
    #227559
  • Pipeline finished with Failed
    4 months ago
    Total: 171s
    #227815
  • Pipeline finished with Failed
    4 months ago
    Total: 155s
    #227821
  • Pipeline finished with Success
    4 months ago
    Total: 469s
    #227829
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia kunal.sachdev

    Added test coverage for the changes to ExtensionExistsConstraintValidator. Also we have update path and its test so removing the related issue tags.

  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    I have very few remaining complaints here! And frankly, they're pretty minor.

  • Pipeline finished with Failed
    4 months ago
    Total: 195s
    #230828
  • Pipeline finished with Success
    4 months ago
    Total: 760s
    #230834
  • Status changed to Needs review 4 months ago
  • Status changed to RTBC 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Ship it.

  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    I left suggestions and some questions in the MR and I tried to resolve many of the threads.

    I would accept some of the comment suggestions but I have to leave. So, setting to needs work for comments.

  • Pipeline finished with Canceled
    4 months ago
    Total: 67s
    #240697
  • Status changed to RTBC 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Addressed @quietone's feedback. Everything was comment changes, but I decided to also make the event subscriber final, merely to be explicit about the intention. Since that's not a substantive change, I'm going to tentatively restore RTBC here in the hopes that tests will pass.

  • Pipeline finished with Failed
    4 months ago
    Total: 475s
    #240698
  • Status changed to Needs work 3 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    There are Merge conflicts now.

  • Pipeline finished with Failed
    3 months ago
    Total: 560s
    #251666
Production build 0.71.5 2024