date: 2026-10-30T04:43:02Z  commit: 81dd816
# после трёх прогонов upload-memory и mmap-32m на том же стенде: 68 загрузок получили 503 (7 + 27 + 34, все при 40 одновременных по 10 MiB)
$ make reconcile   # dry-run, 04:42:40Z, сразу после серии
{"mode": "dry-run", "grace_seconds": 3600, "scanned": {"objects": 1794, "rows": 1837}, "found": {"orphan_stale": 0, "orphan_fresh": 0, "missing": 0, "size_mismatch": 0, "sha_mismatch": 0, "pending_stale": 0, "pending_fresh": 68, "quarantined": 0, "healed": 0}, "fixed": {"orphan_stale": 0, "missing": 0, "size_mismatch": 0, "sha_mismatch": 0, "pending_stale": 0, "healed": 0}, "errors": 0}
$ psql -c "SELECT status, count(*), min(created_at), max(created_at) FROM attachments GROUP BY status"
 status  | count |              min              |              max              
---------+-------+-------------------------------+-------------------------------
 pending |    68 | 2026-10-30 04:30:05.876922+00 | 2026-10-30 04:38:09.467838+00
 ready   |  1769 | 2026-10-30 02:30:27.495355+00 | 2026-10-30 04:42:33.025293+00
(2 rows)

$ psql -c "SELECT created_at < '2026-10-30 04:34:42+00' AS before_upload_memory, count(*), sum(size_bytes) FILTER (WHERE size_bytes > 10000000) / 1048576 AS mib_10m FROM attachments WHERE status = 'pending' GROUP BY 1 ORDER BY 1"
 before_upload_memory | count |       mib_10m        
----------------------+-------+----------------------
 f                    |    67 | 669.9677963256835938
 t                    |     1 |                     
(2 rows)

# ожидание: until [ $(psql -tA -c "SELECT count(*) FROM attachments WHERE status='pending'") = 0 ]; do sleep 10; done
pending = 0 в 2026-10-30T04:53:47Z (последнее намерение создано в 04:38:09, grace 900 с, уборка раз в 30 с)
$ docker compose logs api | audit.attachment_discarded по причине и времени (сортировка по ts); сумма attachments.swept
{'abandoned': 68} swept 68; по времени: первое 2026-10-30T04:45:08Z (намерение от s3-outage), затем 67 с 04:51:08Z по 04:53:38Z
$ psql -c "SELECT status, count(*) FROM attachments GROUP BY status"
 status | count 
--------+-------
 ready  |  1769
(1 row)

$ make reconcile   # dry-run после уборки
{"mode": "dry-run", "grace_seconds": 3600, "scanned": {"objects": 1769, "rows": 1769}, "found": {"orphan_stale": 0, "orphan_fresh": 0, "missing": 0, "size_mismatch": 0, "sha_mismatch": 0, "pending_stale": 0, "pending_fresh": 0, "quarantined": 0, "healed": 0}, "fixed": {"orphan_stale": 0, "missing": 0, "size_mismatch": 0, "sha_mismatch": 0, "pending_stale": 0, "healed": 0}, "errors": 0}
