Files
buzz/crates/buzz-deletion/src
Luke Tornquist 7e94503fe9 Stop using the unused delivery_log and subscriptions tables (#9746)
## Summary

`delivery_log` and `subscriptions` came with the initial schema for a
delivery feature that was never built. No code has ever written to them.
This PR removes every reader, writer, partition-manager entry and
deletion selection, so a follow-up contract migration can drop both
tables (`docs/database.md` Rule 5: drop only after the release that
stops using a table is fully deployed).

- **Partition manager:** manages `events` only. It no longer creates or
audits `delivery_log` partitions.
- **User deletion:** the content, account and profile handlers no longer
select, delete or recheck rows in either table.
- **Community deletion:** both tables move from
`EXPECTED_SCOPED_TABLES`/`PURGE_SCOPED_TABLES` to a new
`RETIRING_SCOPED_TABLES` list. The catalog accepts each one present or
absent. The purge deletes its rows only while it exists.
`validate_approved_schema` accepts a frozen retiring table that has
since been dropped, and no other missing table. Without this, every
community deletion would fail its exact catalog check once the tables
are gone.
- **Docs:** a short "Retiring a tenant-owned table" section in
`docs/database.md`, plus partition-monitoring and cleanup docs.

The tables, their schema files, `.pgschemaignore` entries and the
partition primary-key lint exception stay until the drop migration.

### Rollout

1. Deploy this release to every relay, deletion executor and operator
CLI. Older binaries fail community deletion's exact catalog check after
the drop.
2. Then ship the drop migration and remove the schema entries. Operators
with external tooling that expects `delivery_log` to exist must update
it first.

The partition audit stops emitting `buzz_partition_audit_*` series with
`table="delivery_log"`. Alerts keyed on that label will go quiet.

### What got simpler

Two tables' worth of code paths are gone: partition management, the
audit, and five deletion handlers stop special-casing them. The
follow-up removes the tables and the `RETIRING_SCOPED_TABLES` entries.

### Testing

On a remote workstation at `3675ff17`: `cargo fmt --check`, `clippy -D
warnings` for buzz-db, buzz-deletion and buzz-relay (all targets), unit
tests for buzz-db (lib and tests), buzz-deletion and buzz-relay bins,
and `scripts/postgres-test-run.sh` for buzz-db
partition/deletion/migration tests (294 passed) and all buzz-deletion
Postgres tests (44 passed). The new tests cover: retiring tables purged
and verified while present; a request inventoried before a real `DROP
TABLE` still purges and verifies; `validate_approved_schema` tolerates
only retiring tables vanishing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Luke Tornquist <tornquist@squareup.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 22:19:15 -05:00
..