Content lost after deleting a merged workspace

Created on 31 July 2025, 3 months ago

Problem/Motivation

If a sub-workspaces gets merged into parent workspace and the content gets published, one would assume that removing the workspaces does not delete the content

Steps to reproduce

Create a page in a subworkspaces of stage
Merge the workspaces into stage
Publish content from stage
Remove the subworkspace
Observe the page being deleted

Proposed resolution

Not sure what the fix would be.

I've tracked down and the issue started appearing after this change:
https://www.drupal.org/project/wse/issues/3494770 📌 Simplify getAssociatedRevisions() and getAssociatedInitialRevisions() from core Active

But digging into the DB, I see some weird thing that maybe it is a bug in workspace?
After publishing, you get in DB 2 revision_default. One for original workspaces and one for NULL.
select * from node_revision;
+-----+-----+----------+--------------+--------------------+--------------+------------------+---------------+
| nid | vid | langcode | revision_uid | revision_timestamp | revision_log | revision_default | workspace |
+-----+-----+----------+--------------+--------------------+--------------+------------------+---------------+
| 1 | 1 | en | 1 | 1753956167 | NULL | 1 | sub_sub_stage |
| 1 | 2 | en | 1 | 1753956167 | NULL | 1 | NULL |
+-----+-----+----------+--------------+--------------------+--------------+------------------+---------------+

This is causing the WSE getAssociatedInitialRevisions function to return a revision when this is called in WorkspaceManager::purgeDeletedWorkspacesBatch
where in a comment it says:
// If the workspace is tracking the entity's default revision (i.e. the
// entity was created inside that workspace), we need to delete the
// whole entity after all of its pending revisions are gone.

OR am I missing the point and one should never remove a workspaces, even if content is merged and publihsed?

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇷🇴Romania dragos-dumi

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

Merge Requests

Comments & Activities

  • Issue created by @dragos-dumi
  • 🇷🇴Romania amateescu

    This was recently fixed in 🐛 Deleting a workspace may lead to live data deletion Active , you'll need to update to the latest dev version :)

  • 🇷🇴Romania dragos-dumi

    Checked that fix already, but that refers only to closed workspaces deletion. a workspaces that is merged to parent, does not get closed, so the content loss still happens.

  • 🇷🇴Romania amateescu

    That's right.. I'll see what we can do about it.

  • Pipeline finished with Skipped
    2 months ago
    #568007
    • amateescu committed ab037bae on 2.0.x
      Issue #3539055: Content lost after deleting a merged workspace
      
  • 🇷🇴Romania amateescu

    This should be fixed properly after some upcoming changes in Drupal 11.3, but in the meantime the quickest fix is to not purge any data when deleting sub-workspaces. Thanks for reporting this!

    • amateescu committed acac7721 on 1.0.x
      Issue #3539055: Content lost after deleting a merged workspace
      
  • Pipeline finished with Failed
    2 months ago
    Total: 188s
    #568004
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Pipeline finished with Success
    about 1 month ago
    Total: 429s
    #592702
  • Pipeline finished with Success
    about 1 month ago
    Total: 845s
    #592815
  • Pipeline finished with Failed
    about 1 month ago
    Total: 344s
    #592843
  • Pipeline finished with Success
    about 1 month ago
    Total: 305s
    #596779
  • Pipeline finished with Success
    about 1 month ago
    Total: 356s
    #596787
  • Pipeline finished with Failed
    29 days ago
    Total: 993s
    #603557
  • Pipeline finished with Failed
    25 days ago
    Total: 949s
    #606428
  • Pipeline finished with Failed
    25 days ago
    Total: 1000s
    #606745
  • Pipeline finished with Failed
    25 days ago
    #606857
  • Pipeline finished with Failed
    23 days ago
    Total: 1013s
    #608388
  • Pipeline finished with Failed
    23 days ago
    Total: 1255s
    #608413
  • Pipeline finished with Success
    23 days ago
    Total: 832s
    #608466
  • Pipeline finished with Failed
    23 days ago
    Total: 1136s
    #608854
  • Pipeline finished with Success
    23 days ago
    Total: 2221s
    #608961
  • Pipeline finished with Success
    22 days ago
    #610342
  • Pipeline finished with Success
    22 days ago
    Total: 224s
    #610344
  • Pipeline finished with Success
    21 days ago
    Total: 310s
    #610969
  • Pipeline finished with Success
    20 days ago
    Total: 631s
    #611472
  • Pipeline finished with Success
    20 days ago
    Total: 620s
    #611483
  • Pipeline finished with Success
    8 days ago
    Total: 298s
    #624285
  • Pipeline finished with Success
    about 16 hours ago
    #631755
  • Pipeline finished with Failed
    about 5 hours ago
    Total: 234s
    #632047
  • Pipeline finished with Success
    about 5 hours ago
    Total: 190s
    #632052
Production build 0.71.5 2024