Problem/Motivation

With #3124762: Add 'lifecycle' key to .info.yml files committed, we now have a lifecycle key to indicate the status of a module/theme. However:

  • Currently, experimental themes use the key/value pair: experimental: true in their .info.yml files.
  • Deprecated and obsolete extensions are not indicated on the admin status report page.

Proposed resolution

  • Use lifecycle: experimental for experimental themes.
  • Add warnings on the status page for deprecated and obsolete extensions.

Followup: #3250342: Deprecate "experimental: true" in .info.yml

Remaining tasks

Review
Commit

User interface changes

New info shows on admin/reports for deprecated projects.

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Issue fork drupal-3250585

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Spokje created an issue. See original summary.

spokje’s picture

spokje’s picture

Issue summary: View changes
longwave’s picture

  1. +++ b/core/modules/system/src/Controller/SystemController.php
    @@ -225,7 +226,8 @@ public function themesPage() {
    -      $theme->is_experimental = isset($theme->info['experimental']) && $theme->info['experimental'];
    

    Do we need any BC here, or are we assuming that only core provided experimental modules and themes?

  2. +++ b/core/modules/system/src/Controller/SystemController.php
    @@ -225,7 +226,8 @@ public function themesPage() {
    +      $theme->is_experimental = isset($theme->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER])
    +        && $theme->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::EXPERIMENTAL;
    

    Should this be moved to a method on the value object, so we can just call ->isExperimental()? This code is duplicated in a few places.

    edit: there is no value object that handles ->info, this is blocked by #3015812: Introduce new Theme extension object and properly deprecate REGIONS_VISIBLE and REGIONS_ALL

spokje’s picture

StatusFileSize
new12.89 KB
new3.06 KB

Thanks @longwave!

#4.1: There is a child follow-up issue for that, currently postponed: #3250342: Deprecate "experimental: true" in .info.yml.

That issue was created upon @Gábor Hojtsy requested by in 3215045.#23

Would that be good enough to answer your question?

#4.2: Addressed in attached patch.

spokje’s picture

Status: Needs review » Needs work
StatusFileSize
new12.89 KB
new3.06 KB

D'oh!

karishmaamin’s picture

StatusFileSize
new12.25 KB
new1.1 KB

Tried to fixed custom code failure #6

longwave’s picture

So if we're going to do #3250342: Deprecate "experimental: true" in .info.yml I think we need to leave the code that handles experimental: true alone in this issue and add lifecycle: experimental as an additional way of flagging experimental extensions, so modules/themes can use either until Drupal 10.

spokje’s picture

Assigned: Unassigned » spokje

@longwave: Makes complete sense, let me see what I can do.

spokje’s picture

StatusFileSize
new12.21 KB
new1.5 KB
spokje’s picture

StatusFileSize
new11.86 KB
new1.86 KB

That could have gone better...

spokje’s picture

StatusFileSize
new11.89 KB
new614 bytes

Searching for green TestBot.

spokje’s picture

Status: Needs work » Needs review

Drupal\Core\Extension\Extension::isExperimental should now take care of both lifecycle: experimental and experimental: true.

quietone’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Bug Smash Initiative

What is happening to the 'experimental;' property? Deprecation? If so, then more work for that. Would be nice to have that in the proposed resolution.

  1. +++ b/core/lib/Drupal/Core/Extension/Extension.php
    @@ -192,4 +192,16 @@ public function __wakeup() {
    +    return (isset($this->info['experimental']) && $this->info['experimental'])
    +    || (isset($this->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER])
    

    I think this needs a comment explaining why two properties are being tested. And if one is being removed then an @todo to the followup.

  2. +++ b/core/modules/system/system.install
    @@ -63,13 +67,19 @@ function system_requirements($phase) {
    +    $obsolete_extensions = [];
    

    Let's move this below the comment, and change the comment. See below.

  3. +++ b/core/modules/system/system.install
    @@ -63,13 +67,19 @@ function system_requirements($phase) {
         // Warn if any experimental modules are installed.
    

    This comment, and the one below for themes, needs updating because the code is now doing experimental and obsolete.

spokje’s picture

Issue summary: View changes
StatusFileSize
new12.8 KB
new2.6 KB

Thanks @quietone for the review

What is happening to the 'experimental;' property? Deprecation? If so, then more work for that. Would be nice to have that in the proposed resolution.

It will be deprecated properly in #3250342: Deprecate "experimental: true" in .info.yml. Added the section Proposed resolution in the IS explaining what's going on in this issue and mentioning the deprecation issue.

I've (hopefully) addressed points 1. through 3, where I took the liberty of going a slightly different route with 2. and 3. than suggested.

spokje’s picture

Issue summary: View changes
spokje’s picture

Assigned: spokje » Unassigned
Status: Needs work » Needs review
longwave’s picture

  1. +++ b/core/modules/system/system.install
    @@ -79,14 +91,26 @@ function system_requirements($phase) {
           if (isset($data->info['experimental']) && $data->info['experimental']) {
    

    Let's put the @todo here as well.

  2. +++ b/core/modules/system/tests/themes/experimental_theme_test/experimental_theme_test.info.yml
    @@ -3,4 +3,4 @@ type: theme
    -experimental: true
    +lifecycle: experimental
    

    Do we need a legacy experimental test theme in order to keep testing experimental: true?

spokje’s picture

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

Thanks @longwave, fair points.

Regarding:

2. Do we need a legacy experimental test theme in order to keep testing experimental: true?

We're going to need one anyway to test the deprecation we're going to create in #3250342: Deprecate "experimental: true" in .info.yml.
Besides that, I can't really argue with the need for a test that experimental: true will still work after the changes in this issue.

Patch incoming shortly.

spokje’s picture

StatusFileSize
new25.39 KB
new12.3 KB

Addressing #18

spokje’s picture

Assigned: spokje » Unassigned
Status: Needs work » Needs review
longwave’s picture

Status: Needs review » Needs work

Thanks, I think this is getting close. Another round of review, mostly nitpicks:

  1. +++ b/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php
    @@ -68,69 +69,103 @@ public function testExperimentalConfirmForm() {
    +   * Data Provider.
    

    "Data provider for experimental test themes"?

  2. +++ b/core/lib/Drupal/Core/Extension/Extension.php
    @@ -192,4 +192,20 @@ public function __wakeup() {
    +    // @todo Remove the check for 'experimental: true' as part of https://www.drupal.org/node/3250342
    

    Line needs rewrapping.

  3. +++ b/core/modules/system/system.install
    @@ -79,14 +91,30 @@ function system_requirements($phase) {
    +      // @todo Remove the check for 'experimental: true' as part of https://www.drupal.org/node/3250342
    

    Line needs rewrapping.

  4. +++ b/core/modules/system/system.install
    @@ -94,6 +122,15 @@ function system_requirements($phase) {
    +      $requirements['obsolete_extensions'] = [
    +        'title' => t('Obsolete extensions enabled'),
    +        'value' => t('Obsolete extensions found: %extensions. <a href=":url">Obsolete extensions</a> are provided for compatibility purposes only. Use at your own risk.', ['%extensions' => implode(', ', $obsolete_extensions), ':url' => 'https://www.drupal.org/core/deprecation']),
    +        'severity' => REQUIREMENT_WARNING,
    

    Do we have a test that covers this?

  5. +++ b/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php
    @@ -68,69 +69,103 @@ public function testExperimentalConfirmForm() {
    +   * @return \string[][]
    

    No \ before string.

  6. +++ b/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php
    @@ -68,69 +69,103 @@ public function testExperimentalConfirmForm() {
    +   * @todo Turn the check for 'Testing legacy Key/Value pair "experimental: true"' into a @legacy test triggering a deprecation
    +   * as part of https://www.drupal.org/node/3250342
    

    Lines need rewrapping.

ankithashetty’s picture

StatusFileSize
new25.44 KB
new2.68 KB

Made the changes requested in #22, except #22.4, thanks!

spokje’s picture

Assigned: Unassigned » spokje

So the attempt to narrow the scope from #3215045: [Duplicate] Highlight obsolete module's status at admin/reports/status page, providing warning and link with explanation down to "just" swapping out Key/Value pair experimental: true to lifecycle: experimental in this issue has failed.

We're now just doing the full blown "Highlight obsolete module's status at admin/reports/status page, providing warning and link with explanation" as intended in #3215045: [Duplicate] Highlight obsolete module's status at admin/reports/status page, providing warning and link with explanation.

I'm unsure if we have to move the patch back to that issue, but I'll leave that to bigger brains. If not, we need to update the IS here and probably close #3215045: [Duplicate] Highlight obsolete module's status at admin/reports/status page, providing warning and link with explanation.

Regarding #22.4:

1) Installing lifecycle: obsolete isn't even possible, Core throws an exception when trying to do so.

We need to look at lifecycle: deprecated, which means there's an overlap with #3215043: Indicate the non-stable statuses in admin/modules page regarding test modules which are marked as lifecycle: deprecated. Currently there are none, that issues introduces them.

To create a test I'm going to copy/paste some of them here, meaning we need a reroll on one of the issues them depending on which one gets committed first, but I don't see another, easier way to do this.

spokje’s picture

Regarding #22.5:

+++ b/core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php
@@ -68,69 +69,103 @@ public function testExperimentalConfirmForm() {
+   * @return \string[][]

No \ before string.

Looking at that now, I was wondering where I got that from.

Turns out there are currently 5 occurrences of that line in Core:

Targets
    Occurrences of '\string[' in Project
    Usage in comments  (5 usages found)
        drupal  (5 usages found)
            core\modules\ckeditor5\tests\src\FunctionalJavascript  (1 usage found)
                LanguageTest.php  (1 usage found)
                    59 * @return \string[][]
            core\modules\ckeditor5\tests\src\Kernel  (1 usage found)
                LanguageTest.php  (1 usage found)
                    97 * @return \string[][]
            core\modules\migrate\tests\src\Unit\process  (1 usage found)
                LogTest.php  (1 usage found)
                    35 * @return \string[][]
            core\modules\system\tests\src\Functional\Theme  (1 usage found)
                ExperimentalThemeTest.php  (1 usage found)
                    142 * @return \string[][]
            core\modules\tour\tests\src\FunctionalJavascript  (1 usage found)
                TourLegacyTest.php  (1 usage found)
                    131 * @return \string[][]

Do we need/want a follow-up to remove the backslash from those?

spokje’s picture

Used 3250585-23.patch as base for the new MR.

catch’s picture

@Spokje I don't have a strong preference for which direction to merge the issues (maybe into this one since the MR is up-to-date), but it would definitely be good to close one or the other as duplicate and update issue summaries/titles if necessary.

gábor hojtsy’s picture

Title: Use lifecycle: experimental instead of the current experimental: true in the .info.yml-files » Highlight obsolete module's status at admin/reports/status page, providing warning and link with explanation
Issue summary: View changes

Carried over the original title from #3215045: [Duplicate] Highlight obsolete module's status at admin/reports/status page, providing warning and link with explanation and updated the issue summary. Also applying credits from there.

gábor hojtsy’s picture

Also applying parent and related issue.

gábor hojtsy’s picture

Title: Highlight obsolete module's status at admin/reports/status page, providing warning and link with explanation » Highlight obsolete extensions at admin/reports/status page, providing warning and link with explanation

Also this applies to all extensions not just modules, so expanding title.

xjm’s picture

Issue tags: +Needs tests

Looks like this needs test coverage. We should have test cases for both modules and themes.

spokje’s picture

Assigned: spokje » Unassigned
catch’s picture

Title: Highlight obsolete extensions at admin/reports/status page, providing warning and link with explanation » Highlight obsolete modules and themes at admin/reports/status page, providing warning and link with explanation

Making sure no-one tries to deal with profiles here.

catch’s picture

Priority: Normal » Critical

This is blocking deprecation of core modules, so bumping to critical.

spokje’s picture

I was waiting on #3215043: Indicate the non-stable statuses in admin/modules page to get committed, since there's a lot of overlap, including tests, in that one, before continuing here,

Having said that, it's a non-assigned issue, so if anybody wants to jump in, please do.

spokje’s picture

Assigned: Unassigned » spokje
spokje’s picture

Assigned: spokje » Unassigned

Updated MR, but I have no clue how to enable an obsolete extension without triggering the ObsoleteExtensionException and thus preventing the enabling.

bbrala’s picture

Hmm, i wonder if you could just install a deprecated module, then update the lifecycle config to say its obselete instead of using the installer flow.

catch’s picture

Updated MR, but I have no clue how to enable an obsolete extension without triggering the ObsoleteExtensionException and thus preventing the enabling.

I don't think we need test coverage for that situation, it's what the exception is for. Having some language there for the very rare cases someone manages to do it doesn't hurt either way.

gábor hojtsy’s picture

Added this under #3251854: [META] Requirements for tagging Drupal 10.0.0-alpha1 as a should have since it would be really nice to land this before alpha1 as per @catch :)

catch’s picture

Title: Highlight obsolete modules and themes at admin/reports/status page, providing warning and link with explanation » Highlight deprecated modules and themes at admin/reports/status page, providing warning and link with explanation

Updating the title, IMO deprecated modules are the priority here, obsolete would be completely optional because they should never be installed anyway.

quietone’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new98.4 KB

Added deprecated modules and themes as separate warnings, just the same as experimental. The links are just TBD because I didn't like the idea of sending an admin to a core development page about deprecation policy. I haven't searched but this may need a new page that describes the extension lifecycle for an administrator.

Also, added an after screenshot, which includes an obsolete module and theme.

quietone’s picture

Issue summary: View changes

Added testing of the warning messages. Leaving the needs tests tag because the code for 'obsolete' is still in the MR and maybe we want to test that as well.

quietone’s picture

Looked at the docs and found two places where information about the lifecycle could be added

  1. Chapter 11. Extending and Customizing Your Site This is in the curated user guide, which requires an issue in the User Guide project.
  2. The Overview section of Extending Drupal

Suggestions?

spokje’s picture

Resolved all threads and updated MR with latest commits from 9.4.x-dev.

spokje’s picture

Issue tags: -Needs tests
daffie’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

In the IS there is nothing about deprecated and/or obsolete modules and/or themes.

gábor hojtsy’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update

Made issue summary clearer, inlined screenshot.

I also agree that testing would be impossible for obsolete extensions given you can't install them in the test.

spokje’s picture

Status: Needs review » Needs work

Resolved all threads created by @daffie, hoping that I've explained it clear enough.

spokje’s picture

Status: Needs work » Needs review

Restoring Status, thanks @Gábor Hojtsy for the IS update.

daffie’s picture

Status: Needs review » Reviewed & tested by the community

All code changes look good to me.
All my points have been addressed.
The IS is in order.
For me it is RTBC.

catch’s picture

Status: Reviewed & tested by the community » Needs work

Let's remove the 'Click the links' language per https://www.drupal.org/project/drupal/issues/3250585#mr1567-note66044

Otherwise agreed this is RTBC.

spokje’s picture

Status: Needs work » Reviewed & tested by the community
spokje’s picture

Status: Reviewed & tested by the community » Needs review
longwave’s picture

Status: Needs review » Needs work

The documentation link for obsolete extensions points to https://www.drupal.org/core/TBD

Otherwise this looks ready to go.

spokje’s picture

Since lifecycle: obsolete also always comes hand in hand with a lifcycle_link, we _could_ do the same as we did for lifecycle: deprecated and make the name of the extension a link to each lifcycle_link?

gábor hojtsy’s picture

Since lifecycle: obsolete also always comes hand in hand with a lifcycle_link, we _could_ do the same as we did for lifecycle: deprecated and make the name of the extension a link to each lifcycle_link?

Yes, good plan! :)

spokje’s picture

Status: Needs work » Needs review
longwave’s picture

Status: Needs review » Needs work

We should not generate HTML manually without ensuring it is properly escaped.

spokje’s picture

Status: Needs work » Needs review

Re-resolved all threads

Waves at guy running down the same hill following a boulder.
"Hi Sisyphus!"

daffie’s picture

Status: Needs review » Needs work

Testbot is not happy.

spokje’s picture

catch’s picture

Status: Needs work » Needs review

Looks good to me, not sure how to trigger retesting on MRs.

spokje’s picture

Let's give this another TestBot round after #3259744: PHPUnit 9.5.12 (released 2022-01-21) throws unhandled deprecation notice on "Drupal\Tests\Listeners\DrupalListener" got in.

Waves at Sisyphus going up whilst chasing his own boulder downwards

spokje’s picture

Let's merge the fix first and _then_ start a retest

facepalms after kicking his own boulder into a ditch at the bottom of the hill.

spokje’s picture

Green TestBot.

daffie’s picture

Status: Needs review » Reviewed & tested by the community

All points have been addressed.
Back to RTBC.

  • catch committed 54f08fb on 10.0.x
    Issue #3250585 by Spokje, ankithashetty, karishmaamin, quietone, catch,...

  • catch committed 06cfb95 on 9.4.x
    Issue #3250585 by Spokje, ankithashetty, karishmaamin, quietone, catch,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

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

longwave’s picture

      $requirements['deprecated_modules'] = [
        'title' => t('Deprecated modules enabled'),
        'value' => t('Deprecated modules found: %module_list.', [
          '%module_list' => t(implode(',', $deprecated_modules_link_list)),
        ]),
        'severity' => REQUIREMENT_WARNING,
      ];

I think this is a misuse of t() in the %module_list parameter, translating the list like that doesn't make sense. Will open a followup.

spokje’s picture

I think this is a misuse of t() in the %module_list parameter, translating the list like that doesn't make sense.

Agreed, but it was the only way I could find to use an implode() and get the links as HTML instead of <a href="...> text.

catch’s picture

Status: Fixed » Closed (fixed)

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