Problem/Motivation
Whilst discussing #2316909: Revisit all built-in test/default views configuration in core with @catch, @effulgentsia, @webchick and @xjm since it was tagged with "revisit before release candidate", we decided that we need to ensure that the configuration shipped with core in yml files matches the configuration in the active store after it is installed. This is important since incorrect default configuration can cause unexpected bugs and confusion for developers.
Proposed resolution
Revisit all configuration and make sure auto generated with latest config/plugin/schema changes.
This was done before whilst creating many of the configuration schema. For example, #2316909: Revisit all built-in test/default views configuration in core and the beginnings of a script to do this is available at https://gist.github.com/alexpott/f0650fbb7954df8497e4
Remaining tasks
Discuss what we should do about config provided by test modulesRe-export the files in the installation profileAdapt the config_refresh module to also export optional default config, see #2568459: Configurations in config/optional is not getting updatedUse the former to also export all optional config in core/modules core/profiles/(standard|minimal)- Currently the patch contains mainly out of two parts: a) reordering of existing config b) adding defaults values back. In order to make it easier to review the first patch we could do the following: Write a script which looks at all the config files in HEAD and sorts it strictly alphabetically. We then could do the same with the files after this patch.
When we then compare these two sets of files we have excluded the orderings and the only remaining bits are additions/removals. - Review
User interface changes
None
API changes
None
Data model changes
Should be none
Comment | File | Size | Author |
---|---|---|---|
#92 | interdiff.txt | 13.89 KB | dawehner |
#92 | 2567183-92.patch | 143.31 KB | dawehner |
#90 | 2567183-90.patch | 144.13 KB | dawehner |
#88 | interdiff.txt | 0 bytes | dawehner |
#88 | 2567183-88.patch | 144.33 KB | dawehner |
|
Comments
Comment #2
alexpottComment #3
iantresman CreditAttribution: iantresman commentedDoes this include whether
sites/default/settings.php
should be in YML format?Comment #4
alexpott@iantresman nope. This is about ensuring that things like
core/modules/node/config/install/node.settings.yml
andcore/modules/node/config/install/node.settings.yml
are not unexpectedly changed during installation.Comment #5
catch@iantresman no it's only for existing default YAML configuration. The last time we did it, quite a lot had diverged subtly from how it would have been created new in core, so this is a case of re-exporting everything so it matches. There's an issue somewhere about moving more things to container parameters out of settings, although can't find it at the moment.
Re-titling so try to make the scope clearer.
Comment #6
dawehnerJust a quick question for reviews later ... is this issue just about default configuration or also configuration shipped with test modules?
Comment #7
jibran+1 for all the configuration of all modules test or otherwise.
I think we should add a console command in follow up to export that automatically so that contrib can also use that.
Comment #8
vijaycs85We have a module Configuration Refresh based on @alexpott's script (https://gist.github.com/alexpott/f0650fbb7954df8497e4), but it might need to be updated with current head :(
Comment #9
webchickWell, to kick things off: #2567505: Get it working again.
Comment #10
dawehnerI'll give it a try for a while.
Comment #11
dawehnerI'll give it a try for a while.
Pretty neat shell line to enable all modules:
ls | xargs drush -y en
Using #2567505: Get it working again. I could produce the following changes:
Comment #13
aspilicious CreditAttribution: aspilicious commentedShould config in the installation folder contain a uuid?
Comment #15
dawehnerThis adds some proper test coverage and changes back some of the changes which got caused by the fact that language module was enabled on those exports.
You talk about the examples in image.*, right? Good question.
Well, its what HEAD already does. I think its kinda similar to what panels does in D7
Comment #18
vijaycs85#13: looks like historically, it was a YES(#1969800: Add UUIDs to default configuration) and then NO(#2110615: Do not ship with default UUIDs) and then YES for part of it(#2110615-65: Do not ship with default UUIDs) and image styles are one of them.
Comment #19
hussainwebThis should at least fix the failure in
CommentFieldNameTest
. The changes are in interdiff.The problem is here. These permissions are actually given by the standard profile but now we are assigning them in the user module itself. This doesn't seem right. For example, minimal profile does not enable the contact module but these permissions would be assigned anyway. The problem was that the testing profile didn't give this permission earlier and the test passed. Now, user module gives this permission and the test fails.
Of course, this takes us to the question of if we can use this approach to solve this problem. I am guessing that the site's config export may not match the YAML in modules itself as the profiles will almost definitely change settings. I am of an opinion that differences such as these are okay.
Comment #20
hussainwebThe patch in #19 should also fix problems in shortcut tests - same explanation as above.
Comment #23
dawehnerThe interdiff in https://www.drupal.org/files/issues/interdiff-15-19_1.txt absolutely makes sense!
Well, we have to remove all permissions, so it actually matches the previous default.
On top of that I skipped the simpletest settings, not sure what is going on there yet.
We needed another fix, as system and user did not installed their default config, because they have been installed in the test earlier already.
On top of that the list of modules to test are now ordered alphabetically.
Comment #24
alexpottWe need to preserve comments.
Comment #25
dawehnerGood catch!
While reading the diff again I also realized that the path module sneaks in entries for the taxonomy config.
Comment #26
dawehnerAdded a followup: #2568077: Re-export all test configuration
Comment #27
dawehnerJust putting to needs work, as we need to care about installation profiles, but for sure, reviews would be nice!
Comment #28
Wim LeersConsistent ordering!!!!
<3 <3
The nitpicker in me rejoices!
Why are these being removed? Not saying it's bad, I would just like to understand.
<3
Fantastic!
Shouldn't we create this list automatically? Or would a missing or extraneous module trigger fails anyway?
Comment #29
dawehnerI guess we could just scan the files available in core/modules and be done with it? I was just too lazy to be lazy.
It somehow happens when you save an entity without any third part settings. I'm not sure either where it actually happens.
Some intermediate work dealing with the install profile. Currently the test installs the config from system and then installs standard profile, but standard profile seems not to override
config from system yet.
Comment #30
dawehnerJust
for now.
Comment #33
dawehnerAfter talking with alex we agreed that the install profile one should be a web test, to be 100% sure.
Comment #34
dawehnerWe have now some proper test coverage, let's get the review started.
Comment #39
dawehner* Fixed the failures
* Exported the minimal files as well
* Added a test for the minimal install profile
Comment #40
tim.plunkettIncorrect and out of scope change
Don't profiles count as modules? All of these say null.
Comment #41
Wim Leers?
Comment #44
alexpottre #28.2 ConfigEntityBase::toArray() removes empty third party settings. I've debated creating an issue to do the same for dependencies many time.
Comment #45
dawehnerAh good to know. Thanks alex.
No idea why this happens, but well, its what is there. I guess what we want to do is to actually remove 'provider' from Block entity as its not used at all?
For now this just addresses the feedback + redness of the patch
Comment #47
dawehnerExpanding the issue summary to explain the steps we need to take care off, together with some ideas how to improve the reviewability of this patch and what to do as well.
Have fun!
Comment #49
dawehnerComment #53
dawehnerNo testbot you are drunken!
Comment #56
larowlanworking on fails
Comment #57
larowlan@dawehner pointed out there are no failures, pifr bot is playing up
Comment #58
larowlan"database or disk is full"
Comment #59
dawehnerWell, let's ignore the old testbot then.
Comment #60
Wim Leers<strike>
-><s>
in the issue summary's remaining tasks, to make it actually clear what has already been done without reading HTML :PComment #61
Wim Leersd.o does not allow
<s>
, but does allow<del>
. Oh, d.o…Comment #63
Wim LeersI reviewed the entire patch, including looking for things mentioned in this part of the remaining tasks:
Though I would like official confirmation that we do special case
langcode
,status
,dependencies
,id
andlabel
. Those five are always listed first, and always in that order.Nice, from multiple to one :)
/me points at #2464427: Replace CacheablePluginInterface with CacheableDependencyInterface with a sad expression, which was RTBC >2.5 months ago, and has since been blocked on upgrade path criticals that it kept uncovering.
We'll have to re-export all Views config such as this one after that lands.
Hrm, strange… elsewhere, we don't see single quotes around strings IF those strings don't contain spaces.
That seems inconsistent?
Nice catch!
Though I wonder if this shouldn't be
forum
module that owns this?This is not alphabetically sorted.
Not sorted alphabetically.
Not sorted alphabetically.
So it also seems we add quotes if there is a colon in the string. I wonder why?
Does YAML assign special meaning to string values with colons? Could it for example be something namespaced?
Just asking, because it'd be more legible if this were not quoted. Or otherwise, if it all were consistently quoted.
Why the quotes?
I wonder if we don't just want to make a new base class that extends
InstallerTestBase
, which can then be used to test every profile without repeating this.s/$profile/$this->profile/
Nit: missing newline in between.
s/$profile/$this->profile/
This one I understand.
This one I don't understand.
Oh, it's because of
in
\Drupal\filter\Entity\FilterFormat::toArray()
. Which is … bizarre, but definitely out of scope of this issue to fix.Not sorted alphabetically.
Huh, a
provider
not at the top level but insettings
?Apparently this is a thing, see
block_settings
incore.data_types.schema.yml
. So even if this is wrong, fixing it is out of scope here.It's fascinating that top-level
third_party_settings
are omitted by default, but nested ones aren't.Why are these changes correct? Is there something else that is causing
langcode
to be hidden? Or is it hidden by default?Hah! That makes sense :)
This is another interesting change. We should double-check that this is correct.
Also, again the strange quoting thing (quotes when colon is present).
Incomplete docs.
s/Its/It's/
or
s/Its/It is/
This first confused me, but then I realized this is a KernelTestBaseNG test. Nice! :)
s/compare it/comparing them/
Comment #64
dawehnerYeah, that is life.
Well, this happened automatically. Not sure entirely why to be hoenst though.
Well, this all happened automatically, so yeah this is the right thing do, as it seems. the module is probably the module of the field type.
But this is not the point. Its exported how the config system saves stuff (see '* config_export = {' for example). Just have a look at
... its not sorted in any western alphabet I am aware of.
Seems so, at least this is how your YML parser/writer works.
Yeah, why not, but I guess we would not save much.
Indeed. You know, its documented right above there :)
If you save such a thing without language module enable, it is not there. Well we can readd them, but I think its not needed.
Well, this also happened automatically and IMHO makes sense.
It is not that bad, right?
Comment #65
dawehnerNote: Without those removals, they are removed on install.
Addressed the feedback from wim.
Comment #66
nedjoNice work.
Should filter.format.full_html have a config dependency on user.role.administrator? Ditto elsewhere when anonymous and authenticated roles (provided by user module) are listed.
Comment #67
dawehnerGood observation! Opened an issue for that: #2569741: [PP-1] FilterFormat should add the roles as config dependencies
Comment #68
larowlanMerged this with #1920902: Add a Drupal Yaml wrapper so we can default to PECL Yaml component if it is available which has tests that ensure our YAML is valid for both symfony/yaml and the PECL YAML extension.
Passed all tests - which means we're not introducing any regressions here on that front.
Comment #69
dawehner@larowlan
--group Serialization?
Comment #70
nedjoFiled #2571187: EntityReferenceItem should add the target_bundles as config dependencies for what looked like another missing config dependency.
Comment #71
pfrenssenGoing to review.
Comment #72
pfrenssenThese are indeed quoted by the Yaml dumper.
Symfony\Component\Yaml\Dumper::dump()
is the entry point, but the most relevant parts are:\Symfony\Component\Yaml\Inline::dump()
does some basic type checks for booleans, numeric values etc.\Symfony\Component\Yaml\Escaper::requiresDoubleQuoting()
checks when double quotes are needed. This seems to be for very specific ASCII characters, the list contains things like[\\x00-\\x1f]
etc.\Symfony\Component\Yaml\Escaper::requiresSingleQuoting()
is the one that is responsible for deciding when single quotes are used. Indeed if whitespace, a colon, a "Y" or "N" or a bunch of other symbols is present in the string then it will be quoted. Here's the full code for reference:Comment #73
Wim Leers#72 thanks for clarifying — all quite strange though! I guess it's part of the YML spec?
Comment #74
pfrenssenI was going through all exported configuration but was just hitting the same things that @Wim Leers remarked earlier. It is very tiring, big respect for Wim to power through the whole thing!
I thought of creating the script to order all config alphabetically but discussed this in IRC and Wim didn't think it necessary any more since he reviewed all of it anyway.
I'll skip the rest of the exported config and go through the test coverage and the latest fixes.
Comment #75
pfrenssenIs this a common pattern, to throw an exception in the assert in the trait, then catching the exception and converting it in a fail?
Wouldn't it be easier just to call $this->fail()? Maybe this is done so to make it compatible with all possible test systems?
Typo: "its an array" -> "it's an array".
Comment #76
dawehnerWell, the thing is, for kernel/unit tests we want to throw an exception. Stop as early as possible and be done.
That
try{} / catch {}
was my way to then cause a test failure in a simpletest.Comment #79
dawehnerThere we go.
Comment #81
pfrenssenI've been looking into the
DefaultConfigTest
failure. It seems like there is nothing inherently wrong with the test, it is simply timing out.Trying to reset the timeout at the start of every test. Discussed it with @dawehner, he thinks it might be the test runner timing out, not the tests itself.
Comment #84
dawehnerI'm curious whether this is the thing what we should fix.
Sadly @pfrenssen failed to merge in the interdiff of #79
Comment #86
pfrenssenSorry I indeed forgot to merge in the interdiff, good that you saw it!
Comment #87
stefan.r CreditAttribution: stefan.r commentedHad a quick look at this and don't see any obvious problems - in talking to @dawehner and @pfrenssen they seemed optimistic about this being close to RTBC. I think this is close as well, considering the patch is green and @Wim Leers has done an extensive review of the actual config already.
This should not be needed anymore
Comment #88
dawehnerGood catch @stefan.r
Comment #90
dawehnerRebased
Comment #92
dawehner#2458763: Remove the ability to configure a block's cache max-age caused this failure.
Comment #95
Wim LeersComment #96
catchHave reviewed this a few times as it's been going along, and don't have any comments.
I think it's important to get this in, now that it is we need to try to keep the exported config up-to-date when other patches land if possible.
Committed/pushed to 8.0.x, thanks!
Comment #98
dawehnerYeah we now have tests so it will be ensured at least.
Comment #99
Wim LeersExactly! This is now one of my favorite tests for that very reason :)
Comment #100
jibranCan we have a follow up for this?