WSE Config fails to install properly on 11.x

Created on 16 December 2024, 6 days ago

Problem/Motivation

Due to the module installer changes on 11.x the wse_config module fails to install with the following error:

An error occurred while notifying the creation of the workspace field storage definition: "Exception thrown while performing a schema update. Cannot add field 'wse_config_revision.workspace': table doesn't exist." in Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line 1596 of /Volumes/dev/sites/drupal8alt.dev/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Steps to reproduce

vendor/bin/drush en workspaces wse wse_config workspaces_ui  -y

After installing the standard profile.

Adding container_rebuild_required: true to wse_config.info.yml fixes the error but it would be great to understand why this is happening.

Proposed resolution

TBD

Remaining tasks

User interface changes

None

API changes

TBD

Data model changes

TBD

πŸ› Bug report
Status

Active

Version

2.0

Component

Workspace Config

Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @alexpott
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    This is happening because wse_config and workspaces are being installed at the same time. The wse_config module depends on workspaces (via the wse module), so workspaces is installed first. This means that when we loop round do entity updates we try and create a reference field on the wse_config entity type before the entity type actually exists. Because we process the workspaces in this loop before wse_config.

    I think this is a core bug. I think we should process entity type creations before we do any field adding.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Yeah this is a core bug. We should only be processing field storage updates if the provider of the entity type is not in the module list.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    This is a critical bug because it prevent correct installation of modules that provide fields for entity types they do not provide themselves.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Another way to recreate this problem with only core modules is to make taxonomy dependent on workspaces... and then install minimal and then taxonomy... kaboom! Works fine on 11.1.x.

  • πŸ‡¬πŸ‡§United Kingdom catch

    #6 seems like a possible test coverage shortcut - could be done with hook_system_info_alter() in a test module.

  • First commit to issue fork.
  • Pipeline finished with Success
    4 days ago
    Total: 728s
    #371768
  • Added a test to the MR per #6/#7. The tricky part was that the entity storage exception actually is caught by the module installer and logged. Then the workspace field ends up getting created correctly later anyway. Had to create a logger that would re-throw the exception.

  • Pipeline finished with Success
    3 days ago
    #372687
  • Pipeline finished with Failed
    3 days ago
    Total: 155s
    #372710
  • Pipeline finished with Success
    3 days ago
    #372717
  • Pipeline finished with Success
    1 day ago
    Total: 703s
    #375348
  • Tweaked the service definition YML a bit and rebased. Not sure whether the log recorder should have more of an API with an interface defining methods, instead of expecting to work directly with state, but leaving as is for now.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    That's a tricky test.

    Coverage looks good and fix looks good.
    I'm running test only just to be sure.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Took a couple of reads to see how it was working, but I'll keep it in mind if I ever need this.

Production build 0.71.5 2024