Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Publishing individual nodes is impossible when contents were created on a deleted document #4997

Open
grebaldi opened this issue Apr 18, 2024 · 1 comment · May be fixed by #5462
Open
Assignees

Comments

@grebaldi
Copy link
Contributor

Problem description

It is possible for editors to get trapped in an inescapably broken workspace state by trying to publish a change set that contains both the creation of a document node and the deletion of that same node.

Steps to reproduce:

  1. Create a document
  2. Create a content node on that document
  3. Delete the document
  4. Can't publish (via the UI)

The exception being thrown is: #1541678486: Node aggregate "..." does currently not exist. This happens during the handling of command CreateNodeAggregateWithNodeAndSerializedProperties.

If an attempt has been made to publish this change set via the UI, the workspace is now broken. It cannot be published, discarded or even rebased via the UI. The only escape-hatch is the CLI:

./flow workspace:discard --force [workspace-name]

If you only take the first 3 steps, it is possible to publish the changes via CLI:

./flow workspace:publish [workspace-name]

The problem is limited to PublishIndividualNodesFromWorkspace and DiscardIndividualNodesFromWorkspace.

Once the publishing attempt via the UI has been made, ./flow workspace:publish ceases to work as well.

Notes on solution

@kitsunet noted in Slack:

shouldn't these steps result in no changes?
given that you create the node(s) and delete them again?

Indeed, the ChangeProjection currently only flags the respective change records as both created and deleted. It should be possible to remove the change record instead, if it has been flagged as created and a deletion comes in.

@mhsdesign
Copy link
Member

mhsdesign commented Feb 4, 2025

Thanks for documenting this bug ... so we first suspected that got fixed in the meantime but that is not the case. Well with publishing version 3 we do prevent any corruption happening to the content stream. So that is the good news. The ui continues to work and so will all cli commands. So this behaviour is fixed.

Now i can exactly reproduce the behaviour:

  1. Created a document (id=document-node) with main content collection (id=main-content)
  2. Created a headline in the main content collection (id=headline-node)

events at this step

sequencenumber type payload event auto created
26 NodeAggregateWithNodeWasCreated {"nodeAggregateId":"document-node","nodeTypeName":"Neos.TestNodeTypes:Document.Page","parentNodeAggregateId":"some-document-node"}
27 NodeAggregateWithNodeWasCreated {"nodeAggregateId":"main-content","nodeTypeName":"Neos.Neos:ContentCollection","parentNodeAggregateId":"document-node","nodeName":"main"} yes, via 26
28 NodeAggregateWithNodeWasCreated {"nodeAggregateId":"headline-node","nodeTypeName":"Neos.TestNodeTypes:Content.Headline","parentNodeAggregateId":"main-content"}

change records at this step

created changed moved nodeAggregateId deleted removalAttachmentPoint
1 1 0 headline-node 0 null
1 1 0 main-content 0 null
1 1 0 document-node 0 null
  1. Deleted the document

additional events at this step

sequencenumber type payload
29 NodeAggregateWasRemoved {"nodeAggregateId":"document-node","removalAttachmentPoint":"site-node"}

change records at this step

created changed moved nodeAggregateId deleted removalAttachmentPoint
1 1 0 headline-node 0 null
1 1 0 main-content 0 null
0 0 0 document-node 1 site-node

Publish site does not work

#1729974980: Publication failed, events cannot be reordered as filtered: "Node aggregate "main-content" does currently not exist."

Discard site does not work

#1729974982: Discard failed, events cannot be reordered as filtered: "Node aggregate "main-content" does currently not exist."

Publishing or discarding other selective changes does continue to work, as long as the site is not attempted to be published.
The PartialWorkspaceRebaseFailed exception will continuously be thrown.


Now the problem is similar to the one of creating a new document and another new document within and attempting to publish only that: #5364

The ui request the node document-node to be deleted the publishing goes through the events and drops all events affecting the document-node. Applying all events not targeting the document-node does work for the happy case if there are no other changes but because the filtering dindt specify to drop also all affected children like headline-node the node creation will be attempted to be applied as remaining change but fails because its parents are gone already. The reason for that the node creation of the main-content does not fail is because its tethered and by discarding the parent creation event the main content collection is too not recreated.

But this scenario really shows the problems with publishing: ANY unpublished changes within a hierarchy will prevent that part of the tree from being deleted.

Regarding the proposed solution:

It should be possible to remove the change record instead, if it has been flagged as created and a deletion comes in.

The other change records must not be removed but rather tied together, possibly by sharing the same removalAttachmentPoint so they are published or discarded in sync.

As for similar cases we definitely want to extend the Neos ui to offer a "Publish whole workspace" or "Discard whole workspace" instead to allow resolving such conflicts directly. (see neos/neos-ui#3893)

Solving this via publish/discard whole workspace is just an escape hatch without any possibly for fine grained behaviour. Instead the change projection, or the core publish api has to be able to deal with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Prioritized 🔥
Development

Successfully merging a pull request may close this issue.

2 participants