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:
- missing action schemas for node delete and unsticky (later of which is actually there but misnamed)
- noexistent array type used in menu_ui.schema.yml
- add missing views language filter value schema
- add missing comment field schemas
- 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.
Comment | File | Size | Author |
---|---|---|---|
#18 | 2268975-fix-missing-schema-14-fixes-only.patch | 5.7 KB | Gábor Hojtsy |
#16 | 2268975-fix-missing-schema-14-test-only.patch | 969 bytes | Gábor Hojtsy |
#14 | 2268975-fix-missing-schema-14.patch | 6.64 KB | Gábor Hojtsy |
#12 | 2268975-fix-missing-schema-12.patch | 6.73 KB | Gábor Hojtsy |
#12 | interdiff.txt | 2.41 KB | Gábor Hojtsy |
Comments
Comment #1
Gábor HojtsyFound 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
Comment #2
Gábor HojtsyThe 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:
Comment #4
vijaycs85Few 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.
Comment #5
Gábor Hojtsy#2266501: Array level schema errors are not reported, fix wrong schemas identified was comitted, this would not apply anymore.
Comment #6
Gábor HojtsyWhile 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.
Comment #7
Gábor HojtsyYeah with this patch, indeed the following two things still appear as falling back to default:
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.
Comment #8
Gábor HojtsyUpdated #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 :)
Comment #9
Gábor HojtsyComment #10
Gábor HojtsyAll right, this is the only patch we have that fixes existing schemas now :) How do we add tests to prove this is good? :)
Comment #11
vijaycs85may be we can add tests that can exclude the ones that we know don't exist?
Comment #12
Gábor HojtsyThanks @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...
Comment #14
Gábor HojtsyRerolled to apply. No changes.
Comment #16
Gábor HojtsyThat 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.
Comment #18
Gábor HojtsySo then the fixes only, given the test only one proves Drupal would not install without the fixes and #6 proved the fixes worked.
Comment #19
Gábor HojtsyComment #20
Gábor HojtsyComment #21
vijaycs85Looks good to me.
Comment #22
alexpottCommitted 40cb3b0 and pushed to 8.x. Thanks!
Comment #24
Gábor HojtsyYay, thanks!