Menu migration should happen before block migration

Created on 19 September 2020, almost 5 years ago
Updated 8 March 2024, over 1 year ago

Problem/Motivation

When you run a migration using Migrate Upgrade, which leverages core's Migrate Drupal system, it runs the block migration before the menu migration, resulting in warnings that blocks from the menu system cannot be found, e.g.:

[warning] The "system_menu_block:secondary-menu" was not found

Steps to reproduce

  • Use Migrate Upgrade to prepare a D7 migration to D8 or D9 where menu blocks were displayed in a region.
  • Run the migration.

Proposed resolution

List the d7_menu migration as an optional dependency on d7_block.

Remaining tasks

  • Confirm the problem.
  • Provide a patch with the fix.
  • Test coverage.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Release notes snippet

TBD

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
MigrationΒ  β†’

Last updated about 4 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States damienmckenna NH, USA

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    This was a bug smash triage issue today.

    We still need some tests here.

  • πŸ‡³πŸ‡ΏNew Zealand quietone
  • First commit to issue fork.
  • Pipeline finished with Failed
    4 months ago
    Total: 594s
    #444173
  • Pipeline finished with Success
    4 months ago
    Total: 594s
    #444178
  • πŸ‡ΊπŸ‡ΈUnited States dcam

    I don't think the test changes are any good. Neither undoing the fix nor removing d7_menu from the test's list of migrations will make the test fail. So I'm leaving the Needs Tests tag in place. But I'm marking this as Needs Review in hope that a subsystem maintainer will advise on what might be wrong or an alternate test strategy.

  • πŸ‡«πŸ‡·France andypost

    btw menus probably should be required migration as core has fixed default list independently from menu module since 8.x #2085243: Rename Menu module into Menu UI module β†’

  • πŸ‡ΊπŸ‡ΈUnited States mikelutz Michigan, USA

    I don't think the test changes are any good. Neither undoing the fix nor removing d7_menu from the test's list of migrations will make the test fail. So I'm leaving the Needs Tests tag in place. But I'm marking this as Needs Review in hope that a subsystem maintainer will advise on what might be wrong or an alternate test strategy.

    You can't make a test for this based on looking at the system after the migrations have run, because the migration and the system do not care what order they are run. If the block runs first, it's saved with an invalid plugin for a hot minute, and then when the menu migration runs, the plugin is valid and everything is fine. So you can't do a test based on the final system state; the only way to test is to inject a mock logger or check the logs to make sure the warning is never logged.

  • Pipeline finished with Success
    about 2 months ago
    Total: 516s
    #499413
  • Status changed to Postponed: needs info about 2 months ago
  • πŸ‡ΊπŸ‡ΈUnited States dcam

    I've continued to work on this. I can't reproduce the problem with the migrate_upgrade module or write a failing test that checks for a logged warning. I'll post the output of the migrate_upgrade command. You can see that d7_block runs before d7_menu, but it does so without a warning. I wonder if this problem was fixed at some point in the last 5 years. If someone is still experiencing this issue, then please post more thorough steps to reproduce it.

    dcam@davidslaptop:~/drupal_core$ drush migrate:upgrade --legacy-db-key=migrate
     [notice] Upgrading action_settings
     [notice] Upgrading d7_action
     [notice] Upgrading d7_dblog_settings
     [notice] Upgrading d7_file_private
     [notice] Upgrading d7_filter_format
     [notice] Upgrading d7_filter_settings
     [notice] Upgrading d7_global_theme_settings
     [notice] Upgrading d7_image_settings
     [notice] Upgrading d7_image_styles
     [notice] Upgrading d7_node_settings
     [notice] Upgrading d7_search_page
     [notice] Upgrading d7_search_settings
     [notice] Upgrading d7_system_authorize
     [notice] Upgrading d7_system_cron
     [notice] Upgrading d7_system_date
     [notice] Upgrading d7_system_file
     [notice] Upgrading d7_system_mail
     [notice] Upgrading d7_system_performance
     [notice] Upgrading d7_theme_settings
     [notice] Upgrading d7_user_flood
     [notice] Upgrading d7_user_mail
     [notice] Upgrading d7_user_settings
     [notice] Upgrading file_settings
     [notice] Upgrading menu_settings
     [notice] Upgrading system_image
     [notice] Upgrading system_image_gd
     [notice] Upgrading system_logging
     [notice] Upgrading system_maintenance
     [notice] Upgrading system_rss
     [notice] Upgrading system_site
     [notice] Upgrading taxonomy_settings
     [notice] Upgrading text_settings
     [notice] Upgrading update_settings
     [notice] Upgrading block_content_type
     [notice] Upgrading block_content_body_field
     [notice] Upgrading d7_custom_block
     [notice] Upgrading d7_comment_type
     [notice] Upgrading d7_node_type
     [notice] Upgrading d7_shortcut_set
     [notice] Upgrading d7_taxonomy_vocabulary
     [notice] Upgrading d7_user_role
     [notice] Upgrading d7_block
     [warning] The "aggregator_feed_block" block plugin was not found
     [warning] The "aggregator_feed_block" block plugin was not found
     [notice] Upgrading block_content_entity_form_display
     [notice] Upgrading block_content_entity_display
     [notice] Upgrading d7_comment_field
     [notice] Upgrading d7_comment_entity_form_display_subject
     [notice] Upgrading d7_comment_field_instance
     [notice] Upgrading d7_comment_entity_display
     [notice] Upgrading d7_comment_entity_form_display
     [notice] Upgrading d7_field
     [notice] Upgrading d7_field_instance
     [notice] Upgrading d7_file
     [notice] Upgrading user_picture_field
     [notice] Upgrading user_picture_field_instance
     [notice] Upgrading user_picture_entity_display
     [notice] Upgrading user_picture_entity_form_display
     [notice] Upgrading d7_user
     [notice] Upgrading d7_node_complete:article
     [notice] Upgrading d7_node_complete:page
     [notice] Upgrading d7_comment
     [notice] Upgrading d7_view_modes
     [notice] Upgrading d7_field_formatter_settings
     [notice] Upgrading d7_field_instance_widget_settings
     [notice] Upgrading d7_menu
     [notice] Upgrading d7_menu_links
     [notice] Upgrading d7_node_title_label
     [notice] Upgrading d7_url_alias
     [notice] Upgrading d7_shortcut_set_users
     [notice] Upgrading d7_shortcut
     [notice] Upgrading d7_taxonomy_term:tags
     ----------------------------------------
      Executed migrations
     ----------------------------------------
      action_settings
      d7_action
      d7_dblog_settings
      d7_file_private
      d7_filter_format
      d7_filter_settings
      d7_global_theme_settings
      d7_image_settings
      d7_image_styles
      d7_node_settings
      d7_search_page
      d7_search_settings
      d7_system_authorize
      d7_system_cron
      d7_system_date
      d7_system_file
      d7_system_mail
      d7_system_performance
      d7_theme_settings
      d7_user_flood
      d7_user_mail
      d7_user_settings
      file_settings
      menu_settings
      system_image
      system_image_gd
      system_logging
      system_maintenance
      system_rss
      system_site
      taxonomy_settings
      text_settings
      update_settings
      block_content_type
      block_content_body_field
      d7_custom_block
      d7_comment_type
      d7_node_type
      d7_shortcut_set
      d7_taxonomy_vocabulary
      d7_user_role
      d7_block
      block_content_entity_form_display
      block_content_entity_display
      d7_comment_field
      d7_comment_entity_form_display_subject
      d7_comment_field_instance
      d7_comment_entity_display
      d7_comment_entity_form_display
      d7_field
      d7_field_instance
      d7_file
      user_picture_field
      user_picture_field_instance
      user_picture_entity_display
      user_picture_entity_form_display
      d7_user
      d7_node_complete:article
      d7_node_complete:page
      d7_comment
      d7_view_modes
      d7_field_formatter_settings
      d7_field_instance_widget_settings
      d7_menu
      d7_menu_links
      d7_node_title_label
      d7_url_alias
      d7_shortcut_set_users
      d7_shortcut
      d7_taxonomy_term:tags
     ----------------------------------------
    
Production build 0.71.5 2024