Skip to content

Add read-only user cleanup batch preview - #9332

Draft
ravarora2 wants to merge 1 commit into
mainfrom
rarora/user-batch-preview
Draft

ravarora2 wants to merge 1 commit into
mainfrom
rarora/user-batch-preview

Conversation

@ravarora2

Copy link
Copy Markdown
Contributor

Summary

Add an operator command that prints every proposed human-content cleanup batch for an npub or hex public key in one community. This lets operators inspect which records would be removed before adding deletion execution.

cargo run -p buzz-admin -- user-deletions preview-batches \
  --pubkey '<npub-or-hex>' --community '<community-uuid>' \
  --read-only > batches.jsonl

The command uses a read-only connection and database snapshot. It does not create requests, change progress or delete data. Batches contain at most 100 exact row operations, with dependent records before their parents. The iterator fills batches across events and tables using an in-memory simulation.

The output ends with preview_complete only after the declared scope is exhausted. It lists excluded event kinds and flags media or active work. Thread repairs are reported separately; their mutations are not simulated. Relay-authored history requires --relay-pubkey. See usage and scope.

Related issue

Related to #8698. This is a standalone read-only diagnostic on main, with no dependency on that unmerged deletion handler. No matching preview issue found.

Testing

Ran the actual command against an isolated PostgreSQL fixture using an npub. Its 105 reactions produced 315 items in batches of 100, 100, 100 and 15. The target message remained outside the deletion plan. Database fingerprints matched before and after; a second run printed identical output. An item-limit failure returned an error without a completion marker or database changes.

Human testing against the intended npub remains pending; keep this PR in draft. With DATABASE_URL pointing to the database to inspect, run the command above and check the batch items and final completion record. No real user preview has been run for this PR.

Repository-wide local gates are not green. just ci and just test were attempted; toolchain issues and existing agent-test timing failures occurred. The remaining broad runs were stopped after the handler checks passed. This draft skips the repeated Rust and desktop pre-push test lanes; it retains branch and file-size checks. Full repository validation remains pending.

Generated with Codex

Print ordered cleanup batches for a public key and community using a read-only database snapshot. Keep this diagnostic path separate from deletion execution.

Co-authored-by: maincourse <37ce551b493d4a998caf030929c47bce0b6a0e43f1178b3a63c4151d7c16b76e@buzz.block.builderlab.xyz>
Signed-off-by: Ravneet Arora <rarora@squareup.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant