forked from mtusi2026/mtusi2026lab4
Bring the Claude Code settings, the lint hook, the opsx commands and skills, the architecture notes, the lab 1 to lab 3 specs and the archived lab 1 to lab 3 changes into the lab 4 skeleton, so lab 4 continues the same spec history instead of starting from scratch. The files come from the lab 3 solution commit 61c0c28. Rewrite AGENTS.md and the openspec context and rules for lab 4: image attachments with metadata in PostgreSQL and bytes in a private RustFS bucket inside the stand, a third domain zone for attachments that asks the messaging zone about chat membership through a port wired in main.py, upload limits applied before unbounded reading or decoding, 201 only after both the object write and the commit, Out of scope moved to labs 5-7 plus presigned uploads, and rules on the write order between the two stores and on root S3 keys staying out of the API. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2.3 KiB
2.3 KiB
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"