Grade 3 of lab 5 is closed. Upload answers 202 queued only after the original is staged in the private bucket and the attachment, its job and the outbox row are committed together; a separate relay publishes the outbox to a durable quorum queue with publisher confirms and returns expired leases; a separate FastStream worker claims a job under a lease, publishes the original and the 256 px JPEG thumbnail, commits fenced by the lease token and acks only after the commit. Transient errors retry up to JOB_MAX_ATTEMPTS and end in retry_exhausted, undecodable images fail at once with invalid_image, and a redelivered job changes nothing. The defence demonstration (worker down, upload, message, API, relay and broker restarts, worker up, ready) and the lab 4 minimum pass on a stand raised from empty volumes. The lab5-attachment-pipeline and lab5-job-delivery capabilities join the main specs, and the upload, content, message and restart requirements of lab 1, lab 3 and lab 4 are updated in place. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
16 lines
1.9 KiB
Markdown
16 lines
1.9 KiB
Markdown
## MODIFIED Requirements
|
||
|
||
### Requirement: Компенсация сбоя после записи объекта
|
||
|
||
Если объект записан в staging, а перевод вложения в `queued` вместе с заданием не зафиксирован, сервис SHALL ответить `503` с кодом `unavailable` и до ответа SHALL попытаться удалить объект и строку-намерение. Строку, которая к этому моменту уже поставлена в очередь, сервис SHALL NOT удалять вместе с её объектом. Если строку-намерение к моменту фиксации уже убрали, сервис SHALL ответить `503` и удалить записанный объект, а не возвращать `202`. Неудача компенсации SHALL оставлять строку-намерение для уборки по grace period.
|
||
|
||
#### Scenario: Отказ COMMIT после записи объекта
|
||
|
||
- **WHEN** запись объекта в staging прошла, а фиксация статуса `queued` и задания в PostgreSQL отклонена
|
||
- **THEN** ответ `503` с кодом `unavailable`, сразу после ответа нет ни строки вложения, ни задания, ни объекта с его ключом, в журнале есть событие удаления намерения с причиной `compensation`
|
||
|
||
#### Scenario: Намерение снято раньше, чем загрузка завершилась
|
||
|
||
- **WHEN** во время записи объекта строку-намерение удалили
|
||
- **THEN** ответ `503`, объект с ключом этой загрузки удалён, вложения в очереди не появилось
|