fix: address async-attachments verify findings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 09:13:33 +03:00
co-authored by Claude Opus 5.5
parent acc6584dd3
commit 660466020c
14 changed files with 138 additions and 46 deletions
+8 -2
View File
@@ -726,16 +726,22 @@ def test_upload_with_object_storage_stopped(
chat: dict[str, Any],
) -> None:
data = images.sample_png()
# хотя бы одно готовое вложение: контроль ниже не пуст случайно
ready = api.upload_ready(alice, chat["id"], data)
before = attachment_rows(stand)
assert ready["id"] in ready_ids(before)
with outage(stand, "stop", "s3"):
resp, elapsed = timed(lambda: upload_raw(api, alice, chat, data))
assert_error(resp, 503)
assert elapsed < S3_TIMEOUT_S + SLACK_S, f"503 after {elapsed:.2f}s"
after = attachment_rows(stand)
# строка-намерение осталась, готовых не прибавилось; её уберёт
# уборщик (test_cleaner_survives_outages)
# строка-намерение осталась; её уберёт уборщик
# (test_cleaner_survives_outages)
(pending,) = new_ids(before, after)
assert after[pending] == "pending"
# ready не откатывается; число готовых может расти: worker
# параллельно доводит задания прежних тестов
assert ready_ids(before) <= ready_ids(after)
# заданий и принятых не прибавилось: новая строка одна и pending
assert job_row(stand, pending) is None
# замечание S6 verify attachments: id последней pending — от hook