We've accumulated a lot of BC layers in the rest.module component. In this issue, we maintain an up-to-date patch that removes all BC layers, which allows us to track how much of a difference this would make.

CommentFileSizeAuthor
#94 2893804-94.patch199.07 KBwim leers
#94 interdiff.txt1.1 KBwim leers
#91 2893804-91.patch198.96 KBwim leers
#91 interdiff-87-91.txt1.46 KBwim leers
#88 2893804-88.patch202.09 KBstefdewa
#88 interdiff.txt3.62 KBstefdewa
#87 2893804-87.patch198.89 KBwim leers
#87 interdiff.txt9.63 KBwim leers
#79 2893804-79-9.0.x.patch191.74 KBwim leers
#79 interdiff.txt2.07 KBwim leers
#77 2893804-76-9.0.x.patch192.22 KBwim leers
#77 interdiff.txt30.1 KBwim leers
#75 2893804-75-9.0.x.patch223.95 KBwim leers
#75 interdiff.txt2.71 KBwim leers
#73 interdiff-bc-timestamp-normalizer-trait.txt1.03 KBwim leers
#73 interdiff.txt2.31 KBwim leers
#73 2893804-72-9.0.x.patch222.69 KBwim leers
#72 interdiff-64-67.txt5.54 KBwim leers
#70 2893804-70-8.8.x.patch4.16 KBwim leers
#70 interdiff.txt1.3 KBwim leers
#67 2893804-67-8.8.x.patch2.86 KBwim leers
#67 2893804-67-9.0.x.patch223.57 KBwim leers
#64 2893804-64.patch226.66 KBwim leers
#64 interdiff.txt1.4 KBwim leers
#63 2893804-63.patch226.95 KBwim leers
#55 2893804-55.patch233.08 KBwim leers
#55 interdiff.txt888 byteswim leers
#53 2893804-53.patch232.52 KBwim leers
#53 interdiff.txt791 byteswim leers
#51 2893804-51.patch232.27 KBwim leers
#51 interdiff.txt1.47 KBwim leers
#48 2893804-47.patch230.89 KBwim leers
#47 2893804-47.patch228.59 KBwim leers
#47 interdiff.txt3.13 KBwim leers
#45 2893804-44.patch227.86 KBwim leers
#44 2893804-44.patch225.56 KBwim leers
#44 interdiff.txt3.27 KBwim leers
#42 2893804-42.patch226.05 KBwim leers
#42 interdiff.txt3.56 KBwim leers
#41 2893804-41.patch225 KBwim leers
#35 2893804-35.patch225.15 KBwim leers
#35 interdiff.txt17.18 KBwim leers
#34 2893804-34.patch208.9 KBwim leers
#32 2893804-32.patch206.21 KBwim leers
#32 interdiff.txt55.66 KBwim leers
#31 2893804-31.patch151.49 KBwim leers
#31 interdiff.txt2.64 KBwim leers
#30 2893804-30.patch147.48 KBwim leers
#28 2893804-28.patch150.03 KBwim leers
#28 interdiff.txt3.6 KBwim leers
#27 2893804-27.patch147.44 KBwim leers
#27 interdiff.txt6.46 KBwim leers
#26 2893804-26.patch142.65 KBwim leers
#24 2893804-24.patch140.34 KBwim leers
#24 interdiff.txt1.29 KBwim leers
#23 2893804-23.patch139.53 KBwim leers
#22 2893804-22.patch141.56 KBwim leers
#22 interdiff.txt7.74 KBwim leers
#19 2893804-19.patch133.87 KBwim leers
#19 interdiff.txt3.33 KBwim leers
#18 2893804-18.patch129.21 KBwim leers
#18 interdiff.txt1016 byteswim leers
#2 2893804-2.patch105.23 KBwim leers
#4 2893804-4.patch103.08 KBwim leers
#5 interdiff.txt2.63 KBwim leers
#5 2893804-5.patch105.65 KBwim leers
#6 interdiff.txt7.97 KBwim leers
#6 2893804-6.patch113.32 KBwim leers
#7 2893804-7.patch115.63 KBwim leers
#8 interdiff.txt4.94 KBwim leers
#8 2893804-8.patch120.47 KBwim leers
#9 interdiff.txt8.79 KBwim leers
#9 2893804-9.patch127.67 KBwim leers
#10 2893804-10.patch127.56 KBwim leers
#11 interdiff.txt3.03 KBwim leers
#11 2893804-11.patch129.72 KBwim leers
#12 2893804-12.patch132.02 KBwim leers
#17 interdiff.txt1.76 KBwim leers
#17 2893804-17.patch131.97 KBwim leers

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Title: Remove serialization.module BC layers » Remove rest.module BC layers
StatusFileSize
new105.23 KB

This removes all BC layers from core/modules/rest as of July 11, 2017, commit e1e216138f5311a5dd6b96b5789ab2db9ac5fd5f.

