-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
BUGFIX: Order NodeTypes found inside NodeTypes
folder
#4394
Conversation
Placing NodeTypes into the `NodeTypes` folder will currently yield a non-deterministic order when they are scanned. One can observe this when running `flow configuration:show --type NodeTypes`. The order might change from installation to installation with the same sources. Also you can observe that with this fix, the order is influenced by the file name. Thats because the underling directory scan via the `RecursiveDirectoryIterator` doesn't enforce a specific order, but will return the files how the underlying file system returns them - on linux - unordered. The `NodeTypes` configuration folder was introduces with #3332. This was first noticed, when the nodeTypes would show up in a different order in the "Create New" dialog in the Neos UI: neos/neos-ui#3560 (comment)
There is specificity problem. `Opens Above` appears in both nodeType labels, and thus both might be clicked but testcafe decides for the first occurrence. And the nodeTypes order is currently non deterministic neos/neos-development-collection#4394
There is specificity problem. `Opens Above` appears in both nodeType labels, and thus both might be clicked but testcafe decides for the first occurrence. And the nodeTypes order is currently non deterministic neos/neos-development-collection#4394
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM by reading
@gjwnc posted some useful insights (thank you ❤️) about the unsortiness in other places as well, and that even using the old NodeTypes loading it will be unsorted. This questions this fix as it might not be worth and intended to be fixed. ——— None of the configs is or was sorted. Not the nodeTypes or Settings or Policy. Before neos/neos-development-collection#3332, the config was mainly loaded using Flow's A quick check on a project of ours showed, that on production I get
and on my local dev it is reversed - Sandstorm before PunktDe. |
If I could decide, I'd vote for your PR 🤞 I didn't want to discourage you with my comment. It was meant as showing a bigger picture. Regarding configuration I think it would be great to have consistent and predictable results.
This should result in predictable results for all installations and all configs. 😃 But yeah, not sure if there is any interest in such little changes likely no one will even recognize, thus maybe not much of a need 🙈 But I still favor predictability because it avoids future confusion. |
Not sure if this is really an issue. The unsorted order can only happen within a package OR cross-package if no dependency is defined. Within a package the developer has to ensure, that there are no concurrent configurations, which could lead to different results. Cross-package you have to define dependencies anyways, as otherthings (e.g. Fusion) will break too. BUT I would expect a loading order of the files by name within a package, too. |
Basically all was said:
Adding one thing I can think of:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline comment…
Neos.ContentRepository/Classes/Configuration/RecursiveDirectoryIteratorWithSorting.php
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm skeptical with this change (as written on Slack).
The new behavior is fine of course, but it adds complexity that is not needed IMO because the order of node types depend on the usecase.
E.g. in the UI we should mostly order them according to nodeType.ui.position
– in other parts you might want to show document node types first etc..
Yes indeed for the ui they are sorted via the position key. @ahaeslich also mentioned that the ui should resort as fallback to sorting them by but the sorting doesnt seem to take effect. |
i agree and i opened up a flow issue where we can discuss if we want to fix it all or keep everything as is: It does not make sense to first fix this problem on the outmost leaf in this neos config loader. Thats why ill be closing this pr. |
Placing NodeTypes into the
NodeTypes
folder will currently yield a non-deterministic order when they are scanned.One can observe this when running
flow configuration:show --type NodeTypes
.The order might change from installation to installation with the same sources.
Also you can observe that with this fix, the order is influenced by the file name.
Thats because the underling directory scan via the
RecursiveDirectoryIterator
doesn't enforce a specific order, but will return the files how the underlying file system returns them - on linux - unordered.The
NodeTypes
configuration folder was introduces with #3332.This was first noticed, when the nodeTypes would show up in a different order in the "Create New" dialog in the Neos UI:
neos/neos-ui#3560 (comment)
Upgrade instructions
Review instructions
Checklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions