Problem

  1. Text module is marked as required: TRUE in its .info.yml file, even though it is not required.

Details

  1. Text module was marked as required for an unknown reason.
  2. This causes the module to be installed under any circumstances, even when not needed. (e.g., WebTests using the Testing profile)

Proposed solution

  1. Replace the required flag for Text module with proper dependencies (if any are missing).
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, drupal8.text-required.0.patch, failed testing.

andypost’s picture

If string field type will get widget and formatter it would be much easy #2150511: [meta] Deduplicate the set of available field types

sun’s picture

Since the removal of this required flag originally passed in #1934772: Filter module is not required, but is marked as required, I suspect that this change is blocked on that issue.

Let's wait for the other issue to land first.

Berdir’s picture

Status: Needs work » Needs review

drupal8.text-required.0.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, drupal8.text-required.0.patch, failed testing.

alexpott’s picture

Status: Needs work » Needs review
FileSize
354 bytes
Berdir’s picture

Status: Needs review » Reviewed & tested by the community

I verified that all modules that call text_summary() or create text fields have the dependency on text.module.

Together with #1541298: Remove Node module dependency from Testing profile, this will remove node, filter and text from the list of modules that every web test needs to enable.

Based on a quick test, this decreased the run time of UserSaveTest from 6 to 5 seconds for me, but that wasn't a very scientific test :)

Berdir’s picture

6: 2191285.6.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 6: 2191285.6.patch, failed testing.

alexpott’s picture

Status: Needs work » Needs review

6: 2191285.6.patch queued for re-testing.

Berdir’s picture

FileSize
643 bytes

Nice, now that #1541298: Remove Node module dependency from Testing profile has been committed, tests are now actually running without node, text and filter for the very first time, and that's causing fails related to filter.module as well. Shows that the issue to make filter.module should have waited for this, but I think we can fix it here.

Looks like file.module calls _filter_htmlcorrector() directly, so it needs a dependency on that. Trying again, hopefully with better readable results.

The last submitted patch, 6: 2191285.6.patch, failed testing.

xjm’s picture

Issue tags: +Needs change record

This will need a change record based on #1934772-39: Filter module is not required, but is marked as required.

https://drupal.org/node/1397856 is the change record to look at.

Status: Needs review » Needs work

The last submitted patch, 11: 2191285.11.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review

11: 2191285.11.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 11: 2191285.11.patch, failed testing.

Berdir’s picture

Nice, now we have some real test fails that show that filter.module can actually *not* be an optional module, as there are for example calls to _filter_htmlcorrector() in mail.inc :)

Looking at that, should we move that function to Utility\Xss?

sun’s picture

The HTML Corrector filter is not related to XSS, it just fixes malformed HTML (missing closing element tags, etc) by loading the HTML (soup) string into a DOMDocument and saving it back into a string.

Note that #1333730: [Meta] PHP DOM (libxml2) misinterprets HTML5 proposes to replace the internal implementation with a PHP library.

longwave’s picture

So is Utility\String a suitable place? The four functions in there all handle HTML already.

sun’s picture

Category: Task » Bug report
Priority: Normal » Major
Status: Needs work » Postponed
Issue tags: -Needs change record

Looks like this issue revealed a very deeply hidden bug in our module dependencies, which was masked by 'required' modules previously.

→ Flawed assumptions. Flawed architecture. Yet another major reason to #1688162: Replace required flag of modules with proper dependencies

Postponing on #2195745: Replace _filter_htmlcorrector() with a utility class in core

Berdir’s picture

Issue tags: +Needs change record
jibran’s picture

jibran’s picture

Status: Active » Needs review
FileSize
354 bytes

Nous allons ici.

Damien Tournoud’s picture

11: 2191285.11.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 23: 2191285-23.patch, failed testing.

The last submitted patch, 11: 2191285.11.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
FileSize
10.3 KB

File module's dependency on Text is gone.

Attached patch should fix the test failures. Not sure whether I got Module\DependencyTest right... (I always avoid to run that locally)

Status: Needs review » Needs work

The last submitted patch, 27: drupal8.text-required.27.patch, failed testing.

jibran’s picture

I always avoid to run that locally

What is the reason?

Berdir’s picture

The reason is that it takes forever to run ;)

I'll have a look later today I hope.

Is the dependency for file module still necessary? I only added that due to the call to _filter_htmlcorrector(), before seeing the other calls and we fixed that.

andypost’s picture

+++ b/core/modules/contact/contact.info.yml
@@ -5,3 +5,5 @@ package: Core
+dependencies:
+  - text

Will be after #1856562: Convert "Subject" and "Message" into Message base fields

andypost’s picture

Status: Needs work » Needs review
FileSize
2.45 KB
11.14 KB

Fix latest test
PS: it's easy to comment-out passed test* and leave only one that was broken, so it takes 42 sec for me.

