Problem/Motivation

System module settings has 2 property paths that are not yet validatable:

vendor/bin/drush config:inspect --filter-keys=system.file --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.file                              Correct   67%           ✅❓   ValidKeys: '<infer>'                      
   system.file:                            Correct   Validatable   ✅✅   ValidKeys: '<infer>'                      
   system.file:_core                       Correct   Validatable   ✅✅   ValidKeys:                                
                                                                            - default_config_hash                   
   system.file:_core.default_config_hash   Correct   Validatable   ✅✅   NotNull: {  }                             
                                                                          Regex: '/^[a-zA-Z0-9\-_]+$/'              
                                                                          Length: 43                                
                                                                          ↣ PrimitiveType: {  }                     
   system.file:allow_insecure_uploads      Correct   Validatable   ✅✅   ↣ PrimitiveType: {  }                     
   system.file:default_scheme              Correct   NOT           ✅❓   ⚠️  @todo Add validation constraints here  
   system.file:temporary_maximum_age       Correct   NOT           ✅❓   ⚠️  @todo Add validation constraints here  

Steps to reproduce

Proposed resolution

Add validation constraints to:

  1. system.file:default_scheme
  2. system.file:temporary_maximum_age

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3436096

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

srishtiiee created an issue. See original summary.

naveenvalecha made their first commit to this issue’s fork.

srishtiiee’s picture

Status: Active » Closed (duplicate)
srishtiiee’s picture

Version: 11.x-dev » 10.3.x-dev
Status: Closed (duplicate) » Needs work

srishtiiee changed the visibility of the branch 3436096-add-validation-constraints to hidden.

srishtiiee’s picture

Version: 10.3.x-dev » 11.x-dev
wim leers’s picture

Tests are failing and I think we can fix that by just pushing the latest origin/11.x to this issue fork 🤞

wim leers’s picture

Review posted on MR — if I'd found nothing in my review, then I'd have done #9 for you — but since I can't RTBC this yet anyway, I'll let you handle #9 too 🤓

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

yash.rode’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new95.66 KB

On a standard profile install on 11.x
Installed configuration inspector and applied the MR

validated

Shows that the system.file is fully validated.

Checking the MR everything appears to have a return type

Believe this one is good to go.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

If path is deprecated we should deprecate it. See https://www.drupal.org/about/core/policies/core-change-policies/drupal-d...

Added some review comments.

yash.rode’s picture

Status: Needs work » Needs review

Addressed feedback from #14

narendrar’s picture

Status: Needs review » Needs work

I think as per #14, a deprecation message needs to be added for path in system.schema.yml before removing it completely here.

yash.rode’s picture

Status: Needs work » Needs review
narendrar’s picture

Status: Needs review » Reviewed & tested by the community

Changes looks good to me.

catch’s picture

Status: Reviewed & tested by the community » Needs work

One question on the MR.

borisson_’s picture

I agree with catch in #19, moving this to Drupal\Core\Config seems like a better solution, let's do that.

bbrala made their first commit to this issue’s fork.

bbrala’s picture

Status: Needs work » Needs review

Updated the class namespace as suggested, did do a rebase to clean up.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Back to rtbc now that it is moved.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

If we changing the 10.3 database dumps because of invalid schema this points to us needing an update function. I think we should not be changing the dumps.

Also I think we should be adding a new constraint that works like callback but uses the class resolver service to my more flexible.

bbrala’s picture

Status: Needs work » Needs review

So, the path config key was deprecated in Drupal 8.8 it seems (https://www.drupal.org/node/3039255). That kinda feels out of scope of this change, the fact is that it will need to go through deprecation? I don't even really see any usage in core, but that could be my search skills failing me.

But i don't feel we should do that here. Hopefully you agree.

bbrala’s picture

Status: Needs review » Needs work

Waiting for build, since i had some ci issues ;x

bbrala’s picture

Status: Needs work » Needs review

Adjusted it to actually do what was asked for.

Did revert the deprecation message for the path property. Would like to know if we need to make the change here, or if we should defer that. Seems like that has been here for quite a while. I do think we might be able to ignore it here, since it doesnt seem to be used.

Edit:
A possible update would be:

function system_post_update_remove_path_key(): void {
  if (\Drupal::config('system.file')->get('path') !== NULL) {
    \Drupal::configFactory()->getEditable('system.file')
      ->clear('path')
      ->save();
  }
}

Edit 2:
After reading #3400368: Deprecate path.temporary in system.file configuration schema it was mostly path.temporary that was deprecated. Although it seems that was the only key that used that. So the deprecation does make sense, and an upgrade path also make sense to remove the key from the config.

Lets do that.

bbrala’s picture

Status: Needs review » Needs work
bbrala’s picture

Status: Needs work » Needs review

Ok, lets try again. Seems good now.

bbrala’s picture

#3517070: Remove system.file.path config from system.schema.yml created to do the deprecation and upgrade path

bbrala’s picture

Title: Add validation constraints to system.file » [PP-1] Add validation constraints to system.file
Status: Needs review » Postponed

Postpone on child issue.

bbrala’s picture

Title: [PP-1] Add validation constraints to system.file » Add validation constraints to system.file
Status: Postponed » Needs work

Child is committed

bbrala’s picture

Status: Needs work » Needs review

Pipe is all green after the upgrade stuff in the child. Think we are there.

bbrala’s picture

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative
StatusFileSize
new60.48 KB
new61.75 KB

Using configuration inspector

before

after

Does the new constraint need a CR? I vote yes but don't want to hold it up on that.

Rest appears to be addressed

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 63187d5 and pushed to 11.x. Thanks!

bbrala’s picture

Published a change record

  • alexpott committed 68b8b571 on 11.x
    Issue #3436096 by yash.rode, bbrala, srishtiiee, naveenvalecha,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.