Skip to content
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

Add remaining functionality for entity deletion #710

Open
matthew-white opened this issue Sep 18, 2024 · 0 comments
Open

Add remaining functionality for entity deletion #710

matthew-white opened this issue Sep 18, 2024 · 0 comments
Labels
backend Requires a change to the API server enhancement New feature or behavior entities Multiple Encounter workflows frontend Requires a change to the UI

Comments

@matthew-white
Copy link
Member

matthew-white commented Sep 18, 2024

It is currently possible to delete an entity either via the API or from Frontend. However, we don't ever purge entities. There also isn't a way to list deleted entities or restore/undelete a deleted entity. Eventually, we want both entity deletion and submission deletion to match all the functionality we offer around form deletion. Here is the functionality as things stand with the release of v2024.2:

  Form deletion Submission deletion Entity deletion
Delete via API
Delete from individual page #709
Delete from table N/A #709
Purge after fixed interval ⚪️
List deleted #709 ⚪️
Restore via API ⚪️
Restore from Frontend #709 ⚪️

This issue is to complete what's remaining under the "Entity deletion" column. There are related release criteria here.

Any existing deleted entities in the database should be immediately purged. That is, they shouldn't show up anywhere in Frontend or linger for 30 days. I think we did something similar when we first rolled out form purging.


As a technical note, one thing we've talked about is the need to tombstone (keep a record of) purged entities. We do so for purged forms via the actees table. We don't tombstone purged submissions, but we can retrieve all the information we need for them from the audit log. One specific reason we've talked about tombstoning purged entities has to do with #668. Basically, we never want the same UUID to refer to two different entities, even if one has been purged. If that were possible, then we could have a scenario like this:

  • An entity is created offline, then sent to Central.
  • The entity is deleted and purged in Central. As soon as the device that created the entity checks its status via the integrity URL, it will see that the entity has been deleted and can be safely removed from the device.
  • But before the device has a chance to check that, another device or some other process creates a different entity with the same UUID as the first one. Now when the first device checks, it won't see that the entity has been deleted. That could be a problem if it results in the device never removing the entity or continuing to use its local version instead of the new one that's been created on the server.

To prevent this sort of case, when an entity is created, we should check that its UUID has never been used, even for a previously purged entity. Right now, the uniqueness constraint on the entities table does all that we need, but we'll probably need something more once we work on this issue.

@matthew-white matthew-white added enhancement New feature or behavior backend Requires a change to the API server frontend Requires a change to the UI needs testing Needs manual testing needs design review Needs verification from designer entities Multiple Encounter workflows and removed needs testing Needs manual testing needs design review Needs verification from designer labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Requires a change to the API server enhancement New feature or behavior entities Multiple Encounter workflows frontend Requires a change to the UI
Projects
None yet
Development

No branches or pull requests

1 participant