Files
ArtyomandClaude Opus 5.5 a0d3947710 Carry over the agent context and openspec history from lab 5
Bring the Claude Code settings, the lint hook, the opsx commands and
skills, the architecture notes, the lab 1 to lab 5 specs and the
archived lab 1 to lab 5 changes into the lab 6 skeleton, so lab 6
continues the same spec history instead of starting from scratch. The
files come from the lab 5 solution commit 64d5c67.

Rewrite AGENTS.md and the openspec context and rules for lab 6: the
business API stays at contract 1.6.0, API, relay and worker start the
OpenTelemetry SDK in every process after fork and export OTLP over HTTP
to a separate Collector, Prometheus, Loki and Tempo store metrics, logs
and traces on volumes, Grafana only reads them through provisioning
kept in Git, telemetry never blocks a request and never feeds
/health/ready, metric labels stay low-cardinality and message bodies
and secrets never leave the process. Out of scope moves to lab 7,
track 2 and clustered telemetry backends.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-29 03:46:20 +03:00

2.8 KiB
Raw Blame History

MODIFIED Requirements

Requirement: Отправка сообщения

Сервис SHALL принимать POST /api/v1/chats/{chat_id}/messages от участника чата с телом {"text":...} и обязательным заголовком Idempotency-Key и возвращать 201 с объектом Message. Отправитель SHALL выводиться из предъявленной идентификации; поле sender_id в теле запроса SHALL NOT приниматься. text SHALL содержать от 1 до 4000 Unicode code points и SHALL NOT состоять только из пробельных символов. id и created_at SHALL назначаться сервером. Правила ключа описаны в lab3-idempotent-messages.

Scenario: Сообщение отправлено

  • WHEN участник отправляет {"text":"Привет, мир 👋"} в свой чат с новым Idempotency-Key
  • THEN ответ 201, тело соответствует схеме Message
  • AND sender_id равен идентификатору вызывающего, chat_id равен чату из пути, text побайтово совпадает с отправленным

Scenario: Ключ не передан

  • WHEN участник отправляет корректное тело без заголовка Idempotency-Key
  • THEN ответ 400 с кодом invalid_request

Scenario: Отправитель не берётся из тела запроса

  • WHEN тело запроса содержит поле sender_id
  • THEN ответ 400 с кодом invalid_request

Scenario: Пустой или пробельный текст

  • WHEN тело содержит {"text":""} или {"text":" "}
  • THEN ответ 400 с кодом invalid_request

Scenario: Текст длиннее предела

  • WHEN text содержит более 4000 Unicode code points
  • THEN ответ 400 с кодом invalid_request
  • AND длина считается в code points, а не в байтах UTF-8

Scenario: Посторонний пишет в чужой чат

  • WHEN пользователь, не входящий в состав чата, отправляет корректное сообщение с ключом
  • THEN ответ 404 с кодом not_found
  • AND сообщение не сохраняется

Scenario: Доступ проверяется раньше содержимого

  • WHEN посторонний отправляет в чужой чат с ключом тело с пустым text
  • THEN ответ 404, а не 400