python student-tests/staging_cleanup.py
1. ready 232becfa-7e6d-44da-bb4d-e72e9d0cc9fd: staging removed by the worker right after COMMIT; original and variants kept
2. prepared: staging leftover of a ready attachment, orphan staging, orphan variant, staging of a failed attachment, staging of a queued job (worker stopped)
3. dry-run: {"staging_after_ready": 2, "staging_failed_expired": 0, "orphan": 2} found, deleted 0
   grace 900 s: deleted 0 — everything is younger than the grace period
   grace 2 s: {"staging_after_ready": 2, "staging_failed_expired": 0, "orphan": 2}, deleted 4; kept: ready original and variants, staging of the queued job, staging of the failed attachment (retention)
   retention 0 s: failed staging deleted ({"staging_after_ready": 0, "staging_failed_expired": 3, "orphan": 0}); replay now: {'result': 'refused', 'reason': 'source_missing', 'detail': 'оригинал в staging уже удалён (истёк STAGING_RETENTION_SECONDS)'}
   repeated run: deleted 0
4. worker started: f8dce515-9269-42bf-a961-6ef73c87d763 ready, its staging removed
PASS: staging is removed after the result is committed; objects without a reference in the database are removed only after the grace period; the staging of failed uploads is kept for replay until retention ends; dry-run and repeated runs are safe
