perf(user): drain GDPR deletion batches within a claim - #5368
Merged
Conversation
CLI v2 deletes leaf sessions in parallel and keeps draining batches until the cron reserve is gone. Usage-prefix scrubbing skips already clean pages in the same claim and records scanned_count so the admin queue shows real progress.
Keep parsed progress narrowed across the scan loop and allow null prefixes in the already-clean page fixture.
Persist processed_count on retry, rate-limit, and needs-attention so a partial leaf batch is not lost if a sibling DELETE fails.
Assert CLI leaf-batch progress survives a later 500, and that retry and needs-attention dispositions write processed_count onto the step.
withProgress cannot spread onto DeletionHandlerManualAction.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryReviewed the GDPR claim-drain changes across CLI v2 parallel deletes, usage-prefix clean-page scanning, progress persistence, and admin queue display; no high-confidence bugs in changed code. Files Reviewed (12 files)
Reviewed by grok-4.6 · Input: 339.2K · Output: 31.4K · Cached: 780.4K Review guidance: REVIEW.md from base branch |
iscekic
approved these changes
Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Speed up GDPR teardown for users with large CLI session and usage-prefix histories, and show real progress in the admin queue.
A production user with 4k+ CLI sessions was deleting ~10/min (~7h) because each cron claim processed one leaf batch of 10 and then yielded. Usage-prefix scrubbing had the same one-page-per-claim shape, so already-clean pages looked idle.
scanned_countnext toprocessed_countso the admin queue can show “80 scrubbed · 49000 scanned” instead of looking stuck.No SQL migration:
scanned_countis an optional JSON field.Verification
pnpm --filter web test -- src/lib/user/deletion-queue/handlers/cli-v2.test.ts --runInBandpnpm --filter web test -- src/lib/user/deletion-queue/handlers/usage-prompt-prefixes.test.ts --runInBandpnpm --filter web test -- src/app/admin/deletion-queue/deletion-queue-format.test.ts --runInBandVisual Changes
Admin deletion-queue progress tiles and activity rows now show step counts (
N deleted/N scrubbed · M scanned) and unlock later groups only after earlier groups finish.Reviewer Notes
Per-session session-ingest DELETE is unchanged (leaf-only, 409 on non-leaf). Parallelism is inside one claimed batch of 10.