Problem/Motivation

Facts:

  • Drupal 9.4 ships with CKEditor 4 enabled by default in Standard.
  • Drupal 9.5 will ship with CKEditor 5 enabled by default in Standard.

Therefore the 9.4 DB fixtures for update path testing should contain CKE4. In principle only the 9.5 fixtures should contain CKE5. This would be fine for the 9 → 10 update path if it would migrate from CKE 4 to 5 automatically. That was the original plan in #3304736: Provide a good UX to ensure the CKEditor 4 to 5 update is always done before upgrading to Drupal 10 unless the contrib module is installed, per release manager @xjm.

Except that release manager @catch argued for a different approach to upgrade from CKE4 to CKE5 in #3304736-19: Provide a good UX to ensure the CKEditor 4 to 5 update is always done before upgrading to Drupal 10 unless the contrib module is installed:

9.5.x:
Install ckeditor5, update your settings, uninstall ckeditor 4 easily because it's still in core.

10.0.x:
Install ckeditor 4 from contrib, update your settings, uninstall ckeditor 4 easily because you already installed it from contrib.

10.0.x but didn't read the instructions:
Update to 10.0.x, missing module warning on update.php, abort the update, and do the 9.5.x steps, or install the contrib module and follow the 10.0.x steps.

Phrased differently:

Drupal 10 must require the owner of an existing Drupal 9 site to:

  • manually install the CKEditor 5 module (in Drupal 9 or 10)
  • manually uninstall the CKEditor 4 module (in Drupal 9 or 10)
  • not allow updating a Drupal 9 site with CKEditor 4 still installed to Drupal 10 without also installing the https://www.drupal.org/project/ckeditor contrib module for D10 (necessary for point 1 to still be true)

After careful discussion, this plan was deemed safer & better, and release manager @xjm approved it in #3304736-26: Provide a good UX to ensure the CKEditor 4 to 5 update is always done before upgrading to Drupal 10 unless the contrib module is installed.

So how do we then test the D9 → D10 update path, given that no 9.5 DB fixtures will be added? See the proposed resolution.

Steps to reproduce

N/A

Proposed resolution

Update the 9.4 DB fixtures to use CKEditor 5, in Drupal 10.0 and 10.1. This reflects the upgrade path plan by release managers @xjm and @catch that a site will have to stop using CKEditor 4 prior to upgrading to Drupal 10.

Quoting @catch from #3304326-14: Deprecate CKEditor 4 module in 9.5:

If we remove ckeditor from Drupal 10, but don't remove it from the 9.4.0 database dumps, those tests will fail due to the ckeditor module being missing from the filesystem - so we have to remove it from the dumps in 10.0.x

