Postponed on #3039240: Create a way to declare a plugin as deprecated.

Problem/Motivation

#2500535: Upgrade path for Tracker 7.x introduced a migration for the tracker module. It should be a very simple migration since it's one of the very few that's pretty much just copying a DB table.

  1. The first problem: dependencies. Even though #2500535-5: Upgrade path for Tracker 7.x.10 asked for migration dependencies to be added and #2500535-11: Upgrade path for Tracker 7.x added those, they're wrong.
  2. The second problem is far worse: nothing about the migration is correct 😨. The tests don't test the migration, but the source DB. The migrations themselves try to migrate into user and node entities, which makes no sense.

Steps to reproduce

Proposed resolution

While this migration is not needed running it does not cause problems on the destination. See #5 and #10.
Leaving as postponed because it can be done when this is moved to the contrib project.

Original proposed resolution

Fix all this:

  1. +++ b/core/modules/tracker/migration_templates/d7_tracker_node.yml
    @@ -0,0 +1,15 @@
    +  nid: nid
    

    No migration lookup, which means that changed node IDs will fail to have their tracker data correctly migrated.

  2. +++ b/core/modules/tracker/migration_templates/d7_tracker_node.yml
    @@ -0,0 +1,15 @@
    +migration_dependencies:
    +  required:
    +    - d7_user
    

    This is only depending on d7_user but it also needs d7_node.

  3. +++ b/core/modules/tracker/migration_templates/d7_tracker_user.yml
    @@ -0,0 +1,16 @@
    +process:
    +  nid: nid
    +  uid: uid
    +  published: published
    +  changed: changed
    +destination:
    +  plugin: entity:user
    +migration_dependencies:
    +  required:
    +    - d7_user
    

    … same here.

  4. +++ b/core/modules/tracker/migration_templates/d7_tracker_node.yml
    @@ -0,0 +1,15 @@
    +destination:
    +  plugin: entity:node
    

    This sends the tracker source data to … not the tracker_node table in D8|9 … but to the node entity.

  5. +++ b/core/modules/tracker/migration_templates/d7_tracker_user.yml
    @@ -0,0 +1,16 @@
    +destination:
    +  plugin: entity:user
    

    This sends the tracker source data to … not the tracker_user table in D8|9 … but to the user entity.

  6. +++ b/core/modules/tracker/src/Tests/Migrate/d7/MigrateTrackerNodeTest.php
    @@ -0,0 +1,74 @@
    +  public function testMigrateTrackerNode() {
    +    $connection = Database::getConnection('default', 'migrate');
    

    This is a test.

    But it tests not the migration.

    It tests the _source DB_ 😳

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#3 3204511-2.patch786 byteswim leers

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Title: Tracker migration is 100% broken » Tracker migration is broken for every site trying to use it

Less offensive sounding title, this is what I actually meant — sorry! 😞

wim leers’s picture

Issue tags: +Needs tests
StatusFileSize
new786 bytes

This fixes the first problem: now these migration plugins can only run when it actually makes sense to run them.

But much more importantly, we need to fix the tests and fix the migration definitions.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Title: Tracker migration is broken for every site trying to use it » Fix Tracker migration and tests
Issue tags: -Needs tests +Bug Smash Initiative

The title makes me laugh, is the tracker migration correct for every site not trying to use it? Still, as we know, someone worked really hard on that migration. Changing title to focus on fixing.

From the IS.
1. This is not wrong. It is an established practice for core migrations to use nid: nid because core preserves IDs. See #2748609: [meta] Preserving auto-increment IDs on migration is fragile for some background.
2, 3. Agree
4, 5. Hmm.
6. Yes, the test is wrong. Removing the tag because there are tests, they just need to be fixed.

As far as I can tell, when tracker is enable and the node migration is run the tracker tables are populated. There doesn't seem to be a need to run these migrations at all. Are d7_tracker_node.yml and d7_tracker_user.yml needed at all?

For me, this does not fit the criteria for Major.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

catch’s picture

tracker_cron() can rebuild this table from scratch, and entries are also added when nodes are inserted or updated, so this migration just isn't needed at all.

quietone’s picture

Category: Bug report » Task
Issue summary: View changes
Status: Active » Postponed
Related issues: +#1261120: Deprecate Tracker module in D10 and move to contrib in D11, +#3261679: Deprecate tracker module in Drupal 10.1.x

@catch, thank you for the confirmation.

That means that the tracker migration and associated tests can be removed. Except that there isn't a way to deprecate a migration yet, #3039240: Create a way to declare a plugin as deprecated.

Also changing to a task.

quietone’s picture

Title: Fix Tracker migration and tests » Deprecate tracker migration
catch’s picture

Status: Postponed » Active

I don't think we need to wait for #3039240: Create a way to declare a plugin as deprecated - that's more for plugins that are exposed in UIs (fields, formatters, widgets etc.)

Can we just deprecate the classes and delete the migration template?

As it stands, it's impossible for anyone to actually use this, so we could probably just delete it too?

Just realised this can be handled in the contrib module, as long as we leave core migration fixtures as-is.

quietone’s picture

quietone’s picture

Component: migration system » tracker.module
Status: Active » Postponed

that's more for plugins that are exposed in UIs (fields, formatters, widgets etc.)

Not sure about that. The IS for #3039240: Create a way to declare a plugin as deprecated specifically addressed migration plugins and the reasoning for why they need deprecation.

A reason to not delete it is if someone is modifying them in hook_migration_plugins_alter. They would expect the key to exist in the array of plugins IDs.

I agree this can be dealt with later either in core or in the contrib version of tracker. Changing the component to tracker so this will get moved and changing back to postponed. It is listed in the Meta for tracking the removal process as well. What does need to happen is an issue to deal with the functional tests.

catch’s picture

Even if they're deprecated, we won't have a way to indicate to an alter hook that they're about to be removed. This is mostly covered under https://www.drupal.org/about/core/policies/core-change-policies/drupal-d...

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Priority: Major » Normal
Issue summary: View changes
quietone’s picture

This extension is deprecated and scheduled for removal in Drupal 11.

This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

It will be moved to the contributed extension once the Drupal 11 branch is open.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

Status: Postponed » Closed (outdated)

The module already deprecated, contrib will polish it on adoption