docs: write REPORT.md

This commit is contained in:
TAskMAster339
2026-10-19 00:20:43 +03:00
parent 95c2e78fe3
commit 84175cf1e2
68 changed files with 6629 additions and 38 deletions
-1
View File
@@ -139,7 +139,6 @@ test-direct-upload-access: app-init
test-direct-upload-recovery: app-init
$(COMPOSE) --profile test run --build --rm backend-tests go test -race -count=1 -v ./backend/tests -run '^TestDirectUpload(Recovery|CrashHelper)'
$(COMPOSE) exec -T frontend npm run test:direct-upload
test-direct-upload-cleanup: app-init
$(COMPOSE) --profile test run --build --rm backend-tests go test -race -count=1 -v ./backend/tests -run '^TestDirectUploadCleanup'
+138 -15
View File
@@ -1,37 +1,160 @@
# Отчёт — лабораторная 4
- Автор, группа: TODO
- Целевая оценка; выбранный трек 5, если нужен: TODO
- Commit/PR: TODO после публикации
- Использованные источники, библиотеки и помощь ИИ: TODO
- Автор, группа: Гришко Дмитрий Михайлович, БВТ2303.
- Целевая оценка: 5, трек 1 «Прямой upload».
- Репозиторий: [Gitea](https://gitea.privcloud.tech/TAskMAster339/mtusi2026lab4-fork).
- Commit/PR:
- Хост: AMD Ryzen 9 PRO 7940HS (8 ядер / 16 потоков), 16 GB RAM; Windows 11, WSL2 Ubuntu, kernel `6.6.87.1-microsoft-standard-WSL2`. Docker Desktop: 16 CPU, 7.40 GiB RAM, Engine 29.8.1, Compose 5.5.1, cgroup v2; Python 3.12.3.
- Источники: [задание](README.md), [контракт](contracts/README.md), [OpenAPI](contracts/openapi.json), [S3 POST policy](https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-HTTPPOSTConstructPolicy.html), [cgroup v2](https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html).
- Библиотеки: Go 1.22.2, pgx v5.5.5, go-redis v9.17.3, migrate v4.17.1, minio-go v7.0.76, madmin-go v3.0.70, x/crypto v0.27.0; полные версии — [go.mod](src/go.mod), [package-lock.json](src/frontend/package-lock.json), [анализ](experiments/requirements.txt). Помощь ИИ: OpenAI Codex — реализация, проверки и оформление.
## Запуск из чистого clone
TODO: версии runtime/образов, prerequisites, команды создания локальных secrets/.env, build, миграций, запуска, ожидания готовности, тестов и остановки. Указать необходимые действия оператора. Не вставлять секреты. Отдельно указать безопасную остановку и команду намеренного удаления учебных данных.
Команды для WSL Ubuntu/Linux. Нужны Git, Make, Python 3.12 с `venv`, Docker/Compose с `--wait`, интернет для сборки. Порты: 8080, 5173, 8404, 9000; эксперименту — 18080, 19000, 18404.
**Клонирование и настройка .env:**
```sh
git clone --branch solution/BVT2303-Grishko https://gitea.privcloud.tech/TAskMAster339/mtusi2026lab4-fork.git
cd mtusi2026lab4-fork
make app-init
```
`app-init` создаёт `.env`, случайные пароли и `secrets/`; существующие значения сохраняет. Секреты не включены в Git. Изменение пароля `.env` не меняет пароль роли в уже созданной БД.
**Сборка и запуск:**
```sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml config --quiet
make app-up
make app-status
curl --fail http://127.0.0.1:8080/health/ready
```
Compose ждёт PostgreSQL/Redis/MinIO, выполняет миграции и bootstrap, запускает две API, LB, UI и очистку. Нормально: `migrate`/`s3-bootstrap` — `Exited (0)`, сервисы с healthcheck — `healthy`. UI: <http://127.0.0.1:5173>, API: <http://127.0.0.1:8080>, статистика: <http://127.0.0.1:8404/stats>. S3 — loopback 9000, консоль отключена.
Образы: API `golang:1.22.2-bookworm` → `debian:12.15-slim`, PostgreSQL `16.10-bookworm`, Redis `7.4.11-bookworm`, HAProxy `3.2.25-alpine`, frontend `node:22-bookworm-slim`. MinIO собирается из официального `RELEASE.2025-04-22T22-12-26Z`, commit `0d7408fc9969caf07de6a8c3a84f9fbb10a6739e`, builder Go 1.24.2. Теги не равны digest; точные image ID эксперимента сохранены.
**Проверки и доказательства:**
```sh
make check
make test
python3 scripts/generate_evidence.py
```
[Генератор](scripts/generate_evidence.py) повторяет функциональные, backend `-race`, frontend и отказные проверки. Для каждого критерия создаёт Markdown с командой, временем, exit code, выводом и ссылками на код в [evidence/criteria](evidence/criteria/README.md); история — `runs/`. Нагрузку заново не запускает: сверяет готовую основную серию по seal, архиву и сырым данным. Для другой серии: `--campaign <путь>`. Отказы кратковременно останавливают сервисы этого стенда; в конце восстанавливаются две API, volumes не удаляются.
Новая серия — по [инструкции](experiments/docs/RUNBOOK.md). Для графиков: `bash experiments/setup.sh`; результат — только PNG. Генерацию доказательств и нагрузочные эксперименты не запускать параллельно.
**Безопасная остановка и возобновление:**
```sh
make app-down
make app-start
```
Данные сохраняются. Намеренное удаление **всех учебных данных обычного стенда** (в проверках не используется):
```sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml down -v
```
## Архитектура и решения
TODO: схема процессов/хранилищ, источник истины, транзакционные границы, ограничения. Что перенесено из lab3, что изменено в этой работе. Соответствие переменных из .env.example реальной конфигурации.
```text
React → HAProxy → API ×2 → PostgreSQL: сообщения, Attachment, журналы
→ Redis: общие Bearer-сессии
→ MinIO: приватные оригиналы
React ── presigned POST ─→ MinIO: staging
migrate → PostgreSQL; s3-bootstrap → MinIO; upload-cleanup → PostgreSQL + MinIO
```
Из lab3 сохранены Argon2id, Redis-сессии, PostgreSQL, keyset-пагинация, балансировка, X-Request-Id/X-Instance-Id и общая идемпотентность. Сообщение, упорядоченные attachment_ids и результат Idempotency-Key сохраняются одной транзакцией; изменённый body с тем же ключом даёт 409. Пустой текст допустим с вложениями; файл чужого чата привязать нельзя.
Миграции [4–6](src/backend/repositories/migrations/) добавляют Attachment/связи, upload_attempts и direct_uploads. PostgreSQL определяет доступ/готовность, MinIO хранит байты. Постоянного оригинала на API нет: имя временного файла удаляется сразу после открытия, дескриптор закрывается после запроса/аварии.
- **Proxy:** авторизация → tmpfs + SHA-256 → MIME/размеры/полный Decode → устойчивый журнал → S3 PUT под блокировкой → метаданные и удаление журнала одной транзакцией → `201 ready`.
- **Direct:** init владельца/чата → POST-подпись на 120 с для точного staging key/MIME/размера → клиент отправляет файл S3 → complete владельца. Под row lock выполняется COPY в отдельный final key с условием ETag; API читает **final**, проверяет размер/SHA-256/изображение и атомарно публикует ready. Повтор complete возвращает тот же Attachment; replay формы не меняет original. Срок complete — истечение подписи +600 с.
- **Чтение:** Bearer и членство в чате; чужое вложение — 404. Bytes идут потоком через API без redirect. UI использует авторизованный fetch/Blob URL, освобождает URL; токена в URL нет.
- **Очистка:** журнал до S3-операции, без слепого DELETE при неопределённом COMMIT. Проход каждые 60 с, batch ≤100, grace 600 с (минимум 120), SKIP LOCKED и защита готовых метаданных. Staging учитывает срок complete + grace и повторную запись после ready; lifecycle старше суток действует только на staging/direct/*, receipt хранится ≥24 ч. Ошибки зависимостей оставляют задачу для повтора.
- **Лимиты:** оригинал ≤10 МиБ, ≤40 млн пикселей; буфер 32 КиБ, tmpfs 16 МиБ, общий слот proxy/complete — один на API, RAM 512 МиБ. GOMEMLIMIT 384 МиБ — мягкий лимит Go. Операция 25 с, HTTP 30 с, LB 35 с; ожидание слота отменяется контекстом.
- **S3:** API/cleanup имеют отдельные Get/Put/Delete только originals/* и staging/direct/* рабочего bucket плюс GetBucketLocation/ListBucket. Root — у MinIO/bootstrap и отдельного тестового сервиса. Анонимный доступ запрещён; S3 host-порт только loopback, CORS только localhost/127.0.0.1:5173. DB/Redis/API host-порты не публикуются.
APP_*, TTL, API_REPLICAS и S3_* из `.env` используются Compose/приложением; *_FILE — read-only файлы. SESSION_STORE=postgres в исходном примере — подсказка skeleton: реализация всегда использует Redis. MAX_UPLOAD_BYTES/MAX_IMAGE_PIXELS закреплены константами 10 МиБ/40 млн, изменение строк `.env` лимиты не меняет. Генератор добавляет public endpoint, origins и grace; tmpfs/CPU/RAM заданы Compose.
## Доказательства критериев
Полный вывод — по ссылкам; общие команды генератор выполняет один раз. UI — дополнение к обязательным критериям.
| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства |
| --- | --- | --- | --- |
| Публичный smoke | make test | TODO | TODO |
| Остальные пункты уровня 3 | TODO | TODO | TODO |
| Все пункты уровня 4, если заявлен | TODO | TODO | TODO |
| Выбранный трек 5, если заявлен | TODO | TODO | TODO |
TODO: добавить отдельную строку для каждого заявленного критерия. PASS без команды и наблюдения не является доказательством. Проверка инфраструктурного hook требует подтверждения, какие реальные процессы/хранилища перезапущены.
| Публичный smoke | `make check`, `make test` | Контрактные сценарии и checksum | [public-smoke](evidence/criteria/public-smoke.md) |
| Возможности lab3 | baseline + backend | Сессии, Argon2id, cursor, идемпотентность; `-race` | [baseline](evidence/criteria/baseline.md) |
| Общие PostgreSQL/S3 и две API | inventory + isolation | 2 healthy API, volumes, без локальных оригиналов | [shared-storage](evidence/criteria/shared-storage.md) |
| Proxy upload, сообщения, download | `make test-grade3` | PNG/JPEG, ready, attachment-only message, те же байты | [proxy-attachments](evidence/criteria/proxy-attachments.md) |
| Валидация и ACL | backend + proxy | Размер, пиксели, повреждения, MIME, filename, чужой ID/чат; без 500 | [validation-access](evidence/criteria/validation-access.md) |
| Переключение API | proxy/direct failures + public failover | Остановка обеих обслуживших реплик по очереди, download другой | [replica-failover](evidence/criteria/replica-failover.md) |
| Restart с volumes | public persistence + direct restart | Сессия, receipt, metadata и bytes сохранены; реальные процессы перезапущены | [persistence](evidence/criteria/persistence.md) |
| Обрыв HTTP и отказ S3/БД | backend recovery | Нет ложного ready; журнал переживает rollback/crash | [upload-recovery](evidence/criteria/upload-recovery.md) |
| Безопасная очистка | backend cleanup + dry-run | Fresh/locked/ready защищены; просроченные удалены; retry | [safe-cleanup](evidence/criteria/safe-cleanup.md) |
| Потоковая обработка, ≥10 upload | inventory + аудит серии | 10 клиентов; max API lifetime 397.36 МиБ, без OOM | [bounded-memory](evidence/criteria/bounded-memory.md) |
| Bootstrap и private bucket | backend permissions + isolation | Идемпотентность, ограниченные права, anonymous 403, console off | [s3-permissions](evidence/criteria/s3-permissions.md) |
| Трек 1: прямой flow | direct HTTP + backend | Presigned POST; один результат complete; replay не меняет final | [direct-flow](evidence/criteria/direct-flow.md) |
| Трек 1: негативные сценарии | backend direct validation/access | Подмена policy, размер/SHA/MIME, чужой upload, срок и CORS | [direct-validation-access](evidence/criteria/direct-validation-access.md) |
| Трек 1: восстановление | backend + direct failures | COPY/GET/БД/crash, повтор complete, отмена ожидания | [direct-recovery](evidence/criteria/direct-recovery.md) |
| Трек 1: незавершённые upload | backend direct cleanup | Grace, replay staging, dry-run/retry, lifecycle только staging | [direct-cleanup](evidence/criteria/direct-cleanup.md) |
| Трек 1: исследование | аудит основной серии | 24 прогона, 720/720 оригиналов; H1 подтверждена в заданных условиях | [upload-comparison](evidence/criteria/upload-comparison.md) |
| Дополнительно: React UI | `npm run build` | TypeScript-проверка и сборка | [frontend](evidence/criteria/frontend.md) |
## Эксперименты и отказы
TODO: гипотеза, hardware/лимиты, версии, объём данных, профиль нагрузки, concurrency/arrival rate, длительность/прогрев, повторы, успешные RPS, ошибки, p50/p95/p99, CPU/RAM. Сохранить raw summary без tokens и объяснить ограничения измерения.
### Сравнение proxy/direct
**H1:** direct уменьшает RX+TX двух API на проверенное вложение минимум на 35% по медиане каждого профиля, без ошибок/OOM/рестартов; каждый парный R ≤0.70. RAM сравниваем без обещания снижения. [Гипотеза](experiments/docs/HYPOTHESIS.md), [методика](experiments/docs/METHODOLOGY.md), [исходный протокол](evidence/upload-comparison/20261018T193626Z-formal-f49d61/protocol.json), [seal](evidence/upload-comparison/20261018T193626Z-formal-f49d61/seal.json).
Хост указан выше. Две API по 0.5 CPU/512 МиБ, GOMAXPROCS=1, GOMEMLIMIT=384MiB, пул PG=10/API; PG/MinIO по 1 CPU/512 МиБ, Redis 0.25 CPU/128 МиБ, HAProxy 0.5 CPU/128 МиБ, swap отключён. [Точные image ID](evidence/upload-comparison/20261018T193626Z-formal-f49d61/images.json).
Четыре RGB8 PNG: 1/10 МиБ × 1024×1024/8000×5000; encoded-размер регулируется валидным chunk, пиксели одной геометрии одинаковые. Seed 20261018, 3 парных повтора, порядок AB/BA сбалансирован. Каждый из 24 прогонов: свежие volumes, 4 запроса прогрева, пауза 2 с, idle 5 с, затем 3 волны по 10 клиентов, пауза 1 с. Arrival — барьерные closed-loop bursts. Окна 3.56–20.25 с, суммарно 233.31 с; 720 измеряемых и 96 прогревочных загрузок. Пилот исключён.
RAM — каждые 100 мс, сеть/CPU — разность счётчиков, фон не вычитается. Все 720 originals проверены вторым участником **после** измеряемого окна; ошибок/OOM/рестартов API/S3 нет. Покрытие sampler ≥80.1%, max gap 0.495 с, разброс старта ≤13.23 мс, CPU генератора ≤0.115 ядра, фон ≤0.344% payload — критерии качества выполнены.
Медианы трёх прогонов, `proxy → direct`. RAM — максимум sampled памяти одной API из двух, не сумма. Снижение трафика — по медиане парных R.
| Файл / пиксели | API МиБ/ready | Снижение; диапазон R | API RAM, МиБ | p95, с | ready/с |
| --- | --- | --- | --- | --- | --- |
| 1 МиБ / 1.05 млн | 2.021 → 1.023 | 49.34%; 0.5064–0.5080 | 136.05 → 138.72 | 0.350 → 0.665 | 7.89 → 6.62 |
| 10 МиБ / 1.05 млн | 20.114 → 10.045 | 50.05%; 0.4991–0.4998 | 148.44 → 147.18 | 1.199 → 2.429 | 4.71 → 3.11 |
| 1 МиБ / 40 млн | 2.020 → 1.036 | 48.74%; 0.5071–0.5128 | 381.27 → 384.05 | 2.522 → 3.187 | 3.15 → 2.80 |
| 10 МиБ / 40 млн | 20.121 → 10.046 | 50.07%; 0.4992–0.4996 | 392.00 → 393.06 | 3.148 → 5.166 | 2.32 → 1.78 |
| Файл / пиксели | p50, с | p99, с | API CPU, с/прогон | S3 CPU, с/прогон |
| --- | --- | --- | --- | --- |
| 1 МиБ / 1.05 млн | 0.138 → 0.330 | 0.353 → 0.665 | 0.965 → 1.037 | 0.622 → 1.491 |
| 10 МиБ / 1.05 млн | 0.624 → 1.760 | 1.371 → 2.519 | 2.879 → 2.605 | 2.728 → 6.505 |
| 1 МиБ / 40 млн | 1.294 → 1.646 | 2.550 → 3.235 | 6.939 → 7.587 | 0.954 → 1.924 |
| 10 МиБ / 40 млн | 1.835 → 3.217 | 3.997 → 5.442 | 9.327 → 9.928 | 3.337 → 7.203 |
**Вывод:** H1 подтверждена в исследованных условиях: медианные R=0.4993–0.5126, все пары ниже 0.70. Экономия соответствует исключению передачи оригинала API→S3: API остаётся одно полное чтение для проверки. Ускорения и устойчивого снижения RAM не получено: direct p95 выше, goodput ниже. Память прежде всего растёт с числом пикселей; оба flow выполняют Decode. Max lifetime API — 397.36 МиБ при лимите 512.
Цена переносится на S3: RX+TX примерно удваивается, CPU возрастает в 2.0–2.4 раза. На 10 МиБ MinIO достигает лимита памяти: memory.events.max >0, lifetime peak до 512.84 МиБ при memory.max=512 МиБ, OOM=0; есть CPU throttling. Дополнительные round trips/COPY/GET и давление ресурсов согласуются с ростом задержки, но вклад каждого не изолирован. Складывать трафик API и S3 как независимые байты всей системы нельзя.
[JSON](evidence/upload-comparison/20261018T193626Z-formal-f49d61/metrics.json) · [CSV](evidence/upload-comparison/20261018T193626Z-formal-f49d61/metrics.csv) · [Трафик](evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/20261018T195401.869811Z/api-traffic.png) · [RAM](evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/20261018T195401.869811Z/api-memory-window.png) · [p95](evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/20261018T195401.869811Z/latency-p95.png).
### Отказы
| Воздействие | Что ожидаем | Что наблюдали | Время восстановления / потеря данных |
| --- | --- | --- | --- |
| TODO | TODO | TODO | TODO |
| Остановка обслужившей API | Другая читает original | Proxy/direct для обеих реплик | Точный public failover — в [протоколе](evidence/criteria/replica-failover.md); файлы сохранены |
| Restart DB/Redis/S3/API/cleanup | Сессия, metadata и bytes сохранены | Старый Bearer/receipt работают; StartedAt изменены | Длительность — в [протоколе](evidence/criteria/persistence.md); потери не обнаружены |
| Остановка MinIO | Live 200, ready 503, затем original доступен | Проверено на обеих API | Проверено восстановление после ready; точный downtime не измерялся |
| Обрыв HTTP, PUT/COPY/GET/INSERT/БД/crash | Нет ложного ready; retry/cleanup | Backend fault-тесты с БД/S3 и тестовыми обёртками | Повреждённый файл не опубликован; очистка после grace |
| Ошибка DELETE/БД при cleanup | Задача остаётся | Повтор успешен, fresh/locked/ready защищены | Срок при недоступной зависимости не гарантируется |
## Ограничения и следующие шаги
TODO: какие отказы выдерживаются и какие нет; что не реализовано; где учебное упрощение; какое улучшение подтверждено, а какое пока гипотеза.
Один WSL-host, синтетический PNG, без TLS/WAN и браузерного benchmark; три повтора дают ограниченную оценку разброса. Запросы внутри прогона зависимы; p99 из 30 запросов близок к максимуму. Sampled RAM может пропустить всплеск; lifetime peak включает startup/прогрев. Page cache и чужая нагрузка хоста полностью не изолированы. Это не тест максимального RPS. Полные [ограничения](experiments/docs/LIMITATIONS.md).
Общей транзакции PostgreSQL/S3 нет: журнал обеспечивает очистку неопубликованных объектов, но полного bucket reconciler и восстановления отсутствующих originals нет. Готовые непривязанные вложения сохраняются. Lifecycle проверен по настройкам/prefix; сутки не выжидались. Подпись — временное право записи staging, не одноразовая ссылка и не отзывается немедленно logout.
Единственные MinIO/PG/Redis не дают HA хранилищ; проверен restart с volumes, не потеря диска. HTTP/loopback и UI-токен в localStorage — учебные ограничения. Следующие проверки: TLS/WAN, длительная нагрузка, отдельный эксперимент с ресурсами S3 и стоимостью COPY/валидации; ускорение пока гипотеза.
View File
+25
View File
@@ -0,0 +1,25 @@
# Доказательства критериев
[REPORT.md](../../REPORT.md)
Последний запуск: `20261018T203755.405686Z`.
| Критерий | Результат |
| --- | --- |
| [Публичный smoke и структура контракта](public-smoke.md) | PASS |
| [Возможности lab3](baseline.md) | PASS |
| [Две API, PostgreSQL и приватный S3 в общем стенде](shared-storage.md) | PASS |
| [PNG/JPEG, ready, сообщение и побайтный download](proxy-attachments.md) | PASS |
| [Лимиты, MIME, filename и доступ к чужим вложениям](validation-access.md) | PASS |
| [Оригинал после остановки обслужившей API](replica-failover.md) | PASS |
| [Сессия, метаданные и оригинал после restart](persistence.md) | PASS |
| [Обрыв HTTP и отказ между S3 PUT и COMMIT](upload-recovery.md) | PASS |
| [Grace period, блокировки, защита готовых объектов и повтор](safe-cleanup.md) | PASS |
| [Потоковая обработка, лимиты и ≥10 клиентов](bounded-memory.md) | PASS |
| [Повторяемый bootstrap и ограниченные credentials](s3-permissions.md) | PASS |
| [Presigned POST и неизменяемый готовый оригинал](direct-flow.md) | PASS |
| [Подпись, владелец, размер, SHA-256, MIME и CORS](direct-validation-access.md) | PASS |
| [Повторы complete, crash и отмена ожидания](direct-recovery.md) | PASS |
| [Незавершённый staging, replay, dry-run и lifecycle](direct-cleanup.md) | PASS |
| [Гипотеза и сравнение трафика/RAM на четырёх профилях](upload-comparison.md) | PASS |
| [Сборка React UI](frontend.md) | PASS |
+52
View File
@@ -0,0 +1,52 @@
# Возможности lab3
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestStoredPasswordUsesArgon2id`, `TestShortSessionTTLAndLogout`, `TestIdempotencyConcurrentStoresAndScopes`, `TestChatTransactionRollsBackAfterMemberInsertFailure`, `TestListMessagesPagination`.
## baseline
```sh
make test-baseline
```
Начало: 2026-10-18T20:38:39.428018+00:00; длительность: 1.345 с; exit code: 0.
````text
python3 scripts/check_baseline.py --base-url "http://localhost:8080"
PASS: transferred API, shared sessions, chat, message, logout
````
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](runs/20261018T203755.405686Z/backend.txt).
````text
=== RUN TestChatTransactionRollsBackAfterMemberInsertFailure
--- PASS: TestChatTransactionRollsBackAfterMemberInsertFailure (1.30s)
=== RUN TestShortSessionTTLAndLogout
--- PASS: TestShortSessionTTLAndLogout (2.68s)
=== RUN TestIdempotencyConcurrentStoresAndScopes
--- PASS: TestIdempotencyConcurrentStoresAndScopes (1.24s)
=== RUN TestListMessagesPagination
--- PASS: TestListMessagesPagination (0.55s)
=== RUN TestStoredPasswordUsesArgon2id
--- PASS: TestStoredPasswordUsesArgon2id (0.62s)
PASS
````
## Реализация
- [src/backend/repositories/idempotency.go](../../src/backend/repositories/idempotency.go)
- [src/backend/repositories/redis.go](../../src/backend/repositories/redis.go)
- [src/backend/services/password.go](../../src/backend/services/password.go)
+257
View File
@@ -0,0 +1,257 @@
# Потоковая обработка, лимиты и ≥10 клиентов
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## inventory
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe inventory
```
Начало: 2026-10-18T20:38:15.728752+00:00; длительность: 0.679 с; exit code: 0.
````text
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:36:24.367291372Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.89479619Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.416387316Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:06.043221163Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.786499611Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:50.058525711Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:06.399345399Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.81722101Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
````
## experiment
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe experiment --campaign /mnt/c/projects/Highload-systems/mtusi2026lab4-fork/evidence/upload-comparison/20261018T193626Z-formal-f49d61
```
Начало: 2026-10-18T20:43:13.717511+00:00; длительность: 3.393 с; exit code: 0.
````text
PASS: sealed protocol, archive, fixtures, raw records and recomputed decision match
Campaign: evidence/upload-comparison/20261018T193626Z-formal-f49d61
Ready/verified: 720 720
Errors: 0
{"profile": "small-moderate", "valid_pairs": 3, "median_traffic_ratio": 0.5065773906213067, "min_traffic_ratio": 0.5063861055246678, "max_traffic_ratio": 0.5079907229528128}
{"profile": "large-moderate", "valid_pairs": 3, "median_traffic_ratio": 0.49949754357270226, "min_traffic_ratio": 0.4991382402982068, "max_traffic_ratio": 0.49981732427785186}
{"profile": "small-pixels40m", "valid_pairs": 3, "median_traffic_ratio": 0.5126058228037882, "min_traffic_ratio": 0.50707065100036, "max_traffic_ratio": 0.512817391975545}
{"profile": "large-pixels40m", "valid_pairs": 3, "median_traffic_ratio": 0.49928261799970935, "min_traffic_ratio": 0.4992082132615818, "max_traffic_ratio": 0.49959788796606974}
{"profile": "small-moderate", "mode": "proxy", "median_api_MiB_per_ready": 2.0209168752034503, "median_api_window_peak_MiB": 136.0546875, "max_api_lifetime_peak_MiB": 141.2265625, "median_ready_rps": 7.894590746470929, "median_p50_s": 0.13762395, "median_p95_s": 0.349706212, "median_p99_s": 0.353454295}
{"profile": "small-moderate", "mode": "direct", "median_api_MiB_per_ready": 1.0233642260233562, "median_api_window_peak_MiB": 138.71875, "max_api_lifetime_peak_MiB": 140.8125, "median_ready_rps": 6.6154831177570035, "median_p50_s": 0.330249949, "median_p95_s": 0.664536392, "median_p99_s": 0.665379127}
{"profile": "large-moderate", "mode": "proxy", "median_api_MiB_per_ready": 20.11448278427124, "median_api_window_peak_MiB": 148.44140625, "max_api_lifetime_peak_MiB": 152.44921875, "median_ready_rps": 4.708766693021728, "median_p50_s": 0.623532216, "median_p95_s": 1.199421251, "median_p99_s": 1.370958831}
{"profile": "large-moderate", "mode": "direct", "median_api_MiB_per_ready": 10.044582716623943, "median_api_window_peak_MiB": 147.1796875, "max_api_lifetime_peak_MiB": 150.04296875, "median_ready_rps": 3.1121213975127984, "median_p50_s": 1.760060342, "median_p95_s": 2.429332421, "median_p99_s": 2.519360375}
{"profile": "small-pixels40m", "mode": "proxy", "median_api_MiB_per_ready": 2.0204983075459797, "median_api_window_peak_MiB": 381.2734375, "max_api_lifetime_peak_MiB": 384.3203125, "median_ready_rps": 3.145227806944573, "median_p50_s": 1.294338167, "median_p95_s": 2.522289981, "median_p99_s": 2.55024115}
{"profile": "small-pixels40m", "mode": "direct", "median_api_MiB_per_ready": 1.0358009020487466, "median_api_window_peak_MiB": 384.0546875, "max_api_lifetime_peak_MiB": 387.94140625, "median_ready_rps": 2.8002143610390253, "median_p50_s": 1.645604573, "median_p95_s": 3.186833871, "median_p99_s": 3.235123098}
{"profile": "large-pixels40m", "mode": "proxy", "median_api_MiB_per_ready": 20.120631217956543, "median_api_window_peak_MiB": 391.99609375, "max_api_lifetime_peak_MiB": 393.2578125, "median_ready_rps": 2.3240187390207696, "median_p50_s": 1.835096441, "median_p95_s": 3.14764051, "median_p99_s": 3.996668065}
{"profile": "large-pixels40m", "mode": "direct", "median_api_MiB_per_ready": 10.045849291483561, "median_api_window_peak_MiB": 393.05859375, "max_api_lifetime_peak_MiB": 397.359375, "median_ready_rps": 1.780860551975933, "median_p50_s": 3.21658326, "median_p95_s": 5.166217115, "median_p99_s": 5.44240128}
Decision: confirmed_in_tested_conditions
````
## Реализация
- [src/backend/services/attachment.go](../../src/backend/services/attachment.go)
- [src/backend/services/direct_upload.go](../../src/backend/services/direct_upload.go)
- [experiments/config/protocol.json](../../experiments/config/protocol.json)
Измерения не запускались повторно: проверены сохранённые сырые данные.
[Серия](../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/metrics.json) · [Протокол](../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/protocol.json) · [Графики](../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/)
+49
View File
@@ -0,0 +1,49 @@
# Незавершённый staging, replay, dry-run и lifecycle
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestDirectUploadCleanupSafetyAndReplay`, `TestDirectUploadCleanupDependencyFailureAndMalformedKey`, `TestDirectUploadAccessPermissionsAndLifecycle`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](runs/20261018T203755.405686Z/backend.txt).
````text
=== RUN TestDirectUploadCleanupSafetyAndReplay
--- PASS: TestDirectUploadCleanupSafetyAndReplay (0.87s)
=== RUN TestDirectUploadCleanupDependencyFailureAndMalformedKey
--- PASS: TestDirectUploadCleanupDependencyFailureAndMalformedKey (0.66s)
=== RUN TestDirectUploadAccessPermissionsAndLifecycle
--- PASS: TestDirectUploadAccessPermissionsAndLifecycle (0.98s)
PASS
````
## cleanup-dry-run
```sh
make attachments-cleanup
```
Начало: 2026-10-18T20:41:08.490906+00:00; длительность: 1.327 с; exit code: 0.
````text
docker compose --project-name highload-lab4 --env-file .env -f compose.yml run --rm --no-deps upload-cleanup ./messenger attachments-cleanup --dry-run
Container highload-lab4-upload-cleanup-run-ee9c8bded59f Creating
Container highload-lab4-upload-cleanup-run-ee9c8bded59f Created
{"direct":{"candidates":1,"deleted":0,"eligible":1,"protected":0,"skipped":0,"failed":0,"dry_run":true},"originals":{"candidates":0,"deleted":0,"eligible":0,"protected":0,"skipped":0,"failed":0,"dry_run":true}}
````
## Реализация
- [src/backend/repositories/direct_cleanup.go](../../src/backend/repositories/direct_cleanup.go)
- [src/backend/repositories/s3_admin.go](../../src/backend/repositories/s3_admin.go)
+44
View File
@@ -0,0 +1,44 @@
# Presigned POST и неизменяемый готовый оригинал
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestDirectUploadFlow`, `TestDirectUploadRecoveryConcurrentComplete`.
## direct
```sh
/usr/bin/python3 scripts/check_direct_upload.py
```
Начало: 2026-10-18T20:41:05.039812+00:00; длительность: 2.394 с; exit code: 0.
````text
PASS: real S3 form, concurrent complete through two replicas, authorized bytes and attachment-only message
````
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](runs/20261018T203755.405686Z/backend.txt).
````text
=== RUN TestDirectUploadFlow
--- PASS: TestDirectUploadFlow (0.76s)
=== RUN TestDirectUploadRecoveryConcurrentComplete
--- PASS: TestDirectUploadRecoveryConcurrentComplete (0.61s)
PASS
````
## Реализация
- [src/backend/services/direct_upload.go](../../src/backend/services/direct_upload.go)
- [src/backend/repositories/s3_direct.go](../../src/backend/repositories/s3_direct.go)
+57
View File
@@ -0,0 +1,57 @@
# Повторы complete, crash и отмена ожидания
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestDirectUploadRecoveryFailures`, `TestDirectUploadRecoveryProcessExit`, `TestDirectUploadRecoverySharedSlotAndCancellation`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](runs/20261018T203755.405686Z/backend.txt).
````text
=== RUN TestDirectUploadRecoveryFailures
=== RUN TestDirectUploadRecoveryFailures/copy-result-loss
=== RUN TestDirectUploadRecoveryFailures/get-failure
=== RUN TestDirectUploadRecoveryFailures/metadata-rejection
=== RUN TestDirectUploadRecoveryFailures/database-disconnect
--- PASS: TestDirectUploadRecoveryFailures (2.66s)
--- PASS: TestDirectUploadRecoveryFailures/copy-result-loss (0.66s)
--- PASS: TestDirectUploadRecoveryFailures/get-failure (0.62s)
--- PASS: TestDirectUploadRecoveryFailures/metadata-rejection (0.67s)
--- PASS: TestDirectUploadRecoveryFailures/database-disconnect (0.71s)
=== RUN TestDirectUploadRecoveryProcessExit
--- PASS: TestDirectUploadRecoveryProcessExit (0.85s)
=== RUN TestDirectUploadRecoverySharedSlotAndCancellation
--- PASS: TestDirectUploadRecoverySharedSlotAndCancellation (0.63s)
PASS
````
## direct-failures
```sh
/usr/bin/python3 scripts/check_direct_upload.py --failures --restart
```
Начало: 2026-10-18T20:42:13.319145+00:00; длительность: 45.039 с; exit code: 0.
````text
PASS: original survives stopping confirming replica 959dccd157e1
PASS: original survives stopping confirming replica 7bdd907a608a
PASS: session, direct upload receipt, metadata and bytes survive restart
PASS: real S3 form, concurrent complete through two replicas, authorized bytes and attachment-only message
````
## Реализация
- [src/backend/repositories/direct_upload.go](../../src/backend/repositories/direct_upload.go)
- [src/frontend/src/directUpload.ts](../../src/frontend/src/directUpload.ts)
@@ -0,0 +1,39 @@
# Подпись, владелец, размер, SHA-256, MIME и CORS
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestDirectUploadValidationHTTP`, `TestDirectUploadValidationContents`, `TestDirectUploadAccess`, `TestDirectUploadAccessCORS`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](runs/20261018T203755.405686Z/backend.txt).
````text
=== RUN TestDirectUploadAccessPermissionsAndLifecycle
--- PASS: TestDirectUploadAccessPermissionsAndLifecycle (0.98s)
=== RUN TestDirectUploadAccessCORS
--- PASS: TestDirectUploadAccessCORS (0.02s)
=== RUN TestDirectUploadValidationHTTP
--- PASS: TestDirectUploadValidationHTTP (0.69s)
=== RUN TestDirectUploadValidationContents
--- PASS: TestDirectUploadValidationContents (0.82s)
=== RUN TestDirectUploadAccess
--- PASS: TestDirectUploadAccess (1.30s)
PASS
````
## Реализация
- [src/backend/handlers/direct_upload_http.go](../../src/backend/handlers/direct_upload_http.go)
- [src/backend/tests/direct_upload_test.go](../../src/backend/tests/direct_upload_test.go)
- [src/backend/tests/direct_permissions_test.go](../../src/backend/tests/direct_permissions_test.go)
+50
View File
@@ -0,0 +1,50 @@
[
{
"service": "api",
"hostname": "959dccd157e1",
"state": "running",
"health": "healthy"
},
{
"service": "api",
"hostname": "7bdd907a608a",
"state": "running",
"health": "healthy"
},
{
"service": "db",
"hostname": "259b35fab41e",
"state": "running",
"health": "healthy"
},
{
"service": "frontend",
"hostname": "c0bbd38841b9",
"state": "running",
"health": "healthy"
},
{
"service": "haproxy",
"hostname": "e21b07ae8881",
"state": "running",
"health": "healthy"
},
{
"service": "redis",
"hostname": "64a89a43e53b",
"state": "running",
"health": "healthy"
},
{
"service": "s3",
"hostname": "cc9133bc4406",
"state": "running",
"health": "healthy"
},
{
"service": "upload-cleanup",
"hostname": "e163dbec27d2",
"state": "running",
"health": null
}
]
+37
View File
@@ -0,0 +1,37 @@
# Сборка React UI
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## frontend-build
```sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml exec -T frontend npm run build
```
Начало: 2026-10-18T20:41:09.870085+00:00; длительность: 7.214 с; exit code: 0.
````text
> messenger-test-ui@1.0.0 build
> tsc --noEmit && vite build
vite v8.3.0 building client environment for production...
transforming...
✓ 21 modules transformed.
rendering chunks...
computing gzip size...
dist/index.html 0.42 kB │ gzip: 0.31 kB
dist/assets/index-DLiyty6M.css 9.50 kB │ gzip: 2.72 kB
dist/assets/index-_XVVkjP0.js 241.82 kB │ gzip: 75.95 kB
✓ built in 2.69s
````
## Реализация
- [src/frontend/src/App.tsx](../../src/frontend/src/App.tsx)
- [src/frontend/src/AttachmentImage.tsx](../../src/frontend/src/AttachmentImage.tsx)
- [src/frontend/src/directUpload.ts](../../src/frontend/src/directUpload.ts)
+481
View File
@@ -0,0 +1,481 @@
# Сессия, метаданные и оригинал после restart
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## before-restart
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe inventory
```
Начало: 2026-10-18T20:41:56.334689+00:00; длительность: 0.669 с; exit code: 0.
````text
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:24.516118521Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:37.447855485Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.416387316Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:50.41521695Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.786499611Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:49.925277255Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:52.124509294Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.81722101Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
````
## persistence
```sh
make test-persistence ACTION_SCRIPT=scripts/restart.sh
```
Начало: 2026-10-18T20:41:57.035205+00:00; длительность: 15.362 с; exit code: 0.
````text
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
````
## after-restart
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe inventory
```
Начало: 2026-10-18T20:42:12.429373+00:00; длительность: 0.660 с; exit code: 0.
````text
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:05.941585408Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:06.080394151Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.024663538Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:07.39677266Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.1118558Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.349056081Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:07.681167653Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:42:05.78951003Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
````
## restart-audit
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe restart --before /mnt/c/projects/Highload-systems/mtusi2026lab4-fork/evidence/criteria/runs/20261018T203755.405686Z/before-restart.txt --after /mnt/c/projects/Highload-systems/mtusi2026lab4-fork/evidence/criteria/runs/20261018T203755.405686Z/after-restart.txt
```
Начало: 2026-10-18T20:42:13.123287+00:00; длительность: 0.165 с; exit code: 0.
````text
PASS: real restart db; same containers and persistent volumes
PASS: real restart redis; same containers and persistent volumes
PASS: real restart s3; same containers and persistent volumes
PASS: real restart api; same containers and persistent volumes
PASS: real restart upload-cleanup; same containers and persistent volumes
````
## direct-failures
```sh
/usr/bin/python3 scripts/check_direct_upload.py --failures --restart
```
Начало: 2026-10-18T20:42:13.319145+00:00; длительность: 45.039 с; exit code: 0.
````text
PASS: original survives stopping confirming replica 959dccd157e1
PASS: original survives stopping confirming replica 7bdd907a608a
PASS: session, direct upload receipt, metadata and bytes survive restart
PASS: real S3 form, concurrent complete through two replicas, authorized bytes and attachment-only message
````
## Реализация
- [scripts/restart.sh](../../scripts/restart.sh)
- [tests/resilience.py](../../tests/resilience.py)
+44
View File
@@ -0,0 +1,44 @@
# PNG/JPEG, ready, сообщение и побайтный download
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestAttachmentAccessHTTP`.
## proxy
```sh
make test-grade3
```
Начало: 2026-10-18T20:41:01.363701+00:00; длительность: 3.645 с; exit code: 0.
````text
python3 scripts/check_grade3.py --base-url "http://localhost:8080"
PASS: image limits, chunked upload, ACL, message attachments, concurrent replay across replicas
````
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](runs/20261018T203755.405686Z/backend.txt).
````text
=== RUN TestAttachmentAccessHTTP
--- PASS: TestAttachmentAccessHTTP (1.08s)
PASS
````
## Реализация
- [src/backend/services/attachment.go](../../src/backend/services/attachment.go)
- [src/backend/handlers/attachment_http.go](../../src/backend/handlers/attachment_http.go)
- [src/backend/repositories/attachment.go](../../src/backend/repositories/attachment.go)
+38
View File
@@ -0,0 +1,38 @@
# Публичный smoke и структура контракта
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## structure
```sh
make check
```
Начало: 2026-10-18T20:38:16.782745+00:00; длительность: 16.132 с; exit code: 0.
````text
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
````
## smoke
```sh
make test
```
Начало: 2026-10-18T20:38:32.945680+00:00; длительность: 8.175 с; exit code: 0.
````text
python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
````
## Реализация
- [tests/smoke.py](../../tests/smoke.py)
- [contracts/openapi.json](../../contracts/openapi.json)
+128
View File
@@ -0,0 +1,128 @@
# Оригинал после остановки обслужившей API
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## proxy-failures
```sh
make test-grade3-failures
```
Начало: 2026-10-18T20:41:17.113921+00:00; длительность: 42.575 с; exit code: 0.
````text
python3 scripts/check_grade3.py --base-url "http://localhost:8080" --failures
PASS: image limits, chunked upload, ACL, message attachments, concurrent replay across replicas
PASS: stop the uploading replica, download from the other (both replicas)
PASS: S3 unavailable/recovery, private bucket
````
## direct-failures
```sh
/usr/bin/python3 scripts/check_direct_upload.py --failures --restart
```
Начало: 2026-10-18T20:42:13.319145+00:00; длительность: 45.039 с; exit code: 0.
````text
PASS: original survives stopping confirming replica 959dccd157e1
PASS: original survives stopping confirming replica 7bdd907a608a
PASS: session, direct upload receipt, metadata and bytes survive restart
PASS: real S3 form, concurrent complete through two replicas, authorized bytes and attachment-only message
````
## public-failover
```sh
make test-failover ACTION_SCRIPT=scripts/stop-one.sh
```
Начало: 2026-10-18T20:42:54.991730+00:00; длительность: 18.692 с; exit code: 0.
````text
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 124, "failed_attempts": 2, "first_recovery_seconds": 1.793}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
````
## restore
```sh
make app-start
```
Начало: 2026-10-18T20:43:17.143841+00:00; длительность: 9.220 с; exit code: 0.
````text
python3 scripts/init_env.py
Local .env and connection files ready; existing values and files preserved.
chmod +x scripts/restart.sh scripts/stop-one.sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml up -d --no-build --wait
Container highload-lab4-upload-cleanup-1 Running
Container highload-lab4-frontend-1 Running
Container highload-lab4-api-2 Running
Container highload-lab4-s3-1 Running
Container highload-lab4-haproxy-1 Running
Container highload-lab4-redis-1 Running
Container highload-lab4-db-1 Running
Container highload-lab4-s3-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Starting
Container highload-lab4-db-1 Healthy
Container highload-lab4-migrate-1 Starting
Container highload-lab4-s3-bootstrap-1 Started
Container highload-lab4-migrate-1 Started
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-redis-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-db-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-migrate-1 Exited
Container highload-lab4-redis-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-1 Starting
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-1 Started
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-redis-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-frontend-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-upload-cleanup-1 Waiting
Container highload-lab4-s3-1 Waiting
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-upload-cleanup-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-frontend-1 Healthy
Container highload-lab4-redis-1 Healthy
Container highload-lab4-db-1 Healthy
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
````
## Реализация
- [scripts/check_grade3.py](../../scripts/check_grade3.py)
- [scripts/check_direct_upload.py](../../scripts/check_direct_upload.py)
- [scripts/stop-one.sh](../../scripts/stop-one.sh)
@@ -0,0 +1,201 @@
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:05.941585408Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:06.080394151Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.024663538Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:07.39677266Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.1118558Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.349056081Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:07.681167653Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:42:05.78951003Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
@@ -0,0 +1,532 @@
python3 scripts/init_env.py
Local .env and connection files ready; existing values and files preserved.
chmod +x scripts/restart.sh scripts/stop-one.sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml --profile test run --build --rm backend-tests
Image highload-lab4-s3-bootstrap Building
Image highload-lab4-s3 Building
#1 [internal] load local bake definitions
#1 reading from stdin 1.08kB done
#1 DONE 0.0s
#2 [s3 internal] load build definition from minio.Dockerfile
#2 DONE 0.0s
#3 [s3-bootstrap internal] load build definition from Dockerfile
#3 transferring dockerfile: 661B 0.0s done
#3 DONE 0.1s
#4 [s3-bootstrap internal] load metadata for docker.io/library/golang:1.22.2-bookworm
#4 DONE 0.0s
#2 [s3 internal] load build definition from minio.Dockerfile
#2 transferring dockerfile: 1.01kB 0.0s done
#2 DONE 0.1s
#5 [s3 internal] load metadata for docker.io/library/debian:12.15-slim
#5 DONE 0.0s
#6 [s3-bootstrap internal] load .dockerignore
#6 transferring context: 268B 0.0s done
#6 DONE 0.1s
#7 [s3 internal] load metadata for docker.io/library/golang:1.24.2-bookworm
#7 ...
#8 [s3-bootstrap stage-1 1/4] FROM docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171
#8 resolve docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171 0.0s done
#8 DONE 0.0s
#9 [s3-bootstrap builder 1/6] FROM docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f
#9 resolve docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f 0.0s done
#9 DONE 0.0s
#10 [s3-bootstrap internal] load build context
#10 ...
#7 [s3 internal] load metadata for docker.io/library/golang:1.24.2-bookworm
#7 DONE 0.6s
#10 [s3-bootstrap internal] load build context
#10 transferring context: 4.39kB 0.5s done
#10 DONE 0.5s
#8 [s3 stage-1 1/4] FROM docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171
#8 resolve docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171 0.0s done
#8 DONE 0.0s
#11 [s3 internal] load .dockerignore
#11 transferring context: 2B 0.0s done
#11 DONE 0.0s
#12 [s3-bootstrap builder 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/messenger ./backend
#12 CACHED
#13 [s3-bootstrap builder 3/6] COPY go.mod go.sum ./
#13 CACHED
#14 [s3-bootstrap builder 4/6] RUN go mod download
#14 CACHED
#15 [s3-bootstrap builder 2/6] WORKDIR /src
#15 CACHED
#16 [s3-bootstrap stage-1 2/4] RUN groupadd --system app && useradd --system --gid app --no-create-home app
#16 CACHED
#17 [s3-bootstrap builder 5/6] COPY backend ./backend
#17 CACHED
#18 [s3-bootstrap stage-1 3/4] WORKDIR /app
#18 CACHED
#19 [s3-bootstrap stage-1 4/4] COPY --from=builder /out/messenger ./messenger
#19 CACHED
#20 [s3 builder 1/4] FROM docker.io/library/golang:1.24.2-bookworm@sha256:79390b5e5af9ee6e7b1173ee3eac7fadf6751a545297672916b59bfa0ecf6f71
#20 resolve docker.io/library/golang:1.24.2-bookworm@sha256:79390b5e5af9ee6e7b1173ee3eac7fadf6751a545297672916b59bfa0ecf6f71 0.0s done
#20 DONE 0.1s
#21 [s3 builder 3/4] RUN git init . && git remote add origin https://github.com/minio/minio.git && git fetch --depth 1 origin 0d7408fc9969caf07de6a8c3a84f9fbb10a6739e && git checkout --detach FETCH_HEAD
#21 CACHED
#22 [s3 builder 4/4] RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X github.com/minio/minio/cmd.Version=2025-04-22T22:12:26Z -X github.com/minio/minio/cmd.ReleaseTag=RELEASE.2025-04-22T22-12-26Z -X github.com/minio/minio/cmd.CommitID=0d7408fc9969caf07de6a8c3a84f9fbb10a6739e" -o /out/minio .
#22 CACHED
#23 [s3 stage-1 2/3] RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && rm -rf /var/lib/apt/lists/* && groupadd --system storage && useradd --system --gid storage storage && mkdir /data && chown storage:storage /data
#23 CACHED
#24 [s3 builder 2/4] WORKDIR /source
#24 CACHED
#25 [s3 stage-1 3/3] COPY --from=builder /out/minio /usr/local/bin/minio
#25 CACHED
#26 [s3-bootstrap] exporting to image
#26 exporting layers done
#26 exporting manifest sha256:dd2bbbd4483023e5124c00da1cc13633ac948721c55e0bf6a6bf7331c0cd06e4 done
#26 exporting config sha256:6c819718ab87aac477b0a779c7763274bbabe01223ec05eb372077f96b98adb3 done
#26 exporting attestation manifest sha256:4e1cb2592720a346fc681606478951a95ab5589711c24ef1b8fc42c20f4e3b75 0.0s done
#26 exporting manifest list sha256:c9a7613d41fc469eeb618c2f607be411e843916ca216449c6c9ce41ea0afadc7 0.0s done
#26 naming to docker.io/library/highload-lab4-s3-bootstrap:latest done
#26 unpacking to docker.io/library/highload-lab4-s3-bootstrap:latest 0.0s done
#26 DONE 0.2s
#27 [s3] exporting to image
#27 exporting layers done
#27 exporting manifest sha256:cf1641bb428d024d81f932bd8ab277ade2790aa5cb2ec1b90238a00df54ccbee done
#27 exporting config sha256:b261b45a54ac72fb091ebba0c6b5e09aedc1239e48fe469c1d81ae7ea23621e6 0.0s done
#27 exporting attestation manifest sha256:d90f5c8d3d8cf65e8e6d336fc2c8212925adacea602e77273e6ea83e522f322d 0.0s done
#27 exporting manifest list sha256:abb33d1db0688c1b340efeafa81f0a188fae5d2e7d5104682908e1f8b67b546a 0.0s done
#27 naming to docker.io/library/highload-lab4-s3:latest done
#27 unpacking to docker.io/library/highload-lab4-s3:latest 0.0s done
#27 DONE 0.2s
#28 [s3-bootstrap] resolving provenance for metadata file
#28 DONE 0.0s
#29 [s3] resolving provenance for metadata file
#29 DONE 0.0s
Image highload-lab4-s3 Built
Image highload-lab4-s3-bootstrap Built
Container highload-lab4-db-1 Running
Container highload-lab4-s3-1 Running
Container highload-lab4-redis-1 Running
Container highload-lab4-s3-1 Waiting
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Starting
Container highload-lab4-s3-bootstrap-1 Started
Image highload-lab4-backend-tests Building
#1 [internal] load local bake definitions
#1 reading from stdin 1.58kB done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 661B 0.0s done
#2 DONE 0.1s
#3 [internal] load metadata for docker.io/library/golang:1.22.2-bookworm
#3 DONE 0.0s
#4 [internal] load .dockerignore
#4 transferring context: 33B
#4 transferring context: 268B 0.0s done
#4 DONE 0.0s
#5 [builder 1/6] FROM docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f
#5 resolve docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f 0.0s done
#5 DONE 0.0s
#6 [internal] load build context
#6 transferring context: 4.39kB 0.5s done
#6 DONE 0.5s
#7 [builder 2/6] WORKDIR /src
#7 CACHED
#8 [builder 3/6] COPY go.mod go.sum ./
#8 CACHED
#9 [builder 4/6] RUN go mod download
#9 CACHED
#10 [builder 5/6] COPY backend ./backend
#10 CACHED
#11 [builder 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/messenger ./backend
#11 CACHED
#12 exporting to image
#12 exporting layers done
#12 exporting manifest sha256:342fd07d626776537b397a8a6f8baa4b8bec9db010893bfeabc0e8a36b55cfd5 done
#12 exporting config sha256:45a05b24d4b61e41474a7ec0815634ba3ad8e46f9a02c6fd53f1c2d40b9d7429 done
#12 exporting attestation manifest sha256:b6e80a9d1751b9d695420b019bb354ec1ef2aee3464db8fa7a3193f12d326dae
#12 exporting attestation manifest sha256:b6e80a9d1751b9d695420b019bb354ec1ef2aee3464db8fa7a3193f12d326dae 0.0s done
#12 exporting manifest list sha256:f62521487a7e8ce67a1e92cae7a493447885d87d99c6ef8e28942a5e3af2c66e 0.0s done
#12 naming to docker.io/library/highload-lab4-backend-tests:latest done
#12 unpacking to docker.io/library/highload-lab4-backend-tests:latest 0.0s done
#12 DONE 0.1s
#13 resolving provenance for metadata file
#13 DONE 0.0s
Image highload-lab4-backend-tests Built
Container highload-lab4-redis-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-db-1 Healthy
Container highload-lab4-redis-1 Healthy
Container highload-lab4-backend-tests-run-3c4d84766446 Creating
Container highload-lab4-backend-tests-run-3c4d84766446 Created
? messenger/src/backend [no test files]
? messenger/src/backend/handlers [no test files]
? messenger/src/backend/repositories [no test files]
? messenger/src/backend/services [no test files]
=== RUN TestAttachmentCleanupGraceLocksProtectionAndRetry
--- PASS: TestAttachmentCleanupGraceLocksProtectionAndRetry (0.88s)
=== RUN TestAttachmentCleanupInvalidKeyIsNeverDeleted
--- PASS: TestAttachmentCleanupInvalidKeyIsNeverDeleted (0.61s)
=== RUN TestAttachmentValidationHTTP
--- PASS: TestAttachmentValidationHTTP (1.47s)
=== RUN TestAttachmentAccessHTTP
--- PASS: TestAttachmentAccessHTTP (1.08s)
=== RUN TestUploadRecoveryHTTPDisconnect
--- PASS: TestUploadRecoveryHTTPDisconnect (1.09s)
=== RUN TestAttachmentImageValidation
--- PASS: TestAttachmentImageValidation (0.00s)
=== RUN TestAttachmentFilenameValidation
--- PASS: TestAttachmentFilenameValidation (0.00s)
=== RUN TestAttachmentMessageRequiresStringText
--- PASS: TestAttachmentMessageRequiresStringText (0.59s)
=== RUN TestConcurrentMessageCreation
--- PASS: TestConcurrentMessageCreation (3.88s)
=== RUN TestConnectionFilesTakePrecedence
--- PASS: TestConnectionFilesTakePrecedence (0.00s)
=== RUN TestConfiguredIdempotencyTTL
--- PASS: TestConfiguredIdempotencyTTL (0.62s)
=== RUN TestInvalidIdempotencyTTL
--- PASS: TestInvalidIdempotencyTTL (0.00s)
=== RUN TestCursorRejectsInvalidUUIDBeforeDatabaseAccess
=== RUN TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/chats/user_id/not-a-uuid
=== RUN TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/chats/chat_id/not-a-uuid
=== RUN TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/messages/chat_id/not-a-uuid
=== RUN TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/messages/message_id/not-a-uuid
=== RUN TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/chats/user_id/ffffffff-ffff-ffff-ffff-fffffffffffz
=== RUN TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/chats/chat_id/ffffffff-ffff-ffff-ffff-fffffffffffz
=== RUN TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/messages/chat_id/ffffffff-ffff-ffff-ffff-fffffffffffz
=== RUN TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/messages/message_id/ffffffff-ffff-ffff-ffff-fffffffffffz
--- PASS: TestCursorRejectsInvalidUUIDBeforeDatabaseAccess (0.00s)
--- PASS: TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/chats/user_id/not-a-uuid (0.00s)
--- PASS: TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/chats/chat_id/not-a-uuid (0.00s)
--- PASS: TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/messages/chat_id/not-a-uuid (0.00s)
--- PASS: TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/messages/message_id/not-a-uuid (0.00s)
--- PASS: TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/chats/user_id/ffffffff-ffff-ffff-ffff-fffffffffffz (0.00s)
--- PASS: TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/chats/chat_id/ffffffff-ffff-ffff-ffff-fffffffffffz (0.00s)
--- PASS: TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/messages/chat_id/ffffffff-ffff-ffff-ffff-fffffffffffz (0.00s)
--- PASS: TestCursorRejectsInvalidUUIDBeforeDatabaseAccess/messages/message_id/ffffffff-ffff-ffff-ffff-fffffffffffz (0.00s)
=== RUN TestChatCursorPreservesPosition
--- PASS: TestChatCursorPreservesPosition (0.00s)
=== RUN TestDirectUploadCleanupSafetyAndReplay
--- PASS: TestDirectUploadCleanupSafetyAndReplay (0.87s)
=== RUN TestDirectUploadCleanupDependencyFailureAndMalformedKey
--- PASS: TestDirectUploadCleanupDependencyFailureAndMalformedKey (0.66s)
=== RUN TestDirectUploadAccessPermissionsAndLifecycle
--- PASS: TestDirectUploadAccessPermissionsAndLifecycle (0.98s)
=== RUN TestDirectUploadAccessCORS
--- PASS: TestDirectUploadAccessCORS (0.02s)
=== RUN TestDirectUploadFlow
--- PASS: TestDirectUploadFlow (0.76s)
=== RUN TestDirectUploadValidationHTTP
--- PASS: TestDirectUploadValidationHTTP (0.69s)
=== RUN TestDirectUploadValidationContents
--- PASS: TestDirectUploadValidationContents (0.82s)
=== RUN TestDirectUploadAccess
--- PASS: TestDirectUploadAccess (1.30s)
=== RUN TestDirectUploadRecoveryConcurrentComplete
--- PASS: TestDirectUploadRecoveryConcurrentComplete (0.61s)
=== RUN TestDirectUploadRecoveryFailures
=== RUN TestDirectUploadRecoveryFailures/copy-result-loss
=== RUN TestDirectUploadRecoveryFailures/get-failure
=== RUN TestDirectUploadRecoveryFailures/metadata-rejection
=== RUN TestDirectUploadRecoveryFailures/database-disconnect
--- PASS: TestDirectUploadRecoveryFailures (2.66s)
--- PASS: TestDirectUploadRecoveryFailures/copy-result-loss (0.66s)
--- PASS: TestDirectUploadRecoveryFailures/get-failure (0.62s)
--- PASS: TestDirectUploadRecoveryFailures/metadata-rejection (0.67s)
--- PASS: TestDirectUploadRecoveryFailures/database-disconnect (0.71s)
=== RUN TestDirectUploadRecoveryProcessExit
--- PASS: TestDirectUploadRecoveryProcessExit (0.85s)
=== RUN TestDirectUploadCrashHelper
--- PASS: TestDirectUploadCrashHelper (0.00s)
=== RUN TestDirectUploadRecoverySharedSlotAndCancellation
--- PASS: TestDirectUploadRecoverySharedSlotAndCancellation (0.63s)
=== RUN TestConcurrentRegistrationSameUsername
--- PASS: TestConcurrentRegistrationSameUsername (1.18s)
=== RUN TestChatTransactionRollsBackAfterMemberInsertFailure
--- PASS: TestChatTransactionRollsBackAfterMemberInsertFailure (1.30s)
=== RUN TestShortSessionTTLAndLogout
grade4_lab2_test.go:118: GET /api/v1/users/me: HTTP 200
grade4_lab2_test.go:134: SESSION_TTL_SECONDS=2: expiry observed after 2.055101347s
grade4_lab2_test.go:135: GET /api/v1/users/me: HTTP 401
grade4_lab2_test.go:146: GET /api/v1/users/me: HTTP 401
--- PASS: TestShortSessionTTLAndLogout (2.68s)
=== RUN TestWrongPasswordAndLogoutHTTP
--- PASS: TestWrongPasswordAndLogoutHTTP (1.27s)
=== RUN TestDependencyFailuresReturnUnavailable
redis: 2026/10/18 20:40:44 pool.go:426: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
redis: 2026/10/18 20:40:44 pool.go:426: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
redis: 2026/10/18 20:40:45 pool.go:426: redis: connection pool: failed to dial after 5 attempts: dial tcp 127.0.0.1:1: connect: connection refused
--- PASS: TestDependencyFailuresReturnUnavailable (2.40s)
=== RUN TestHistoryQueryPlanAtTenThousandMessages
=== RUN TestHistoryQueryPlanAtTenThousandMessages/first
grade4_lab2_test.go:281: first page EXPLAIN (ANALYZE, BUFFERS): [
{
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.29,
"Total Cost": 4.29,
"Plan Rows": 51,
"Plan Width": 69,
"Actual Startup Time": 0.020,
"Actual Total Time": 0.033,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 3,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_history_idx",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.29,
"Total Cost": 784.70,
"Plan Rows": 9999,
"Plan Width": 69,
"Actual Startup Time": 0.019,
"Actual Total Time": 0.027,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "((chat_id = 'b223d993-d605-4bfe-8035-435c9ede3221'::uuid) AND (ROW(created_at, id) > ROW('0001-01-01 00:00:00+00'::timestamp with time zone, '00000000-0000-0000-0000-000000000000'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Shared Hit Blocks": 3,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 6,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.144,
"Triggers": [
],
"Execution Time": 0.176
}
]
=== RUN TestHistoryQueryPlanAtTenThousandMessages/late
grade4_lab2_test.go:281: late page EXPLAIN (ANALYZE, BUFFERS): [
{
"Plan": {
"Node Type": "Limit",
"Parallel Aware": false,
"Async Capable": false,
"Startup Cost": 0.29,
"Total Cost": 14.48,
"Plan Rows": 51,
"Plan Width": 69,
"Actual Startup Time": 0.029,
"Actual Total Time": 0.049,
"Actual Rows": 51,
"Actual Loops": 1,
"Shared Hit Blocks": 3,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0,
"Plans": [
{
"Node Type": "Index Scan",
"Parent Relationship": "Outer",
"Parallel Aware": false,
"Async Capable": false,
"Scan Direction": "Forward",
"Index Name": "messages_history_idx",
"Relation Name": "messages",
"Alias": "messages",
"Startup Cost": 0.29,
"Total Cost": 278.27,
"Plan Rows": 999,
"Plan Width": 69,
"Actual Startup Time": 0.028,
"Actual Total Time": 0.042,
"Actual Rows": 51,
"Actual Loops": 1,
"Index Cond": "((chat_id = 'b223d993-d605-4bfe-8035-435c9ede3221'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009001+00'::timestamp with time zone, '8d5d01eb-6729-47e0-a7c1-db170ff9ba40'::uuid)))",
"Rows Removed by Index Recheck": 0,
"Shared Hit Blocks": 3,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
}
]
},
"Planning": {
"Shared Hit Blocks": 0,
"Shared Read Blocks": 0,
"Shared Dirtied Blocks": 0,
"Shared Written Blocks": 0,
"Local Hit Blocks": 0,
"Local Read Blocks": 0,
"Local Dirtied Blocks": 0,
"Local Written Blocks": 0,
"Temp Read Blocks": 0,
"Temp Written Blocks": 0
},
"Planning Time": 0.124,
"Triggers": [
],
"Execution Time": 0.073
}
]
--- PASS: TestHistoryQueryPlanAtTenThousandMessages (0.75s)
--- PASS: TestHistoryQueryPlanAtTenThousandMessages/first (0.00s)
--- PASS: TestHistoryQueryPlanAtTenThousandMessages/late (0.00s)
=== RUN TestIdempotencyConcurrentStoresAndScopes
--- PASS: TestIdempotencyConcurrentStoresAndScopes (1.24s)
=== RUN TestIdempotencyRecordFailureRollsBackMessage
--- PASS: TestIdempotencyRecordFailureRollsBackMessage (0.58s)
=== RUN TestMessengerWorkflow
--- PASS: TestMessengerWorkflow (0.92s)
=== RUN TestDecodeJSONBodyRequiresExactFieldNames
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/canonical
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/escaped_canonical_name
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/uppercase_extra
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/uppercase_extra_first
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/mixed_case
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/uppercase_attachments
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/escaped_uppercase
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/unknown_field
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/wrong_type
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/null
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/array
=== RUN TestDecodeJSONBodyRequiresExactFieldNames/trailing_object
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames (0.58s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/canonical (0.01s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/escaped_canonical_name (0.01s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/uppercase_extra (0.00s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/uppercase_extra_first (0.00s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/mixed_case (0.00s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/uppercase_attachments (0.00s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/escaped_uppercase (0.00s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/unknown_field (0.00s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/wrong_type (0.00s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/null (0.00s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/array (0.00s)
--- PASS: TestDecodeJSONBodyRequiresExactFieldNames/trailing_object (0.00s)
=== RUN TestCreateMessageBlankText
--- PASS: TestCreateMessageBlankText (0.54s)
=== RUN TestCreateMessageFromChatOutsider
--- PASS: TestCreateMessageFromChatOutsider (0.88s)
=== RUN TestListMessagesPagination
--- PASS: TestListMessagesPagination (0.55s)
=== RUN TestListPageByChatUsesCursorAndLimit
--- PASS: TestListPageByChatUsesCursorAndLimit (0.53s)
=== RUN TestListPageByChatReturnsNonNilEmptyPage
--- PASS: TestListPageByChatReturnsNonNilEmptyPage (0.19s)
=== RUN TestS3PermissionsAndBootstrap
--- PASS: TestS3PermissionsAndBootstrap (0.92s)
=== RUN TestPasswordKDFUsesSaltAndFullUTF8Password
--- PASS: TestPasswordKDFUsesSaltAndFullUTF8Password (1.37s)
=== RUN TestStoredPasswordUsesArgon2id
--- PASS: TestStoredPasswordUsesArgon2id (0.62s)
=== RUN TestBearerRequiredIgnoresXUserID
--- PASS: TestBearerRequiredIgnoresXUserID (0.00s)
=== RUN TestMessageCursorPreservesPosition
--- PASS: TestMessageCursorPreservesPosition (0.00s)
=== RUN TestUploadRecoveryAfterPutFailure
--- PASS: TestUploadRecoveryAfterPutFailure (0.58s)
=== RUN TestUploadRecoveryMetadataRejection
--- PASS: TestUploadRecoveryMetadataRejection (0.60s)
=== RUN TestUploadRecoveryDatabaseConnectionLoss
--- PASS: TestUploadRecoveryDatabaseConnectionLoss (0.62s)
=== RUN TestUploadRecoveryProcessExit
--- PASS: TestUploadRecoveryProcessExit (0.67s)
=== RUN TestUploadCrashHelper
--- PASS: TestUploadCrashHelper (0.00s)
=== RUN TestUploadRecoveryInterruptedBody
--- PASS: TestUploadRecoveryInterruptedBody (0.55s)
=== RUN TestUploadRecoveryWaitingCancellation
--- PASS: TestUploadRecoveryWaitingCancellation (0.60s)
=== RUN TestCreateUserInvalidJSON
--- PASS: TestCreateUserInvalidJSON (0.00s)
=== RUN TestCreateUserDuplicateUsername
--- PASS: TestCreateUserDuplicateUsername (0.87s)
=== RUN TestCaseVariantExtraFieldsReturn400WithoutSaving
--- PASS: TestCaseVariantExtraFieldsReturn400WithoutSaving (0.60s)
=== RUN TestChatRejectsCaseVariantDuplicateMembersBeforeSQL
--- PASS: TestChatRejectsCaseVariantDuplicateMembersBeforeSQL (0.00s)
=== RUN TestChatNormalizesMemberUUIDsHTTP
--- PASS: TestChatNormalizesMemberUUIDsHTTP (0.56s)
PASS
ok messenger/src/backend/tests 46.524s
@@ -0,0 +1,52 @@
# Возможности lab3
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestStoredPasswordUsesArgon2id`, `TestShortSessionTTLAndLogout`, `TestIdempotencyConcurrentStoresAndScopes`, `TestChatTransactionRollsBackAfterMemberInsertFailure`, `TestListMessagesPagination`.
## baseline
```sh
make test-baseline
```
Начало: 2026-10-18T20:38:39.428018+00:00; длительность: 1.345 с; exit code: 0.
````text
python3 scripts/check_baseline.py --base-url "http://localhost:8080"
PASS: transferred API, shared sessions, chat, message, logout
````
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](backend.txt).
````text
=== RUN TestChatTransactionRollsBackAfterMemberInsertFailure
--- PASS: TestChatTransactionRollsBackAfterMemberInsertFailure (1.30s)
=== RUN TestShortSessionTTLAndLogout
--- PASS: TestShortSessionTTLAndLogout (2.68s)
=== RUN TestIdempotencyConcurrentStoresAndScopes
--- PASS: TestIdempotencyConcurrentStoresAndScopes (1.24s)
=== RUN TestListMessagesPagination
--- PASS: TestListMessagesPagination (0.55s)
=== RUN TestStoredPasswordUsesArgon2id
--- PASS: TestStoredPasswordUsesArgon2id (0.62s)
PASS
````
## Реализация
- [src/backend/repositories/idempotency.go](../../../../src/backend/repositories/idempotency.go)
- [src/backend/repositories/redis.go](../../../../src/backend/repositories/redis.go)
- [src/backend/services/password.go](../../../../src/backend/services/password.go)
@@ -0,0 +1,2 @@
python3 scripts/check_baseline.py --base-url "http://localhost:8080"
PASS: transferred API, shared sessions, chat, message, logout
@@ -0,0 +1,201 @@
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:24.516118521Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:37.447855485Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.416387316Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:50.41521695Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.786499611Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:49.925277255Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:52.124509294Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.81722101Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
@@ -0,0 +1,257 @@
# Потоковая обработка, лимиты и ≥10 клиентов
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## inventory
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe inventory
```
Начало: 2026-10-18T20:38:15.728752+00:00; длительность: 0.679 с; exit code: 0.
````text
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:36:24.367291372Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.89479619Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.416387316Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:06.043221163Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.786499611Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:50.058525711Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:06.399345399Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.81722101Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
````
## experiment
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe experiment --campaign /mnt/c/projects/Highload-systems/mtusi2026lab4-fork/evidence/upload-comparison/20261018T193626Z-formal-f49d61
```
Начало: 2026-10-18T20:43:13.717511+00:00; длительность: 3.393 с; exit code: 0.
````text
PASS: sealed protocol, archive, fixtures, raw records and recomputed decision match
Campaign: evidence/upload-comparison/20261018T193626Z-formal-f49d61
Ready/verified: 720 720
Errors: 0
{"profile": "small-moderate", "valid_pairs": 3, "median_traffic_ratio": 0.5065773906213067, "min_traffic_ratio": 0.5063861055246678, "max_traffic_ratio": 0.5079907229528128}
{"profile": "large-moderate", "valid_pairs": 3, "median_traffic_ratio": 0.49949754357270226, "min_traffic_ratio": 0.4991382402982068, "max_traffic_ratio": 0.49981732427785186}
{"profile": "small-pixels40m", "valid_pairs": 3, "median_traffic_ratio": 0.5126058228037882, "min_traffic_ratio": 0.50707065100036, "max_traffic_ratio": 0.512817391975545}
{"profile": "large-pixels40m", "valid_pairs": 3, "median_traffic_ratio": 0.49928261799970935, "min_traffic_ratio": 0.4992082132615818, "max_traffic_ratio": 0.49959788796606974}
{"profile": "small-moderate", "mode": "proxy", "median_api_MiB_per_ready": 2.0209168752034503, "median_api_window_peak_MiB": 136.0546875, "max_api_lifetime_peak_MiB": 141.2265625, "median_ready_rps": 7.894590746470929, "median_p50_s": 0.13762395, "median_p95_s": 0.349706212, "median_p99_s": 0.353454295}
{"profile": "small-moderate", "mode": "direct", "median_api_MiB_per_ready": 1.0233642260233562, "median_api_window_peak_MiB": 138.71875, "max_api_lifetime_peak_MiB": 140.8125, "median_ready_rps": 6.6154831177570035, "median_p50_s": 0.330249949, "median_p95_s": 0.664536392, "median_p99_s": 0.665379127}
{"profile": "large-moderate", "mode": "proxy", "median_api_MiB_per_ready": 20.11448278427124, "median_api_window_peak_MiB": 148.44140625, "max_api_lifetime_peak_MiB": 152.44921875, "median_ready_rps": 4.708766693021728, "median_p50_s": 0.623532216, "median_p95_s": 1.199421251, "median_p99_s": 1.370958831}
{"profile": "large-moderate", "mode": "direct", "median_api_MiB_per_ready": 10.044582716623943, "median_api_window_peak_MiB": 147.1796875, "max_api_lifetime_peak_MiB": 150.04296875, "median_ready_rps": 3.1121213975127984, "median_p50_s": 1.760060342, "median_p95_s": 2.429332421, "median_p99_s": 2.519360375}
{"profile": "small-pixels40m", "mode": "proxy", "median_api_MiB_per_ready": 2.0204983075459797, "median_api_window_peak_MiB": 381.2734375, "max_api_lifetime_peak_MiB": 384.3203125, "median_ready_rps": 3.145227806944573, "median_p50_s": 1.294338167, "median_p95_s": 2.522289981, "median_p99_s": 2.55024115}
{"profile": "small-pixels40m", "mode": "direct", "median_api_MiB_per_ready": 1.0358009020487466, "median_api_window_peak_MiB": 384.0546875, "max_api_lifetime_peak_MiB": 387.94140625, "median_ready_rps": 2.8002143610390253, "median_p50_s": 1.645604573, "median_p95_s": 3.186833871, "median_p99_s": 3.235123098}
{"profile": "large-pixels40m", "mode": "proxy", "median_api_MiB_per_ready": 20.120631217956543, "median_api_window_peak_MiB": 391.99609375, "max_api_lifetime_peak_MiB": 393.2578125, "median_ready_rps": 2.3240187390207696, "median_p50_s": 1.835096441, "median_p95_s": 3.14764051, "median_p99_s": 3.996668065}
{"profile": "large-pixels40m", "mode": "direct", "median_api_MiB_per_ready": 10.045849291483561, "median_api_window_peak_MiB": 393.05859375, "max_api_lifetime_peak_MiB": 397.359375, "median_ready_rps": 1.780860551975933, "median_p50_s": 3.21658326, "median_p95_s": 5.166217115, "median_p99_s": 5.44240128}
Decision: confirmed_in_tested_conditions
````
## Реализация
- [src/backend/services/attachment.go](../../../../src/backend/services/attachment.go)
- [src/backend/services/direct_upload.go](../../../../src/backend/services/direct_upload.go)
- [experiments/config/protocol.json](../../../../experiments/config/protocol.json)
Измерения не запускались повторно: проверены сохранённые сырые данные.
[Серия](../../../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/metrics.json) · [Протокол](../../../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/protocol.json) · [Графики](../../../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/)
@@ -0,0 +1,4 @@
docker compose --project-name highload-lab4 --env-file .env -f compose.yml run --rm --no-deps upload-cleanup ./messenger attachments-cleanup --dry-run
Container highload-lab4-upload-cleanup-run-ee9c8bded59f Creating
Container highload-lab4-upload-cleanup-run-ee9c8bded59f Created
{"direct":{"candidates":1,"deleted":0,"eligible":1,"protected":0,"skipped":0,"failed":0,"dry_run":true},"originals":{"candidates":0,"deleted":0,"eligible":0,"protected":0,"skipped":0,"failed":0,"dry_run":true}}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,49 @@
# Незавершённый staging, replay, dry-run и lifecycle
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestDirectUploadCleanupSafetyAndReplay`, `TestDirectUploadCleanupDependencyFailureAndMalformedKey`, `TestDirectUploadAccessPermissionsAndLifecycle`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](backend.txt).
````text
=== RUN TestDirectUploadCleanupSafetyAndReplay
--- PASS: TestDirectUploadCleanupSafetyAndReplay (0.87s)
=== RUN TestDirectUploadCleanupDependencyFailureAndMalformedKey
--- PASS: TestDirectUploadCleanupDependencyFailureAndMalformedKey (0.66s)
=== RUN TestDirectUploadAccessPermissionsAndLifecycle
--- PASS: TestDirectUploadAccessPermissionsAndLifecycle (0.98s)
PASS
````
## cleanup-dry-run
```sh
make attachments-cleanup
```
Начало: 2026-10-18T20:41:08.490906+00:00; длительность: 1.327 с; exit code: 0.
````text
docker compose --project-name highload-lab4 --env-file .env -f compose.yml run --rm --no-deps upload-cleanup ./messenger attachments-cleanup --dry-run
Container highload-lab4-upload-cleanup-run-ee9c8bded59f Creating
Container highload-lab4-upload-cleanup-run-ee9c8bded59f Created
{"direct":{"candidates":1,"deleted":0,"eligible":1,"protected":0,"skipped":0,"failed":0,"dry_run":true},"originals":{"candidates":0,"deleted":0,"eligible":0,"protected":0,"skipped":0,"failed":0,"dry_run":true}}
````
## Реализация
- [src/backend/repositories/direct_cleanup.go](../../../../src/backend/repositories/direct_cleanup.go)
- [src/backend/repositories/s3_admin.go](../../../../src/backend/repositories/s3_admin.go)
@@ -0,0 +1,4 @@
PASS: original survives stopping confirming replica 959dccd157e1
PASS: original survives stopping confirming replica 7bdd907a608a
PASS: session, direct upload receipt, metadata and bytes survive restart
PASS: real S3 form, concurrent complete through two replicas, authorized bytes and attachment-only message
@@ -0,0 +1,44 @@
# Presigned POST и неизменяемый готовый оригинал
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestDirectUploadFlow`, `TestDirectUploadRecoveryConcurrentComplete`.
## direct
```sh
/usr/bin/python3 scripts/check_direct_upload.py
```
Начало: 2026-10-18T20:41:05.039812+00:00; длительность: 2.394 с; exit code: 0.
````text
PASS: real S3 form, concurrent complete through two replicas, authorized bytes and attachment-only message
````
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](backend.txt).
````text
=== RUN TestDirectUploadFlow
--- PASS: TestDirectUploadFlow (0.76s)
=== RUN TestDirectUploadRecoveryConcurrentComplete
--- PASS: TestDirectUploadRecoveryConcurrentComplete (0.61s)
PASS
````
## Реализация
- [src/backend/services/direct_upload.go](../../../../src/backend/services/direct_upload.go)
- [src/backend/repositories/s3_direct.go](../../../../src/backend/repositories/s3_direct.go)
@@ -0,0 +1,57 @@
# Повторы complete, crash и отмена ожидания
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestDirectUploadRecoveryFailures`, `TestDirectUploadRecoveryProcessExit`, `TestDirectUploadRecoverySharedSlotAndCancellation`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](backend.txt).
````text
=== RUN TestDirectUploadRecoveryFailures
=== RUN TestDirectUploadRecoveryFailures/copy-result-loss
=== RUN TestDirectUploadRecoveryFailures/get-failure
=== RUN TestDirectUploadRecoveryFailures/metadata-rejection
=== RUN TestDirectUploadRecoveryFailures/database-disconnect
--- PASS: TestDirectUploadRecoveryFailures (2.66s)
--- PASS: TestDirectUploadRecoveryFailures/copy-result-loss (0.66s)
--- PASS: TestDirectUploadRecoveryFailures/get-failure (0.62s)
--- PASS: TestDirectUploadRecoveryFailures/metadata-rejection (0.67s)
--- PASS: TestDirectUploadRecoveryFailures/database-disconnect (0.71s)
=== RUN TestDirectUploadRecoveryProcessExit
--- PASS: TestDirectUploadRecoveryProcessExit (0.85s)
=== RUN TestDirectUploadRecoverySharedSlotAndCancellation
--- PASS: TestDirectUploadRecoverySharedSlotAndCancellation (0.63s)
PASS
````
## direct-failures
```sh
/usr/bin/python3 scripts/check_direct_upload.py --failures --restart
```
Начало: 2026-10-18T20:42:13.319145+00:00; длительность: 45.039 с; exit code: 0.
````text
PASS: original survives stopping confirming replica 959dccd157e1
PASS: original survives stopping confirming replica 7bdd907a608a
PASS: session, direct upload receipt, metadata and bytes survive restart
PASS: real S3 form, concurrent complete through two replicas, authorized bytes and attachment-only message
````
## Реализация
- [src/backend/repositories/direct_upload.go](../../../../src/backend/repositories/direct_upload.go)
- [src/frontend/src/directUpload.ts](../../../../src/frontend/src/directUpload.ts)
@@ -0,0 +1,39 @@
# Подпись, владелец, размер, SHA-256, MIME и CORS
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestDirectUploadValidationHTTP`, `TestDirectUploadValidationContents`, `TestDirectUploadAccess`, `TestDirectUploadAccessCORS`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](backend.txt).
````text
=== RUN TestDirectUploadAccessPermissionsAndLifecycle
--- PASS: TestDirectUploadAccessPermissionsAndLifecycle (0.98s)
=== RUN TestDirectUploadAccessCORS
--- PASS: TestDirectUploadAccessCORS (0.02s)
=== RUN TestDirectUploadValidationHTTP
--- PASS: TestDirectUploadValidationHTTP (0.69s)
=== RUN TestDirectUploadValidationContents
--- PASS: TestDirectUploadValidationContents (0.82s)
=== RUN TestDirectUploadAccess
--- PASS: TestDirectUploadAccess (1.30s)
PASS
````
## Реализация
- [src/backend/handlers/direct_upload_http.go](../../../../src/backend/handlers/direct_upload_http.go)
- [src/backend/tests/direct_upload_test.go](../../../../src/backend/tests/direct_upload_test.go)
- [src/backend/tests/direct_permissions_test.go](../../../../src/backend/tests/direct_permissions_test.go)
@@ -0,0 +1 @@
PASS: real S3 form, concurrent complete through two replicas, authorized bytes and attachment-only message
@@ -0,0 +1,17 @@
PASS: sealed protocol, archive, fixtures, raw records and recomputed decision match
Campaign: evidence/upload-comparison/20261018T193626Z-formal-f49d61
Ready/verified: 720 720
Errors: 0
{"profile": "small-moderate", "valid_pairs": 3, "median_traffic_ratio": 0.5065773906213067, "min_traffic_ratio": 0.5063861055246678, "max_traffic_ratio": 0.5079907229528128}
{"profile": "large-moderate", "valid_pairs": 3, "median_traffic_ratio": 0.49949754357270226, "min_traffic_ratio": 0.4991382402982068, "max_traffic_ratio": 0.49981732427785186}
{"profile": "small-pixels40m", "valid_pairs": 3, "median_traffic_ratio": 0.5126058228037882, "min_traffic_ratio": 0.50707065100036, "max_traffic_ratio": 0.512817391975545}
{"profile": "large-pixels40m", "valid_pairs": 3, "median_traffic_ratio": 0.49928261799970935, "min_traffic_ratio": 0.4992082132615818, "max_traffic_ratio": 0.49959788796606974}
{"profile": "small-moderate", "mode": "proxy", "median_api_MiB_per_ready": 2.0209168752034503, "median_api_window_peak_MiB": 136.0546875, "max_api_lifetime_peak_MiB": 141.2265625, "median_ready_rps": 7.894590746470929, "median_p50_s": 0.13762395, "median_p95_s": 0.349706212, "median_p99_s": 0.353454295}
{"profile": "small-moderate", "mode": "direct", "median_api_MiB_per_ready": 1.0233642260233562, "median_api_window_peak_MiB": 138.71875, "max_api_lifetime_peak_MiB": 140.8125, "median_ready_rps": 6.6154831177570035, "median_p50_s": 0.330249949, "median_p95_s": 0.664536392, "median_p99_s": 0.665379127}
{"profile": "large-moderate", "mode": "proxy", "median_api_MiB_per_ready": 20.11448278427124, "median_api_window_peak_MiB": 148.44140625, "max_api_lifetime_peak_MiB": 152.44921875, "median_ready_rps": 4.708766693021728, "median_p50_s": 0.623532216, "median_p95_s": 1.199421251, "median_p99_s": 1.370958831}
{"profile": "large-moderate", "mode": "direct", "median_api_MiB_per_ready": 10.044582716623943, "median_api_window_peak_MiB": 147.1796875, "max_api_lifetime_peak_MiB": 150.04296875, "median_ready_rps": 3.1121213975127984, "median_p50_s": 1.760060342, "median_p95_s": 2.429332421, "median_p99_s": 2.519360375}
{"profile": "small-pixels40m", "mode": "proxy", "median_api_MiB_per_ready": 2.0204983075459797, "median_api_window_peak_MiB": 381.2734375, "max_api_lifetime_peak_MiB": 384.3203125, "median_ready_rps": 3.145227806944573, "median_p50_s": 1.294338167, "median_p95_s": 2.522289981, "median_p99_s": 2.55024115}
{"profile": "small-pixels40m", "mode": "direct", "median_api_MiB_per_ready": 1.0358009020487466, "median_api_window_peak_MiB": 384.0546875, "max_api_lifetime_peak_MiB": 387.94140625, "median_ready_rps": 2.8002143610390253, "median_p50_s": 1.645604573, "median_p95_s": 3.186833871, "median_p99_s": 3.235123098}
{"profile": "large-pixels40m", "mode": "proxy", "median_api_MiB_per_ready": 20.120631217956543, "median_api_window_peak_MiB": 391.99609375, "max_api_lifetime_peak_MiB": 393.2578125, "median_ready_rps": 2.3240187390207696, "median_p50_s": 1.835096441, "median_p95_s": 3.14764051, "median_p99_s": 3.996668065}
{"profile": "large-pixels40m", "mode": "direct", "median_api_MiB_per_ready": 10.045849291483561, "median_api_window_peak_MiB": 393.05859375, "max_api_lifetime_peak_MiB": 397.359375, "median_ready_rps": 1.780860551975933, "median_p50_s": 3.21658326, "median_p95_s": 5.166217115, "median_p99_s": 5.44240128}
Decision: confirmed_in_tested_conditions
@@ -0,0 +1,201 @@
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:43:18.169537722Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:48.242355675Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:44.953066075Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:43:16.829481289Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:44.819950417Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:45.129321274Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:43:16.556487286Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:42:47.900470304Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
@@ -0,0 +1,14 @@
> messenger-test-ui@1.0.0 build
> tsc --noEmit && vite build
vite v8.3.0 building client environment for production...
transforming...
✓ 21 modules transformed.
rendering chunks...
computing gzip size...
dist/index.html 0.42 kB │ gzip: 0.31 kB
dist/assets/index-DLiyty6M.css 9.50 kB │ gzip: 2.72 kB
dist/assets/index-_XVVkjP0.js 241.82 kB │ gzip: 75.95 kB
✓ built in 2.69s
@@ -0,0 +1,37 @@
# Сборка React UI
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## frontend-build
```sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml exec -T frontend npm run build
```
Начало: 2026-10-18T20:41:09.870085+00:00; длительность: 7.214 с; exit code: 0.
````text
> messenger-test-ui@1.0.0 build
> tsc --noEmit && vite build
vite v8.3.0 building client environment for production...
transforming...
✓ 21 modules transformed.
rendering chunks...
computing gzip size...
dist/index.html 0.42 kB │ gzip: 0.31 kB
dist/assets/index-DLiyty6M.css 9.50 kB │ gzip: 2.72 kB
dist/assets/index-_XVVkjP0.js 241.82 kB │ gzip: 75.95 kB
✓ built in 2.69s
````
## Реализация
- [src/frontend/src/App.tsx](../../../../src/frontend/src/App.tsx)
- [src/frontend/src/AttachmentImage.tsx](../../../../src/frontend/src/AttachmentImage.tsx)
- [src/frontend/src/directUpload.ts](../../../../src/frontend/src/directUpload.ts)
@@ -0,0 +1,14 @@
PASS: real restart db; same containers and persistent volumes
PASS: real restart redis; same containers and persistent volumes
PASS: real restart s3; same containers and persistent volumes
PASS: real restart api; same containers and persistent volumes
PASS: real restart upload-cleanup; same containers and persistent volumes
test_every_report_criterion_and_code_link_has_a_definition (test_generate_evidence.EvidenceTests.test_every_report_criterion_and_code_link_has_a_definition) ... ok
test_exit_zero_without_required_test_pass_is_not_evidence (test_generate_evidence.EvidenceTests.test_exit_zero_without_required_test_pass_is_not_evidence) ... ok
test_restart_audit_requires_actual_restart_not_just_ready (test_generate_evidence.EvidenceTests.test_restart_audit_requires_actual_restart_not_just_ready) ... ok
test_secrets_and_signed_fields_are_redacted (test_generate_evidence.EvidenceTests.test_secrets_and_signed_fields_are_redacted) ... ok
----------------------------------------------------------------------
Ran 4 tests in 0.101s
OK
@@ -0,0 +1,201 @@
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:36:24.367291372Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.89479619Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.416387316Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:06.043221163Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.786499611Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:50.058525711Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:06.399345399Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.81722101Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
@@ -0,0 +1 @@
PASS: loopback-only private S3, disabled console, restricted API mounts, bounded tmpfs
@@ -0,0 +1,481 @@
# Сессия, метаданные и оригинал после restart
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## before-restart
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe inventory
```
Начало: 2026-10-18T20:41:56.334689+00:00; длительность: 0.669 с; exit code: 0.
````text
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:24.516118521Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:37.447855485Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.416387316Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:50.41521695Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.786499611Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:49.925277255Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:41:52.124509294Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.81722101Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
````
## persistence
```sh
make test-persistence ACTION_SCRIPT=scripts/restart.sh
```
Начало: 2026-10-18T20:41:57.035205+00:00; длительность: 15.362 с; exit code: 0.
````text
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
````
## after-restart
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe inventory
```
Начало: 2026-10-18T20:42:12.429373+00:00; длительность: 0.660 с; exit code: 0.
````text
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:05.941585408Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:06.080394151Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.024663538Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:07.39677266Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.1118558Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:01.349056081Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:42:07.681167653Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:42:05.78951003Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
````
## restart-audit
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe restart --before /mnt/c/projects/Highload-systems/mtusi2026lab4-fork/evidence/criteria/runs/20261018T203755.405686Z/before-restart.txt --after /mnt/c/projects/Highload-systems/mtusi2026lab4-fork/evidence/criteria/runs/20261018T203755.405686Z/after-restart.txt
```
Начало: 2026-10-18T20:42:13.123287+00:00; длительность: 0.165 с; exit code: 0.
````text
PASS: real restart db; same containers and persistent volumes
PASS: real restart redis; same containers and persistent volumes
PASS: real restart s3; same containers and persistent volumes
PASS: real restart api; same containers and persistent volumes
PASS: real restart upload-cleanup; same containers and persistent volumes
````
## direct-failures
```sh
/usr/bin/python3 scripts/check_direct_upload.py --failures --restart
```
Начало: 2026-10-18T20:42:13.319145+00:00; длительность: 45.039 с; exit code: 0.
````text
PASS: original survives stopping confirming replica 959dccd157e1
PASS: original survives stopping confirming replica 7bdd907a608a
PASS: session, direct upload receipt, metadata and bytes survive restart
PASS: real S3 form, concurrent complete through two replicas, authorized bytes and attachment-only message
````
## Реализация
- [scripts/restart.sh](../../../../scripts/restart.sh)
- [tests/resilience.py](../../../../tests/resilience.py)
@@ -0,0 +1,3 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
@@ -0,0 +1,44 @@
# PNG/JPEG, ready, сообщение и побайтный download
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestAttachmentAccessHTTP`.
## proxy
```sh
make test-grade3
```
Начало: 2026-10-18T20:41:01.363701+00:00; длительность: 3.645 с; exit code: 0.
````text
python3 scripts/check_grade3.py --base-url "http://localhost:8080"
PASS: image limits, chunked upload, ACL, message attachments, concurrent replay across replicas
````
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](backend.txt).
````text
=== RUN TestAttachmentAccessHTTP
--- PASS: TestAttachmentAccessHTTP (1.08s)
PASS
````
## Реализация
- [src/backend/services/attachment.go](../../../../src/backend/services/attachment.go)
- [src/backend/handlers/attachment_http.go](../../../../src/backend/handlers/attachment_http.go)
- [src/backend/repositories/attachment.go](../../../../src/backend/repositories/attachment.go)
@@ -0,0 +1,4 @@
python3 scripts/check_grade3.py --base-url "http://localhost:8080" --failures
PASS: image limits, chunked upload, ACL, message attachments, concurrent replay across replicas
PASS: stop the uploading replica, download from the other (both replicas)
PASS: S3 unavailable/recovery, private bucket
@@ -0,0 +1,2 @@
python3 scripts/check_grade3.py --base-url "http://localhost:8080"
PASS: image limits, chunked upload, ACL, message attachments, concurrent replay across replicas
@@ -0,0 +1,4 @@
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 124, "failed_attempts": 2, "first_recovery_seconds": 1.793}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
@@ -0,0 +1,38 @@
# Публичный smoke и структура контракта
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## structure
```sh
make check
```
Начало: 2026-10-18T20:38:16.782745+00:00; длительность: 16.132 с; exit code: 0.
````text
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
````
## smoke
```sh
make test
```
Начало: 2026-10-18T20:38:32.945680+00:00; длительность: 8.175 с; exit code: 0.
````text
python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
````
## Реализация
- [tests/smoke.py](../../../../tests/smoke.py)
- [contracts/openapi.json](../../../../contracts/openapi.json)
@@ -0,0 +1,128 @@
# Оригинал после остановки обслужившей API
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## proxy-failures
```sh
make test-grade3-failures
```
Начало: 2026-10-18T20:41:17.113921+00:00; длительность: 42.575 с; exit code: 0.
````text
python3 scripts/check_grade3.py --base-url "http://localhost:8080" --failures
PASS: image limits, chunked upload, ACL, message attachments, concurrent replay across replicas
PASS: stop the uploading replica, download from the other (both replicas)
PASS: S3 unavailable/recovery, private bucket
````
## direct-failures
```sh
/usr/bin/python3 scripts/check_direct_upload.py --failures --restart
```
Начало: 2026-10-18T20:42:13.319145+00:00; длительность: 45.039 с; exit code: 0.
````text
PASS: original survives stopping confirming replica 959dccd157e1
PASS: original survives stopping confirming replica 7bdd907a608a
PASS: session, direct upload receipt, metadata and bytes survive restart
PASS: real S3 form, concurrent complete through two replicas, authorized bytes and attachment-only message
````
## public-failover
```sh
make test-failover ACTION_SCRIPT=scripts/stop-one.sh
```
Начало: 2026-10-18T20:42:54.991730+00:00; длительность: 18.692 с; exit code: 0.
````text
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 124, "failed_attempts": 2, "first_recovery_seconds": 1.793}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
````
## restore
```sh
make app-start
```
Начало: 2026-10-18T20:43:17.143841+00:00; длительность: 9.220 с; exit code: 0.
````text
python3 scripts/init_env.py
Local .env and connection files ready; existing values and files preserved.
chmod +x scripts/restart.sh scripts/stop-one.sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml up -d --no-build --wait
Container highload-lab4-upload-cleanup-1 Running
Container highload-lab4-frontend-1 Running
Container highload-lab4-api-2 Running
Container highload-lab4-s3-1 Running
Container highload-lab4-haproxy-1 Running
Container highload-lab4-redis-1 Running
Container highload-lab4-db-1 Running
Container highload-lab4-s3-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Starting
Container highload-lab4-db-1 Healthy
Container highload-lab4-migrate-1 Starting
Container highload-lab4-s3-bootstrap-1 Started
Container highload-lab4-migrate-1 Started
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-redis-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-db-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-migrate-1 Exited
Container highload-lab4-redis-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-1 Starting
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-1 Started
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-redis-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-frontend-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-upload-cleanup-1 Waiting
Container highload-lab4-s3-1 Waiting
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-upload-cleanup-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-frontend-1 Healthy
Container highload-lab4-redis-1 Healthy
Container highload-lab4-db-1 Healthy
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
````
## Реализация
- [scripts/check_grade3.py](../../../../scripts/check_grade3.py)
- [scripts/check_direct_upload.py](../../../../scripts/check_direct_upload.py)
- [scripts/stop-one.sh](../../../../scripts/stop-one.sh)
@@ -0,0 +1,5 @@
PASS: real restart db; same containers and persistent volumes
PASS: real restart redis; same containers and persistent volumes
PASS: real restart s3; same containers and persistent volumes
PASS: real restart api; same containers and persistent volumes
PASS: real restart upload-cleanup; same containers and persistent volumes
@@ -0,0 +1,59 @@
python3 scripts/init_env.py
Local .env and connection files ready; existing values and files preserved.
chmod +x scripts/restart.sh scripts/stop-one.sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml up -d --no-build --wait
Container highload-lab4-upload-cleanup-1 Running
Container highload-lab4-frontend-1 Running
Container highload-lab4-api-2 Running
Container highload-lab4-s3-1 Running
Container highload-lab4-haproxy-1 Running
Container highload-lab4-redis-1 Running
Container highload-lab4-db-1 Running
Container highload-lab4-s3-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Starting
Container highload-lab4-db-1 Healthy
Container highload-lab4-migrate-1 Starting
Container highload-lab4-s3-bootstrap-1 Started
Container highload-lab4-migrate-1 Started
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-redis-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-db-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-migrate-1 Exited
Container highload-lab4-redis-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-1 Starting
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-1 Started
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-redis-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-frontend-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-upload-cleanup-1 Waiting
Container highload-lab4-s3-1 Waiting
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-upload-cleanup-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-frontend-1 Healthy
Container highload-lab4-redis-1 Healthy
Container highload-lab4-db-1 Healthy
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
@@ -0,0 +1,44 @@
# Повторяемый bootstrap и ограниченные credentials
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestS3PermissionsAndBootstrap`, `TestDirectUploadAccessPermissionsAndLifecycle`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](backend.txt).
````text
=== RUN TestDirectUploadAccessPermissionsAndLifecycle
--- PASS: TestDirectUploadAccessPermissionsAndLifecycle (0.98s)
=== RUN TestS3PermissionsAndBootstrap
--- PASS: TestS3PermissionsAndBootstrap (0.92s)
PASS
````
## isolation
```sh
/usr/bin/python3 scripts/check_s3_isolation.py
```
Начало: 2026-10-18T20:41:07.464744+00:00; длительность: 0.991 с; exit code: 0.
````text
PASS: loopback-only private S3, disabled console, restricted API mounts, bounded tmpfs
````
## Реализация
- [src/backend/repositories/s3_admin.go](../../../../src/backend/repositories/s3_admin.go)
- [scripts/check_s3_isolation.py](../../../../scripts/check_s3_isolation.py)
@@ -0,0 +1,48 @@
# Grace period, блокировки, защита готовых объектов и повтор
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestAttachmentCleanupGraceLocksProtectionAndRetry`, `TestAttachmentCleanupInvalidKeyIsNeverDeleted`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](backend.txt).
````text
=== RUN TestAttachmentCleanupGraceLocksProtectionAndRetry
--- PASS: TestAttachmentCleanupGraceLocksProtectionAndRetry (0.88s)
=== RUN TestAttachmentCleanupInvalidKeyIsNeverDeleted
--- PASS: TestAttachmentCleanupInvalidKeyIsNeverDeleted (0.61s)
PASS
````
## cleanup-dry-run
```sh
make attachments-cleanup
```
Начало: 2026-10-18T20:41:08.490906+00:00; длительность: 1.327 с; exit code: 0.
````text
docker compose --project-name highload-lab4 --env-file .env -f compose.yml run --rm --no-deps upload-cleanup ./messenger attachments-cleanup --dry-run
Container highload-lab4-upload-cleanup-run-ee9c8bded59f Creating
Container highload-lab4-upload-cleanup-run-ee9c8bded59f Created
{"direct":{"candidates":1,"deleted":0,"eligible":1,"protected":0,"skipped":0,"failed":0,"dry_run":true},"originals":{"candidates":0,"deleted":0,"eligible":0,"protected":0,"skipped":0,"failed":0,"dry_run":true}}
````
## Реализация
- [src/backend/cleanup.go](../../../../src/backend/cleanup.go)
- [src/backend/repositories/cleanup_config.go](../../../../src/backend/repositories/cleanup_config.go)
- [src/backend/repositories/upload.go](../../../../src/backend/repositories/upload.go)
@@ -0,0 +1,5 @@
version | dirty
---------+-------
6 | f
(1 row)
@@ -0,0 +1,579 @@
# Две API, PostgreSQL и приватный S3 в общем стенде
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## startup
```sh
make app-up
```
Начало: 2026-10-18T20:37:55.408721+00:00; длительность: 21.944 с; exit code: 0.
````text
python3 scripts/init_env.py
Local .env and connection files ready; existing values and files preserved.
chmod +x scripts/restart.sh scripts/stop-one.sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml up -d --build --wait
Image highload-lab4-frontend Building
Image highload-lab4-migrate Building
Image highload-lab4-s3-bootstrap Building
Image highload-lab4-api Building
Image highload-lab4-s3 Building
Image highload-lab4-upload-cleanup Building
#1 [internal] load local bake definitions
#1 reading from stdin 3.08kB done
#1 DONE 0.0s
#2 [api internal] load build definition from Dockerfile
#2 transferring dockerfile:
#2 transferring dockerfile: 661B 0.0s done
#2 DONE 0.2s
#3 [frontend internal] load build definition from Dockerfile
#3 transferring dockerfile: 181B 0.1s done
#3 DONE 0.2s
#4 [s3 internal] load build definition from minio.Dockerfile
#4 transferring dockerfile: 1.01kB 0.0s done
#4 DONE 0.2s
#5 [upload-cleanup internal] load metadata for docker.io/library/debian:12.15-slim
#5 ...
#6 [frontend internal] load metadata for docker.io/library/node:22-bookworm-slim
#6 DONE 0.5s
#5 [s3 internal] load metadata for docker.io/library/debian:12.15-slim
#5 DONE 0.5s
#7 [api internal] load metadata for docker.io/library/golang:1.22.2-bookworm
#7 DONE 0.5s
#8 [migrate internal] load .dockerignore
#8 transferring context: 268B 0.0s done
#8 DONE 0.0s
#9 [frontend internal] load .dockerignore
#9 transferring context: 58B 0.0s done
#9 DONE 0.1s
#10 [api internal] load build context
#10 DONE 0.0s
#11 [s3-bootstrap stage-1 1/4] FROM docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171
#11 resolve docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171
#11 resolve docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171 0.1s done
#11 DONE 0.1s
#12 [s3-bootstrap builder 1/6] FROM docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f
#12 resolve docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f 0.1s done
#12 DONE 0.1s
#13 [frontend 1/5] FROM docker.io/library/node:22-bookworm-slim@sha256:43ac6c60b8f89723f746e8a92ce91abd5017e627ce1ddfe4238355d3a30b772c
#13 resolve docker.io/library/node:22-bookworm-slim@sha256:43ac6c60b8f89723f746e8a92ce91abd5017e627ce1ddfe4238355d3a30b772c 0.1s done
#13 DONE 0.1s
#14 [frontend internal] load build context
#14 transferring context: 1.07kB 0.1s done
#14 DONE 0.1s
#15 [frontend 2/5] WORKDIR /app
#15 CACHED
#16 [frontend 3/5] COPY package.json package-lock.json ./
#16 CACHED
#17 [frontend 4/5] RUN npm ci
#17 CACHED
#10 [s3-bootstrap internal] load build context
#10 ...
#18 [frontend 5/5] COPY . .
#18 DONE 0.1s
#10 [s3-bootstrap internal] load build context
#10 ...
#19 [s3 internal] load metadata for docker.io/library/golang:1.24.2-bookworm
#19 DONE 1.0s
#20 [s3 internal] load .dockerignore
#20 transferring context: 2B 0.0s done
#20 DONE 0.0s
#10 [s3-bootstrap internal] load build context
#10 transferring context: 4.39kB 0.5s done
#10 DONE 0.5s
#11 [s3 stage-1 1/4] FROM docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171
#11 resolve docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171 0.1s done
#11 DONE 0.1s
#21 [s3 builder 1/4] FROM docker.io/library/golang:1.24.2-bookworm@sha256:79390b5e5af9ee6e7b1173ee3eac7fadf6751a545297672916b59bfa0ecf6f71
#21 resolve docker.io/library/golang:1.24.2-bookworm@sha256:79390b5e5af9ee6e7b1173ee3eac7fadf6751a545297672916b59bfa0ecf6f71 0.0s done
#21 DONE 0.0s
#22 [s3 stage-1 2/3] RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && rm -rf /var/lib/apt/lists/* && groupadd --system storage && useradd --system --gid storage storage && mkdir /data && chown storage:storage /data
#22 CACHED
#23 [s3 builder 3/4] RUN git init . && git remote add origin https://github.com/minio/minio.git && git fetch --depth 1 origin 0d7408fc9969caf07de6a8c3a84f9fbb10a6739e && git checkout --detach FETCH_HEAD
#23 CACHED
#24 [s3 builder 4/4] RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X github.com/minio/minio/cmd.Version=2025-04-22T22:12:26Z -X github.com/minio/minio/cmd.ReleaseTag=RELEASE.2025-04-22T22-12-26Z -X github.com/minio/minio/cmd.CommitID=0d7408fc9969caf07de6a8c3a84f9fbb10a6739e" -o /out/minio .
#24 CACHED
#25 [s3 builder 2/4] WORKDIR /source
#25 CACHED
#26 [s3 stage-1 3/3] COPY --from=builder /out/minio /usr/local/bin/minio
#26 CACHED
#27 [api stage-1 3/4] WORKDIR /app
#27 CACHED
#28 [api builder 4/6] RUN go mod download
#28 CACHED
#29 [api builder 2/6] WORKDIR /src
#29 CACHED
#30 [api builder 3/6] COPY go.mod go.sum ./
#30 CACHED
#31 [api stage-1 2/4] RUN groupadd --system app && useradd --system --gid app --no-create-home app
#31 CACHED
#32 [api builder 5/6] COPY backend ./backend
#32 CACHED
#33 [api builder 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/messenger ./backend
#33 CACHED
#34 [api stage-1 4/4] COPY --from=builder /out/messenger ./messenger
#34 CACHED
#35 [s3] exporting to image
#35 exporting layers done
#35 exporting manifest sha256:cf1641bb428d024d81f932bd8ab277ade2790aa5cb2ec1b90238a00df54ccbee done
#35 exporting config sha256:b261b45a54ac72fb091ebba0c6b5e09aedc1239e48fe469c1d81ae7ea23621e6 done
#35 exporting attestation manifest sha256:5f4beb93e7723dcab160781dab716c739459a829c31e7d26e443fb017974f3b9
#35 ...
#28 [s3-bootstrap builder 4/6] RUN go mod download
#28 CACHED
#29 [s3-bootstrap builder 2/6] WORKDIR /src
#29 CACHED
#33 [s3-bootstrap builder 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/messenger ./backend
#33 CACHED
#27 [s3-bootstrap stage-1 3/4] WORKDIR /app
#27 CACHED
#31 [s3-bootstrap stage-1 2/4] RUN groupadd --system app && useradd --system --gid app --no-create-home app
#31 CACHED
#30 [s3-bootstrap builder 3/6] COPY go.mod go.sum ./
#30 CACHED
#32 [s3-bootstrap builder 5/6] COPY backend ./backend
#32 CACHED
#34 [upload-cleanup stage-1 4/4] COPY --from=builder /out/messenger ./messenger
#34 CACHED
#36 [frontend] exporting to image
#36 exporting layers 0.1s done
#36 exporting manifest sha256:d59faebffe67b578ba0786caed54363bffa894312c0787d714977eb9bec9799a 0.0s done
#36 exporting config sha256:fb3ba9317f8efad41b9927e041302762863ea60e513b286942022cd88a4ccf3f 0.0s done
#36 exporting attestation manifest sha256:d4458fdb5f8220753cb7ac6be3561ff06e61c9d49e1ef60947bda4fe49215f3b 0.0s done
#36 exporting manifest list sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c 0.0s done
#36 naming to docker.io/library/highload-lab4-frontend:latest done
#36 unpacking to docker.io/library/highload-lab4-frontend:latest 0.1s done
#36 DONE 0.4s
#35 [s3] exporting to image
#35 exporting attestation manifest sha256:5f4beb93e7723dcab160781dab716c739459a829c31e7d26e443fb017974f3b9 0.0s done
#35 exporting manifest list sha256:4ba76dc492ca964bc6d3702e4dcd6e7befbe17fb39ac169860624139962b7825 0.1s done
#35 naming to docker.io/library/highload-lab4-s3:latest 0.1s done
#35 unpacking to docker.io/library/highload-lab4-s3:latest
#35 unpacking to docker.io/library/highload-lab4-s3:latest 0.1s done
#35 DONE 0.4s
#37 [upload-cleanup] exporting to image
#37 exporting layers done
#37 exporting manifest sha256:7d4f622a2a83dd1aec3b761e2eaa48032ec8594af604c57033d2b78ab0516eba 0.0s done
#37 exporting config sha256:650babbe6357784df8340e53537cec18e70beebc11d5a478528daf3c4a46800b 0.0s done
#37 exporting attestation manifest sha256:66d7cb5be9afd6a4fb83c889db7d4f168f479593edebbf627245ba3e617755f6 0.1s done
#37 exporting manifest list sha256:64ccebc0240289b7f87b7f15f05b4a5cefa3a62c0dc1487f58a80ca4dff51ffb 0.1s done
#37 naming to docker.io/library/highload-lab4-upload-cleanup:latest 0.0s done
#37 unpacking to docker.io/library/highload-lab4-upload-cleanup:latest
#37 unpacking to docker.io/library/highload-lab4-upload-cleanup:latest 0.0s done
#37 DONE 0.5s
#38 [s3-bootstrap] exporting to image
#38 exporting layers done
#38 exporting manifest sha256:dd2bbbd4483023e5124c00da1cc13633ac948721c55e0bf6a6bf7331c0cd06e4 0.0s done
#38 exporting config sha256:6c819718ab87aac477b0a779c7763274bbabe01223ec05eb372077f96b98adb3 0.0s done
#38 exporting attestation manifest sha256:5c621aa3c04fb990da97dc1fb103feb5fbb8c3c3c7495589efd9001a823298df 0.1s done
#38 exporting manifest list sha256:87530453dc25cf26f9aab7bb3167e0831af3e0e9233b17eaaa59be4d780f5fa9 0.1s done
#38 naming to docker.io/library/highload-lab4-s3-bootstrap:latest 0.0s done
#38 unpacking to docker.io/library/highload-lab4-s3-bootstrap:latest 0.0s done
#38 DONE 0.5s
#39 [migrate] exporting to image
#39 exporting layers done
#39 exporting manifest sha256:72b55ff56061496e227a3f2d6159efd7619d4ebac3e62a7a292ca38c0aa430e5 0.0s done
#39 exporting config sha256:717f0c6505d0f59b5ff8b1ae4a2ae07241dfd835b97f85ebd54812db3f40df02 0.0s done
#39 exporting attestation manifest sha256:eb8048635d5a2fe19319f95e751bacb7484d8357992fc324e2e5c401359d2df9 0.1s done
#39 exporting manifest list sha256:776406956564b03c4c68fcb0273a0e1d6b86e2c0e2cf9ce3fa82a85762ac0f42 0.1s done
#39 naming to docker.io/library/highload-lab4-migrate:latest 0.0s done
#39 unpacking to docker.io/library/highload-lab4-migrate:latest 0.0s done
#39 DONE 0.5s
#40 [api] exporting to image
#40 exporting layers done
#40 exporting manifest sha256:9c7d0be760523e4c4a8775f30d52c18f04c9290528e99d8b542474a6941c2843 0.0s done
#40 exporting config sha256:b3dcf18403a7675697043933aee1a0a0f297c459658ffc1dd6f5372060d04942 0.0s done
#40 exporting attestation manifest sha256:8f285c1fdf78dbe48b37e4f39354817556369f0840f24e91a8671ebf84b2ba25 0.1s done
#40 exporting manifest list sha256:e5149bb9db200a2bcfeadde9eb676add0e9fa7f2a6018069212387cce6467dba 0.1s done
#40 naming to docker.io/library/highload-lab4-api:latest 0.0s done
#40 unpacking to docker.io/library/highload-lab4-api:latest 0.1s done
#40 DONE 0.5s
#41 [frontend] resolving provenance for metadata file
#41 ...
#42 [s3] resolving provenance for metadata file
#42 DONE 0.2s
#43 [api] resolving provenance for metadata file
#43 DONE 0.0s
#41 [frontend] resolving provenance for metadata file
#41 DONE 0.4s
#44 [migrate] resolving provenance for metadata file
#44 DONE 0.2s
#45 [upload-cleanup] resolving provenance for metadata file
#45 DONE 0.3s
#46 [s3-bootstrap] resolving provenance for metadata file
#46 DONE 0.3s
Image highload-lab4-s3 Built
Image highload-lab4-s3-bootstrap Built
Image highload-lab4-api Built
Image highload-lab4-frontend Built
Image highload-lab4-upload-cleanup Built
Image highload-lab4-migrate Built
Container highload-lab4-upload-cleanup-1 Running
Container highload-lab4-s3-1 Running
Container highload-lab4-haproxy-1 Running
Container highload-lab4-api-1 Running
Container highload-lab4-api-2 Running
Container highload-lab4-redis-1 Running
Container highload-lab4-db-1 Running
Container highload-lab4-frontend-1 Recreate
Container highload-lab4-frontend-1 Recreated
Container highload-lab4-s3-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-db-1 Healthy
Container highload-lab4-migrate-1 Starting
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Starting
Container highload-lab4-migrate-1 Started
Container highload-lab4-s3-bootstrap-1 Started
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-redis-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-migrate-1 Exited
Container highload-lab4-redis-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-db-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-frontend-1 Starting
Container highload-lab4-frontend-1 Started
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-redis-1 Waiting
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-upload-cleanup-1 Waiting
Container highload-lab4-s3-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-frontend-1 Waiting
Container highload-lab4-s3-1 Healthy
Container highload-lab4-db-1 Healthy
Container highload-lab4-upload-cleanup-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-redis-1 Healthy
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
Container highload-lab4-frontend-1 Healthy
````
## inventory
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe inventory
```
Начало: 2026-10-18T20:38:15.728752+00:00; длительность: 0.679 с; exit code: 0.
````text
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:36:24.367291372Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.89479619Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.416387316Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:06.043221163Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.786499611Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:50.058525711Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:06.399345399Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.81722101Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
````
## schema
```sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml exec -T db sh -c 'psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT version, dirty FROM schema_migrations;"'
```
Начало: 2026-10-18T20:38:16.439436+00:00; длительность: 0.315 с; exit code: 0.
````text
version | dirty
---------+-------
6 | f
(1 row)
````
## isolation
```sh
/usr/bin/python3 scripts/check_s3_isolation.py
```
Начало: 2026-10-18T20:41:07.464744+00:00; длительность: 0.991 с; exit code: 0.
````text
PASS: loopback-only private S3, disabled console, restricted API mounts, bounded tmpfs
````
## Реализация
- [compose.yml](../../../../compose.yml)
- [infra/minio.Dockerfile](../../../../infra/minio.Dockerfile)
- [src/backend/repositories/migrations/000004_attachments.up.sql](../../../../src/backend/repositories/migrations/000004_attachments.up.sql)
@@ -0,0 +1,2 @@
python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
@@ -0,0 +1,316 @@
python3 scripts/init_env.py
Local .env and connection files ready; existing values and files preserved.
chmod +x scripts/restart.sh scripts/stop-one.sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml up -d --build --wait
Image highload-lab4-frontend Building
Image highload-lab4-migrate Building
Image highload-lab4-s3-bootstrap Building
Image highload-lab4-api Building
Image highload-lab4-s3 Building
Image highload-lab4-upload-cleanup Building
#1 [internal] load local bake definitions
#1 reading from stdin 3.08kB done
#1 DONE 0.0s
#2 [api internal] load build definition from Dockerfile
#2 transferring dockerfile:
#2 transferring dockerfile: 661B 0.0s done
#2 DONE 0.2s
#3 [frontend internal] load build definition from Dockerfile
#3 transferring dockerfile: 181B 0.1s done
#3 DONE 0.2s
#4 [s3 internal] load build definition from minio.Dockerfile
#4 transferring dockerfile: 1.01kB 0.0s done
#4 DONE 0.2s
#5 [upload-cleanup internal] load metadata for docker.io/library/debian:12.15-slim
#5 ...
#6 [frontend internal] load metadata for docker.io/library/node:22-bookworm-slim
#6 DONE 0.5s
#5 [s3 internal] load metadata for docker.io/library/debian:12.15-slim
#5 DONE 0.5s
#7 [api internal] load metadata for docker.io/library/golang:1.22.2-bookworm
#7 DONE 0.5s
#8 [migrate internal] load .dockerignore
#8 transferring context: 268B 0.0s done
#8 DONE 0.0s
#9 [frontend internal] load .dockerignore
#9 transferring context: 58B 0.0s done
#9 DONE 0.1s
#10 [api internal] load build context
#10 DONE 0.0s
#11 [s3-bootstrap stage-1 1/4] FROM docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171
#11 resolve docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171
#11 resolve docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171 0.1s done
#11 DONE 0.1s
#12 [s3-bootstrap builder 1/6] FROM docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f
#12 resolve docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f 0.1s done
#12 DONE 0.1s
#13 [frontend 1/5] FROM docker.io/library/node:22-bookworm-slim@sha256:43ac6c60b8f89723f746e8a92ce91abd5017e627ce1ddfe4238355d3a30b772c
#13 resolve docker.io/library/node:22-bookworm-slim@sha256:43ac6c60b8f89723f746e8a92ce91abd5017e627ce1ddfe4238355d3a30b772c 0.1s done
#13 DONE 0.1s
#14 [frontend internal] load build context
#14 transferring context: 1.07kB 0.1s done
#14 DONE 0.1s
#15 [frontend 2/5] WORKDIR /app
#15 CACHED
#16 [frontend 3/5] COPY package.json package-lock.json ./
#16 CACHED
#17 [frontend 4/5] RUN npm ci
#17 CACHED
#10 [s3-bootstrap internal] load build context
#10 ...
#18 [frontend 5/5] COPY . .
#18 DONE 0.1s
#10 [s3-bootstrap internal] load build context
#10 ...
#19 [s3 internal] load metadata for docker.io/library/golang:1.24.2-bookworm
#19 DONE 1.0s
#20 [s3 internal] load .dockerignore
#20 transferring context: 2B 0.0s done
#20 DONE 0.0s
#10 [s3-bootstrap internal] load build context
#10 transferring context: 4.39kB 0.5s done
#10 DONE 0.5s
#11 [s3 stage-1 1/4] FROM docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171
#11 resolve docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171 0.1s done
#11 DONE 0.1s
#21 [s3 builder 1/4] FROM docker.io/library/golang:1.24.2-bookworm@sha256:79390b5e5af9ee6e7b1173ee3eac7fadf6751a545297672916b59bfa0ecf6f71
#21 resolve docker.io/library/golang:1.24.2-bookworm@sha256:79390b5e5af9ee6e7b1173ee3eac7fadf6751a545297672916b59bfa0ecf6f71 0.0s done
#21 DONE 0.0s
#22 [s3 stage-1 2/3] RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && rm -rf /var/lib/apt/lists/* && groupadd --system storage && useradd --system --gid storage storage && mkdir /data && chown storage:storage /data
#22 CACHED
#23 [s3 builder 3/4] RUN git init . && git remote add origin https://github.com/minio/minio.git && git fetch --depth 1 origin 0d7408fc9969caf07de6a8c3a84f9fbb10a6739e && git checkout --detach FETCH_HEAD
#23 CACHED
#24 [s3 builder 4/4] RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X github.com/minio/minio/cmd.Version=2025-04-22T22:12:26Z -X github.com/minio/minio/cmd.ReleaseTag=RELEASE.2025-04-22T22-12-26Z -X github.com/minio/minio/cmd.CommitID=0d7408fc9969caf07de6a8c3a84f9fbb10a6739e" -o /out/minio .
#24 CACHED
#25 [s3 builder 2/4] WORKDIR /source
#25 CACHED
#26 [s3 stage-1 3/3] COPY --from=builder /out/minio /usr/local/bin/minio
#26 CACHED
#27 [api stage-1 3/4] WORKDIR /app
#27 CACHED
#28 [api builder 4/6] RUN go mod download
#28 CACHED
#29 [api builder 2/6] WORKDIR /src
#29 CACHED
#30 [api builder 3/6] COPY go.mod go.sum ./
#30 CACHED
#31 [api stage-1 2/4] RUN groupadd --system app && useradd --system --gid app --no-create-home app
#31 CACHED
#32 [api builder 5/6] COPY backend ./backend
#32 CACHED
#33 [api builder 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/messenger ./backend
#33 CACHED
#34 [api stage-1 4/4] COPY --from=builder /out/messenger ./messenger
#34 CACHED
#35 [s3] exporting to image
#35 exporting layers done
#35 exporting manifest sha256:cf1641bb428d024d81f932bd8ab277ade2790aa5cb2ec1b90238a00df54ccbee done
#35 exporting config sha256:b261b45a54ac72fb091ebba0c6b5e09aedc1239e48fe469c1d81ae7ea23621e6 done
#35 exporting attestation manifest sha256:5f4beb93e7723dcab160781dab716c739459a829c31e7d26e443fb017974f3b9
#35 ...
#28 [s3-bootstrap builder 4/6] RUN go mod download
#28 CACHED
#29 [s3-bootstrap builder 2/6] WORKDIR /src
#29 CACHED
#33 [s3-bootstrap builder 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/messenger ./backend
#33 CACHED
#27 [s3-bootstrap stage-1 3/4] WORKDIR /app
#27 CACHED
#31 [s3-bootstrap stage-1 2/4] RUN groupadd --system app && useradd --system --gid app --no-create-home app
#31 CACHED
#30 [s3-bootstrap builder 3/6] COPY go.mod go.sum ./
#30 CACHED
#32 [s3-bootstrap builder 5/6] COPY backend ./backend
#32 CACHED
#34 [upload-cleanup stage-1 4/4] COPY --from=builder /out/messenger ./messenger
#34 CACHED
#36 [frontend] exporting to image
#36 exporting layers 0.1s done
#36 exporting manifest sha256:d59faebffe67b578ba0786caed54363bffa894312c0787d714977eb9bec9799a 0.0s done
#36 exporting config sha256:fb3ba9317f8efad41b9927e041302762863ea60e513b286942022cd88a4ccf3f 0.0s done
#36 exporting attestation manifest sha256:d4458fdb5f8220753cb7ac6be3561ff06e61c9d49e1ef60947bda4fe49215f3b 0.0s done
#36 exporting manifest list sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c 0.0s done
#36 naming to docker.io/library/highload-lab4-frontend:latest done
#36 unpacking to docker.io/library/highload-lab4-frontend:latest 0.1s done
#36 DONE 0.4s
#35 [s3] exporting to image
#35 exporting attestation manifest sha256:5f4beb93e7723dcab160781dab716c739459a829c31e7d26e443fb017974f3b9 0.0s done
#35 exporting manifest list sha256:4ba76dc492ca964bc6d3702e4dcd6e7befbe17fb39ac169860624139962b7825 0.1s done
#35 naming to docker.io/library/highload-lab4-s3:latest 0.1s done
#35 unpacking to docker.io/library/highload-lab4-s3:latest
#35 unpacking to docker.io/library/highload-lab4-s3:latest 0.1s done
#35 DONE 0.4s
#37 [upload-cleanup] exporting to image
#37 exporting layers done
#37 exporting manifest sha256:7d4f622a2a83dd1aec3b761e2eaa48032ec8594af604c57033d2b78ab0516eba 0.0s done
#37 exporting config sha256:650babbe6357784df8340e53537cec18e70beebc11d5a478528daf3c4a46800b 0.0s done
#37 exporting attestation manifest sha256:66d7cb5be9afd6a4fb83c889db7d4f168f479593edebbf627245ba3e617755f6 0.1s done
#37 exporting manifest list sha256:64ccebc0240289b7f87b7f15f05b4a5cefa3a62c0dc1487f58a80ca4dff51ffb 0.1s done
#37 naming to docker.io/library/highload-lab4-upload-cleanup:latest 0.0s done
#37 unpacking to docker.io/library/highload-lab4-upload-cleanup:latest
#37 unpacking to docker.io/library/highload-lab4-upload-cleanup:latest 0.0s done
#37 DONE 0.5s
#38 [s3-bootstrap] exporting to image
#38 exporting layers done
#38 exporting manifest sha256:dd2bbbd4483023e5124c00da1cc13633ac948721c55e0bf6a6bf7331c0cd06e4 0.0s done
#38 exporting config sha256:6c819718ab87aac477b0a779c7763274bbabe01223ec05eb372077f96b98adb3 0.0s done
#38 exporting attestation manifest sha256:5c621aa3c04fb990da97dc1fb103feb5fbb8c3c3c7495589efd9001a823298df 0.1s done
#38 exporting manifest list sha256:87530453dc25cf26f9aab7bb3167e0831af3e0e9233b17eaaa59be4d780f5fa9 0.1s done
#38 naming to docker.io/library/highload-lab4-s3-bootstrap:latest 0.0s done
#38 unpacking to docker.io/library/highload-lab4-s3-bootstrap:latest 0.0s done
#38 DONE 0.5s
#39 [migrate] exporting to image
#39 exporting layers done
#39 exporting manifest sha256:72b55ff56061496e227a3f2d6159efd7619d4ebac3e62a7a292ca38c0aa430e5 0.0s done
#39 exporting config sha256:717f0c6505d0f59b5ff8b1ae4a2ae07241dfd835b97f85ebd54812db3f40df02 0.0s done
#39 exporting attestation manifest sha256:eb8048635d5a2fe19319f95e751bacb7484d8357992fc324e2e5c401359d2df9 0.1s done
#39 exporting manifest list sha256:776406956564b03c4c68fcb0273a0e1d6b86e2c0e2cf9ce3fa82a85762ac0f42 0.1s done
#39 naming to docker.io/library/highload-lab4-migrate:latest 0.0s done
#39 unpacking to docker.io/library/highload-lab4-migrate:latest 0.0s done
#39 DONE 0.5s
#40 [api] exporting to image
#40 exporting layers done
#40 exporting manifest sha256:9c7d0be760523e4c4a8775f30d52c18f04c9290528e99d8b542474a6941c2843 0.0s done
#40 exporting config sha256:b3dcf18403a7675697043933aee1a0a0f297c459658ffc1dd6f5372060d04942 0.0s done
#40 exporting attestation manifest sha256:8f285c1fdf78dbe48b37e4f39354817556369f0840f24e91a8671ebf84b2ba25 0.1s done
#40 exporting manifest list sha256:e5149bb9db200a2bcfeadde9eb676add0e9fa7f2a6018069212387cce6467dba 0.1s done
#40 naming to docker.io/library/highload-lab4-api:latest 0.0s done
#40 unpacking to docker.io/library/highload-lab4-api:latest 0.1s done
#40 DONE 0.5s
#41 [frontend] resolving provenance for metadata file
#41 ...
#42 [s3] resolving provenance for metadata file
#42 DONE 0.2s
#43 [api] resolving provenance for metadata file
#43 DONE 0.0s
#41 [frontend] resolving provenance for metadata file
#41 DONE 0.4s
#44 [migrate] resolving provenance for metadata file
#44 DONE 0.2s
#45 [upload-cleanup] resolving provenance for metadata file
#45 DONE 0.3s
#46 [s3-bootstrap] resolving provenance for metadata file
#46 DONE 0.3s
Image highload-lab4-s3 Built
Image highload-lab4-s3-bootstrap Built
Image highload-lab4-api Built
Image highload-lab4-frontend Built
Image highload-lab4-upload-cleanup Built
Image highload-lab4-migrate Built
Container highload-lab4-upload-cleanup-1 Running
Container highload-lab4-s3-1 Running
Container highload-lab4-haproxy-1 Running
Container highload-lab4-api-1 Running
Container highload-lab4-api-2 Running
Container highload-lab4-redis-1 Running
Container highload-lab4-db-1 Running
Container highload-lab4-frontend-1 Recreate
Container highload-lab4-frontend-1 Recreated
Container highload-lab4-s3-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-db-1 Healthy
Container highload-lab4-migrate-1 Starting
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Starting
Container highload-lab4-migrate-1 Started
Container highload-lab4-s3-bootstrap-1 Started
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-redis-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-migrate-1 Exited
Container highload-lab4-redis-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-db-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-frontend-1 Starting
Container highload-lab4-frontend-1 Started
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-redis-1 Waiting
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-upload-cleanup-1 Waiting
Container highload-lab4-s3-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-frontend-1 Waiting
Container highload-lab4-s3-1 Healthy
Container highload-lab4-db-1 Healthy
Container highload-lab4-upload-cleanup-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-redis-1 Healthy
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
Container highload-lab4-frontend-1 Healthy
@@ -0,0 +1,2 @@
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
@@ -0,0 +1,28 @@
{
"run": "20261018T203755.405686Z",
"python": "3.12.3",
"platform": "Linux-6.6.87.1-microsoft-standard-WSL2-x86_64-with-glibc2.39",
"script_sha256": "590edec359e8641ff0723c2be4352f3363b0ef8d2b2bf24509dcd88be0eed102",
"report_sha256": "a389b2e9d05ae7a35a6e1096f70561937dbd004151fa5b2874f5b2b22e46d20b",
"campaign": "evidence/upload-comparison/20261018T193626Z-formal-f49d61",
"criteria": {
"public-smoke": "PASS",
"baseline": "PASS",
"shared-storage": "PASS",
"proxy-attachments": "PASS",
"validation-access": "PASS",
"replica-failover": "PASS",
"persistence": "PASS",
"upload-recovery": "PASS",
"safe-cleanup": "PASS",
"bounded-memory": "PASS",
"s3-permissions": "PASS",
"direct-flow": "PASS",
"direct-validation-access": "PASS",
"direct-recovery": "PASS",
"direct-cleanup": "PASS",
"upload-comparison": "PASS",
"frontend": "PASS"
},
"restored": true
}
@@ -0,0 +1,46 @@
# Гипотеза и сравнение трафика/RAM на четырёх профилях
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## experiment
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe experiment --campaign /mnt/c/projects/Highload-systems/mtusi2026lab4-fork/evidence/upload-comparison/20261018T193626Z-formal-f49d61
```
Начало: 2026-10-18T20:43:13.717511+00:00; длительность: 3.393 с; exit code: 0.
````text
PASS: sealed protocol, archive, fixtures, raw records and recomputed decision match
Campaign: evidence/upload-comparison/20261018T193626Z-formal-f49d61
Ready/verified: 720 720
Errors: 0
{"profile": "small-moderate", "valid_pairs": 3, "median_traffic_ratio": 0.5065773906213067, "min_traffic_ratio": 0.5063861055246678, "max_traffic_ratio": 0.5079907229528128}
{"profile": "large-moderate", "valid_pairs": 3, "median_traffic_ratio": 0.49949754357270226, "min_traffic_ratio": 0.4991382402982068, "max_traffic_ratio": 0.49981732427785186}
{"profile": "small-pixels40m", "valid_pairs": 3, "median_traffic_ratio": 0.5126058228037882, "min_traffic_ratio": 0.50707065100036, "max_traffic_ratio": 0.512817391975545}
{"profile": "large-pixels40m", "valid_pairs": 3, "median_traffic_ratio": 0.49928261799970935, "min_traffic_ratio": 0.4992082132615818, "max_traffic_ratio": 0.49959788796606974}
{"profile": "small-moderate", "mode": "proxy", "median_api_MiB_per_ready": 2.0209168752034503, "median_api_window_peak_MiB": 136.0546875, "max_api_lifetime_peak_MiB": 141.2265625, "median_ready_rps": 7.894590746470929, "median_p50_s": 0.13762395, "median_p95_s": 0.349706212, "median_p99_s": 0.353454295}
{"profile": "small-moderate", "mode": "direct", "median_api_MiB_per_ready": 1.0233642260233562, "median_api_window_peak_MiB": 138.71875, "max_api_lifetime_peak_MiB": 140.8125, "median_ready_rps": 6.6154831177570035, "median_p50_s": 0.330249949, "median_p95_s": 0.664536392, "median_p99_s": 0.665379127}
{"profile": "large-moderate", "mode": "proxy", "median_api_MiB_per_ready": 20.11448278427124, "median_api_window_peak_MiB": 148.44140625, "max_api_lifetime_peak_MiB": 152.44921875, "median_ready_rps": 4.708766693021728, "median_p50_s": 0.623532216, "median_p95_s": 1.199421251, "median_p99_s": 1.370958831}
{"profile": "large-moderate", "mode": "direct", "median_api_MiB_per_ready": 10.044582716623943, "median_api_window_peak_MiB": 147.1796875, "max_api_lifetime_peak_MiB": 150.04296875, "median_ready_rps": 3.1121213975127984, "median_p50_s": 1.760060342, "median_p95_s": 2.429332421, "median_p99_s": 2.519360375}
{"profile": "small-pixels40m", "mode": "proxy", "median_api_MiB_per_ready": 2.0204983075459797, "median_api_window_peak_MiB": 381.2734375, "max_api_lifetime_peak_MiB": 384.3203125, "median_ready_rps": 3.145227806944573, "median_p50_s": 1.294338167, "median_p95_s": 2.522289981, "median_p99_s": 2.55024115}
{"profile": "small-pixels40m", "mode": "direct", "median_api_MiB_per_ready": 1.0358009020487466, "median_api_window_peak_MiB": 384.0546875, "max_api_lifetime_peak_MiB": 387.94140625, "median_ready_rps": 2.8002143610390253, "median_p50_s": 1.645604573, "median_p95_s": 3.186833871, "median_p99_s": 3.235123098}
{"profile": "large-pixels40m", "mode": "proxy", "median_api_MiB_per_ready": 20.120631217956543, "median_api_window_peak_MiB": 391.99609375, "max_api_lifetime_peak_MiB": 393.2578125, "median_ready_rps": 2.3240187390207696, "median_p50_s": 1.835096441, "median_p95_s": 3.14764051, "median_p99_s": 3.996668065}
{"profile": "large-pixels40m", "mode": "direct", "median_api_MiB_per_ready": 10.045849291483561, "median_api_window_peak_MiB": 393.05859375, "max_api_lifetime_peak_MiB": 397.359375, "median_ready_rps": 1.780860551975933, "median_p50_s": 3.21658326, "median_p95_s": 5.166217115, "median_p99_s": 5.44240128}
Decision: confirmed_in_tested_conditions
````
## Реализация
- [experiments/docs/HYPOTHESIS.md](../../../../experiments/docs/HYPOTHESIS.md)
- [experiments/docs/METHODOLOGY.md](../../../../experiments/docs/METHODOLOGY.md)
- [experiments/docs/LIMITATIONS.md](../../../../experiments/docs/LIMITATIONS.md)
- [experiments/run.py](../../../../experiments/run.py)
Измерения не запускались повторно: проверены сохранённые сырые данные.
[Серия](../../../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/metrics.json) · [Протокол](../../../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/protocol.json) · [Графики](../../../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/)
@@ -0,0 +1,38 @@
# Обрыв HTTP и отказ между S3 PUT и COMMIT
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestUploadRecoveryHTTPDisconnect`, `TestUploadRecoveryAfterPutFailure`, `TestUploadRecoveryMetadataRejection`, `TestUploadRecoveryDatabaseConnectionLoss`, `TestUploadRecoveryProcessExit`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](backend.txt).
````text
=== RUN TestUploadRecoveryHTTPDisconnect
--- PASS: TestUploadRecoveryHTTPDisconnect (1.09s)
=== RUN TestUploadRecoveryAfterPutFailure
--- PASS: TestUploadRecoveryAfterPutFailure (0.58s)
=== RUN TestUploadRecoveryMetadataRejection
--- PASS: TestUploadRecoveryMetadataRejection (0.60s)
=== RUN TestUploadRecoveryDatabaseConnectionLoss
--- PASS: TestUploadRecoveryDatabaseConnectionLoss (0.62s)
=== RUN TestUploadRecoveryProcessExit
--- PASS: TestUploadRecoveryProcessExit (0.67s)
PASS
````
## Реализация
- [src/backend/repositories/upload.go](../../../../src/backend/repositories/upload.go)
- [src/backend/tests/upload_recovery_test.go](../../../../src/backend/tests/upload_recovery_test.go)
@@ -0,0 +1,49 @@
# Лимиты, MIME, filename и доступ к чужим вложениям
[Отчёт](../../../../REPORT.md) · [Все критерии](../../README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestAttachmentValidationHTTP`, `TestAttachmentImageValidation`, `TestAttachmentFilenameValidation`, `TestAttachmentAccessHTTP`.
## proxy
```sh
make test-grade3
```
Начало: 2026-10-18T20:41:01.363701+00:00; длительность: 3.645 с; exit code: 0.
````text
python3 scripts/check_grade3.py --base-url "http://localhost:8080"
PASS: image limits, chunked upload, ACL, message attachments, concurrent replay across replicas
````
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](backend.txt).
````text
=== RUN TestAttachmentValidationHTTP
--- PASS: TestAttachmentValidationHTTP (1.47s)
=== RUN TestAttachmentAccessHTTP
--- PASS: TestAttachmentAccessHTTP (1.08s)
=== RUN TestAttachmentImageValidation
--- PASS: TestAttachmentImageValidation (0.00s)
=== RUN TestAttachmentFilenameValidation
--- PASS: TestAttachmentFilenameValidation (0.00s)
PASS
````
## Реализация
- [src/backend/tests/attachment_http_test.go](../../../../src/backend/tests/attachment_http_test.go)
- [src/backend/services/attachment.go](../../../../src/backend/services/attachment.go)
+44
View File
@@ -0,0 +1,44 @@
# Повторяемый bootstrap и ограниченные credentials
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestS3PermissionsAndBootstrap`, `TestDirectUploadAccessPermissionsAndLifecycle`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](runs/20261018T203755.405686Z/backend.txt).
````text
=== RUN TestDirectUploadAccessPermissionsAndLifecycle
--- PASS: TestDirectUploadAccessPermissionsAndLifecycle (0.98s)
=== RUN TestS3PermissionsAndBootstrap
--- PASS: TestS3PermissionsAndBootstrap (0.92s)
PASS
````
## isolation
```sh
/usr/bin/python3 scripts/check_s3_isolation.py
```
Начало: 2026-10-18T20:41:07.464744+00:00; длительность: 0.991 с; exit code: 0.
````text
PASS: loopback-only private S3, disabled console, restricted API mounts, bounded tmpfs
````
## Реализация
- [src/backend/repositories/s3_admin.go](../../src/backend/repositories/s3_admin.go)
- [scripts/check_s3_isolation.py](../../scripts/check_s3_isolation.py)
+48
View File
@@ -0,0 +1,48 @@
# Grace period, блокировки, защита готовых объектов и повтор
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestAttachmentCleanupGraceLocksProtectionAndRetry`, `TestAttachmentCleanupInvalidKeyIsNeverDeleted`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](runs/20261018T203755.405686Z/backend.txt).
````text
=== RUN TestAttachmentCleanupGraceLocksProtectionAndRetry
--- PASS: TestAttachmentCleanupGraceLocksProtectionAndRetry (0.88s)
=== RUN TestAttachmentCleanupInvalidKeyIsNeverDeleted
--- PASS: TestAttachmentCleanupInvalidKeyIsNeverDeleted (0.61s)
PASS
````
## cleanup-dry-run
```sh
make attachments-cleanup
```
Начало: 2026-10-18T20:41:08.490906+00:00; длительность: 1.327 с; exit code: 0.
````text
docker compose --project-name highload-lab4 --env-file .env -f compose.yml run --rm --no-deps upload-cleanup ./messenger attachments-cleanup --dry-run
Container highload-lab4-upload-cleanup-run-ee9c8bded59f Creating
Container highload-lab4-upload-cleanup-run-ee9c8bded59f Created
{"direct":{"candidates":1,"deleted":0,"eligible":1,"protected":0,"skipped":0,"failed":0,"dry_run":true},"originals":{"candidates":0,"deleted":0,"eligible":0,"protected":0,"skipped":0,"failed":0,"dry_run":true}}
````
## Реализация
- [src/backend/cleanup.go](../../src/backend/cleanup.go)
- [src/backend/repositories/cleanup_config.go](../../src/backend/repositories/cleanup_config.go)
- [src/backend/repositories/upload.go](../../src/backend/repositories/upload.go)
+579
View File
@@ -0,0 +1,579 @@
# Две API, PostgreSQL и приватный S3 в общем стенде
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## startup
```sh
make app-up
```
Начало: 2026-10-18T20:37:55.408721+00:00; длительность: 21.944 с; exit code: 0.
````text
python3 scripts/init_env.py
Local .env and connection files ready; existing values and files preserved.
chmod +x scripts/restart.sh scripts/stop-one.sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml up -d --build --wait
Image highload-lab4-frontend Building
Image highload-lab4-migrate Building
Image highload-lab4-s3-bootstrap Building
Image highload-lab4-api Building
Image highload-lab4-s3 Building
Image highload-lab4-upload-cleanup Building
#1 [internal] load local bake definitions
#1 reading from stdin 3.08kB done
#1 DONE 0.0s
#2 [api internal] load build definition from Dockerfile
#2 transferring dockerfile:
#2 transferring dockerfile: 661B 0.0s done
#2 DONE 0.2s
#3 [frontend internal] load build definition from Dockerfile
#3 transferring dockerfile: 181B 0.1s done
#3 DONE 0.2s
#4 [s3 internal] load build definition from minio.Dockerfile
#4 transferring dockerfile: 1.01kB 0.0s done
#4 DONE 0.2s
#5 [upload-cleanup internal] load metadata for docker.io/library/debian:12.15-slim
#5 ...
#6 [frontend internal] load metadata for docker.io/library/node:22-bookworm-slim
#6 DONE 0.5s
#5 [s3 internal] load metadata for docker.io/library/debian:12.15-slim
#5 DONE 0.5s
#7 [api internal] load metadata for docker.io/library/golang:1.22.2-bookworm
#7 DONE 0.5s
#8 [migrate internal] load .dockerignore
#8 transferring context: 268B 0.0s done
#8 DONE 0.0s
#9 [frontend internal] load .dockerignore
#9 transferring context: 58B 0.0s done
#9 DONE 0.1s
#10 [api internal] load build context
#10 DONE 0.0s
#11 [s3-bootstrap stage-1 1/4] FROM docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171
#11 resolve docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171
#11 resolve docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171 0.1s done
#11 DONE 0.1s
#12 [s3-bootstrap builder 1/6] FROM docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f
#12 resolve docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f 0.1s done
#12 DONE 0.1s
#13 [frontend 1/5] FROM docker.io/library/node:22-bookworm-slim@sha256:43ac6c60b8f89723f746e8a92ce91abd5017e627ce1ddfe4238355d3a30b772c
#13 resolve docker.io/library/node:22-bookworm-slim@sha256:43ac6c60b8f89723f746e8a92ce91abd5017e627ce1ddfe4238355d3a30b772c 0.1s done
#13 DONE 0.1s
#14 [frontend internal] load build context
#14 transferring context: 1.07kB 0.1s done
#14 DONE 0.1s
#15 [frontend 2/5] WORKDIR /app
#15 CACHED
#16 [frontend 3/5] COPY package.json package-lock.json ./
#16 CACHED
#17 [frontend 4/5] RUN npm ci
#17 CACHED
#10 [s3-bootstrap internal] load build context
#10 ...
#18 [frontend 5/5] COPY . .
#18 DONE 0.1s
#10 [s3-bootstrap internal] load build context
#10 ...
#19 [s3 internal] load metadata for docker.io/library/golang:1.24.2-bookworm
#19 DONE 1.0s
#20 [s3 internal] load .dockerignore
#20 transferring context: 2B 0.0s done
#20 DONE 0.0s
#10 [s3-bootstrap internal] load build context
#10 transferring context: 4.39kB 0.5s done
#10 DONE 0.5s
#11 [s3 stage-1 1/4] FROM docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171
#11 resolve docker.io/library/debian:12.15-slim@sha256:88200866dfff7ea7f5cbcb6ec7c8a701889efe6fe859fe64d6990e4b07ea4171 0.1s done
#11 DONE 0.1s
#21 [s3 builder 1/4] FROM docker.io/library/golang:1.24.2-bookworm@sha256:79390b5e5af9ee6e7b1173ee3eac7fadf6751a545297672916b59bfa0ecf6f71
#21 resolve docker.io/library/golang:1.24.2-bookworm@sha256:79390b5e5af9ee6e7b1173ee3eac7fadf6751a545297672916b59bfa0ecf6f71 0.0s done
#21 DONE 0.0s
#22 [s3 stage-1 2/3] RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && rm -rf /var/lib/apt/lists/* && groupadd --system storage && useradd --system --gid storage storage && mkdir /data && chown storage:storage /data
#22 CACHED
#23 [s3 builder 3/4] RUN git init . && git remote add origin https://github.com/minio/minio.git && git fetch --depth 1 origin 0d7408fc9969caf07de6a8c3a84f9fbb10a6739e && git checkout --detach FETCH_HEAD
#23 CACHED
#24 [s3 builder 4/4] RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X github.com/minio/minio/cmd.Version=2025-04-22T22:12:26Z -X github.com/minio/minio/cmd.ReleaseTag=RELEASE.2025-04-22T22-12-26Z -X github.com/minio/minio/cmd.CommitID=0d7408fc9969caf07de6a8c3a84f9fbb10a6739e" -o /out/minio .
#24 CACHED
#25 [s3 builder 2/4] WORKDIR /source
#25 CACHED
#26 [s3 stage-1 3/3] COPY --from=builder /out/minio /usr/local/bin/minio
#26 CACHED
#27 [api stage-1 3/4] WORKDIR /app
#27 CACHED
#28 [api builder 4/6] RUN go mod download
#28 CACHED
#29 [api builder 2/6] WORKDIR /src
#29 CACHED
#30 [api builder 3/6] COPY go.mod go.sum ./
#30 CACHED
#31 [api stage-1 2/4] RUN groupadd --system app && useradd --system --gid app --no-create-home app
#31 CACHED
#32 [api builder 5/6] COPY backend ./backend
#32 CACHED
#33 [api builder 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/messenger ./backend
#33 CACHED
#34 [api stage-1 4/4] COPY --from=builder /out/messenger ./messenger
#34 CACHED
#35 [s3] exporting to image
#35 exporting layers done
#35 exporting manifest sha256:cf1641bb428d024d81f932bd8ab277ade2790aa5cb2ec1b90238a00df54ccbee done
#35 exporting config sha256:b261b45a54ac72fb091ebba0c6b5e09aedc1239e48fe469c1d81ae7ea23621e6 done
#35 exporting attestation manifest sha256:5f4beb93e7723dcab160781dab716c739459a829c31e7d26e443fb017974f3b9
#35 ...
#28 [s3-bootstrap builder 4/6] RUN go mod download
#28 CACHED
#29 [s3-bootstrap builder 2/6] WORKDIR /src
#29 CACHED
#33 [s3-bootstrap builder 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/messenger ./backend
#33 CACHED
#27 [s3-bootstrap stage-1 3/4] WORKDIR /app
#27 CACHED
#31 [s3-bootstrap stage-1 2/4] RUN groupadd --system app && useradd --system --gid app --no-create-home app
#31 CACHED
#30 [s3-bootstrap builder 3/6] COPY go.mod go.sum ./
#30 CACHED
#32 [s3-bootstrap builder 5/6] COPY backend ./backend
#32 CACHED
#34 [upload-cleanup stage-1 4/4] COPY --from=builder /out/messenger ./messenger
#34 CACHED
#36 [frontend] exporting to image
#36 exporting layers 0.1s done
#36 exporting manifest sha256:d59faebffe67b578ba0786caed54363bffa894312c0787d714977eb9bec9799a 0.0s done
#36 exporting config sha256:fb3ba9317f8efad41b9927e041302762863ea60e513b286942022cd88a4ccf3f 0.0s done
#36 exporting attestation manifest sha256:d4458fdb5f8220753cb7ac6be3561ff06e61c9d49e1ef60947bda4fe49215f3b 0.0s done
#36 exporting manifest list sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c 0.0s done
#36 naming to docker.io/library/highload-lab4-frontend:latest done
#36 unpacking to docker.io/library/highload-lab4-frontend:latest 0.1s done
#36 DONE 0.4s
#35 [s3] exporting to image
#35 exporting attestation manifest sha256:5f4beb93e7723dcab160781dab716c739459a829c31e7d26e443fb017974f3b9 0.0s done
#35 exporting manifest list sha256:4ba76dc492ca964bc6d3702e4dcd6e7befbe17fb39ac169860624139962b7825 0.1s done
#35 naming to docker.io/library/highload-lab4-s3:latest 0.1s done
#35 unpacking to docker.io/library/highload-lab4-s3:latest
#35 unpacking to docker.io/library/highload-lab4-s3:latest 0.1s done
#35 DONE 0.4s
#37 [upload-cleanup] exporting to image
#37 exporting layers done
#37 exporting manifest sha256:7d4f622a2a83dd1aec3b761e2eaa48032ec8594af604c57033d2b78ab0516eba 0.0s done
#37 exporting config sha256:650babbe6357784df8340e53537cec18e70beebc11d5a478528daf3c4a46800b 0.0s done
#37 exporting attestation manifest sha256:66d7cb5be9afd6a4fb83c889db7d4f168f479593edebbf627245ba3e617755f6 0.1s done
#37 exporting manifest list sha256:64ccebc0240289b7f87b7f15f05b4a5cefa3a62c0dc1487f58a80ca4dff51ffb 0.1s done
#37 naming to docker.io/library/highload-lab4-upload-cleanup:latest 0.0s done
#37 unpacking to docker.io/library/highload-lab4-upload-cleanup:latest
#37 unpacking to docker.io/library/highload-lab4-upload-cleanup:latest 0.0s done
#37 DONE 0.5s
#38 [s3-bootstrap] exporting to image
#38 exporting layers done
#38 exporting manifest sha256:dd2bbbd4483023e5124c00da1cc13633ac948721c55e0bf6a6bf7331c0cd06e4 0.0s done
#38 exporting config sha256:6c819718ab87aac477b0a779c7763274bbabe01223ec05eb372077f96b98adb3 0.0s done
#38 exporting attestation manifest sha256:5c621aa3c04fb990da97dc1fb103feb5fbb8c3c3c7495589efd9001a823298df 0.1s done
#38 exporting manifest list sha256:87530453dc25cf26f9aab7bb3167e0831af3e0e9233b17eaaa59be4d780f5fa9 0.1s done
#38 naming to docker.io/library/highload-lab4-s3-bootstrap:latest 0.0s done
#38 unpacking to docker.io/library/highload-lab4-s3-bootstrap:latest 0.0s done
#38 DONE 0.5s
#39 [migrate] exporting to image
#39 exporting layers done
#39 exporting manifest sha256:72b55ff56061496e227a3f2d6159efd7619d4ebac3e62a7a292ca38c0aa430e5 0.0s done
#39 exporting config sha256:717f0c6505d0f59b5ff8b1ae4a2ae07241dfd835b97f85ebd54812db3f40df02 0.0s done
#39 exporting attestation manifest sha256:eb8048635d5a2fe19319f95e751bacb7484d8357992fc324e2e5c401359d2df9 0.1s done
#39 exporting manifest list sha256:776406956564b03c4c68fcb0273a0e1d6b86e2c0e2cf9ce3fa82a85762ac0f42 0.1s done
#39 naming to docker.io/library/highload-lab4-migrate:latest 0.0s done
#39 unpacking to docker.io/library/highload-lab4-migrate:latest 0.0s done
#39 DONE 0.5s
#40 [api] exporting to image
#40 exporting layers done
#40 exporting manifest sha256:9c7d0be760523e4c4a8775f30d52c18f04c9290528e99d8b542474a6941c2843 0.0s done
#40 exporting config sha256:b3dcf18403a7675697043933aee1a0a0f297c459658ffc1dd6f5372060d04942 0.0s done
#40 exporting attestation manifest sha256:8f285c1fdf78dbe48b37e4f39354817556369f0840f24e91a8671ebf84b2ba25 0.1s done
#40 exporting manifest list sha256:e5149bb9db200a2bcfeadde9eb676add0e9fa7f2a6018069212387cce6467dba 0.1s done
#40 naming to docker.io/library/highload-lab4-api:latest 0.0s done
#40 unpacking to docker.io/library/highload-lab4-api:latest 0.1s done
#40 DONE 0.5s
#41 [frontend] resolving provenance for metadata file
#41 ...
#42 [s3] resolving provenance for metadata file
#42 DONE 0.2s
#43 [api] resolving provenance for metadata file
#43 DONE 0.0s
#41 [frontend] resolving provenance for metadata file
#41 DONE 0.4s
#44 [migrate] resolving provenance for metadata file
#44 DONE 0.2s
#45 [upload-cleanup] resolving provenance for metadata file
#45 DONE 0.3s
#46 [s3-bootstrap] resolving provenance for metadata file
#46 DONE 0.3s
Image highload-lab4-s3 Built
Image highload-lab4-s3-bootstrap Built
Image highload-lab4-api Built
Image highload-lab4-frontend Built
Image highload-lab4-upload-cleanup Built
Image highload-lab4-migrate Built
Container highload-lab4-upload-cleanup-1 Running
Container highload-lab4-s3-1 Running
Container highload-lab4-haproxy-1 Running
Container highload-lab4-api-1 Running
Container highload-lab4-api-2 Running
Container highload-lab4-redis-1 Running
Container highload-lab4-db-1 Running
Container highload-lab4-frontend-1 Recreate
Container highload-lab4-frontend-1 Recreated
Container highload-lab4-s3-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-db-1 Healthy
Container highload-lab4-migrate-1 Starting
Container highload-lab4-s3-1 Healthy
Container highload-lab4-s3-bootstrap-1 Starting
Container highload-lab4-migrate-1 Started
Container highload-lab4-s3-bootstrap-1 Started
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-redis-1 Waiting
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-migrate-1 Exited
Container highload-lab4-redis-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-db-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-frontend-1 Starting
Container highload-lab4-frontend-1 Started
Container highload-lab4-s3-bootstrap-1 Waiting
Container highload-lab4-redis-1 Waiting
Container highload-lab4-api-2 Waiting
Container highload-lab4-api-1 Waiting
Container highload-lab4-haproxy-1 Waiting
Container highload-lab4-migrate-1 Waiting
Container highload-lab4-upload-cleanup-1 Waiting
Container highload-lab4-s3-1 Waiting
Container highload-lab4-db-1 Waiting
Container highload-lab4-frontend-1 Waiting
Container highload-lab4-s3-1 Healthy
Container highload-lab4-db-1 Healthy
Container highload-lab4-upload-cleanup-1 Healthy
Container highload-lab4-s3-bootstrap-1 Exited
Container highload-lab4-redis-1 Healthy
Container highload-lab4-haproxy-1 Healthy
Container highload-lab4-migrate-1 Exited
Container highload-lab4-api-2 Healthy
Container highload-lab4-api-1 Healthy
Container highload-lab4-frontend-1 Healthy
````
## inventory
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe inventory
```
Начало: 2026-10-18T20:38:15.728752+00:00; длительность: 0.679 с; exit code: 0.
````text
[
{
"id": "959dccd157e188cd60f6db860ea20700cc2dd8c27805d55952d53c7b5471598e",
"hostname": "959dccd157e1",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:36:24.367291372Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "7bdd907a608af31577bd5510a41375cf26d9c3076545109c447c9e54024fb011",
"hostname": "7bdd907a608a",
"service": "api",
"image": "sha256:ffc389d196c2b7ed2a25cc6dc40c3c379f039142825e99c51afb58505bad734e",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.89479619Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {
"/tmp/uploads": "rw,noexec,nosuid,size=16m,mode=1777"
},
"volumes": []
},
{
"id": "259b35fab41e7e1790ac49e31fcff0e461ff512a95cd722c6f677d5058d86303",
"hostname": "259b35fab41e",
"service": "db",
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.416387316Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_postgres_data"
]
},
{
"id": "c0bbd38841b949b916226af63ada5d8c855ab59c67e4a06ef51ad8d51b2839b7",
"hostname": "c0bbd38841b9",
"service": "frontend",
"image": "sha256:f5b74ea208d8858de6d2174c5b42f2c470a511252641e29ef98aff6dedf6ed8c",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:09.864159664Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 500000000,
"ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
},
"tmpfs": {},
"volumes": [
"b9f1bd167d18e267c37863a052b4aed0a20f0b82b7680e0b92c6d6a78d83345c"
]
},
{
"id": "e21b07ae8881dac719504c3f9377931815597fe4460eac747ce25ddf52027a9a",
"hostname": "e21b07ae8881",
"service": "haproxy",
"image": "sha256:5d97434a423c2533cfeb42874d45cf6d69a840b60334582dfbfd5008e94c80be",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T15:32:54.031245659Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
},
"tmpfs": {},
"volumes": []
},
{
"id": "a5c6efa8b9b37c253baa4aff4e710d75f1fb263956bdcb18658b69224a563a43",
"hostname": "a5c6efa8b9b3",
"service": "migrate",
"image": "sha256:3924dbfb81da76fca449bd32819e6ca36a3fdbf8490a0c1c1b50fd81a324103d",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:06.043221163Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "64a89a43e53bb359e2e41fea25f15b8b91a7ce67ed8a2a7b2c9e5105d9350aed",
"hostname": "64a89a43e53b",
"service": "redis",
"image": "sha256:c6eabf748fc7a61dbb5a705c78bcf3d6377b1127a97d0ce965c11c44ba46896f",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:49.786499611Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": [
"highload-lab4_redis_data"
]
},
{
"id": "cc9133bc44063407356aabc39a7efcfe12ffed39046dbb7868a390b2926757d4",
"hostname": "cc9133bc4406",
"service": "s3",
"image": "sha256:1ba45e373544d1351cdc5623067181bd21185a6487e53c026f8cfaf2330d155d",
"state": "running",
"health": "healthy",
"exit_code": 0,
"started_at": "2026-10-18T20:35:50.058525711Z",
"restarts": 0,
"memory": 536870912,
"nano_cpus": 1000000000,
"ports": {
"9000/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "9000"
}
]
},
"tmpfs": {},
"volumes": [
"highload-lab4_s3_data"
]
},
{
"id": "cd964756deb6c3898420c382b33394ea602426da7ae405e6925863107a3c01e5",
"hostname": "cd964756deb6",
"service": "s3-bootstrap",
"image": "sha256:759e9a688eb1bd82330ff43eb8f0fec811d4dcf8f9ff784489a41e87f8622a13",
"state": "exited",
"health": "unhealthy",
"exit_code": 0,
"started_at": "2026-10-18T20:38:06.399345399Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 500000000,
"ports": {},
"tmpfs": {},
"volumes": []
},
{
"id": "e163dbec27d202308dbda1a0f2c1804695870d07f99b4fea4d48335294c2eb35",
"hostname": "e163dbec27d2",
"service": "upload-cleanup",
"image": "sha256:003cb186865f57ed75ca7eb742995ee65674a68c64afadca5fba7649d522e8c3",
"state": "running",
"health": null,
"exit_code": 0,
"started_at": "2026-10-18T20:35:54.81722101Z",
"restarts": 0,
"memory": 134217728,
"nano_cpus": 250000000,
"ports": {},
"tmpfs": {},
"volumes": []
}
]
````
## schema
```sh
docker compose --project-name highload-lab4 --env-file .env -f compose.yml exec -T db sh -c 'psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT version, dirty FROM schema_migrations;"'
```
Начало: 2026-10-18T20:38:16.439436+00:00; длительность: 0.315 с; exit code: 0.
````text
version | dirty
---------+-------
6 | f
(1 row)
````
## isolation
```sh
/usr/bin/python3 scripts/check_s3_isolation.py
```
Начало: 2026-10-18T20:41:07.464744+00:00; длительность: 0.991 с; exit code: 0.
````text
PASS: loopback-only private S3, disabled console, restricted API mounts, bounded tmpfs
````
## Реализация
- [compose.yml](../../compose.yml)
- [infra/minio.Dockerfile](../../infra/minio.Dockerfile)
- [src/backend/repositories/migrations/000004_attachments.up.sql](../../src/backend/repositories/migrations/000004_attachments.up.sql)
+46
View File
@@ -0,0 +1,46 @@
# Гипотеза и сравнение трафика/RAM на четырёх профилях
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
## experiment
```sh
/usr/bin/python3 scripts/generate_evidence.py --probe experiment --campaign /mnt/c/projects/Highload-systems/mtusi2026lab4-fork/evidence/upload-comparison/20261018T193626Z-formal-f49d61
```
Начало: 2026-10-18T20:43:13.717511+00:00; длительность: 3.393 с; exit code: 0.
````text
PASS: sealed protocol, archive, fixtures, raw records and recomputed decision match
Campaign: evidence/upload-comparison/20261018T193626Z-formal-f49d61
Ready/verified: 720 720
Errors: 0
{"profile": "small-moderate", "valid_pairs": 3, "median_traffic_ratio": 0.5065773906213067, "min_traffic_ratio": 0.5063861055246678, "max_traffic_ratio": 0.5079907229528128}
{"profile": "large-moderate", "valid_pairs": 3, "median_traffic_ratio": 0.49949754357270226, "min_traffic_ratio": 0.4991382402982068, "max_traffic_ratio": 0.49981732427785186}
{"profile": "small-pixels40m", "valid_pairs": 3, "median_traffic_ratio": 0.5126058228037882, "min_traffic_ratio": 0.50707065100036, "max_traffic_ratio": 0.512817391975545}
{"profile": "large-pixels40m", "valid_pairs": 3, "median_traffic_ratio": 0.49928261799970935, "min_traffic_ratio": 0.4992082132615818, "max_traffic_ratio": 0.49959788796606974}
{"profile": "small-moderate", "mode": "proxy", "median_api_MiB_per_ready": 2.0209168752034503, "median_api_window_peak_MiB": 136.0546875, "max_api_lifetime_peak_MiB": 141.2265625, "median_ready_rps": 7.894590746470929, "median_p50_s": 0.13762395, "median_p95_s": 0.349706212, "median_p99_s": 0.353454295}
{"profile": "small-moderate", "mode": "direct", "median_api_MiB_per_ready": 1.0233642260233562, "median_api_window_peak_MiB": 138.71875, "max_api_lifetime_peak_MiB": 140.8125, "median_ready_rps": 6.6154831177570035, "median_p50_s": 0.330249949, "median_p95_s": 0.664536392, "median_p99_s": 0.665379127}
{"profile": "large-moderate", "mode": "proxy", "median_api_MiB_per_ready": 20.11448278427124, "median_api_window_peak_MiB": 148.44140625, "max_api_lifetime_peak_MiB": 152.44921875, "median_ready_rps": 4.708766693021728, "median_p50_s": 0.623532216, "median_p95_s": 1.199421251, "median_p99_s": 1.370958831}
{"profile": "large-moderate", "mode": "direct", "median_api_MiB_per_ready": 10.044582716623943, "median_api_window_peak_MiB": 147.1796875, "max_api_lifetime_peak_MiB": 150.04296875, "median_ready_rps": 3.1121213975127984, "median_p50_s": 1.760060342, "median_p95_s": 2.429332421, "median_p99_s": 2.519360375}
{"profile": "small-pixels40m", "mode": "proxy", "median_api_MiB_per_ready": 2.0204983075459797, "median_api_window_peak_MiB": 381.2734375, "max_api_lifetime_peak_MiB": 384.3203125, "median_ready_rps": 3.145227806944573, "median_p50_s": 1.294338167, "median_p95_s": 2.522289981, "median_p99_s": 2.55024115}
{"profile": "small-pixels40m", "mode": "direct", "median_api_MiB_per_ready": 1.0358009020487466, "median_api_window_peak_MiB": 384.0546875, "max_api_lifetime_peak_MiB": 387.94140625, "median_ready_rps": 2.8002143610390253, "median_p50_s": 1.645604573, "median_p95_s": 3.186833871, "median_p99_s": 3.235123098}
{"profile": "large-pixels40m", "mode": "proxy", "median_api_MiB_per_ready": 20.120631217956543, "median_api_window_peak_MiB": 391.99609375, "max_api_lifetime_peak_MiB": 393.2578125, "median_ready_rps": 2.3240187390207696, "median_p50_s": 1.835096441, "median_p95_s": 3.14764051, "median_p99_s": 3.996668065}
{"profile": "large-pixels40m", "mode": "direct", "median_api_MiB_per_ready": 10.045849291483561, "median_api_window_peak_MiB": 393.05859375, "max_api_lifetime_peak_MiB": 397.359375, "median_ready_rps": 1.780860551975933, "median_p50_s": 3.21658326, "median_p95_s": 5.166217115, "median_p99_s": 5.44240128}
Decision: confirmed_in_tested_conditions
````
## Реализация
- [experiments/docs/HYPOTHESIS.md](../../experiments/docs/HYPOTHESIS.md)
- [experiments/docs/METHODOLOGY.md](../../experiments/docs/METHODOLOGY.md)
- [experiments/docs/LIMITATIONS.md](../../experiments/docs/LIMITATIONS.md)
- [experiments/run.py](../../experiments/run.py)
Измерения не запускались повторно: проверены сохранённые сырые данные.
[Серия](../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/metrics.json) · [Протокол](../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/protocol.json) · [Графики](../../evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/)
+38
View File
@@ -0,0 +1,38 @@
# Обрыв HTTP и отказ между S3 PUT и COMMIT
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestUploadRecoveryHTTPDisconnect`, `TestUploadRecoveryAfterPutFailure`, `TestUploadRecoveryMetadataRejection`, `TestUploadRecoveryDatabaseConnectionLoss`, `TestUploadRecoveryProcessExit`.
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](runs/20261018T203755.405686Z/backend.txt).
````text
=== RUN TestUploadRecoveryHTTPDisconnect
--- PASS: TestUploadRecoveryHTTPDisconnect (1.09s)
=== RUN TestUploadRecoveryAfterPutFailure
--- PASS: TestUploadRecoveryAfterPutFailure (0.58s)
=== RUN TestUploadRecoveryMetadataRejection
--- PASS: TestUploadRecoveryMetadataRejection (0.60s)
=== RUN TestUploadRecoveryDatabaseConnectionLoss
--- PASS: TestUploadRecoveryDatabaseConnectionLoss (0.62s)
=== RUN TestUploadRecoveryProcessExit
--- PASS: TestUploadRecoveryProcessExit (0.67s)
PASS
````
## Реализация
- [src/backend/repositories/upload.go](../../src/backend/repositories/upload.go)
- [src/backend/tests/upload_recovery_test.go](../../src/backend/tests/upload_recovery_test.go)
+49
View File
@@ -0,0 +1,49 @@
# Лимиты, MIME, filename и доступ к чужим вложениям
[Отчёт](../../REPORT.md) · [Все критерии](README.md)
Статус: **PASS**. Запуск: `20261018T203755.405686Z`.
Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.
Проверенные сценарии: `TestAttachmentValidationHTTP`, `TestAttachmentImageValidation`, `TestAttachmentFilenameValidation`, `TestAttachmentAccessHTTP`.
## proxy
```sh
make test-grade3
```
Начало: 2026-10-18T20:41:01.363701+00:00; длительность: 3.645 с; exit code: 0.
````text
python3 scripts/check_grade3.py --base-url "http://localhost:8080"
PASS: image limits, chunked upload, ACL, message attachments, concurrent replay across replicas
````
## backend
```sh
make test-backend
```
Начало: 2026-10-18T20:38:40.802787+00:00; длительность: 148.987 с; exit code: 0.
Фрагмент; полный вывод: [backend.txt](runs/20261018T203755.405686Z/backend.txt).
````text
=== RUN TestAttachmentValidationHTTP
--- PASS: TestAttachmentValidationHTTP (1.47s)
=== RUN TestAttachmentAccessHTTP
--- PASS: TestAttachmentAccessHTTP (1.08s)
=== RUN TestAttachmentImageValidation
--- PASS: TestAttachmentImageValidation (0.00s)
=== RUN TestAttachmentFilenameValidation
--- PASS: TestAttachmentFilenameValidation (0.00s)
PASS
````
## Реализация
- [src/backend/tests/attachment_http_test.go](../../src/backend/tests/attachment_http_test.go)
- [src/backend/services/attachment.go](../../src/backend/services/attachment.go)
+13
View File
@@ -0,0 +1,13 @@
{
"checked_utc": "2026-10-18T20:44:47.784359+00:00",
"run": "20261018T203755.405686Z",
"criteria_passed": 17,
"markdown_files_checked": 53,
"all_links_resolve": true,
"generator_unit_tests_passed": 4,
"no_frontend_tests": true,
"report_sections_preserved": true,
"commit_pr_field_unchanged": true,
"no_secret_values_in_current_evidence": true,
"pdf_count": 0
}
@@ -1,20 +0,0 @@
{
"purpose": "png_only_plot_validation",
"application_uploads": 0,
"hypothesis_tested": false,
"removed_pdf_files": [
"evidence/upload-comparison/20261018T193141Z-pilot-980ab7/plots/20261018T193517.348234Z/api-memory-lifetime.pdf",
"evidence/upload-comparison/20261018T193141Z-pilot-980ab7/plots/20261018T193517.348234Z/api-memory-window.pdf",
"evidence/upload-comparison/20261018T193141Z-pilot-980ab7/plots/20261018T193517.348234Z/api-traffic.pdf",
"evidence/upload-comparison/20261018T193141Z-pilot-980ab7/plots/20261018T193517.348234Z/errors.pdf",
"evidence/upload-comparison/20261018T193141Z-pilot-980ab7/plots/20261018T193517.348234Z/latency-p95.pdf",
"evidence/upload-comparison/20261018T193141Z-pilot-980ab7/plots/20261018T193517.348234Z/traffic-ratio.pdf",
"evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/20261018T195401.869811Z/api-memory-lifetime.pdf",
"evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/20261018T195401.869811Z/api-memory-window.pdf",
"evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/20261018T195401.869811Z/api-traffic.pdf",
"evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/20261018T195401.869811Z/errors.pdf",
"evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/20261018T195401.869811Z/latency-p95.pdf",
"evidence/upload-comparison/20261018T193626Z-formal-f49d61/plots/20261018T195401.869811Z/traffic-ratio.pdf"
],
"test_exit_code": 0
}
+363
View File
@@ -0,0 +1,363 @@
#!/usr/bin/env python3
"""Run criterion checks and publish sanitized Markdown evidence; never commit."""
import argparse
import datetime as dt
import fcntl
import hashlib
import json
import os
from pathlib import Path
import platform
import re
import shlex
import statistics
import subprocess
import sys
import tarfile
import time
ROOT = Path(__file__).resolve().parents[1]
OUTPUT = ROOT / "evidence/criteria"
COMPOSE = ["docker", "compose", "--project-name", "highload-lab4",
"--env-file", ".env", "-f", "compose.yml"]
# One file per criterion in REPORT.md. Shared checks are executed only once.
CRITERIA = [
("public-smoke", "Публичный smoke и структура контракта", ["structure", "smoke"], [],
["tests/smoke.py", "contracts/openapi.json"]),
("baseline", "Возможности lab3", ["baseline", "backend"],
["TestStoredPasswordUsesArgon2id", "TestShortSessionTTLAndLogout", "TestIdempotencyConcurrentStoresAndScopes", "TestChatTransactionRollsBackAfterMemberInsertFailure", "TestListMessagesPagination"],
["src/backend/repositories/idempotency.go", "src/backend/repositories/redis.go", "src/backend/services/password.go"]),
("shared-storage", "Две API, PostgreSQL и приватный S3 в общем стенде", ["startup", "inventory", "schema", "isolation"], [],
["compose.yml", "infra/minio.Dockerfile", "src/backend/repositories/migrations/000004_attachments.up.sql"]),
("proxy-attachments", "PNG/JPEG, ready, сообщение и побайтный download", ["proxy", "backend"],
["TestAttachmentAccessHTTP"], ["src/backend/services/attachment.go", "src/backend/handlers/attachment_http.go", "src/backend/repositories/attachment.go"]),
("validation-access", "Лимиты, MIME, filename и доступ к чужим вложениям", ["proxy", "backend"],
["TestAttachmentValidationHTTP", "TestAttachmentImageValidation", "TestAttachmentFilenameValidation", "TestAttachmentAccessHTTP"],
["src/backend/tests/attachment_http_test.go", "src/backend/services/attachment.go"]),
("replica-failover", "Оригинал после остановки обслужившей API", ["proxy-failures", "direct-failures", "public-failover", "restore"], [],
["scripts/check_grade3.py", "scripts/check_direct_upload.py", "scripts/stop-one.sh"]),
("persistence", "Сессия, метаданные и оригинал после restart", ["before-restart", "persistence", "after-restart", "restart-audit", "direct-failures"], [],
["scripts/restart.sh", "tests/resilience.py"]),
("upload-recovery", "Обрыв HTTP и отказ между S3 PUT и COMMIT", ["backend"],
["TestUploadRecoveryHTTPDisconnect", "TestUploadRecoveryAfterPutFailure", "TestUploadRecoveryMetadataRejection", "TestUploadRecoveryDatabaseConnectionLoss", "TestUploadRecoveryProcessExit"],
["src/backend/repositories/upload.go", "src/backend/tests/upload_recovery_test.go"]),
("safe-cleanup", "Grace period, блокировки, защита готовых объектов и повтор", ["backend", "cleanup-dry-run"],
["TestAttachmentCleanupGraceLocksProtectionAndRetry", "TestAttachmentCleanupInvalidKeyIsNeverDeleted"],
["src/backend/cleanup.go", "src/backend/repositories/cleanup_config.go", "src/backend/repositories/upload.go"]),
("bounded-memory", "Потоковая обработка, лимиты и ≥10 клиентов", ["inventory", "experiment"], [],
["src/backend/services/attachment.go", "src/backend/services/direct_upload.go", "experiments/config/protocol.json"]),
("s3-permissions", "Повторяемый bootstrap и ограниченные credentials", ["backend", "isolation"],
["TestS3PermissionsAndBootstrap", "TestDirectUploadAccessPermissionsAndLifecycle"],
["src/backend/repositories/s3_admin.go", "scripts/check_s3_isolation.py"]),
("direct-flow", "Presigned POST и неизменяемый готовый оригинал", ["direct", "backend"],
["TestDirectUploadFlow", "TestDirectUploadRecoveryConcurrentComplete"],
["src/backend/services/direct_upload.go", "src/backend/repositories/s3_direct.go"]),
("direct-validation-access", "Подпись, владелец, размер, SHA-256, MIME и CORS", ["backend"],
["TestDirectUploadValidationHTTP", "TestDirectUploadValidationContents", "TestDirectUploadAccess", "TestDirectUploadAccessCORS"],
["src/backend/handlers/direct_upload_http.go", "src/backend/tests/direct_upload_test.go", "src/backend/tests/direct_permissions_test.go"]),
("direct-recovery", "Повторы complete, crash и отмена ожидания", ["backend", "direct-failures"],
["TestDirectUploadRecoveryFailures", "TestDirectUploadRecoveryProcessExit", "TestDirectUploadRecoverySharedSlotAndCancellation"],
["src/backend/repositories/direct_upload.go", "src/frontend/src/directUpload.ts"]),
("direct-cleanup", "Незавершённый staging, replay, dry-run и lifecycle", ["backend", "cleanup-dry-run"],
["TestDirectUploadCleanupSafetyAndReplay", "TestDirectUploadCleanupDependencyFailureAndMalformedKey", "TestDirectUploadAccessPermissionsAndLifecycle"],
["src/backend/repositories/direct_cleanup.go", "src/backend/repositories/s3_admin.go"]),
("upload-comparison", "Гипотеза и сравнение трафика/RAM на четырёх профилях", ["experiment"], [],
["experiments/docs/HYPOTHESIS.md", "experiments/docs/METHODOLOGY.md", "experiments/docs/LIMITATIONS.md", "experiments/run.py"]),
("frontend", "Сборка React UI", ["frontend-build"], [],
["src/frontend/src/App.tsx", "src/frontend/src/AttachmentImage.tsx", "src/frontend/src/directUpload.ts"]),
]
def load(path):
return json.loads(path.read_text())
def digest(path):
h = hashlib.sha256()
with path.open("rb") as stream:
for block in iter(lambda: stream.read(65536), b""):
h.update(block)
return h.hexdigest()
def sanitize(text):
# Redact actual local secrets as well as common credential representations.
values = []
for path in (ROOT / "secrets").glob("*"):
if path.is_file():
values.append(path.read_text().strip())
env = ROOT / ".env"
if env.exists():
values += [line.split("=", 1)[1].strip().strip("\"'")
for line in env.read_text().splitlines()
if line.startswith("POSTGRES_PASSWORD=")]
for value in sorted(set(values), key=len, reverse=True):
if value:
text = text.replace(value, "[REDACTED]")
text = re.sub(r"(?i)(Bearer|Basic)\s+[A-Za-z0-9+/=_.-]+", r"\1 [REDACTED]", text)
text = re.sub(r"(?i)(postgres(?:ql)?|redis)://[^\s\"']+", r"\1://[REDACTED]", text)
text = re.sub(r'(?i)("(?:token|password|secret_access_key|x-amz-signature|x-amz-credential|policy)"\s*:\s*)"[^"]*"', r'\1"[REDACTED]"', text)
return text
def capture(args):
return subprocess.check_output(args, cwd=ROOT, text=True, stderr=subprocess.STDOUT)
def inventory():
ids = capture(COMPOSE + ["ps", "--all", "-q"]).splitlines()
assert ids, "stack is absent"
result = []
for c in json.loads(capture(["docker", "inspect", *ids])):
if c["Config"]["Labels"].get("com.docker.compose.oneoff") == "True":
continue
result.append({
"id": c["Id"], "hostname": c["Config"]["Hostname"],
"service": c["Config"]["Labels"]["com.docker.compose.service"],
"image": c["Image"], "state": c["State"]["Status"],
"health": c["State"].get("Health", {}).get("Status"),
"exit_code": c["State"]["ExitCode"], "started_at": c["State"]["StartedAt"],
"restarts": c["RestartCount"], "memory": c["HostConfig"]["Memory"],
"nano_cpus": c["HostConfig"]["NanoCpus"],
"ports": c["HostConfig"]["PortBindings"],
"tmpfs": c["HostConfig"].get("Tmpfs", {}),
"volumes": sorted(m["Name"] for m in c["Mounts"] if m["Type"] == "volume"),
})
api = [c for c in result if c["service"] == "api"]
assert len(api) == 2 and all(c["health"] == "healthy" for c in api)
assert all(c["memory"] == 512 * 1048576 and not c["volumes"] for c in api)
assert all(not c["ports"] for c in api)
for service in ("db", "redis", "s3"):
assert any(c["service"] == service and c["volumes"] and c["health"] == "healthy" for c in result)
for service in ("migrate", "s3-bootstrap"):
assert any(c["service"] == service and c["state"] == "exited" and c["exit_code"] == 0 for c in result)
print(json.dumps(result, indent=2))
def audit_restart(before, after):
a, b = load(before), load(after)
for role in ("db", "redis", "s3", "api", "upload-cleanup"):
old, new = [c for c in a if c["service"] == role], [c for c in b if c["service"] == role]
assert old and len(old) == len(new)
assert {c["id"] for c in old} == {c["id"] for c in new}
for first in old:
second = next(c for c in new if c["id"] == first["id"])
assert first["started_at"] != second["started_at"], role + " was not restarted"
assert first["volumes"] == second["volumes"], role + " changed volumes"
print("PASS: real restart " + role + "; same containers and persistent volumes")
def audit_experiment(campaign):
campaign = campaign.resolve()
assert campaign.parent == (ROOT / "evidence/upload-comparison").resolve()
sys.path.insert(0, str(ROOT / "experiments/src"))
from common import check_seal
from analysis import case_metrics, decision, json_lines
check_seal(campaign)
protocol, plan, manifest = load(campaign / "protocol.json"), load(campaign / "plan.json"), load(campaign / "source-manifest.json")
assert protocol["purpose"] == "confirmatory" and protocol["clients"] >= 10
assert len({p["size_bytes"] for p in protocol["profiles"]}) >= 2
# Verify archived code, not today's edited docs/plotter, against the frozen manifest.
with tarfile.open(campaign / "source.tar.gz") as archive:
for name, expected in manifest.items():
member = archive.extractfile(name)
assert member and hashlib.sha256(member.read()).hexdigest() == expected, name
for name in ("experiments/src/analysis.py", "experiments/src/common.py"):
assert digest(ROOT / name) == manifest[name], "use frozen analysis code"
fixtures = {f["name"]: f for f in load(campaign / "fixtures.json")}
metrics = []
for case in plan:
folder = campaign / "cases" / case["directory"]
recorded = load(folder / "case.json")
assert all(recorded.get(key) == value for key, value in case.items())
requests, checks = json_lines(folder / "requests.jsonl"), json_lines(folder / "verification.jsonl")
assert len(requests) == protocol["clients"] * protocol["waves"]
assert len(json_lines(folder / "warmup.jsonl")) == protocol["warmup_clients"]
ids = [r["attachment"]["id"] for r in requests if r["ready"]]
assert len(set(ids)) == len(ids) and sorted(ids) == sorted(v["id"] for v in checks)
for v in checks:
assert v["verified"] and v["size_bytes"] == case["size_bytes"]
assert v["sha256"] == fixtures[case["profile"]]["sha256"]
metrics.append(case_metrics(folder, protocol))
saved = load(campaign / "metrics.json")
actual = decision(protocol, metrics, plan)
assert saved["cases"] == metrics and saved["decision"] == actual, "summary differs from raw evidence"
assert not (campaign / "execution-failure.json").exists()
assert actual["criterion_status"] == "confirmed_in_tested_conditions", actual["criterion_status"]
# The running backend must match the one actually measured.
changed_backend = [n for n, h in manifest.items() if n.startswith(("src/backend/", "src/go.", "src/Dockerfile", "infra/minio.Dockerfile")) and digest(ROOT / n) != h]
assert not changed_backend, "measured backend differs from current backend"
print("PASS: sealed protocol, archive, fixtures, raw records and recomputed decision match")
print("Campaign: " + str(campaign.relative_to(ROOT)))
print("Ready/verified:", sum(c["ready"] for c in metrics), sum(c["verified"] for c in metrics))
print("Errors:", sum(c["errors"] for c in metrics))
for profile in actual["profiles"]:
print(json.dumps(profile))
for name in [p["name"] for p in protocol["profiles"]]:
for mode in ("proxy", "direct"):
cases = [c for c in metrics if c["profile"] == name and c["mode"] == mode]
print(json.dumps({"profile": name, "mode": mode,
"median_api_MiB_per_ready": statistics.median(c["api_bytes_per_ready"] for c in cases) / 1048576,
"median_api_window_peak_MiB": statistics.median(c["api_sampled_peak_window_max"] for c in cases) / 1048576,
"max_api_lifetime_peak_MiB": max(c["api_peak_lifetime_max"] for c in cases) / 1048576,
"median_ready_rps": statistics.median(c["ready_rps"] for c in cases),
"median_p50_s": statistics.median(c["latency_seconds"]["p50"] for c in cases),
"median_p95_s": statistics.median(c["latency_seconds"]["p95"] for c in cases),
"median_p99_s": statistics.median(c["latency_seconds"]["p99"] for c in cases)}))
print("Decision:", actual["criterion_status"])
def report_ids():
return re.findall(r"\]\(evidence/criteria/([a-z0-9-]+)\.md\)", (ROOT / "REPORT.md").read_text())
def write_pages(directory, results, campaign):
status = {}
for key, title, checks, names, sources in CRITERIA:
records = [results[n] for n in checks]
missing = [n for n in names if "--- PASS: " + n + " (" not in results["backend"]["output"]]
passed = all(r["exit_code"] == 0 for r in records) and not missing
status[key] = "PASS" if passed else "FAIL / НЕ ДОКАЗАНО"
lines = ["# " + title, "", "[Отчёт](../../REPORT.md) · [Все критерии](README.md)", "",
"Статус: **" + status[key] + "**. Запуск: `" + directory.name + "`.", "",
"Тесты создают синтетические данные. Интеграционные Go-тесты используют отдельные схемы БД и собственные S3-ключи.", ""]
if names:
lines += ["Проверенные сценарии: " + ", ".join("`" + n + "`" for n in names) + ".", ""]
if missing:
lines += ["Не найдены успешные результаты: " + ", ".join(missing), ""]
for check in checks:
r = results[check]
lines += ["## " + check, "", "```sh", r["command"], "```", "",
f"Начало: {r['started_utc']}; длительность: {r['seconds']:.3f} с; exit code: {r['exit_code']}.", ""]
if check == "backend" and names:
shown = "\n".join(l for l in r["output"].splitlines() if any(n in l for n in names) or l.startswith(("FAIL", "ok\t", "PASS")))
lines += ["Фрагмент; полный вывод: [backend.txt](runs/" + directory.name + "/backend.txt).", ""]
else:
shown = r["output"]
lines += ["````text", shown.strip(), "````", ""]
lines += ["## Реализация", "", *["- [" + s + "](../../" + s + ")" for s in sources], ""]
if "experiment" in checks:
rel = str(campaign.relative_to(ROOT))
lines += ["Измерения не запускались повторно: проверены сохранённые сырые данные.", "",
"[Серия](../../" + rel + "/metrics.json) · [Протокол](../../" + rel + "/protocol.json) · [Графики](../../" + rel + "/plots/)", ""]
text = "\n".join(lines)
(OUTPUT / (key + ".md")).write_text(text)
history = text.replace("](../../", "](../../../../")
history = history.replace("](README.md)", "](../../README.md)")
history = history.replace("](runs/" + directory.name + "/backend.txt)", "](backend.txt)")
(directory / (key + ".md")).write_text(history)
index = ["# Доказательства критериев", "", "[REPORT.md](../../REPORT.md)", "", "Последний запуск: `" + directory.name + "`. Предыдущие попытки сохранены в `runs/`.", "", "| Критерий | Результат |", "| --- | --- |"]
index += [f"| [{title}]({key}.md) | {status[key]} |" for key, title, *_ in CRITERIA]
(OUTPUT / "README.md").write_text("\n".join(index) + "\n")
return status
def generate(campaign):
assert set(report_ids()) == {c[0] for c in CRITERIA}, "REPORT.md criteria and generator differ"
OUTPUT.mkdir(parents=True, exist_ok=True)
with (OUTPUT / ".lock").open("a") as lock:
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
# Never run fault checks alongside an experiment campaign.
with (ROOT / "evidence/upload-comparison/.lock").open("a") as experiment_lock:
fcntl.flock(experiment_lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
return run_checks(campaign)
def run_checks(campaign):
stamp = dt.datetime.now(dt.timezone.utc).strftime("%Y%m%dT%H%M%S.%fZ")
directory = OUTPUT / "runs" / stamp
directory.mkdir(parents=True)
results = {}
self_command = [sys.executable, "scripts/generate_evidence.py", "--probe"]
def run(name, args, timeout=900):
print("Running " + name, flush=True)
started, clock = dt.datetime.now(dt.timezone.utc).isoformat(), time.monotonic()
try:
proc = subprocess.run(args, cwd=ROOT, text=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, timeout=timeout)
output, code = proc.stdout, proc.returncode
except subprocess.TimeoutExpired as error:
output = error.stdout or b""
if isinstance(output, bytes):
output = output.decode(errors="replace")
output += "\nTIMEOUT: check did not finish within the declared limit."
code = 124
except OSError as error:
output, code = type(error).__name__, 127
result = dict(command=shlex.join(args), started_utc=started,
seconds=time.monotonic() - clock, exit_code=code, output=sanitize(output))
results[name] = result
(directory / (name + ".txt")).write_text(result["output"])
(directory / "commands.json").write_text(json.dumps(results, indent=2) + "\n")
print(name + ": " + ("PASS" if code == 0 else "FAIL"), flush=True)
return result
try:
run("startup", ["make", "app-up"], 1800)
run("inventory", self_command + ["inventory"])
run("schema", COMPOSE + ["exec", "-T", "db", "sh", "-c", 'psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT version, dirty FROM schema_migrations;"'])
run("structure", ["make", "check"])
run("smoke", ["make", "test"])
run("baseline", ["make", "test-baseline"])
run("backend", ["make", "test-backend"], 1800)
run("proxy", ["make", "test-grade3"])
run("direct", [sys.executable, "scripts/check_direct_upload.py"])
run("isolation", [sys.executable, "scripts/check_s3_isolation.py"])
run("cleanup-dry-run", ["make", "attachments-cleanup"])
run("frontend-build", COMPOSE + ["exec", "-T", "frontend", "npm", "run", "build"])
run("proxy-failures", ["make", "test-grade3-failures"])
run("before-restart", self_command + ["inventory"])
run("persistence", ["make", "test-persistence", "ACTION_SCRIPT=scripts/restart.sh"])
run("after-restart", self_command + ["inventory"])
run("restart-audit", self_command + ["restart", "--before", str(directory / "before-restart.txt"), "--after", str(directory / "after-restart.txt")])
run("direct-failures", [sys.executable, "scripts/check_direct_upload.py", "--failures", "--restart"])
run("public-failover", ["make", "test-failover", "ACTION_SCRIPT=scripts/stop-one.sh"])
run("experiment", self_command + ["experiment", "--campaign", str(campaign)])
finally:
run("restore", ["make", "app-start"])
run("final-inventory", self_command + ["inventory"])
for _, _, checks, _, _ in CRITERIA:
for check in checks:
results.setdefault(check, dict(command="not executed", started_utc=stamp,
seconds=0, exit_code=125, output="NOT RUN"))
state = write_pages(directory, results, campaign)
meta = {"run": stamp, "python": platform.python_version(), "platform": platform.platform(),
"script_sha256": digest(Path(__file__)), "report_sha256": digest(ROOT / "REPORT.md"),
"campaign": str(campaign.relative_to(ROOT)), "criteria": state,
"restored": results["restore"]["exit_code"] == results["final-inventory"]["exit_code"] == 0}
(directory / "summary.json").write_text(json.dumps(meta, indent=2) + "\n")
print("Evidence: " + str(OUTPUT.relative_to(ROOT)))
return 0 if all(v == "PASS" for v in state.values()) and meta["restored"] else 1
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--campaign", type=Path, help="completed confirmatory campaign; otherwise latest completed")
parser.add_argument("--probe", choices=["inventory", "restart", "experiment"])
parser.add_argument("--before", type=Path)
parser.add_argument("--after", type=Path)
args = parser.parse_args()
if args.probe == "inventory":
inventory()
elif args.probe == "restart":
audit_restart(args.before, args.after)
else:
campaign = args.campaign
if campaign is None:
candidates = sorted(d for d in (ROOT / "evidence/upload-comparison").iterdir()
if (d / "metrics.json").exists()
and load(d / "protocol.json")["purpose"] == "confirmatory")
if not candidates:
parser.error("no completed formal campaign; pass --campaign")
campaign = candidates[-1]
campaign = campaign.resolve()
if args.probe == "experiment":
audit_experiment(campaign)
else:
raise SystemExit(generate(campaign))
if __name__ == "__main__":
main()
+1 -2
View File
@@ -6,8 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc --noEmit && vite build",
"typecheck": "tsc --noEmit",
"test:direct-upload": "node --test tests/directUpload.test.cjs"
"typecheck": "tsc --noEmit"
},
"dependencies": {
"react": "19.3.0",