Repository navigation
Fixes #35962: Soft-deleting a user keeps their tasks - #35963
Conversation
Code Review ✅ Approved 1 closed / 1 findings🔴 High risk · Changing user-deletion cleanup alters durable task retention: soft-deleted users keep tasks, while hard deletion may leave non-suggestion tasks tied to removed creators. Soft-deleting a user now keeps their tasks, so restoring the user brings back their description, tag, owner, tier, and domain requests along with their suggestions. A permanent delete removes only the user's suggestions, open or closed, and leaves other tasks resolvable. Resolved the missing decision record for which tasks a user deletion removes. No open issues found. ✅ 1 closed✅ Quality: No decision record for which tasks a user deletion removes
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
Fixes #35962
Problem
Deleting a user from the UI is a soft delete: the user can be restored later. But it also permanently deleted every metadata task the user had created: description, tag, owner, tier and domain requests, and suggestions, open or closed. Restoring the user brought none of them back.
I reproduced it on the 2.0.6 release. A user created four tasks on a table. After an admin soft-deleted the user, all four returned 404, and they still returned 404 after the restore.
Why it happened
When a user is deleted, a cleanup removes the tasks they created, so nobody is left reviewing a suggestion from someone who no longer exists. It had two problems:
What this PR changes
What users will notice
Offboarding a person keeps their open requests in the review queue and keeps the history of their past ones. Restoring a user shows their tasks again.
How it was tested
Two new tests in
TaskResourceIT:Both tests fail without this change and pass with it, on MySQL + Elasticsearch and on Postgres + OpenSearch. The existing bot-deletion test still passes. The full
UserResourceITandTaskResourceITclasses pass (601 tests), as doUserRepositoryUnitTestandTaskBucketSqlDriftTest.Not in this PR
A permanent delete still removes the suggestions straight from the database, which leaves their links, version history and workflows behind. That is a separate, older problem.
Tasks already lost on 2.0.x cannot be restored by this change.


Confidence Score: 5/5
The PR appears safe to merge; no new actionable issues were found.Summary
Soft-deleting a user keeps their tasks. Permanent deletion removes only their suggestions.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Delete user] --> B{Permanent delete?} B -->|No| C[Keep all tasks] B -->|Yes| D[Remove creator's suggestions] D --> E[Keep other tasks]Reviews (2) · Last reviewed commit: "Record the user-deletion task rule and a..." · Reviewed by Greptile