== scenario 1: accept while worker stopped, resume -> ready == with worker stopped: status=queued (expected queued) API restarted; work still queued (durable) worker resumed: status=ready variants=['crop', 'optimized', 'thumbnail'] == scenario 2: COMMIT/publish gap (broker down), API restart, then broker == broker down: status=queued published_at='' (expected empty) API restarted with broker still down; intent preserved in PostgreSQL broker back: status=ready (outbox republished without new task) == scenario 3: transient failures -> failed(retry_exhausted) -> replay == injected: staging object points to a missing key (transient fetch failure) status=failed error_code=retry_exhausted (expected retry_exhausted) explicit replay after recovery: {"replayed": 1} after replay: status=ready variants=['crop', 'optimized', 'thumbnail'] == scenario 4: redelivery of a ready job is a no-op == re-queued the same job (duplicate delivery) status=ready variants=['crop', 'optimized', 'thumbnail'] (must be unchanged) == scenario 5: stuck processing -> lease recovery == marked attachment+job processing with an expired lease watchdog requeued and finished the job: status=ready PASS: lab5 grade-4 failure scenarios