We've accumulated a fair number of BC layers in the hal.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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers created an issue. See original summary.

Wim Leers’s picture

FileSize
18.08 KB

Commit c8dc57eedea3fd34de067098ca2ee36e6c459245.

 core/modules/hal/hal.install                                                                     |  45 ---------------------------------------------
 core/modules/hal/hal.services.yml                                                                |   8 +-------
 core/modules/hal/src/LinkManager/RelationLinkManager.php                                         |   8 --------
 core/modules/hal/src/LinkManager/RelationLinkManagerInterface.php                                |   4 +---
 core/modules/hal/src/Normalizer/FileEntityNormalizer.php                                         |  93 ---------------------------------------------------------------------------------------------
 core/modules/hal/tests/fixtures/update/drupal-8.hal-hal_update_8301.php                          |  43 -------------------------------------------
 core/modules/hal/tests/fixtures/update/drupal-8.rest-hal_update_8301.php                         | Bin 4892 -> 0 bytes
 core/modules/hal/tests/modules/hal_test/hal_test.module                                          |  25 -------------------------
 core/modules/hal/tests/src/Functional/Update/CreateHalSettingsForLinkDomainUpdateTest.php        |  43 -------------------------------------------
 core/modules/hal/tests/src/Functional/Update/MigrateLinkDomainSettingFromRestToHalUpdateTest.php |  49 -------------------------------------------------
 core/modules/hal/tests/src/Kernel/HalLinkManagerTest.php                                         |  12 ------------
 11 files changed, 2 insertions(+), 328 deletions(-)
Wim Leers’s picture

Title: Remove serialization.module BC layers » Remove hal.module BC layers
FileSize
20.46 KB

Title was wrong. And patch was rolled without --binary.

jibran’s picture

Do we still want to keep HAL around after JSON:API is included in core? I vote for removal from D9.

Wim Leers’s picture

e0ipso’s picture

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

Issue tags: +Deprecation Removal
Wim Leers’s picture

Title: Remove hal.module BC layers » [PP-1] Remove hal.module BC layers
Berdir’s picture

Note: Should also remove all left-over references to hal_update_8501() and possibly others.

Wim Leers’s picture

#10: 👍, thanks! :)

Stefdewa’s picture

Status: Postponed » Needs review
FileSize
20.02 KB

Patch from #3 didn't apply anymore, created a new one from scratch after applying patch from #2893804-91: Remove rest.module BC layers .

Wim Leers’s picture

Status: Needs review » Postponed

I compared #3 with #12. Differences:

  1. hal.install is not being modified anymore. #3087644: Remove Drupal 8 updates up to and including 88** already did all of that for us!
  2. drupal-8.hal-hal_update_8301.php is not being removed anymore. #3087644: Remove Drupal 8 updates up to and including 88** already did all of that for us!
  3. Removed the deprecated code in NormalizerBase that I missed 👍
  4. Removed 4 deprecated test base classes in core/modules/hal/tests/src/Functional/EntityResource that I missed 👍
  5. Removed the alterDeprecated() calls in RelationLinkManager and TypeLinkManager that I missed that were added since #3 was created 👍

This is completely ready if it passes tests, but we'll need to wait for #2893804: Remove rest.module BC layers to land to know that for sure!

Thanks for getting this patch into shape and highly likely insta-RTBC, @Stefdewa! Marking postponed for now, but as soon as #2893804 lands, this should be re-tested and marked RTBC :) 🚢🚢

Berdir’s picture

+++ /dev/null
@@ -1,96 +0,0 @@
-   *
-   * @deprecated in drupal:8.5.0 and is removed from drupal:9.0.0.
-   */
-  public function normalize($entity, $format = NULL, array $context = []) {
-    $data = parent::normalize($entity, $format, $context);
-
-    $this->addCacheableDependency($context, $this->halSettings);
-
-    if ($this->halSettings->get('bc_file_uri_as_url_normalizer')) {
-      // Replace the file url with a full url for the file.
-      $data['uri'][0]['value'] = $this->getEntityUri($entity);
-      @trigger_error("Replacing the file uri with the URL is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use the provided url property instead and disable hal.settings:bc_file_uri_as_url_normalizer. See https://www.drupal.org/node/2925783", E_USER_DEPRECATED);
-    }
-
-    return $data;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function getEntityUri(EntityInterface $entity, array $context = []) {
-    assert($entity instanceof FileInterface);

this class is not deprecated anymore, we can't remove it, only the first method that is marked as deprecated.

What we do need is remove this configuration, the schema for it and add an update function that removes it on existing sites. Basically the same dance as in the rest issue.

Leaving at postponed as we'll likely need to reuse the fixture we have in the rest issue and it will be easier to do that once that is committed.

Wim Leers’s picture

You're right, good catch! Our tests would (presumably) have caught this prior to commit fortunately. 🤞

Wim Leers’s picture

Title: [PP-1] Remove hal.module BC layers » Remove hal.module BC layers
Status: Postponed » Needs review

#2893804: Remove rest.module BC layers landed 5 mins ago! Testing #14

Status: Needs review » Needs work

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

Berdir’s picture

Yes, failing as expected :)

Wim Leers’s picture

Issue tags: +Needs reroll, +Novice

Most of the failures are due to the remark that @Berdir posted in #14, so yay, that confirms my statement that tests should catch that bug! 🥳

Also, FileHalJsonAnonTest::testGetBcUriField() should be removed.

Those things seem simple enough for a novice to do :)

