Problem/Motivation

TypedConfigManager has this code in getDefinition():

      // If we don't have definition, return the 'default' element.
      // This should map to 'undefined' type by default, unless overridden.
      $type = 'default';

If we don't have this fallback Drupal currently cannot be installed. If we record the items where fallback happens in a standard install, we get the following list in order of appearance:

action.configuration.node_delete_action
action.configuration.node_make_unsticky_action
array
views.filter_value.language
array
array
field.comment.settings
field.comment.value
field.comment.instance_settings
update.settings

Proposed resolution

Fix most instances where schema is missing in the installer. The fix includes the following:

  1. missing action schemas for node delete and unsticky (later of which is actually there but misnamed)
  2. noexistent array type used in menu_ui.schema.yml
  3. add missing views language filter value schema
  4. add missing comment field schemas
  5. fix installer code to refresh config factory when updating update.settings

This fixes all but one of the items. views.filter_value.language will still show up because default views include language filters although language module is not enabled. Views handles this as optional elements but schema does not have a concept of optional elements. Solving that is out of scope here.

Note that it is not possible to include eg. throwing exceptions in the fallback as (a) we want contrib to still have optional schema which this very condition ensures (b) there are still tests that we don't want to provide schema for which is basically the same thing and (c) there are still a whole bunch of known issues of other missing items in the runtime (although those do not appear in the installer). Other elements that appear as fallbacks and solved elsewhere are listed in #16.

Remaining tasks

Review.

User interface changes

None.

API changes

Minor API addition in FormBase: resetConfigFactory() method.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

Status: Active » Needs review
FileSize
538 bytes

Found the reason for all the 'array' items. It was entity menu settings :D

Now down to these for INSTALLATION. There are likely a lot more AFTER installation, but we can put in something to test once Drupal can at least install :D

action.configuration.node_delete_action
action.configuration.node_make_unsticky_action
search.plugin.user_search <<< solved in #2266501: Array level schema errors are not reported, fix wrong schemas identified
views.filter_value.language
field.image.value <<< solved in #2266501: Array level schema errors are not reported, fix wrong schemas identified
field.image.value <<< solved in #2266501: Array level schema errors are not reported, fix wrong schemas identified
field.comment.settings
field.comment.value
field.comment.instance_settings
update.settings
Gábor Hojtsy’s picture

The node actions were a bit confused too. There was an unsticky one but not as make_unsticky (even though make_sticky is there). Also the unpublish was not close to publish and the save had wrong cased label.

Should be down to the following:

views.filter_value.language
field.comment.settings
field.comment.value
field.comment.instance_settings
update.settings

The last submitted patch, 1: top-level-schema-type-fixes-1.patch, failed testing.

vijaycs85’s picture

Few update on the list at #2.
views.filter_value.language - Fixed, but since the language module not enabled, still it is missing on install.
field.image.value - Fixed.
field.comment.settings - Fixed.
field.comment.value - Fixed.
field.comment.instance_settings - Fixed.

update.settings - Not sure how it came in this list. We have schema for this in update module.

Gábor Hojtsy’s picture

Status: Needs review » Needs work
Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
4.32 KB

While the patch technically applied, the field.image.value schema was duplicate, it was already added in #2266501: Array level schema errors are not reported, fix wrong schemas identified. I don't think there are other overlaps.

Gábor Hojtsy’s picture

Yeah with this patch, indeed the following two things still appear as falling back to default:

views.filter_value.language
update.settings

Would be good to figure out why update.settings appears and see if we can do something about disabled modules vs. schema. One option is we parse in all the disabled module schemas, but that would not help for modules that include optional views components from modules that may or may not be enabled... Also not sure how it would affect performance just so we have some coverage for the minority case... However this questions that we can throw exceptions wholesale when parts of schemas are missing, which makes it hard/impossible to ensure that core has full schema coverage unless we can identify a small set of keys that are problematic and stick to that.

Gábor Hojtsy’s picture

Updated #2183983: Find hidden configuration schema issues with info following @catch's concerns in #2264179: Clarify use of property/undefined and add an ignore type in configuration schema. I'm not sure we can solve the throwing of exception here, but we can try :)

Gábor Hojtsy’s picture

Issue tags: +D8MI, +sprint, +language-config
Gábor Hojtsy’s picture

All right, this is the only patch we have that fixes existing schemas now :) How do we add tests to prove this is good? :)

vijaycs85’s picture

may be we can add tests that can exclude the ones that we know don't exist?

Gábor Hojtsy’s picture

Thanks @alexpott for identifying the module enable combined with a stale config factory in the install config form caused update.settings to pop up. By resetting the config factory in there, that is resolved. So now only the known views exception remains. Let's see all the rest of the fails now with that exception...

Status: Needs review » Needs work

The last submitted patch, 12: 2268975-fix-missing-schema-12.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
6.64 KB

Rerolled to apply. No changes.

Status: Needs review » Needs work

The last submitted patch, 14: 2268975-fix-missing-schema-14.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
969 bytes

That is an impressive set. Looks like the good news is these are mostly things we knew:

- migrate.* which is the overwhelming majority will be resolved with #2183957: Provide configuration schema for Migration module.
- language.config.* which is also a *lot* will be resolved with #2224887: Language configuration overrides should have their own storage
- then there are only test ones left which we said we don't want to cover
- content_translation.settings pops up a lot which was supposed to be fixed by #2224761: Add a generic way to add third party configuration on configuration entities and implement for field configuration but that got on a totally different track
- finally action.settings pops up some which is puzzling, that has a schema... may be similar to the installer use case of update.settings where the module is enabled and then config directly fiddled with

I did not look at all the fails but this seems to be covering most. So seems like no new ones uncovered, which is surprising based on my pessimistic expectation but definitely good news :D We should work on getting in the above to cut down on the fail counts here.

Looks like however we cannot add the exception for various reasons, mainly we want to keep schema optional for tests and contrib, so we cannot fail on the type fallback, it needs to just work. So we can use this technique to manually find missing core types but not as a part of the final system.

I think the fixes proposed in this issue can be proven by adding the exception and showing the installer would fail. So a with fixes and test only version would work for that IMHO. Here is a test only patch. Should hopefully fail on install.

Status: Needs review » Needs work

The last submitted patch, 16: 2268975-fix-missing-schema-14-test-only.patch, failed testing.

Gábor Hojtsy’s picture

Status: Needs work » Needs review
FileSize
5.7 KB

So then the fixes only, given the test only one proves Drupal would not install without the fixes and #6 proved the fixes worked.

Gábor Hojtsy’s picture

Title: Fix missing top level schemas on install from definition fallback » Fix named schema elements missing when installing Drupal
Issue summary: View changes
Gábor Hojtsy’s picture

Issue summary: View changes
vijaycs85’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 40cb3b0 and pushed to 8.x. Thanks!

  • Commit 40cb3b0 on 8.x by alexpott:
    Issue #2268975 by Gábor Hojtsy, vijaycs85: Fixed named schema elements...
Gábor Hojtsy’s picture

Issue tags: -sprint

Yay, thanks!

Status: Fixed » Closed (fixed)

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