Orphaned resource cleanup semantics¶
Manual cleanup and scheduled platform recovery share an implementation but have different permission boundaries. Platform reconcile and Worker compatibility paths do not bypass user permissions. Default file age is30 days and batch size100. Default schedule interval and claim lease are one hour, not an SLA guaranteeing recovery within one hour.
First select old-enough orphan candidates with ref_count=0 or expired claims, then claim/recheck transactionally. FileService physical deletion occurs outside the transaction. Finally, claim identity guards record deletion and storage change recording. Built-in files are skipped and associations/active references narrow candidates. ref_count alone does not prove deletability. Already-missing physical objects can complete cleanup. Physical-deletion failures retain a durable exclusion state for recovery; do not manually restore references merely because an API failed.
External files without MOI-owned objects remove metadata only, not source connector objects. Soft-deleted volumes are cleaned from leaves upward. Association removal, reference decrement, and hard volume deletion occur in tenant transactions. Newly orphaned files may require another pass; one result does not prove complete cleanup.
Both cleanup stages have separate batch_size limits and may aggregate errors after partial success. API failure does not mean nothing was deleted; handlers return no partial-success counts. A single500 cannot reconstruct the deletion set. Check audit/storage facts while resolving causes or awaiting existing-claim recovery. Repeated requests are not the same idempotent receipt. There is no current dry_run, candidate preview, or job_id polling contract.