- Issue created by @claudiu.cristea
- Merge request !5559Fix filter_settings.<filter_plugin_id> schema type โ (Closed) created by claudiu.cristea
- Status changed to Needs work
12 months ago 9:19am 28 November 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
+1!
This is technically a duplicate of ๐ Provide guidance to config schema developers: detect broken config schema types Needs work , but there I'm trying to add automatic detection of this very problem to ensure it can happen never again (reviews + help appreciated ๐ค).
But that issue is likely to take a long time to land. I think it makes sense to fix core's schema regardless of deeper configuration schema system DX/architecture improvements ๐
- Status changed to Needs review
12 months ago 10:02am 28 November 2023 - ๐ท๐ดRomania claudiu.cristea Arad ๐ท๐ด
I came here from ๐ฌ Slick filter schema is incomplete Fixed (weird issue there)
We don't need a new type: filter_settings_base.
I was think that it's good to have a base schema for a particular *kind* of configs
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
The change of
filter.settings.*
fromtype: sequence
totype: mapping
implies all keys must now be defined.Which means every
@Filter
plugin with settings now MUST definefilter.settings.<PLUGIN ID>
if they want toConsequence is this validation error now appearing for (all?) CKEditor 5 functional JS tests:
'filter_url_length' is not a supported key.
But why?
- In Drupal core, the only config entity validation that occurs anywhere in Drupal core
- The Text Format & Editor UI itself generates configuration that does not conform the config schema:
\Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5TestBase::createNewTextFormat()
uses the UI to generate a new text format, resulting infilters.filter_url
being set to:
[ 'status' => 0, 'weight' => '0', 'settings' => [ 'filter_url_length' => 72, ], ]
- โ
The
settings
value complies withtype: filter_settings.filter_url
๐ - โ But that entire value (the entire array) should comply with
type: filter
, which it does NOT:id
andprovider
are missing. That's why config schema was unable to resolvetype: filter_settings.[%parent.id]
tofilter_settings.filter_url
and instead fell back tofilter_settings.*
๐ฑ - Or annotated in the debugger:
- Status changed to Needs work
12 months ago 11:12am 28 November 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
AFAICT we have two choices:
- tighten scope: drop the change to
filter_settings.*
, to allow it to continue to accept arbitrary garbage values - broaden scope: fix
\Drupal\filter\FilterFormatFormBase
Better to fix all the broken things that are connected IMO, so attached a suggested interdiff that AFAICT should fix it ๐ค
- tighten scope: drop the change to
- Status changed to Needs review
12 months ago 11:55am 28 November 2023 - ๐ท๐ดRomania claudiu.cristea Arad ๐ท๐ด
I went with #8.2 as it avoids adding any arbitrary sequence but used fields of type
value
. Let's see the bot - Status changed to Needs work
12 months ago 4:25pm 2 December 2023 - ๐ง๐ชBelgium borisson_ Mechelen, ๐ง๐ช
There are a couple of remaining failures in the javascript test coverage, they seem to be related (as they fail in ckeditor / filter things).
But I agree with @Wim Leers, this issue is great!Removing tags that have been implemented already.
- Assigned to wim leers
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Debugging the failing Functional JS CKEditor 5 testsโฆ
- Issue was unassigned.
- Status changed to Needs review
12 months ago 10:56am 5 December 2023 - Status changed to RTBC
12 months ago 4:29pm 5 December 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
@claudiu.cristea independently discovered and diagnosed this issue after I opened the broader scoped ๐ Provide guidance to config schema developers: detect broken config schema types Needs work to forever detect and prevent this bug pattern from getting reintroduced.
I only helped with debugging the failing CKEditor 5 JS tests (see #8 for details) and provided a trivial suggestion โฆ that happened to work on the first try :D
@claudiu.cristea also provided an update path + tests, to automatically fix all of
filter.format.*
config objects on all sites, to add the missing information (id
+provider
).This looks excellent, so RTBC'ing ๐
- Status changed to Needs work
11 months ago 7:42am 27 December 2023 - ๐ณ๐ฟNew Zealand quietone
I'm triaging RTBC issues โ . I read the IS, the comments and the MR. I didn't find any unanswered questions.
I left a comment on the MR. I would have made the change myself but maybe someone here has a better one line summary.
And, correct me if I am wrong but I also think it prudent to have a change record.
Sorry, but back to NW for two items.
- Status changed to RTBC
11 months ago 8:28am 27 December 2023 - ๐ท๐ดRomania claudiu.cristea Arad ๐ท๐ด
@quietone, thank you. Iโve applied the suggestion but I donโt see the need for a CR, weโre fixing here a bug. No idea what I could write in a CR
- Status changed to Needs review
10 months ago 11:48am 4 February 2024 - ๐ฌ๐งUnited Kingdom longwave UK
Are we sure we don't need a change record?
--- a/core/modules/media/config/schema/media.schema.yml +++ b/core/modules/media/config/schema/media.schema.yml @@ -119,7 +119,7 @@ media.source.field_aware: label: 'Source field' filter_settings.media_embed: - type: filter + type: mapping label: 'Media Embed' mapping: default_view_mode:
If contrib or custom code that adds a filter setting schema has made the same mistake, we need them to update from
filter
tomapping
, no? - Status changed to RTBC
9 months ago 9:24am 5 February 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
If contrib or custom code that adds a filter setting schema has made the same mistake, we need them to update from
filter
tomapping
, no?Yes, they should all change. You're right that they likely all copied the wrong pattern from Drupal core. CR to announce this: https://www.drupal.org/node/3419181 โ .
And if existing code has made that mistake, will there be any side effects anywhere if we commit this?
No, zero side effects in production. This only:
- blocks making filter settings validatable in ๐ Add validation constraints to filter.settings Fixed
- impacted https://www.drupal.org/project/config_inspector โ .
To prevent such circular config schema types from being introduced accidentally in the future in core/contrib, I created ๐ Provide guidance to config schema developers: detect broken config schema types Needs work .
-
longwave โ
committed d8c4e4cf on 11.x
Issue #3404431 by claudiu.cristea, Wim Leers, borisson_, quietone:...
-
longwave โ
committed d8c4e4cf on 11.x
- Status changed to Fixed
9 months ago 9:50am 5 February 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Thanks so much!
Pushed both unblocked issues forward:
Automatically closed - issue fixed for 2 weeks with no activity.
- ๐ฌ๐งUnited Kingdom alexpott ๐ช๐บ๐
quietone โ credited alexpott โ .
- ๐ณ๐ฟNew Zealand quietone
Adding credit for duplicate, ๐ Remove generic sequence schema for filter plugins Closed: duplicate ,