- Issue created by @wim leers
- Assigned to wim leers
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Taking this on because nobody seems interested ๐
- @wim-leers opened merge request.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Tests are pesent since 8fc9f0b7.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
I just pushed
537e40d78cb8457979a12169f4bcfe823ede4d06
.Well well now we find ourselves in a pretty much impossible position:
- According to
\Drupal\menu_ui\MenuForm::form()
,description
is optional. - But according to
\Drupal\system\MenuInterface::getDescription()
, the return type is alwaysstring
, notstring|null
, so that implies it's not optional.
This means that the reality is that the empty string is in fact treated as an acceptable value ๐
The same pattern applies to:
ContactForm
's\Drupal\contact\ContactFormInterface::getMessage()
Vocabulary
's\Drupal\taxonomy\VocabularyInterface::getDescription()
This leaves only 3 simple solutions (more complex solutions are always possible!):
- โ truly make it an optional value, but this requires a BC break for
MenuInterface::getDescription()
(and a number of other classes) โ not acceptable - introduce an additional config schema type because a description/message is conceptually not at all a "label", but just an optional translatable long string/piece of text
- switch to the
Length
constraint.
The second choice is IMHO the best one. But it technically constitutes a data model change, even though virtually nobody is using config schema. The third choice is arguably the least disruptive, but also makes config schema validation less meaningful. The second choice is theoretically disruptive but clearly moves the entire config/config schema system to a place where all data & metadata becomes more meaningful.
Because the disruption is so highly theoretical, I'm for now going with option 2. And actually โฆ the needed config schema type already exists:
# Human readable string that can contain multiple lines of text or HTML. text: type: string label: 'Text' translatable: true
Did that in
5630efacd75a70cb115bd3feae4b198a7e374bf2
. - According to
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
The failures in
\ValidKeysConstraintValidatorTest
, are failing because the
defaultsystem.site
configuration hasslogan: ''
andname: ''
, but both are oftype: label
, so those trigger validation errors too.In the case of
name
, it's only triggering a validation error because kernel tests bypass the installer (which would require the user to enter a site name).In the case of
slogan
, the use oftype: label
is simply inappropriate.Fixed in
eb066c37002c7010e5157271056ad99b4b1c2461
. - Issue was unassigned.
- Status changed to Needs review
almost 2 years ago 5:03pm 21 March 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
This should now be green! ๐ฅณ
Will update the issue summary tomorrow, calling it a day.
- Status changed to Needs work
almost 2 years ago 5:31pm 21 March 2023 - ๐บ๐ธUnited States phenaproxima Massachusetts
Some questions arise...
- Assigned to wim leers
- First commit to issue fork.
- Status changed to Needs review
almost 2 years ago 2:22pm 22 March 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Determined the root cause: #2144413: Config translation does not support text elements with a format โ 's logic combined with
config_translation_config_schema_info_alter()
not documenting reality ๐ฌThis MR indeed makes the site slogan not show up in the translation UI:
(Left = MR, right = HEAD.)
--- a/core/modules/config_translation/config_translation.module +++ b/core/modules/config_translation/config_translation.module @@ -181,6 +181,7 @@ function config_translation_entity_operation(EntityInterface $entity) { function config_translation_config_schema_info_alter(&$definitions) { $map = [ 'label' => '\Drupal\config_translation\FormElement\Textfield', + 'string' => '\Drupal\config_translation\FormElement\Textfield', 'text' => '\Drupal\config_translation\FormElement\Textarea', 'date_format' => '\Drupal\config_translation\FormElement\DateFormat', 'text_format' => '\Drupal\config_translation\FormElement\TextFormat',
makes the test pass but actually makes things worse:
(Left = MR, middle = HEAD, right = MR + aforementioned one line change.)
But
config_translation_config_schema_info_alter()
said:Other translatable types will appear as a one line textfield.
โฆ apparently that is really to mean that only config schema types can be marked
translatable: true
; a concrete config schema apparently is not allowed to specify it! Or rather, it's allowed (no validation error occurs), but it's not supported by Config Translation. Whether that's intentional or accidental is unclear. I suspect it's intentional.Turns out that there's at least two crucial follow-ups that never happened:
- ๐ Document configuration schema with a dedicated @config_schema_api @defgroup Active
- #2275865: Per language settings (vs translated settings) are not directly supported โ
Given that it's intentional, the solution is actually fairly simple:
- Introduce
type: translatable_string
, in addition totype: label
andtype: string
. Change record created: https://www.drupal.org/node/3349638 โ - Update the site
slogan
to use this type instead. - Follow-up to trigger validation error for config schema declaring
translatable
in concrete config schema, since it is only allowed in type definitions.
Just did that in
d394d6f09f1705b925da689970e3783f44d85680
๐ - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Follow-up created, including patch: ๐ Config Translation only supports `translatable: true` at the top level, but has no validation to indicate this Needs work .
- ๐ง๐ชBelgium borisson_ Mechelen, ๐ง๐ช
I went trough this MR a couple of times and the code looks ready to me. I agree with the approach taken in #5 and I think that will not be an issue in practice regarding BC.
We will need a change record to announce that new type, so adding the tag for that.This comment can be considered a +1 on rtbc already, but not setting it to that because of the change record and issue summary update that are needed. I also think that that someone with more insight on the BC implications would need to comment on the change as well.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
We will need a change record to announce that new type, so adding the tag for that.
Did that yesterday already: https://www.drupal.org/node/3349638 โ .
Will update the issue summary later today.
- ๐ฎ๐ณIndia rajeshreeputra Pune
Overall changes looks good, so +1 for RTBC.
- ๐บ๐ธUnited States smustgrave
Only moving to NW for the issue summary update
Looking at MR 3690 it appears all threads have been answered.
Applied the patch locally to checkout the tests.
Reverted core/modules/taxonomy/config/schema/taxonomy.schema.yml and core/modules/contact/config/schema/contact.schema.yml
Ran testLabelValidation against those two sets and got Failed asserting that two arrays are identical. - last update
over 1 year ago 29,396 pass - last update
over 1 year ago 29,396 pass - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
While working on the issue summary update, I noticed/realized that #11 should be applied to all places where
{ type: label }
was being changed to{ type: string, translatable: true }
, not only for the site slogan (which happens to be the one thing with test coverage).So: applying it to those too.
- Issue was unassigned.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
- Merged in all upstream
10.1.x
changes - Updated issue summary
- Merged in all upstream
- Status changed to RTBC
over 1 year ago 12:46pm 28 April 2023 - ๐ง๐ชBelgium borisson_ Mechelen, ๐ง๐ช
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Fixed markup.
#19: thank you! ๐ ๐
Agreed. Created ๐ Test to assert every config property path that has `translatable: true` can be translated using the UI Active for this.
- last update
over 1 year ago 29,396 pass - ๐ฌ๐งUnited Kingdom joachim
> Virtually every configuration entity has a label. There is no validation on this at all. There is a lot of freedom in what this string contains, but one thing is certain: it should not be empty.
This is a great feature, but I'm confused -- ConfigEntityBase has no validate(), so where will config entities get validated?
The validate() method is on FieldableEntityInterface, so only content entity types have it.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
This is a great feature, but I'm confused -- ConfigEntityBase has no validate(), so where will config entities get validated?
Correct. Nothing is using it yet. Because not a single piece of configuration is 100% validatable by config.
See ๐ฑ [META] Untie config validation from form validation โ enables validatable Recipes, decoupled admin UIs โฆ Active .
- last update
over 1 year ago 29,401 pass - last update
over 1 year ago 29,408 pass - last update
over 1 year ago 29,409 pass - last update
over 1 year ago 29,410 pass - last update
over 1 year ago 29,413 pass - Assigned to wim leers
- Status changed to Needs work
over 1 year ago 5:35pm 11 May 2023 - ๐ฌ๐งUnited Kingdom alexpott ๐ช๐บ๐
Wim Leers โ credited alexpott โ .
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Had a long discussion with @alexpott in Drupal Slack about this.
His initial reaction:
That is one disruptive change :)
I feel that we should be deprecating label and introducing two new schema types
I agree that empty labels are a big issueMy initial reaction: โ sad laughter followed.
His follow-up question was โฆ another great question. I started responding. And that's when I realized that telling people to move from
type: label
totype: translatable_string
is difficult to convey. Plus, there are cases where things are labels, but they are optional: theprefix
andsuffix
settings on e.g.integer
fields. They both default to the empty string (see\Drupal\Core\Field\Plugin\Field\FieldType\IntegerItem::defaultFieldSettings()
).That's why the MR changes their config type:
@@ -705,10 +713,10 @@ field.field_settings.integer: type: integer label: 'Maximum' prefix: - type: label + type: translatable_string label: 'Prefix' suffix: - type: label + type: translatable_string label: 'Suffix'
But โฆ that's where I realized @alexpott was right from the very beginning: itโs easier to flip things around:
- keep
label
unchanged: do not add validation constraints to them - instead, add a new
required_label
, which all code is then free to adopt
So then we end up with:
string
= string, NOT translatablelabel
= string, translatablerequired_label
= string, translatable, REQUIRED
(Because optional labels still have a use case, for example this prefix/suffix thing.)
@alexpott on that conclusion:
Let's do this! ๐ช
- keep
- last update
over 1 year ago 29,418 pass 9:21 8:55 Running- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 11:40am 12 May 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Wow, that was a lot more change. But likely reduces future disruption. ๐
(None of the disruption would have happened immediately because as @joachim asked: "what would the impact be?" โ none for now, since config validation is not used anywhere, because not a single piece of configuration has 100% validation constraint coverage.)
Having done this โฆI now do wonder if @alexpott was on to something when he pondered whether we should deprecate
type: label
: Would it be clearer/simpler if we deprecatedtype: label
and forced everyone to choose between a newtype: optional_label
vstype: required_label
? ๐ค - last update
over 1 year ago 29,279 pass, 30 fail - Status changed to Needs work
over 1 year ago 1:50pm 12 May 2023 - ๐ง๐ชBelgium borisson_ Mechelen, ๐ง๐ช
Tests seem to indicate something is still broken.
- Assigned to wim leers
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
I also need to update the CR.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Continuing this tomorrow.
- last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago 29,394 pass, 44 fail - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Turns out the test failures were due to a stupid mistake I made in the commit in which I changed from the
type: translatable_string
approach to thetype: required_label
approach that @alexpott recommended: I forgot to restoretranslatable: true
๐๐ฌAlso, ๐ Make assertions using ConfigEntityValidationTestBase::assertValidationErrors() clearer Fixed landed since this merge request was last updated, and that changed
::assertValidationErrors()
slightly, adjusting for that too. - last update
over 1 year ago 29,748 pass, 9 fail - last update
over 1 year ago 29,912 pass - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
To update the impact measurement, I applied #3324984-29: Create test that reports % of config entity types (and config schema types) that is validatable โ , but then I had to apply a relative patch to update expectations. That's attached. Issue summary updated.
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 9:04am 26 July 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Addressed @phenaproxima's concern from ~4 months ago on the MR thanks to the pivot in #25 + #26. Opened ๐ Add validation constraint to `type: label`: disallow multiple lines Fixed to address that instead, to keep the scope of this issue clear.
- last update
over 1 year ago 29,912 pass - Status changed to RTBC
over 1 year ago 10:46am 26 July 2023 - ๐ง๐ชBelgium borisson_ Mechelen, ๐ง๐ช
This new type is quite simple, and we are using it in a couple of places already. I would love to get ๐ KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate Fixed in first. I don't think that might expose new errors here, since we are only using this in a few new places but still think it makes sense to get that one in to ensure we don't introduce new schema errors here.
I don't see anything in this patch I don't understand anymore, and the new places this is used are all sensible. - last update
over 1 year ago Build Successful - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Merged in
origin/11.x
now that ๐ KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate Fixed landed: very curious to see if this triggers new test failures, just like @borisson_ said in #35โฆ ๐ค - Status changed to Needs work
over 1 year ago 10:27am 27 July 2023 - ๐ง๐ชBelgium borisson_ Mechelen, ๐ง๐ช
There are a couple of failures in nightwatch tests.
- Assigned to wim leers
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Actually, this triggered many hundreds of kernel test failures. Yay for ๐ KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate Fixed doing what it was intended to do!
- last update
over 1 year ago Build Successful - last update
over 1 year ago Build Successful - Issue was unassigned.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Patterns:
NodeType::create(['type' => 'someting'])->save()
โ i.e. without the label key ('name'
)- Same for
CommentType
('label'
) - Same for
ImageStyle
('label'
) - Same for
View
('label'
) - Same for
EntityViewMode
('label'
) - Same for
DateFormat
('label'
) - et cetera.
This is not surprising, given that we've specifically made config entity labels required. Which is the correct thing to do because config entities' annotations specifically indicate that the label is required.
I've done a first (very big) batch of fixing these. This is an example of how config validation helps makes test A) more reliable, B) more representative of real sites.
This also makes it clear that this would be fairly disruptive for contrib/custom modules' test coverage:
NodeType::create()
is likely to be fairly common there too. The fix is obviously trivial though โฆ but still, it has a wide (but simple) impact. So tagging . This sort of touches upon ๐ฑ [meta] Make config schema checking something that can be ignored when testing contrib modules Active โ see theif (self::convertViolationsToDeprecation($this->schema->getRoot())) {
snippet in that PoC MR to see how that could work based on any combination of conditions: core vs contrib/custom, test vs non-test, Drupal core version-dependent, โฆUnassigning, because switching to other work before starting the weekend ๐ค This is definitely available for others to continue though! ๐ Otherwise, will continue this next week!
- last update
over 1 year ago Build Successful - last update
over 1 year ago 29,107 pass, 403 fail - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago 29,536 pass, 183 fail - last update
over 1 year ago 29,639 pass, 150 fail - last update
over 1 year ago 29,711 pass, 124 fail - last update
over 1 year ago 29,790 pass, 81 fail - Assigned to phenaproxima
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Great progress here by @phenaproxima! ๐คฉ
In Slack, he raised:
phenaproxima
We need to talk about the required_label thing. Tests are failing because certain things are set as required_labels which probably shouldnโt be. As an example โ block labels. It makes sense for these to be optional. Same with layout section labels.
I can easily revert those changes to make tests pass, but my point is that we have to apply required_label somewhat judiciously. :slightly_smiling_face:
wimleers
@phenaproxima Thatโs fair. I just wanted to make it a nice & simple rule. But for blocks and layout sections it probably makes far less sense indeed :+1:I can add one more to that list: Views. Because it has this logic in
View::label()
:public function label() { if (!$label = $this->get('label')) { $label = $this->id(); } return $label; }
That already ensures Views' admin UI remains usable. ๐
- last update
over 1 year ago 29,873 pass, 24 fail - ๐บ๐ธUnited States phenaproxima Massachusetts
Re #42:
I would ask that we don't make view labels optional. To me, these are entities that absolutely should be labeled - the ID may or may not be descriptive or useful. To me, Views is doing a strange (but very Views-like) thing here by repurposing the ID as the label. We should, in my opinion, rip out that logic in a follow-up, ensure labels are required in the UI, and add an update path.
Besides, selfish reasons: it took a long time of updating the well over 100 test views scattered throughout core to ensure they all had labels. This was responsible for a BIG chunk of the test failures. I guess we don't need to revert all that work, regardless of what we chose...but to me, it's worth the pain if we make views act a little more sanely.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
๐ That works for me! ๐
Then let's add some logic to
\Drupal\views\Entity\View::label()
that detects the absence of a label and triggers a deprecation error, and says that falling back to the ID as the label will be removed in Drupal 11? - last update
over 1 year ago 29,910 pass, 15 fail - last update
over 1 year ago 29,911 pass, 6 fail - Open on Drupal.org โEnvironment: PHP 8.2 & MySQL 8last update
over 1 year ago Not currently mergeable. - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
https://git.drupalcode.org/project/drupal/-/merge_requests/3690/diffs?co... changes the update path fixture. Let's not do that. Let's revert the config schema change for
field.value.string:value
instead.It kinda doesn't make sense that
''
(the empty string) is a valid default value because that's meaningless โฆ but it's also just harmless ๐That also means less disruption and more focus in this issue. In the future, every single field type can choose to make things more strict! ๐ค
- last update
over 1 year ago 29,934 pass, 2 fail - last update
over 1 year ago 29,946 pass - last update
over 1 year ago 29,945 pass, 1 fail - last update
over 1 year ago 29,946 pass - Assigned to wim leers
- Status changed to Needs review
over 1 year ago 2:30pm 3 August 2023 - ๐บ๐ธUnited States phenaproxima Massachusetts
Welp, it's passing tests! I think this is ready. Sorry for the massive change set -- a lot of tests were previously doing the "wrong" thing (creating certain entities without labels), which is now fixed. But it meant fixing a lot of tests, and especially a lot of test views. Whew!
- ๐ง๐ชBelgium borisson_ Mechelen, ๐ง๐ช
This looks great, I found 2 nitpicks in the code, this looks very big but most of the changes are because of the change in views. I wonder if we need an update hook to change all existing views to give them the id as a label if no label has been set?
- last update
over 1 year ago 29,952 pass - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
268 files changed. ๐ณ๐ณ๐ณ ๐คฏ I think that this means it's nearly impossible to land this issueโฆ ๐
Now, don't get me wrong: every single one of the
view.*.yml
updates you made is valuable and not in vain. But I think that it's unreasonable to expect a core committer will sit through and read all of this in detail.IMHO the more reasonable approach is to ignore certain patterns, just like we did in ๐ KernelTestBase::$strictConfigSchema = TRUE and BrowserTestBase::$strictConfigSchema = TRUE do not actually strictly validate Fixed with validation constraint messages, and to then defer the concrete fixes to follow-up issues (i.e. ๐ Fix all PluginExistsConstraint constraint violations in tests Fixed , ๐ Fix all ExtensionExistsConstraint constraint violations in tests Fixed etc.)
That way, this issue would be able to land much sooner. However, that infrastructure does not yet exist. I'm introducing it over at ๐ Configuration schema & required values: add test coverage for `nullable: true` validation support Fixed , see https://git.drupalcode.org/project/drupal/-/merge_requests/4092/diffs?co... and some subsequent commits.
Using
git diff 5052fcddde7744bd1f78f21bbcfe0a502bd44cd0 HEAD -- **/views.view.*.yml
it's easy to revert (and extract!) virtually all the Views changes programmatically. The remainder I checked manually. That brings it from 268 changed files to only 166..So let's bring that infrastructure here, so that I can defer the gazillion
View
config entity updates to a separate issue. Nope, this is not really a concern, since 100% of the modified config entities are test config entities only: if they had been created through the UI, they would have had labels. Verify that ONLY test config is being modified by grepping the patch forconfig/install
andconfig/optional
and โฆ 0 matches are found! ๐๐One more non-trivial change is being made: to the Search module's migration path. So, extracting that next.
- Issue was unassigned.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
We definitely needed to revert the Search-related changes because
MigrateSearchPageTest
was not receiving updated test coverage as part of this โ which means the existing test coverage is inadequate ๐(Well,
SchemaCheckTrait
was triggering a validation error, but that's not explicit test coverage for the now more complicated migration logic. Which is exactly what made this hard to review, and what will be simple to review in a follow-up issue!)Done.
As far as I'm concerned, this is now RTBC. But I worked too much on this issue to RTBC it ๐ Will create the follow-ups for Views & Search as soon as @phenaproxima +1s what I'm proposing in #48 and here.
- last update
over 1 year ago 29,952 pass - Status changed to RTBC
over 1 year ago 2:15pm 4 August 2023 - ๐ง๐ชBelgium borisson_ Mechelen, ๐ง๐ช
Good to know that the upgrade path is not needed, this makes this one indeed a lot smaller. I had already looked at the other issue and I think the infrastructure for partial ignores from there does indeed make this a lot easier to review.
RTBC, but we still need the follow-ups Wim mentioned in #49. Hopefully the tests agree with me here, because they haven't returned from the bot yet.
- last update
over 1 year ago 29,953 pass - last update
over 1 year ago 29,953 pass - Status changed to Needs work
over 1 year ago 5:39pm 8 August 2023 - ๐บ๐ธUnited States phenaproxima Massachusetts
Will create the follow-ups for Views & Search as soon as @phenaproxima +1s what I'm proposing in #48 and here.
I'm okay with whatever gets this issue landed. Kicking back for the follow-ups.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
If you have the bandwidth, could you create those follow-ups? ๐ I'm dealing with a lot of other config schema validation issues ๐
- ๐บ๐ธUnited States phenaproxima Massachusetts
Opened ๐ SearchPage entities implicitly require labels: make explicit, and fix migration from D7 Active for the search stuff.
- ๐บ๐ธUnited States phenaproxima Massachusetts
And ๐ Views should require a label, rather than falling back to an unhelpful ID RTBC to handle Views.
- Status changed to RTBC
over 1 year ago 2:22pm 10 August 2023 - ๐บ๐ธUnited States phenaproxima Massachusetts
Restoring RTBC per #50, now that the follow-ups are created. Hopefully we can get a release manager to commit this.
- ๐ฌ๐งUnited Kingdom catch
I think this is fine if we do ๐ Follow-up for #3361534: config validation errors in contrib modules should cause deprecation notices, not test failures Fixed , so that it only becomes a deprecation error. I am not sure we should be adding more of these to 10.2.x before that lands though since 10.2.x branching/alpha is not all that far away at this point.
So I guess that means we could remove the RM review tag if this is PP-1, or keep it on if there's a reason to do this first?
- last update
over 1 year ago 29,958 pass - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
100% agreed that we should do ๐ Follow-up for #3361534: config validation errors in contrib modules should cause deprecation notices, not test failures Fixed .
I don't think this needs to be blocked on #3379899 though, because that one is trivial to add, and does not conflict with this at all. But, from a release manager POV that sequencing makes things simpler, so let's postpone this on that one. ๐
Thanks, @catch! ๐
- last update
over 1 year ago 29,958 pass - ๐ง๐ชBelgium kristiaanvandeneynde Antwerp, Belgium
One thing I don't see mentioned here is that core allows config entities to have no label but in other places expects there to be one. This problem hit Group particularly hard with the entire Views creation wizard breaking because I stopped providing a label for one of my bundle entities. ConfigEntityBase has no label method and uses EntityBase's, which allows to return NULL as label.
See ๐ฌ Group relationship type no longer has a label, leading to PHP warnings all over the place Fixed , especially comments 10 through 13
Yeah. This definitely feels like a broken promise. But we don't want to fault contrib modules that are doing things the "right way" when it's broken.
From what I can tell, this issue is merely adding a new schema type and making sure large parts of core are updated to use that. But what's the expectation here? Can we still have config entities without labels (like Block) or is everything expected to follow suit at some point, like the spinoff Views issue shows?
- Status changed to Needs work
over 1 year ago 1:42pm 14 August 2023 - Status changed to RTBC
over 1 year ago 1:51pm 14 August 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
#59: yay! ๐ Merged in upstream, only a trivial conflict in
SchemaCheckTrait
. ๐#58:
- Yep, I hear you! That's what the section in the issue summary covers. Expanded that part to refer to your comment + example ๐
- That's a great question! The answer is multi-faceted:
- YES, every config entity in Drupal core that supports labels, will now be required to have a label. The sole exceptions are listed in
SchemaCheckTrait::$ignoredPropertyPaths
, i.e.View
andSearchPage
config entities and they have follow-up issues: ๐ SearchPage entities implicitly require labels: make explicit, and fix migration from D7 Active and ๐ Views should require a label, rather than falling back to an unhelpful ID RTBC . There, we will determine what the appropriate course of action is. Rationale: every config entity type in Drupal core that has a UI supports labels, to be able to provide a good admin UX. Which in turn implies the label should be required for that good admin UX to actually be possible. (Note that some config entity types have never supported labels, for exampleRestResourceConfig
.) - Because that will now be the expectation for all core config entity types except for 2, the disruption to contrib modules would be enormous if
๐
New config schema data type: `required_label`
Fixed
hadn't landed first (thanks @lauriii!). But thanks to that landing first, every contrib module creating any config entity in any test will now get a deprecation notice triggered (except for
View
andSearchPage
, due to the above). - This issue is not changing
\Drupal\Core\Config\Entity\ConfigEntityBase
, which means the inherited\Drupal\Core\Entity\EntityBase::label()
still applies, which means that according to the type hint, a return value ofnull
is still allowed. We cannot change this, that would be a BC break. We can consider changing that in the future, but it'd be a significant change. And would break many config entity types. - For comments 10โ13 in
๐ฌ
Group relationship type no longer has a label, leading to PHP warnings all over the place
Fixed
, I'd say the proper solution is to modify
ConfigEntityBundleBase
(introduced in #2261369: Introduce a common config entity base class for all bundle config entity types โ ) and make labels required there. Because those are not just any config entity types, they're used as bundles for some entity types, and then it indeed makes sense to force implementors to provide a label, otherwise anything entity-reference-related is unable to provide a good admin UX. Also see\Drupal\Core\Entity\EntityType::getBundleLabel()
, which makes it even more explicit that it's a built-in assumption that entity bundles need to be able to have human-readable labels. Furthermore, there already is ano_ui
key-value pair for the@FieldType
plugin annotation, which is dealing with exactly this use case, and it's also in the Entity/Field API space. So I suggest creating a new issue, propose allowing entity bundle config entity types to have ano_ui
annotation, and reference these related issues ๐ But all of that is for sure out of scope, because: - This issue is not changing ANYTHING wrt infrastructure in Drupal core assuming the presence or absence of labels on config entity types! See the first point in this list: this is only making it required for config entities that explicitly already support it ๐ There is an easy way to see this: this MR is NOT modifying the
type: config_entity
config schema data type incore.data_types.schema.yml
, it's only modifying concrete config entity types' schema definitions.
- YES, every config entity in Drupal core that supports labels, will now be required to have a label. The sole exceptions are listed in
- last update
over 1 year ago 29,959 pass - Status changed to Needs review
over 1 year ago 4:38pm 15 August 2023 - last update
over 1 year ago 29,959 pass - last update
over 1 year ago 29,959 pass - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Thanks for adding the links, @phenaproxima, but you seem to have accidentally merged in an older version of this branch/MR, causing all the
views.view.*.yml
changes to be reinstated ๐ And also a merge oforigin/11.x
that is identical to what I had pushed a day prior. I went back to0cd5b9a7
and cherry-picked the todo-linking commit to get back to a simpler history.This is one of the many symptoms why I am not so sure that this GitLab issue fork + MR workflow truly is simpler than patches. ๐ I've made similar mistakes in the past, because
git
sometimes just gets in the way. If we'd be able to rebase on upstream instead of merge in upstream and GitLab's UI would suggest to go to the newly pushed version of the same commit, then it'd be a lot simpler.Next: addressing @lauriii's other comments.
- Status changed to RTBC
over 1 year ago 9:09am 16 August 2023 - ๐ง๐ชBelgium kristiaanvandeneynde Antwerp, Belgium
Thanks for addressing my concerns Wim.
- Status changed to Needs review
over 1 year ago 9:09am 16 August 2023 - last update
over 1 year ago 29,962 pass - Assigned to lauriii
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Cross-posted with @kristiaanvandeneynde, resulted in the node getting unpublished โ republishing this issue.
- Status changed to RTBC
over 1 year ago 10:29am 16 August 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
So basically, I think the 2 examples @lauriii questioned and for which I did the necessary research โฆ show how incredibly pervasive the problem is โฆ and that probably most admin UIs in Drupal core contain bugs like this ๐ ๐
But there's a grand total of 5 more config schema changes beyond making labels required for all config entities that actually store labels, so updated the issue summary to list all 5.
Restoring RTBC state, because I believe all of @lauriii's feedback has been addressed, and per #64, so have @kristiaanvandeneynde's.
- last update
over 1 year ago 29,971 pass -
lauriii โ
committed 67360f2a on 11.x
Issue #3341682 by Wim Leers, phenaproxima, borisson_, catch, alexpott:...
-
lauriii โ
committed 67360f2a on 11.x
- Issue was unassigned.
- Status changed to Fixed
over 1 year ago 9:30am 17 August 2023 Automatically closed - issue fixed for 2 weeks with no activity.