Bring the Claude Code settings, the lint hook, the opsx commands and
skills, the architecture notes, the lab 1 to lab 4 specs and the
archived lab 1 to lab 4 changes into the lab 5 skeleton, so lab 5
continues the same spec history instead of starting from scratch. The
files come from the lab 4 solution commit d2744bc.
Rewrite AGENTS.md and the openspec context and rules for lab 5: upload
answers 202 queued after the original is in a private staging prefix
and the attachment, the job and the outbox row are committed in one
transaction, a separate relay publishes the outbox to RabbitMQ with
publisher confirms, a separate worker built from the same image
consumes the queue through FastStream with a manual ack after the
result commit, PostgreSQL stays the source of truth for job states,
Out of scope moves to labs 6-7, track 1 and broker HA, and the rules
add the failure windows between PostgreSQL and the broker, the effect
key and the lease to specs and designs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
22 lines
2.2 KiB
Markdown
22 lines
2.2 KiB
Markdown
## MODIFIED Requirements
|
||
|
||
### Requirement: Отказ PostgreSQL даёт ограниченную ошибку
|
||
|
||
При недоступном PostgreSQL защищённые endpoint и `/health/ready` каждой реплики SHALL отвечать `503` с кодом `unavailable` в общем формате ошибки быстрее 2 секунд. Проверка сессии, которая не смогла обратиться к БД, SHALL давать `503`, а не `401`, и SHALL NOT пропускать запрос. `/health/live` реплики SHALL отвечать `200`. Балансировщик SHALL исключить все реплики из ротации не позднее чем через 1,5 с после отказа и SHALL сам отвечать на любой запрос `503` в общем формате ошибки с `request_id`, равным `X-Request-Id`; после возвращения PostgreSQL реплики SHALL вернуться в ротацию без перезапуска.
|
||
|
||
#### Scenario: PostgreSQL остановлен
|
||
|
||
- **WHEN** сервис `postgres` остановлен
|
||
- **THEN** `GET /health/ready` и `GET /api/v1/users/me` через LB отвечают `503 unavailable` быстрее 2 с, `GET /health/live` внутри реплики — `200`, ни один ответ не `500`
|
||
|
||
#### Scenario: Неизвестный токен при остановленной БД
|
||
|
||
- **WHEN** PostgreSQL остановлен и приходит запрос с неизвестным токеном
|
||
- **THEN** ответ `503`, а не `200`
|
||
|
||
#### Scenario: Балансировщик исключает все реплики
|
||
|
||
- **WHEN** PostgreSQL остановлен дольше времени обнаружения
|
||
- **THEN** статистика LB показывает 0 готовых реплик, а запрос через LB, включая `GET /health/live`, получает `503 {"error":{"code":"unavailable",...}}` без `X-Instance-Id`
|
||
- **AND** после запуска PostgreSQL все реплики снова готовы в LB без перезапуска своих процессов
|