Simultaneously, we're adding ckeditor5 to the standard profile in 9.5.0, but if we want the standard upgrade path tests to run with ckeditor5 installed, we'll need to add it to the database dumps used for tests - currently we only have 9.4.0 database dumps, none for 9.5.0 or 10.0.0 (and might not add those until just before Drupal 11, certainly can't add them before 9.5.0 is released anyway).

More or less we need to replicate what we're expecting real sites to do, which is install ckeditor4 and uninstall ckeditor5.

Remaining tasks

Update DB dumps.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Title: [PP-1] Replace ckeditor with ckeditor5 in the 9.4.0 database dumps in Drupal 10.1.0 » Replace ckeditor with ckeditor5 in the 9.4.0 database dumps in Drupal 10.1.0
Assigned: Unassigned » wim leers
Status: Postponed » Active
wim leers’s picture

wim leers’s picture

Title: Replace ckeditor with ckeditor5 in the 9.4.0 database dumps in Drupal 10.1.0 » Replace ckeditor with ckeditor5 in the 9.4.x database dumps in Drupal 10.0.x & 10.1.x
Issue summary: View changes

I found this issue along with #3304326: Deprecate CKEditor 4 module in 9.5, #3270438: Remove CKEditor 4 from core and #3304736: Provide a good UX to ensure the CKEditor 4 to 5 update is always done before upgrading to Drupal 10 unless the contrib module is installed extremely confusing. So … updated issue summary that explains why we're updating the 9.4 DB dumps this way, by synthesizing all discussion in the past ~week into a (hopefully 🤞) cohesive explanation.

Title updated too:

wim leers’s picture

Issue summary: View changes

HTML fix 😬

Wim Leers credited catch.

Wim Leers credited xjm.

wim leers’s picture

@xjm and @catch definitely deserve credit here! 😊

wim leers’s picture

StatusFileSize
new1.54 KB

Let's run only the Update tests while figuring this out.

wim leers’s picture

StatusFileSize
new1.66 KB
wim leers’s picture

StatusFileSize
new1.65 KB

Ugh. phpunit does have a --group argument. But this us actually using core/scripts/run-tests.sh

3rd time's a charm?

catch’s picture

@Wim Leers: just a note because it's painful to find out later. For 9.5.x, it's necessary to generate the database dumps using PHP 7.3 - otherwise serialisation format causes errors. See #3275093: Drupal 9.3.0 dumps were created with PHP 8, needs to be PHP 7.3.

This isn't an issue for dumps to be committed to 10.0.x

wim leers’s picture

Assigned: wim leers » Unassigned
Status: Active » Needs review
StatusFileSize
new1.47 MB
new1.47 MB
  1. HEAD of 9.4.x is currently f20c0a2030cb19bafa2f54d7e5da8c75459410fd.
  2. #
    # 1. Get current dumps
    #
    git checkout 10.0.x
    gunzip core/modules/system/tests/fixtures/update/drupal-9.4.0.bare.standard.php.gz
    git checkout core/modules/system/tests/fixtures/update/drupal-9.4.0.bare.standard.php.gz
    gunzip core/modules/system/tests/fixtures/update/drupal-9.4.0.filled.standard.php.gz
    git checkout core/modules/system/tests/fixtures/update/drupal-9.4.0.filled.standard.php.gz
    
    #
    # 2. Update the "bare" dump
    #
    git checkout 9.4.x
    # manual: wipe DB
    php -d memory_limit=-1 core/scripts/db-tools.php import core/modules/system/tests/fixtures/update/drupal-9.4.0.bare.standard.php 
    # manual: log in with drupal/drupal
    # manual: navigate to /admin/config/content/formats/manage/basic_html, switch to CKEditor 5, save
    # manual: navigate to /admin/config/content/formats/manage/full_html, switch to CKEditor 5, save
    # manual: navigate to /admin/modules/uninstall, uninstall CKEditor (4)
    php -d memory_limit=-1 core/scripts/db-tools.php dump-database-d8-mysql > some-temporary-file
    
    # 
    # 3. Update the "filled" dump
    #
    # repeat 2. but with s/bare/filled/
    

    Wow, this is painful! We really really need #3305003: Create standard steps for creating database dumps 🤯

  3. Note that diff or git diff seem to be pointless: the order in which things are dumped is different 🤷‍♀️
  4. Note that the first time I created those dumps, they were causing changes in PHP's serialize() output — it was because I was using PHP 7.4 instead of 7.3 — previously seen in #3275093: Drupal 9.3.0 dumps were created with PHP 8, needs to be PHP 7.3.
  5. Note that as I described in #3304736-6: Provide a good UX to ensure the CKEditor 4 to 5 update is always done before upgrading to Drupal 10 unless the contrib module is installed, the dumps have broken Text Format/Editor configuration — they don't match what was in the Standard install profile! So a step I didn't list above was to re-import the Basic & Full HTML text format + editor.
  6. Note that the test_text_format appears to be designed to test that a text format with all filters enabled still has all filters enabled after applying the update path. It also had CKEditor 4 enabled, but this made no sense, given that the filter_html_escape filter was enabled. So, disabled CKEditor 4 for it. This was wrong before, and during the CKE 4 → 5 upgrade that an end user would do as per #3304736: Provide a good UX to ensure the CKEditor 4 to 5 update is always done before upgrading to Drupal 10 unless the contrib module is installed, they'd do the same.
  7. I expect both of CKEditor4To5UpgradeTest's test cases to fail because it specifically accounted for the broken fixtures; if I'm right and they do fail, we'll be able to remove 10 lines of code from that file, making it also more maintainable in the long run 👍

Now … how does one go about reviewing this? Since this involved manual steps? I do see a lot more changes than I'd like 😬 I don't know how to solve the different ordering of identical data. I can't find docs about it. I also see there's more LoC than before, but I didn't do anything besides the above so … 🤷‍♀️

Really curious about reviews on this. The above took hours to figure out already 🙃

EDIT: #12: too late 😅

wim leers’s picture

Status: Needs review » Needs work

The last submitted patch, 13: 3306545-12.patch, failed testing. View results

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new758 bytes
new1.47 MB

Update UpdatePathTestBaseFilledTest expectation.

Hoping that this will address the otherwise inexplicable Undefined variable $theme_list errors 😬

Status: Needs review » Needs work

The last submitted patch, 16: 3306545-16.patch, failed testing. View results

spokje’s picture

@Wim Leers

If you can explain what you did to accomplish this:

Note that as I described in #3304736-6: [P-2] Provide a good UX to ensure the CKEditor 4 to 5 update is always done before upgrading to Drupal 10 unless the contrib module is installed, the dumps have broken Text Format/Editor configuration — they don't match what was in the Standard install profile! So a step I didn't list above was to re-import the Basic & Full HTML text format + editor.

So import what from where, I could have a stab at updating the dumps.

We really need #3213633 for our own sanity

I've lost that long ago, actually whilst doing fixture updates, so there's no risk involved for me :)

