forked from mtusi2026/mtusi2026lab5
Add the failed registry, an explicit replay and failed staging retention
python -m messenger.admin is a new process assembly over the attachments zone with only a database: "failed" lists failed jobs (served by the new partial index jobs_failed_idx), "replay --attachment-id" moves a failed attachment back to queued with the same job_id, attempt 1 and a fresh outbox row, writing a replayed event with the operator. A ready, queued or processing attachment is a noop (replay_noop event), a failed one whose staging is already gone is expired. Every request is audited. The relay now also removes the staging object of a failed attachment once STAGING_RETENTION_SECONDS have passed since it failed; replay and the cleanup take the same row lock. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ecb4827e75
commit
b568fcf9c9
@@ -48,12 +48,15 @@ async def counts() -> list[int]:
|
||||
async def test_migrations_are_ordered_and_versioned() -> None:
|
||||
versions = [version for version, _ in migrations()]
|
||||
assert versions == sorted(versions)
|
||||
assert versions[:4] == [
|
||||
assert versions[:5] == [
|
||||
"0001_init",
|
||||
"0002_idempotency_keys",
|
||||
"0003_attachments",
|
||||
"0004_jobs",
|
||||
"0005_failed_registry",
|
||||
]
|
||||
plan = await scalar("SELECT indexdef FROM pg_indexes WHERE indexname = 'jobs_failed_idx'")
|
||||
assert "WHERE (status = 'failed'::text)" in plan
|
||||
applied = await scalar("SELECT array_agg(version ORDER BY version) FROM schema_migrations")
|
||||
assert applied == versions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user