feat: add image attachments to messages
- upload, metadata and download endpoints for PNG/JPEG attachments:
limits before reading and decompression, type by content,
structural integrity check without decoding pixels, safe filename
- write order: pending row with object key -> PUT to S3 -> ready;
per-step DB sessions so no pool connection is held during transfers
- attachment_ids in messages (validation, idempotency hash, history);
whitespace-only text allowed with an attachment (teacher, 2026-10-20)
- migration: attachments and message_attachments tables, text length
CHECK relaxed with NOT VALID
- student tests, fault checks and driver commands for attachments;
rollout profile starts from e1161f7 and checks the commit first
- sync attachments deltas into main specs; rules, AGENTS.md, PLAN.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,11 +32,14 @@
|
||||
|
||||
### Requirement: Валидация текста
|
||||
|
||||
`text` SHALL содержать не больше 4000 Unicode code points. Пустая строка
|
||||
SHALL допускаться только вместе с хотя бы одним вложением. Текст из
|
||||
одних пробельных символов MUST NOT приниматься ни с вложениями, ни без
|
||||
них. Поле `sender_id` в теле MUST NOT приниматься. Нарушения SHALL
|
||||
давать 400 `invalid_request`.
|
||||
`text` SHALL содержать не больше 4000 Unicode code points. Пустой
|
||||
текст — пустая строка или строка из одних пробельных символов — SHALL
|
||||
допускаться только вместе с хотя бы одним вложением, без вложений он MUST
|
||||
NOT приниматься (согласовано с преподавателем 2026-10-20, AGENTS.md,
|
||||
«Согласования с преподавателем»). Текст SHALL сохраняться и
|
||||
возвращаться как прислан, без обрезки и нормализации. Поле `sender_id`
|
||||
в теле MUST NOT приниматься. Нарушения SHALL давать 400
|
||||
`invalid_request`.
|
||||
|
||||
#### Scenario: Пустой текст
|
||||
|
||||
@@ -62,7 +65,11 @@ SHALL допускаться только вместе с хотя бы одни
|
||||
#### Scenario: Пробелы с вложением
|
||||
|
||||
- **WHEN** участник отправляет `{"text": " ", "attachment_ids": [A]}`
|
||||
- **THEN** ответ 400 `invalid_request`, сообщение не создаётся
|
||||
с готовым вложением A своего чата, а затем `{"text": " "}` без
|
||||
вложений
|
||||
- **THEN** первый ответ 201, `text` — те же три пробела,
|
||||
`attachment_ids` — `[A]`; второй — 400 `invalid_request`, и это
|
||||
сообщение не создаётся
|
||||
|
||||
### Requirement: История чата
|
||||
|
||||
|
||||
Reference in New Issue
Block a user