wim leers’s picture

#18:

So import what from where, I could have a stab at updating the dumps.

Re-import these:

core/profiles/standard/config/install/filter.format.basic_html.yml
core/profiles/standard/config/install/filter.format.full_html.yml
core/profiles/standard/config/install/editor.editor.basic_html.yml
core/profiles/standard/config/install/editor.editor.full_html.yml
I've lost that long ago

🤣

wim leers’s picture

Down to 4 failures in #16! 🚀

But … Undefined variable $theme_list all over the place. Let's investigate! It comes from the last line in this chunk of code:

      if (!empty($extensions['theme'])) {
        $theme_list_scan = $listing->scan('theme');
        foreach (array_keys($extensions['theme']) as $theme) {
          if (isset($theme_list_scan[$theme])) {
            $theme_list[$theme] = $theme_list_scan[$theme];
          }
        }
        $this->folders += $this->getComponentNames($theme_list);
      }

… that actually looks like a genuine bug. How is it possible that this has never been surfaced?! 🤯

spokje’s picture

Assigned: Unassigned » spokje

How is it possible that this has never been surfaced?!
Looking at your previous comments I'm assuming the update of the fixtures wasn't done correctly, leaving the test with an "undefined" DB to work from and the most "fun" failures are returned from TestBot. I wouldn't spend to much time investigating that (Been there, done that, threw away the T-Shirt.)

Re-import these:

I'm assuming I should be on 9.4.4 to have the correct config?

wim leers’s picture

Yes, 9.4.4. Or 9.4.x — it doesn't matter (git diff 9.4.4 origin/9.4.x -- core/profiles/standard/config/install is empty).

P.S.: I'd really love to know what I did wrong 😬

spokje’s picture

StatusFileSize
new1.29 MB

Let's give this a whirl

spokje’s picture

Assigned: spokje » Unassigned
Status: Needs work » Needs review

What's green enough for TestBot, is good enough for me.

P.S.: I'd really love to know what I did wrong 😬

I see several options:
1) Approaching this task too sane
2) Using PHP 7.3 while the 10.0.x and 10.1.x fixtures are dumped in PHP 8.1
3) "Something weird", since the ordering of dumped things shouldn't change (much).
4) No ritual offering to Cthulhu.

My money is on #4, but it might be all of the above.

wim leers’s picture

Status: Needs review » Reviewed & tested by the community

I definitely violated 4) and 2), I probably violated 1), and possibly 3). Clearly a case of PEBKACAC (classical PEBKAC with the addition of And Cthulhu).

I manually gunzipped and diffed the drupal-9.4.0.bare.standard.php.gz and drupal-9.4.0.filled.standard.php.gz before and after. The same observations I had about my own patch in #13 applies:

I do see a lot more changes than I'd like 😬 I don't know how to solve the different ordering of identical data. I can't find docs about it. I also see there's more LoC than before, but I didn't do anything besides the above so … 🤷‍♀️

I see the exact same number of lines before vs after, the same ordering differences. The only difference appears to be that @Spokje did it with PHP 8.1 instead of PHP 7.3. 👍

  • catch committed 0b8aadb on 10.0.x
    Issue #3306545 by Wim Leers, Spokje, catch, xjm: Replace ckeditor with...
  • catch committed 7f5e7bf on 10.1.x
    Issue #3306545 by Wim Leers, Spokje, catch, xjm: Replace ckeditor with...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 10.1.x and cherry-picked to 10.0.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.