(Note that this must be applied on top of #2893795-2: Remove serialization.module BC layers.)

 core/modules/rest/config/install/rest.settings.yml |   7 -
 core/modules/rest/config/schema/rest.schema.yml    |  14 -
 core/modules/rest/rest.api.php                     |  57 --
 core/modules/rest/rest.install                     |  60 --
 core/modules/rest/rest.post_update.php             |  63 ---
 core/modules/rest/rest.routing.yml                 |   9 -
 core/modules/rest/rest.services.yml                |  15 -
 .../src/EventSubscriber/RestConfigSubscriber.php   |  53 --
 .../ConfigurableLinkManagerInterface.php           |  13 -
 core/modules/rest/src/LinkManager/LinkManager.php  |  13 -
 .../rest/src/LinkManager/LinkManagerBase.php       |  13 -
 .../rest/src/LinkManager/LinkManagerInterface.php  |  13 -
 .../rest/src/LinkManager/RelationLinkManager.php   |  13 -
 .../LinkManager/RelationLinkManagerInterface.php   |  13 -
 .../rest/src/LinkManager/TypeLinkManager.php       |  13 -
 .../src/LinkManager/TypeLinkManagerInterface.php   |  13 -
 .../PathProcessorEntityResourceBC.php              |  55 --
 core/modules/rest/src/Plugin/ResourceBase.php      |   8 -
 .../src/Plugin/rest/resource/EntityResource.php    |  10 +-
 core/modules/rest/src/RestServiceProvider.php      |  51 --
 core/modules/rest/src/Tests/RESTTestBase.php       | 624 ---------------------
 .../Update/EntityResourcePermissionsUpdateTest.php |  56 --
 .../Tests/Update/ResourceGranularityUpdateTest.php |  71 ---
 .../Update/RestConfigurationEntitiesUpdateTest.php |  65 ---
 .../src/Tests/Update/RestExportAuthUpdateTest.php  |  36 --
 ....rest-rest_post_update_resource_granularity.php | Bin 5199 -> 0 bytes
 .../update/drupal-8.rest-rest_update_8201.php      |  59 --
 .../update/drupal-8.rest-rest_update_8203.php      |  58 --
 .../update/rest-export-with-authentication.php     |  65 ---
 .../rest.resource.entity.comment_2721595.yml       |  32 --
 .../update/rest.resource.entity.node_2721595.yml   |  29 -
 .../update/rest.resource.entity.user_2721595.yml   |  32 --
 .../BcTimestampNormalizerUnixTestTrait.php         |  43 --
 .../BaseFieldOverrideResourceTestBase.php          |   4 -
 .../EntityResource/Block/BlockResourceTestBase.php |   4 -
 .../Comment/CommentResourceTestBase.php            |  17 +-
 .../Editor/EditorResourceTestBase.php              |   4 -
 .../EntityResource/EntityResourceTestBase.php      | 171 ------
 .../EntityTest/EntityTestResourceTestBase.php      |  12 +-
 .../EntityTestLabelResourceTestBase.php            |  12 +-
 .../EntityResource/Feed/FeedResourceTestBase.php   |  22 +-
 .../FieldConfig/FieldConfigResourceTestBase.php    |   4 -
 .../FieldStorageConfigResourceTestBase.php         |   4 -
 .../ImageStyle/ImageStyleResourceTestBase.php      |   4 -
 .../EntityResource/Item/ItemResourceTestBase.php   |  12 +-
 .../MenuLinkContentResourceTestBase.php            |  12 +-
 .../EntityResource/Node/NodeResourceTestBase.php   |  22 +-
 .../NodeType/NodeTypeResourceTestBase.php          |   4 -
 .../SearchPage/SearchPageResourceTestBase.php      |   4 -
 .../Shortcut/ShortcutResourceTestBase.php          |   4 -
 .../EntityResource/Term/TermResourceTestBase.php   |  12 +-
 .../EntityResource/Tour/TourResourceTestBase.php   |   4 -
 .../EntityResource/User/UserResourceTestBase.php   |  17 +-
 53 files changed, 62 insertions(+), 1963 deletions(-)
wim leers’s picture

Status: Active » Postponed

(This module likely has the most BC layers and the most BC layer test coverage of all of core I think, considering how much we can remove…)

wim leers’s picture

StatusFileSize
new103.08 KB

Rebased for 8.5.x, commit 0fa72bdeea3d72e874b25dc72d2185645b57d6c5.

wim leers’s picture

Related issues: +#2720233: Use arguments resolver in RequestHandler to have consistent parameter ordering
StatusFileSize
new2.63 KB
new105.65 KB

Updating for BC layers added to #2720233: Use arguments resolver in RequestHandler to have consistent parameter ordering.

Slightly bigger diffstat now:

 core/modules/rest/config/install/rest.settings.yml |   7 -
 core/modules/rest/config/schema/rest.schema.yml    |  14 -
 core/modules/rest/rest.api.php                     |  57 --
 core/modules/rest/rest.install                     |  60 --
 core/modules/rest/rest.post_update.php             |  63 ---
 core/modules/rest/rest.routing.yml                 |   9 -
 core/modules/rest/rest.services.yml                |  15 -
 .../src/EventSubscriber/RestConfigSubscriber.php   |  53 --
 .../ConfigurableLinkManagerInterface.php           |  13 -
 core/modules/rest/src/LinkManager/LinkManager.php  |  13 -
 .../rest/src/LinkManager/LinkManagerBase.php       |  13 -
 .../rest/src/LinkManager/LinkManagerInterface.php  |  13 -
 .../rest/src/LinkManager/RelationLinkManager.php   |  13 -
 .../LinkManager/RelationLinkManagerInterface.php   |  13 -
 .../rest/src/LinkManager/TypeLinkManager.php       |  13 -
 .../src/LinkManager/TypeLinkManagerInterface.php   |  13 -
 .../PathProcessorEntityResourceBC.php              |  55 --
 core/modules/rest/src/Plugin/ResourceBase.php      |   8 -
 .../src/Plugin/rest/resource/EntityResource.php    |  10 +-
 core/modules/rest/src/RequestHandler.php           |  41 +-
 core/modules/rest/src/RestServiceProvider.php      |  51 --
 core/modules/rest/src/Tests/RESTTestBase.php       | 624 ---------------------
 ....rest-rest_post_update_resource_granularity.php | Bin 5199 -> 0 bytes
 .../update/drupal-8.rest-rest_update_8201.php      |  59 --
 .../update/drupal-8.rest-rest_update_8203.php      |  58 --
 .../update/rest-export-with-authentication.php     |  65 ---
 .../rest.resource.entity.comment_2721595.yml       |  32 --
 .../update/rest.resource.entity.node_2721595.yml   |  29 -
 .../update/rest.resource.entity.user_2721595.yml   |  32 --
 .../BcTimestampNormalizerUnixTestTrait.php         |  43 --
 .../BaseFieldOverrideResourceTestBase.php          |   4 -
 .../EntityResource/Block/BlockResourceTestBase.php |   4 -
 .../Comment/CommentResourceTestBase.php            |  17 +-
 .../Editor/EditorResourceTestBase.php              |   4 -
 .../EntityResource/EntityResourceTestBase.php      | 171 ------
 .../EntityTest/EntityTestResourceTestBase.php      |  12 +-
 .../EntityTestLabelResourceTestBase.php            |  12 +-
 .../EntityResource/Feed/FeedResourceTestBase.php   |  22 +-
 .../FieldConfig/FieldConfigResourceTestBase.php    |   4 -
 .../FieldStorageConfigResourceTestBase.php         |   4 -
 .../ImageStyle/ImageStyleResourceTestBase.php      |   4 -
 .../EntityResource/Item/ItemResourceTestBase.php   |  12 +-
 .../MenuLinkContentResourceTestBase.php            |  12 +-
 .../EntityResource/Node/NodeResourceTestBase.php   |  22 +-
 .../NodeType/NodeTypeResourceTestBase.php          |   4 -
 .../SearchPage/SearchPageResourceTestBase.php      |   4 -
 .../Shortcut/ShortcutResourceTestBase.php          |   4 -
 .../EntityResource/Term/TermResourceTestBase.php   |  12 +-
 .../EntityResource/Tour/TourResourceTestBase.php   |   4 -
 .../EntityResource/User/UserResourceTestBase.php   |  17 +-
 .../Update/EntityResourcePermissionsUpdateTest.php |  56 --
 .../Update/ResourceGranularityUpdateTest.php       |  71 ---
 .../Update/RestConfigurationEntitiesUpdateTest.php |  65 ---
 .../Functional/Update/RestExportAuthUpdateTest.php |  36 --
 54 files changed, 63 insertions(+), 2003 deletions(-)
wim leers’s picture

StatusFileSize
new7.97 KB
new113.32 KB

Updating for BC layers added in #2825204: REST views: authentication is broken. Which added a whole bunch of BC layer/update path code that can be removed. ~180 additional line deletions:

 core/modules/rest/config/install/rest.settings.yml |   7 -
 core/modules/rest/config/schema/rest.schema.yml    |  14 -
 core/modules/rest/rest.api.php                     |  57 --
 core/modules/rest/rest.install                     |  96 ----
 core/modules/rest/rest.module                      |  27 -
 core/modules/rest/rest.post_update.php             |  63 ---
 core/modules/rest/rest.routing.yml                 |   9 -
 core/modules/rest/rest.services.yml                |  15 -
 .../src/EventSubscriber/RestConfigSubscriber.php   |  53 --
 .../ConfigurableLinkManagerInterface.php           |  13 -
 core/modules/rest/src/LinkManager/LinkManager.php  |  13 -
 .../rest/src/LinkManager/LinkManagerBase.php       |  13 -
 .../rest/src/LinkManager/LinkManagerInterface.php  |  13 -
 .../rest/src/LinkManager/RelationLinkManager.php   |  13 -
 .../LinkManager/RelationLinkManagerInterface.php   |  13 -
 .../rest/src/LinkManager/TypeLinkManager.php       |  13 -
 .../src/LinkManager/TypeLinkManagerInterface.php   |  13 -
 .../PathProcessorEntityResourceBC.php              |  55 --
 core/modules/rest/src/Plugin/ResourceBase.php      |   8 -
 .../src/Plugin/rest/resource/EntityResource.php    |  10 +-
 .../rest/src/Plugin/views/display/RestExport.php   |  18 -
 core/modules/rest/src/RequestHandler.php           |  41 +-
 core/modules/rest/src/RestServiceProvider.php      |  51 --
 core/modules/rest/src/Tests/RESTTestBase.php       | 626 ---------------------
 .../Update/RestExportAuthCorrectionUpdateTest.php  |  36 --
 ....rest-rest_post_update_resource_granularity.php | Bin 5199 -> 0 bytes
 .../update/drupal-8.rest-rest_update_8201.php      |  59 --
 .../update/drupal-8.rest-rest_update_8203.php      |  58 --
 .../rest-export-with-authentication-correction.php |  63 ---
 .../update/rest-export-with-authentication.php     |  65 ---
 .../rest.resource.entity.comment_2721595.yml       |  32 --
 .../update/rest.resource.entity.node_2721595.yml   |  29 -
 .../update/rest.resource.entity.user_2721595.yml   |  32 --
 .../BcTimestampNormalizerUnixTestTrait.php         |  43 --
 .../BaseFieldOverrideResourceTestBase.php          |   4 -
 .../EntityResource/Block/BlockResourceTestBase.php |   4 -
 .../Comment/CommentResourceTestBase.php            |  17 +-
 .../Editor/EditorResourceTestBase.php              |   4 -
 .../EntityResource/EntityResourceTestBase.php      | 174 ------
 .../EntityTest/EntityTestResourceTestBase.php      |  12 +-
 .../EntityTestLabelResourceTestBase.php            |  12 +-
 .../EntityResource/Feed/FeedResourceTestBase.php   |  22 +-
 .../FieldConfig/FieldConfigResourceTestBase.php    |   4 -
 .../FieldStorageConfigResourceTestBase.php         |   4 -
 .../ImageStyle/ImageStyleResourceTestBase.php      |   4 -
 .../EntityResource/Item/ItemResourceTestBase.php   |  12 +-
 .../MenuLinkContentResourceTestBase.php            |  12 +-
 .../EntityResource/Node/NodeResourceTestBase.php   |  22 +-
 .../NodeType/NodeTypeResourceTestBase.php          |   4 -
 .../SearchPage/SearchPageResourceTestBase.php      |   4 -
 .../Shortcut/ShortcutResourceTestBase.php          |   4 -
 .../EntityResource/Term/TermResourceTestBase.php   |  12 +-
 .../EntityResource/Tour/TourResourceTestBase.php   |   4 -
 .../EntityResource/User/UserResourceTestBase.php   |  17 +-
 .../Update/EntityResourcePermissionsUpdateTest.php |  56 --
 .../Update/ResourceGranularityUpdateTest.php       |  71 ---
 .../Update/RestConfigurationEntitiesUpdateTest.php |  65 ---
 .../Functional/Update/RestExportAuthUpdateTest.php |  36 --
 58 files changed, 63 insertions(+), 2188 deletions(-)
wim leers’s picture

StatusFileSize
new115.63 KB

There have been quite a few REST changes lately. Patch didn't apply anymore.

Rebased on top of commit 91e668f5758159b27bea9e4bc3247969fa91232a, solved all conflicts. Because of removed whitespace, there are now fewer deletions:

58 files changed, 63 insertions(+), 2168 deletions(-)

Also: I should've been queueing tests for this, to prove that it works. Did that this time.

wim leers’s picture

StatusFileSize
new4.94 KB
new120.47 KB

More REST tests have been added, I haven't updated them all perfectly, hence tests not being able to run.

5 more files changed:

 63 files changed, 79 insertions(+), 2182 deletions(-)
wim leers’s picture

StatusFileSize
new8.79 KB
new127.67 KB

This should fix some of the failures.

wim leers’s picture

wim leers’s picture

Related issues: +#2765959: Make 4xx REST responses cacheable by (Dynamic) Page Cache + comprehensive cacheability test coverage
StatusFileSize
new3.03 KB
new129.72 KB

#2765959: Make 4xx REST responses cacheable by (Dynamic) Page Cache + comprehensive cacheability test coverage added some extra code to ensure BC layers are respected by the support for caching responses:

+      // Add global rest settings config's cache tag, for BC flags.
+      // @see \Drupal\rest\Plugin\rest\resource\EntityResource::permissions()
+      // @see \Drupal\rest\EventSubscriber\RestConfigSubscriber
+      // @todo Remove in https://www.drupal.org/node/2893804
+      $response->addCacheableDependency($this->configFactory->get('rest.settings'));

(and more)

That can now all be removed too.

Diffstat keeps getting more appealing:

 68 files changed, 92 insertions(+), 2275 deletions(-)
wim leers’s picture

StatusFileSize
new132.02 KB
error: cannot apply binary patch to 'core/modules/rest/tests/fixtures/update/drupal-8.rest-rest_post_update_resource_granularity.php' without full index line
error: core/modules/rest/tests/fixtures/update/drupal-8.rest-rest_post_update_resource_granularity.php: patch does not apply

I hate git diff --binary with a passion. A) git is stupid for thinking it's binary, B) why can't I configure git to always create binary patches!?

