Skip to content

Fixes #35962: Soft-deleting a user keeps their tasks (backport 2.0 #35963) - #35964

Merged
manerow merged 2 commits into
2.0from
35962-user-soft-delete-keeps-tasks-2.0
Oct 22, 2026
Merged

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

Conversation

@manerow

@manerow manerow commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Issue

Cherry-pick of PR #35963 (Fixes #35962).

Soft-deleting a user permanently deleted every metadata task they had created, and restoring the user brought none back. With this change, a soft delete leaves the user's tasks alone. A permanent delete removes only the suggestions the user created, open or closed, as in 1.x; their other tasks stay.

Differences from the main PR

  • On 2.0 the task queries live in CollectionDAO, not in FeedDAOs, so the query change is made there.
  • On 2.0 the user-preferences cleanup still runs on every delete. This PR leaves it as it is and guards only the task cleanup.

How it was tested

On this branch: the two new TaskResourceIT tests and the existing bot-deletion test pass on MySQL + Elasticsearch and on Postgres + OpenSearch. The full UserResourceIT and TaskResourceIT classes pass (551 tests), as do UserRepositoryUnitTest and TaskBucketSqlDriftTest.

RetriggerView in GreptileConfidence Score: 4/5

The reviewed changes introduce no new blocking behavior, but the two outstanding Java guide requirements must be satisfied before merging.

Findings

  1. P2 Unchanged variables lack final ▶
  2. P2 Field paths repeat literals ▶

Summary

This PR keeps a user's tasks when the user is soft-deleted. Permanent deletion removes only their suggestions, whether open or closed.

  • User deletion keeps requests and removes suggestions only when permanent.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Delete user] --> B{Permanent delete?}
  B -->|No| C[Keep all tasks]
  B -->|Yes| D[Delete the user'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:50
@manerow
manerow requested review from mohityadav766 and removed request for a team October 22, 2026 11:50
@manerow manerow self-assigned this Oct 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@manerow manerow added the skip-pr-checks Bypass PR metadata validation check label 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
Comment on lines +4470 to +4471
CreatorWithTasks creator = createUserWithMetadataTasks(ns, "soft_delete_creator");
String creatorId = creator.user().getId().toString();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unchanged variables lack final

The new tests and helpers declare unchanged local variables and parameters without final. The Java guide requires final on both when they do not change. Apply it throughout the added code, including creator, creatorId, and the parameters of createUserWithMetadataTasks. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

private static Map<String, Object> suggestion() {
return Map.of(
"suggestionType", "Description",
"fieldPath", "description",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Field paths repeat literals

The new helpers repeat "description" in the request and suggestion payload. The Java guide requires a named constant when a string appears more than once. Use one shared constant for these field paths. This repository requirement must be satisfied before merging.

Context Used: CLAUDE.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@gitar-bot

gitar-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · Restricting hard-delete cleanup to suggestions may leave other creator-owned tasks actionable after the creator is permanently removed.

Stops soft-deleting a user from removing their metadata tasks; a permanent delete now removes only the suggestions that user created, open or closed, matching 1.x behavior. No issues found.

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 merged commit dfe2a22 into 2.0 Oct 22, 2026
67 of 70 checks passed
@manerow
manerow deleted the 35962-user-soft-delete-keeps-tasks-2.0 branch October 22, 2026 14:31

This branch was previously deployed

1 inactive deployment
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 skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants