Skip to content

feat(deletion): add resumable media inventory - #9329

Draft
ravarora2 wants to merge 2 commits into
mainfrom
rarora/media-inventory
Draft

ravarora2 wants to merge 2 commits into
mainfrom
rarora/media-inventory

Conversation

@ravarora2

@ravarora2 ravarora2 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add buzz-admin user-deletions media --pubkey <npub-or-hex> --mode print-only to inspect a person's media across communities. It saves a resumable inventory and prints JSON after classification, without deleting source records or storage objects.

One new table, entity_deletion_media_files, stores each file's evidence, status, exact deletion targets and errors. Discovery rows and the completion marker commit together, including an empty inventory. Retries reuse the saved inventory. The shared handler supports print-only, print and no-print, and retries deletion of the same recorded object versions after a crash.

This draft does not enable production deletion. The execution loop requires a ProtectedMedia provider. Durable reservations respected by every writer, approved downstream removal selectors and retention checks still need integration. Standalone preview keeps proven shared files and leaves unresolved files unknown; it never manufactures an executable deletion plan. Direct destructive modes are rejected before connecting to services.

The operator guide lists every source table, control-table write, mode and crash boundary. Source reads can use a separate read-only database connection while the journal stays local. No production database or bucket was accessed.

Related issue

Related: #8959 implements standalone agent database deletion. This PR adds the separate media inventory and recovery journal. No duplicate media-inventory PR was found.

Testing

Exercised the actual command against isolated local PostgreSQL and an HTTP S3 fixture. It found an unposted upload recorded only in a historical storage version, saved its inventory, and resumed with storage offline. The fixture rejects storage mutations. No human testing yet; keep this PR in draft.

To test with operator-provided source and storage connections, use a migrated local control database and run cargo run -p buzz-admin -- user-deletions media --pubkey <npub> --include-owned-agents --mode print-only. Stdout should contain inventory JSON. Exit 2 means decisions remain unresolved. Resume the saved observation with the printed --run-id; use a new run ID to observe changed data. Larger source databases can use --max-source-rows 10000000 --scan-timeout-secs 900; exceeding any budget publishes no partial inventory.

Broad local validation is not clean: an existing connection-pool test timed out, and an admission test process was killed during the database suite. The new inventory and recovery checks passed. The draft does not claim repository-wide validation or human testing is complete.

Generated with Codex

ravarora2 and others added 2 commits November 10, 2026 13:27
Save atomic per-file inventory and expose print-only inspection with a protected exact-version execution loop.

Co-authored-by: dessert <7d616e7e143e5d408159614dccff1371350a1c1bd36c8de838a45ece5aca0aca@buzz.block.builderlab.xyz>
Signed-off-by: Ravneet Arora <rarora@squareup.com>
Allow larger read-only inventories while preserving atomic failure when the source scan exceeds its budget.

Co-authored-by: dessert <7d616e7e143e5d408159614dccff1371350a1c1bd36c8de838a45ece5aca0aca@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