This patch is identical to 11, but with --binary.

wim leers’s picture

Drupal\dblog\Tests\Rest\DbLogResourceTest fails with a fatal error, because it uses a deprecated base class that this patch is removing. Created #2927758: Update DbLogResourceTest to use the ResourceTestBase base class instead of the deprecated RESTTestBase to update that test to no longer use the deprecated base test class. That now blocks this patch from becoming green.

wim leers’s picture

Title: Remove rest.module BC layers » [PP-3] Remove rest.module BC layers

This is blocked on #13 + #14 + #15.

wim leers’s picture

StatusFileSize
new131.97 KB
new1.76 KB

All remaining test failures except for the 3 listed in #13+#14+#15 are like this:

/usr/local/bin/php /private/var/folders/f6/g_q2g6w545z_q3h4cx7kv2qm0000gn/T/ide-phpunit.php --configuration /Users/wim.leers/Work/d8/core/phpunit.xml --filter "/::testSourceFeedRequired( .*)?$/" Drupal\Tests\aggregator\Functional\Update\AggregatorUpdateTest /Users/wim.leers/Work/d8/core/modules/aggregator/tests/src/Functional/Update/AggregatorUpdateTest.php
Testing started at 12:05 ...
#!/usr/bin/env php
PHPUnit 4.8.36 by Sebastian Bergmann and contributors.

