Revision metadata is not updated when a workspace is merged into its parent

Created on 23 November 2022, about 2 years ago
Updated 29 April 2024, 8 months ago

Problem/Motivation

Workspaces structure: develop -> stage -> live.

After merging the develop workspace into stage, the workspace revision metadata field is not updated to point to the new workspace ID.

Steps to reproduce

  • Create a node in develop workspace
  • Merge the develop workspace into stage in /admin/config/workflow/workspaces/manage/develop/stage/merge
  • Either load the latest revision of that node and check the value of the workspace revision metadata field, or look it up in the node_revision table.

Proposed resolution

Update the workspace revision metadata field for all the revisions involved when merging two workspaces.

πŸ› Bug report
Status

Fixed

Version

10.3 ✨

Component
WorkspacesΒ  β†’

Last updated 4 days ago

No maintainer
Created by

πŸ‡·πŸ‡ΊRussia vladimir_kriukov

Live updates comments and jobs are added and updated live.
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.

  • πŸ‡·πŸ‡΄Romania amateescu

    I agree with the solution, since the workspace merger behaves like the publisher and it's not creating new revisions when a workspace is merged into its parent. However, we need test coverage for this, somewhere in \Drupal\Tests\workspaces\Functional\WorkspaceConcurrentEditingTest.

  • πŸ‡·πŸ‡΄Romania amateescu

    Improved the patch a bit and converted to a MR, still needs tests so leaving at NW for now.

  • Pipeline finished with Failed
    9 months ago
    Total: 720s
    #140839
  • Pipeline finished with Failed
    9 months ago
    Total: 165s
    #142786
  • Status changed to Needs review 9 months ago
  • πŸ‡·πŸ‡΄Romania amateescu

    Added test coverage and revamped the issue summary since this can no longer be reproduced via the workspace conflict constraint.

  • Status changed to Needs work 9 months ago
  • The Needs Review Queue Bot β†’ tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

  • Status changed to Needs review 9 months ago
  • Pipeline finished with Success
    9 months ago
    Total: 4484s
    #142870
  • Status changed to RTBC 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Hiding patches for clarity

    Test only feature was already ran

    1) Drupal\Tests\workspaces\Kernel\WorkspaceAssociationTest::testWorkspaceAssociation
    Failed asserting that two arrays are equal.
    --- Expected
    +++ Actual
    @@ @@
         1 => 4
         2 => 5
         3 => 6
    -    4 => 7
    -    5 => 9
     )
    /builds/issue/drupal-3323317/vendor/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqual.php:94
    /builds/issue/drupal-3323317/core/modules/workspaces/tests/src/Kernel/WorkspaceAssociationTest.php:183
    /builds/issue/drupal-3323317/core/modules/workspaces/tests/src/Kernel/WorkspaceAssociationTest.php:157
    /builds/issue/drupal-3323317/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
    

    So change to the Merger looks good.

  • πŸ‡ΊπŸ‡ΈUnited States michelle Wisconsin, USA

    My issue, https://www.drupal.org/project/drupal/issues/3438769 πŸ› Sub workspace does not clear Closed: duplicate was marked as a duplicate of this. However, this patch is not fixing the issue of the develop workspace not clearing. Is there something not working here, or is my issue not actually a duplicate?

  • πŸ‡·πŸ‡΄Romania amateescu

    Hm.. that's right, I thought πŸ› Sub workspace does not clear Closed: duplicate was about the value of the workspace metadata field, but it's actually about WorkspaceAssociation::onPostPublish() not deleting the associations of sub-workspaces. I'll reopen it :)

  • Status changed to Needs work 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Added a comment to the MR. It's a bit of a pain to address but this change makes a service that's injected unused.

  • Pipeline finished with Failed
    8 months ago
    Total: 315s
    #145870
  • Status changed to Needs review 8 months ago
  • πŸ‡·πŸ‡΄Romania amateescu

    Oops, I didn't realize we don't need that service anymore. Since the Merger class is not a service and it's also tagged @internal, I only removed the argument from its constructor, but I had to do the whole deprecation dance anyway for WorkspaceOperationFactory because that's an actual service :/

    Also added a CR for it: https://www.drupal.org/node/3440755 β†’

  • Pipeline finished with Success
    8 months ago
    Total: 633s
    #145874
  • Status changed to RTBC 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Wasn't fully aware of DeprecatedServicePropertyTrait neat!

    Deprecation is all green. Know the stable ticket for workspace is RTBC but maybe this can get in at the same time.

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

    I checked the change record and it is correct and easy to understand.

    • alexpott β†’ committed 028e0937 on 10.3.x
      Issue #3323317 by amateescu, vladimir_kriukov, smustgrave, alexpott:...
    • alexpott β†’ committed 36006808 on 11.x
      Issue #3323317 by amateescu, vladimir_kriukov, smustgrave, alexpott:...
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Whoops! Forgot to mark this fixed.

  • Status changed to Fixed 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024