DamienMcKenna’s picture

Tagging as a requirement for Drupal 9.0-beta1.

sokru’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll, -Novice
FileSize
21.67 KB
9.68 KB

Reroll solving #14 and #19. However not sure should we extend rest-module-installed.php fixture or not. Created a separate hal-module-installed.php fixture.

Status: Needs review » Needs work

The last submitted patch, 21: 3034062-21.patch, failed testing. View results

Wim Leers’s picture

Looks like most if not all of the remaining failures are about the test coverage asserting that the config:hal.settings cache tag is present, but this patch is removing the hal.settings configuration, so that cache tag should no longer appear. In other words, the tests' expectations need to be updated :)

Berdir’s picture

Assigned: Unassigned » Berdir

Working on this.

Berdir’s picture

Status: Needs work » Needs review
FileSize
23.64 KB
9.81 KB

So I learned something interesting while working on #3095333: Extend filled database dump with new stable modules and content for them, and that is that the filled dump already has hal+serialization+rest enabled, so we don't actually need to fake anything here, we just need to use the filled dumps. That does make the test quite a bit slower, but it also means fewer fixtures and workarounds to maintain.

I updated HalSettingsDeletionUpdateTest to use that, and it passes now. Maybe better to do the same with the rest test in a separate issue? That said, the test actually still tested the rest config *and* we removed too much here, we still need the link domain setting, so this update must only remove the specific key. Cleaned that up.

Other fixes include removing the cache tag where it is no longer needed and re-adding the file entity normalizer service. Also still quite a few tests covering removed functionality, that was deprecated a long time ago, so some of these are a bit tricky, like removing array keys in return values. But, this has also been done very long ago and is unlikely to be used.

interdiff is weird in a few places due to re-adding removed files and then removing parts.

Berdir’s picture

One thing: the update test passes now without @group legacy as well, I'm not sure if we should keep that or not, as right now it makes sense to not have it to make sure we have no deprecations left, but sooner or later, we'll add a system.module update or so that will trigger one and then all tests would need to be updated.

I kept it here but removed in the hal issue IIRC, sorry about the inconsistency :p

Berdir’s picture

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

Note: The tests failed because I removed the @group legacy from that test and now it has none left.

So, per https://drupal.slack.com/archives/C1BMUQ9U6/p1580561124478000, we should add that back *and* also make sure we have a @group hal there and then it should run the tests.

Won't have time for that during the day.

Berdir’s picture

Status: Needs work » Needs review
FileSize
23.67 KB
593 bytes

No volunteers it seems :)

Status: Needs review » Needs work

The last submitted patch, 28: 3034062-27.patch, failed testing. View results

Berdir’s picture

Status: Needs work » Needs review
FileSize
24.26 KB
600 bytes

This should fix the remaining media tests.

Although, I do wonder whether not all hal+json resources should always still include config:hal.settings cache taq anyway because the logic in \Drupal\hal\LinkManager\LinkManagerBase::getLinkDomain() depends on it, seems like a classic cacheability-only-added-in-positive-case bug. But that's not really related and should be fixed in a separate issue.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#2928882: HAL links are broken if diffferent domains, protocols or ports are used in multisite or multi-domain setup

But that's not really related and should be fixed in a separate issue.

+1 — and this already has an issue: #2928882: HAL links are broken if diffferent domains, protocols or ports are used in multisite or multi-domain setup 🙂

  • catch committed 8c2f0de on 9.0.x
    Issue #3034062 by Berdir, Wim Leers, sokru, Stefdewa, jibran: Remove hal...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 8c2f0de and pushed to 9.0.x. Thanks!

Status: Fixed » Closed (fixed)

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