Testing Drupal\Tests\aggregator\Functional\Update\AggregatorUpdateTest
F

Time: 36.9 seconds, Memory: 6.00MB

There was 1 failure:

1) Drupal\Tests\aggregator\Functional\Update\AggregatorUpdateTest::testSourceFeedRequired
No schema for rest.settings

/Users/wim.leers/Work/d8/core/tests/Drupal/Tests/SchemaCheckTestTrait.php:31
/Users/wim.leers/Work/d8/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php:372
/Users/wim.leers/Work/d8/core/modules/aggregator/tests/src/Functional/Update/AggregatorUpdateTest.php:34

FAILURES!
Tests: 1, Assertions: 251, Failures: 1.

Process finished with exit code 1

Interestingly, this only happens for update path tests. My guess: because the default installation of D8 that update path tests run against does contain rest.settings configuration.

If I restore just

rest.settings:
  type: config_object

then the error changes to:

Schema key rest.settings:resources failed with: missing schema

Which points to rest_update_8201() + rest_post_update_create_rest_resource_config_entities(). Sure enough, when I add rest_update_8201(), tests pass again. (Or at lest AggregatorUpdateTest does.) I searched and found the minimal work-around necessary for now.

wim leers’s picture

StatusFileSize
new1016 bytes
new129.21 KB
Schema key rest.settings:bc_entity_resource_permissions failed with: missing schema

Looks like I literally have to restore the entire config schema.

wim leers’s picture

StatusFileSize
new3.33 KB
new133.87 KB

This fixes the failures in EntitySerializationTest, Drupal\Tests\rest\Kernel\RequestHandlerTest and Drupal\Tests\rest\Functional\ResourceTest.

For the 3 remaining failures, see #13+#14+#15.

Current tally:

 69 files changed, 105 insertions(+), 2246 deletions(-)
wim leers’s picture

Title: [PP-2] Remove rest.module BC layers » [PP-1] Remove rest.module BC layers
wim leers’s picture

StatusFileSize
new7.74 KB
new141.56 KB

The failing RestExportAuthTest was effectively an update path test, without it being named that way. Deleted it, and its test view.

71 files changed, 105 insertions(+), 2518 deletions(-)
wim leers’s picture

StatusFileSize
new139.53 KB

This no longer applied. Rebased. Solved dozens of conflicts.

Diffstat is still similar:

71 files changed, 103 insertions(+), 2491 deletions(-)
wim leers’s picture

StatusFileSize
new1.29 KB
new140.34 KB

Per #2940417: Remove always_populate_raw_post_data requirements check, which might be incorrect, rest_requirements() can be removed as soon as Drupal doesn't support PHP 5.6 anymore. Drupal 9 won't support it. So, removing it.

71 files changed, 103 insertions(+), 2508 deletions(-)
wim leers’s picture

(The lower number of lines removed is mostly due to RequestHandler and EntityResourceTestBase having been improved in HEAD!)

wim leers’s picture

StatusFileSize
new142.65 KB

It's been ~5 months since I rerolled this patch, so I forgot how stupid git is again:

error: cannot apply binary patch to 'core/modules/rest/tests/fixtures/update/drupal-8.rest-rest_post_update_resource_granularity.php' without full index line

Rerolled #24 with --binary.

wim leers’s picture

StatusFileSize
new6.46 KB
new147.44 KB

Fixed

00:00:53.818 PHP Fatal error:  Trait 'Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait' not found in /var/www/html/core/modules/rest/tests/src/Functional/EntityResource/File/FileResourceTestBase.php on line 12

New diffstat:

74 files changed, 119 insertions(+), 2523 deletions(-)
wim leers’s picture

StatusFileSize
new3.6 KB
new150.03 KB

Yay, only 30 failures, not bad! Fixing some of the trivial failures.

wim leers’s picture

No longer applies because #2910883: Move all entity type REST tests to the providing modules landed. Very painful rebase.

wim leers’s picture

StatusFileSize
new147.48 KB

Rebase completed. Hopefully I didn't make too many mistakes.

 75 files changed, 150 insertions(+), 2536 deletions(-)
wim leers’s picture

StatusFileSize
new2.64 KB
new151.49 KB

And while doing the rebase, I spotted a few things I missed in the REST tests that were added since #21/December last year.

More importantly, I again forgot to do #30 with --binary 🙃

wim leers’s picture

StatusFileSize
new55.66 KB
new206.21 KB

With #2910883: Move all entity type REST tests to the providing modules committed, there now is again a whole lot of additional BC layer that needs to be removed! This interdiff does that.

 122 files changed, 150 insertions(+), 3284 deletions(-)
wim leers’s picture

Status: Postponed » Needs review
StatusFileSize
new208.9 KB

