Add validation constraints to system.theme

Created on 17 April 2024, about 1 year ago
Updated 22 April 2024, about 1 year 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

Active

Version

10.3

Component
System 

Last updated about 19 hours 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
    about 1 year ago
    Total: 594s
    #153318
  • Pipeline finished with Failed
    about 1 year ago
    Total: 535s
    #154006
  • Pipeline finished with Failed
    about 1 year ago
    Total: 4883s
    #154066
  • Pipeline finished with Failed
    about 1 year ago
    Total: 1079s
    #154171
  • Pipeline finished with Success
    about 1 year ago
    Total: 987s
    #155654
  • Pipeline finished with Failed
    about 1 year ago
    Total: 1510s
    #155671
  • Pipeline finished with Success
    about 1 year ago
    Total: 1109s
    #156203
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India narendraR Jaipur, India
  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States smustgrave

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

  • Pipeline finished with Canceled
    about 1 year ago
    Total: 817s
    #159384
  • Pipeline finished with Failed
    about 1 year ago
    Total: 502s
    #159390
  • Pipeline finished with Success
    about 1 year ago
    Total: 6302s
    #159412
  • Status changed to Needs review about 1 year 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 about 1 year ago
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    99% ready! :)

  • Pipeline finished with Success
    about 1 year ago
    Total: 725s
    #159632
  • Pipeline finished with Success
    about 1 year ago
    Total: 5245s
    #159669
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India narendraR Jaipur, India
  • Status changed to RTBC about 1 year ago
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
  • Status changed to Needs work about 1 year 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
    about 1 year ago
    Total: 165s
    #167383
  • Pipeline finished with Failed
    about 1 year ago
    Total: 240s
    #167410
  • Pipeline finished with Failed
    about 1 year ago
    Total: 269s
    #167492
  • Pipeline finished with Failed
    about 1 year ago
    Total: 172s
    #168436
  • Pipeline finished with Failed
    about 1 year ago
    Total: 502s
    #168442
  • Pipeline finished with Failed
    about 1 year ago
    Total: 998s
    #168571
  • Pipeline finished with Failed
    about 1 year ago
    Total: 1153s
    #168592
  • Pipeline finished with Failed
    about 1 year 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
    about 1 year ago
    Total: 176s
    #171538
  • First commit to issue fork.
  • Pipeline finished with Failed
    about 1 year ago
    Total: 546s
    #171735
  • Pipeline finished with Failed
    about 1 year ago
    Total: 1629s
    #172164
  • Pipeline finished with Failed
    about 1 year ago
    Total: 532s
    #172241
  • Pipeline finished with Failed
    about 1 year ago
    Total: 631s
    #172308
  • Pipeline finished with Failed
    about 1 year ago
    Total: 670s
    #195428
  • Pipeline finished with Failed
    about 1 year ago
    Total: 226s
    #195444
  • Pipeline finished with Failed
    about 1 year ago
    Total: 539s
    #195448
  • Pipeline finished with Failed
    about 1 year ago
    Total: 591s
    #196143
  • 🇮🇳India kunal.sachdev

    kunal.sachdev made their first commit to this issue’s fork.

  • Pipeline finished with Failed
    about 1 year ago
    Total: 550s
    #197056
  • Pipeline finished with Failed
    about 1 year ago
    Total: 659s
    #197256
  • Pipeline finished with Failed
    about 1 year ago
    Total: 620s
    #198609
  • Pipeline finished with Failed
    about 1 year 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 📌 [PP-1] core.extension should be validatable Postponed .

  • 🇮🇳India yash.rode pune

    yash.rode made their first commit to this issue’s fork.

  • Pipeline finished with Failed
    about 1 year ago
    Total: 469s
    #213574
  • Pipeline finished with Failed
    12 months ago
    Total: 540s
    #224421
  • Pipeline finished with Failed
    12 months ago
    Total: 462s
    #224454
  • Pipeline finished with Failed
    12 months ago
    Total: 476s
    #224577
  • Pipeline finished with Success
    12 months ago
    Total: 925s
    #224609
  • Status changed to Needs review 12 months ago
  • 🇮🇳India yash.rode pune

    In this commit I have added fix from 📌 [PP-1] core.extension should be validatable Postponed . We do not need to block this issue on it as whichever gets merged first is fine.

  • Status changed to Needs work 12 months ago
  • 🇺🇸United States phenaproxima Massachusetts

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

  • Pipeline finished with Failed
    12 months ago
    Total: 157s
    #226229
  • Pipeline finished with Failed
    12 months ago
    Total: 825s
    #226246
  • Pipeline finished with Success
    12 months ago
    Total: 918s
    #226272
  • Pipeline finished with Success
    12 months ago
    Total: 961s
    #226514
  • Status changed to Needs review 12 months ago
  • Status changed to Needs work 12 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
    12 months ago
    Total: 173s
    #227519
  • Pipeline finished with Success
    12 months ago
    Total: 462s
    #227531
  • Pipeline finished with Success
    12 months ago
    Total: 489s
    #227559
  • Pipeline finished with Failed
    12 months ago
    Total: 171s
    #227815
  • Pipeline finished with Failed
    12 months ago
    Total: 155s
    #227821
  • Pipeline finished with Success
    12 months ago
    Total: 469s
    #227829
  • Status changed to Needs review 12 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 12 months ago
  • 🇺🇸United States phenaproxima Massachusetts

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

  • Pipeline finished with Failed
    12 months ago
    Total: 195s
    #230828
  • Pipeline finished with Success
    12 months ago
    Total: 760s
    #230834
  • Status changed to Needs review 12 months ago
  • Status changed to RTBC 12 months ago
  • 🇺🇸United States phenaproxima Massachusetts

    Ship it.

  • Status changed to Needs work 12 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
    12 months ago
    Total: 67s
    #240697
  • Status changed to RTBC 12 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
    12 months ago
    Total: 475s
    #240698
  • Status changed to Needs work 11 months ago
  • 🇳🇿New Zealand quietone

    There are Merge conflicts now.

  • Pipeline finished with Failed
    11 months ago
    Total: 560s
    #251666
  • 🇧🇪Belgium borisson_ Mechelen, 🇧🇪

    This needs another rebase.

  • First commit to issue fork.
  • 🇳🇱Netherlands bbrala Netherlands

    Rebased and updated one deprecation message to 11.2.0 since we moved past 11.1.0

  • Pipeline finished with Failed
    3 months ago
    Total: 159s
    #461869
  • 🇺🇸United States smustgrave

    Appears to have a pipeline issue. Would you say the 2 threads are good to resolve? If they are and you can't I can do it for you.

  • 🇳🇱Netherlands bbrala Netherlands

    Fixed the phpstan issue.

    Also;

    1st comment is Wim telling what this brings us, which is not an issue to resolve.

    @quietone did leave feedback, but later wanted to commit so feel like she didnt feal to strong about it. Keeping is open to get extra attention from the committer here.

  • Pipeline finished with Failed
    3 months ago
    Total: 752s
    #461887
  • 🇧🇪Belgium borisson_ Mechelen, 🇧🇪

    Actually I think this can go back to rtbc

  • The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • 🇳🇱Netherlands bbrala Netherlands

    Rebased.

  • Pipeline finished with Failed
    3 months ago
    #468261
  • 🇬🇧United Kingdom longwave UK

    ThemeAdminUpdateTest is failing.

  • Pipeline finished with Canceled
    2 months ago
    Total: 188s
    #487900
  • Pipeline finished with Failed
    2 months ago
    Total: 847s
    #487901
  • 🇳🇱Netherlands bbrala Netherlands

    Fixed the tet error. But getting phpstan errors on function t(...) which is weird, since it is fine o_O

    Tried rebasing, updating 11.x in fork, not trying empty commit. Weird...

  • Pipeline finished with Failed
    2 months ago
    Total: 168s
    #487919
  • 🇳🇱Netherlands bbrala Netherlands

    Head is broken on phpstan.

  • Pipeline finished with Failed
    2 months ago
    Total: 1496s
    #487936
  • 🇳🇱Netherlands bbrala Netherlands

    Head fixed, still a test failing, but it seems so unrelated...

  • Pipeline finished with Success
    2 months ago
    Total: 745s
    #488091
  • 🇳🇱Netherlands bbrala Netherlands

    Rebased, all green. yay.

  • 🇺🇸United States smustgrave

    Before

    After

    Resolved what threads I could but restoring status

  • Status changed to RTBC 13 days ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Credits

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Left some comments on the MR, thanks for working on this one

Production build 0.71.5 2024