Skip to content

Fixes #35962: Soft-deleting a user keeps their tasks - #35963

Merged
manerow merged 2 commits into
mainfrom
35962-user-soft-delete-keeps-tasks
Oct 23, 2026
Merged

manerow merged 2 commits into
mainfrom
35962-user-soft-delete-keeps-tasks

Conversation

@manerow

@manerow manerow commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • It ran on every delete, including the soft delete. Only the permanent delete should clean anything up, the same way the user's preferences are already handled.
  • It removed the whole metadata-update category. In 1.x this cleanup removed only the user's suggestions (PR #17988). The 2.0 task redesign widened it to every metadata task, so a person's description and tag requests were deleted with them.

What this PR changes

  • A soft delete no longer touches the user's tasks.
  • A permanent delete removes only the suggestions the user created, open or closed, as in 1.x. Their other tasks stay and can still be resolved.
  • Deleting a bot still removes the bot's suggestions, because deleting a bot permanently deletes its user.

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:

  • Soft-delete a user, then restore them: their description request and both of their suggestions (one open, one closed) stay readable, with the user still shown as the creator.
  • Permanently delete a user: both suggestions are gone, and the description request is still there and can be approved.

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 UserResourceIT and TaskResourceIT classes pass (601 tests), as do UserRepositoryUnitTest and TaskBucketSqlDriftTest.

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.

RetriggerView in GreptileConfidence 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.

  • Soft-deleted users keep their tasks, and hard deletes remove only 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]
Loading

Reviews (2) · Last reviewed commit: "Record the user-deletion task rule and a..." · Reviewed by Greptile

@manerow
manerow requested a review from a team as a code owner October 22, 2026 11:42
@manerow
manerow requested a review from sonika-shah October 22, 2026 11:42
@manerow manerow self-assigned this Oct 22, 2026
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 22, 2026
@gitar-bot

gitar-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown
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

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java:1684-1690 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/UserRepository.java:1755 📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/FeedDAOs.java:295-309
This is the third PR to change which of a deleted user's tasks get removed. #17988 removed only suggestions, the 2.0 redesign widened that to the whole MetadataUpdate category, and this PR goes back to suggestions only, on hard delete only. The rule is stated in the PR description ("Only the permanent delete should clean anything up" and "A permanent delete removes only the suggestions the user created, open or closed … Their other tasks stay"). Nothing in docs/decisions/ records it. The two-line code comment does not say why the other task types are kept, so the next task redesign could widen the scope again. Under the repo's decision-record rules, a PR that is the third iteration on the same trade-off must add a record in the same PR.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@manerow
manerow added this pull request to the merge queue Oct 22, 2026
manerow added a commit that referenced this pull request Oct 22, 2026
…5963) (#35964)

* Fixes #35962: Soft-deleting a user keeps their tasks

* Record the user-deletion task rule and assert 404 in the hard-delete test
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-22T17:13:20Z)

Blocked the queue: integration-tests-mysql-elasticsearch

@manerow
manerow added this pull request to the merge queue Oct 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-23T07:56:52Z)

Blocked the queue: playwright-summary, integration-tests-mysql-elasticsearch

Failed Playwright tests:

  • Features/Glossary/LargeGlossaryPerformance.spec.ts › should handle large number of glossary terms with pagination

@manerow
manerow added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 0e326f7 Oct 23, 2026
100 of 101 checks passed
@manerow
manerow deleted the 35962-user-soft-delete-keeps-tasks branch October 23, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Soft-deleting a user permanently deletes every metadata task they created

2 participants