Repository navigation
Fixes #35962: Soft-deleting a user keeps their tasks (backport 2.0 #35963) - #35964
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
| CreatorWithTasks creator = createUserWithMetadataTasks(ns, "soft_delete_creator"); | ||
| String creatorId = creator.user().getId().toString(); |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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!
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. 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 |
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
2.0the task queries live inCollectionDAO, not inFeedDAOs, so the query change is made there.2.0the 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
TaskResourceITtests and the existing bot-deletion test pass on MySQL + Elasticsearch and on Postgres + OpenSearch. The fullUserResourceITandTaskResourceITclasses pass (551 tests), as doUserRepositoryUnitTestandTaskBucketSqlDriftTest.The reviewed changes introduce no new blocking behavior, but the two outstanding Java guide requirements must be satisfied before merging.
Findings
Summary
This PR keeps a user's tasks when the user is soft-deleted. Permanent deletion removes only their suggestions, whether open or closed.
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]Reviews (2) · Last reviewed commit: "Record the user-deletion task rule and a..." · Reviewed by Greptile