diff --git a/.dockerignore b/.dockerignore
index bc16e556..e3e1b9a6 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -16,5 +16,8 @@ backups
.venv
__pycache__
node_modules
+**/node_modules
+frontend/dist
+frontend/.vite
evidence
.DS_Store
diff --git a/.env.example b/.env.example
index d32b9be0..677c7bb9 100644
--- a/.env.example
+++ b/.env.example
@@ -1,13 +1,52 @@
# Copy to .env for your LOCAL synthetic test environment; never commit .env.
-# These are logical interface suggestions; map actual framework names in REPORT.md.
+# Compose publishes only the load balancer; API replicas stay on its network.
+
APP_HOST=0.0.0.0
APP_PORT=8080
APP_ENV=lab
+# INSTANCE_ID is intentionally unset: each container uses its own hostname.
+# INSTANCE_ID=api-replica-01
+
+POSTGRES_USER=messenger
+POSTGRES_DB=messenger
+POSTGRES_CPU_LIMIT=1.00
+POSTGRES_MEMORY_LIMIT=512M
+
SESSION_TTL_SECONDS=3600
-# Choose credentials locally. File paths contain no secret values.
-DATABASE_URL_FILE=/run/secrets/database_url
-# Optional on 3, required use on 4 in lab2; Redis OR Valkey:
SESSION_STORE=postgres
-CACHE_URL_FILE=/run/secrets/cache_url
+# Keep false only for local HTTP. Set true when the public entrypoint uses HTTPS.
+SESSION_COOKIE_SECURE=false
+CURSOR_SIGNING_KEY_FILE=/run/secrets/cursor_signing_key
+
API_REPLICAS=2
+API_CPU_LIMIT=0.50
+API_MEMORY_LIMIT=256M
IDEMPOTENCY_TTL_SECONDS=86400
+
+# File paths contain no secret values. Create the referenced local secret files
+# according to REPORT.md; never commit their contents.
+DATABASE_URL_FILE=/run/secrets/database_url
+
+DB_MAX_CONNS=10
+DB_MIN_CONNS=2
+DB_MAX_CONN_LIFETIME=30m
+DB_MAX_CONN_IDLE_TIME=5m
+DB_HEALTH_CHECK_PERIOD=30s
+DB_CONNECT_TIMEOUT=5s
+DB_QUERY_TIMEOUT=3s
+
+READINESS_TIMEOUT=2s
+SHUTDOWN_DRAIN_DELAY=2s
+SHUTDOWN_TIMEOUT=10s
+
+# Redis stores a disposable shared chat cache; PostgreSQL remains authoritative.
+# The Go config accepts CACHE_URL or CACHE_URL_FILE, but never both. The
+# transferred Compose baseline currently passes CACHE_URL directly.
+CACHE_URL=redis://redis:6379/0
+# CACHE_URL_FILE=/run/secrets/cache_url
+CACHE_TTL=5m
+CACHE_OPERATION_TIMEOUT=250ms
+CACHE_POOL_SIZE=10
+
+# Optional Redis Insight profile from the transferred baseline.
+REDIS_INSIGHT_PORT=5540
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..a62b7bca
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,33 @@
+FROM golang:1.27.1-alpine@sha256:8a5910f31396cd4d89662f56c68b3ae31d374308270a1c3bd96672ee5ed43414 AS builder
+
+WORKDIR /build
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY cmd/ ./cmd/
+COPY internal/ ./internal/
+
+
+RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-w -s" -o /build/server ./cmd/server/main.go
+
+FROM alpine:3.24@sha256:294b683cb724975bec92580e1e685676bd4b50bda910ddb8c51d4cabeaec77e6
+
+RUN addgroup -g 1000 appgroup && \
+ adduser -u 1000 -G appgroup -s /bin/sh -D appuser
+
+WORKDIR /app
+
+COPY --from=builder /build/server /app/server
+
+RUN chown -R appuser:appgroup /app
+
+USER appuser:appgroup
+
+EXPOSE 8080
+
+HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=10 \
+ CMD wget -qO- http://127.0.0.1:8080/health/ready || exit 1
+
+
+ENTRYPOINT ["/app/server"]
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 5d86d171..1dd07d60 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,104 @@
+GO ?= go
PYTHON ?= python3
+COMPOSE ?= docker compose
+
+ENV_FILE ?= .env
BASE_URL ?= http://localhost:8080
CA_FILE ?=
ACTION_SCRIPT ?=
-TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
+GRADE4_OUTPUT ?= evidence/grade4/results.json
+GRADE5_OUTPUT ?= evidence/grade5/results.json
+READINESS_OUTPUT ?= evidence/readiness-routing.json
-.PHONY: help check validate test load test-persistence test-failover
+TLS_ARGS = $(if $(CA_FILE),--ca-file "$(CA_FILE)",)
+COMPOSE_CMD = $(COMPOSE) --env-file "$(ENV_FILE)"
+
+.PHONY: \
+ help \
+ init-env \
+ fmt \
+ fmt-check \
+ build \
+ go-test \
+ go-race \
+ go-vet \
+ go-check \
+ check \
+ validate \
+ test \
+ load \
+ test-persistence \
+ test-failover \
+ test-readiness-routing \
+ rolling-update \
+ grade4-experiment \
+ grade5-experiment \
+ compose-config \
+ compose-build \
+ compose-up \
+ compose-down \
+ compose-ps \
+ compose-logs
help:
- @echo "check: offline structure; validate: full OpenAPI (requirements-dev.txt); test: running API; load: synthetic writes"
+ @echo "init-env: create local .env from .env.example if missing"
+ @echo "fmt: format Go source files"
+ @echo "fmt-check: report unformatted Go source files"
+ @echo "build: compile the API"
+ @echo "go-test: run Go tests"
+ @echo "go-race: run Go tests with race detector"
+ @echo "go-vet: run static Go analysis"
+ @echo "go-check: run formatting, tests, race detector and vet"
+ @echo "check: run offline skeleton checks"
+ @echo "validate: validate the OpenAPI contract"
+ @echo "test: run public smoke test against the LB entrypoint"
+ @echo "load: run synthetic writes against the LB entrypoint"
+ @echo "test-persistence: run persistence test with ACTION_SCRIPT"
+ @echo "test-failover: run replica failover test with ACTION_SCRIPT"
+ @echo "test-readiness-routing: isolate PostgreSQL from one API and verify active LB health checks"
+ @echo "rolling-update: replace API replicas one by one with surge capacity"
+ @echo "grade4-experiment: run failovers, idempotency and rolling update with evidence"
+ @echo "grade5-experiment: measure fixed-budget scaling, saturation and one improvement"
+ @echo "compose-config: validate resolved Compose configuration"
+ @echo "compose-build: build application images"
+ @echo "compose-up: start the stack"
+ @echo "compose-down: stop the stack without deleting volumes"
+ @echo "compose-ps: show stack containers"
+ @echo "compose-logs: follow stack logs"
+
+init-env:
+ @if [ -f "$(ENV_FILE)" ]; then \
+ echo "$(ENV_FILE) already exists; leaving it unchanged"; \
+ else \
+ cp .env.example "$(ENV_FILE)"; \
+ echo "Created $(ENV_FILE) from .env.example"; \
+ fi
+
+fmt:
+ $(GO) fmt ./...
+
+fmt-check:
+ @files="$$(find cmd internal student_tests -type f -name '*.go' -print)"; \
+ unformatted="$$(gofmt -l $$files)"; \
+ if [ -n "$$unformatted" ]; then \
+ echo "Unformatted Go files:"; \
+ echo "$$unformatted"; \
+ exit 1; \
+ fi
+
+build:
+ $(GO) build ./cmd/server
+
+go-test:
+ $(GO) test ./...
+
+go-race:
+ $(GO) test -race ./...
+
+go-vet:
+ $(GO) vet ./...
+
+go-check: fmt-check go-test go-race go-vet
check:
$(PYTHON) scripts/check_contract.py
@@ -28,3 +119,37 @@ test-persistence:
test-failover:
@test -n "$(ACTION_SCRIPT)" || (echo "Set ACTION_SCRIPT to your implemented executable stop-one hook"; exit 2)
$(PYTHON) tests/resilience.py --mode failover --action-script "$(ACTION_SCRIPT)" --base-url "$(BASE_URL)" $(TLS_ARGS)
+
+test-readiness-routing:
+ $(PYTHON) scripts/test_readiness_routing.py --env-file "$(ENV_FILE)" --output "$(READINESS_OUTPUT)"
+
+rolling-update:
+ ENV_FILE="$(ENV_FILE)" ./scripts/rolling-update.sh
+
+grade4-experiment:
+ $(PYTHON) scripts/grade4_experiment.py --base-url "$(BASE_URL)" --env-file "$(ENV_FILE)" --output "$(GRADE4_OUTPUT)"
+ $(PYTHON) scripts/render_grade4.py "$(GRADE4_OUTPUT)"
+
+grade5-experiment:
+ $(PYTHON) scripts/grade5_experiment.py --base-url "$(BASE_URL)" --env-file "$(ENV_FILE)" --output "$(GRADE5_OUTPUT)"
+ $(PYTHON) scripts/render_grade5.py "$(GRADE5_OUTPUT)"
+
+compose-config:
+ @test -f "$(ENV_FILE)" || \
+ (echo "$(ENV_FILE) is missing; run: make init-env"; exit 2)
+ $(COMPOSE_CMD) config --quiet
+
+compose-build:
+ $(COMPOSE_CMD) build
+
+compose-up:
+ $(COMPOSE_CMD) up -d --build
+
+compose-down:
+ $(COMPOSE_CMD) down
+
+compose-ps:
+ $(COMPOSE_CMD) ps
+
+compose-logs:
+ $(COMPOSE_CMD) logs --follow
diff --git a/REPORT.md b/REPORT.md
index c2679005..7ca111bd 100644
--- a/REPORT.md
+++ b/REPORT.md
@@ -1,37 +1,366 @@
# Отчёт — лабораторная 3
-- Автор, группа: TODO
-- Целевая оценка; выбранный трек 5, если нужен: TODO
-- Commit/PR: TODO после публикации
-- Использованные источники, библиотеки и помощь ИИ: TODO
+- Автор, группа: Чурилин, БВТ2301
+- Текущий завершённый уровень: оценка «5», трек 1 «Цена масштабирования»
+- Итоговая цель: выполнена; уровень «4» и законченный исследовательский трек
+- Commit/PR: заполняется автором после локального коммита и публикации
+- Использованные источники и библиотеки: преподавательские README/OpenAPI/tests,
+ документация Go, pgx, PostgreSQL, Docker Compose, HAProxy, Nginx, React, TypeScript,
+ Vite, TanStack Query, React Router, Lucide и Vitest. Для разбора архитектуры,
+ рефакторинга, реализации и проверок использовался OpenAI Codex; решения
+ проверены тестами и описанными ниже воспроизводимыми сценариями.
## Запуск из чистого clone
-TODO: версии runtime/образов, prerequisites, команды создания локальных secrets/.env, build, миграций, запуска, ожидания готовности, тестов и остановки. Указать необходимые действия оператора. Не вставлять секреты. Отдельно указать безопасную остановку и команду намеренного удаления учебных данных.
+Локальные секреты не входят в Git. Перед первым запуском оператор создаёт каталог
+`secrets/`, генерирует пароль PostgreSQL и общий для всех API-реплик ключ подписи
+курсоров длиной не менее 32 байт. Значение `database_url` должно использовать имя
+Compose-сервиса `postgres`, а не `localhost`. Пример генерации синтетических
+локальных значений без их вывода в терминал:
+
+```bash
+mkdir -p secrets
+openssl rand -hex 32 > secrets/postgres_password.txt
+openssl rand -base64 48 > secrets/cursor_signing_key.txt
+printf 'postgres://messenger:%s@postgres:5432/messenger?sslmode=disable' \
+ "$(cat secrets/postgres_password.txt)" > secrets/database_url.txt
+chmod 600 secrets/*.txt
+cp .env.example .env
+```
+
+Единственная публичная точка входа — `http://localhost:8080`; контейнеры API не
+публикуют порты на host. Последовательность запуска и проверки:
+
+```bash
+docker compose --env-file .env config --quiet
+docker compose --env-file .env up -d --build --wait
+make test
+make test-readiness-routing
+make test-failover ACTION_SCRIPT=./scripts/stop-one.sh
+docker compose --env-file .env up -d --wait api
+make test-persistence ACTION_SCRIPT=./scripts/restart.sh
+make grade4-experiment
+make grade5-experiment
+```
+
+По этому же адресу HAProxy направляет обычные browser-запросы во внутренний
+Nginx, который отдаёт production-сборку React. Переход на
+`http://localhost:8080` открывает Messenger, а `/api/v1/*` и health endpoints
+остаются доступны автоматическим проверкам. Отдельный Node.js на машине для
+обычного запуска не нужен: multi-stage image сам выполняет `npm ci`, Vitest,
+TypeScript build и копирует статические файлы в Nginx. Для production с HTTPS
+нужно установить `SESSION_COOKIE_SECURE=true`; локально по HTTP значение остаётся
+`false`.
+
+`stop-one.sh` оставляет выбранную тестом реплику остановленной. Команда `up` в
+примере явно возвращает желаемые две реплики перед следующей проверкой.
+Обычная остановка не удаляет named volumes:
+
+```bash
+docker compose --env-file .env down
+```
+
+Для демонстрации балансировки одним и тем же клиентом можно многократно вызвать
+любой API endpoint через `localhost:8080` и сравнить `X-Instance-Id`. В проверке
+20 последовательных health-запросов наблюдались оба процесса: 10 ответов от
+одной реплики и 10 от другой. Запрос `/health/ready` непосредственно из Windows
+PowerShell вернул HTTP 200 и `X-Instance-Id`, поэтому браузер Windows и будущий
+frontend смогут использовать тот же `http://localhost:8080`.
## Архитектура и решения
-TODO: схема процессов/хранилищ, источник истины, транзакционные границы, ограничения. Что перенесено из lab2, что изменено в этой работе. Соответствие переменных из .env.example реальной конфигурации.
+Перенесённая основа lab2 разделена на явные слои:
+
+- `internal/domain` — сущности и бизнес-инварианты без HTTP/JSON-зависимостей;
+- `internal/application` — сценарии, команды и узкие порты репозиториев;
+- `internal/adapter/postgres`, `memory`, `redis`, `cache` — реализации внешних
+ зависимостей и кэширующий декоратор;
+- `internal/transport/http/dto` — wire-модели HTTP-контракта и преобразование
+ domain → response DTO;
+- `internal/transport/http/handlers` — тонкие обработчики, по одному
+ нетривиальному endpoint на файл;
+- `cmd/server` — composition root, единственное место сборки зависимостей.
+
+PostgreSQL остаётся источником истины для пользователей, сессий, чатов и
+сообщений. Redis содержит только удаляемую производную копию неизменяемых данных
+чата; его отказ не делает API неготовым и не отменяет подтверждённую запись в
+PostgreSQL.
+
+Compose запускает один сервис `api` с `API_REPLICAS=2`. Реплики не имеют host
+ports и разделяют PostgreSQL, включая таблицу сессий. HAProxy — единственная
+публичная точка входа; он использует `leastconn`, Docker DNS resolver и активные
+HTTP-проверки `/health/ready` раз в секунду. Реплика исключается после двух
+неуспешных readiness-проверок и возвращается после двух успешных. Поэтому живой,
+но потерявший PostgreSQL и ставший неготовым процесс перестаёт получать трафик;
+Docker healthcheck не является единственным механизмом обнаружения. Sticky
+sessions не применяются. Nginx остаётся отдельным внутренним контейнером и
+обслуживает только статические файлы React.
+
+Произвольные POST балансировщик автоматически не повторяет. Исключение сделано
+только для маршрута отправки сообщения: обязательный `Idempotency-Key` позволяет
+HAProxy безопасно повторить запрос на другой реплике при connection failure,
+empty response, timeout или 502/503/504 во время обнаружения отказа и drain.
+Для этого маршрута тело запроса буферизуется отдельным backend; регистрации
+пользователя и создание чата контрактом не идемпотентны, поэтому retry для них
+запрещён. Клиент также сохраняет ключ для повтора после неопределённого результата.
+
+Миграции вынесены в одноразовый сервис `migrate`, завершение которого является
+предусловием запуска API. Поэтому две реплики не конкурируют за изменение схемы.
+
+Пагинационный курсор теперь формируется в application-слое из канонических
+полей границы `(created_at, id, scope_id)` и подписывается HMAC-SHA-256. Подпись
+не скрывает payload, но обнаруживает подмену. В scope входит пользователь для
+списка чатов и чат для истории сообщений. Все реплики обязаны использовать один
+`CURSOR_SIGNING_KEY` или `CURSOR_SIGNING_KEY_FILE`; в Compose используется Docker
+secret `cursor_signing_key`. Репозитории получают только уже проверенную
+типизированную границу и ничего не знают о формате HTTP-курсора.
+
+`.env.example` перечисляет реально читаемые приложением параметры PostgreSQL,
+пула, readiness/shutdown, Redis-кэша, числа реплик, TTL идемпотентности и ключа
+курсора. Там же задаются CPU/RAM API и задержка drain перед shutdown.
+`API_REPLICAS` используется Compose, а `IDEMPOTENCY_TTL_SECONDS` читает
+Go-приложение и не допускает значение меньше 86400 секунд. Секретных значений в
+шаблоне нет: там указаны только пути внутри контейнера.
+
+Каждый процесс определяет стабильный `instance_id` один раз при загрузке
+конфигурации. По умолчанию используется hostname контейнера; это одновременно
+даёт уникальность между Compose-репликами и позволяет инфраструктурному hook
+сопоставить `X-Instance-Id` с конкретным контейнером. Опциональный `INSTANCE_ID`
+проверяется по безопасному для HTTP-заголовка шаблону. Сам middleware является
+внешним относительно router/recovery, поэтому заголовок присутствует также на
+health, 404/405 и восстановленных 500-ответах.
+
+POST сообщения принимает только ASCII-ключ по шаблону
+`[A-Za-z0-9._:-]{1,128}`. HTTP-слой нормализует UUID чата и формирует канонический
+path, application-слой хэширует SHA-256 не исходные bytes JSON, а типизированное
+семантическое представление запроса. Поэтому форматирование и порядок JSON-полей
+не влияют на повтор; задел под `attachment_ids` уже канонизирует отсутствующий
+список как пустой.
+
+Область уникальности в `message_idempotency` состоит из пользователя, метода,
+канонического пути и ключа. В одной PostgreSQL-транзакции сначала захватывается
+эта область через primary key, затем создаётся Message. Отложенный foreign key
+позволяет заранее записать будущий `message_id`, но проверяется при commit. При
+гонке вторая реплика ждёт разрешения уникального конфликта и затем либо возвращает
+то же сообщение, либо отвечает 409 при другом request hash. Любая ошибка до
+commit откатывает и бизнес-эффект, и запись ключа, поэтому transient 5xx не
+фиксируется как успешный результат. Перед replay снова выполняются обычная
+проверка bearer-сессии и проверка членства в чате.
+
+### Frontend и браузерная сессия
+
+Клиент находится в `frontend/` и собран на React + TypeScript + Vite. TanStack
+Query отвечает за серверное состояние и периодическое обновление списков,
+React Router — за маршруты login/register, выбранного чата и профиля. UI сделан
+адаптивным: на широком экране одновременно видны навигация, список и разговор,
+а на узком список и чат переключаются как отдельные мобильные экраны. Фон чата
+добавлен из предоставленного изображения; нейтральная графитово-белая палитра,
+мягкая системная типографика и скруглённая геометрия компонентов подобраны
+самостоятельно, без копирования Telegram.
+
+Токен не хранится в `localStorage` и недоступен JavaScript. Успешный login
+по-прежнему возвращает преподавательский JSON с bearer token, но дополнительно
+ставит host-only cookie `mtusi_session` с `Path=/`, `HttpOnly` и
+`SameSite=Strict`. Флаг `Secure` управляется `SESSION_COOKIE_SECURE`: `false`
+нужен только локальному HTTP, на HTTPS должен быть `true`.
+
+Контрактные `/api/v1/*` сознательно остались Bearer-only. HAProxy предоставляет
+отдельный браузерный адаптер `/web-api/v1/*`: берёт token из HttpOnly-cookie,
+формирует `Authorization: Bearer ...`, удаляет исходный `Cookie` и проксирует на
+обычный `/api/v1/*`. Поэтому преподавательские тесты и внешние API-клиенты не
+получили скрытый альтернативный способ авторизации. Same-origin deployment,
+`SameSite=Strict`, JSON-only изменяющие запросы и отсутствие CORS для сторонних
+origin уменьшают CSRF-поверхность. Logout удаляет серверную сессию и истекает
+cookie.
+
+Список чатов показывает только данные, реально существующие в контракте: title
+и число участников. Превью последнего сообщения и unread counter не имитируются,
+поскольку backend их пока не отдаёт. При неопределённой ошибке отправки клиент
+сохраняет текст вместе с `Idempotency-Key`; повтор использует тот же ключ.
## Доказательства критериев
| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства |
| --- | --- | --- | --- |
-| Публичный smoke | make test | TODO | TODO |
-| Остальные пункты уровня 3 | TODO | TODO | TODO |
-| Все пункты уровня 4, если заявлен | TODO | TODO | TODO |
-| Выбранный трек 5, если заявлен | TODO | TODO | TODO |
-
-TODO: добавить отдельную строку для каждого заявленного критерия. PASS без команды и наблюдения не является доказательством. Проверка инфраструктурного hook требует подтверждения, какие реальные процессы/хранилища перезапущены.
+| Воспроизводимая конфигурация и качество Go | `make check && make go-check && make validate PYTHON=../mtusi2026lab2/.venv/bin/python` | форматирование, tests, race detector, vet, Compose config и OpenAPI validation завершились без ошибок | `evidence/lab3-summary.md` |
+| Две API-реплики за одним LB | `docker compose --env-file .env up -d --build --wait`; 20 health-запросов через `:8080` | наружу опубликован только HAProxy; два разных `X-Instance-Id`, по 10 ответов от каждого | `compose.yaml`, `infrastructure/haproxy/haproxy.cfg`, `evidence/lab3-summary.md` |
+| Публичный smoke lab3 | `make test` | `tests/smoke.py` завершился `PASS: lab3 public API scenario` | `evidence/lab3-summary.md` |
+| Общая сессия без sticky routing | smoke, затем failover и persistence через тот же bearer token | обе реплики обслуживали запросы; сессия работает после остановки API и рестартов | `evidence/lab3-summary.md` |
+| Идемпотентность сообщения | `go test ./student_tests -run Idempotency`; 32 конкурентных POST с одним ключом через LB | один Message и ровно одна строка в PostgreSQL; другой payload даёт 409 | `student_tests/idempotency_test.go`, `evidence/lab3-summary.md` |
+| Failover каждой API-реплики | два последовательных запуска `make test-failover ACTION_SCRIPT=./scripts/stop-one.sh` с восстановлением между ними | реально остановлены `api-2`, затем `api-1`; получено 142/143 успешных записи, 0 ошибок, восстановление 0.963/0.750 с | `scripts/stop-one.sh`, `evidence/lab3-summary.md` |
+| Persistence после рестартов | `make test-persistence ACTION_SCRIPT=./scripts/restart.sh` | PASS; прежняя сессия и данные доступны после рестарта PostgreSQL, Redis, API и LB | `scripts/restart.sh`, `evidence/lab3-summary.md` |
+| Миграции перед API | `docker compose --env-file .env ps -a` и логи `migrate` | миграции 1 и 2 применены; one-shot контейнер завершился с кодом 0; API healthy | `migrations/000002_message_idempotency.up.sql`, `evidence/lab3-summary.md` |
+| React frontend и HttpOnly BFF | `docker compose build frontend load-balancer`; browser QA; cookie-only curl-сценарий | Vitest/TypeScript/Vite build PASS; register/login 201; прямой `/api` 401; `/web-api` 200; logout 204, после logout 401; browser console без warning/error | `frontend/`, `infrastructure/nginx/`, `infrastructure/haproxy/` |
+| Согласованные health и shutdown | SIGTERM каждой реплики под нагрузкой | API сразу закрывает availability gate, 2 с дренирует запросы и укладывается в 10 с shutdown; `/health/live` остаётся доступен | `internal/transport/http/middleware/availability.go`, `evidence/grade4/` |
+| CPU/RAM и изоляция портов | `docker inspect`; `docker compose ps` | API: 0,5 CPU/256 MiB на реплику; наружу опубликован только HAProxy `127.0.0.1:8080`; `container_name` отсутствует | `compose.yaml`, `evidence/grade4/results.json` |
+| Readiness-aware routing | `make test-readiness-routing` | одной API-реплике заблокирован PostgreSQL: HAProxy исключил её за 2,861 с; 40 health-запросов получили 200, 20 регистраций — 201; после снятия fault реплика вернулась | `scripts/test_readiness_routing.py`, `evidence/readiness-routing.json` |
+| Последовательный failover уровня 4 | `make grade4-experiment` | обе исходные реплики остановлены по очереди и восстановлены; recovery 2,893/2,938 с; во всех фазах 0 ошибочных запросов | `evidence/grade4/README.md`, `throughput-errors.svg`, `timeline.svg` |
+| Rolling update под нагрузкой | surge до 3 реплик, замена двух старых по одной, возврат к 2 | 22 212 успешных запросов, 0 ошибок; все новые реплики проходят healthcheck и DNS-settle | `scripts/rolling-update.sh`, `evidence/grade4/` |
+| Фиксированный бюджет 1/2/4 API | `make grade5-experiment`; 32 closed-loop клиента | при суммарных 1 CPU, 512 MiB и 16 соединениях получено 578,242 / 529,499 / 353,955 RPS; четыре процесса при том же бюджете дали на 38,79% меньше одной реплики | `evidence/grade5/02-fixed-total.svg`, `measurements.csv` |
+| Рост ресурсов 1/2/4 API | тот же workload; по 0,5 CPU, 256 MiB и 8 соединений на реплику | 533,656 / 563,460 / 438,868 RPS; нелинейная серия показывает отсутствие пропорционального выигрыша при общей БД в 1 CPU | `evidence/grade5/03-resource-growth.svg`, `results.json` |
+| Saturation point и bottleneck | concurrency 1/2/4/8/16/32, по 10 с после warm-up | первый сигнал насыщения — 8: относительно 4 клиентов RPS вырос только на 8,03%, p95 — в 1,92 раза; PostgreSQL в профиле четырёх реплик достиг 101,91% одного CPU | `evidence/grade5/01-saturation.svg`, `04-bottleneck.svg` |
+| Подтверждённое улучшение | четыре API без изменений; PostgreSQL 1 → 2 CPU | RPS 438,868 → 587,574 (+33,88%), ошибок 0, p95 снизился на 14,12%; следующим ограничением стал HAProxy с лимитом 0,25 CPU | `evidence/grade5/05-improvement.svg`, `resources.csv` |
## Эксперименты и отказы
-TODO: гипотеза, hardware/лимиты, версии, объём данных, профиль нагрузки, concurrency/arrival rate, длительность/прогрев, повторы, успешные RPS, ошибки, p50/p95/p99, CPU/RAM. Сохранить raw summary без tokens и объяснить ограничения измерения.
+Итоговый эксперимент уровня 4 выполнен 23.10.2026 на Windows + WSL2:
+Docker Engine 29.7.2, Compose 5.5.0, 8 логических CPU и 3813,6 MiB RAM,
+commit-base `34618bd4237bbb8bf6a3a303056fc95d799577f9` с незакоммиченными
+изменениями текущего уровня. В Compose каждой API-реплике выделено 0,5 CPU и
+256 MiB; HAProxy — 0,25 CPU/128 MiB; frontend Nginx — 0,10 CPU/64 MiB;
+PostgreSQL — 1 CPU/512 MiB; Redis — 0,25 CPU/128 MiB.
-| Воздействие | Что ожидаем | Что наблюдали | Время восстановления / потеря данных |
-| --- | --- | --- | --- |
-| TODO | TODO | TODO | TODO |
+Команда `make grade4-experiment` создаёт синтетических пользователей и чат,
+делает 12 warm-up записей, затем запускает 8 closed-loop клиентов без повторов
+на стороне клиента. Baseline длится 12 с. В каждом failover воздействие
+начинается через 3 с, предыдущая реплика восстанавливается перед остановкой
+следующей, после действия нагрузка продолжается ещё 8 с. Rolling update
+временно увеличивает сервис до трёх реплик, ждёт healthcheck и два периода
+Docker DNS, заменяет старые контейнеры по одному и возвращает масштаб к двум.
+Минимальный подтверждённый размер набора после прогона — 43 810 сообщений.
+
+| Фаза | Успешно / ошибок | RPS | Доля ошибок | p50 / p95 / p99, мс | Восстановление |
+| --- | ---: | ---: | ---: | ---: | ---: |
+| baseline | 5762 / 0 | 479,581 | 0% | 9,178 / 56,402 / 79,978 | — |
+| остановка реплики 1 | 7853 / 0 | 537,548 | 0% | 8,812 / 50,050 / 66,373 | 2,893 с |
+| остановка реплики 2 | 7970 / 0 | 533,154 | 0% | 8,726 / 48,789 / 64,333 | 2,938 с |
+| rolling update | 22 212 / 0 | 428,860 | 0% | 10,560 / 58,713 / 83,982 | непрерывная нагрузка |
+
+На baseline средняя выборка одного API-контейнера составила 27,144% CPU и
+31,008 MiB RAM, максимум — 30,93% и 66,17 MiB. PostgreSQL оказался самым
+нагруженным компонентом: среднее 89,392% CPU при лимите одного ядра, максимум
+110,59%; HAProxy использовал в среднем 26,262% CPU. Это не capacity-тест и не доказательство
+saturation point, но важный ориентир для исследования уровня 5.
+
+HAProxy обновляет Docker DNS раз в 1 с и исключает peer после двух неуспешных
+активных `/health/ready`-проверок. Измеренные 2,893 и 2,938 с укладываются в
+требование 10 с. Отдельный тест потери доступа одной реплики к PostgreSQL
+подтвердил исключение неготового backend за 2,861 с без 5xx: 40 health-запросов
+получили 200, а 20 регистраций — 201. Во всех четырёх фазах grade-4 эксперимента
+ошибок нет. Параллельные 32 POST с одним ключом прошли через обе реплики и
+вернули один Message ID.
+
+Исходные агрегаты, environment/limits, посекундные таблицы и четыре SVG-графика
+лежат в `evidence/grade4/`. Percentile рассчитаны только по успешным ответам;
+профиль closed-loop имеет coordinated omission. CPU для API агрегируется как
+средняя/максимальная выборка отдельного контейнера, а не сумма двух реплик.
+
+## Исследование уровня 5: цена масштабирования
+
+Трек 1 выполнен командой `make grade5-experiment` 23.10.2026 на том же
+однохостовом стенде Windows + WSL2: Docker Engine 29.7.2, Compose 5.5.0,
+8 логических CPU и 3813,6 MiB RAM. Базовым commit до изменений уровня 5 был
+`5300a1a`; измерения ожидаемо зафиксировали dirty working tree, поскольку сам
+скрипт и параметризация лимитов ещё не были закоммичены. Все запросы проходили
+через единственную публичную точку HAProxy, создавали сообщения с уникальными
+`Idempotency-Key` и не повторялись нагрузочным клиентом автоматически.
+
+### Методика и воспроизводимость
+
+Каждая измеряемая фаза длилась 10 секунд. После каждой смены профиля выполнялся
+двухсекундный warm-up, затем контейнеры и реально применённые `NanoCpus`, RAM и
+`DB_MAX_CONNS` проверялись через `docker inspect`. Скрипт сохраняет посекундные
+request buckets и каждую выборку `docker stats`; CPU/RAM API сначала суммируются
+по всем репликам в одной временной точке и только затем усредняются. Это устраняет
+ошибку, при которой средняя загрузка одного из четырёх контейнеров выдавалась бы
+за стоимость всего API-сервиса.
+
+В серии с фиксированным бюджетом сохранялись суммарные 1 CPU, 512 MiB RAM и
+16 соединений пула API:
+
+| Реплики | CPU на реплику | RAM на реплику | `DB_MAX_CONNS` на реплику | Суммарный пул |
+| ---: | ---: | ---: | ---: | ---: |
+| 1 | 1,00 | 512 MiB | 16 | 16 |
+| 2 | 0,50 | 256 MiB | 8 | 16 |
+| 4 | 0,25 | 128 MiB | 4 | 16 |
+
+В серии роста каждая реплика получала 0,5 CPU, 256 MiB и 8 соединений, поэтому
+суммарный API-бюджет менялся от 0,5 CPU/256 MiB/8 соединений до
+2 CPU/1024 MiB/32 соединений. Во всех основных профилях PostgreSQL оставался на
+1 CPU/512 MiB, HAProxy — 0,25 CPU/128 MiB, frontend Nginx — 0,10 CPU/64 MiB,
+Redis — 0,25 CPU/128 MiB. Сравнение
+1/2/4 выполнялось при одинаковом concurrency 32. До и после эксперимента
+зафиксированы размер набора и базы: 225 626 → 299 524 сообщений и
+175 406 103 → 228 793 367 байт. После любого исхода `finally` возвращает стенд к
+двум API по 0,5 CPU/256 MiB, пулу 10 на реплику и PostgreSQL с 1 CPU; успешное
+восстановление также записано в `results.json`.
+
+### Насыщение и цена реплик
+
+Для поиска saturation point две API-реплики с суммарным 1 CPU и пулом 16
+нагружались последовательностью concurrency 1/2/4/8/16/32:
+
+| Concurrency | RPS | p95, мс | PostgreSQL CPU avg/max | Ошибки |
+| ---: | ---: | ---: | ---: | ---: |
+| 1 | 230,369 | 5,065 | 23,900% / 29,41% | 0 |
+| 2 | 320,190 | 7,196 | 54,987% / 62,60% | 0 |
+| 4 | 435,822 | 29,304 | 63,093% / 81,80% | 0 |
+| 8 | 470,828 | 56,230 | 65,945% / 92,98% | 0 |
+| 16 | 472,892 | 73,628 | 65,080% / 88,93% | 0 |
+| 32 | 564,012 | 94,785 | 83,825% / 107,62% | 0 |
+
+Заранее зафиксированное правило считает первым saturation signal шаг, где прирост
+RPS меньше 10%, а p95 одновременно вырастает не менее чем в 1,5 раза. Это
+произошло при переходе 4 → 8: throughput вырос только на 8,03%, а p95 — в
+1,92 раза. При 16 клиентах прирост относительно 8 почти отсутствует (+0,44%),
+а p95 продолжает расти; при 32 клиентах RPS увеличивается ценой ещё большей
+очереди. Поэтому concurrency 8 — первый воспроизводимый saturation signal по
+заранее заданному правилу, а не утверждение об абсолютном максимуме системы.
+
+При фиксированном суммарном бюджете 1/2/4 реплики дали соответственно
+578,242 / 529,499 / 353,955 RPS. Четыре процесса при том же общем бюджете дали
+на 38,79% меньше одной реплики: дробление ресурсов добавило scheduling и pool
+overhead, но не увеличило общую ёмкость. В серии роста ресурсов получены
+533,656 / 563,460 / 438,868 RPS. Разброс и нестрогая монотонность честно
+сохранены: это один прогон на одном Docker-host, где контейнеры конкурируют за
+общий scheduler и одну БД. Главный результат здесь не выбор «лучшего» количества
+реплик, а отсутствие пропорционального роста: четырёхкратный API-бюджет дал на
+17,76% меньше throughput одной реплики в этом конкретном прогоне.
+
+Доминирующее ограничение локализовано в PostgreSQL. В базовом профиле четырёх
+реплик API суммарно использовал в среднем 35,690% CPU из доступных 200%, HAProxy —
+15,595% из 25%, тогда как PostgreSQL использовал 84,847% в среднем и достигал
+101,91% лимита одного ядра. Само по себе это корреляция, поэтому выполнено
+контрольное изменение только одного параметра.
+
+### Подтверждённое улучшение
+
+Для тех же четырёх API по 0,5 CPU/256 MiB, того же пула и concurrency 32 лимит
+PostgreSQL увеличен с 1 до 2 CPU. RPS вырос с 438,868 до 587,574 — на 33,88%;
+ошибок в обеих фазах не было, p95 снизился с 109,446 до 93,991 мс (-14,12%).
+Таким образом, снятие именно ограничения CPU БД существенно увеличило throughput
+и улучшило tail latency, что подтверждает исходную гипотезу.
+
+После улучшения PostgreSQL использовал в среднем 95,573% из доступных 200%, а
+HAProxy — 22,350% при лимите 0,25 CPU и достигал 26,73%. То есть следующее
+ограничение ожидаемо сместилось к публичному
+балансировщику. Увеличивать API дальше без пересмотра лимита или топологии LB уже
+нерационально — это и есть практическая «цена масштабирования».
+
+Полный JSON с окружением, профилями, фактически применёнными лимитами и сырыми
+выборками находится в `evidence/grade5/results.json`; агрегаты — в
+`measurements.csv`, посекундные запросы — в `timeseries.csv`, ресурсы — в
+`resources.csv`. Пять SVG показывают saturation curve, обе серии 1/2/4,
+локализацию bottleneck и контрольное улучшение.
## Ограничения и следующие шаги
-TODO: какие отказы выдерживаются и какие нет; что не реализовано; где учебное упрощение; какое улучшение подтверждено, а какое пока гипотеза.
+- Топология однохостовая: HAProxy и PostgreSQL остаются single points of failure.
+ Репликация БД и несколько балансировщиков в требования уровня «4» не входят.
+- Redis содержит только кэш, поэтому его потеря допустима. Отдельная
+ персистентность Redis для корректности API не требуется.
+- Истёкшие записи идемпотентности удаляются лениво при повторном обращении к той
+ же области ключа. Индекс по `expires_at` оставлен для будущей периодической
+ очистки без изменения схемы.
+- Исследование уровня «5» выполняет по одному измеряемому прогону на профиль.
+ Для production capacity planning нужны несколько повторов, доверительные
+ интервалы и отдельный генератор нагрузки вне измеряемого Docker-host.
+- Rolling-сценарий заменяет бинарник без изменения схемы. Миграции выполняются
+ однократно до API; для будущей несовместимой схемы потребуется expand/contract,
+ поэтому одновременная работа разных schema-version сейчас не заявляется.
+- Текущий API не содержит endpoint поиска пользователей, аватаров, изменения
+ имени/пароля и агрегатов last message/unread. Поэтому UI принимает UUID
+ участников при создании чата, а профиль честно показывает только доступные
+ поля. Эти функции требуют сначала расширить и зафиксировать API-контракт.
+- Однохостовая среда WSL2 не доказывает устойчивость к потере Docker-host;
+ измерен только отказ и замена процесса API.
diff --git a/cmd/server/main.go b/cmd/server/main.go
new file mode 100644
index 00000000..53d6ab3e
--- /dev/null
+++ b/cmd/server/main.go
@@ -0,0 +1,224 @@
+package main
+
+import (
+ "context"
+ "errors"
+ "log"
+ "net/http"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+
+ cacheadapter "mtusi2026lab3/internal/adapter/cache"
+ "mtusi2026lab3/internal/adapter/postgres"
+ redisadapter "mtusi2026lab3/internal/adapter/redis"
+ "mtusi2026lab3/internal/application"
+ "mtusi2026lab3/internal/config"
+ "mtusi2026lab3/internal/database"
+ "mtusi2026lab3/internal/transport/http/handlers"
+ "mtusi2026lab3/internal/transport/http/middleware"
+)
+
+func main() {
+ cfg, err := config.Load()
+ if err != nil {
+ log.Fatalf("[FATAL] Invalid configuration: %v", err)
+ }
+
+ startupContext, startupCancel := context.WithTimeout(
+ context.Background(),
+ cfg.DatabaseConnectTimeout,
+ )
+
+ databasePool, err := database.Open(startupContext, cfg)
+ startupCancel()
+
+ if err != nil {
+ log.Fatalf("[FATAL] PostgreSQL initialization failed: %v", err)
+ }
+ defer databasePool.Close()
+
+ postgresStore := postgres.NewPostgreSQLStore(
+ databasePool,
+ cfg.DatabaseQueryTimeout,
+ )
+
+ var applicationStore application.Repository = postgresStore
+
+ if cfg.RedisURL != "" {
+ redisChatCache, cacheError := redisadapter.NewRedisChatCache(
+ cfg.RedisURL,
+ cfg.RedisCacheTTL,
+ cfg.RedisOperationTimeout,
+ cfg.RedisPoolSize,
+ )
+ if cacheError != nil {
+ log.Fatalf("[FATAL] Invalid Redis configuration: %v", cacheError)
+ }
+ defer func() {
+ if closeError := redisChatCache.Close(); closeError != nil {
+ log.Printf("[WARN] Redis client close failed: %v", closeError)
+ }
+ }()
+
+ cacheContext, cacheCancel := context.WithTimeout(
+ context.Background(),
+ cfg.RedisOperationTimeout,
+ )
+ if cacheError = redisChatCache.Ping(cacheContext); cacheError != nil {
+ log.Printf("[WARN] Redis unavailable at startup; PostgreSQL fallback is active: %v", cacheError)
+ } else {
+ log.Println("[INFO] Redis chat cache is available")
+ }
+ cacheCancel()
+
+ applicationStore = cacheadapter.NewCachedRepository(
+ postgresStore,
+ redisChatCache,
+ log.Default(),
+ )
+ }
+
+ cursorCodec, err := application.NewCursorCodec(cfg.CursorSigningKey)
+ if err != nil {
+ log.Fatalf("[FATAL] Invalid cursor configuration: %v", err)
+ }
+
+ service, err := application.NewService(
+ applicationStore,
+ cursorCodec,
+ cfg.SessionTTL,
+ application.WithIdempotencyTTL(cfg.IdempotencyTTL),
+ )
+ if err != nil {
+ log.Fatalf("[FATAL] Application initialization failed: %v", err)
+ }
+
+ handler := handlers.NewHandler(
+ service,
+ handlers.WithReadiness(
+ databasePool,
+ cfg.ReadinessTimeout,
+ ),
+ handlers.WithSessionCookieSecure(cfg.SessionCookieSecure),
+ )
+
+ mux := http.NewServeMux()
+
+ mux.HandleFunc("GET /health/live", handler.HealthLive)
+ mux.HandleFunc("GET /health/ready", handler.HealthReady)
+
+ mux.HandleFunc(
+ "POST /api/v1/auth/sessions",
+ handler.CreateSession,
+ )
+
+ mux.HandleFunc("POST /api/v1/users", handler.CreateUser)
+
+ requireAuth := func(next http.HandlerFunc) http.HandlerFunc {
+ return middleware.RequireAuth(service, next)
+ }
+
+ mux.HandleFunc(
+ "GET /api/v1/users/me",
+ requireAuth(handler.GetMe),
+ )
+
+ mux.HandleFunc(
+ "DELETE /api/v1/auth/sessions/current",
+ requireAuth(handler.DeleteCurrentSession),
+ )
+
+ mux.HandleFunc(
+ "POST /api/v1/chats",
+ requireAuth(handler.CreateChat),
+ )
+ mux.HandleFunc(
+ "GET /api/v1/chats",
+ requireAuth(handler.ListChats),
+ )
+ mux.HandleFunc(
+ "GET /api/v1/chats/{chat_id}",
+ requireAuth(handler.GetChat),
+ )
+ mux.HandleFunc(
+ "POST /api/v1/chats/{chat_id}/messages",
+ requireAuth(handler.CreateMessage),
+ )
+ mux.HandleFunc(
+ "GET /api/v1/chats/{chat_id}/messages",
+ requireAuth(handler.GetMessages),
+ )
+
+ var rootHandler http.Handler = mux
+ rootHandler = middleware.Recovery(rootHandler)
+ rootHandler = middleware.Logger(rootHandler)
+ availabilityGate := middleware.NewAvailabilityGate()
+ rootHandler = availabilityGate.Middleware(rootHandler)
+ rootHandler = middleware.RequestID(rootHandler)
+ rootHandler = middleware.InstanceID(cfg.InstanceID, rootHandler)
+
+ server := &http.Server{
+ Addr: cfg.HTTPAddress(),
+ Handler: rootHandler,
+ ReadTimeout: 15 * time.Second,
+ WriteTimeout: 15 * time.Second,
+ IdleTimeout: 60 * time.Second,
+ }
+
+ serverErrors := make(chan error, 1)
+
+ go func() {
+ log.Printf(
+ "[INFO] Server instance %s starting on %s",
+ cfg.InstanceID,
+ server.Addr,
+ )
+ serverErrors <- server.ListenAndServe()
+ }()
+
+ shutdownSignals := make(chan os.Signal, 1)
+ signal.Notify(
+ shutdownSignals,
+ os.Interrupt,
+ syscall.SIGTERM,
+ )
+ defer signal.Stop(shutdownSignals)
+
+ select {
+ case serverError := <-serverErrors:
+ if !errors.Is(serverError, http.ErrServerClosed) {
+ log.Fatalf("[FATAL] Server crashed: %v", serverError)
+ }
+
+ case signalValue := <-shutdownSignals:
+ log.Printf(
+ "[INFO] Signal %v received. Starting graceful shutdown...",
+ signalValue,
+ )
+
+ availabilityGate.BeginDrain()
+ log.Printf(
+ "[INFO] Readiness disabled; draining new traffic for %s",
+ cfg.ShutdownDrainDelay,
+ )
+ time.Sleep(cfg.ShutdownDrainDelay)
+
+ shutdownContext, shutdownCancel := context.WithTimeout(
+ context.Background(),
+ cfg.ShutdownTimeout,
+ )
+ defer shutdownCancel()
+
+ if err := server.Shutdown(shutdownContext); err != nil {
+ log.Printf(
+ "[WARN] Graceful shutdown failed: %v. Forcing close.",
+ err,
+ )
+ _ = server.Close()
+ }
+
+ log.Println("[INFO] Server stopped gracefully.")
+ }
+}
diff --git a/compose.yaml b/compose.yaml
new file mode 100644
index 00000000..2e49ddda
--- /dev/null
+++ b/compose.yaml
@@ -0,0 +1,251 @@
+services:
+ load-balancer:
+ build:
+ context: .
+ dockerfile: infrastructure/haproxy/Dockerfile
+ image: mtusi2026lab3-load-balancer
+ ports:
+ - "127.0.0.1:${APP_PORT:-8080}:8080"
+ depends_on:
+ api:
+ condition: service_healthy
+ frontend:
+ condition: service_healthy
+ healthcheck:
+ test:
+ [
+ "CMD-SHELL",
+ "wget -qO- http://127.0.0.1:8080/health/ready || exit 1",
+ ]
+ interval: 5s
+ timeout: 3s
+ retries: 10
+ start_period: 3s
+ stop_grace_period: 10s
+ restart: unless-stopped
+ deploy:
+ resources:
+ limits:
+ cpus: "0.25"
+ memory: 128M
+
+ frontend:
+ build:
+ context: .
+ dockerfile: infrastructure/nginx/Dockerfile
+ image: mtusi2026lab3-web
+ expose:
+ - "8080"
+ healthcheck:
+ test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/ >/dev/null || exit 1"]
+ interval: 5s
+ timeout: 3s
+ retries: 10
+ start_period: 3s
+ stop_grace_period: 10s
+ restart: unless-stopped
+ deploy:
+ resources:
+ limits:
+ cpus: "0.10"
+ memory: 64M
+
+ postgres:
+ image: postgres:16.15-alpine3.24@sha256:721873c34ceb9f8d8fc265984940dc982404c105f19ad51be9fdc5970a6080ea
+ environment:
+ POSTGRES_USER: ${POSTGRES_USER:-messenger}
+ POSTGRES_DB: ${POSTGRES_DB:-messenger}
+ POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
+ secrets:
+ - postgres_password
+ volumes:
+ - postgres_data:/var/lib/postgresql/data
+ healthcheck:
+ test:
+ [
+ "CMD-SHELL",
+ "pg_isready -U ${POSTGRES_USER:-messenger} -d ${POSTGRES_DB:-messenger}",
+ ]
+ interval: 5s
+ timeout: 3s
+ retries: 10
+ start_period: 5s
+ restart: unless-stopped
+ deploy:
+ resources:
+ limits:
+ cpus: "${POSTGRES_CPU_LIMIT:-1.00}"
+ memory: ${POSTGRES_MEMORY_LIMIT:-512M}
+
+ redis:
+ image: redis:8.10.2-alpine3.23@sha256:3811787313eba226a2ef38658c6ccb91cd5e110edc89c37767de373120a0e5a0
+ command:
+ [
+ "redis-server",
+ "--save",
+ "",
+ "--appendonly",
+ "no",
+ "--maxmemory",
+ "64mb",
+ "--maxmemory-policy",
+ "allkeys-lru",
+ ]
+ healthcheck:
+ test: ["CMD", "redis-cli", "ping"]
+ interval: 5s
+ timeout: 3s
+ retries: 10
+ start_period: 3s
+ stop_grace_period: 10s
+ restart: unless-stopped
+ deploy:
+ resources:
+ limits:
+ cpus: "0.25"
+ memory: 128M
+
+ migrate:
+ image: migrate/migrate:v4.20.1@sha256:76cc2074cb6642631f34a898ced71e6aeaa6b1a4d78c4daa743275a22e0c5be7
+ entrypoint: ["/bin/sh", "-ec"]
+ command:
+ - >
+ exec migrate
+ -path=/migrations
+ -database="$$(cat /run/secrets/database_url)"
+ up
+ secrets:
+ - database_url
+ volumes:
+ - ./migrations:/migrations:ro
+ depends_on:
+ postgres:
+ condition: service_healthy
+ restart: "no"
+ deploy:
+ resources:
+ limits:
+ cpus: "0.25"
+ memory: 64M
+
+ api:
+ build:
+ context: .
+ dockerfile: Dockerfile
+ environment:
+ APP_HOST: ${APP_HOST:-0.0.0.0}
+ APP_PORT: ${APP_PORT:-8080}
+ APP_ENV: ${APP_ENV:-lab}
+
+ SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
+ IDEMPOTENCY_TTL_SECONDS: ${IDEMPOTENCY_TTL_SECONDS:-86400}
+ SESSION_STORE: ${SESSION_STORE:-postgres}
+ SESSION_COOKIE_SECURE: ${SESSION_COOKIE_SECURE:-false}
+ CURSOR_SIGNING_KEY_FILE: ${CURSOR_SIGNING_KEY_FILE:-/run/secrets/cursor_signing_key}
+
+ CACHE_URL: ${CACHE_URL:-redis://redis:6379/0}
+ CACHE_TTL: ${CACHE_TTL:-5m}
+ CACHE_OPERATION_TIMEOUT: ${CACHE_OPERATION_TIMEOUT:-250ms}
+ CACHE_POOL_SIZE: ${CACHE_POOL_SIZE:-10}
+
+ DATABASE_URL_FILE: ${DATABASE_URL_FILE:-/run/secrets/database_url}
+
+ DB_MAX_CONNS: ${DB_MAX_CONNS:-10}
+ DB_MIN_CONNS: ${DB_MIN_CONNS:-2}
+ DB_MAX_CONN_LIFETIME: ${DB_MAX_CONN_LIFETIME:-30m}
+ DB_MAX_CONN_IDLE_TIME: ${DB_MAX_CONN_IDLE_TIME:-5m}
+ DB_HEALTH_CHECK_PERIOD: ${DB_HEALTH_CHECK_PERIOD:-30s}
+ DB_CONNECT_TIMEOUT: ${DB_CONNECT_TIMEOUT:-5s}
+ DB_QUERY_TIMEOUT: ${DB_QUERY_TIMEOUT:-3s}
+
+ READINESS_TIMEOUT: ${READINESS_TIMEOUT:-2s}
+ SHUTDOWN_DRAIN_DELAY: ${SHUTDOWN_DRAIN_DELAY:-2s}
+ SHUTDOWN_TIMEOUT: ${SHUTDOWN_TIMEOUT:-10s}
+ secrets:
+ - database_url
+ - cursor_signing_key
+ expose:
+ - "8080"
+ depends_on:
+ postgres:
+ condition: service_healthy
+ redis:
+ condition: service_healthy
+ migrate:
+ condition: service_completed_successfully
+ deploy:
+ replicas: ${API_REPLICAS:-2}
+ resources:
+ limits:
+ cpus: "${API_CPU_LIMIT:-0.50}"
+ memory: ${API_MEMORY_LIMIT:-256M}
+ healthcheck:
+ test:
+ [
+ "CMD-SHELL",
+ "wget -qO- http://127.0.0.1:$${APP_PORT:-8080}/health/ready || exit 1",
+ ]
+ interval: 5s
+ timeout: 3s
+ retries: 10
+ start_period: 5s
+ stop_grace_period: 15s
+ restart: unless-stopped
+
+ redis-insight:
+ image: redis/redisinsight:3.8.0@sha256:b5e19ee240abef6edb435871b90ff8a210995422e8e018ab61c0339d318a1f84
+ profiles: ["tools"]
+ ports:
+ - "127.0.0.1:${REDIS_INSIGHT_PORT:-5540}:5540"
+ volumes:
+ - redis_insight_data:/data
+ depends_on:
+ redis:
+ condition: service_healthy
+ restart: unless-stopped
+ deploy:
+ resources:
+ limits:
+ cpus: "0.50"
+ memory: 256M
+
+ postgres-restore:
+ image: postgres:16.15-alpine3.24@sha256:721873c34ceb9f8d8fc265984940dc982404c105f19ad51be9fdc5970a6080ea
+ profiles: ["recovery"]
+ environment:
+ POSTGRES_USER: ${POSTGRES_USER:-messenger}
+ POSTGRES_DB: ${POSTGRES_RESTORE_DB:-messenger_restore_admin}
+ POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
+ secrets:
+ - postgres_password
+ volumes:
+ - postgres_restore_data:/var/lib/postgresql/data
+ healthcheck:
+ test:
+ [
+ "CMD-SHELL",
+ "pg_isready -U ${POSTGRES_USER:-messenger} -d ${POSTGRES_RESTORE_DB:-messenger_restore_admin}",
+ ]
+ interval: 5s
+ timeout: 3s
+ retries: 10
+ start_period: 5s
+ restart: "no"
+ deploy:
+ resources:
+ limits:
+ cpus: "1.00"
+ memory: 512M
+
+volumes:
+ postgres_data:
+ redis_insight_data:
+ postgres_restore_data:
+
+secrets:
+ postgres_password:
+ file: ./secrets/postgres_password.txt
+ database_url:
+ file: ./secrets/database_url.txt
+ cursor_signing_key:
+ file: ./secrets/cursor_signing_key.txt
diff --git a/evidence/README.md b/evidence/README.md
index 8df70015..a03474bc 100644
--- a/evidence/README.md
+++ b/evidence/README.md
@@ -3,3 +3,12 @@
Храните небольшие обезличенные результаты: команды и stdout проверок, JSON/CSV агрегатов нагрузки, EXPLAIN, dashboard JSON, текст разбора отказа. Укажите дату, commit, аппаратные лимиты и профиль нагрузки.
Не добавляйте .env, session tokens, cookies, приватные ключи, credentials, реальные сообщения, raw dumps и signed URLs. Для скриншотов скрывайте секреты. Большие логи/бинарные traces сохраняйте отдельно по правилам преподавателя; одного скриншота без методики недостаточно.
+
+## Сохранённые эксперименты
+
+- `grade4/` — failover обеих API-реплик и rolling update под нагрузкой;
+- `grade5/` — трек «Цена масштабирования»: saturation sweep, сравнение 1/2/4
+ реплик с фиксированным и растущим бюджетом, сырые JSON/CSV, пять SVG-графиков
+ и подтверждённое улучшение PostgreSQL CPU;
+- `readiness-routing.json` — результат изоляции PostgreSQL от одной живой
+ API-реплики: время исключения backend, статусы запросов и восстановление.
diff --git a/evidence/grade4/README.md b/evidence/grade4/README.md
new file mode 100644
index 00000000..e42cd53b
--- /dev/null
+++ b/evidence/grade4/README.md
@@ -0,0 +1,39 @@
+# Lab 3 grade-4 experiment
+
+Generated: 2026-10-23T15:23:05.031807+00:00.
+
+## Method
+
+- concurrency: 8;
+- baseline duration: 12 s;
+- load: closed-loop POST messages through the public HAProxy gateway;
+- failover: both original API containers stopped and restored in turn;
+- rolling update: one surge replica, old replicas replaced one by one;
+- percentiles cover successful responses; failures are separate.
+
+## Results
+
+| Phase | RPS | Errors | p50 ms | p95 ms | p99 ms | Recovery s |
+| --- | ---: | ---: | ---: | ---: | ---: | ---: |
+| baseline | 479.581 | 0 (0.000%) | 9.178 | 56.402 | 79.978 | n/a |
+| failover-1 | 537.548 | 0 (0.000%) | 8.812 | 50.05 | 66.373 | 2.893 |
+| failover-2 | 533.154 | 0 (0.000%) | 8.726 | 48.789 | 64.333 | 2.938 |
+| rolling-update | 428.86 | 0 (0.000%) | 10.56 | 58.713 | 83.982 | n/a |
+
+## Parallel idempotency
+
+32 requests produced 1 unique message ID across 2 API instances.
+
+## Graphs
+
+
+
+
+
+
+
+
+
+## Scope
+
+Single-host process failure and rolling replacement only. PostgreSQL and HAProxy remain single points of failure.
diff --git a/evidence/grade4/latency.svg b/evidence/grade4/latency.svg
new file mode 100644
index 00000000..4120856b
--- /dev/null
+++ b/evidence/grade4/latency.svg
@@ -0,0 +1,69 @@
+
diff --git a/evidence/grade4/resources.svg b/evidence/grade4/resources.svg
new file mode 100644
index 00000000..f5bd373d
--- /dev/null
+++ b/evidence/grade4/resources.svg
@@ -0,0 +1,48 @@
+
diff --git a/evidence/grade4/results.json b/evidence/grade4/results.json
new file mode 100644
index 00000000..5cd27d9d
--- /dev/null
+++ b/evidence/grade4/results.json
@@ -0,0 +1,680 @@
+{
+ "schema_version": 1,
+ "environment": {
+ "utc_started_at": "2026-10-23T15:23:05.031807+00:00",
+ "git_commit": "5300a1a1e0e5497f2d30097bb1542b2743a8aad5",
+ "working_tree_dirty": true,
+ "logical_cpu_count": 8,
+ "host_memory_mib": 3813.6,
+ "docker_engine": "29.7.2",
+ "docker_compose": "5.5.0",
+ "container_limits": [
+ {
+ "service": "api",
+ "nano_cpus": 500000000,
+ "memory_limit_bytes": 268435456
+ },
+ {
+ "service": "api",
+ "nano_cpus": 500000000,
+ "memory_limit_bytes": 268435456
+ },
+ {
+ "service": "frontend",
+ "nano_cpus": 100000000,
+ "memory_limit_bytes": 67108864
+ },
+ {
+ "service": "load-balancer",
+ "nano_cpus": 250000000,
+ "memory_limit_bytes": 134217728
+ },
+ {
+ "service": "postgres",
+ "nano_cpus": 1000000000,
+ "memory_limit_bytes": 536870912
+ },
+ {
+ "service": "redis",
+ "nano_cpus": 250000000,
+ "memory_limit_bytes": 134217728
+ }
+ ]
+ },
+ "methodology": {
+ "base_url": "http://localhost:8080",
+ "concurrency": 8,
+ "baseline_seconds": 12,
+ "action_after_seconds": 3,
+ "post_action_seconds": 8,
+ "warmup_requests": 12,
+ "workload": "closed-loop POST messages via the public HAProxy gateway; no automatic retries"
+ },
+ "phases": [
+ {
+ "name": "baseline",
+ "elapsed_seconds": 12.015,
+ "successful_requests": 5762,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 479.581,
+ "successful_latency_ms": {
+ "p50": 9.178,
+ "p95": 56.402,
+ "p99": 79.978
+ },
+ "instances": [
+ "a85567c48d67",
+ "df8a69558af0"
+ ],
+ "recovery_seconds": null,
+ "action": null,
+ "per_second": {
+ "0": {
+ "successful": 434,
+ "failed": 0
+ },
+ "1": {
+ "successful": 280,
+ "failed": 0
+ },
+ "2": {
+ "successful": 372,
+ "failed": 0
+ },
+ "3": {
+ "successful": 436,
+ "failed": 0
+ },
+ "4": {
+ "successful": 541,
+ "failed": 0
+ },
+ "5": {
+ "successful": 474,
+ "failed": 0
+ },
+ "6": {
+ "successful": 526,
+ "failed": 0
+ },
+ "7": {
+ "successful": 539,
+ "failed": 0
+ },
+ "8": {
+ "successful": 554,
+ "failed": 0
+ },
+ "9": {
+ "successful": 559,
+ "failed": 0
+ },
+ "10": {
+ "successful": 448,
+ "failed": 0
+ },
+ "11": {
+ "successful": 584,
+ "failed": 0
+ },
+ "12": {
+ "successful": 15,
+ "failed": 0
+ }
+ },
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 27.144,
+ "cpu_percent_max": 30.93,
+ "memory_mib_avg": 31.008,
+ "memory_mib_max": 66.17
+ },
+ "frontend": {
+ "cpu_percent_avg": 1.812,
+ "cpu_percent_max": 3.76,
+ "memory_mib_avg": 7.212,
+ "memory_mib_max": 10.15
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 26.262,
+ "cpu_percent_max": 27.37,
+ "memory_mib_avg": 15.645,
+ "memory_mib_max": 15.97
+ },
+ "postgres": {
+ "cpu_percent_avg": 89.392,
+ "cpu_percent_max": 110.59,
+ "memory_mib_avg": 130.125,
+ "memory_mib_max": 132.2
+ },
+ "redis": {
+ "cpu_percent_avg": 2.488,
+ "cpu_percent_max": 6.58,
+ "memory_mib_avg": 15.072,
+ "memory_mib_max": 15.25
+ }
+ }
+ },
+ {
+ "name": "failover-1",
+ "elapsed_seconds": 14.609,
+ "successful_requests": 7853,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 537.548,
+ "successful_latency_ms": {
+ "p50": 8.812,
+ "p95": 50.05,
+ "p99": 66.373
+ },
+ "instances": [
+ "a85567c48d67",
+ "df8a69558af0"
+ ],
+ "recovery_seconds": 2.893,
+ "action": {
+ "started_at": 3.003,
+ "ended_at": 5.888,
+ "duration_seconds": 2.885,
+ "exit_code": 0,
+ "summary": "stopped API instance df8a69558af0"
+ },
+ "per_second": {
+ "0": {
+ "successful": 551,
+ "failed": 0
+ },
+ "1": {
+ "successful": 605,
+ "failed": 0
+ },
+ "2": {
+ "successful": 558,
+ "failed": 0
+ },
+ "3": {
+ "successful": 443,
+ "failed": 0
+ },
+ "4": {
+ "successful": 575,
+ "failed": 0
+ },
+ "5": {
+ "successful": 538,
+ "failed": 0
+ },
+ "6": {
+ "successful": 593,
+ "failed": 0
+ },
+ "7": {
+ "successful": 623,
+ "failed": 0
+ },
+ "8": {
+ "successful": 507,
+ "failed": 0
+ },
+ "9": {
+ "successful": 626,
+ "failed": 0
+ },
+ "10": {
+ "successful": 608,
+ "failed": 0
+ },
+ "11": {
+ "successful": 601,
+ "failed": 0
+ },
+ "12": {
+ "successful": 556,
+ "failed": 0
+ },
+ "13": {
+ "successful": 469,
+ "failed": 0
+ }
+ },
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 35.916,
+ "cpu_percent_max": 49.48,
+ "memory_mib_avg": 11.892,
+ "memory_mib_max": 13.27
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.762,
+ "cpu_percent_max": 3.75,
+ "memory_mib_avg": 6.256,
+ "memory_mib_max": 6.434
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 22.21,
+ "cpu_percent_max": 26.89,
+ "memory_mib_avg": 16.312,
+ "memory_mib_max": 16.93
+ },
+ "postgres": {
+ "cpu_percent_avg": 73.128,
+ "cpu_percent_max": 89.46,
+ "memory_mib_avg": 135.64,
+ "memory_mib_max": 141.9
+ },
+ "redis": {
+ "cpu_percent_avg": 0.782,
+ "cpu_percent_max": 3.27,
+ "memory_mib_avg": 15.258,
+ "memory_mib_max": 15.73
+ }
+ }
+ },
+ {
+ "name": "failover-2",
+ "elapsed_seconds": 14.949,
+ "successful_requests": 7970,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 533.154,
+ "successful_latency_ms": {
+ "p50": 8.726,
+ "p95": 48.789,
+ "p99": 64.333
+ },
+ "instances": [
+ "a85567c48d67",
+ "df8a69558af0"
+ ],
+ "recovery_seconds": 2.938,
+ "action": {
+ "started_at": 3.006,
+ "ended_at": 5.933,
+ "duration_seconds": 2.927,
+ "exit_code": 0,
+ "summary": "stopped API instance a85567c48d67"
+ },
+ "per_second": {
+ "0": {
+ "successful": 584,
+ "failed": 0
+ },
+ "1": {
+ "successful": 613,
+ "failed": 0
+ },
+ "2": {
+ "successful": 570,
+ "failed": 0
+ },
+ "3": {
+ "successful": 465,
+ "failed": 0
+ },
+ "4": {
+ "successful": 564,
+ "failed": 0
+ },
+ "5": {
+ "successful": 605,
+ "failed": 0
+ },
+ "6": {
+ "successful": 610,
+ "failed": 0
+ },
+ "7": {
+ "successful": 579,
+ "failed": 0
+ },
+ "8": {
+ "successful": 497,
+ "failed": 0
+ },
+ "9": {
+ "successful": 575,
+ "failed": 0
+ },
+ "10": {
+ "successful": 569,
+ "failed": 0
+ },
+ "11": {
+ "successful": 600,
+ "failed": 0
+ },
+ "12": {
+ "successful": 586,
+ "failed": 0
+ },
+ "13": {
+ "successful": 553,
+ "failed": 0
+ }
+ },
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 28.073,
+ "cpu_percent_max": 48.59,
+ "memory_mib_avg": 10.391,
+ "memory_mib_max": 13.47
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.696,
+ "cpu_percent_max": 3.44,
+ "memory_mib_avg": 6.25,
+ "memory_mib_max": 6.398
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 25.966,
+ "cpu_percent_max": 26.65,
+ "memory_mib_avg": 16.918,
+ "memory_mib_max": 17.25
+ },
+ "postgres": {
+ "cpu_percent_avg": 72.558,
+ "cpu_percent_max": 93.6,
+ "memory_mib_avg": 146.22,
+ "memory_mib_max": 160.2
+ },
+ "redis": {
+ "cpu_percent_avg": 0.168,
+ "cpu_percent_max": 0.2,
+ "memory_mib_avg": 15.646,
+ "memory_mib_max": 16.64
+ }
+ }
+ },
+ {
+ "name": "rolling-update",
+ "elapsed_seconds": 51.793,
+ "successful_requests": 22212,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 428.86,
+ "successful_latency_ms": {
+ "p50": 10.56,
+ "p95": 58.713,
+ "p99": 83.982
+ },
+ "instances": [
+ "872dbac02cd3",
+ "a85567c48d67",
+ "dac03e904506",
+ "df00f21e6f41",
+ "df8a69558af0"
+ ],
+ "recovery_seconds": null,
+ "action": {
+ "started_at": 3.005,
+ "ended_at": 42.955,
+ "duration_seconds": 39.95,
+ "exit_code": 0,
+ "summary": "rolling update completed with 2 healthy API replicas"
+ },
+ "per_second": {
+ "0": {
+ "successful": 509,
+ "failed": 0
+ },
+ "1": {
+ "successful": 577,
+ "failed": 0
+ },
+ "2": {
+ "successful": 660,
+ "failed": 0
+ },
+ "3": {
+ "successful": 438,
+ "failed": 0
+ },
+ "4": {
+ "successful": 577,
+ "failed": 0
+ },
+ "5": {
+ "successful": 392,
+ "failed": 0
+ },
+ "6": {
+ "successful": 326,
+ "failed": 0
+ },
+ "7": {
+ "successful": 232,
+ "failed": 0
+ },
+ "8": {
+ "successful": 199,
+ "failed": 0
+ },
+ "9": {
+ "successful": 170,
+ "failed": 0
+ },
+ "10": {
+ "successful": 263,
+ "failed": 0
+ },
+ "11": {
+ "successful": 323,
+ "failed": 0
+ },
+ "12": {
+ "successful": 308,
+ "failed": 0
+ },
+ "13": {
+ "successful": 362,
+ "failed": 0
+ },
+ "14": {
+ "successful": 443,
+ "failed": 0
+ },
+ "15": {
+ "successful": 495,
+ "failed": 0
+ },
+ "16": {
+ "successful": 429,
+ "failed": 0
+ },
+ "17": {
+ "successful": 370,
+ "failed": 0
+ },
+ "18": {
+ "successful": 451,
+ "failed": 0
+ },
+ "19": {
+ "successful": 377,
+ "failed": 0
+ },
+ "20": {
+ "successful": 422,
+ "failed": 0
+ },
+ "21": {
+ "successful": 485,
+ "failed": 0
+ },
+ "22": {
+ "successful": 473,
+ "failed": 0
+ },
+ "23": {
+ "successful": 441,
+ "failed": 0
+ },
+ "24": {
+ "successful": 470,
+ "failed": 0
+ },
+ "25": {
+ "successful": 487,
+ "failed": 0
+ },
+ "26": {
+ "successful": 504,
+ "failed": 0
+ },
+ "27": {
+ "successful": 516,
+ "failed": 0
+ },
+ "28": {
+ "successful": 441,
+ "failed": 0
+ },
+ "29": {
+ "successful": 390,
+ "failed": 0
+ },
+ "30": {
+ "successful": 502,
+ "failed": 0
+ },
+ "31": {
+ "successful": 450,
+ "failed": 0
+ },
+ "32": {
+ "successful": 500,
+ "failed": 0
+ },
+ "33": {
+ "successful": 363,
+ "failed": 0
+ },
+ "34": {
+ "successful": 470,
+ "failed": 0
+ },
+ "35": {
+ "successful": 434,
+ "failed": 0
+ },
+ "36": {
+ "successful": 424,
+ "failed": 0
+ },
+ "37": {
+ "successful": 373,
+ "failed": 0
+ },
+ "38": {
+ "successful": 460,
+ "failed": 0
+ },
+ "39": {
+ "successful": 516,
+ "failed": 0
+ },
+ "40": {
+ "successful": 375,
+ "failed": 0
+ },
+ "41": {
+ "successful": 492,
+ "failed": 0
+ },
+ "42": {
+ "successful": 477,
+ "failed": 0
+ },
+ "43": {
+ "successful": 503,
+ "failed": 0
+ },
+ "44": {
+ "successful": 506,
+ "failed": 0
+ },
+ "45": {
+ "successful": 465,
+ "failed": 0
+ },
+ "46": {
+ "successful": 501,
+ "failed": 0
+ },
+ "47": {
+ "successful": 502,
+ "failed": 0
+ },
+ "48": {
+ "successful": 446,
+ "failed": 0
+ },
+ "49": {
+ "successful": 446,
+ "failed": 0
+ },
+ "50": {
+ "successful": 477,
+ "failed": 0
+ }
+ },
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 20.954,
+ "cpu_percent_max": 31.69,
+ "memory_mib_avg": 8.855,
+ "memory_mib_max": 12.74
+ },
+ "frontend": {
+ "cpu_percent_avg": 1.326,
+ "cpu_percent_max": 8.06,
+ "memory_mib_avg": 7.43,
+ "memory_mib_max": 12.17
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 24.581,
+ "cpu_percent_max": 29.42,
+ "memory_mib_avg": 17.398,
+ "memory_mib_max": 19.6
+ },
+ "postgres": {
+ "cpu_percent_avg": 77.881,
+ "cpu_percent_max": 102.6,
+ "memory_mib_avg": 170.081,
+ "memory_mib_max": 185.9
+ },
+ "redis": {
+ "cpu_percent_avg": 0.63,
+ "cpu_percent_max": 3.84,
+ "memory_mib_avg": 15.178,
+ "memory_mib_max": 15.91
+ }
+ }
+ }
+ ],
+ "idempotency": {
+ "parallel_requests": 32,
+ "successful_responses": 32,
+ "failed_responses": 0,
+ "unique_message_ids": 1,
+ "observed_instances": [
+ "a85567c48d67",
+ "df8a69558af0"
+ ]
+ },
+ "dataset": {
+ "warmup_requests": 12,
+ "minimum_confirmed_messages": 43810
+ },
+ "limitations": [
+ "single Docker host",
+ "closed-loop coordinated omission",
+ "successful-response latency percentiles only",
+ "PostgreSQL and HAProxy remain single points of failure"
+ ]
+}
diff --git a/evidence/grade4/throughput-errors.svg b/evidence/grade4/throughput-errors.svg
new file mode 100644
index 00000000..b228e322
--- /dev/null
+++ b/evidence/grade4/throughput-errors.svg
@@ -0,0 +1,45 @@
+
diff --git a/evidence/grade4/timeline.svg b/evidence/grade4/timeline.svg
new file mode 100644
index 00000000..884b13f2
--- /dev/null
+++ b/evidence/grade4/timeline.svg
@@ -0,0 +1,36 @@
+
diff --git a/evidence/grade5/01-saturation.svg b/evidence/grade5/01-saturation.svg
new file mode 100644
index 00000000..7a3ee57a
--- /dev/null
+++ b/evidence/grade5/01-saturation.svg
@@ -0,0 +1,63 @@
+
diff --git a/evidence/grade5/02-fixed-total.svg b/evidence/grade5/02-fixed-total.svg
new file mode 100644
index 00000000..ae3e0f00
--- /dev/null
+++ b/evidence/grade5/02-fixed-total.svg
@@ -0,0 +1,49 @@
+
diff --git a/evidence/grade5/03-resource-growth.svg b/evidence/grade5/03-resource-growth.svg
new file mode 100644
index 00000000..0744eef9
--- /dev/null
+++ b/evidence/grade5/03-resource-growth.svg
@@ -0,0 +1,49 @@
+
diff --git a/evidence/grade5/04-bottleneck.svg b/evidence/grade5/04-bottleneck.svg
new file mode 100644
index 00000000..fa13b0c1
--- /dev/null
+++ b/evidence/grade5/04-bottleneck.svg
@@ -0,0 +1,83 @@
+
diff --git a/evidence/grade5/05-improvement.svg b/evidence/grade5/05-improvement.svg
new file mode 100644
index 00000000..2662e79b
--- /dev/null
+++ b/evidence/grade5/05-improvement.svg
@@ -0,0 +1,37 @@
+
diff --git a/evidence/grade5/README.md b/evidence/grade5/README.md
new file mode 100644
index 00000000..e0532524
--- /dev/null
+++ b/evidence/grade5/README.md
@@ -0,0 +1,69 @@
+# Lab 3 grade-5 scaling experiment
+
+Generated: 2026-10-23T15:23:12.734339+00:00.
+
+## Hypothesis
+
+API replicas stop improving throughput when shared PostgreSQL CPU saturates; adding PostgreSQL CPU should improve the unchanged four-replica profile.
+
+## Reproduction
+
+- workload: closed-loop POST messages through the public HAProxy gateway; unique idempotency keys; no client retries;
+- phase duration: 10 s;
+- comparison concurrency: 32;
+- saturation sweep: [1, 2, 4, 8, 16, 32];
+- fixed budget: 1.00 API CPU, 512 MiB API RAM, 16 total DB pool connections;
+- growth series: 0.50 API CPU, 256 MiB RAM and 8 DB pool connections per replica;
+- saturation rule: RPS gain below 10% and p95 growth at least 1.5x versus the previous step;
+- host: 8 logical CPU, 3813.6 MiB RAM;
+- Docker 29.7.2, Compose 5.5.0;
+- command: `make grade5-experiment`; warmup runs before every changed profile.
+
+## Measurements
+
+| Phase | Replicas | Concurrency | RPS | Errors | p50 ms | p95 ms | p99 ms | PG CPU avg | API CPU avg |
+| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
+| saturation-c1 | 2 | 1 | 230.369 | 0 (0.000%) | 3.839 | 5.065 | 6.282 | 23.9 | 26.85 |
+| saturation-c2 | 2 | 2 | 320.19 | 0 (0.000%) | 5.192 | 7.196 | 15.11 | 54.987 | 48.3 |
+| saturation-c4 | 2 | 4 | 435.822 | 0 (0.000%) | 6.171 | 29.304 | 47.665 | 63.093 | 54.453 |
+| saturation-c8 | 2 | 8 | 470.828 | 0 (0.000%) | 9.159 | 56.23 | 70.71 | 65.945 | 48.505 |
+| saturation-c16 | 2 | 16 | 472.892 | 0 (0.000%) | 19.862 | 73.628 | 98.773 | 65.08 | 38.028 |
+| saturation-c32 | 2 | 32 | 564.012 | 0 (0.000%) | 51.089 | 94.785 | 109.138 | 83.825 | 51.965 |
+| fixed-r1 | 1 | 32 | 578.242 | 0 (0.000%) | 48.579 | 95.757 | 115.549 | 79.058 | 36.575 |
+| fixed-r2 | 2 | 32 | 529.499 | 0 (0.000%) | 53.316 | 100.145 | 129.953 | 81.065 | 44.7 |
+| fixed-r4 | 4 | 32 | 353.955 | 0 (0.000%) | 69.354 | 139.408 | 291.312 | 74.677 | 46.25 |
+| growth-r1 | 1 | 32 | 533.656 | 0 (0.000%) | 53.378 | 93.541 | 115.58 | 77.252 | 38.273 |
+| growth-r2 | 2 | 32 | 563.46 | 0 (0.000%) | 50.516 | 96.428 | 129.46 | 85.597 | 46.653 |
+| growth-r4 | 4 | 32 | 438.868 | 0 (0.000%) | 68.331 | 109.446 | 199.616 | 84.847 | 35.69 |
+| improved-db-cpu-r4 | 4 | 32 | 587.574 | 0 (0.000%) | 49.466 | 93.991 | 112.002 | 95.573 | 55.2 |
+
+## Conclusion
+
+The first saturation signal appears at concurrency 8: RPS changes by +8.03% while p95 changes by 1.92x versus concurrency 4.
+
+Observed bottleneck classification: `postgres_cpu`.
+
+The PostgreSQL CPU change produced +33.88% RPS and -14.12% p95; confirmed improvement: `true`.
+
+After the improvement the remaining bottleneck classification is `load_balancer_cpu`.
+
+## Graphs
+
+
+
+
+
+
+
+
+
+
+
+## Raw data and limits
+
+Raw aggregates are in `measurements.csv`; one-second request buckets are in `timeseries.csv`; every resource sample is in `resources.csv`; complete metadata and applied limits are in `results.json`.
+
+- single Docker host: replicas do not prove host-level availability
+- closed-loop workload has coordinated omission
+- successful-response latency percentiles are reported separately from failures
+- one measured run per profile; host scheduling noise is possible
diff --git a/evidence/grade5/measurements.csv b/evidence/grade5/measurements.csv
new file mode 100644
index 00000000..d777c58b
--- /dev/null
+++ b/evidence/grade5/measurements.csv
@@ -0,0 +1,14 @@
+phase,kind,replicas,concurrency,elapsed_seconds,successful_requests,failed_requests,error_ratio,successful_rps,p50_ms,p95_ms,p99_ms,api_cpu_avg,postgres_cpu_avg,load_balancer_cpu_avg,frontend_cpu_avg,redis_cpu_avg
+saturation-c1,saturation,2,1,10.731,2472,0,0.0,230.369,3.839,5.065,6.282,26.85,23.9,11.662,0.688,0.8
+saturation-c2,saturation,2,2,10.915,3495,0,0.0,320.19,5.192,7.196,15.11,48.3,54.987,19.13,0.325,0.193
+saturation-c4,saturation,2,4,10.832,4721,0,0.0,435.822,6.171,29.304,47.665,54.453,63.093,20.843,0.95,0.81
+saturation-c8,saturation,2,8,10.821,5095,0,0.0,470.828,9.159,56.23,70.71,48.505,65.945,20.867,0.86,0.953
+saturation-c16,saturation,2,16,10.876,5143,0,0.0,472.892,19.862,73.628,98.773,38.028,65.08,20.98,1.113,0.172
+saturation-c32,saturation,2,32,10.808,6096,0,0.0,564.012,51.089,94.785,109.138,51.965,83.825,21.163,1.837,2.475
+fixed-r1,fixed,1,32,10.88,6291,0,0.0,578.242,48.579,95.757,115.549,36.575,79.058,20.732,0.005,1.232
+fixed-r2,fixed,2,32,10.905,5774,0,0.0,529.499,53.316,100.145,129.953,44.7,81.065,21.15,0.823,1.093
+fixed-r4,fixed,4,32,11.917,4218,0,0.0,353.955,69.354,139.408,291.312,46.25,74.677,21.18,0.637,2.715
+growth-r1,growth,1,32,10.951,5844,0,0.0,533.656,53.378,93.541,115.58,38.273,77.252,20.062,0.693,0.958
+growth-r2,growth,2,32,10.796,6083,0,0.0,563.46,50.516,96.428,129.46,46.653,85.597,21.192,0.765,0.865
+growth-r4,growth,4,32,10.682,4688,0,0.0,438.868,68.331,109.446,199.616,35.69,84.847,15.595,0.667,0.873
+improved-db-cpu-r4,improvement,4,32,10.601,6229,0,0.0,587.574,49.466,93.991,112.002,55.2,95.573,22.35,0.83,0.458
diff --git a/evidence/grade5/resources.csv b/evidence/grade5/resources.csv
new file mode 100644
index 00000000..b51ffde1
--- /dev/null
+++ b/evidence/grade5/resources.csv
@@ -0,0 +1,261 @@
+phase,t,service,containers,cpu_percent,memory_mib
+saturation-c1,0.0,api,2,26.09,17.976
+saturation-c1,0.0,frontend,1,1.61,7.578
+saturation-c1,0.0,load-balancer,1,13.0,17.18
+saturation-c1,0.0,postgres,1,28.57,169.0
+saturation-c1,0.0,redis,1,0.15,15.28
+saturation-c1,2.356,api,2,32.65,16.886
+saturation-c1,2.356,frontend,1,0.02,7.617
+saturation-c1,2.356,load-balancer,1,13.32,17.23
+saturation-c1,2.356,postgres,1,28.96,169.5
+saturation-c1,2.356,redis,1,2.75,15.4
+saturation-c1,5.485,api,2,27.72,17.586
+saturation-c1,5.485,frontend,1,0.0,7.383
+saturation-c1,5.485,load-balancer,1,13.69,17.41
+saturation-c1,5.485,postgres,1,29.41,170.1
+saturation-c1,5.485,redis,1,0.15,15.28
+saturation-c1,8.605,api,2,20.94,17.41
+saturation-c1,8.605,frontend,1,1.12,12.06
+saturation-c1,8.605,load-balancer,1,6.64,17.24
+saturation-c1,8.605,postgres,1,8.66,170.5
+saturation-c1,8.605,redis,1,0.15,15.53
+saturation-c2,0.001,api,2,51.0,17.761
+saturation-c2,0.001,frontend,1,0.03,7.617
+saturation-c2,0.001,load-balancer,1,24.78,17.71
+saturation-c2,0.001,postgres,1,57.44,171.2
+saturation-c2,0.001,redis,1,0.17,16.03
+saturation-c2,2.361,api,2,45.61,17.516
+saturation-c2,2.361,frontend,1,0.03,7.367
+saturation-c2,2.361,load-balancer,1,24.6,17.41
+saturation-c2,2.361,postgres,1,49.85,172.6
+saturation-c2,2.361,redis,1,0.18,15.28
+saturation-c2,5.543,api,2,51.19,16.258
+saturation-c2,5.543,frontend,1,0.02,7.367
+saturation-c2,5.543,load-balancer,1,24.27,17.91
+saturation-c2,5.543,postgres,1,62.6,173.0
+saturation-c2,5.543,redis,1,0.21,15.28
+saturation-c2,8.736,api,2,45.4,17.082
+saturation-c2,8.736,frontend,1,1.22,8.121
+saturation-c2,8.736,load-balancer,1,2.87,17.2
+saturation-c2,8.736,postgres,1,50.06,173.8
+saturation-c2,8.736,redis,1,0.21,15.78
+saturation-c4,0.001,api,2,65.41,17.297
+saturation-c4,0.001,frontend,1,0.03,7.367
+saturation-c4,0.001,load-balancer,1,25.95,17.71
+saturation-c4,0.001,postgres,1,81.8,174.4
+saturation-c4,0.001,redis,1,0.19,15.28
+saturation-c4,2.372,api,2,60.01,18.188
+saturation-c4,2.372,frontend,1,3.75,7.965
+saturation-c4,2.372,load-balancer,1,26.04,17.46
+saturation-c4,2.372,postgres,1,79.42,175.4
+saturation-c4,2.372,redis,1,0.16,15.53
+saturation-c4,5.501,api,2,56.53,17.433
+saturation-c4,5.501,frontend,1,0.02,7.367
+saturation-c4,5.501,load-balancer,1,25.9,21.22
+saturation-c4,5.501,postgres,1,73.71,175.7
+saturation-c4,5.501,redis,1,0.18,15.28
+saturation-c4,8.662,api,2,35.86,16.699
+saturation-c4,8.662,frontend,1,0.0,7.367
+saturation-c4,8.662,load-balancer,1,5.48,17.53
+saturation-c4,8.662,postgres,1,17.44,177.2
+saturation-c4,8.662,redis,1,2.71,16.1
+saturation-c8,0.006,api,2,48.34,17.403
+saturation-c8,0.006,frontend,1,0.0,7.367
+saturation-c8,0.006,load-balancer,1,25.42,20.12
+saturation-c8,0.006,postgres,1,77.51,185.1
+saturation-c8,0.006,redis,1,0.18,15.28
+saturation-c8,2.372,api,2,57.14,18.602
+saturation-c8,2.372,frontend,1,3.44,7.734
+saturation-c8,2.372,load-balancer,1,26.83,17.14
+saturation-c8,2.372,postgres,1,92.98,188.5
+saturation-c8,2.372,redis,1,3.34,15.28
+saturation-c8,5.527,api,2,48.26,18.192
+saturation-c8,5.527,frontend,1,0.0,7.363
+saturation-c8,5.527,load-balancer,1,25.47,17.28
+saturation-c8,5.527,postgres,1,76.05,189.4
+saturation-c8,5.527,redis,1,0.15,15.28
+saturation-c8,8.685,api,2,40.28,21.813
+saturation-c8,8.685,frontend,1,0.0,7.363
+saturation-c8,8.685,load-balancer,1,5.75,17.64
+saturation-c8,8.685,postgres,1,17.24,190.4
+saturation-c8,8.685,redis,1,0.14,15.28
+saturation-c16,0.015,api,2,44.39,18.796
+saturation-c16,0.015,frontend,1,0.0,7.363
+saturation-c16,0.015,load-balancer,1,26.92,17.44
+saturation-c16,0.015,postgres,1,82.81,205.9
+saturation-c16,0.015,redis,1,0.17,15.28
+saturation-c16,2.354,api,2,56.54,17.856
+saturation-c16,2.354,frontend,1,0.03,7.375
+saturation-c16,2.354,load-balancer,1,26.66,17.69
+saturation-c16,2.354,postgres,1,88.93,207.7
+saturation-c16,2.354,redis,1,0.19,15.75
+saturation-c16,5.525,api,2,41.39,17.73
+saturation-c16,5.525,frontend,1,4.4,7.379
+saturation-c16,5.525,load-balancer,1,25.76,17.7
+saturation-c16,5.525,postgres,1,72.49,208.6
+saturation-c16,5.525,redis,1,0.18,15.25
+saturation-c16,8.731,api,2,9.79,18.257
+saturation-c16,8.731,frontend,1,0.02,7.375
+saturation-c16,8.731,load-balancer,1,4.58,17.55
+saturation-c16,8.731,postgres,1,16.09,209.7
+saturation-c16,8.731,redis,1,0.15,15.33
+saturation-c32,0.039,api,2,55.84,18.75
+saturation-c32,0.039,frontend,1,6.63,8.125
+saturation-c32,0.039,load-balancer,1,25.97,18.0
+saturation-c32,0.039,postgres,1,104.2,210.6
+saturation-c32,0.039,redis,1,5.85,15.05
+saturation-c32,2.29,api,2,56.87,18.933
+saturation-c32,2.29,frontend,1,0.0,7.625
+saturation-c32,2.29,load-balancer,1,27.03,19.23
+saturation-c32,2.29,postgres,1,105.41,212.1
+saturation-c32,2.29,redis,1,0.19,15.55
+saturation-c32,5.446,api,2,64.13,19.003
+saturation-c32,5.446,frontend,1,0.7,7.375
+saturation-c32,5.446,load-balancer,1,26.33,18.27
+saturation-c32,5.446,postgres,1,107.62,213.1
+saturation-c32,5.446,redis,1,3.7,15.27
+saturation-c32,8.653,api,2,31.02,19.379
+saturation-c32,8.653,frontend,1,0.02,7.625
+saturation-c32,8.653,load-balancer,1,5.32,18.36
+saturation-c32,8.653,postgres,1,18.07,213.5
+saturation-c32,8.653,redis,1,0.16,15.26
+fixed-r1,0.034,api,1,45.68,10.61
+fixed-r1,0.034,frontend,1,0.02,7.359
+fixed-r1,0.034,load-balancer,1,25.97,18.08
+fixed-r1,0.034,postgres,1,106.86,214.7
+fixed-r1,0.034,redis,1,4.41,15.3
+fixed-r1,2.424,api,1,48.23,11.36
+fixed-r1,2.424,frontend,1,0.0,7.699
+fixed-r1,2.424,load-balancer,1,27.02,22.21
+fixed-r1,2.424,postgres,1,96.33,215.7
+fixed-r1,2.424,redis,1,0.14,15.44
+fixed-r1,5.588,api,1,48.84,12.07
+fixed-r1,5.588,frontend,1,0.0,7.359
+fixed-r1,5.588,load-balancer,1,26.38,18.43
+fixed-r1,5.588,postgres,1,104.71,217.4
+fixed-r1,5.588,redis,1,0.19,15.92
+fixed-r1,8.743,api,1,3.55,11.93
+fixed-r1,8.743,frontend,1,0.0,7.508
+fixed-r1,8.743,load-balancer,1,3.56,17.96
+fixed-r1,8.743,postgres,1,8.33,218.1
+fixed-r1,8.743,redis,1,0.19,16.07
+fixed-r2,0.041,api,2,52.24,18.086
+fixed-r2,0.041,frontend,1,0.0,7.359
+fixed-r2,0.041,load-balancer,1,26.74,18.2
+fixed-r2,0.041,postgres,1,100.69,219.4
+fixed-r2,0.041,redis,1,3.81,15.18
+fixed-r2,2.379,api,2,65.39,18.801
+fixed-r2,2.379,frontend,1,1.92,7.859
+fixed-r2,2.379,load-balancer,1,26.23,18.61
+fixed-r2,2.379,postgres,1,106.33,221.3
+fixed-r2,2.379,redis,1,0.16,15.16
+fixed-r2,5.564,api,2,54.12,18.379
+fixed-r2,5.564,frontend,1,1.37,10.54
+fixed-r2,5.564,load-balancer,1,25.33,18.35
+fixed-r2,5.564,postgres,1,103.06,222.7
+fixed-r2,5.564,redis,1,0.2,14.93
+fixed-r2,8.728,api,2,7.05,18.086
+fixed-r2,8.728,frontend,1,0.0,7.363
+fixed-r2,8.728,load-balancer,1,6.3,17.82
+fixed-r2,8.728,postgres,1,14.18,223.3
+fixed-r2,8.728,redis,1,0.2,15.43
+fixed-r4,0.095,api,4,51.98,27.492
+fixed-r4,0.095,frontend,1,0.0,7.363
+fixed-r4,0.095,load-balancer,1,27.15,19.06
+fixed-r4,0.095,postgres,1,90.1,223.1
+fixed-r4,0.095,redis,1,5.94,16.87
+fixed-r4,3.244,api,4,64.6,33.144
+fixed-r4,3.244,frontend,1,0.02,7.359
+fixed-r4,3.244,load-balancer,1,26.34,18.58
+fixed-r4,3.244,postgres,1,101.51,225.1
+fixed-r4,3.244,redis,1,0.2,16.96
+fixed-r4,6.45,api,4,65.35,34.281
+fixed-r4,6.45,frontend,1,0.02,7.359
+fixed-r4,6.45,load-balancer,1,26.27,18.56
+fixed-r4,6.45,postgres,1,106.68,225.7
+fixed-r4,6.45,redis,1,4.55,16.7
+fixed-r4,9.725,api,4,3.07,32.867
+fixed-r4,9.725,frontend,1,2.51,7.762
+fixed-r4,9.725,load-balancer,1,4.96,17.89
+fixed-r4,9.725,postgres,1,0.42,226.7
+fixed-r4,9.725,redis,1,0.17,16.95
+growth-r1,0.045,api,1,44.44,9.355
+growth-r1,0.045,frontend,1,0.0,7.359
+growth-r1,0.045,load-balancer,1,25.9,18.3
+growth-r1,0.045,postgres,1,93.36,207.6
+growth-r1,0.045,redis,1,3.22,18.55
+growth-r1,2.404,api,1,50.32,9.379
+growth-r1,2.404,frontend,1,0.0,7.363
+growth-r1,2.404,load-balancer,1,25.42,18.36
+growth-r1,2.404,postgres,1,96.7,209.4
+growth-r1,2.404,redis,1,0.22,18.11
+growth-r1,5.579,api,1,50.68,9.66
+growth-r1,5.579,frontend,1,0.03,7.613
+growth-r1,5.579,load-balancer,1,25.44,18.67
+growth-r1,5.579,postgres,1,105.06,210.9
+growth-r1,5.579,redis,1,0.22,17.84
+growth-r1,8.767,api,1,7.65,9.262
+growth-r1,8.767,frontend,1,2.74,8.02
+growth-r1,8.767,load-balancer,1,3.49,17.86
+growth-r1,8.767,postgres,1,13.89,211.8
+growth-r1,8.767,redis,1,0.17,17.93
+growth-r2,0.047,api,2,52.25,17.629
+growth-r2,0.047,frontend,1,0.02,7.363
+growth-r2,0.047,load-balancer,1,24.23,18.59
+growth-r2,0.047,postgres,1,100.9,233.3
+growth-r2,0.047,redis,1,0.14,17.16
+growth-r2,2.292,api,2,62.86,17.606
+growth-r2,2.292,frontend,1,0.0,7.355
+growth-r2,2.292,load-balancer,1,25.57,18.19
+growth-r2,2.292,postgres,1,105.07,235.3
+growth-r2,2.292,redis,1,0.16,17.16
+growth-r2,5.459,api,2,57.29,18.789
+growth-r2,5.459,frontend,1,0.04,7.363
+growth-r2,5.459,load-balancer,1,25.89,18.43
+growth-r2,5.459,postgres,1,104.58,235.1
+growth-r2,5.459,redis,1,0.17,17.73
+growth-r2,8.628,api,2,14.21,17.832
+growth-r2,8.628,frontend,1,3.0,8.062
+growth-r2,8.628,load-balancer,1,9.08,18.0
+growth-r2,8.628,postgres,1,31.84,234.3
+growth-r2,8.628,redis,1,2.99,22.08
+growth-r4,0.043,api,4,25.03,29.672
+growth-r4,0.043,frontend,1,0.02,7.316
+growth-r4,0.043,load-balancer,1,9.16,18.25
+growth-r4,0.043,postgres,1,99.03,269.2
+growth-r4,0.043,redis,1,0.15,16.5
+growth-r4,2.197,api,4,48.89,31.184
+growth-r4,2.197,frontend,1,2.63,7.305
+growth-r4,2.197,load-balancer,1,23.31,18.25
+growth-r4,2.197,postgres,1,100.3,284.5
+growth-r4,2.197,redis,1,2.97,20.3
+growth-r4,5.406,api,4,43.96,32.164
+growth-r4,5.406,frontend,1,0.0,7.305
+growth-r4,5.406,load-balancer,1,19.48,17.79
+growth-r4,5.406,postgres,1,101.91,290.1
+growth-r4,5.406,redis,1,0.19,16.68
+growth-r4,8.538,api,4,24.88,32.855
+growth-r4,8.538,frontend,1,0.02,7.551
+growth-r4,8.538,load-balancer,1,10.43,17.5
+growth-r4,8.538,postgres,1,38.15,279.9
+growth-r4,8.538,redis,1,0.18,16.91
+improved-db-cpu-r4,0.054,api,4,52.63,30.188
+improved-db-cpu-r4,0.054,frontend,1,0.03,7.301
+improved-db-cpu-r4,0.054,load-balancer,1,24.59,18.03
+improved-db-cpu-r4,0.054,postgres,1,121.18,130.1
+improved-db-cpu-r4,0.054,redis,1,1.35,16.63
+improved-db-cpu-r4,2.129,api,4,70.26,36.812
+improved-db-cpu-r4,2.129,frontend,1,0.0,7.301
+improved-db-cpu-r4,2.129,load-balancer,1,25.64,18.99
+improved-db-cpu-r4,2.129,postgres,1,106.99,141.4
+improved-db-cpu-r4,2.129,redis,1,0.16,16.88
+improved-db-cpu-r4,5.271,api,4,65.05,33.652
+improved-db-cpu-r4,5.271,frontend,1,3.29,7.43
+improved-db-cpu-r4,5.271,load-balancer,1,26.73,18.41
+improved-db-cpu-r4,5.271,postgres,1,102.2,145.9
+improved-db-cpu-r4,5.271,redis,1,0.14,16.63
+improved-db-cpu-r4,8.446,api,4,32.86,34.023
+improved-db-cpu-r4,8.446,frontend,1,0.0,7.301
+improved-db-cpu-r4,8.446,load-balancer,1,12.44,18.0
+improved-db-cpu-r4,8.446,postgres,1,51.92,147.6
+improved-db-cpu-r4,8.446,redis,1,0.18,16.88
diff --git a/evidence/grade5/results.json b/evidence/grade5/results.json
new file mode 100644
index 00000000..7e89b5ef
--- /dev/null
+++ b/evidence/grade5/results.json
@@ -0,0 +1,3354 @@
+{
+ "schema_version": 1,
+ "environment": {
+ "utc_started_at": "2026-10-23T15:23:12.734339+00:00",
+ "git_commit": "5300a1a1e0e5497f2d30097bb1542b2743a8aad5",
+ "working_tree_dirty": true,
+ "logical_cpu_count": 8,
+ "host_memory_mib": 3813.6,
+ "kernel": "6.18.33.2-microsoft-standard-WSL2",
+ "python": "3.14.4",
+ "docker_engine": "29.7.2",
+ "docker_compose": "5.5.0",
+ "images": [
+ "mtusi2026lab3-api",
+ "mtusi2026lab3-load-balancer",
+ "mtusi2026lab3-web",
+ "postgres:16.15-alpine3.24@sha256:721873c34ceb9f8d8fc265984940dc982404c105f19ad51be9fdc5970a6080ea",
+ "redis:8.10.2-alpine3.23@sha256:3811787313eba226a2ef38658c6ccb91cd5e110edc89c37767de373120a0e5a0",
+ "migrate/migrate:v4.20.1@sha256:76cc2074cb6642631f34a898ced71e6aeaa6b1a4d78c4daa743275a22e0c5be7"
+ ]
+ },
+ "hypothesis": "API replicas stop improving throughput when shared PostgreSQL CPU saturates; adding PostgreSQL CPU should improve the unchanged four-replica profile.",
+ "methodology": {
+ "workload": "closed-loop POST messages through the public HAProxy gateway; unique idempotency keys; no client retries",
+ "duration_seconds_per_phase": 10,
+ "warmup_seconds_per_profile": 2,
+ "comparison_concurrency": 32,
+ "saturation_concurrency": [
+ 1,
+ 2,
+ 4,
+ 8,
+ 16,
+ 32
+ ],
+ "fixed_total_budget": "1.00 API CPU, 512 MiB API RAM, 16 total DB pool connections",
+ "growth_budget": "0.50 API CPU, 256 MiB RAM and 8 DB pool connections per replica",
+ "improvement": "only PostgreSQL CPU changes from 1.00 to 2.00",
+ "saturation_rule": "RPS gain below 10% and p95 growth at least 1.5x versus the previous step",
+ "cpu_bottleneck_rule": "average at least 70% and peak at least 95% of PostgreSQL CPU limit; service-specific threshold for the 0.25 CPU load balancer"
+ },
+ "profiles": {
+ "fixed-r1": {
+ "postgres_cpu": 1.0,
+ "postgres_memory": "512M",
+ "name": "fixed-r1",
+ "replicas": 1,
+ "api_cpu": 1.0,
+ "api_memory": "512M",
+ "db_max_conns": 16,
+ "db_min_conns": 2
+ },
+ "fixed-r2": {
+ "postgres_cpu": 1.0,
+ "postgres_memory": "512M",
+ "name": "fixed-r2",
+ "replicas": 2,
+ "api_cpu": 0.5,
+ "api_memory": "256M",
+ "db_max_conns": 8,
+ "db_min_conns": 1
+ },
+ "fixed-r4": {
+ "postgres_cpu": 1.0,
+ "postgres_memory": "512M",
+ "name": "fixed-r4",
+ "replicas": 4,
+ "api_cpu": 0.25,
+ "api_memory": "128M",
+ "db_max_conns": 4,
+ "db_min_conns": 1
+ },
+ "growth-r1": {
+ "postgres_cpu": 1.0,
+ "postgres_memory": "512M",
+ "name": "growth-r1",
+ "replicas": 1,
+ "api_cpu": 0.5,
+ "api_memory": "256M",
+ "db_max_conns": 8,
+ "db_min_conns": 1
+ },
+ "growth-r2": {
+ "postgres_cpu": 1.0,
+ "postgres_memory": "512M",
+ "name": "growth-r2",
+ "replicas": 2,
+ "api_cpu": 0.5,
+ "api_memory": "256M",
+ "db_max_conns": 8,
+ "db_min_conns": 1
+ },
+ "growth-r4": {
+ "postgres_cpu": 1.0,
+ "postgres_memory": "512M",
+ "name": "growth-r4",
+ "replicas": 4,
+ "api_cpu": 0.5,
+ "api_memory": "256M",
+ "db_max_conns": 8,
+ "db_min_conns": 1
+ },
+ "improved-db-cpu-r4": {
+ "postgres_cpu": 2.0,
+ "postgres_memory": "512M",
+ "name": "improved-db-cpu-r4",
+ "replicas": 4,
+ "api_cpu": 0.5,
+ "api_memory": "256M",
+ "db_max_conns": 8,
+ "db_min_conns": 1
+ }
+ },
+ "applied_limits": {
+ "growth-r2": {
+ "api": [
+ {
+ "instance": "3849349fa312",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ },
+ {
+ "instance": "bbcb5c0a1b19",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ }
+ ],
+ "postgres_cpu_limit": 1.0,
+ "postgres_memory_limit_mib": 512.0
+ },
+ "fixed-r1": {
+ "api": [
+ {
+ "instance": "f5b4c0a90be9",
+ "cpu_limit": 1.0,
+ "memory_limit_mib": 512.0,
+ "db_max_conns": 16
+ }
+ ],
+ "postgres_cpu_limit": 1.0,
+ "postgres_memory_limit_mib": 512.0
+ },
+ "fixed-r2": {
+ "api": [
+ {
+ "instance": "71e7fe08b5fe",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ },
+ {
+ "instance": "b072d13bfd31",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ }
+ ],
+ "postgres_cpu_limit": 1.0,
+ "postgres_memory_limit_mib": 512.0
+ },
+ "fixed-r4": {
+ "api": [
+ {
+ "instance": "0cc2174bf528",
+ "cpu_limit": 0.25,
+ "memory_limit_mib": 128.0,
+ "db_max_conns": 4
+ },
+ {
+ "instance": "295ab9e0814c",
+ "cpu_limit": 0.25,
+ "memory_limit_mib": 128.0,
+ "db_max_conns": 4
+ },
+ {
+ "instance": "76432e4c3707",
+ "cpu_limit": 0.25,
+ "memory_limit_mib": 128.0,
+ "db_max_conns": 4
+ },
+ {
+ "instance": "e24ef15f043e",
+ "cpu_limit": 0.25,
+ "memory_limit_mib": 128.0,
+ "db_max_conns": 4
+ }
+ ],
+ "postgres_cpu_limit": 1.0,
+ "postgres_memory_limit_mib": 512.0
+ },
+ "growth-r1": {
+ "api": [
+ {
+ "instance": "15f62705e72d",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ }
+ ],
+ "postgres_cpu_limit": 1.0,
+ "postgres_memory_limit_mib": 512.0
+ },
+ "growth-r4": {
+ "api": [
+ {
+ "instance": "4cdd1d3ba154",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ },
+ {
+ "instance": "5e6a432825a9",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ },
+ {
+ "instance": "98727dbbd98f",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ },
+ {
+ "instance": "9a0b50ef6c5a",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ }
+ ],
+ "postgres_cpu_limit": 1.0,
+ "postgres_memory_limit_mib": 512.0
+ },
+ "improved-db-cpu-r4": {
+ "api": [
+ {
+ "instance": "3078d9394686",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ },
+ {
+ "instance": "950a06115bc5",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ },
+ {
+ "instance": "b04f6abe9ea1",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ },
+ {
+ "instance": "b4c3bdf282a0",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 8
+ }
+ ],
+ "postgres_cpu_limit": 2.0,
+ "postgres_memory_limit_mib": 512.0
+ }
+ },
+ "phases": [
+ {
+ "name": "saturation-c1",
+ "kind": "saturation",
+ "profile": "growth-r2",
+ "replicas": 2,
+ "concurrency": 1,
+ "elapsed_seconds": 10.731,
+ "successful_requests": 2472,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 230.369,
+ "successful_latency_ms": {
+ "p50": 3.839,
+ "p95": 5.065,
+ "p99": 6.282
+ },
+ "instances": [
+ "442f0f041187",
+ "c0e4b7903cdc"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 252,
+ "failed": 0
+ },
+ "1": {
+ "successful": 266,
+ "failed": 0
+ },
+ "2": {
+ "successful": 257,
+ "failed": 0
+ },
+ "3": {
+ "successful": 262,
+ "failed": 0
+ },
+ "4": {
+ "successful": 253,
+ "failed": 0
+ },
+ "5": {
+ "successful": 249,
+ "failed": 0
+ },
+ "6": {
+ "successful": 228,
+ "failed": 0
+ },
+ "7": {
+ "successful": 240,
+ "failed": 0
+ },
+ "8": {
+ "successful": 219,
+ "failed": 0
+ },
+ "9": {
+ "successful": 244,
+ "failed": 0
+ },
+ "10": {
+ "successful": 2,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.0,
+ "services": {
+ "api": {
+ "cpu_percent": 26.09,
+ "memory_mib": 17.976,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 1.61,
+ "memory_mib": 7.578,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 13.0,
+ "memory_mib": 17.18,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 28.57,
+ "memory_mib": 169.0,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.15,
+ "memory_mib": 15.28,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.356,
+ "services": {
+ "api": {
+ "cpu_percent": 32.65,
+ "memory_mib": 16.886,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.02,
+ "memory_mib": 7.617,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 13.32,
+ "memory_mib": 17.23,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 28.96,
+ "memory_mib": 169.5,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 2.75,
+ "memory_mib": 15.4,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.485,
+ "services": {
+ "api": {
+ "cpu_percent": 27.72,
+ "memory_mib": 17.586,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.383,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 13.69,
+ "memory_mib": 17.41,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 29.41,
+ "memory_mib": 170.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.15,
+ "memory_mib": 15.28,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.605,
+ "services": {
+ "api": {
+ "cpu_percent": 20.94,
+ "memory_mib": 17.41,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 1.12,
+ "memory_mib": 12.06,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 6.64,
+ "memory_mib": 17.24,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 8.66,
+ "memory_mib": 170.5,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.15,
+ "memory_mib": 15.53,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 26.85,
+ "cpu_percent_max": 32.65,
+ "memory_mib_avg": 17.465,
+ "memory_mib_max": 17.976,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.688,
+ "cpu_percent_max": 1.61,
+ "memory_mib_avg": 8.659,
+ "memory_mib_max": 12.06,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 11.662,
+ "cpu_percent_max": 13.69,
+ "memory_mib_avg": 17.265,
+ "memory_mib_max": 17.41,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 23.9,
+ "cpu_percent_max": 29.41,
+ "memory_mib_avg": 169.775,
+ "memory_mib_max": 170.5,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 0.8,
+ "cpu_percent_max": 2.75,
+ "memory_mib_avg": 15.372,
+ "memory_mib_max": 15.53,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "saturation-c2",
+ "kind": "saturation",
+ "profile": "growth-r2",
+ "replicas": 2,
+ "concurrency": 2,
+ "elapsed_seconds": 10.915,
+ "successful_requests": 3495,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 320.19,
+ "successful_latency_ms": {
+ "p50": 5.192,
+ "p95": 7.196,
+ "p99": 15.11
+ },
+ "instances": [
+ "442f0f041187",
+ "c0e4b7903cdc"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 444,
+ "failed": 0
+ },
+ "1": {
+ "successful": 377,
+ "failed": 0
+ },
+ "2": {
+ "successful": 352,
+ "failed": 0
+ },
+ "3": {
+ "successful": 297,
+ "failed": 0
+ },
+ "4": {
+ "successful": 383,
+ "failed": 0
+ },
+ "5": {
+ "successful": 324,
+ "failed": 0
+ },
+ "6": {
+ "successful": 275,
+ "failed": 0
+ },
+ "7": {
+ "successful": 323,
+ "failed": 0
+ },
+ "8": {
+ "successful": 333,
+ "failed": 0
+ },
+ "9": {
+ "successful": 381,
+ "failed": 0
+ },
+ "10": {
+ "successful": 6,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.001,
+ "services": {
+ "api": {
+ "cpu_percent": 51.0,
+ "memory_mib": 17.761,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.03,
+ "memory_mib": 7.617,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 24.78,
+ "memory_mib": 17.71,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 57.44,
+ "memory_mib": 171.2,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.17,
+ "memory_mib": 16.03,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.361,
+ "services": {
+ "api": {
+ "cpu_percent": 45.61,
+ "memory_mib": 17.516,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.03,
+ "memory_mib": 7.367,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 24.6,
+ "memory_mib": 17.41,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 49.85,
+ "memory_mib": 172.6,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.18,
+ "memory_mib": 15.28,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.543,
+ "services": {
+ "api": {
+ "cpu_percent": 51.19,
+ "memory_mib": 16.258,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.02,
+ "memory_mib": 7.367,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 24.27,
+ "memory_mib": 17.91,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 62.6,
+ "memory_mib": 173.0,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.21,
+ "memory_mib": 15.28,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.736,
+ "services": {
+ "api": {
+ "cpu_percent": 45.4,
+ "memory_mib": 17.082,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 1.22,
+ "memory_mib": 8.121,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 2.87,
+ "memory_mib": 17.2,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 50.06,
+ "memory_mib": 173.8,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.21,
+ "memory_mib": 15.78,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 48.3,
+ "cpu_percent_max": 51.19,
+ "memory_mib_avg": 17.154,
+ "memory_mib_max": 17.761,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.325,
+ "cpu_percent_max": 1.22,
+ "memory_mib_avg": 7.618,
+ "memory_mib_max": 8.121,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 19.13,
+ "cpu_percent_max": 24.78,
+ "memory_mib_avg": 17.558,
+ "memory_mib_max": 17.91,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 54.987,
+ "cpu_percent_max": 62.6,
+ "memory_mib_avg": 172.65,
+ "memory_mib_max": 173.8,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 0.193,
+ "cpu_percent_max": 0.21,
+ "memory_mib_avg": 15.592,
+ "memory_mib_max": 16.03,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "saturation-c4",
+ "kind": "saturation",
+ "profile": "growth-r2",
+ "replicas": 2,
+ "concurrency": 4,
+ "elapsed_seconds": 10.832,
+ "successful_requests": 4721,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 435.822,
+ "successful_latency_ms": {
+ "p50": 6.171,
+ "p95": 29.304,
+ "p99": 47.665
+ },
+ "instances": [
+ "442f0f041187",
+ "c0e4b7903cdc"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 526,
+ "failed": 0
+ },
+ "1": {
+ "successful": 453,
+ "failed": 0
+ },
+ "2": {
+ "successful": 425,
+ "failed": 0
+ },
+ "3": {
+ "successful": 478,
+ "failed": 0
+ },
+ "4": {
+ "successful": 510,
+ "failed": 0
+ },
+ "5": {
+ "successful": 468,
+ "failed": 0
+ },
+ "6": {
+ "successful": 458,
+ "failed": 0
+ },
+ "7": {
+ "successful": 428,
+ "failed": 0
+ },
+ "8": {
+ "successful": 490,
+ "failed": 0
+ },
+ "9": {
+ "successful": 474,
+ "failed": 0
+ },
+ "10": {
+ "successful": 11,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.001,
+ "services": {
+ "api": {
+ "cpu_percent": 65.41,
+ "memory_mib": 17.297,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.03,
+ "memory_mib": 7.367,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.95,
+ "memory_mib": 17.71,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 81.8,
+ "memory_mib": 174.4,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.19,
+ "memory_mib": 15.28,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.372,
+ "services": {
+ "api": {
+ "cpu_percent": 60.01,
+ "memory_mib": 18.188,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 3.75,
+ "memory_mib": 7.965,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 26.04,
+ "memory_mib": 17.46,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 79.42,
+ "memory_mib": 175.4,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.16,
+ "memory_mib": 15.53,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.501,
+ "services": {
+ "api": {
+ "cpu_percent": 56.53,
+ "memory_mib": 17.433,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.02,
+ "memory_mib": 7.367,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.9,
+ "memory_mib": 21.22,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 73.71,
+ "memory_mib": 175.7,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.18,
+ "memory_mib": 15.28,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.662,
+ "services": {
+ "api": {
+ "cpu_percent": 35.86,
+ "memory_mib": 16.699,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.367,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 5.48,
+ "memory_mib": 17.53,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 17.44,
+ "memory_mib": 177.2,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 2.71,
+ "memory_mib": 16.1,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 54.453,
+ "cpu_percent_max": 65.41,
+ "memory_mib_avg": 17.404,
+ "memory_mib_max": 18.188,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.95,
+ "cpu_percent_max": 3.75,
+ "memory_mib_avg": 7.516,
+ "memory_mib_max": 7.965,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 20.843,
+ "cpu_percent_max": 26.04,
+ "memory_mib_avg": 18.48,
+ "memory_mib_max": 21.22,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 63.093,
+ "cpu_percent_max": 81.8,
+ "memory_mib_avg": 175.675,
+ "memory_mib_max": 177.2,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 0.81,
+ "cpu_percent_max": 2.71,
+ "memory_mib_avg": 15.547,
+ "memory_mib_max": 16.1,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "saturation-c8",
+ "kind": "saturation",
+ "profile": "growth-r2",
+ "replicas": 2,
+ "concurrency": 8,
+ "elapsed_seconds": 10.821,
+ "successful_requests": 5095,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 470.828,
+ "successful_latency_ms": {
+ "p50": 9.159,
+ "p95": 56.23,
+ "p99": 70.71
+ },
+ "instances": [
+ "442f0f041187",
+ "c0e4b7903cdc"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 532,
+ "failed": 0
+ },
+ "1": {
+ "successful": 476,
+ "failed": 0
+ },
+ "2": {
+ "successful": 530,
+ "failed": 0
+ },
+ "3": {
+ "successful": 529,
+ "failed": 0
+ },
+ "4": {
+ "successful": 490,
+ "failed": 0
+ },
+ "5": {
+ "successful": 527,
+ "failed": 0
+ },
+ "6": {
+ "successful": 445,
+ "failed": 0
+ },
+ "7": {
+ "successful": 524,
+ "failed": 0
+ },
+ "8": {
+ "successful": 507,
+ "failed": 0
+ },
+ "9": {
+ "successful": 519,
+ "failed": 0
+ },
+ "10": {
+ "successful": 16,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.006,
+ "services": {
+ "api": {
+ "cpu_percent": 48.34,
+ "memory_mib": 17.403,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.367,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.42,
+ "memory_mib": 20.12,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 77.51,
+ "memory_mib": 185.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.18,
+ "memory_mib": 15.28,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.372,
+ "services": {
+ "api": {
+ "cpu_percent": 57.14,
+ "memory_mib": 18.602,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 3.44,
+ "memory_mib": 7.734,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 26.83,
+ "memory_mib": 17.14,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 92.98,
+ "memory_mib": 188.5,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 3.34,
+ "memory_mib": 15.28,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.527,
+ "services": {
+ "api": {
+ "cpu_percent": 48.26,
+ "memory_mib": 18.192,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.363,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.47,
+ "memory_mib": 17.28,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 76.05,
+ "memory_mib": 189.4,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.15,
+ "memory_mib": 15.28,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.685,
+ "services": {
+ "api": {
+ "cpu_percent": 40.28,
+ "memory_mib": 21.813,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.363,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 5.75,
+ "memory_mib": 17.64,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 17.24,
+ "memory_mib": 190.4,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.14,
+ "memory_mib": 15.28,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 48.505,
+ "cpu_percent_max": 57.14,
+ "memory_mib_avg": 19.002,
+ "memory_mib_max": 21.813,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.86,
+ "cpu_percent_max": 3.44,
+ "memory_mib_avg": 7.457,
+ "memory_mib_max": 7.734,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 20.867,
+ "cpu_percent_max": 26.83,
+ "memory_mib_avg": 18.045,
+ "memory_mib_max": 20.12,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 65.945,
+ "cpu_percent_max": 92.98,
+ "memory_mib_avg": 188.35,
+ "memory_mib_max": 190.4,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 0.953,
+ "cpu_percent_max": 3.34,
+ "memory_mib_avg": 15.28,
+ "memory_mib_max": 15.28,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "saturation-c16",
+ "kind": "saturation",
+ "profile": "growth-r2",
+ "replicas": 2,
+ "concurrency": 16,
+ "elapsed_seconds": 10.876,
+ "successful_requests": 5143,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 472.892,
+ "successful_latency_ms": {
+ "p50": 19.862,
+ "p95": 73.628,
+ "p99": 98.773
+ },
+ "instances": [
+ "442f0f041187",
+ "c0e4b7903cdc"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 349,
+ "failed": 0
+ },
+ "1": {
+ "successful": 592,
+ "failed": 0
+ },
+ "2": {
+ "successful": 541,
+ "failed": 0
+ },
+ "3": {
+ "successful": 491,
+ "failed": 0
+ },
+ "4": {
+ "successful": 545,
+ "failed": 0
+ },
+ "5": {
+ "successful": 420,
+ "failed": 0
+ },
+ "6": {
+ "successful": 499,
+ "failed": 0
+ },
+ "7": {
+ "successful": 529,
+ "failed": 0
+ },
+ "8": {
+ "successful": 548,
+ "failed": 0
+ },
+ "9": {
+ "successful": 601,
+ "failed": 0
+ },
+ "10": {
+ "successful": 28,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.015,
+ "services": {
+ "api": {
+ "cpu_percent": 44.39,
+ "memory_mib": 18.796,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.363,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 26.92,
+ "memory_mib": 17.44,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 82.81,
+ "memory_mib": 205.9,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.17,
+ "memory_mib": 15.28,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.354,
+ "services": {
+ "api": {
+ "cpu_percent": 56.54,
+ "memory_mib": 17.856,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.03,
+ "memory_mib": 7.375,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 26.66,
+ "memory_mib": 17.69,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 88.93,
+ "memory_mib": 207.7,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.19,
+ "memory_mib": 15.75,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.525,
+ "services": {
+ "api": {
+ "cpu_percent": 41.39,
+ "memory_mib": 17.73,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 4.4,
+ "memory_mib": 7.379,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.76,
+ "memory_mib": 17.7,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 72.49,
+ "memory_mib": 208.6,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.18,
+ "memory_mib": 15.25,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.731,
+ "services": {
+ "api": {
+ "cpu_percent": 9.79,
+ "memory_mib": 18.257,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.02,
+ "memory_mib": 7.375,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 4.58,
+ "memory_mib": 17.55,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 16.09,
+ "memory_mib": 209.7,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.15,
+ "memory_mib": 15.33,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 38.028,
+ "cpu_percent_max": 56.54,
+ "memory_mib_avg": 18.16,
+ "memory_mib_max": 18.796,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent_avg": 1.113,
+ "cpu_percent_max": 4.4,
+ "memory_mib_avg": 7.373,
+ "memory_mib_max": 7.379,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 20.98,
+ "cpu_percent_max": 26.92,
+ "memory_mib_avg": 17.595,
+ "memory_mib_max": 17.7,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 65.08,
+ "cpu_percent_max": 88.93,
+ "memory_mib_avg": 207.975,
+ "memory_mib_max": 209.7,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 0.172,
+ "cpu_percent_max": 0.19,
+ "memory_mib_avg": 15.402,
+ "memory_mib_max": 15.75,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "saturation-c32",
+ "kind": "saturation",
+ "profile": "growth-r2",
+ "replicas": 2,
+ "concurrency": 32,
+ "elapsed_seconds": 10.808,
+ "successful_requests": 6096,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 564.012,
+ "successful_latency_ms": {
+ "p50": 51.089,
+ "p95": 94.785,
+ "p99": 109.138
+ },
+ "instances": [
+ "442f0f041187",
+ "c0e4b7903cdc"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 661,
+ "failed": 0
+ },
+ "1": {
+ "successful": 604,
+ "failed": 0
+ },
+ "2": {
+ "successful": 610,
+ "failed": 0
+ },
+ "3": {
+ "successful": 589,
+ "failed": 0
+ },
+ "4": {
+ "successful": 571,
+ "failed": 0
+ },
+ "5": {
+ "successful": 627,
+ "failed": 0
+ },
+ "6": {
+ "successful": 587,
+ "failed": 0
+ },
+ "7": {
+ "successful": 619,
+ "failed": 0
+ },
+ "8": {
+ "successful": 629,
+ "failed": 0
+ },
+ "9": {
+ "successful": 548,
+ "failed": 0
+ },
+ "10": {
+ "successful": 51,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.039,
+ "services": {
+ "api": {
+ "cpu_percent": 55.84,
+ "memory_mib": 18.75,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 6.63,
+ "memory_mib": 8.125,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.97,
+ "memory_mib": 18.0,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 104.2,
+ "memory_mib": 210.6,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 5.85,
+ "memory_mib": 15.05,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.29,
+ "services": {
+ "api": {
+ "cpu_percent": 56.87,
+ "memory_mib": 18.933,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.625,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 27.03,
+ "memory_mib": 19.23,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 105.41,
+ "memory_mib": 212.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.19,
+ "memory_mib": 15.55,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.446,
+ "services": {
+ "api": {
+ "cpu_percent": 64.13,
+ "memory_mib": 19.003,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.7,
+ "memory_mib": 7.375,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 26.33,
+ "memory_mib": 18.27,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 107.62,
+ "memory_mib": 213.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 3.7,
+ "memory_mib": 15.27,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.653,
+ "services": {
+ "api": {
+ "cpu_percent": 31.02,
+ "memory_mib": 19.379,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.02,
+ "memory_mib": 7.625,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 5.32,
+ "memory_mib": 18.36,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 18.07,
+ "memory_mib": 213.5,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.16,
+ "memory_mib": 15.26,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 51.965,
+ "cpu_percent_max": 64.13,
+ "memory_mib_avg": 19.016,
+ "memory_mib_max": 19.379,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent_avg": 1.837,
+ "cpu_percent_max": 6.63,
+ "memory_mib_avg": 7.688,
+ "memory_mib_max": 8.125,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 21.163,
+ "cpu_percent_max": 27.03,
+ "memory_mib_avg": 18.465,
+ "memory_mib_max": 19.23,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 83.825,
+ "cpu_percent_max": 107.62,
+ "memory_mib_avg": 212.325,
+ "memory_mib_max": 213.5,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 2.475,
+ "cpu_percent_max": 5.85,
+ "memory_mib_avg": 15.283,
+ "memory_mib_max": 15.55,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "fixed-r1",
+ "kind": "fixed",
+ "profile": "fixed-r1",
+ "replicas": 1,
+ "concurrency": 32,
+ "elapsed_seconds": 10.88,
+ "successful_requests": 6291,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 578.242,
+ "successful_latency_ms": {
+ "p50": 48.579,
+ "p95": 95.757,
+ "p99": 115.549
+ },
+ "instances": [
+ "f5b4c0a90be9"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 511,
+ "failed": 0
+ },
+ "1": {
+ "successful": 580,
+ "failed": 0
+ },
+ "2": {
+ "successful": 659,
+ "failed": 0
+ },
+ "3": {
+ "successful": 687,
+ "failed": 0
+ },
+ "4": {
+ "successful": 588,
+ "failed": 0
+ },
+ "5": {
+ "successful": 675,
+ "failed": 0
+ },
+ "6": {
+ "successful": 647,
+ "failed": 0
+ },
+ "7": {
+ "successful": 701,
+ "failed": 0
+ },
+ "8": {
+ "successful": 690,
+ "failed": 0
+ },
+ "9": {
+ "successful": 521,
+ "failed": 0
+ },
+ "10": {
+ "successful": 32,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.034,
+ "services": {
+ "api": {
+ "cpu_percent": 45.68,
+ "memory_mib": 10.61,
+ "containers": 1
+ },
+ "frontend": {
+ "cpu_percent": 0.02,
+ "memory_mib": 7.359,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.97,
+ "memory_mib": 18.08,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 106.86,
+ "memory_mib": 214.7,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 4.41,
+ "memory_mib": 15.3,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.424,
+ "services": {
+ "api": {
+ "cpu_percent": 48.23,
+ "memory_mib": 11.36,
+ "containers": 1
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.699,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 27.02,
+ "memory_mib": 22.21,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 96.33,
+ "memory_mib": 215.7,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.14,
+ "memory_mib": 15.44,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.588,
+ "services": {
+ "api": {
+ "cpu_percent": 48.84,
+ "memory_mib": 12.07,
+ "containers": 1
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.359,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 26.38,
+ "memory_mib": 18.43,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 104.71,
+ "memory_mib": 217.4,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.19,
+ "memory_mib": 15.92,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.743,
+ "services": {
+ "api": {
+ "cpu_percent": 3.55,
+ "memory_mib": 11.93,
+ "containers": 1
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.508,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 3.56,
+ "memory_mib": 17.96,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 8.33,
+ "memory_mib": 218.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.19,
+ "memory_mib": 16.07,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 36.575,
+ "cpu_percent_max": 48.84,
+ "memory_mib_avg": 11.492,
+ "memory_mib_max": 12.07,
+ "containers": 1
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.005,
+ "cpu_percent_max": 0.02,
+ "memory_mib_avg": 7.481,
+ "memory_mib_max": 7.699,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 20.732,
+ "cpu_percent_max": 27.02,
+ "memory_mib_avg": 19.17,
+ "memory_mib_max": 22.21,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 79.058,
+ "cpu_percent_max": 106.86,
+ "memory_mib_avg": 216.475,
+ "memory_mib_max": 218.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 1.232,
+ "cpu_percent_max": 4.41,
+ "memory_mib_avg": 15.683,
+ "memory_mib_max": 16.07,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "fixed-r2",
+ "kind": "fixed",
+ "profile": "fixed-r2",
+ "replicas": 2,
+ "concurrency": 32,
+ "elapsed_seconds": 10.905,
+ "successful_requests": 5774,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 529.499,
+ "successful_latency_ms": {
+ "p50": 53.316,
+ "p95": 100.145,
+ "p99": 129.953
+ },
+ "instances": [
+ "71e7fe08b5fe",
+ "b072d13bfd31"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 452,
+ "failed": 0
+ },
+ "1": {
+ "successful": 545,
+ "failed": 0
+ },
+ "2": {
+ "successful": 604,
+ "failed": 0
+ },
+ "3": {
+ "successful": 652,
+ "failed": 0
+ },
+ "4": {
+ "successful": 521,
+ "failed": 0
+ },
+ "5": {
+ "successful": 627,
+ "failed": 0
+ },
+ "6": {
+ "successful": 571,
+ "failed": 0
+ },
+ "7": {
+ "successful": 611,
+ "failed": 0
+ },
+ "8": {
+ "successful": 573,
+ "failed": 0
+ },
+ "9": {
+ "successful": 586,
+ "failed": 0
+ },
+ "10": {
+ "successful": 32,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.041,
+ "services": {
+ "api": {
+ "cpu_percent": 52.24,
+ "memory_mib": 18.086,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.359,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 26.74,
+ "memory_mib": 18.2,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 100.69,
+ "memory_mib": 219.4,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 3.81,
+ "memory_mib": 15.18,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.379,
+ "services": {
+ "api": {
+ "cpu_percent": 65.39,
+ "memory_mib": 18.801,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 1.92,
+ "memory_mib": 7.859,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 26.23,
+ "memory_mib": 18.61,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 106.33,
+ "memory_mib": 221.3,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.16,
+ "memory_mib": 15.16,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.564,
+ "services": {
+ "api": {
+ "cpu_percent": 54.12,
+ "memory_mib": 18.379,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 1.37,
+ "memory_mib": 10.54,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.33,
+ "memory_mib": 18.35,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 103.06,
+ "memory_mib": 222.7,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.2,
+ "memory_mib": 14.93,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.728,
+ "services": {
+ "api": {
+ "cpu_percent": 7.05,
+ "memory_mib": 18.086,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.363,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 6.3,
+ "memory_mib": 17.82,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 14.18,
+ "memory_mib": 223.3,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.2,
+ "memory_mib": 15.43,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 44.7,
+ "cpu_percent_max": 65.39,
+ "memory_mib_avg": 18.338,
+ "memory_mib_max": 18.801,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.823,
+ "cpu_percent_max": 1.92,
+ "memory_mib_avg": 8.28,
+ "memory_mib_max": 10.54,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 21.15,
+ "cpu_percent_max": 26.74,
+ "memory_mib_avg": 18.245,
+ "memory_mib_max": 18.61,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 81.065,
+ "cpu_percent_max": 106.33,
+ "memory_mib_avg": 221.675,
+ "memory_mib_max": 223.3,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 1.093,
+ "cpu_percent_max": 3.81,
+ "memory_mib_avg": 15.175,
+ "memory_mib_max": 15.43,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "fixed-r4",
+ "kind": "fixed",
+ "profile": "fixed-r4",
+ "replicas": 4,
+ "concurrency": 32,
+ "elapsed_seconds": 11.917,
+ "successful_requests": 4218,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 353.955,
+ "successful_latency_ms": {
+ "p50": 69.354,
+ "p95": 139.408,
+ "p99": 291.312
+ },
+ "instances": [
+ "0cc2174bf528",
+ "295ab9e0814c",
+ "76432e4c3707",
+ "e24ef15f043e"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 133,
+ "failed": 0
+ },
+ "1": {
+ "successful": 276,
+ "failed": 0
+ },
+ "2": {
+ "successful": 461,
+ "failed": 0
+ },
+ "3": {
+ "successful": 406,
+ "failed": 0
+ },
+ "4": {
+ "successful": 503,
+ "failed": 0
+ },
+ "5": {
+ "successful": 487,
+ "failed": 0
+ },
+ "6": {
+ "successful": 377,
+ "failed": 0
+ },
+ "7": {
+ "successful": 427,
+ "failed": 0
+ },
+ "8": {
+ "successful": 551,
+ "failed": 0
+ },
+ "9": {
+ "successful": 547,
+ "failed": 0
+ },
+ "10": {
+ "successful": 50,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.095,
+ "services": {
+ "api": {
+ "cpu_percent": 51.98,
+ "memory_mib": 27.492,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.363,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 27.15,
+ "memory_mib": 19.06,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 90.1,
+ "memory_mib": 223.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 5.94,
+ "memory_mib": 16.87,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 3.244,
+ "services": {
+ "api": {
+ "cpu_percent": 64.6,
+ "memory_mib": 33.144,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 0.02,
+ "memory_mib": 7.359,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 26.34,
+ "memory_mib": 18.58,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 101.51,
+ "memory_mib": 225.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.2,
+ "memory_mib": 16.96,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 6.45,
+ "services": {
+ "api": {
+ "cpu_percent": 65.35,
+ "memory_mib": 34.281,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 0.02,
+ "memory_mib": 7.359,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 26.27,
+ "memory_mib": 18.56,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 106.68,
+ "memory_mib": 225.7,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 4.55,
+ "memory_mib": 16.7,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 9.725,
+ "services": {
+ "api": {
+ "cpu_percent": 3.07,
+ "memory_mib": 32.867,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 2.51,
+ "memory_mib": 7.762,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 4.96,
+ "memory_mib": 17.89,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 0.42,
+ "memory_mib": 226.7,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.17,
+ "memory_mib": 16.95,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 46.25,
+ "cpu_percent_max": 65.35,
+ "memory_mib_avg": 31.946,
+ "memory_mib_max": 34.281,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.637,
+ "cpu_percent_max": 2.51,
+ "memory_mib_avg": 7.461,
+ "memory_mib_max": 7.762,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 21.18,
+ "cpu_percent_max": 27.15,
+ "memory_mib_avg": 18.523,
+ "memory_mib_max": 19.06,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 74.677,
+ "cpu_percent_max": 106.68,
+ "memory_mib_avg": 225.15,
+ "memory_mib_max": 226.7,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 2.715,
+ "cpu_percent_max": 5.94,
+ "memory_mib_avg": 16.87,
+ "memory_mib_max": 16.96,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "growth-r1",
+ "kind": "growth",
+ "profile": "growth-r1",
+ "replicas": 1,
+ "concurrency": 32,
+ "elapsed_seconds": 10.951,
+ "successful_requests": 5844,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 533.656,
+ "successful_latency_ms": {
+ "p50": 53.378,
+ "p95": 93.541,
+ "p99": 115.58
+ },
+ "instances": [
+ "15f62705e72d"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 527,
+ "failed": 0
+ },
+ "1": {
+ "successful": 596,
+ "failed": 0
+ },
+ "2": {
+ "successful": 604,
+ "failed": 0
+ },
+ "3": {
+ "successful": 616,
+ "failed": 0
+ },
+ "4": {
+ "successful": 516,
+ "failed": 0
+ },
+ "5": {
+ "successful": 508,
+ "failed": 0
+ },
+ "6": {
+ "successful": 606,
+ "failed": 0
+ },
+ "7": {
+ "successful": 620,
+ "failed": 0
+ },
+ "8": {
+ "successful": 628,
+ "failed": 0
+ },
+ "9": {
+ "successful": 591,
+ "failed": 0
+ },
+ "10": {
+ "successful": 32,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.045,
+ "services": {
+ "api": {
+ "cpu_percent": 44.44,
+ "memory_mib": 9.355,
+ "containers": 1
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.359,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.9,
+ "memory_mib": 18.3,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 93.36,
+ "memory_mib": 207.6,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 3.22,
+ "memory_mib": 18.55,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.404,
+ "services": {
+ "api": {
+ "cpu_percent": 50.32,
+ "memory_mib": 9.379,
+ "containers": 1
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.363,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.42,
+ "memory_mib": 18.36,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 96.7,
+ "memory_mib": 209.4,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.22,
+ "memory_mib": 18.11,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.579,
+ "services": {
+ "api": {
+ "cpu_percent": 50.68,
+ "memory_mib": 9.66,
+ "containers": 1
+ },
+ "frontend": {
+ "cpu_percent": 0.03,
+ "memory_mib": 7.613,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.44,
+ "memory_mib": 18.67,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 105.06,
+ "memory_mib": 210.9,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.22,
+ "memory_mib": 17.84,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.767,
+ "services": {
+ "api": {
+ "cpu_percent": 7.65,
+ "memory_mib": 9.262,
+ "containers": 1
+ },
+ "frontend": {
+ "cpu_percent": 2.74,
+ "memory_mib": 8.02,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 3.49,
+ "memory_mib": 17.86,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 13.89,
+ "memory_mib": 211.8,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.17,
+ "memory_mib": 17.93,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 38.273,
+ "cpu_percent_max": 50.68,
+ "memory_mib_avg": 9.414,
+ "memory_mib_max": 9.66,
+ "containers": 1
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.693,
+ "cpu_percent_max": 2.74,
+ "memory_mib_avg": 7.589,
+ "memory_mib_max": 8.02,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 20.062,
+ "cpu_percent_max": 25.9,
+ "memory_mib_avg": 18.297,
+ "memory_mib_max": 18.67,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 77.252,
+ "cpu_percent_max": 105.06,
+ "memory_mib_avg": 209.925,
+ "memory_mib_max": 211.8,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 0.958,
+ "cpu_percent_max": 3.22,
+ "memory_mib_avg": 18.108,
+ "memory_mib_max": 18.55,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "growth-r2",
+ "kind": "growth",
+ "profile": "growth-r2",
+ "replicas": 2,
+ "concurrency": 32,
+ "elapsed_seconds": 10.796,
+ "successful_requests": 6083,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 563.46,
+ "successful_latency_ms": {
+ "p50": 50.516,
+ "p95": 96.428,
+ "p99": 129.46
+ },
+ "instances": [
+ "3849349fa312",
+ "bbcb5c0a1b19"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 461,
+ "failed": 0
+ },
+ "1": {
+ "successful": 662,
+ "failed": 0
+ },
+ "2": {
+ "successful": 670,
+ "failed": 0
+ },
+ "3": {
+ "successful": 655,
+ "failed": 0
+ },
+ "4": {
+ "successful": 640,
+ "failed": 0
+ },
+ "5": {
+ "successful": 495,
+ "failed": 0
+ },
+ "6": {
+ "successful": 635,
+ "failed": 0
+ },
+ "7": {
+ "successful": 626,
+ "failed": 0
+ },
+ "8": {
+ "successful": 598,
+ "failed": 0
+ },
+ "9": {
+ "successful": 609,
+ "failed": 0
+ },
+ "10": {
+ "successful": 32,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.047,
+ "services": {
+ "api": {
+ "cpu_percent": 52.25,
+ "memory_mib": 17.629,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.02,
+ "memory_mib": 7.363,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 24.23,
+ "memory_mib": 18.59,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 100.9,
+ "memory_mib": 233.3,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.14,
+ "memory_mib": 17.16,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.292,
+ "services": {
+ "api": {
+ "cpu_percent": 62.86,
+ "memory_mib": 17.606,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.355,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.57,
+ "memory_mib": 18.19,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 105.07,
+ "memory_mib": 235.3,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.16,
+ "memory_mib": 17.16,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.459,
+ "services": {
+ "api": {
+ "cpu_percent": 57.29,
+ "memory_mib": 18.789,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 0.04,
+ "memory_mib": 7.363,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.89,
+ "memory_mib": 18.43,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 104.58,
+ "memory_mib": 235.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.17,
+ "memory_mib": 17.73,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.628,
+ "services": {
+ "api": {
+ "cpu_percent": 14.21,
+ "memory_mib": 17.832,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent": 3.0,
+ "memory_mib": 8.062,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 9.08,
+ "memory_mib": 18.0,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 31.84,
+ "memory_mib": 234.3,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 2.99,
+ "memory_mib": 22.08,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 46.653,
+ "cpu_percent_max": 62.86,
+ "memory_mib_avg": 17.964,
+ "memory_mib_max": 18.789,
+ "containers": 2
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.765,
+ "cpu_percent_max": 3.0,
+ "memory_mib_avg": 7.536,
+ "memory_mib_max": 8.062,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 21.192,
+ "cpu_percent_max": 25.89,
+ "memory_mib_avg": 18.303,
+ "memory_mib_max": 18.59,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 85.597,
+ "cpu_percent_max": 105.07,
+ "memory_mib_avg": 234.5,
+ "memory_mib_max": 235.3,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 0.865,
+ "cpu_percent_max": 2.99,
+ "memory_mib_avg": 18.532,
+ "memory_mib_max": 22.08,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "growth-r4",
+ "kind": "growth",
+ "profile": "growth-r4",
+ "replicas": 4,
+ "concurrency": 32,
+ "elapsed_seconds": 10.682,
+ "successful_requests": 4688,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 438.868,
+ "successful_latency_ms": {
+ "p50": 68.331,
+ "p95": 109.446,
+ "p99": 199.616
+ },
+ "instances": [
+ "4cdd1d3ba154",
+ "5e6a432825a9",
+ "98727dbbd98f",
+ "9a0b50ef6c5a"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 106,
+ "failed": 0
+ },
+ "1": {
+ "successful": 514,
+ "failed": 0
+ },
+ "2": {
+ "successful": 587,
+ "failed": 0
+ },
+ "3": {
+ "successful": 506,
+ "failed": 0
+ },
+ "4": {
+ "successful": 423,
+ "failed": 0
+ },
+ "5": {
+ "successful": 409,
+ "failed": 0
+ },
+ "6": {
+ "successful": 459,
+ "failed": 0
+ },
+ "7": {
+ "successful": 462,
+ "failed": 0
+ },
+ "8": {
+ "successful": 618,
+ "failed": 0
+ },
+ "9": {
+ "successful": 549,
+ "failed": 0
+ },
+ "10": {
+ "successful": 55,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.043,
+ "services": {
+ "api": {
+ "cpu_percent": 25.03,
+ "memory_mib": 29.672,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 0.02,
+ "memory_mib": 7.316,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 9.16,
+ "memory_mib": 18.25,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 99.03,
+ "memory_mib": 269.2,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.15,
+ "memory_mib": 16.5,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.197,
+ "services": {
+ "api": {
+ "cpu_percent": 48.89,
+ "memory_mib": 31.184,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 2.63,
+ "memory_mib": 7.305,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 23.31,
+ "memory_mib": 18.25,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 100.3,
+ "memory_mib": 284.5,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 2.97,
+ "memory_mib": 20.3,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.406,
+ "services": {
+ "api": {
+ "cpu_percent": 43.96,
+ "memory_mib": 32.164,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.305,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 19.48,
+ "memory_mib": 17.79,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 101.91,
+ "memory_mib": 290.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.19,
+ "memory_mib": 16.68,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.538,
+ "services": {
+ "api": {
+ "cpu_percent": 24.88,
+ "memory_mib": 32.855,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 0.02,
+ "memory_mib": 7.551,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 10.43,
+ "memory_mib": 17.5,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 38.15,
+ "memory_mib": 279.9,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.18,
+ "memory_mib": 16.91,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 35.69,
+ "cpu_percent_max": 48.89,
+ "memory_mib_avg": 31.469,
+ "memory_mib_max": 32.855,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.667,
+ "cpu_percent_max": 2.63,
+ "memory_mib_avg": 7.369,
+ "memory_mib_max": 7.551,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 15.595,
+ "cpu_percent_max": 23.31,
+ "memory_mib_avg": 17.947,
+ "memory_mib_max": 18.25,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 84.847,
+ "cpu_percent_max": 101.91,
+ "memory_mib_avg": 280.925,
+ "memory_mib_max": 290.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 0.873,
+ "cpu_percent_max": 2.97,
+ "memory_mib_avg": 17.598,
+ "memory_mib_max": 20.3,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "name": "improved-db-cpu-r4",
+ "kind": "improvement",
+ "profile": "improved-db-cpu-r4",
+ "replicas": 4,
+ "concurrency": 32,
+ "elapsed_seconds": 10.601,
+ "successful_requests": 6229,
+ "failed_requests": 0,
+ "error_ratio": 0.0,
+ "errors": {},
+ "successful_rps": 587.574,
+ "successful_latency_ms": {
+ "p50": 49.466,
+ "p95": 93.991,
+ "p99": 112.002
+ },
+ "instances": [
+ "3078d9394686",
+ "950a06115bc5",
+ "b04f6abe9ea1",
+ "b4c3bdf282a0"
+ ],
+ "per_second": {
+ "0": {
+ "successful": 492,
+ "failed": 0
+ },
+ "1": {
+ "successful": 583,
+ "failed": 0
+ },
+ "2": {
+ "successful": 629,
+ "failed": 0
+ },
+ "3": {
+ "successful": 681,
+ "failed": 0
+ },
+ "4": {
+ "successful": 667,
+ "failed": 0
+ },
+ "5": {
+ "successful": 632,
+ "failed": 0
+ },
+ "6": {
+ "successful": 585,
+ "failed": 0
+ },
+ "7": {
+ "successful": 677,
+ "failed": 0
+ },
+ "8": {
+ "successful": 602,
+ "failed": 0
+ },
+ "9": {
+ "successful": 629,
+ "failed": 0
+ },
+ "10": {
+ "successful": 52,
+ "failed": 0
+ }
+ },
+ "resource_samples": [
+ {
+ "t": 0.054,
+ "services": {
+ "api": {
+ "cpu_percent": 52.63,
+ "memory_mib": 30.188,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 0.03,
+ "memory_mib": 7.301,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 24.59,
+ "memory_mib": 18.03,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 121.18,
+ "memory_mib": 130.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 1.35,
+ "memory_mib": 16.63,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 2.129,
+ "services": {
+ "api": {
+ "cpu_percent": 70.26,
+ "memory_mib": 36.812,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.301,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 25.64,
+ "memory_mib": 18.99,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 106.99,
+ "memory_mib": 141.4,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.16,
+ "memory_mib": 16.88,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 5.271,
+ "services": {
+ "api": {
+ "cpu_percent": 65.05,
+ "memory_mib": 33.652,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 3.29,
+ "memory_mib": 7.43,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 26.73,
+ "memory_mib": 18.41,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 102.2,
+ "memory_mib": 145.9,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.14,
+ "memory_mib": 16.63,
+ "containers": 1
+ }
+ }
+ },
+ {
+ "t": 8.446,
+ "services": {
+ "api": {
+ "cpu_percent": 32.86,
+ "memory_mib": 34.023,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent": 0.0,
+ "memory_mib": 7.301,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent": 12.44,
+ "memory_mib": 18.0,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent": 51.92,
+ "memory_mib": 147.6,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent": 0.18,
+ "memory_mib": 16.88,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "resources": {
+ "api": {
+ "cpu_percent_avg": 55.2,
+ "cpu_percent_max": 70.26,
+ "memory_mib_avg": 33.669,
+ "memory_mib_max": 36.812,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.83,
+ "cpu_percent_max": 3.29,
+ "memory_mib_avg": 7.333,
+ "memory_mib_max": 7.43,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 22.35,
+ "cpu_percent_max": 26.73,
+ "memory_mib_avg": 18.358,
+ "memory_mib_max": 18.99,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 95.573,
+ "cpu_percent_max": 121.18,
+ "memory_mib_avg": 141.25,
+ "memory_mib_max": 147.6,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 0.458,
+ "cpu_percent_max": 1.35,
+ "memory_mib_avg": 16.755,
+ "memory_mib_max": 16.88,
+ "containers": 1
+ }
+ }
+ }
+ ],
+ "analysis": {
+ "saturation_point": {
+ "concurrency": 8,
+ "previous_concurrency": 4,
+ "rps_gain_percent": 8.03,
+ "p95_growth_ratio": 1.919
+ },
+ "observed_bottleneck": "postgres_cpu",
+ "baseline_resource_snapshot": {
+ "api": {
+ "cpu_percent_avg": 35.69,
+ "cpu_percent_max": 48.89,
+ "memory_mib_avg": 31.469,
+ "memory_mib_max": 32.855,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.667,
+ "cpu_percent_max": 2.63,
+ "memory_mib_avg": 7.369,
+ "memory_mib_max": 7.551,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 15.595,
+ "cpu_percent_max": 23.31,
+ "memory_mib_avg": 17.947,
+ "memory_mib_max": 18.25,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 84.847,
+ "cpu_percent_max": 101.91,
+ "memory_mib_avg": 280.925,
+ "memory_mib_max": 290.1,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 0.873,
+ "cpu_percent_max": 2.97,
+ "memory_mib_avg": 17.598,
+ "memory_mib_max": 20.3,
+ "containers": 1
+ }
+ },
+ "improved_resource_snapshot": {
+ "api": {
+ "cpu_percent_avg": 55.2,
+ "cpu_percent_max": 70.26,
+ "memory_mib_avg": 33.669,
+ "memory_mib_max": 36.812,
+ "containers": 4
+ },
+ "frontend": {
+ "cpu_percent_avg": 0.83,
+ "cpu_percent_max": 3.29,
+ "memory_mib_avg": 7.333,
+ "memory_mib_max": 7.43,
+ "containers": 1
+ },
+ "load-balancer": {
+ "cpu_percent_avg": 22.35,
+ "cpu_percent_max": 26.73,
+ "memory_mib_avg": 18.358,
+ "memory_mib_max": 18.99,
+ "containers": 1
+ },
+ "postgres": {
+ "cpu_percent_avg": 95.573,
+ "cpu_percent_max": 121.18,
+ "memory_mib_avg": 141.25,
+ "memory_mib_max": 147.6,
+ "containers": 1
+ },
+ "redis": {
+ "cpu_percent_avg": 0.458,
+ "cpu_percent_max": 1.35,
+ "memory_mib_avg": 16.755,
+ "memory_mib_max": 16.88,
+ "containers": 1
+ }
+ },
+ "remaining_bottleneck_after_improvement": "load_balancer_cpu",
+ "improvement": {
+ "change": "PostgreSQL CPU limit: 1.00 -> 2.00; API profile unchanged",
+ "baseline_phase": "growth-r4",
+ "improved_phase": "improved-db-cpu-r4",
+ "rps_change_percent": 33.88,
+ "p95_change_percent": -14.12,
+ "confirmed": true
+ }
+ },
+ "dataset": {
+ "before": {
+ "messages": 225626,
+ "database_size_bytes": 175406103
+ },
+ "after": {
+ "messages": 299524,
+ "database_size_bytes": 228793367
+ },
+ "warmup_successful_requests": 7749
+ },
+ "restoration": {
+ "attempted": true,
+ "succeeded": true,
+ "applied": {
+ "api": [
+ {
+ "instance": "9c029f1ecdff",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 10
+ },
+ {
+ "instance": "bd53aadefab0",
+ "cpu_limit": 0.5,
+ "memory_limit_mib": 256.0,
+ "db_max_conns": 10
+ }
+ ],
+ "postgres_cpu_limit": 1.0,
+ "postgres_memory_limit_mib": 512.0
+ }
+ },
+ "limitations": [
+ "single Docker host: replicas do not prove host-level availability",
+ "closed-loop workload has coordinated omission",
+ "successful-response latency percentiles are reported separately from failures",
+ "one measured run per profile; host scheduling noise is possible"
+ ]
+}
diff --git a/evidence/grade5/timeseries.csv b/evidence/grade5/timeseries.csv
new file mode 100644
index 00000000..6b425ada
--- /dev/null
+++ b/evidence/grade5/timeseries.csv
@@ -0,0 +1,144 @@
+phase,second,successful,failed
+saturation-c1,0,252,0
+saturation-c1,1,266,0
+saturation-c1,2,257,0
+saturation-c1,3,262,0
+saturation-c1,4,253,0
+saturation-c1,5,249,0
+saturation-c1,6,228,0
+saturation-c1,7,240,0
+saturation-c1,8,219,0
+saturation-c1,9,244,0
+saturation-c1,10,2,0
+saturation-c2,0,444,0
+saturation-c2,1,377,0
+saturation-c2,2,352,0
+saturation-c2,3,297,0
+saturation-c2,4,383,0
+saturation-c2,5,324,0
+saturation-c2,6,275,0
+saturation-c2,7,323,0
+saturation-c2,8,333,0
+saturation-c2,9,381,0
+saturation-c2,10,6,0
+saturation-c4,0,526,0
+saturation-c4,1,453,0
+saturation-c4,2,425,0
+saturation-c4,3,478,0
+saturation-c4,4,510,0
+saturation-c4,5,468,0
+saturation-c4,6,458,0
+saturation-c4,7,428,0
+saturation-c4,8,490,0
+saturation-c4,9,474,0
+saturation-c4,10,11,0
+saturation-c8,0,532,0
+saturation-c8,1,476,0
+saturation-c8,2,530,0
+saturation-c8,3,529,0
+saturation-c8,4,490,0
+saturation-c8,5,527,0
+saturation-c8,6,445,0
+saturation-c8,7,524,0
+saturation-c8,8,507,0
+saturation-c8,9,519,0
+saturation-c8,10,16,0
+saturation-c16,0,349,0
+saturation-c16,1,592,0
+saturation-c16,2,541,0
+saturation-c16,3,491,0
+saturation-c16,4,545,0
+saturation-c16,5,420,0
+saturation-c16,6,499,0
+saturation-c16,7,529,0
+saturation-c16,8,548,0
+saturation-c16,9,601,0
+saturation-c16,10,28,0
+saturation-c32,0,661,0
+saturation-c32,1,604,0
+saturation-c32,2,610,0
+saturation-c32,3,589,0
+saturation-c32,4,571,0
+saturation-c32,5,627,0
+saturation-c32,6,587,0
+saturation-c32,7,619,0
+saturation-c32,8,629,0
+saturation-c32,9,548,0
+saturation-c32,10,51,0
+fixed-r1,0,511,0
+fixed-r1,1,580,0
+fixed-r1,2,659,0
+fixed-r1,3,687,0
+fixed-r1,4,588,0
+fixed-r1,5,675,0
+fixed-r1,6,647,0
+fixed-r1,7,701,0
+fixed-r1,8,690,0
+fixed-r1,9,521,0
+fixed-r1,10,32,0
+fixed-r2,0,452,0
+fixed-r2,1,545,0
+fixed-r2,2,604,0
+fixed-r2,3,652,0
+fixed-r2,4,521,0
+fixed-r2,5,627,0
+fixed-r2,6,571,0
+fixed-r2,7,611,0
+fixed-r2,8,573,0
+fixed-r2,9,586,0
+fixed-r2,10,32,0
+fixed-r4,0,133,0
+fixed-r4,1,276,0
+fixed-r4,2,461,0
+fixed-r4,3,406,0
+fixed-r4,4,503,0
+fixed-r4,5,487,0
+fixed-r4,6,377,0
+fixed-r4,7,427,0
+fixed-r4,8,551,0
+fixed-r4,9,547,0
+fixed-r4,10,50,0
+growth-r1,0,527,0
+growth-r1,1,596,0
+growth-r1,2,604,0
+growth-r1,3,616,0
+growth-r1,4,516,0
+growth-r1,5,508,0
+growth-r1,6,606,0
+growth-r1,7,620,0
+growth-r1,8,628,0
+growth-r1,9,591,0
+growth-r1,10,32,0
+growth-r2,0,461,0
+growth-r2,1,662,0
+growth-r2,2,670,0
+growth-r2,3,655,0
+growth-r2,4,640,0
+growth-r2,5,495,0
+growth-r2,6,635,0
+growth-r2,7,626,0
+growth-r2,8,598,0
+growth-r2,9,609,0
+growth-r2,10,32,0
+growth-r4,0,106,0
+growth-r4,1,514,0
+growth-r4,2,587,0
+growth-r4,3,506,0
+growth-r4,4,423,0
+growth-r4,5,409,0
+growth-r4,6,459,0
+growth-r4,7,462,0
+growth-r4,8,618,0
+growth-r4,9,549,0
+growth-r4,10,55,0
+improved-db-cpu-r4,0,492,0
+improved-db-cpu-r4,1,583,0
+improved-db-cpu-r4,2,629,0
+improved-db-cpu-r4,3,681,0
+improved-db-cpu-r4,4,667,0
+improved-db-cpu-r4,5,632,0
+improved-db-cpu-r4,6,585,0
+improved-db-cpu-r4,7,677,0
+improved-db-cpu-r4,8,602,0
+improved-db-cpu-r4,9,629,0
+improved-db-cpu-r4,10,52,0
diff --git a/evidence/lab3-summary.md b/evidence/lab3-summary.md
new file mode 100644
index 00000000..8501342e
--- /dev/null
+++ b/evidence/lab3-summary.md
@@ -0,0 +1,104 @@
+# Lab 3 verification summary
+
+Дата проверки: 2026-10-23.
+
+Файл содержит обезличенную сводку воспроизводимых проверок. Bearer tokens,
+пароли, ключи идемпотентности, UUID пользователей/чатов/сообщений и содержимое
+локальных Docker secrets намеренно не сохранены.
+
+## Окружение
+
+- Windows + WSL2;
+- Docker Engine 29.7.2;
+- Docker Compose 5.5.0;
+- две Compose-реплики сервиса `api`;
+- единственный опубликованный endpoint: HAProxy на `127.0.0.1:8080`;
+- Nginx доступен только внутри Compose network и отдаёт статический React;
+- PostgreSQL и Redis доступны только внутри Compose network.
+
+## Статические проверки
+
+```text
+go test ./... PASS
+go test -race ./... PASS
+go vet ./... PASS
+make check PASS
+make validate PASS
+docker compose config PASS
+shell syntax for hooks PASS
+```
+
+`make validate` запускался с Python virtual environment, где установлены
+зависимости преподавательского validator.
+
+## Топология и smoke
+
+- migration 1 and migration 2 applied successfully;
+- one-shot service `migrate` exited with code 0;
+- оба API-контейнера перешли в `healthy`;
+- 20 последовательных запросов к health через LB вернули два разных
+ `X-Instance-Id`: распределение 10/10;
+- Windows PowerShell получил HTTP 200 и `X-Instance-Id` с
+ `http://localhost:8080/health/ready`;
+- преподавательский `python3 tests/smoke.py` завершился строкой
+ `PASS: lab3 public API scenario`.
+
+## Readiness-aware routing
+
+`make test-readiness-routing` добавил в network namespace одной API-реплики
+правило, запрещающее TCP-доступ к PostgreSQL, не останавливая сам процесс. Его
+`/health/ready` вернул 503; HAProxy исключил backend за 2,861 с. После этого
+40 запросов `/health/live` получили 200, а 20 корректных регистраций — 201;
+не готовая реплика не получила ни одного запроса. После удаления fault-правила
+она вернулась в ротацию. Машиночитаемый результат сохранён в
+`evidence/readiness-routing.json`.
+
+## Failover API
+
+Команда:
+
+```bash
+make test-failover ACTION_SCRIPT=./scripts/stop-one.sh
+```
+
+Наблюдение преподавательского теста:
+
+```text
+run 1:
+ observed instances before action: 2
+ successful writes / failures: 141 / 0
+ first recovery: 2.668 seconds
+run 2, after restoring the desired two replicas:
+ observed instances before action: 2
+ successful writes / failures: 142 / 0
+ first recovery: 2.653 seconds
+both results: PASS
+```
+
+После каждого запуска желаемое число реплик было восстановлено командой
+`docker compose up -d --wait api`. Hook сопоставляет `TARGET_INSTANCE_ID` с
+hostname контейнера и останавливает только выбранную API-реплику. Отдельный
+`make grade4-experiment` целенаправленно остановил обе исходные реплики по
+очереди: 7853/0 и 7970/0 успешных/ошибочных запросов, recovery 2,893/2,938 с.
+
+## Persistence и идемпотентность
+
+- `make test-persistence ACTION_SCRIPT=./scripts/restart.sh`: PASS; после
+ рестарта PostgreSQL, Redis, всех API-реплик, frontend и HAProxy прежние bearer session и
+ созданные данные сохранились;
+- 32 конкурентных POST сообщения с одинаковыми semantic payload и
+ `Idempotency-Key` через HAProxy вернули один Message ID;
+- прямой запрос PostgreSQL подтвердил ровно одну строку сообщения;
+- повтор с тем же scope/key и другим payload возвращает HTTP 409.
+
+## Негативные и browser-security проверки
+
+- сырой `Authorization: Bearer` с UTF-8 `é` вернул 401, Bearer challenge и
+ стандартный `Error`; процесс не завершился с panic/500;
+- тело JSON из одного байта `FF` вернуло 400 `invalid_request`, а
+ `error.request_id` совпал с `X-Request-Id`;
+- login установил host-only `HttpOnly; SameSite=Strict` cookie;
+- cookie без Bearer на контрактном `/api/v1/users/me` дала 401, через
+ `/web-api/v1/users/me` — 200;
+- logout через `/web-api` вернул 204 и инвалидировал серверную сессию;
+- статический frontend вернул 200 и `Content-Security-Policy`.
diff --git a/evidence/readiness-routing.json b/evidence/readiness-routing.json
new file mode 100644
index 00000000..abb6ab7f
--- /dev/null
+++ b/evidence/readiness-routing.json
@@ -0,0 +1,11 @@
+{
+ "target_instance": "bd53aadefab0",
+ "detection_seconds": 2.861,
+ "health_requests": {
+ "200": 40
+ },
+ "registration_requests": {
+ "201": 20
+ },
+ "recovered": true
+}
diff --git a/frontend/.dockerignore b/frontend/.dockerignore
new file mode 100644
index 00000000..0e75fe55
--- /dev/null
+++ b/frontend/.dockerignore
@@ -0,0 +1,3 @@
+node_modules
+dist
+coverage
diff --git a/frontend/index.html b/frontend/index.html
new file mode 100644
index 00000000..74b8e760
--- /dev/null
+++ b/frontend/index.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+ MTUCI Messenger
+
+
+
+
+
+
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
new file mode 100644
index 00000000..556c03bd
--- /dev/null
+++ b/frontend/package-lock.json
@@ -0,0 +1,1688 @@
+{
+ "name": "mtusi-messenger-web",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "mtusi-messenger-web",
+ "version": "0.1.0",
+ "dependencies": {
+ "@tanstack/react-query": "^5.104.5",
+ "lucide-react": "^1.61.0",
+ "react": "^19.3.1",
+ "react-dom": "^19.3.1",
+ "react-router-dom": "^7.18.4"
+ },
+ "devDependencies": {
+ "@types/react": "^19.3.0",
+ "@types/react-dom": "^19.3.0",
+ "@vitejs/plugin-react": "^6.1.2",
+ "typescript": "^7.0.2",
+ "vite": "^8.3.5",
+ "vitest": "^5.0.5"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz",
+ "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@oxc-project/types": {
+ "version": "0.155.0",
+ "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.155.0.tgz",
+ "integrity": "sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/oxc-project"
+ }
+ },
+ "node_modules/@rolldown/binding-android-arm-eabi": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.15.tgz",
+ "integrity": "sha512-aLcgK9gIJ3YRvrrtfSBbRa27F5WrpiTaPulnFpsHPxpUHgFlSgnU4854MHwoRGEBhfRJDWCS2WQ7lIjskE9Olw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-android-arm64": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.15.tgz",
+ "integrity": "sha512-xD7DdZCrbThKuxNg7ooQmvp07ys4J/pnSEMTG3/OdOWl6daC67m/Q4fL78sRHMxTH/N4fGUbYhcPM0MF5WFHkg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-darwin-arm64": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.15.tgz",
+ "integrity": "sha512-m2WuQ6r0B4OTYxyPpNLtXaMRbRDUbG8YQV2Q3KTdSSK8Th6KHCnC8jVCJt8bvYeSB5WivkkNbc85mKadaSdOxA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-darwin-x64": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.15.tgz",
+ "integrity": "sha512-5RtnsHM36nodM9WbMy+zip0LGS/G+y5wro5RHrpOlr4ac24+1zSi9kiV2MP1myZeZ/ifEHfulQcWjnAXzc2C2A==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-freebsd-x64": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.15.tgz",
+ "integrity": "sha512-g3l09pyFqhu+135JKkbkwiKGQmwU5hUMUPJ4VdBADvuqR8d33L6H578rh8m7rtxbdp+VmX/+nzI7nvhSZlzpUQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm-gnueabihf": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.15.tgz",
+ "integrity": "sha512-nIe3VugI97nGQtspPxDqA4sXMUpeiocKIP/CqpY/u/vgbT+alX+cVxu1C/oVBPKg4feNTmYovE91v4DgXvXNwQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm64-gnu": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.15.tgz",
+ "integrity": "sha512-iTBjXx+B5QSvgI89lJfmqh4wTh8NabR1YZIIN3hNx4zSG0EVfVqkOvLulNpG4251pbd6/IAmZ/LefVk1Y4rPhw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm64-musl": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.15.tgz",
+ "integrity": "sha512-uN26XOnVR7rqQupG3V9oAG2EGGatWjcJHOeDOHUFCh4TBWmP2tHTFoVN13aYbwfm0aHqJAEmcwhAu6sooIjfqQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-ppc64-gnu": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.15.tgz",
+ "integrity": "sha512-9nWkcdd+H+XhaA3fQIwpHnKIrfx/PQ6rO0pivr78Og07tXlUlctBBJoEYLPfhTmCR/QxEVdn6uPjHV5SymPhdw==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-s390x-gnu": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.15.tgz",
+ "integrity": "sha512-Ggh0ciFjLwIusLSLz7LZYEaGdxOAUJXI+Qu5JCbhPJJHEt8vP+IjRATTJheiJsdzzTYgUiHUiw3X1Ea3ZpMBdA==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-x64-gnu": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.15.tgz",
+ "integrity": "sha512-FHg60rS6DBePAYZ9X9F67x+JObFdmgn6tupA1C/a3B+CufFmTD4mX+e8M75tCiAO3foR/6xwVBI0KQiI7sn/rw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-x64-musl": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.15.tgz",
+ "integrity": "sha512-/cvV/7v5VGz/moiz0XKRj2dE8DzsKyhIu1KpOvJGPjRywg3yscON889UGvAe8zfiJLHup7VLjBduoGWi3HusWQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-openharmony-arm64": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.15.tgz",
+ "integrity": "sha512-MyzC5Hrv/sm+Z7TSGKP/j8001RO2xQm1zOpCNVL4j0cY/VhBZviludA2YFQ7i4lH6ZAXxQm0lcMdBzM+99mE7w==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-win32-arm64-msvc": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.15.tgz",
+ "integrity": "sha512-+PgYiS+AH5omy6L45ZLxybasauJaj3M8buoT83D+nzPmCayXlxUV9hydhciCKVyIg0B/v0BtXPDE1uGqNwCPpg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-win32-x64-msvc": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.15.tgz",
+ "integrity": "sha512-HFZd2QNQYn1JbIi+Hpd7H+r/lkWxcfIu28nirZ6eCn2LafuvmExMlb/P96Sfx5tf7pPArw39IdhmCF8vmV+NhQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/pluginutils": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",
+ "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@tanstack/query-core": {
+ "version": "5.104.5",
+ "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.104.5.tgz",
+ "integrity": "sha512-Q94gI8Opd+CbdVNOdj8ZCyV8WqLYitrDq1t96Xc8WZT6lY0r5iRnJLXYDxMex7EEf2v+mXvn4FcjaBKSxXZQ9A==",
+ "license": "MIT",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/tannerlinsley"
+ }
+ },
+ "node_modules/@tanstack/react-query": {
+ "version": "5.104.5",
+ "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.104.5.tgz",
+ "integrity": "sha512-RORgFe052U+93weaNuqg7qHq7vNVNzXN/VrXqD4bbAuQCWUqOl2lV5Ui9flWk5CVvMyL/Bh27QWhzwH0aaOx9g==",
+ "license": "MIT",
+ "dependencies": {
+ "@tanstack/query-core": "5.104.5"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/tannerlinsley"
+ },
+ "peerDependencies": {
+ "@types/react": "^18 || ^19",
+ "react": "^18 || ^19"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@types/chai": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
+ "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/deep-eql": "*",
+ "assertion-error": "^2.0.1"
+ }
+ },
+ "node_modules/@types/deep-eql": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
+ "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
+ "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/react": {
+ "version": "19.3.0",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz",
+ "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "csstype": "^3.2.2"
+ }
+ },
+ "node_modules/@types/react-dom": {
+ "version": "19.3.0",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz",
+ "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "^19.3.0"
+ }
+ },
+ "node_modules/@typescript/typescript-aix-ppc64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz",
+ "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-darwin-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz",
+ "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-darwin-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz",
+ "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-freebsd-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz",
+ "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-freebsd-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz",
+ "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-arm": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz",
+ "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz",
+ "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-loong64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz",
+ "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-mips64el": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz",
+ "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-ppc64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz",
+ "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-riscv64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz",
+ "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-s390x": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz",
+ "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-linux-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz",
+ "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-netbsd-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz",
+ "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-netbsd-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz",
+ "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-openbsd-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz",
+ "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-openbsd-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz",
+ "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-sunos-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz",
+ "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-win32-arm64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz",
+ "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@typescript/typescript-win32-x64": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz",
+ "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=16.20.0"
+ }
+ },
+ "node_modules/@vitejs/plugin-react": {
+ "version": "6.1.2",
+ "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.1.2.tgz",
+ "integrity": "sha512-fhJNGUdscQa4HkI0xFxwonWyhnVReCPDbXI7FH7jmzpnVCrFQI7PRrhWecO263610vOrs9tr2Y4xcf8uAdFxbw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@rolldown/pluginutils": "^1.0.1"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "peerDependencies": {
+ "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0",
+ "babel-plugin-react-compiler": "^1.0.0",
+ "oxc-transform-react": "^0.152.0",
+ "vite": "^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@rolldown/plugin-babel": {
+ "optional": true
+ },
+ "babel-plugin-react-compiler": {
+ "optional": true
+ },
+ "oxc-transform-react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@vitest/mocker": {
+ "version": "5.0.5",
+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz",
+ "integrity": "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/trace-mapping": "0.3.31",
+ "@vitest/spy": "5.0.5",
+ "estree-walker": "^3.0.3",
+ "magic-string": "^1.4.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "msw": "^2.4.9 || ^3.0.0",
+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "msw": {
+ "optional": true
+ },
+ "vite": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@vitest/spy": {
+ "version": "5.0.5",
+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.5.tgz",
+ "integrity": "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/assertion-error": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/chai": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz",
+ "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz",
+ "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/csstype": {
+ "version": "3.2.3",
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
+ "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/detect-libc": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/es-module-lexer": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz",
+ "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/estree-walker": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "^1.0.0"
+ }
+ },
+ "node_modules/expect-type": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz",
+ "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
+ "node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/lightningcss": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",
+ "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",
+ "dev": true,
+ "license": "MPL-2.0",
+ "dependencies": {
+ "detect-libc": "^2.0.3"
+ },
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ },
+ "optionalDependencies": {
+ "lightningcss-android-arm64": "1.33.0",
+ "lightningcss-darwin-arm64": "1.33.0",
+ "lightningcss-darwin-x64": "1.33.0",
+ "lightningcss-freebsd-x64": "1.33.0",
+ "lightningcss-linux-arm-gnueabihf": "1.33.0",
+ "lightningcss-linux-arm64-gnu": "1.33.0",
+ "lightningcss-linux-arm64-musl": "1.33.0",
+ "lightningcss-linux-x64-gnu": "1.33.0",
+ "lightningcss-linux-x64-musl": "1.33.0",
+ "lightningcss-win32-arm64-msvc": "1.33.0",
+ "lightningcss-win32-x64-msvc": "1.33.0"
+ }
+ },
+ "node_modules/lightningcss-android-arm64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz",
+ "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-darwin-arm64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",
+ "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-darwin-x64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",
+ "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-freebsd-x64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",
+ "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm-gnueabihf": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",
+ "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm64-gnu": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",
+ "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm64-musl": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",
+ "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-x64-gnu": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",
+ "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-x64-musl": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",
+ "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-win32-arm64-msvc": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",
+ "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-win32-x64-msvc": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",
+ "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lucide-react": {
+ "version": "1.61.0",
+ "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.61.0.tgz",
+ "integrity": "sha512-v2SQPPPNjnr+BlhL9Spuzmo5yR+hLkftfuE4E3jaxdNPgSH0hJKPcLJBP7yAta87jQNPsSERS59PJjCJ/CorBA==",
+ "license": "ISC",
+ "peerDependencies": {
+ "@types/react": "*",
+ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/magic-string": {
+ "version": "1.4.3",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz",
+ "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.6.0"
+ }
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.20",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
+ "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/obug": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz",
+ "integrity": "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==",
+ "dev": true,
+ "funding": [
+ "https://github.com/sponsors/sxzz",
+ "https://opencollective.com/debug"
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/picomatch": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
+ "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/postcss": {
+ "version": "8.5.31",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.31.tgz",
+ "integrity": "sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.20",
+ "picocolors": "^1.1.1",
+ "source-map-js": "^1.2.2"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/react": {
+ "version": "19.3.1",
+ "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz",
+ "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/react-dom": {
+ "version": "19.3.1",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz",
+ "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==",
+ "license": "MIT",
+ "dependencies": {
+ "scheduler": "^0.28.0"
+ },
+ "peerDependencies": {
+ "react": "^19.3.1"
+ }
+ },
+ "node_modules/react-router": {
+ "version": "7.18.4",
+ "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.4.tgz",
+ "integrity": "sha512-PUPQcMhMGRAslLcvtlPz/kmzBEWPhLdgLFrL7pLNepBL6dX0lWj4WD2cUYVgYCuT3jxvghYFg81cDTj44DhetQ==",
+ "license": "MIT",
+ "dependencies": {
+ "cookie": "^1.0.1",
+ "set-cookie-parser": "^2.6.0"
+ },
+ "engines": {
+ "node": ">=20.0.0"
+ },
+ "peerDependencies": {
+ "react": ">=18",
+ "react-dom": ">=18"
+ },
+ "peerDependenciesMeta": {
+ "react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/react-router-dom": {
+ "version": "7.18.4",
+ "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.18.4.tgz",
+ "integrity": "sha512-yrfmJHIpDG7taCpqKjT1G5B6q3O2K+RN8/fgNf0lTjCwiPbQ0ei6vXX9ZjQR+7ld8Tr7Z5xmyMnZ8YJrphWQUw==",
+ "license": "MIT",
+ "dependencies": {
+ "react-router": "7.18.4"
+ },
+ "engines": {
+ "node": ">=20.0.0"
+ },
+ "peerDependencies": {
+ "react": ">=18",
+ "react-dom": ">=18"
+ }
+ },
+ "node_modules/rolldown": {
+ "version": "1.2.15",
+ "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.15.tgz",
+ "integrity": "sha512-6odND+fel5zVw3I4Yc2e69gvguDnX0CAAGiNDZSq4ik5WUcaLrkD2GLuog0XcODbor31hZ5ayEMgVDno+KPV5g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@oxc-project/types": "=0.155.0",
+ "@rolldown/pluginutils": "^1.0.0"
+ },
+ "bin": {
+ "rolldown": "bin/cli.mjs"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "optionalDependencies": {
+ "@rolldown/binding-android-arm-eabi": "1.2.15",
+ "@rolldown/binding-android-arm64": "1.2.15",
+ "@rolldown/binding-darwin-arm64": "1.2.15",
+ "@rolldown/binding-darwin-x64": "1.2.15",
+ "@rolldown/binding-freebsd-x64": "1.2.15",
+ "@rolldown/binding-linux-arm-gnueabihf": "1.2.15",
+ "@rolldown/binding-linux-arm64-gnu": "1.2.15",
+ "@rolldown/binding-linux-arm64-musl": "1.2.15",
+ "@rolldown/binding-linux-ppc64-gnu": "1.2.15",
+ "@rolldown/binding-linux-s390x-gnu": "1.2.15",
+ "@rolldown/binding-linux-x64-gnu": "1.2.15",
+ "@rolldown/binding-linux-x64-musl": "1.2.15",
+ "@rolldown/binding-openharmony-arm64": "1.2.15",
+ "@rolldown/binding-win32-arm64-msvc": "1.2.15",
+ "@rolldown/binding-win32-x64-msvc": "1.2.15"
+ }
+ },
+ "node_modules/scheduler": {
+ "version": "0.28.0",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz",
+ "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==",
+ "license": "MIT"
+ },
+ "node_modules/set-cookie-parser": {
+ "version": "2.7.2",
+ "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz",
+ "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==",
+ "license": "MIT"
+ },
+ "node_modules/source-map-js": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
+ "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/std-env": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz",
+ "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tinybench": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.2.tgz",
+ "integrity": "sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=20.0.0"
+ }
+ },
+ "node_modules/tinyexec": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz",
+ "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/tinyglobby": {
+ "version": "0.2.17",
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.4"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/SuperchupuDev"
+ }
+ },
+ "node_modules/typescript": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz",
+ "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc"
+ },
+ "engines": {
+ "node": ">=16.20.0"
+ },
+ "optionalDependencies": {
+ "@typescript/typescript-aix-ppc64": "7.0.2",
+ "@typescript/typescript-darwin-arm64": "7.0.2",
+ "@typescript/typescript-darwin-x64": "7.0.2",
+ "@typescript/typescript-freebsd-arm64": "7.0.2",
+ "@typescript/typescript-freebsd-x64": "7.0.2",
+ "@typescript/typescript-linux-arm": "7.0.2",
+ "@typescript/typescript-linux-arm64": "7.0.2",
+ "@typescript/typescript-linux-loong64": "7.0.2",
+ "@typescript/typescript-linux-mips64el": "7.0.2",
+ "@typescript/typescript-linux-ppc64": "7.0.2",
+ "@typescript/typescript-linux-riscv64": "7.0.2",
+ "@typescript/typescript-linux-s390x": "7.0.2",
+ "@typescript/typescript-linux-x64": "7.0.2",
+ "@typescript/typescript-netbsd-arm64": "7.0.2",
+ "@typescript/typescript-netbsd-x64": "7.0.2",
+ "@typescript/typescript-openbsd-arm64": "7.0.2",
+ "@typescript/typescript-openbsd-x64": "7.0.2",
+ "@typescript/typescript-sunos-x64": "7.0.2",
+ "@typescript/typescript-win32-arm64": "7.0.2",
+ "@typescript/typescript-win32-x64": "7.0.2"
+ }
+ },
+ "node_modules/vite": {
+ "version": "8.3.5",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.5.tgz",
+ "integrity": "sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "lightningcss": "^1.33.0",
+ "picomatch": "^4.0.7",
+ "postcss": "^8.5.30",
+ "rolldown": "~1.2.14",
+ "tinyglobby": "^0.2.17"
+ },
+ "bin": {
+ "vite": "bin/vite.js"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/vitejs/vite?sponsor=1"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ },
+ "peerDependencies": {
+ "@types/node": "^20.19.0 || >=22.12.0",
+ "@vitejs/devtools": "^0.7.1 || ^0.8.0",
+ "esbuild": "^0.27.0 || ^0.28.0",
+ "jiti": ">=1.21.0",
+ "less": "^4.0.0",
+ "sass": "^1.70.0",
+ "sass-embedded": "^1.70.0",
+ "stylus": ">=0.54.8",
+ "sugarss": "^5.0.0",
+ "terser": "^5.16.0",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "@vitejs/devtools": {
+ "optional": true
+ },
+ "esbuild": {
+ "optional": true
+ },
+ "jiti": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "sass-embedded": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "terser": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/vitest": {
+ "version": "5.0.5",
+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.5.tgz",
+ "integrity": "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/chai": "^5.2.2",
+ "@vitest/mocker": "5.0.5",
+ "chai": "^6.3.0",
+ "es-module-lexer": "^2.3.2",
+ "expect-type": "^1.4.0",
+ "magic-string": "^1.4.3",
+ "obug": "^3.0.0",
+ "picomatch": "^4.0.7",
+ "std-env": "^4.3.0",
+ "tinybench": "^6.2.2",
+ "tinyexec": "^1.3.1",
+ "tinyglobby": "^0.2.17",
+ "why-is-node-running": "3.2.1"
+ },
+ "bin": {
+ "vitest": "vitest.mjs"
+ },
+ "engines": {
+ "node": "^22.12.0 || ^24.0.0 || >=26.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "@edge-runtime/vm": "*",
+ "@opentelemetry/api": "^1.9.0",
+ "@types/node": "^22.0.0 || >=24.0.0",
+ "@vitest/browser-playwright": "5.0.5",
+ "@vitest/browser-preview": "5.0.5",
+ "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
+ "@vitest/coverage-istanbul": "5.0.5",
+ "@vitest/coverage-v8": "5.0.5",
+ "@vitest/ui": "5.0.5",
+ "happy-dom": "*",
+ "jsdom": "*",
+ "vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@edge-runtime/vm": {
+ "optional": true
+ },
+ "@opentelemetry/api": {
+ "optional": true
+ },
+ "@types/node": {
+ "optional": true
+ },
+ "@vitest/browser-playwright": {
+ "optional": true
+ },
+ "@vitest/browser-preview": {
+ "optional": true
+ },
+ "@vitest/browser-webdriverio": {
+ "optional": true
+ },
+ "@vitest/coverage-istanbul": {
+ "optional": true
+ },
+ "@vitest/coverage-v8": {
+ "optional": true
+ },
+ "@vitest/ui": {
+ "optional": true
+ },
+ "happy-dom": {
+ "optional": true
+ },
+ "jsdom": {
+ "optional": true
+ },
+ "vite": {
+ "optional": false
+ }
+ }
+ },
+ "node_modules/why-is-node-running": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz",
+ "integrity": "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "why-is-node-running": "cli.js"
+ },
+ "engines": {
+ "node": ">=20.11"
+ }
+ }
+ }
+}
diff --git a/frontend/package.json b/frontend/package.json
new file mode 100644
index 00000000..8f151c3e
--- /dev/null
+++ b/frontend/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "mtusi-messenger-web",
+ "private": true,
+ "version": "0.1.0",
+ "type": "module",
+ "scripts": {
+ "dev": "vite --host 0.0.0.0",
+ "build": "tsc -b && vite build",
+ "test": "vitest run",
+ "test:watch": "vitest"
+ },
+ "dependencies": {
+ "@tanstack/react-query": "^5.104.5",
+ "lucide-react": "^1.61.0",
+ "react": "^19.3.1",
+ "react-dom": "^19.3.1",
+ "react-router-dom": "^7.18.4"
+ },
+ "devDependencies": {
+ "@types/react": "^19.3.0",
+ "@types/react-dom": "^19.3.0",
+ "@vitejs/plugin-react": "^6.1.2",
+ "typescript": "^7.0.2",
+ "vite": "^8.3.5",
+ "vitest": "^5.0.5"
+ }
+}
diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts
new file mode 100644
index 00000000..9a227eb8
--- /dev/null
+++ b/frontend/src/api/client.ts
@@ -0,0 +1,158 @@
+import type {
+ ApiErrorBody,
+ Chat,
+ CreateChatInput,
+ LoginInput,
+ Message,
+ Page,
+ RegisterInput,
+ Session,
+ User,
+} from "./types";
+
+const publicApi = "/api/v1";
+const browserApi = "/web-api/v1";
+
+export class ApiError extends Error {
+ readonly status: number;
+ readonly code?: string;
+ readonly requestId?: string;
+
+ constructor(status: number, body: ApiErrorBody) {
+ super(body.error?.message || `HTTP ${status}`);
+ this.name = "ApiError";
+ this.status = status;
+ this.code = body.error?.code;
+ this.requestId = body.error?.request_id;
+ }
+}
+
+type RequestOptions = Omit & {
+ body?: unknown;
+};
+
+async function request(path: string, options: RequestOptions = {}): Promise {
+ const headers = new Headers(options.headers);
+ if (options.body !== undefined) {
+ headers.set("Content-Type", "application/json");
+ }
+
+ const response = await fetch(path, {
+ ...options,
+ headers,
+ credentials: "same-origin",
+ body: options.body === undefined ? undefined : JSON.stringify(options.body),
+ });
+
+ if (!response.ok) {
+ let body: ApiErrorBody = {};
+ try {
+ body = (await response.json()) as ApiErrorBody;
+ } catch {
+ // Preserve a useful HTTP-level error when a proxy returned non-JSON.
+ }
+ throw new ApiError(response.status, body);
+ }
+
+ if (response.status === 204) {
+ return undefined as T;
+ }
+ return (await response.json()) as T;
+}
+
+function encodeBasic({ username, password }: LoginInput): string {
+ const bytes = new TextEncoder().encode(`${username}:${password}`);
+ let binary = "";
+ for (const byte of bytes) {
+ binary += String.fromCharCode(byte);
+ }
+ return btoa(binary);
+}
+
+async function collectPages(path: string): Promise {
+ const items: T[] = [];
+ let cursor: string | null = null;
+
+ for (let pageIndex = 0; pageIndex < 100; pageIndex += 1) {
+ const search = new URLSearchParams({ limit: "100" });
+ if (cursor) {
+ search.set("cursor", cursor);
+ }
+ const page = await request>(`${path}?${search.toString()}`);
+ items.push(...page.items);
+ cursor = page.next_cursor;
+ if (!cursor) {
+ return items;
+ }
+ }
+ throw new Error("pagination safety limit exceeded");
+}
+
+export const api = {
+ register(input: RegisterInput): Promise {
+ return request(`${publicApi}/users`, {
+ method: "POST",
+ body: {
+ username: input.username,
+ display_name: input.displayName,
+ password: input.password,
+ },
+ });
+ },
+
+ login(input: LoginInput): Promise {
+ return request(`${publicApi}/auth/sessions`, {
+ method: "POST",
+ headers: {
+ Authorization: `Basic ${encodeBasic(input)}`,
+ },
+ });
+ },
+
+ logout(): Promise {
+ return request(`${browserApi}/auth/sessions/current`, {
+ method: "DELETE",
+ });
+ },
+
+ me(): Promise {
+ return request(`${browserApi}/users/me`);
+ },
+
+ chats(): Promise {
+ return collectPages(`${browserApi}/chats`);
+ },
+
+ chat(chatID: string): Promise {
+ return request(`${browserApi}/chats/${encodeURIComponent(chatID)}`);
+ },
+
+ createChat(input: CreateChatInput): Promise {
+ return request(`${browserApi}/chats`, {
+ method: "POST",
+ body: {
+ title: input.title,
+ member_ids: input.memberIds,
+ },
+ });
+ },
+
+ messages(chatID: string): Promise {
+ return collectPages(
+ `${browserApi}/chats/${encodeURIComponent(chatID)}/messages`,
+ );
+ },
+
+ sendMessage(chatID: string, text: string, idempotencyKey: string): Promise {
+ return request(
+ `${browserApi}/chats/${encodeURIComponent(chatID)}/messages`,
+ {
+ method: "POST",
+ headers: {
+ "Idempotency-Key": idempotencyKey,
+ },
+ body: { text },
+ },
+ );
+ },
+};
diff --git a/frontend/src/api/types.ts b/frontend/src/api/types.ts
new file mode 100644
index 00000000..21283d89
--- /dev/null
+++ b/frontend/src/api/types.ts
@@ -0,0 +1,57 @@
+export type User = {
+ id: string;
+ username: string;
+ display_name: string;
+ created_at: string;
+};
+
+export type Session = {
+ token: string;
+ token_type: "Bearer";
+ expires_at: string;
+ user: User;
+};
+
+export type Chat = {
+ id: string;
+ title: string;
+ member_ids: string[];
+ created_at: string;
+};
+
+export type Message = {
+ id: string;
+ chat_id: string;
+ sender_id: string;
+ text: string;
+ created_at: string;
+};
+
+export type Page = {
+ items: T[];
+ next_cursor: string | null;
+};
+
+export type ApiErrorBody = {
+ error?: {
+ code?: string;
+ message?: string;
+ request_id?: string;
+ };
+};
+
+export type RegisterInput = {
+ username: string;
+ displayName: string;
+ password: string;
+};
+
+export type CreateChatInput = {
+ title: string;
+ memberIds: string[];
+};
+
+export type LoginInput = {
+ username: string;
+ password: string;
+};
diff --git a/frontend/src/app/App.tsx b/frontend/src/app/App.tsx
new file mode 100644
index 00000000..c6aa7aed
--- /dev/null
+++ b/frontend/src/app/App.tsx
@@ -0,0 +1,51 @@
+import { Navigate, Outlet, Route, Routes, useLocation } from "react-router-dom";
+
+import { useAuth } from "../auth/AuthProvider";
+import { LoadingScreen } from "../components/LoadingScreen";
+import { AuthPage } from "../pages/AuthPage";
+import { MessengerPage } from "../pages/MessengerPage";
+
+function ProtectedRoute() {
+ const { user, isLoading } = useAuth();
+ const location = useLocation();
+
+ if (isLoading) {
+ return ;
+ }
+ if (!user) {
+ return ;
+ }
+ return ;
+}
+
+function PublicOnlyRoute() {
+ const { user, isLoading } = useAuth();
+
+ if (isLoading) {
+ return ;
+ }
+ if (user) {
+ return ;
+ }
+ return ;
+}
+
+export function App() {
+ return (
+
+ }>
+ } />
+ } />
+
+
+ }>
+ } />
+ } />
+ } />
+
+
+ } />
+ } />
+
+ );
+}
diff --git a/frontend/src/assets/chat-background.jpg b/frontend/src/assets/chat-background.jpg
new file mode 100644
index 00000000..899884b3
Binary files /dev/null and b/frontend/src/assets/chat-background.jpg differ
diff --git a/frontend/src/auth/AuthProvider.tsx b/frontend/src/auth/AuthProvider.tsx
new file mode 100644
index 00000000..5154fad7
--- /dev/null
+++ b/frontend/src/auth/AuthProvider.tsx
@@ -0,0 +1,90 @@
+import { useQuery, useQueryClient } from "@tanstack/react-query";
+import {
+ createContext,
+ useCallback,
+ useContext,
+ type PropsWithChildren,
+} from "react";
+
+import { api, ApiError } from "../api/client";
+import type { LoginInput, RegisterInput, User } from "../api/types";
+
+type AuthContextValue = {
+ user: User | null;
+ isLoading: boolean;
+ login: (input: LoginInput) => Promise;
+ register: (input: RegisterInput) => Promise;
+ logout: () => Promise;
+};
+
+const AuthContext = createContext(null);
+const meQueryKey = ["current-user"] as const;
+
+async function loadCurrentUser(): Promise {
+ try {
+ return await api.me();
+ } catch (error) {
+ if (error instanceof ApiError && error.status === 401) {
+ return null;
+ }
+ throw error;
+ }
+}
+
+export function AuthProvider({ children }: PropsWithChildren) {
+ const queryClient = useQueryClient();
+ const meQuery = useQuery({
+ queryKey: meQueryKey,
+ queryFn: loadCurrentUser,
+ retry: false,
+ staleTime: 30_000,
+ });
+
+ const login = useCallback(
+ async (input: LoginInput) => {
+ const session = await api.login(input);
+ queryClient.setQueryData(meQueryKey, session.user);
+ },
+ [queryClient],
+ );
+
+ const register = useCallback(
+ async (input: RegisterInput) => {
+ await api.register(input);
+ const session = await api.login({
+ username: input.username,
+ password: input.password,
+ });
+ queryClient.setQueryData(meQueryKey, session.user);
+ },
+ [queryClient],
+ );
+
+ const logout = useCallback(async () => {
+ await api.logout();
+ queryClient.setQueryData(meQueryKey, null);
+ queryClient.removeQueries({ queryKey: ["chats"] });
+ }, [queryClient]);
+
+ return (
+
+ {children}
+
+ );
+}
+
+export function useAuth(): AuthContextValue {
+ const context = useContext(AuthContext);
+ if (!context) {
+ throw new Error("useAuth must be used within AuthProvider");
+ }
+ return context;
+}
diff --git a/frontend/src/components/Avatar.tsx b/frontend/src/components/Avatar.tsx
new file mode 100644
index 00000000..6fd07fb6
--- /dev/null
+++ b/frontend/src/components/Avatar.tsx
@@ -0,0 +1,26 @@
+import { initials } from "../lib/format";
+
+type AvatarProps = {
+ label: string;
+ seed?: string;
+ size?: "small" | "medium" | "large";
+};
+
+function tone(seed: string): number {
+ let hash = 0;
+ for (const character of seed) {
+ hash = (hash * 31 + character.codePointAt(0)!) >>> 0;
+ }
+ return hash % 5;
+}
+
+export function Avatar({ label, seed = label, size = "medium" }: AvatarProps) {
+ return (
+
+ {initials(label)}
+
+ );
+}
diff --git a/frontend/src/components/ChatList.tsx b/frontend/src/components/ChatList.tsx
new file mode 100644
index 00000000..1426d013
--- /dev/null
+++ b/frontend/src/components/ChatList.tsx
@@ -0,0 +1,121 @@
+import { MessageSquarePlus, Search, UsersRound, X } from "lucide-react";
+import { useMemo, useState } from "react";
+import { useNavigate } from "react-router-dom";
+
+import type { Chat, User } from "../api/types";
+import { formatMemberCount } from "../lib/format";
+import { Avatar } from "./Avatar";
+
+type ChatListProps = {
+ chats: Chat[];
+ currentUser: User;
+ error: boolean;
+ isLoading: boolean;
+ selectedChatID?: string;
+ onCreateChat: () => void;
+};
+
+export function ChatList({
+ chats,
+ currentUser,
+ error,
+ isLoading,
+ selectedChatID,
+ onCreateChat,
+}: ChatListProps) {
+ const navigate = useNavigate();
+ const [search, setSearch] = useState("");
+
+ const filteredChats = useMemo(() => {
+ const normalized = search.trim().toLocaleLowerCase("ru");
+ if (!normalized) {
+ return chats;
+ }
+ return chats.filter((chat) =>
+ chat.title.toLocaleLowerCase("ru").includes(normalized),
+ );
+ }, [chats, search]);
+
+ return (
+
+ );
+}
diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsx
new file mode 100644
index 00000000..64ffaad6
--- /dev/null
+++ b/frontend/src/components/ChatView.tsx
@@ -0,0 +1,236 @@
+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import {
+ ArrowLeft,
+ CheckCheck,
+ RefreshCcw,
+ Send,
+ ShieldCheck,
+ UsersRound,
+} from "lucide-react";
+import {
+ useEffect,
+ useMemo,
+ useRef,
+ useState,
+ type FormEvent,
+ type KeyboardEvent,
+} from "react";
+
+import { api } from "../api/client";
+import type { Chat, Message, User } from "../api/types";
+import {
+ dayKey,
+ formatDay,
+ formatMemberCount,
+ formatMessageTime,
+ shortID,
+} from "../lib/format";
+import { createIdempotencyKey } from "../lib/idempotency";
+import { Avatar } from "./Avatar";
+
+type ChatViewProps = {
+ chat: Chat;
+ currentUser: User;
+ onBack: () => void;
+};
+
+type SendEnvelope = {
+ text: string;
+ idempotencyKey: string;
+};
+
+export function ChatView({ chat, currentUser, onBack }: ChatViewProps) {
+ const queryClient = useQueryClient();
+ const messagesEnd = useRef(null);
+ const [draft, setDraft] = useState("");
+ const [failedEnvelope, setFailedEnvelope] = useState(null);
+
+ const messagesQuery = useQuery({
+ queryKey: ["messages", chat.id],
+ queryFn: () => api.messages(chat.id),
+ refetchInterval: 3_000,
+ staleTime: 1_000,
+ });
+
+ const messages = messagesQuery.data ?? [];
+
+ useEffect(() => {
+ messagesEnd.current?.scrollIntoView({
+ behavior: messages.length > 1 ? "smooth" : "auto",
+ block: "end",
+ });
+ }, [chat.id, messages.length]);
+
+ const mutation = useMutation({
+ mutationFn: (envelope: SendEnvelope) =>
+ api.sendMessage(chat.id, envelope.text, envelope.idempotencyKey),
+ onSuccess: (message) => {
+ setFailedEnvelope(null);
+ queryClient.setQueryData(
+ ["messages", chat.id],
+ (current = []) => {
+ if (current.some((item) => item.id === message.id)) {
+ return current;
+ }
+ return [...current, message];
+ },
+ );
+ },
+ onError: (_error, envelope) => {
+ setFailedEnvelope(envelope);
+ },
+ });
+
+ const groups = useMemo(() => {
+ const result: Array<{ key: string; label: string; messages: Message[] }> = [];
+ for (const message of messages) {
+ const key = dayKey(message.created_at);
+ const current = result.at(-1);
+ if (!current || current.key !== key) {
+ result.push({
+ key,
+ label: formatDay(message.created_at),
+ messages: [message],
+ });
+ } else {
+ current.messages.push(message);
+ }
+ }
+ return result;
+ }, [messages]);
+
+ function send(envelope: SendEnvelope) {
+ if (!mutation.isPending) {
+ mutation.mutate(envelope);
+ }
+ }
+
+ function submit(event: FormEvent) {
+ event.preventDefault();
+ const text = draft.trim();
+ if (!text || Array.from(text).length > 4_000) {
+ return;
+ }
+ const envelope = { text, idempotencyKey: createIdempotencyKey() };
+ setDraft("");
+ setFailedEnvelope(null);
+ send(envelope);
+ }
+
+ function handleKeyDown(event: KeyboardEvent) {
+ if (event.key === "Enter" && !event.shiftKey) {
+ event.preventDefault();
+ event.currentTarget.form?.requestSubmit();
+ }
+ }
+
+ return (
+
+
+
+
+
+
+ {messagesQuery.isLoading && (
+
+
+ Загружаем историю
+
+ )}
+
+ {messagesQuery.isError && (
+
+
История временно недоступна
+
+
+ )}
+
+ {!messagesQuery.isLoading && !messagesQuery.isError && messages.length === 0 && (
+
+
+
Сообщений пока нет. Начните разговор.
+
+ )}
+
+ {groups.map((group) => (
+
+
{group.label}
+ {group.messages.map((message) => {
+ const own = message.sender_id === currentUser.id;
+ return (
+
+
+ {own ? "Вы" : shortID(message.sender_id)}
+
+ {message.text}
+
+ {formatMessageTime(message.created_at)}
+ {own && }
+
+
+ );
+ })}
+
+ ))}
+
+
+
+
+
+
+ );
+}
diff --git a/frontend/src/components/CreateChatDialog.tsx b/frontend/src/components/CreateChatDialog.tsx
new file mode 100644
index 00000000..875084cd
--- /dev/null
+++ b/frontend/src/components/CreateChatDialog.tsx
@@ -0,0 +1,148 @@
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { Plus, UserRoundPlus, X } from "lucide-react";
+import { useEffect, useState, type FormEvent } from "react";
+import { useNavigate } from "react-router-dom";
+
+import { api, ApiError } from "../api/client";
+import type { Chat, User } from "../api/types";
+import { shortID } from "../lib/format";
+
+type CreateChatDialogProps = {
+ currentUser: User;
+ onClose: () => void;
+};
+
+const uuidPattern =
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
+
+export function CreateChatDialog({
+ currentUser,
+ onClose,
+}: CreateChatDialogProps) {
+ const navigate = useNavigate();
+ const queryClient = useQueryClient();
+ const [title, setTitle] = useState("");
+ const [memberInput, setMemberInput] = useState("");
+ const [validationError, setValidationError] = useState("");
+
+ useEffect(() => {
+ function closeOnEscape(event: KeyboardEvent) {
+ if (event.key === "Escape") {
+ onClose();
+ }
+ }
+ window.addEventListener("keydown", closeOnEscape);
+ return () => window.removeEventListener("keydown", closeOnEscape);
+ }, [onClose]);
+
+ const mutation = useMutation({
+ mutationFn: api.createChat,
+ onSuccess: (chat) => {
+ queryClient.setQueryData(["chats"], (current = []) => [
+ ...current,
+ chat,
+ ]);
+ onClose();
+ navigate(`/app/chats/${chat.id}`);
+ },
+ });
+
+ function submit(event: FormEvent) {
+ event.preventDefault();
+ setValidationError("");
+
+ const enteredIDs = memberInput
+ .split(/[\s,;]+/)
+ .map((value) => value.trim())
+ .filter(Boolean);
+ const memberIds = Array.from(new Set([currentUser.id, ...enteredIDs]));
+
+ if (!title.trim() || Array.from(title.trim()).length > 100) {
+ setValidationError("Название должно содержать от 1 до 100 символов");
+ return;
+ }
+ const invalidID = enteredIDs.find((id) => !uuidPattern.test(id));
+ if (invalidID) {
+ setValidationError(`Некорректный UUID: ${invalidID}`);
+ return;
+ }
+ mutation.mutate({ title: title.trim(), memberIds });
+ }
+
+ const serverError =
+ mutation.error instanceof ApiError
+ ? mutation.error.message
+ : mutation.error
+ ? "Не удалось создать чат"
+ : "";
+
+ return (
+
+
event.stopPropagation()}
+ role="dialog"
+ >
+
+
+
Новый разговор
+
Создать чат
+
+
+
+
+
+
+
+ );
+}
diff --git a/frontend/src/components/EmptyChat.tsx b/frontend/src/components/EmptyChat.tsx
new file mode 100644
index 00000000..a2f3ee3c
--- /dev/null
+++ b/frontend/src/components/EmptyChat.tsx
@@ -0,0 +1,29 @@
+import { MessageSquarePlus } from "lucide-react";
+
+type EmptyChatProps = {
+ hasChats: boolean;
+ onCreateChat: () => void;
+};
+
+export function EmptyChat({ hasChats, onCreateChat }: EmptyChatProps) {
+ return (
+
+
+
+
MTUCI Messenger
+
{hasChats ? "Выберите чат" : "Начните разговор"}
+
+ {hasChats
+ ? "История и новые сообщения появятся здесь."
+ : "Создайте первый чат и пригласите участников по UUID."}
+
+ {!hasChats && (
+
+ )}
+
+
+ );
+}
diff --git a/frontend/src/components/LoadingScreen.tsx b/frontend/src/components/LoadingScreen.tsx
new file mode 100644
index 00000000..63f0636a
--- /dev/null
+++ b/frontend/src/components/LoadingScreen.tsx
@@ -0,0 +1,11 @@
+export function LoadingScreen() {
+ return (
+
+
+ M
+
+ Подключаемся к Messenger
+
+
+ );
+}
diff --git a/frontend/src/components/NavigationRail.tsx b/frontend/src/components/NavigationRail.tsx
new file mode 100644
index 00000000..5b0670f7
--- /dev/null
+++ b/frontend/src/components/NavigationRail.tsx
@@ -0,0 +1,42 @@
+import { MessagesSquare, UserRound } from "lucide-react";
+import { Link } from "react-router-dom";
+
+import type { User } from "../api/types";
+import { Avatar } from "./Avatar";
+
+type NavigationRailProps = {
+ user: User;
+ profileOpen: boolean;
+};
+
+export function NavigationRail({ user, profileOpen }: NavigationRailProps) {
+ return (
+
+ );
+}
diff --git a/frontend/src/components/ProfileDrawer.tsx b/frontend/src/components/ProfileDrawer.tsx
new file mode 100644
index 00000000..f1d25d51
--- /dev/null
+++ b/frontend/src/components/ProfileDrawer.tsx
@@ -0,0 +1,123 @@
+import {
+ CalendarDays,
+ Check,
+ Copy,
+ LogOut,
+ ShieldCheck,
+ UserRound,
+ X,
+} from "lucide-react";
+import { useState } from "react";
+import { useNavigate } from "react-router-dom";
+
+import type { User } from "../api/types";
+import { useAuth } from "../auth/AuthProvider";
+import { Avatar } from "./Avatar";
+
+type ProfileDrawerProps = {
+ user: User;
+};
+
+const createdAtFormatter = new Intl.DateTimeFormat("ru-RU", {
+ day: "numeric",
+ month: "long",
+ year: "numeric",
+});
+
+export function ProfileDrawer({ user }: ProfileDrawerProps) {
+ const { logout } = useAuth();
+ const navigate = useNavigate();
+ const [copied, setCopied] = useState(false);
+ const [error, setError] = useState("");
+ const [isLoggingOut, setIsLoggingOut] = useState(false);
+
+ async function copyID() {
+ await navigator.clipboard.writeText(user.id);
+ setCopied(true);
+ window.setTimeout(() => setCopied(false), 1800);
+ }
+
+ async function submitLogout() {
+ setError("");
+ setIsLoggingOut(true);
+ try {
+ await logout();
+ navigate("/login", { replace: true });
+ } catch {
+ setError("Не удалось завершить сессию. Попробуйте ещё раз.");
+ setIsLoggingOut(false);
+ }
+ }
+
+ return (
+ <>
+