Harden owner deletion preparation coverage

Co-authored-by: Codex <noreply@openai.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: tornquist <tornquist@squareup.com>
This commit is contained in:
tornquist
2026-09-25 18:03:39 +00:00
parent 99c26f9741
commit 98f4e91ef1
3 changed files with 201 additions and 21 deletions

View File

@@ -1838,6 +1838,43 @@ mod postgres_tests {
);
}
}
let migration_approval_table = migration
.tables
.get("community_deletion_approvals")
.expect("0029 approval table");
let schema_approval_table = schema
.tables
.get("community_deletion_approvals")
.expect("schema.sql approval table");
for invariant in [
"inventory_digest bytea not null check (length(inventory_digest) = 32)",
"foreign key (request_id, community_id, inventory_digest) references community_deletion_requests(id, community_id, inventory_digest) on delete restrict",
] {
assert!(
migration_approval_table.contains(invariant),
"0029 deletion approvals are missing {invariant}"
);
assert!(
schema_approval_table.contains(invariant),
"schema.sql deletion approvals are missing {invariant}"
);
}
let migration_request_table = migration
.tables
.get("community_deletion_requests")
.expect("0029 deletion request table");
for request_table in [
migration_request_table,
schema
.tables
.get("community_deletion_requests")
.expect("schema.sql deletion request table"),
] {
assert!(
request_table.contains("unique (id, community_id, inventory_digest)"),
"deletion requests must expose the exact composite approval target"
);
}
for (function, definition) in &migration.functions {
let in_schema = schema
.functions