Problem/Motivation
The Export UI does this:
$form['export']['#value'] = Yaml::encode($this->configStorage->read($name));
and hence does not respect ConfigEntityTypeInterface::getPropertiesToExport()
.
The cacheability metadata in the View config entity should not be exported, but the above bug causes it to be exported anyway.
Consequently, all configuration exported through the config export UI until this is fixed will contain data that, when its schema changes, forces people to re-export or manually fix their exported config, rather than that being something that is fixed transparently.
Proposed resolution
Fix it.
Remaining tasks
TBD
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#15 | 2538348-15.patch | 8.41 KB | alexpott |
#15 | 2538348-15.test-only.patch | 3.46 KB | alexpott |
#15 | 12-15-interdiff.txt | 7.27 KB | alexpott |
#12 | 2538348-config_export-12.patch | 1.47 KB | tim.plunkett |
#3 | 2538348-config_export-3.patch | 1.65 KB | tim.plunkett |
Comments
Comment #1
Wim LeersRelevant IRC discussion:
Comment #2
tim.plunkettYeah, I wrote the config export UI in Prague, and it went in October 2013.
getPropertiesToExport() wasn't added til May 2015 :)
Comment #3
tim.plunkettComment #4
tim.plunkettlol, left that bit of debugging in
Comment #5
Wim LeersSeems to me this is important to land during the RC phase, because otherwise lots of people will end up exporting config incorrectly…
Per https://groups.drupal.org/node/484788, I cannot actually add that tag, but I did anyway for clarity. So, also added the "Needs committer feedback" tag and assigning to Alex Pott, who's both a committer and the authority on the configuration system, so he can decide whether to keep or remove that tag.
Comment #6
alexpottSo this is part of a bigger concern I have about the single import export UI - it is not doing an validation that is done during a full config import... I have an issue for that somewhere.
Comment #7
alexpottComment #8
xjmComment #9
xjm@alexpott and I agreed with this going in during RC because of the implications for data integrity, developer experience, etc.
NW for tests.
Comment #10
xjmComment #11
alexpottComment #12
tim.plunkettRerolled. Still needs tests.
Comment #13
alexpottI think we also have a problem with mapFromStorageRecords / mapToStorageRecords - this was introduced for #2293773: Field allowed values use dots in key names - not allowed in config
Comment #14
alexpottSo yes we do have a problem because of #13... I tried importing a field storage for a float options field...
And this resulted in the following error:
Comment #15
alexpottHere's a patch that fixes the issue described in #14 and adds a test for it.
Comment #16
alexpottComment #17
xjmThis issue was an rc target for 8.0.0. It could also be an RC target for 8.1.0 but we can discuss that if needed.
Shouldn't the test-only patch have failed?
Comment #18
alexpottSo thinking about this some more I'm not sure that we have a bug here at all. We get the configuration to export directly from the configuration storage. The only way a configuration entity should have got there is through a config entity save which will obviously export its properties correctly. The only way the config storage can have properties which no longer exist is if there are module updates that have changed the exported properties and they haven't written a hook_update_N() or update.php has not been run yet. Neither of those situations should be handled by this form.
I think the test added in #15 is a good addition to core because field creation is always worth testing.
I'll reach out to @tim.plunkett to talk about re-scoping this issue to add the test and make it a task.
Comment #20
alexpottAfter discussing on IRC with @tim.plunkett we agreed to close this issue because
I'm going to open another issue to add the float field test coverage because:
Comment #21
Wim LeersI'm fine with #20's course of action. But I'd like an answer to the original reason for reporting this issue:
I just checked, and View config entities'
cache_metadata
is still being exported at/admin/config/development/configuration/single/export
. So, what I reported is still happening.But then I started wondering… what is actually wrong with that?
ConfigEntityType::getPropertiesToExport()
looks at theconfig_export
key in a config entity type's annotation. For theView
config entity, that is:… and since
cache_metadata
lives several levels under thedisplay
key, this is actually totally correct.So, actually …
cache_metadata
not to be exported? I now wonder if I expected that because the patch in #2318377: Determine whether a view is cacheable and its required contexts, store this i/t config entity didn't update the exported View config entity YAML files? Which was something we did quite frequently back then, which is why we've re-exported all built-in configuration in one go at a later time: #2567183: Re-export all built-in configuration in core.It's fine to re-close this with the simple statement that I was indeed completely wrong. But then… why didn't anybody call me out on that? :P
Comment #22
alexpottI totally expect cache_metadata to be exported - it is in all of our default views. If we don't want to export then we need to unset on save. Nothing is doing that.
I remember once we change where we stored the key and everything had to change. I think this is what you are referring to in #21.2