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.

Files: 
CommentFileSizeAuthor
#18 2268975-fix-missing-schema-14-fixes-only.patch5.7 KBGábor Hojtsy
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,653 pass(es). View
#16 2268975-fix-missing-schema-14-test-only.patch969 bytesGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Drupal installation failed. View
#14 2268975-fix-missing-schema-14.patch6.64 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,612 pass(es), 210 fail(s), and 132 exception(s). View
#12 2268975-fix-missing-schema-12.patch6.73 KBGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch 2268975-fix-missing-schema-12.patch. Unable to apply patch. See the log in the details link for more information. View
#12 interdiff.txt2.41 KBGábor Hojtsy
#6 2268975-fix-missing-schema-6.patch4.32 KBGábor Hojtsy
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,659 pass(es). View
#4 2268975-diff-2-3.txt2.7 KBvijaycs85
#4 2268975-fix-missing-schema-3.patch4.87 KBvijaycs85
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,249 pass(es). View
#2 interdiff.txt1.64 KBGábor Hojtsy
#2 top-level-schema-type-fixes-2.patch2.17 KBGábor Hojtsy
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,233 pass(es). View
#1 top-level-schema-type-fixes-1.patch538 bytesGábor Hojtsy
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 68,772 pass(es), 202 fail(s), and 279 exception(s). View

Comments

Gábor Hojtsy’s picture

Status: Active » Needs review
FileSize
538 bytes
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 68,772 pass(es), 202 fail(s), and 279 exception(s). View

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

FileSize
2.17 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,233 pass(es). View
1.64 KB

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

FileSize
4.87 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,249 pass(es). View
2.7 KB

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
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,659 pass(es). View

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

FileSize
2.41 KB
6.73 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Unable to apply patch 2268975-fix-missing-schema-12.patch. Unable to apply patch. See the log in the details link for more information. View

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
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 66,612 pass(es), 210 fail(s), and 132 exception(s). View

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
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Drupal installation failed. View

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
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 71,653 pass(es). View

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.