refactor(files): unify mutation accounting and retention

Merged
MZ
4d ago
+2068-1380

Summary

  • Unify file mutation accounting, retained-version cleanup, and owner-scoped retention.
  • Part 1 of the five-PR split of #8610. Provides the storage foundation for core Project files; no schema changes.

Testing

  • Focused accounting/content-effect tests: 28 passed; cleanup tests: 17 passed.
  • Disposable database: retention/accounting tests passed; all 56 version tests passed after updating failure injection to the shared accounting boundary.
  • Scoped type check and unused-export check passed. Full CI runs on this draft.

Type of Change

  • Feature / refactor

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Focused tests added/updated and passing
  • Full hosted CI passed
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Review stack

  1. #9015 — mutation accounting and retention (base: staging)
  2. #9016 — core files, history, uploads, realtime
  3. #9017 — rendering, derived content, search
  4. #9018 — cross-owner copy, extraction, downloads, export
  5. #9019 — public sharing

Review each against its immediate parent. #8610 is superseded by this stack.