Open strangedev opened 5 years ago
For clarity: 5fb96dd disallows the problematic adding of shadows, and leaves the delete logic unchanged.
Since now the invalid state is not reachable anymore, this can be closed, right?
No, since the branch was not merged yet.
Follow up: We can't just disallow this in the API, the front end should also detect this case and disallow it, otherwise this will be confusing to users.
If I add a Shadow that references a Concrete of the same parent, when trying to delete the Shadow again, the following edge case may occur:
If the parent is a template and there exist shadow copies of it, the backend will try to delete the Shadow from the parent's shadow copies as well. Because copies of the parent include the Shadow twice (once as a direct copy of the Concrete and another as an indirect copy of the Shadow we've just created), the delete query will mark them both for deletion and the query will fail.
The backend should either detect this edge case (potentially hard without distinguishing between direct and indirect shadow copies) or disallow adding the Shadow* in the first place, since there's no use case for it.