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>
33 lines
2.3 KiB
Markdown
33 lines
2.3 KiB
Markdown
## MODIFIED Requirements
|
||
|
||
### Requirement: Создание чата
|
||
|
||
Сервис SHALL принимать `POST /api/v1/chats` от аутентифицированного пользователя с телом `{"title":..., "member_ids":[...]}` и возвращать `201` с объектом `Chat`. `title` SHALL содержать от 1 до 100 code points и не состоять только из пробельных символов. `member_ids` SHALL содержать от 1 до 100 уникальных идентификаторов существующих пользователей и SHALL включать вызывающего. Чат SHALL создаваться атомарно: при любой ошибке валидации он не создаётся вовсе.
|
||
|
||
#### Scenario: Чат создан
|
||
|
||
- **WHEN** участник отправляет `POST /api/v1/chats` с корректным `title` и списком из своего и чужого идентификаторов
|
||
- **THEN** ответ `201`, тело соответствует схеме `Chat`, `member_ids` совпадает с запрошенным составом
|
||
- **AND** `id` и `created_at` назначены сервером
|
||
|
||
#### Scenario: Вызывающий не входит в состав
|
||
|
||
- **WHEN** `member_ids` не содержит идентификатора вызывающего
|
||
- **THEN** ответ `400` с кодом `invalid_request`
|
||
|
||
#### Scenario: Состав содержит дубликаты
|
||
|
||
- **WHEN** `member_ids` содержит один и тот же идентификатор дважды
|
||
- **THEN** ответ `400` с кодом `invalid_request`
|
||
|
||
#### Scenario: Состав содержит неизвестного пользователя
|
||
|
||
- **WHEN** `member_ids` содержит идентификатор, которому не соответствует ни один пользователь
|
||
- **THEN** ответ `400` с кодом `invalid_request`
|
||
- **AND** чат не создаётся
|
||
|
||
#### Scenario: Запрос без идентификации
|
||
|
||
- **WHEN** `POST /api/v1/chats` приходит без `Authorization: Bearer` или с недействительным токеном
|
||
- **THEN** ответ `401` с кодом `unauthorized` и `WWW-Authenticate: Bearer realm="messenger"`
|