Berdir’s picture

  1. +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigSingleImportExportTest.php
    @@ -128,7 +128,7 @@ public function testExport() {
         // Spot check several known simple configuration files.
         $element = $this->xpath('//select[@name="config_name"]');
         $options = $this->getAllOptions($element[0]);
    -    $expected_options = array('filter.settings', 'system.site', 'user.settings');
    +    $expected_options = array('system.site', 'user.settings');
         foreach ($options as &$option) {
           $option = (string) $option;
         }
    

    Enabling filter here would also be a valid test fix, not sure if it is worth to check a third file.

  2. +++ b/core/modules/contact/contact.info.yml
    @@ -5,3 +5,5 @@ package: Core
     version: VERSION
     core: 8.x
     configure: contact.category_list
    +dependencies:
    +  - text
    

    Does it really? Weren't those just test fails because they tried to add text fields to contact forms? If possible, I'd prefer to add the dependency to the tests, not contact.module.

    Also, based on those noticed, I'm guessing the field_ui is not handling the now possible case that there are no field types properly.

  3. +++ b/core/modules/field/field.module
    @@ -87,7 +87,7 @@ function field_help($path, $arg) {
           $output .= '<dl>';
           $output .= '<dt>' . t('Enabling field types') . '</dt>';
    -      $output .= '<dd>' . t('The Field module provides the infrastructure for fields and field attachment; the field types and input widgets themselves are provided by additional modules. Some of the modules are required; the optional modules can be enabled from the <a href="@modules">Modules administration page</a>. Drupal core includes the following field type modules: Number (required), Text (required), List (required), Taxonomy (optional), Image (optional), and File (optional); the required Options module provides input widgets for other field modules. Additional fields and widgets may be provided by contributed modules, which you can find in the <a href="@contrib">contributed module section of Drupal.org</a>. Currently enabled field and input widget modules:', array('@modules' => url('admin/modules'), '@contrib' => 'http://drupal.org/project/modules', '@options' => url('admin/help/options')));
    +      $output .= '<dd>' . t('The Field module provides the infrastructure for fields and field attachment; the field types and input widgets themselves are provided by additional modules. The modules can be enabled from the <a href="@modules">Modules administration page</a>. Drupal core includes the following field type modules: Number, Text, Taxonomy, Image, File, Email, Link, Telephone, and Options. Additional fields and widgets may be provided by contributed modules, which you can find in the <a href="@contrib">contributed module section of Drupal.org</a>.', array('@modules' => url('admin/modules'), '@contrib' => 'http://drupal.org/project/modules', '@options' => url('admin/help/options')));
     
           // Make a list of all widget and field modules currently enabled, ordered
    

    When you are changing the text anyway, add Entity Reference? Instead of opening another issue...

sun’s picture

The other two simple (non-entity) config settings files are completely sufficient for that test.

So attached patch addresses 2. + 3. only.

Status: Needs review » Needs work

The last submitted patch, 34: drupal8.text-required.34.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
FileSize
11.44 KB
846 bytes

I can only hope that this is not a random test failure... let's see.

Berdir’s picture

Yeah, I had a similar problem with the node issue where that list wasn't the same locally and on the testbot. It does seem to be stable on the same environment though. The test doesn't seem to be failing on 5.4/5.5 on testbot. But it is scary, maybe we should switch to a different module with a smaller and more specific dependency tree? We've extended this line multiple times now, always adding more to the list as we change dependencies and make more modules optional...

Not in this issue....

andypost’s picture

probably related, suppose needs separate issue but CommentDefaultFormatter::viewElements() uses $this->settings['pager_id'] so defaults are skipped, this should be $this->getSetting('pager_id')

sun’s picture

This patch appears to decrease the total test suite time by ~2 minutes on one of the fastest testbots (#1883):

-Test run duration: 49 min 22 sec
+Test run duration: 47 min 38 sec
Berdir’s picture

Status: Needs review » Reviewed & tested by the community

The fast/physical test bots have a fairly reliable text execution time now unlike the virtual ones, so that might actually mean something yes. Some sort of dependency tree/count of tests that don't rely on text/node and are now avoiding those 3 modules would be interesting, not sure how many of those we really have. Might write something :)

Patch looks great and is quite small now, that's great.

A follow-up to investigate the warnings thrown in field_ui if there are no field_types available would be great but this is RTBC.

Note that this issue doesn't need a new change record, we only need to update the existing one linked in #13, which is trivial and we don't need to prepare anything for that, so we're good.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

Seems like we ought to be close to Field module not being required now?

sun’s picture

That's an interesting question. I've created

#2199637: Replace "required" flag of Field module with proper dependencies

and also updated the issue summary of #1688162: Replace required flag of modules with proper dependencies to give a more holistic overview of the remaining 'required' modules.

Berdir’s picture

Updated https://drupal.org/node/1397856, now mentions all modules that were made optional so far.

xjm’s picture

Issue tags: -Needs change record

Looks like the change record is taken care of. Thanks!

Status: Fixed » Closed (fixed)

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