Content lost after deleting a merged workspace

Created on 31 July 2025, 8 days 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

Production build 0.71.5 2024