Keep a deleted-but-held account's audit and journal records under the hold #381

Merged
jcoffey-dev merged 1 commits from fix/legal-hold-audit-purge into main 2026-11-11 19:43:28 +00:00
1 Commits
Author SHA1 Message Date
jcoffey-dev c884bad555 Keep a deleted-but-held account's audit and journal records under the hold
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 9m6s
held_accounts() scanned only live accounts, so an account deleted while
undelete still kept it -- the case a legal hold is placed for -- was absent
from the set the retention purges trust. audit_purge consults it directly,
so a deleted-but-held account's audit trail was purged once past the 90-day
floor while the hold was active. The journal purge augmented the set at its
own call site, so it was affected only when a hold covered no live account.

held_accounts() now folds in the accounts undelete keeps that a hold covers,
through the domain and tenant their retained record carries, so every purge
that trusts it keeps a deleted-but-held account's records. The journal call
site's now-redundant augmentation is removed, leaving one source of truth.

Covered by legal_hold_tests: a deleted-but-held custodian is now present in
held_accounts() (LH-6, AU-7).
2026-11-11 12:27:05 -07:00