Add a limit to entity hierarchy depth
Add a limit to entity hierarchy depth. We currently have many SQL calls that recursively walk entities hierarchies. Each of these walks currently include a depth limit to prevent stack over flows or infinite loops. We need to block users from creating hierarchies deeper than our recursive walk limits.
Retried my script on staging and got back the expected response this time:
On synapse.org I do not see the "red" labels anymore when navigating to the deepest folder and I cannot upload a file in the leaf folder or create an additional nested folder: "Exceeded the maximum hierarchical depth of: 50 for parent: syn24992964"
I can see the error when I added the following line to the test:
The nodeDAO.getEntityPathIds() limit is actually 49 and not 50;
I guess then the check is performed before the node manager? e.g. maybe at the entity service level? I used the python client to create the nested hierarchy through the API (unfortunately migration deleted my testing folder).
Maybe an API integration test would surface the issue? The message seem to come from the NodeDaoImpl.validatePath method.
I am having trouble reproducing the errors you observed. The following test passes on develop:
Blocking the 50th child will result in a 400, and the 49th child is still available.
I tried running a script to create more than 50 nested folders:
Here 21918767 is a folder in a project (which is already at level 2).
But I got back the following 500 error:
I would expect a 4xx status code. Additionally now navigating to the latest nested folder that I created I get back a 500 (Path depth limit of: 50 exceeded for: syn24747304):
I can navigate to the parent of this folder: https://staging.synapse.org/#!Synapse:syn24747299 but the children shows the same red 500.