neos / neos-development-collection

The unified repository containing the Neos core packages, used for Neos development.
https://www.neos.io/
GNU General Public License v3.0
264 stars 222 forks source link

NodeDataRepository don't respect removed-state while reducing NodeVariants #3651

Open Nikdro opened 2 years ago

Nikdro commented 2 years ago

Description

If you have moved Nodes in a workspace (multiple NodeData-Entries, one removed), the NodeDataRepository sometimes reduces the Result to the removed NodeData.


Situation, the Bug appears We had a workspace for restructuring the NodeTree of the current Website. In this workspace, some nodes where moved to other locations in the tree. Then the Editor wasn't able to find some of the moved nodes via the Search above NodeTree (neither in references-fields).

It turned out, that the NodeDataRepository queried the NodeData-entries correctly. Just the Method \Neos\ContentRepository\Domain\Repository\NodeDataRepository::reduceNodeVariantsByWorkspacesAndDimensions() reduced the Result to only the removed NodeData entry. Since removed NodeData's are filtered out, this leaded to 0 Results in the search.


Why does it happen? The priorities that are used for reduction in reduceNodeVariantsByWorkspacesAndDimensions() are dimensionValues and workspace. It's reducing the the Nodes to the best match(es) depending on the source-dimensions and workspace. But if you have moved one node, there are 2 same priorities for dimensions and workspace.
Depending on the sql-result-order (Persistence-Identifier), it get's the removed or the not removed NodeData. This is because the state (removed/not removed) isn't a priority here.

Steps to Reproduce

  1. Create a Workspace and switch into it
  2. Move multiple documents in NodeTree. (You need luck to get the "wrong" order of generated UUID to reproduce the Bug)
  3. Pulblish changes to workspace
  4. Try to search for the moved DocumentNodes. If you got the "wrong" UUID-Order, you won't find it in search, but it's in the tree.

Affected Versions

Neos: Tested starting from 5.3

Bugfix

See #3652

Nikdro commented 2 years ago

A possible solution is available at #3652.

I hope, I explained the problem exactly enough. If you have questions, please don't hesitate to contact me on Slack 💬 📞 🙂