Menu migration should happen before block migration

Created on 19 September 2020, over 4 years ago
Updated 8 March 2024, about 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 6 days 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
    2 months ago
    Total: 594s
    #444173
  • Pipeline finished with Success
    2 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.

Production build 0.71.5 2024