End a failed reconciler pass with the dependency error

The merge loop runs inside the TaskGroup that holds the --deep checks,
so a listing or page failure in the middle of a pass left the group as
an ExceptionGroup. The entry point catches Unavailable only: the pass
still exited with code 1, but through an uncaught traceback instead of
the reconcile.failed record. The pass now unwraps the group and raises
the Unavailable with its original cause; the API test fails the listing
on the second page of a deep apply pass and expects Unavailable.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
This commit is contained in:
Artyom
2026-10-30 06:31:46 +03:00
co-authored by Claude Opus 5.5
parent 8cd30488d2
commit 3b3cb5bd7f
3 changed files with 32 additions and 10 deletions
+14
View File
@@ -22,6 +22,7 @@ from messenger.attachments.infrastructure.postgres import (
PostgresSingleRun,
)
from messenger.migrate import migrate
from messenger.shared.application.errors import Unavailable
from messenger.shared.infrastructure.clock import MonotonicUtcClock
from messenger.shared.infrastructure.postgres import Database
from pictures import SAMPLE
@@ -271,3 +272,16 @@ async def test_second_pass_is_skipped_while_one_runs(dsn: str) -> None:
assert not busy.found
assert not free.skipped
assert free.fixed["orphan_stale"] == 1
async def test_storage_failure_mid_pass_ends_it_as_unavailable(dsn: str) -> None:
async with stand(dsn) as s:
await damage(s)
async def broken() -> None:
raise Unavailable("S3 недоступно") from TimeoutError()
s.store.after_page = broken
with pytest.raises(Unavailable) as failed:
await s.run(apply=True, deep=True)
assert isinstance(failed.value.__cause__, TimeoutError)