Problem/Motivation

The upgrade to htmx v.4 removes methods from our integration to stay in sync with the htmx API changes.

Proposed resolution

Add a deprecation notice to each removed method.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3607711

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

fathershawn created an issue. See original summary.

sourav_paul’s picture

Working on this...

sourav_paul’s picture

I've attached the deprecation warning messages, got php-stan errors, already resolved that but still got unit test core falures,
It would be great if anyone could lookinto it as I'm busy on projet tasks.

[Used AI]

fathershawn’s picture

Thanks. Your AI missed some deprecations. The notices should link to the CR, not the issue. Updated the branch.

sourav_paul’s picture

Thanks @shawn for rectifing it. still I see some pipeline error, can you please look into it? else I'll look into it later.

fathershawn’s picture

Thanks @sourav_paul! I ran out of time but wanted to push up my progress :)

fathershawn’s picture

Status: Active » Needs review
quietone’s picture

Issue summary: View changes
Status: Needs review » Needs work

So, we are deprecating some functions in preparation for HTMX 4. The change record title is 'HTMX now used htmx 4, which will not be correct. And I don't see a review of the change record here, so adding that to the remaining tasks.

The deprecation messages have information that should be in the change record. I suggest removing the sentence about the item being removed from htmx 4. That can be in the change record. I made two suggestions in the MR but the idea applies to all the messages.

There are failing tests as well.

fathershawn’s picture

I am new to the deprecation process, but I made this issue a child of #3555916: Update to htmx 4 and my expectation was that these two issues would be committed together. The CR referenced in the notices is the CR for #3555916: Update to htmx 4 and this issue was intended to track the work to get the notices into 11.x.

It sounds like these notices are too verbose. All the info in the notices is in the referenced CR, so we should simplify them as suggested.

fathershawn’s picture

Issue summary: View changes
fathershawn’s picture

Updated the messages. Tests still need to be reviewed and adjusted..

macsim’s picture

Version: 11.4.x-dev » main

A few things :

  • issue and MR must target main branch - I changed the target in the issue but I can't do it in the MR
  • Drupal 11.4.0 has already been released so we need to bump the deprecation messages in code and CR by replacing 11.4.0 with 11.5.0
godotislate’s picture

Version: main » 11.x-dev

This won't go to main, because the methods are being removed there in #3555916: Update to htmx 4.

In Slack discussion with RMs @catch, @longwave, and @quietone:

  • For now, target the deprecation for 11.5
  • We could think about backporting to a 11.4.x patch release later, but that is pretty unlikely because it's disruptive
  • There are also likely very few contrib modules leveraging the HTMX methods in question, so we could do a search and file issues

fathershawn’s picture

  1. Moved the changes onto branch 11.x
  2. Updated all messages to reference 11.5
  3. Unit test show failure although the report shows all methods passed??
  4. Changed tests pass locally
macsim’s picture

Example of test failures:

    Htmx Request Info (Drupal\Tests\Core\Htmx\HtmxRequestInfo)
     ✔ Is htmx request
     ✔ Is htmx boosted
     ✔ Get htmx current url
     ✔ Is htmx history restoration
     ⚠ Get htmx prompt
     ✔ Get htmx target
     ⚠ Get htmx trigger
     ✔ Get htmx trigger name
    
    2 tests triggered 2 deprecations:
    
    1) /builds/core/lib/Drupal/Core/Htmx/HtmxRequestInfoTrait.php:73
    Drupal\Core\Htmx\HtmxRequestInfoTrait::getHtmxPrompt() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3583674
    
    Triggered by:
    
    * Drupal\Tests\Core\Htmx\HtmxRequestInfoTest::testGetHtmxPrompt
      /builds/core/tests/Drupal/Tests/Core/Htmx/HtmxRequestInfoTest.php:86
    
    2) /builds/core/lib/Drupal/Core/Htmx/HtmxRequestInfoTrait.php:98
    Drupal\Core\Htmx\HtmxRequestInfoTrait::getHtmxTrigger() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3583674
    
    Triggered by:
    
    * Drupal\Tests\Core\Htmx\HtmxRequestInfoTest::testGetHtmxTrigger
      /builds/core/tests/Drupal/Tests/Core/Htmx/HtmxRequestInfoTest.php:108
    
    OK, but there were issues!
    Tests: 8, Assertions: 16, Deprecations: 2.
quietone’s picture

Title: Add deprecation notices to methods removed in htmx v.4 upgrade » Deprecate \Drupal\Core\Htmx\Htmx methods

@fathershawn, thanks for saying that you are new to the deprecation process. I wanted to follow up here sooner, but life got busy again. Briefly, we deprecate things in a minor release and add a change record for the deprecation. Then, in the next major release the update of a dependency is announced in the release notes and not a change record. So, in the case the deprecation is added to 11.5 and then in on the main branch the updated happens as well as the removal of the deprecated code.

The commit of the deprecations is separate from the commit of the update and removal of deprecated code issues. They do not have to happen at the same time. The first will go on the main branch and 11.x. The latter is only for the main branch.

Changing title because this is a deprecation, not just adding notices, and using the more standard form of 'Deprecate ...'

One question. If someone makes the recommended changes that are given in the change record or the migration guide, will it work on the 11.x branch.

edit: correct branches for the commits.

fathershawn’s picture

Thanks @quietone for the guidance! These are breaking changes. HTMX v.4 removes functions, changes names, and so on. Because we are using a factory pattern to generate the necessary attributes and headers, one could use the DeprecationHelper to write D11 and D12 code.

I'll add a note about use of the helper to the CR and link the CR to this issue.

fathershawn’s picture

Thanks @macsim for the note that the failures are uncaught deprecations. That was not easy for me to filter out of the results.

fathershawn’s picture

Added #[IgnoreDeprecations] to the test methods expecting deprecations, following the pattern of other core tests.

fathershawn’s picture

Status: Needs work » Needs review

All tests green

fathershawn’s picture

Issue summary: View changes
nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

I think this is ready, I read through https://four.htmx.org/docs briefly and I don't see anything that's not addressed in the CR or deprecated here.

Versions look right and the link to the CR is correct.

I did have a question if the https://four.htmx.org/docs#upgrade-checker would work, but I think it only partially works.

It might be worth mentioning the limited application in the CR.

I tweaked some minor formatting on the CR.

  • longwave committed 33be9650 on 11.x
    task: #3607711 Deprecate \Drupal\Core\Htmx\Htmx methods
    
    By: fathershawn...
longwave’s picture

Status: Reviewed & tested by the community » Fixed

Given that HTMX 4 has some changes that we can't add forward or backward compatibility for, I think this is the best we can do.

Committed and pushed 33be9650049 to 11.x. main will upgrade directly to HTMX 4 so no point adding the deprecations only to remove them again, and we are too late for 11.4.x.

The change record should be published once we've actually added HTMX 4 to Drupal 12.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.