- Issue created by @phenaproxima
- ๐บ๐ธUnited States phenaproxima Massachusetts
- ๐บ๐ธUnited States phenaproxima Massachusetts
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
- Status changed to Active
about 1 year ago 10:30am 28 February 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
And that's fixed too now ๐
- First commit to issue fork.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
I think it's 99% likely that this will run into the exact same problem that @phenaproxima surfaced for #3417835: Convert the Standard install profile into a set of recipes โ at https://git.drupalcode.org/project/distributions_recipes/-/merge_request..., and which I proposed a solution for over at #3417835-56: Convert the Standard install profile into a set of recipes โ .
IMHO it's reasonable to use this issue to implement that strategy here.
- ๐บ๐ธUnited States phenaproxima Massachusetts
Okay, I'm struggling with how to test this.
With any fully validatable config, it's kind of impossible to put it into an invalid state. As soon as we save it, we validate it, and that throws an exception. How, therefore, can we contrive a situation where the imports and the actions (both of which validate everything they can) somehow fail to catch an invalid config object?
- ๐บ๐ธUnited States phenaproxima Massachusetts
The problem and fix that Wim mentions in #8 are, in fact, the reason why this is critical. From a Slack thread:
Application fails if it runs into invalid config from contrib.
So we have to limit validation to only
FullyValidatable
config, pronto. - Status changed to Needs work
about 1 year ago 5:54pm 3 March 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
#12: Yup.
#11: I already provided guidance to @narendraR on how to do that. In a single Recipe, first modify a
Editor
config entity (e.g. change label), second modify the correspondingFilterFormat
to disallow the<br>
tag. Each individual config action results in a valid config entity. But re-validating the entire set of changes at the end will result in theEditor
triggering a validation error because it is no longer in sync with theFilterFormat
. - ๐ฎ๐ณIndia narendraR Jaipur, India
Re #13, I tried to add test in https://git.drupalcode.org/project/distributions_recipes/-/merge_request... but it is not failing as expected.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
๐ค That makes no sense. Did you already step through CKEditor 5's "fundamental compatibility" MR with a debugger when executing validation?
- Assigned to wim leers
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
I'll investigate ๐ต๏ธ
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Huh, the test immediately fails for me?
Testing /Users/wim.leers/core/core/tests/Drupal/KernelTests/Core/Recipe E 1 / 1 (100%)R Time: 00:03.229, Memory: 10.00 MB There was 1 error: 1) Drupal\KernelTests\Core\Recipe\RecipeRunnerTest::testValidationAfterRecipeApplied Drupal\Core\Field\FieldException: Field 'uid' on entity type 'file' references a target entity type 'user' which does not exist. /Users/wim.leers/core/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php:171 /Users/wim.leers/core/core/lib/Drupal/Core/Field/BaseFieldDefinition.php:668 /Users/wim.leers/core/core/lib/Drupal/Core/Field/BaseFieldDefinition.php:691 /Users/wim.leers/core/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php:414 /Users/wim.leers/core/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php:975 /Users/wim.leers/core/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php:418 /Users/wim.leers/core/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:1518 /Users/wim.leers/core/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:1592 /Users/wim.leers/core/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php:1519 /Users/wim.leers/core/core/lib/Drupal/Core/Entity/EntityTypeListener.php:93 /Users/wim.leers/core/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php:184 /Users/wim.leers/core/core/lib/Drupal/Core/Extension/ModuleInstaller.php:298 /Users/wim.leers/core/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php:83 /Users/wim.leers/core/core/lib/Drupal/Core/Recipe/RecipeRunner.php:66 /Users/wim.leers/core/core/lib/Drupal/Core/Recipe/RecipeRunner.php:27 /Users/wim.leers/core/core/tests/Drupal/KernelTests/Core/Recipe/RecipeRunnerTest.php:198 /Users/wim.leers/core/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
Are you not seeing the same locally? https://git.drupalcode.org/issue/distributions_recipes-3401925/-/jobs/97... is definitely not showing this, so just pushed a commit to verify that this actually gets executed on GitLab CIโฆ
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Huh โฆ https://git.drupalcode.org/issue/distributions_recipes-3401925/-/jobs/97... โ that did fail as expected. But I cannot reproduce this locally, it fails long before it gets to that point. Bizarre. GitLab CI uses PHP 8.1.27, I use โฆ the same exact version. I did a fresh
composer install
twice, even after manually deleting thevendor
directory just in case.๐คช What is going on here?!
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
For the test coverage I proposed in #8, we first would need to fix ๐ Deprecate \Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair() and `type: ckeditor5_valid_pair__format_and_editor` Active .
I think I've figured out a simpler test scenario that wouldn't require that to land first.
- Issue was unassigned.
- Status changed to Needs review
about 1 year ago 5:20pm 4 March 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
I think I've figured out a simpler test scenario that wouldn't require that to land first.
That simpler scenario is: delete the text format config entity after having updated the text editor config entity.
But, since there's no config action for deleting a config entity, I don't actually see how that's possible after all โฆ ๐ฌ
Ways out of this to not block this on ๐ Deprecate \Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair() and `type: ckeditor5_valid_pair__format_and_editor` Active :
- add such a "delete" action in a test-only way
- add this without test coverage
๐ฌ
- ๐บ๐ธUnited States phenaproxima Massachusetts
best choice today: add the editor.schema.yml changes using a test-only module
Well...this is a core fork, so why not just land this change in
editor.schema.yml
with a todo to remove it when the appropriate fix(es) are made upstream in core? - ๐บ๐ธUnited States phenaproxima Massachusetts
delete the text format config entity after having updated the text editor config entity.
Tried this, but it doesn't work, because Editors have hard config dependencies on their text formats, which means the editors are deleted when the text format is! (This happens in
\Drupal\Core\Config\Entity\ConfigEntityBase::preDelete()
.) - ๐บ๐ธUnited States phenaproxima Massachusetts
Since this is tricky to test, and encompasses a bigger fix than the current critical problem turned up in #12, I've decided to split out the critical fix into its own issue, which already has dedicated test coverage: #3425540: Only validate config which is is fully validatable โ . I'm de-escalating this one.
- Status changed to Needs work
about 1 year ago 5:45pm 6 March 2024 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
I'm very glad to see that #3425540: Only validate config which is fully validatable โ was split out.
- This now needs a reroll. Seeing what remains of the MR would be helpful.
- ๐ Deprecate \Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair() and `type: ckeditor5_valid_pair__format_and_editor` Active might make this obsolete! Might.
- ๐ฎ๐ณIndia narendraR Jaipur, India
Re-rolled the code and changes done as suggested. I am not sure what needs to be done next here as
::testValidationAfterRecipeApplied
is still not failing as expected. - Assigned to wim leers
- Issue was unassigned.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
tl;dr of what has happened since #26:
- I've proven at
๐
Deprecate \Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair() and `type: ckeditor5_valid_pair__format_and_editor`
Active
that it's possible to ensure any change to an
Editor
config entity can indeed trigger the validity of theEditor
-FilterFormat
pair ๐ - BUT it is in turn blocked on missing infrastructure in Drupal core: ๐ Config validation: config entities should get the same validation errors when validated as plain config vs ConfigEntityAdapter Needs review is the blocker.
Next steps
- We could test the scope of this issue today if there were a "delete config entity" action. But it doesn't, and intentionally so.
- That means that the only other way to test the scope of this issue is to wait for some other config validation logic to validate across config entity types. The only one that I know of are the validation constraints for
ckeditor5_valid_pair__format_and_editor
, which are currently only executed by callingCKEditor5::validatePair()
. We shouldn't tie Recipes to that (although we temporarily couldโฆ), so we should wait for ๐ Deprecate \Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair() and `type: ckeditor5_valid_pair__format_and_editor` Active , because then a simpleConfigEntityAdapter::createFromEntity(Editor::load('basic_html'))->validate()
(which we already call) will trigger that same validation logic without the need for calling custom logic ๐ - Consequently, this issue is blocked on not one but two core issues ๐
Finally: I did write in #26.2 that this issue might become obsolete. That is still possible, but the 2 blocking issues alone are insufficient.
For that to happen, we'd need to add a new validation constraint to Drupal core: one that is applied to all config entities and verifies that all dependents (other config entities depending on the config entity being modified) also remain valid. Both direct ones (e.g.editor.editor.basic_html
depends onfilter.format.basic_html
) and indirect ones (e.g. an entity view display depending on a text field, and that text field havingfilter.format.basic_html
configured as the only allowed format). If that were to happen, then only validating the actually modified config entities would be sufficient (which Recipes already does), because all interdependencies would be validated too ๐
The risk/danger/complexity lies in the fact that this risks becoming a major performance bottleneck, because for some things there could be MANY indirect dependencies that would need to be revalidatedโฆ - I've proven at
๐
Deprecate \Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair() and `type: ckeditor5_valid_pair__format_and_editor`
Active
that it's possible to ensure any change to an
- Status changed to Postponed
11 months ago 1:49pm 19 May 2024 - ๐บ๐ธUnited States thejimbirch Cape Cod, Massachusetts
This is marked as Postponed. Updating the status.