#2927768: Update RestRegisterUserTest to use the ResourceTestBase base class instead of the deprecated RESTTestBase landed, so this is no longer postponed on anything except for the D9 branch being opened 🥳

Nearly a year later, time for an update. Commit c8dc57eedea3fd34de067098ca2ee36e6c459245. Rebased #32. Next: removing any BC layers added since then.

 122 files changed, 150 insertions(+), 3311 deletions(-)
wim leers’s picture

StatusFileSize
new17.18 KB
new225.15 KB

Done.

 130 files changed, 159 insertions(+), 3502 deletions(-)
wim leers’s picture

Title: [PP-1] Remove rest.module BC layers » Remove rest.module BC layers

Per #34.

wim leers’s picture

Issue tags: +API-First Initiative

Version: 9.x-dev » 9.0.x-dev

The 9.0.x branch will open for development soon, and the placeholder 9.x branch should no longer be used. Only issues that require a new major version should be filed against 9.0.x (for example, removing deprecated code or updating dependency major versions). New developments and disruptive changes that are allowed in a minor version should be filed against 8.9.x, and significant new features will be moved to 9.1.x at committer discretion. For more information see the Allowed changes during the Drupal 8 and 9 release cycles and the Drupal 9.0.0 release plan.

wim leers’s picture

Assigned: Unassigned » wim leers
Status: Needs review » Needs work
Issue tags: +Amsterdam2019

Now that #3087874: [meta] Make 9.0.x branch pass testbot is done, let's do this!

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new225 KB

To start us off: a rebase of #35.

wim leers’s picture

StatusFileSize
new3.56 KB
new226.05 KB

Fixed phpcs violations.

Status: Needs review » Needs work

The last submitted patch, 42: 2893804-42.patch, failed testing. View results

wim leers’s picture

Status: Needs work » Needs review
Issue tags: +Deprecation Removal
StatusFileSize
new3.27 KB
new225.56 KB
wim leers’s picture

StatusFileSize
new227.86 KB

😈 --binary

Status: Needs review » Needs work

The last submitted patch, 45: 2893804-44.patch, failed testing. View results

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new3.13 KB
new228.59 KB

Some new tests were added since #35 in February, this removes BC layer logic from those as well.

This patch won't be green yet, but it'll be quite a bit closer.

wim leers’s picture

StatusFileSize
new230.89 KB

😈 --binary

jibran’s picture

FYI; this will conflict with #3087644: Remove Drupal 8 updates up to and including 88** so this is pp-1 technically.

Status: Needs review » Needs work

The last submitted patch, 48: 2893804-47.patch, failed testing. View results

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new1.47 KB
new232.27 KB

#49: Easy rebase for either one though! :)

Yay, #48 is down to 20 failures.

Most of the remaining failures are caused by a single removal of deprecated code, specifically:

-    // BC: the REST module originally created the POST URL for a resource by
-    // reading the 'https://www.drupal.org/link-relations/create' URI path from
-    // the plugin annotation. For consistency with entity type definitions, that
-    // then changed to reading the 'create' URI path. For any REST Resource
-    // plugins that were using the old mechanism, we continue to support that.
-    if (!isset($definition['uri_paths']['create']) && isset($definition['uri_paths']['https://www.drupal.org/link-relations/create'])) {
-      $create_path = $definition['uri_paths']['https://www.drupal.org/link-relations/create'];
-    }

… because the two @RestResource plugins in Drupal core that were still using the deprecated declaration had not yet been updated! Easy fix :)

Status: Needs review » Needs work

The last submitted patch, 51: 2893804-51.patch, failed testing. View results

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new791 bytes
new232.52 KB

Lowest number of failures yet! 🥳

Let's bring it even lower.

Status: Needs review » Needs work

The last submitted patch, 53: 2893804-53.patch, failed testing. View results

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new888 bytes
new233.08 KB

The last failures are caused by \Drupal\Component\Utility\ArgumentsResolver treating non-object-typehinted function arguments really weirdly. In HEAD, this automatically falls back to the BC layer (also see #5), but this patch removes that. So we have to actually fix it.

This should be green 🔥😬

wim leers’s picture

Assigned: wim leers » Unassigned

🥳

 137 files changed, 186 insertions(+), 3516 deletions(-)

🙏

berdir’s picture

  1. +++ b/core/modules/rest/src/RequestHandler.php
    @@ -41,13 +33,10 @@ class RequestHandler implements ContainerInjectionInterface {
        * Creates a new RequestHandler instance.
        *
    -   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    -   *   The config factory.
        * @param \Symfony\Component\Serializer\SerializerInterface|\Symfony\Component\Serializer\Encoder\DecoderInterface $serializer
        *   The serializer.
        */
    -  public function __construct(ConfigFactoryInterface $config_factory, SerializerInterface $serializer) {
    -    $this->configFactory = $config_factory;
    +  public function __construct(SerializerInterface $serializer) {
         $this->serializer = $serializer;
       }
     
    @@ -56,7 +45,6 @@ public function __construct(ConfigFactoryInterface $config_factory, SerializerIn
    

    This is technically a BC break between 8.9 and 9.0, removing constructor arguments is tricky.

    To be extra careful, we could remove the type hint and check for that, basically adding a D10 deprecation. Not sure if it's worth it.

  2. +++ b/core/modules/rest/src/RequestHandler.php
    @@ -288,6 +265,10 @@ protected function createArgumentResolver(RouteMatchInterface $route_match, $uns
           $upcasted_route_arguments['original_entity'] = $route_arguments_entity;
    +      // ArgumentsResolver treats arrays like scalars, so pass it as a scalar.
    +      if (is_array($unserialized)) {
    +        $raw_route_arguments['data'] = $unserialized;
    +      }
         }
    

    Lets fix this first in #3067762: Fix bug in \Drupal\rest\RequestHandler::createArgumentResolver and handle "Passing in arguments the legacy way is deprecated" deprecation, has tests and everything, just needs a review :)

berdir’s picture

+++ /dev/null
@@ -1,7 +0,0 @@
-# Before Drupal 8.2, EntityResource used permissions as well as the entity
-# access system for access checking. This was confusing, and it only did this
-# for historical reasons. New Drupal installations opt out from this by default
-# (hence this is set to false), existing installations opt in to it.
-# @see rest_update_8203()
-# @see https://www.drupal.org/node/2664780
-bc_entity_resource_permissions: false

Don't we need an update function that now *removes* this setting, as we remove the default and (eventually)schema for it?

Otherwise any D8 site will have it in their config export still.

wim leers’s picture

Title: Remove rest.module BC layers » [PP-1] Remove rest.module BC layers
Status: Needs review » Postponed
wim leers’s picture

Note: I'm happy to split this up into multiple patches, because this is one very big patch obviously!

berdir’s picture

Status: Postponed » Needs work

The blocker is in, so this can be rerolled and we still need to clean up the BC setting per #58

wim leers’s picture

Assigned: Unassigned » wim leers

Yay!

wim leers’s picture

Title: [PP-1] Remove rest.module BC layers » Remove rest.module BC layers
Status: Needs work » Needs review
StatusFileSize
new226.95 KB

First, a straight rebase (with dozens of conflicts to resolve, which was to be expected).

wim leers’s picture

Assigned: wim leers » Unassigned
StatusFileSize
new1.4 KB
new226.66 KB

This fixes #57.2 and #58. I think #58 also should have an update path test? (That's not yet in this patch.)

berdir’s picture

Probably not a bad idea to have a test? We can repurpose the existing fixtures on top of the new 8.8 dumps instead and then test with that?

  1. +++ b/core/modules/aggregator/tests/src/Functional/Rest/FeedResourceTestBase.php
    @@ -105,10 +102,16 @@ protected function getExpectedNormalizedEntity() {
           ],
           'checked' => [
    -        $this->formatExpectedTimestampItemValues(123456789),
    +        [
    +          'value' => (new \DateTime())->setTimestamp(123456789)->setTimezone(new \DateTimeZone('UTC'))->format(\DateTime::RFC3339),
    +          'format' => \DateTime::RFC3339,
    +        ],
    

    what about keeping the helper function? seems to be called 33 times or so and the replacement is not trivial with the timezone and correct format.

    Unfortunately the name of the trait has BC in it.

    Another problem is that this trait itself was not deprecated nor internal, and by removing it, we kind of break tests between 8.9 9.0 if they would use this.

  2. +++ b/core/modules/file/src/Plugin/rest/resource/FileUploadResource.php
    @@ -48,7 +48,7 @@
      *   serialization_class = "Drupal\file\Entity\File",
      *   uri_paths = {
    - *     "https://www.drupal.org/link-relations/create" = "/file/upload/{entity_type_id}/{bundle}/{field_name}"
    + *     "create" = "/file/upload/{entity_type_id}/{bundle}/{field_name}"
      *   }
    

    Looks like we had a BC layer without explicit @trigger_error() considering that we have to fix this now? could we add that still to 8.x?

  3. +++ b/core/modules/node/tests/src/Functional/Rest/NodeTypeResourceTestBase.php
    @@ -31,7 +31,10 @@ abstract class NodeTypeResourceTestBase extends EntityResourceTestBase {
        */
       protected function setUpAuthorization($method) {
    -    $this->grantPermissionsToTestedRole(['administer content types', 'access content']);
    +    $this->grantPermissionsToTestedRole([
    +      'administer content types',
    +      'access content',
    +    ]);
       }
    

    unrelated reformatting?

  4. +++ b/core/modules/rest/config/schema/rest.schema.yml
    @@ -1,4 +1,5 @@
    -# Schema for the configuration files of the REST module.
    +# Make non-REST update path tests pass.
    +# @todo Remove this when those update path tests from 8.0.0 to the last 8.x minor before 9.0.0 have been removed.
     rest.settings:
       type: config_object
    

    mabe we can actually remove this now with the delete?

  5. +++ b/core/modules/rest/rest.api.php
    @@ -28,62 +28,6 @@ function hook_rest_resource_alter(&$definitions) {
    - *
    - * @deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use
    - *   hook_serialization_type_uri_alter() instead. This exists solely for BC.
    - *
    

    this was before we added support for hook deprecation, another thing that we might want to do still in 8.8 to make it explicit and easier to detect?

  6. +++ b/core/modules/rest/rest.install
    @@ -9,9 +9,9 @@
     /**
    - * Install the REST config entity type and fix old settings-based config.
    + * Make non-REST update path tests pass.
      *
    - * @see rest_post_update_create_rest_resource_config_entities()
    + * @todo Remove this when those update path tests from 8.0.0 to the last 8.x minor before 9.0.0 have been removed.
    

    I'd rather just not touch the updates here at all (except adding the new one) and rely on the existing issue to clean that up.. This will just conflict with that.

Status: Needs review » Needs work

The last submitted patch, 64: 2893804-64.patch, failed testing. View results

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new223.57 KB
new2.86 KB
  1. -1 to keeping the helper. That makes the test expectations much less explicit. Explicit, simple expectations are really important for tests IMHO. Sure, it's not always possible, but it is possible here.
  2. You're right, #2293697: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available happened in Q2 2017 and didn't explicitly add a @trigger_error() in this hunk of \Drupal\rest\Plugin\ResourceBase::routes():
        // BC: the REST module originally created the POST URL for a resource by
        // reading the 'https://www.drupal.org/link-relations/create' URI path from
        // the plugin annotation. For consistency with entity type definitions, that
        // then changed to reading the 'create' URI path. For any REST Resource
        // plugins that were using the old mechanism, we continue to support that.
        if (!isset($definition['uri_paths']['create']) && isset($definition['uri_paths']['https://www.drupal.org/link-relations/create'])) {
          $create_path = $definition['uri_paths']['https://www.drupal.org/link-relations/create'];
        }
    

    BUT note that this change is fixing a bug, see #2293697-124: EntityResource POST routes all use the confusing default: use entity types' https://www.drupal.org/link-relations/create link template if available. We chose to not fix the bug in the annotation back then to avoid breaking Drupal 8 modules that were hardcoded to overwrite this particular entity type annotation key. That's why we have to change it now.

    I think it makes sense to still add a @trigger_error() in 8.8.x and 8.9.x..

  3. ✅ — good catch!
  4. ✅ — another good catch :)
  5. +1, also needs follow-up. (Fun fact: the deprecation error exists, but the docs are wrong — it was first moved to serialization but before it shipped in a stable release, we moved it to hal. See #2758897: Move rest module's "link manager" services to serialization module + #2854830: Move rest/serialization module's "link manager" services to HAL module.)
  6. ✅— very good call! 🙏

For points 2 and 5: attaching a 8.8/8.9 patch here to add those explicit deprecations.

Note: test coverage requested in #64/#65 still needs to be written.

Status: Needs review » Needs work

The last submitted patch, 67: 2893804-67-8.8.x.patch, failed testing. View results

wim leers’s picture

Status: Needs work » Needs review
wim leers’s picture

StatusFileSize
new1.3 KB
new4.16 KB

The 9.0.x patch in #67 was green!

This fixes the 8.8.x deprecation patch.

berdir’s picture

1. It's not important enough to fight over it, if alexpott/catch are OK with it then fine. I do think we should at least make it a D10 deprecation instead of just removing it, as again, removing it means code that works on 8.9 without deprecations will break on 9.0 and we're trying to avoid that?

Did you forget the interdiff in #67? That's a tough one to review as a whole again ;)

wim leers’s picture

StatusFileSize
new5.54 KB

1. It was explicitly in a BcTimestampNormalizerUnixTestTrait trait that got added in #2768651: Let TimestampItem (de)normalize to/from RFC3339 timestamps, not UNIX timestamps, for better DX, so … 😢You're right that it wasn't triggering a deprecation error like it should've, but it predated that practice. I'm also not entirely sure if it should have triggered a deprecation error, because it was specifically added to allow for BC-compatible testing. Tricky. Happy to expand the 8.8 patch for this if you know of a similar example!

Did you forget the interdiff in #67? That's a tough one to review as a whole again ;)

YES, SORRY! 🙈 Attached :)

wim leers’s picture

StatusFileSize
new222.69 KB
new2.31 KB
new1.03 KB

Discussed #65.1 / #67.1 / #71.1 in Slack.

We settled on the compromise to indeed keep the trait to avoid any disruption for contrib/custom modules that are using this (because it wasn't properly deprecated, this predates the deprecation process), and instead deprecate this in D9, for removal in D10. Updated https://www.drupal.org/node/2859657 accordingly.

Important note: you're not required to use (new \DateTime())->setTimestamp(123456789)->setTimezone(new \DateTimeZone('UTC'))->format(\DateTime::RFC3339) — you can just write an RFC3339-formatted timestamp instead, i.e. just a string. You only need the complexity in case your timestamps are programmatic rather than hardcoded.
In core, I preferred to opt for the more complex programmatic approach because that is more copy-pasteable. I'm happy to change that if people disagree though.

wim leers’s picture

Issue summary: View changes

Fix mistake in IS.

wim leers’s picture

StatusFileSize
new2.71 KB
new223.95 KB

Added the requested test coverage (for rest_update_9001()).

berdir’s picture

+++ b/core/modules/rest/tests/src/Functional/Update/RestSettingsDeletionUpdateTest.php
@@ -0,0 +1,37 @@
+
+    $rest_settings = \Drupal::configFactory()->get('rest.settings');
+    $this->assertSame([], $rest_settings->getRawData());

I think you can just do assertTrue/False($rest_settings->isNew())?

wim leers’s picture

StatusFileSize
new30.1 KB
new192.22 KB

And to avoid conflict with #3087644: Remove Drupal 8 updates up to and including 88** like @jibran mentioned in #49 and @Berdir in #65.6, unremoving all the update path test removals.

This means we go from

 138 files changed, 222 insertions(+), 3417 deletions(-)

to

 124 files changed, 221 insertions(+), 2589 deletions(-)

The reduced reduction will be handled in #3087644: Remove Drupal 8 updates up to and including 88**. Rather unsatisfying, but logical :)

wim leers’s picture

#76: I followed a pre-existing pattern.

wim leers’s picture

StatusFileSize
new2.07 KB
new191.74 KB

Missed one spot. (Discovered by manually comparing to #3087644: Remove Drupal 8 updates up to and including 88**'s patch.)

Final diffstat:

 124 files changed, 258 insertions(+), 2561 deletions(-)
wim leers’s picture

(In #79 I also discovered two bugs in #3087644 — see #3087644-91: Remove Drupal 8 updates up to and including 88**.)

The last submitted patch, 77: 2893804-76-9.0.x.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 79: 2893804-79-9.0.x.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

berdir’s picture

> #76: I followed a pre-existing pattern.

But you're not actually asserting anything, the before/after assert is identical? And since you don't actually set up the config in the fixture, it doesn't exist at all during the test. So the fixture needs to create that config, then assert it does exist, run updates and then make sure it doesn't anymore?

You actually delete the config, so why not assert that?

berdir’s picture

Note: Once #3087644: Remove Drupal 8 updates up to and including 88** is in, there are a handful of checks and references to update functions (search for _update_8, e.g. \Drupal\rest\Plugin\views\display\RestExport::calculateDependencies() that we can clean up too.

gábor hojtsy’s picture

(@berdir I think you did not mean to suggest this should be postponed on that, just wanted to highlight that this is already almost 20% of the remaining deprecations, so would be nice to get in in its own if possible sooner :)

wim leers’s picture

Assigned: Unassigned » wim leers
Issue tags: +ContributionWeekend2020
wim leers’s picture

  1. Fixed the one coding standard violation.
  2. (The failing test was removed by #3087644: Remove Drupal 8 updates up to and including 88**, so nothing left to do about that.)
  3. Addressed @Berdir's remarks in #76/#83. Note that for now I went with installing the entity type definition using the API instead of updating the fixture. I still need to update the fixture. @Berdir pointed me to #3095333: Extend filled database dump with new stable modules and content for them — if that issue were done, we wouldn't have to deal with generating a complex fixture.
  4. Also addressed @Berdir's remark in #84.
  5. Removed core/modules/views/tests/modules/views_test_config/test_views/views.view.rest_export_with_authorization_correction.yml because #3087644 didn't do that after all.
 125 files changed, 273 insertions(+), 2792 deletions(-)
stefdewa’s picture

StatusFileSize
new3.62 KB
new202.09 KB

Still had a deprecation warning for Symfony\Component\HttpKernel\Event\FilterResponseEvent. Fixed and added this to the patch, also added interdiff.txt.

wim leers’s picture

Thanks for double-checking #87 with drupal-check, @Stefdewa! 🙏🙏🙏🥳

berdir’s picture

I'm not sure that belongs in here. drupal-check is about removing usages of deprecated API's (typically of something else), what you changed is about removing deprecated symfony event classes that are a Symfony 4 deprecation. AFAIK we already have an issue to fix that in all of core.

wim leers’s picture

Assigned: wim leers » Unassigned
StatusFileSize
new1.46 KB
new198.96 KB

#90 Woah, of course. Good catch. I'm glad you're looking at this :)

Also, regarding #87.3:

berdir 5 minutes ago
let me look at the patch, I can IMHO live with doing it through the API, maybe with a @todo on the other issue?

berdir 3 minutes ago
yeah, I'd definitely be OK with just adding a comment that says, this used to be done by an update function and can be removed once we have a database dump that officially installed the rest.module

Yay!

berdir’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/rest/tests/src/Functional/Update/RestSettingsDeletionUpdateTest.php
@@ -25,6 +25,7 @@ protected function setDatabaseDumpFiles() {
    * Ensures that update hook is run for "rest" module.
    */
   public function testUpdate() {
+    // @todo Remove this in https://www.drupal.org/project/drupal/issues/3095333.
     \Drupal::entityDefinitionUpdateManager()->installEntityType(\Drupal::entityTypeManager()->getDefinition('rest_resource_config'));
 

the comment is apparently now 81 characters according to dreditor. but we often leave out the . after links because that often ends up the URL otherwise. Either way, seems like something that could be fixed on commit.

I've looked through this several times and we discussed it a ton in slack as well. I'm still not 100% happy abut those convoluted date things, but Wim prefers it like this and I don't care that much.

IMHO this is ready, removes 20% or so of the remaining deprecations and unblocks the hal/serialization issues. The patch is huge but it's also very repetitive, most of it is either related to permissions and BC handling and test coverage of that or the changed date format/timezone.

catch’s picture

Status: Reviewed & tested by the community » Needs work

Is #2893804-70: Remove rest.module BC layers still the right patch for 8.8.x/8.9.x? If so that seems fine (although could also have been spun-out to a side issue and committed with no other dependencies).

  1. +++ b/core/modules/aggregator/tests/src/Functional/Rest/FeedResourceTestBase.php
    @@ -105,10 +102,16 @@ protected function getExpectedNormalizedEntity() {
           ],
           'checked' => [
    -        $this->formatExpectedTimestampItemValues(123456789),
    +        [
    +          'value' => (new \DateTime())->setTimestamp(123456789)->setTimezone(new \DateTimeZone('UTC'))->format(\DateTime::RFC3339),
    +          'format' => \DateTime::RFC3339,
    +        ],
           ],
    

    Reading the discussion about this and looking at the patch, I think I would have preferred keeping the helper method in this issue then refactoring the test coverage in a follow-up issue not specifically tied to removing the deprecations. Would mean a considerably smaller patch. However now that it's done and RTBC I don't have a strong opinion enough to push back either.

  2. +++ b/core/modules/rest/rest.install
    @@ -11,3 +11,10 @@
    +
    +/**
    + * Remove obsolete rest.settings configuration.
    + */
    +function rest_update_9001() {
    +  \Drupal::configFactory()->getEditable('rest.settings')->delete();
    +}
    

    This should be fine as a post update instead of a hook_update_N() I think? Also making it a post update increases the headroom before we run into #3108658: Handling update path divergence between 11.x and 10.x in REST module.

wim leers’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new1.1 KB
new199.07 KB

Is #2893804-70: Remove rest.module BC layers still the right patch for 8.8.x/8.9.x? If so that seems fine

Yes.

(although could also have been spun-out to a side issue and committed with no other dependencies).

I had forgotten that even existed until your reminder just now. You're right.

  1. BC removal is the entire reason for the layer of indirection in the current test coverage; removing the layer of indirection is simplification directly enabled by the BC removal. That's why I felt strongly about this. I'm glad you are okay with it :)
  2. I 🤔… think you're right. 🙂 Done. ✅
catch’s picture

removing the layer of indirection is simplification directly enabled by the BC removal.

Right, it is, but it would also have been possible to remove the bc layer only in the method and do the rest in a follow-up. Either way fine committing as is.

Waiting for tests to run, but otherwise ready to commit this assuming they pass. Although i'm not sure the upgrade path test is going to work now - we might not need to reset the schema version, but we might need to manipulate the post updates entry.

wim leers’s picture

Although i'm not sure the upgrade path test is going to work now - we might not need to reset the schema version, but we might need to manipulate the post updates entry.

I did run \Drupal\Tests\rest\Functional\Update\RestSettingsDeletionUpdateTest locally and it still passes :)

catch’s picture

Hmm OK I think that works because of this:

+// Update core.extension.
+$extensions = $connection->select('config')
+  ->fields('config', ['data'])
+  ->condition('collection', '')
+  ->condition('name', 'core.extension')
+  ->execute()
+  ->fetchField();
+$extensions = unserialize($extensions);
+$extensions['module']['rest'] = 0;
+$extensions['module']['serialization'] = 0;
+$extensions['module']['basic_auth'] = 0;
+$connection->update('config')
+  ->fields([
+    'data' => serialize($extensions),
+  ])
+  ->condition('collection', '')
+  ->condition('name', 'core.extension')
+  ->execute();

i.e. we're brute-installing the module, bypassing the logic that populates already-existing post-updates (meaning they'll all run).

However that is likely to break once #3097661: No hook_update_last_removed() equivalent for post updates is committed, because we'll be on an older schema version without having run the post updates that will be removed in that patch. But since we don't 100% know what change will be required we can probably defer to that issue or a follow-up of this one.

wim leers’s picture

#97: Fascinating. I didn't do anything special here. I just copy/pasted the pattern of how all of the REST module fixtures used to work until #3087644: Remove Drupal 8 updates up to and including 88** removed them. And AFAICT just about every fixture follows this pattern?

I'm not sure I understand what's "brute force" about this; AFAICT that's how it was intended to work — at least back when we started doing these update path tests. Perhaps there's a better pattern by now? If so, we should look into applying that to all core update path tests.
EDIT: Ah now I see, it's this: (meaning they'll all run). — this is true, that is what happens. That has always puzzled me about our update path tests. I haven't yet seen any update path test fixture that defines which post updates have already run.

  • catch committed 720924f on 9.0.x
    Issue #2893804 by Wim Leers, Stefdewa, Berdir, catch: Remove rest.module...

  • catch committed 9664d37 on 8.9.x
    Issue #2893804 by Wim Leers, Stefdewa, Berdir, catch: fix deprecation...

  • catch committed fe62186 on 8.8.x
    Issue #2893804 by Wim Leers, Stefdewa, Berdir, catch: fix deprecation...
catch’s picture

Status: Reviewed & tested by the community » Fixed

@Wim Leers yes this is all because we've never, ever removed a post update before but as soon as we have a mechanism for doing so, it'll have to happen a bit differently.

Committed 720924f and pushed to 9.0.x. Thanks!

Also committed the 8.9.x/8.8.x documentation updates with 9664d37.

Leaving the issue at 9.0.x so it doesn't induce too much panic.

wim leers’s picture

Yay!

Unpostponed #2893795: Remove serialization.module BC layers and #3034062: Remove hal.module BC layers — their patches are currently being tested by DrupalCI. If they need rerolls, they should be easy.

#102: Yep, makes perfect sense :)

Status: Fixed » Closed (fixed)

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