Problem/Motivation

Condition plugin validation schema is wrong.

`condition.plugin` includes uuid, which is not present at all (these aren't config entities, just used inside config entities).

This might have passed unnoticed as we didn't add `FullyValidatable` to block settings until recently (#3379725: Make Block config entities fully validatable).

Proposed resolution

  • Remove uuid.
  • Make `context_mapping` not required.

Remaining tasks

Fix config schema and related tests.

User interface changes

None.

Introduced terminology

None.

API changes

None.

Data model changes

Config schema changes, but these are expected?

Release notes snippet

None.

Issue fork drupal-3525391

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

penyaskito created an issue. See original summary.

penyaskito’s picture

Title: Condition validation schema is wrong » Conditions plugin validation schema is wrong
Issue tags: +Configuration schema, +validation
penyaskito’s picture

Issue summary: View changes

Verified context_mapping applies here. But shouldn't be mandatory.

penyaskito’s picture

Issue summary: View changes
Status: Active » Needs review

Fixed config schema and related tests.

wim leers’s picture

🏓 — missing some crucial info that will be necessary for this to become committable — right now, it's not clear whether this would break contrib/custom modules 😇

This was surfaced by #3525601: Personalization Segment storage: new `Segment` config entity type.

mstrelan’s picture

Component: system.module » configuration system
penyaskito’s picture

Status: Needs work » Needs review

🏓 Back to NR for feedback.
We can definitely be extra-safe and make uuid optional instead of removing it, but Occam's Razor says this was a copypasta 10 years ago.

smustgrave’s picture

@wimleers thoughts on the comments in the MR?

smustgrave’s picture

There's 1 thread that's unanswered could that be addressed.

smustgrave’s picture

Status: Needs review » Needs work

Looking at this again won't we need an update hook, using ConfigImporter, to remove the UUID from existing config.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

borisson_’s picture

Status: Needs work » Needs review

This doesn't need that update hook, because the config currently does not reflect reality. I just grepped in my config folder for 2 projects. (both on context_mapping and visibility), in both cases the uuid does not show up.

Since both merge request comments are about the same thing, I think both are answered by this + #8.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

I actually think this is rtbc.

  • longwave committed 25c4571c on 10.6.x
    fix: #3525391 Conditions plugin validation schema is wrong
    
    By:...

  • longwave committed a5831a7d on 11.3.x
    fix: #3525391 Conditions plugin validation schema is wrong
    
    By:...

  • longwave committed fb0632b3 on 11.x
    fix: #3525391 Conditions plugin validation schema is wrong
    
    By:...

  • longwave committed 28b81cc5 on main
    fix: #3525391 Conditions plugin validation schema is wrong
    
    By:...
longwave’s picture

Version: main » 10.6.x-dev
Status: Reviewed & tested by the community » Fixed

Looks good to me too. Backported down to 10.6.x as it corrects a bug in schema.

Committed and pushed 28b81cc545f to main and fb0632b33ca to 11.x and a5831a7dc39 to 11.3.x and 25c4571c057 to 10.6.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

mxr576’s picture

Looking at this again won't we need an update hook, using ConfigImporter, to remove the UUID from existing config.

+1

And probably this should not have been merged into 11.3.x and released in 11.3.4 because it broke our automated CI pipeline and automated tests started to fail due to Drupal\Core\Config\Schema\SchemaIncompleteException.

I haven't tested it, but I assume it could happen that site install from existing configuration could also fail in "strict" environments where \Drupal\Core\Config\Development\ConfigSchemaChecker is enabled since the beginning, and \Drupal\Core\Config\Development\LenientConfigSchemaChecker could create a bunch of noise.

mxr576’s picture

This doesn't need that update hook, because the config currently does not reflect reality. I just grepped in my config folder for 2 projects. (both on context_mapping and visibility), in both cases the uuid does not show up.

It shows up in pathauto configurations.

uuid: 94138ea6-1167-4892-b511-770da955b112
langcode: en
status: true
dependencies:
  module:
    - node
id: capability_content_type
label: 'Capability content type'
type: 'canonical_entities:node'
pattern: 'capability/[node:title]'
selection_criteria:
  141d10df-0283-4b58-b275-30bcbaf561a2:
    id: 'entity_bundle:node'
    negate: false
    uuid: 141d10df-0283-4b58-b275-30bcbaf561a2
    context_mapping:
      node: node
    bundles:
      capability: capability
selection_logic: and
weight: -5
relationships: {  }

longwave’s picture

@mxr576 should we revert this and try again?

mxr576’s picture

My colleague (@morvaim) just clarified the issue we experienced related to this change and it is possible that only Pathauto was doing something special and requires fixing after this change, see #3577286: Drupal core 11.3.4 removed uuid from condition plugin schema which causes schema errors in pathauto pattern configuration.

longwave’s picture

Given this has broken pathauto I am going to revert this from 10.6 and 11.3 and re-release; this fix will then go out for real in 11.4 which gives pathauto and anyone else affected time to write their update hooks.

  • longwave committed 80d562fc on 10.6.x
    Revert "fix: #3525391 Conditions plugin validation schema is wrong"...

  • longwave committed 8b9c5ed1 on 11.3.x
    Revert "fix: #3525391 Conditions plugin validation schema is wrong"...
mxr576’s picture

Status: Fixed » Needs work

reopening the issue

longwave’s picture

Do you think there is more to do here? ie, should we revert from 11.x and main as well, or should we leave that in place and it's up to contrib modules to handle updates? Given that I don't think core can know where this schema might be used, I am not sure what more we can do from the core side.

borisson_’s picture

Status: Needs work » Reviewed & tested by the community

I agree with #30, I don't think there is more to do, I think we can move this issue back to fixed.

godotislate’s picture

Re #26/30: Do we need a change record to help prepare people for 11.4/12.0?

longwave’s picture

Version: 10.6.x-dev » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Not sure we need a change record for every schema change, just have to remember to only make them in minor releases and not patch releases.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.