yeldiRium / st3k101

UNMAINTAINED.
2 stars 1 forks source link

Adding a Shadow* to a parent which includes the referenced Concrete* breaks delete #76

Open strangedev opened 5 years ago

strangedev commented 5 years ago

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.

strangedev commented 5 years ago

For clarity: 5fb96dd disallows the problematic adding of shadows, and leaves the delete logic unchanged.

yeldiRium commented 5 years ago

Since now the invalid state is not reachable anymore, this can be closed, right?

strangedev commented 5 years ago

No, since the branch was not merged yet.

strangedev commented 5 years ago

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.

strangedev commented 5 years ago

Adding a Shadow to a parent which includes the referenced Concrete breaks delete #76