ЛР 2 — БВТ2301 — Гамаюнов — на 5 #97

Closed
gamayunov2004 wants to merge 5 commits from gamayunov2004/mtusi2026lab2:solution/bvt2301-gamayunov into master
170 changed files with 77979 additions and 17 deletions
+16
View File
@@ -0,0 +1,16 @@
*.sh text eol=lf
*.py text eol=lf
*.sql text eol=lf
# New research text evidence: stable LF on Windows; existing teacher files unchanged.
evidence/grade5/**/*.txt text eol=lf
evidence/grade5/**/*.md text eol=lf
evidence/grade5/**/*.json text eol=lf
evidence/grade5/**/*.jsonl text eol=lf
evidence/grade5/**/*.csv text eol=lf
evidence/grade5/**/*.yaml text eol=lf
evidence/grade5/**/*.svg text eol=lf
# Raw measurements are immutable; CR before LF is data, other whitespace checks stay on.
evidence/grade5/raw/** -text !eol whitespace=cr-at-eol
# Never apply text/EOL conversion to binary source archives.
evidence/grade5/**/*.zip binary !eol
+27
View File
@@ -0,0 +1,27 @@
name: Student application
on: [push, pull_request]
permissions:
contents: read
jobs:
application:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Local synthetic secrets and build
run: |
sh scripts/init-env.sh
docker compose --env-file .env --profile test build
- name: Start and wait for the new application
run: docker compose --env-file .env --profile test up -d --wait --wait-timeout 120 api api-expiry
- name: Public and grade 4 checks
run: docker compose --profile test run --rm tools sh scripts/run-checks.sh
- name: Sanitized evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: lab2-evidence
path: evidence/
- name: Stop only this test project
if: always()
run: docker compose --profile test down
+7
View File
@@ -30,3 +30,10 @@ coverage/
.vscode/
# Keep small, sanitized evidence summaries in evidence/ under version control.
# Inspect git diff --cached: ignore rules are not a secret scanner.
# Isolated grade-5 runtime copies and local review archives
.grade5-work/
review-grade5*.zip
# Local PR description draft; publish manually after review.
/PR_GRADE5_DRAFT.md
+12
View File
@@ -0,0 +1,12 @@
FROM python:3.12.10-slim-bookworm
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 APP_HOST=0.0.0.0 APP_PORT=8080
WORKDIR /app
COPY requirements.txt requirements.lock ./
RUN pip install --no-cache-dir -r requirements.lock && useradd --create-home --uid 10001 appuser
COPY --chown=appuser:appuser src ./src
COPY --chown=appuser:appuser migrations ./migrations
USER appuser
EXPOSE 8080
STOPSIGNAL SIGTERM
HEALTHCHECK --interval=3s --timeout=3s --start-period=10s --retries=5 CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready',timeout=2).read()" || exit 1
CMD ["sh", "-c", "exec uvicorn src.main:app --host \"$APP_HOST\" --port \"$APP_PORT\" --no-access-log"]
+102 -17
View File
@@ -1,37 +1,122 @@
# Отчёт — лабораторная 2
- Автор, группа: TODO
- Целевая оценка; выбранный трек 5, если нужен: TODO
- Commit/PR: TODO после публикации
- Использованные источники, библиотеки и помощь ИИ: TODO
- Автор, группа: Гамаюнов Артём, БВТ2301.
- Целевая оценка; выбранный трек 5, если нужен: **5; трек 1 «Согласованность кэша» — cache stampede**.
- Commit/PR: [PR №97](https://gitea.privcloud.tech/mtusi2026/mtusi2026lab2/pulls/97); опубликованный коммит пятёрки `799f56c`, ветка `solution/bvt2301-gamayunov`.
- Использованные источники, библиотеки и помощь ИИ: оригинальные README/COURSE/CONTRIBUTING/contracts/tests ЛР2; собственная актуальная ЛР1 на 5 (соседняя папка только для чтения). FastAPI/Pydantic/Uvicorn, psycopg/pool, Argon2id, redis-py; Codex — реализация, методика, проверки и отчёт. [PostgreSQL16 pg_stat_statements](https://www.postgresql.org/docs/16/pgstatstatements.html), [Python3.12 Future](https://docs.python.org/3.12/library/concurrent.futures.html). Преподавательский сервер не использовался.
## Запуск из чистого clone
TODO: версии runtime/образов, prerequisites, команды создания локальных secrets/.env, build, миграций, запуска, ожидания готовности, тестов и остановки. Указать необходимые действия оператора. Не вставлять секреты. Отдельно указать безопасную остановку и команду намеренного удаления учебных данных.
Нужны Docker Engine с Linux containers, Compose с `--wait`, сеть для первого скачивания образов/пакетов. Host Python нужен только для исследовательской обвязки; make/проверки выполняются в Linux tools. Проверено 25.10.2026 Europe/Moscow: Windows + Docker Desktop, Engine 29.5.2, Compose 5.1.3, WSL 2; Intel i5-6300U (2cores/4threads), DockerVM4CPU/8242409472bytes. Образы: python:3.12.10-slim-bookworm, postgres:16.8-bookworm, valkey/valkey:8.0.2-alpine, tools docker:27.5.1-cli. Python зависимости закреплены в requirements.lock и infra/requirements-tools.lock. Конкретные imageID/digest и конфигурация: [evidence/grade5](evidence/grade5/README.md).
Обычный запуск решения из свободной локальной копии:
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/init-env.ps1
# Linux вместо PowerShell: sh scripts/init-env.sh
# На Linux: chmod +x scripts/init-env.sh scripts/restart.sh scripts/run-checks.sh
docker compose --env-file .env config --quiet
docker compose --env-file .env --profile test build
docker compose --env-file .env --profile test up -d --wait --wait-timeout 120 api api-expiry
docker compose --profile test run --rm tools sh scripts/run-checks.sh
```
API — http://localhost:8080; PG/Valkey не публикуют порты. `/health/live` проверяет процесс; `/health/ready` — PostgreSQL, поскольку кэш необязателен для безопасного обслуживания. `init-env` генерирует file secrets без печати значений, повторный запуск сохраняет пароль БД. Secrets/.env исключены из Git/build context. На Linux каталог secrets 700, файлы444 для чтения UID 10001 внутри API. Миграции запускаются автоматически; отдельно: `docker compose exec -T api python -m src.db`.
Безопасная остановка — `docker compose --profile test down` (volumes сохраняются). Намеренное удаление **своих ненужных учебных данных**, только по решению оператора: та же команда с `--volumes`. В ходе этой работы volumes не удалялись. Tools имеет Docker socket для операторских fault/restart hooks; обычный API его не имеет.
Текущий исходный стенд `mtusi-lab2` не перезапускался и не обновлялся. Все новые проверки выполнялись на отдельных `lab2-g5-20261025-{baseline,candidate,final,clean}` с собственными credentials/networks/volumes и уникальными image tags. Из чистой копии исходный compose.yaml проверен с маленьким [override](evidence/grade5/compose.clean-override.yaml): новые image names, отключение публикации8080, запрет дополнительного swap и project env для tools. Чистая `build --no-cache`, bootstrap дважды, пустые users/chats/messages, миграции и полный набор проверок прошли. [Лог](evidence/grade5/clean-build.txt), [bootstrap](evidence/grade5/clean-bootstrap.txt), [результаты](evidence/grade5/clean-checks/).
Новый полный сравнительный эксперимент, не затрагивающий основной стенд:
```powershell
py -3.14 evidence/grade5/reproduce.py
# Linux: python3 evidence/grade5/reproduce.py
# Только пересчёт опубликованных чисел:
py -3.14 evidence/grade5/aggregate.py
py -3.14 evidence/grade5/audit.py --offline
```
Пути, команды Linux tools, время, создание/остановка своих ресурсов и ограничения: [README воспроизведения](evidence/grade5/README.md), [выполненные команды](evidence/grade5/commands.md).
## Архитектура и решения
TODO: схема процессов/хранилищ, источник истины, транзакционные границы, ограничения. Что перенесено из lab1, что изменено в этой работе. Соответствие переменных из .env.example реальной конфигурации.
Клиент → API → PostgreSQL; API → Valkey для неизменяемого публичного профиля. Сохраняются все users/chats/chat_members/messages/sessions в PG с UUID PK, FK, UNIQUE username и версионируемой миграцией001. Чат и все участники создаются одной транзакцией: реальный FK после INSERT родителя откатывает всё. Сообщение подтверждается201 после COMMIT. fsync/synchronous_commit=on; durability зависит также от volume/диска host.
Пароли — Argon2id (19 MiB,t=2,p=1), 12–128 Unicode code points без усечения. Basic применяется только на login, пароль с двоеточием поддержан; неизвестный username/неверный пароль дают одинаковый401. Bearer — opaque random 256 bit, в PG только32 byteSHA256 токена и абсолютный expires_at. Это hash случайного токена, не способ хранения пароля. **На каждом защищённом HTTP-запросе с корректным Bearer выполняется session SELECT PostgreSQL до обращения к профилю**. Logout удаляет сессию; expiry проверяет clock_timestamp, не продлевается чтением/рестартом. X-User-Id не авторизует и не меняет владельца токена. Пароли, токены и сессии не кэшируются.
Все значения параметризованы psycopg. Pool на процесс min1/max8, wait 2 s, очередь32, connect 2 s, statement 2 s, lock 1.5 s, idle transaction 5 s. Синхронных рабочих потоков16. API1CPU/512MiB; PG1CPU/512MiB; Valkey0.5CPU/128MiB, maxmemory96MiB/allkeys-lru/AOF everysec. Исследовательский driver1CPU/512MiB; дополнительный swap запрещён. Образы и реальные лимиты проверены в [audit.json](evidence/grade5/audit.json).
Valkey хранит `profile:<user UUID>`: id/username/display_name/created_at, TTL 60 s без sliding. PG — истина. При неизменяемых профилях нет инвалидации по записи. История и членство не кэшируются, поэтому RAW не зависит от Valkey. После потери кэша профиль читается из PG. Сохранены прежние optional_call: socket timeouts 200 ms, бюджет полной операции250 ms (включая ожидание DNS), четыре bounded worker slots, обход кэша5 s после сбоя. При отказе Valkey остаётся PG fallback; при отказе PG корректный503, даже с тёплым профилем.
Новое: bounded single-flight **на один профиль в одном процессе** охватывает GET/load/SET, включая warm hits. Один лидер загружает/публикует профиль, последователи получают тот же публичный результат. Mutex держится только при регистрации/удалении Future; I/O под ним нет, разные пользователи не сериализуются. Реестр максимум128 записей, очистка в finally при успехе и исключении. Максимум ожидания последователя1 s, затем прямой PG fallback без конкурирующей записи кэша. Потеря процесса уничтожает локальный реестр; устаревших distributed locks нет. Это осознанно локальная защита для однопроцессного ЛР2: два процесса могут сделать два SELECT, что реально проверено. Медленный лидер допускает повторные SELECT после timeout; доступность важнее вечной блокировки. При полном реестре — PG с прежними ограничениями pool. Повреждённый JSON/неверные типы/чужой id/лишние поля считаются miss, а не попадают в HTTP.
SQL keyset и индекс `messages_history(chat_id,created_at,id)` сохранены: tuple>boundary ORDER BY tuple LIMIT n+1; OFFSET в API отсутствует. Из актуальной ЛР1 адаптированы полезные проверки UUID spelling, ошибок и access-before-cursor; исправлена нормализация UUID внутри cursor до SQL (urn:uuid принимается PythonUUID, но не PG input) и приоритет404 для чужого чата с malformed cursor. Member UUID уже нормализовались. In-memory индекс/bisect/чужие контракты и tests из ЛР1 не переносились.
Между HTTP-страницами snapshot нет. Поздний COMMIT с ранним created_at или откат часов могут поместить сообщение перед уже пройденным cursor; свежий обход его увидит. При неизменной истории гарантия отсутствия повторов/потерь доказана, равное время разрешается UUID. Настройки .env.example: SESSION_TTL_SECONDS по умолчанию3600, отдельный expiryAPI 2; SESSION_STORE=postgres; Compose задаёт APP_HOST/PORT/ENV и *_URL_FILE; API_PORT меняет только loopback-порт. Текст ошибок/request_id остаётся контрактным и не раскрывает SQL/credentials/stack trace.
## Доказательства критериев
| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства |
| --- | --- | --- | --- |
| Публичный smoke | make test | TODO | TODO |
| Остальные пункты уровня 3 | TODO | TODO | TODO |
| Все пункты уровня 4, если заявлен | TODO | TODO | TODO |
| Выбранный трек 5, если заявлен | TODO | TODO | TODO |
Все строки ниже относятся к окончательным файлам и новым результатам 25.10.2026. Исходная матрица до изменения — [requirements.md](evidence/grade5/requirements.md); независимая финальная сверка — [audit.md](evidence/grade5/audit.md). Исторические evidence уровня4 не переписывались.
TODO: добавить отдельную строку для каждого заявленного критерия. PASS без команды и наблюдения не является доказательством. Проверка инфраструктурного hook требует подтверждения, какие реальные процессы/хранилища перезапущены.
| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства |
|---|---|---|---|
| 3: API ЛР1 с переходом на PG/Bearer | make check validate test, core | smokePASS, Unicode, пагинация/изоляция, KDF/Basic/Bearer | grade5/checks/checks.txt, smoke.txt, core.txt |
| 3: users/chats/members/messages, PK/FK/UNIQUE, миграции с нуля, атомарный чат | clean bootstrap; grade 4 core/migrations | пустая БД→001; FK после INSERT откатывает чат/членство; два запуска миграций не меняют counts/expiry | grade5/clean-bootstrap.txt, checks/core.txt, migrations.txt |
| 3: данные/действующая сессия переживают restart всех stores | make test-persistence ACTION_SCRIPT=scripts/restart.sh; persistence_meta | прежние token/message читаются; StartedAt изменился у api/PG/Valkey; абсолютный expires_at тот же | grade5/checks/persistence.txt, session-persistence.txt |
| 3: auth/expiry/logout/KDF/X-User-Id | core, expiry, integration, faults | неверный пароль/Basic на бизнесAPI/X-User-Id/anonymous401; UTF8:128 codepoints; expired/revoked401 при разных состояниях кэша | grade5/checks/core.txt, expiry.txt, cache-integration.txt, cache-recovery.txt |
| 3: check/test/persistence, секреты/volumes вне Git | весь набор дважды на final/clean; local audit | PASS; реальные private values отсутствуют в передаваемых файлах, teacher files неизменны | grade5/checks/, clean-checks/, audit.json |
| 4: осмысленный Valkey с TTL/истиной | core + integration + faults | реальные hit/TTL/expiry/refill,10 corrupt values; потеря своего ключа+restart→refill из PG | grade5/checks/core.txt, cache-integration.txt, cache-recovery.txt |
| 4: безопасныеSQL/bounded pool/username race/rollback | core/failures | 12 регистраций:1×201+11×409;40 concurrent messages; rollback; bounded 503 | grade5/checks/core.txt, failures.txt |
| 4: индекс ≥10000 и EXPLAIN | grade 4 explain | 3 IndexScan,51 строка/страница;100 HTTP страниц без потерь/повторов | grade5/checks/explain.txt, clean-checks/explain.txt |
| 4: автоматические expiry/logout/wrong password/cache+DB outage | expiry/failures/faults | stop/start реальных own containers; PG неавторизует изкэша; ready503/live200; confirmed data сохранены | grade5/checks/expiry.txt, failures.txt, cache-recovery.txt |
| 5 трек1: конкурентный stampede ДО изменения | HTTP 16 clients, pg_stat_statements | все3 повтора: cold 405–463 profile SELECT/512HTTP, session 512; warm 42–58 лишних SELECT | grade5/raw/baseline/, baseline-source.json/zip |
| 5 трек1: защита/SQL/latency до→после | тот же plan/generator/counters,3 повтора | cold/contended ровно32profileSELECT/512HTTP, warm 0; session 512 сохранены; таблица ниже | grade5/raw/candidate/, runs.csv, comparison.json/svg |
| 5 трек1: RAW и восстановление кэша | integration/faults/persistence | чаты/списки/сообщения немедленно видны другому процессу в обе стороны; restart/loss безопасны | grade5/checks/cache-integration.txt, cache-recovery.txt, persistence.txt |
| 5: границы/стоимость защиты | unit+realHTTP lock+two processes |5 unitPASS;2 process→2 SQL;leader 1.2 s→8SQL/8HTTP, max 1.232 s;warm p99 regression | grade5/checks/unit.txt, cache-integration.txt; results.md |
## Эксперименты и отказы
TODO: гипотеза, hardware/лимиты, версии, объём данных, профиль нагрузки, concurrency/arrival rate, длительность/прогрев, повторы, успешные RPS, ошибки, p50/p95/p99, CPU/RAM. Сохранить raw summary без tokens и объяснить ограничения измерения.
**Гипотеза:** группировка одновременного чтения одного неизменяемого профиля уменьшит SQL-нагрузку при холодном ключе и перегрузке четырёх cache slots, сохранив session SELECT и корректность. Искусственный API редактирования пользователя не вводился; stale read не заявляется.
**Методика, зафиксированная до измерений:** [plan.json](evidence/grade5/plan.json). По16 clients,32 волны/режим,3 повтора; cold/contended/warm, вращение порядка режимов. На версию4608 GET me, 1536/режим. Один синтетический пользователь/валидная сессия. Прогрев профиля и16 keep-alive соединений до фаз. DEL только своего profileUUID перед cold/contended; warm primed перед волной. Barrier в driver запускает настоящие HTTP запросы. Contended держит таблицу users отдельной observer-транзакцией около100 ms; эта задержка включена в latency. Cold не имеет задержек. Генератор ждёт все16 ответов; retries нет. SQL/app исходники для измерений не инструментировались.
pg_stat_statements считает реальные завершённые SQL, snapshot до/после каждой волны под отдельным observer. Фильтр app-role/database; profile/session SELECT раздельны. AllSQL включает BEGIN/COMMIT и попавшие в окно healthSELECT 1; observer/подготовка исключены. Инструментовка одинаковая, её CPU/память и накладные расходы отдельно не вычитались: абсолютные latency включают их влияние. HTTP clock monotonic, полное тело и проверка JSON. RPS — успешные ответы/sum(wave durations), подготовка/сброс/счётчики вне таймера; это goodput синхронных всплесков, не maxRPS. Квантили nearest-rank 512 успешных наблюдений/повтор; около5 наблюдений в верхнем1%, поэтому p99 неточен. 4xx/5xx/timeouts записываются отдельно.
Пилот исходной версии:96 запросов, wall 1.2 s; на32 coldHTTP 23 profileSELECT, при contention32/32, warm3/32. Основная удачная серия baseline 56.084 s, окончательный candidate 41.205 s; подготовка/SQL snapshots включены в wall, но не RPS знаменатель. Baseline измерен до изменения src на исходном HEAD `b5b35682c25e99f774596a809a11d2be2aaf83d8`. SHA всех файлов, source archive и imageID сохранены. Baselineimage `6f6b9e436cb3`; finalcandidate `0bed5b677a58`; полные SHA и clean image — [images-apps.txt](evidence/grade5/images-apps.txt), [audit.json](evidence/grade5/audit.json). Текущие src совпали побайтно с final/clean контейнерами; отдельные LF SHA описывают нормализацию будущего Git checkout.
**Результат:** медианы трёх повторов; каждая ячейка относится к512 HTTP, session SELECT **512→512 во всех режимах**.
| Режим | ProfileSQL до→после | AllSQL до→после | RPS до→после | p50 ms | p95 ms | p99 ms |
|---|---:|---:|---:|---:|---:|---:|
| cold |459→32|2916→1635|87.03→151.32|151.90→69.96|279.25→167.42|296.88→205.41|
| contended 100 ms |508→32|3066→1635|82.86→110.74|165.81→128.72|288.36→169.53|313.78→196.85|
| warm |44→0|1668→1539|133.08→146.03|88.75→80.13|181.42→174.78|205.38→215.68|
Всего в основных сериях: **9216 успешных HTTP,0 ошибок/4xx/5xx/timeouts; profileSQL 2994→192, sessionSQL 4608→4608, allSQL 22836→14418**. Все individual repeats и min/max: [runs.csv](evidence/grade5/runs.csv), [results.md](evidence/grade5/results.md). В cold число profileSELECT уменьшилось на93.0% по медиане, ровно один на волну. Warm control дополнительно подтверждает причину прежних SQL: ограниченные cache slots обходились конкурентными запросами.
![Медианы и min/max трёх повторов](evidence/grade5/comparison.svg)
**Регрессии и цена:** warm p99 +5.0% (205.38→215.68 ms), диапазоны повторов199.66–243.44 и183.80–233.37 ms пересекаются; статистическая значимость не установлена. Candidate cold p99 во втором повторе379.49 ms; нельзя скрывать этот хвост медианой. Появились Future/registry mutex, ожидание followers и максимум128 entries; CPU/RAM overhead количественно не измерен. Несинхронные Docker samples прежних попыток оставлены диагностикой, без заявления об улучшении CPU/RSS. При лидере1.2 s после секунды ожидания fallback допускает8profileSQL/8HTTP вместо одного — доказанная цена ограничения ожидания. Два API-процесса дают2 profileSQL, распределённой дедупликации нет.
**Неуспешные и промежуточные попытки:** первая основная baseline-серия оборвалась из-за Windows bind-mount OSError 22 при сохранении JSON; частичные raw/stdout сохранены и исключены. Raw стали записываться в /tmp контейнера и копироваться после завершения; вся baseline-серия повторена до изменения src. Первая candidate-серия завершилась, но audit обнаружил искажённые русские тексты ошибок после записи WindowsPython с default encoding. Тексты восстановлены из baseline, вся candidate-серия и correctness повторены на finalimage. Пилоты и предыдущая версия не входят в итоговые агрегаты. Подробности и точные fingerprints: [provenance](evidence/grade5/provenance.md). Нулевые ошибки основных серий не выдаются за отсутствие этой неуспешной попытки.
| Воздействие | Что ожидаем | Что наблюдали | Время восстановления / потеря данных |
| --- | --- | --- | --- |
| TODO | TODO | TODO | TODO |
|---|---|---|---|
| restart API+PG+Valkey | прежние token/data/expiry | публичный persistence и metaPASS, все StartedAt изменились | в бюджетах hook/ready; потерь нет |
| stop Valkey | PGfallback, auth остаётся PG | valid read/write; anonymous/unknown/revoked401, чужой404 | final сценарий0.363 s; boundedHTTPmax 0.451 s по всему failures |
| потеря своего ключа + restart Valkey | refill с TTL после cooldown | ключ реально отсутствовал; валидный User восстановлен из PG;expired/revoked401 |7.725 s сявным5.1 s ожиданием cooldown, потерьнет |
| stop PG при прогретом профиле | ready/auth/write503;live 200 | всё подтверждено, anonymous 401;неудачная запись отсутствует | ready+session/data после start 2.083 s |
| sessionTTL 2, logout |401 независимо от кэша/процесса | warm/cold/corrupt/down и второйпроцесс проверены | старые токены не оживают |
| leaderdelay 1.2 s / ошибка / другие key | boundedfallback/очистка/нет общейI/Oблокировки | реальный HTTPmax 1.232 s,8 SQL;5 unitPASS | лидер завершился, повторные вызовы работают |
| clean export / migrations / EXPLAIN | тот же контракт снуля | полная build --no-cache+весьнабор PASS;3 IndexScan на10000 | finalplans0.157/0.135/0.085ms;100 API страниц2.597 s |
Логи API/PG/Valkey проверены на синтетический message marker, пять паролей/токенов и Argon 2 hash; совпадений нет. Некорректный HTTP не отражает тело запроса. Это проверенный набор маркеров, а не универсальное доказательство отсутствия утечек.
## Ограничения и следующие шаги
TODO: какие отказы выдерживаются и какие нет; что не реализовано; где учебное упрощение; какое улучшение подтверждено, а какое пока гипотеза.
Весь формальный уровень3, все пункты4 и завершённый трек1 локально доказаны; статус **READY FOR GRADE 5 REVIEW** означает готовность к независимому ревью, оценку выставляет преподаватель. Контракт и публичные tests не изменены. Source/ref архивы и raw не содержат credentials; исходная однострочная правка REPORT сохранена в начальном snapshot. До публикации выборочный staging был проверен агентом только в отдельной временной Git-копии. Версия на 5 опубликована в коммите `799f56c` и представлена в PR №97.
Ограничения: single-flight локален одному процессу; timeout/полный реестр/недоступный Valkey возвращают SQL нагрузку. Профили неизменяемы, будущему updateAPI понадобится инвалидация. Смена cache data с корректной схемой не обнаруживается как враждебная подмена — доверие к изолированному Valkey остаётся прежним. 16 рабочих потоков, pool 8, однаБД/host не дают HA. Истёкшие sessionrows отвергаются сразу, физическая очистка операторская по expires_at index.
Три повтора, WSL 2/общийноутбук, блоки baseline→candidate, closed-loop/barrier и ограниченныйp99 не описывают открытуюочередь/все workloads. Ресурсная стоимость Future не измерена. Не проверялись отдельная UbuntuVM, powerloss/OOM/hostloss, backuprestore/трек2, распределённаядедупликация и удалённый CI. Это явно незаявленные условия, не пропуски выбраннойрубрикитрека1. Чистый локальный экспорт с пустыми volumes проверен; отдельный запуск из свежего clone опубликованного коммита `799f56c` не проверялся. Для независимого ревью до публикации был подготовлен ZIP рабочего дерева.
+77
View File
@@ -0,0 +1,77 @@
name: mtusi-lab2
x-api: &api
image: mtusi-lab2-api:local
environment: &api-env
APP_HOST: 0.0.0.0
APP_PORT: 8080
APP_ENV: lab
SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600}
SESSION_STORE: postgres
DATABASE_URL_FILE: /run/secrets/database_url
CACHE_URL_FILE: /run/secrets/cache_url
secrets: [database_url, cache_url]
depends_on:
postgres: {condition: service_healthy}
valkey: {condition: service_healthy}
cpus: 1.0
mem_limit: 512m
restart: unless-stopped
services:
api:
<<: *api
build: .
ports: ["127.0.0.1:${API_PORT:-8080}:8080"]
postgres:
image: postgres:16.8-bookworm
environment:
POSTGRES_USER: messenger
POSTGRES_DB: messenger
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
secrets: [postgres_password]
volumes: [postgres_data:/var/lib/postgresql/data]
healthcheck:
test: [CMD-SHELL, "pg_isready -U messenger -d messenger"]
interval: 2s
timeout: 2s
retries: 20
cpus: 1.0
mem_limit: 512m
restart: unless-stopped
valkey:
image: valkey/valkey:8.0.2-alpine
command: [valkey-server, --appendonly, "yes", --appendfsync, everysec, --maxmemory, 96mb, --maxmemory-policy, allkeys-lru]
volumes: [valkey_data:/data]
healthcheck:
test: [CMD, valkey-cli, ping]
interval: 2s
timeout: 2s
retries: 15
cpus: 0.5
mem_limit: 128m
restart: unless-stopped
api-expiry:
<<: *api
profiles: [test]
environment:
<<: *api-env
SESSION_TTL_SECONDS: 2
restart: "no"
tools:
image: mtusi-lab2-tools:local
profiles: [test]
build: {context: ., dockerfile: infra/Dockerfile.tools}
working_dir: /workspace
volumes:
- .:/workspace
- /var/run/docker.sock:/var/run/docker.sock
environment:
BASE_URL: http://api:8080
cpus: 1.0
mem_limit: 512m
secrets:
postgres_password: {file: ./secrets/postgres_password}
database_url: {file: ./secrets/database_url}
cache_url: {file: ./secrets/cache_url}
volumes:
postgres_data:
valkey_data:
+15
View File
@@ -0,0 +1,15 @@
Date: 2026-10-23, Europe/Moscow
Commands: git branch/status/diff --check/check-ignore/ls-files (read-only); exact local secret scan; HTTP readiness.
PASS: existing branch solution/bvt2301-gamayunov; no Git mutations performed.
PASS: teacher README/COURSE/CONTRIBUTING/contracts/tests/Makefile/examples/templates/original CI unchanged.
PASS: lab1-reference working tree is clean; used for reading only.
PASS: ignored local files: .env, secrets/postgres_password, secrets/database_url, secrets/cache_url
PASS: exact generated PostgreSQL secret and private key markers absent from all tracked/untracked-to-submit files; secrets were not printed.
PASS: git diff --check and own source trailing-whitespace check.
PASS: host http://127.0.0.1:8080/health/ready = 200 application/json; X-Request-Id present.
All grade 3 and 4 criteria: PASS locally (see REPORT.md per-criterion mapping). Remote CI, commit/push/PR: not executed.
PASS: final Compose/application CI YAML, all application/student Python, all shell scripts parse; make check validate repeated after documentation changes.
Main api/postgres/valkey left running; auxiliary api-expiry stopped after tests.
Exact changed-file list: evidence/changed-files.txt. Only REPORT.md modified among tracked skeleton files; new source files are untracked and unstaged.
Release audit supersedes this earlier summary: evidence/release-audit.md; latest source/build/tests: evidence/release/.
+12
View File
@@ -0,0 +1,12 @@
Fresh named volumes mtusi-lab2-bootstrap_postgres_data and mtusi-lab2-bootstrap_valkey_data were created by Compose on 2026-10-23.
Command: API_PORT=18080 docker compose -p mtusi-lab2-bootstrap --env-file .env up -d --wait api
001_initial.sql
0
0
0
python3 tests/smoke.py --base-url "http://api:8080"
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
Linux init-env.sh was also executed twice in /tmp/bootstrap inside an isolated tools container.
Observed secret directory mode=700, secret file mode=444; no credentials were printed.
Bootstrap containers were stopped and removed with compose down; both named volumes were preserved.
+9
View File
@@ -0,0 +1,9 @@
Historical build before release-audit; current code/build proof: evidence/release/build.txt.
Command: docker compose build api; docker compose --profile test up -d --wait api api-expiry
Final running image:
CONTAINER REPOSITORY TAG PLATFORM IMAGE ID SIZE CREATED
mtusi-lab2-api-1 mtusi-lab2-api local linux/amd64 d17dea09ac6a 56.7MB About a minute ago
mtusi-lab2-api-expiry-1 mtusi-lab2-api local linux/amd64 d17dea09ac6a 56.7MB About a minute ago
PASS: running API image equals the current locally built image: sha256:d17dea09ac6adf3ab6e4e9ca0e12286826aba878edd7110e07b1234546a4f713
PASS: SHA-256 of every src/*.py and migrations/*.sql matches the actual running container.
{"migrations/001_initial.sql": "5154c63cca9b5068821e5270b3d8dbc14c542b88ae5ce65422d72874118a14e5", "src/__init__.py": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", "src/cache.py": "0f92c67b59f57a1ac5ee44d99bb5d992efa208e1d3c6fa44e5b537b913be926c", "src/config.py": "7d18c6b03d1130ca633055599f13a002d05a722a86427f2c47700b65908223b5", "src/db.py": "d21da56f3551eef2fb7e930a184264a0731eef8d6eb531929e611f8fa3df4d47", "src/errors.py": "8906150236b7b90081878cd7730964e4dee981897798a37c2a3441c3705cadc0", "src/main.py": "5c36a8dc3fa3dc84c69ebbfee94d1536619ee090da8d5d49931a99bfbd25f436", "src/models.py": "7fa8f35f7fd64e3b7ae6e1c2e4a621cbddb8ed6e4ddf595a71abcb0fe3958863", "src/pagination.py": "bba67fcab7b6ead93c4848319feccecd5e608287f0e983981b04ce0e1ca4b8f3", "src/security.py": "43a8b463e41053fe8ab125570eb7e93bbbbc13e4f5b6599457cbec22c00dc4d6", "src/store.py": "dc8c9512979dba9d54617e27b19beb40ca45972dd8f294263144bb2de716c548"}
+62
View File
@@ -0,0 +1,62 @@
Modified tracked files:
REPORT.md
New files (untracked, not staged):
.gitattributes
.github/workflows/application.yml
Dockerfile
PR_DRAFT.md
compose.yaml
evidence/audit.txt
evidence/bootstrap.txt
evidence/build.txt
evidence/changed-files.txt
evidence/checks.txt
evidence/environment.txt
evidence/expiry.txt
evidence/explain.txt
evidence/failures.txt
evidence/load-resources.txt
evidence/load.json
evidence/migrations.txt
evidence/persistence.txt
evidence/release-audit.md
evidence/release/bootstrap.txt
evidence/release/build.txt
evidence/release/checks.txt
evidence/release/expiry.txt
evidence/release/explain.txt
evidence/release/failures.txt
evidence/release/host-smoke.txt
evidence/release/migrations.txt
evidence/release/persistence.txt
evidence/release/repository.txt
evidence/release/session-persistence.txt
evidence/release/smoke.txt
evidence/release/student.txt
evidence/requirements.md
evidence/schema.txt
evidence/session-persistence.txt
evidence/smoke.txt
evidence/student.txt
infra/Dockerfile.tools
infra/requirements-tools.lock
migrations/001_initial.sql
requirements.lock
requirements.txt
scripts/init-env.ps1
scripts/init-env.sh
scripts/restart.sh
scripts/run-checks.sh
src/__init__.py
src/cache.py
src/config.py
src/db.py
src/errors.py
src/main.py
src/models.py
src/pagination.py
src/security.py
src/store.py
student-tests/README.md
student-tests/grade4.py
student-tests/load_measure.py
+4
View File
@@ -0,0 +1,4 @@
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
python3 scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
+13
View File
@@ -0,0 +1,13 @@
Date: 2026-10-23, Europe/Moscow; local unstaged solution/bvt2301-gamayunov
CPU: Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz; cores=2; logical=4
Host RAM bytes: 17004175360
Docker client=29.5.2 server=29.5.2
Docker Compose version v5.1.3
Docker VM: CPUs=4 RAM bytes=8242409472 OS=Docker Desktop (containerized)
Limits: api 1 CPU / 512MiB; PostgreSQL 1 CPU / 512MiB; Valkey 0.5 CPU / 128MiB; tools 1 CPU / 512MiB. api-expiry: same as api.
Python 3.12.10
uid=10001(appuser) gid=10001(appuser) groups=10001(appuser)
Valkey server v=8.0.2 sha=00000000:0 malloc=jemalloc-5.3.0 bits=64 build=6559adb0eb9ba245
Python 3.12.15
GNU Make 4.4.1
Docker Compose version v2.33.0
+1
View File
@@ -0,0 +1 @@
PASS: SESSION_TTL_SECONDS=2: immediate authentication succeeds; after 2.21s cached profile cannot bypass expiry/logout
+33
View File
@@ -0,0 +1,33 @@
Rows in test chat: 10000
Position: 0
Limit (cost=0.41..10.95 rows=51 width=70) (actual time=0.061..0.085 rows=51 loops=1)
Buffers: shared hit=4
-> Index Scan using messages_history on messages (cost=0.41..2063.98 rows=9985 width=70) (actual time=0.059..0.076 rows=51 loops=1)
Index Cond: (chat_id = '969e1211-e475-4545-bd15-7e56dc71896d'::uuid)
Buffers: shared hit=4
Planning:
Buffers: shared hit=19
Planning Time: 0.220 ms
Execution Time: 0.148 ms
Position: 5000
Limit (cost=0.41..17.20 rows=51 width=70) (actual time=0.013..0.058 rows=51 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_history on messages (cost=0.41..1741.06 rows=5288 width=70) (actual time=0.012..0.050 rows=51 loops=1)
Index Cond: ((chat_id = '969e1211-e475-4545-bd15-7e56dc71896d'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.005001+00'::timestamp with time zone, 'fa66b073-e248-4fb4-9603-7515b64b598e'::uuid)))
Buffers: shared hit=5
Planning Time: 0.107 ms
Execution Time: 0.104 ms
Position: 9900
Limit (cost=0.41..94.31 rows=51 width=70) (actual time=0.017..0.029 rows=51 loops=1)
Buffers: shared hit=4
-> Index Scan using messages_history on messages (cost=0.41..1324.25 rows=719 width=70) (actual time=0.016..0.025 rows=51 loops=1)
Index Cond: ((chat_id = '969e1211-e475-4545-bd15-7e56dc71896d'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009901+00'::timestamp with time zone, 'b484fd5f-6223-4f33-9f32-7d154df937da'::uuid)))
Buffers: shared hit=4
Planning Time: 0.087 ms
Execution Time: 0.046 ms
PostgreSQL: 16.8 (Debian 16.8-1.pgdg120+1)
Durability: on on
PASS: actual EXPLAIN ANALYZE BUFFERS at first/middle/tail; API traversal 10000 rows, 100 pages, 1.851s
+4
View File
@@ -0,0 +1,4 @@
PASS: Valkey stopped: ready=200, authenticated read/write via PG, unknown/missing/revoked=401, outsider=404; scenario 0.374s
PASS: PostgreSQL stopped: ready/auth/write=503, live=200, no credentials=401, no cached authentication; scenario 0.063s
PASS: PostgreSQL recovery 2.811s, same valid token/data survive, revoked token remains revoked, rejected write absent
PASS: all 22 HTTP requests bounded below 4.5s; maximum 0.274s
+58
View File
@@ -0,0 +1,58 @@
# Публикация после независимого ревью
Команды ниже предназначены для PowerShell в основном репозитории. Агент их здесь
не выполнял: staging проверен только в отдельной временной Git-копии с
core.autocrlf=true. PR №97 и удалённые репозитории не изменялись.
```powershell
Set-Location -LiteralPath 'C:\dev\mtusi\lab2'
function Invoke-Git {
& git @args
if ($LASTEXITCODE -ne 0) { throw 'Git command failed; publication stopped.' }
}
$branch = Invoke-Git branch --show-current
if ($branch -ne 'solution/bvt2301-gamayunov') { throw 'Unexpected branch.' }
if (@(Invoke-Git diff --cached --name-only).Count -ne 0) {
throw 'Index already contains changes. Review them before selective staging.'
}
Invoke-Git status --short --branch
Invoke-Git -c core.autocrlf=true add -- .gitattributes .gitignore REPORT.md src/cache.py src/pagination.py src/store.py student-tests/grade5 evidence/grade5
Invoke-Git -c core.autocrlf=true add --chmod=+x -- scripts/init-env.sh scripts/restart.sh scripts/run-checks.sh
Invoke-Git -c 'core.whitespace=blank-at-eol,blank-at-eof,space-before-tab' diff --cached --check
$staged = @(Invoke-Git diff --cached --name-only)
$allowed = @('.gitattributes', '.gitignore', 'REPORT.md', 'src/cache.py', 'src/pagination.py', 'src/store.py', 'scripts/init-env.sh', 'scripts/restart.sh', 'scripts/run-checks.sh')
$unexpected = @($staged | Where-Object { $_ -notin $allowed -and $_ -notmatch '^(student-tests|evidence)/grade5/' })
$forbidden = @($staged | Where-Object { $_ -match '(^|/)(secrets|\.env(?:\.[^/]*)?|\.grade5-work|cache|volumes|PR_GRADE5_DRAFT\.md)(/|$)' -or ($_ -match '\.zip$' -and $_ -ne 'evidence/grade5/baseline-source.zip') })
if ($unexpected.Count -or $forbidden.Count) {
$unexpected; $forbidden
throw 'Unexpected staged files. Stop and inspect the index.'
}
$modes = @(Invoke-Git ls-files --stage -- scripts/init-env.sh scripts/restart.sh scripts/run-checks.sh)
if ($modes.Count -ne 3 -or @($modes | Where-Object { $_ -notmatch '^100755 ' }).Count) {
throw 'Expected three shell scripts with mode 100755.'
}
$staged
$modes
Invoke-Git diff --cached --stat
# Прочитать staged diff перед двумя следующими командами публикации.
Invoke-Git diff --cached -- REPORT.md src/cache.py src/pagination.py src/store.py
Invoke-Git commit -m 'ЛР 2: исследовать и ограничить cache stampede — на 5'
Invoke-Git push origin solution/bvt2301-gamayunov
```
Не использовать `git add .` или `git add --renormalize .`: преподавательские файлы,
старые evidence и рабочие CRLF не относятся к этому изменению. Новый текстовый
набор evidence/grade5 имеет LF и не содержит trailing spaces/пустых строк в конце.
Raw сохранены побайтно (`-text`, без eol-преобразования, `whitespace=cr-at-eol`);
baseline-source.zip остаётся бинарным. Общие whitespace checks не отключаются.
PR_GRADE5_DRAFT.md — игнорируемый локальный текст для последующей ручной замены
описания существующего PR №97, а не файл коммита. REPORT.md больше не ссылается
на этот локальный draft. Удалённый PR обновляется отдельно после публикации;
новый PR, force, rebase и изменение origin не нужны.
Результаты завершающей проверки: publication-audit.json и publication-checks.txt.
review-inventory.json/review-archive.json описывают прежний review ZIP до этой
публикационной полировки; changed-files.txt/git-final-status.txt также исторические.
Актуальный состав staging записан в publication-audit.json. Старые файлы не являются
manifest текущего коммита.
+110
View File
@@ -0,0 +1,110 @@
# Воспроизведение трека 1 (ЛР2), 25.10.2026 Europe/Moscow
Основные результаты: [REPORT](../../REPORT.md), [таблица median/min/max](results.md),
[SQL и latency SVG](comparison.svg), [аудит](audit.md), [provenance](provenance.md).
Первичная рубрика — README/COURSE/contracts этой ЛР2. Исторические evidence уровня4
не изменены. Удалённый PR 97 не редактировался.
## Пересчёт без Docker
```sh
python evidence/grade5/aggregate.py
python evidence/grade5/audit.py --offline
```
aggregate.py использует только raw/baseline и raw/candidate. Каждый содержит CSV
с latency/status/error каждого HTTP-запроса, JSON с измеренными SQL-дельтами каждой
волны и metadata. runs.csv — все 18 повторов (3 режима x 3 повтора x 2 версии),
comparison.json/results.md — median/min/max, comparison.svg — график из тех же данных.
Неудачная попытка, пилоты и предыдущий candidate исключены, причины сохранены.
На исходной машине `python evidence/grade5/audit.py` с Docker дополнительно сверяет уже собранные образы/контейнеры; без Docker
доступна проверка raw и исходников (см. --help).
## Полный новый эксперимент
Из корня репозитория, Docker Desktop Linux containers / Docker Engine + Compose,
Python 3.9+ на host, без установки Python-пакетов на host:
```powershell
py -3.14 evidence/grade5/reproduce.py
# Linux: python3 evidence/grade5/reproduce.py
```
Можно выбрать `--version baseline` или `--version candidate`. Скрипт создаёт новые
копии только внутри .grade5-work/replay-<timestamp-random>/, новые случайные file
secrets и новые уникальные Compose projects/volumes. Baseline берётся из сохранённого
baseline-source.zip, candidate — из текущих src/Dockerfile/requirements/migrations.
Не читает реальные credentials стенда, не обращается к host-порту8080, не изменяет
Git и исходный mtusi-lab 2. Valkey/PG портов на host не публикуют. Безопасный stop
в finally оставляет свои volumes/контейнеры для осмотра; ничего не удаляет.
Скрипт не переписывает опубликованные raw evidence: свежие raw остаются рядом с
новой копией. На текущем ноутбуке сами серии заняли baseline56.084s/candidate41.205s;
сборки, запуск и копирование добавляют обычно 1–3 минуты при прогретых Docker layers.
Первое скачивание образов/пакетов зависит от сети и может занять больше времени.
Удаление только своих ненужных тестовых данных — сознательное действие оператора:
из summary.json взять точное уникальное project name и directory, затем
`docker compose -p <этот-project> --project-directory <эта-directory> -f <эта-directory>/research.yaml down --volumes`.
Не использовать prune, общий FLUSH, имена основного стенда или чужие volumes.
Контейнер measure имеет явное имя `<project>-measure`, его также можно отдельно
удалить после копирования raw. Агент volumes не удалял.
## Методика (заранее зафиксирована в plan.json)
16 клиентов x 32 волны x 3 режима x 3 повтора =4608 GET me/версию; один валидный
Bearer-user, пользователь синтетический. Перед фазами создаются user/session,
профиль прогревается, открываются16HTTP/1.1 keep-alive connections через health/live.
Перед каждой холодной волной DEL строго собственного profile:UUID. Тёплый режим
предварительно читает me. Нагрузочные запросы стартуют по barrier в генераторе,
каждый клиент отправляет ровно один запрос/волну; retries нет. Следующая волна
начинается после всех ответов. Каждый успешный JSON сравнивается с публичным User.
Cold — без задержек; contended — observer держит ACCESS EXCLUSIVE lock на users
примерно100 ms; warm — ключ существует. Блокировка не меняет API/SQL-код и явно
добавляет задержку БД в contended latency. pg_stat_activity фиксирует число ждущих.
Порядок режимов вращается по repeat; все baseline раньше всех candidate.
pg_stat_statements включён shared_preload_libraries в отдельном PG 16.8.
Snapshot до/после каждой волны фильтруется по app-role messenger и текущей БД.
Counter/lock SQL идут под другим g 5 observer и не попадают в appSQL. Query text
нормализован, содержит placeholders, без токенов/паролей. profile SELECT и session
SELECT классифицированы раздельно; all_sql включает BEGIN/COMMIT и случайно попавший
в окно healthSELECT 1. Это не число SELECT, выведенное из HTTP-ответов. Успешный
SQL профиля соответствует реальной загрузке PostgreSQL; подробные deltas сохранены.
Clock — monotonic; latency включает отправку, полное тело и проверку JSON.
RPS=успешные HTTP/sum(wave elapsed); подготовка/сброс/SQL snapshots вне знаменателя.
Это burst goodput, НЕ длительная производительность сервера и не maxRPS. Percentiles
nearest-rank успешных запросов каждого повтора; 512 наблюдений дают лишь около5
верхних наблюдений p99. Median повторов не равна pooled percentile. 4xx/5xx/timeouts
считаются отдельно, а не исключаются молча. 3 повтора и общий ноутбук дают шум.
pg_stat_statements добавляет накладные расходы и память на каждый SQL; абсолютные
latency включают инструментовку. Её цена отдельно не измерена и не вычтена.
Snapshot вне HTTP-таймера, но нагрузка observer/lock и host всё равно может влиять.
Нельзя обещать такую же latency без инструментовки или в production. Настройки
одинаковы до/после: API1CPU/512MiB/без extra swap/1process/16threads/PGpool1..8;
PG1CPU/512MiB, Valkey0.5CPU/128MiB, driver1CPU/512MiB. Версии образов/ID/digest,
hostCPU и DockerVM записаны в images-*.txt, host-cpu.json, docker-environment.json.
Ресурсные samples предыдущих попыток — только диагностика, не сравнение CPU/памяти.
## Проверки корректности
Полный Linux-набор: student-tests/grade5/run-public.sh (check/validate/test,
core/expiry/migrations/explain/failures, test-persistence с scripts/restart.sh,
persistence_meta). Запуск выполнялся tools-контейнером именно своего project;
лог/команды — final-public-run.txt, checks/*.txt. После него отдельно:
```sh
# В своём research project, API-процессы api/api-peer/api-expiry запущены:
# driver запускается как one-off api image, /workspace = read-only корень проекта
python student-tests/grade5/test_singleflight.py
python student-tests/grade5/integration.py
# tools с Docker socket, только свой project:
python student-tests/grade5/faults.py
```
Точные host-команды и clean build указаны в commands.md. Без running research stack
integration/faults запускать нельзя; они создают только синтетические данные,
меняют только свои profile-ключи и останавливают Valkey только выбранного project.
Проверки не следует запускать на production. tools — операторский доверенный
контейнер с Docker socket; обычный API его не получает.
+67
View File
@@ -0,0 +1,67 @@
#!/usr/bin/env python3
"""Recompute every table/plot from immutable request/burst observations; stdlib only."""
import csv, json, math, statistics
from collections import Counter
from pathlib import Path
ROOT=Path(__file__).resolve().parent
def quantile(v,p):
return sorted(v)[max(0,math.ceil(len(v)*p)-1)] if v else None
def aggregate():
runs=[]
for version in ['baseline','candidate']:
directory=ROOT/'raw'/version
if not (directory/'meta.json').exists(): continue
rows=list(csv.DictReader((directory/'requests.csv').open()))
bursts=json.loads((directory/'bursts.json').read_text())
for mode in ['cold','contended','warm']:
for repeat in range(1,4):
group=[r for r in rows if r['mode']==mode and int(r['repeat'])==repeat]
phases=[b for b in bursts if b['mode']==mode and b['repeat']==repeat]
good=[float(r['latency_ms']) for r in group if r['status']=='200' and not r['error']]
elapsed=sum(b['elapsed_s'] for b in phases)
counts={k:sum(b['counts'][k] for b in phases) for k in phases[0]['counts']}
# Every single SQL call comes from a real PG counter, independent of HTTP status.
assert all(b['all_sql']==sum(q['calls'] for q in b['queries']) for b in phases)
runs.append(dict(version=version,mode=mode,repeat=repeat,requests=len(group),ok=len(good),errors=len(group)-len(good),http_4xx=sum(400<=int(r['status'])<500 for r in group),http_5xx=sum(500<=int(r['status'])<600 for r in group),timeouts=sum('Timeout' in r['error'] for r in group),elapsed_s=elapsed,rps=len(good)/elapsed,p50_ms=quantile(good,.5),p95_ms=quantile(good,.95),p99_ms=quantile(good,.99),all_sql=sum(b['all_sql'] for b in phases),**counts))
if not runs: return
with (ROOT/'runs.csv').open('w',newline='') as f:
w=csv.DictWriter(f,fieldnames=list(runs[0]));w.writeheader();w.writerows(runs)
comparison=[]
for mode in ['cold','contended','warm']:
for metric in ['profile_select','session_select','all_sql','rps','p50_ms','p95_ms','p99_ms','errors']:
entry={'mode':mode,'metric':metric}
for version in ['baseline','candidate']:
values=[r[metric] for r in runs if r['mode']==mode and r['version']==version]
if values: entry[version]={'median':statistics.median(values),'min':min(values),'max':max(values),'total':sum(values)}
comparison.append(entry)
(ROOT/'comparison.json').write_text(json.dumps(comparison,indent=2))
lines=['| Mode | Metric | Baseline median [min,max] | Candidate median [min,max] |','|---|---|---:|---:|']
for item in comparison:
cells=[]
for version in ['baseline','candidate']:
v=item.get(version); cells.append(f"{v['median']:.3f} [{v['min']:.3f}, {v['max']:.3f}]" if v else '-')
lines.append(f"| {item['mode']} | {item['metric']} | {' | '.join(cells)} |")
(ROOT/'results.md').write_text('\n'.join(lines)+'\n')
# Portable SVG, no binary/runtime dependencies. Baseline/candidate and min/max per repeat.
svg=['<svg xmlns="http://www.w3.org/2000/svg" width="1100" height="570" viewBox="0 0 1100 570"><rect width="1100" height="570" fill="white"/><style>text{font:14px sans-serif;fill:#172033}</style><text x="30" y="30" style="font-size:22px">Cache stampede: medians of 3 repeats; whiskers = min/max</text>']
for col,metric in enumerate(['profile_select','p95_ms']):
x0=50+col*550; maximum=max((i[v]['max'] for i in comparison if i['metric']==metric for v in ['baseline','candidate'] if v in i),default=1)*1.12
svg.append(f'<text x="{x0}" y="65">{metric} per repeat (512 HTTP requests)</text>')
for tick in range(5):
val=maximum*tick/4;y=440-val/maximum*330
svg.append(f'<path d="M{x0} {y}h460" stroke="#ddd"/><text x="{x0}" y="{y-4}">{val:.1f}</text>')
for pos,mode in enumerate(['cold','contended','warm']):
item=next(i for i in comparison if i['mode']==mode and i['metric']==metric)
for j,v in enumerate(['baseline','candidate']):
if v not in item:continue
value=item[v];x=x0+50+pos*150+j*42;h=value['median']/maximum*330;y=440-h
svg.append(f'<rect x="{x}" y="{y}" width="32" height="{h}" fill="{["#e47b43","#2a8990"][j]}"/>')
low=440-value['min']/maximum*330;high=440-value['max']/maximum*330
svg.append(f'<path d="M{x+16} {low}V{high}m-6 0h12M{x+10} {low}h12" stroke="#172033" fill="none"/><text x="{x-4}" y="{high-8}">{value["median"]:.1f}</text>')
svg.append(f'<text x="{x0+45+pos*150}" y="465">{mode}</text>')
svg.append('<rect x="80" y="500" width="15" height="15" fill="#e47b43"/><text x="100" y="513">baseline</text><rect x="220" y="500" width="15" height="15" fill="#2a8990"/><text x="240" y="513">candidate</text><text x="50" y="548">Contended: observer locks users for ~100 ms; latency includes this controlled delay. No max-RPS claim.</text></svg>')
(ROOT/'comparison.svg').write_text('\n'.join(svg))
print('\n'.join(lines))
if __name__=='__main__': aggregate()
+100
View File
@@ -0,0 +1,100 @@
{
"checks": {
"baseline_raw": "PASS",
"candidate_raw": "PASS",
"baseline_archive_matches_initial_snapshot": "PASS",
"teacher_files_unchanged": "PASS",
"historical_grade4_evidence_unchanged": "PASS",
"syntax_and_shell_lf": "PASS",
"configured_private_values_absent": "PASS",
"final_and_clean_image_bytes_match_working_source": "PASS"
},
"details": {
"baseline": {
"requests": 4608,
"profile_select": 2994,
"session_select": 4608,
"all_sql": 22836
},
"candidate": {
"requests": 4608,
"profile_select": 192,
"session_select": 4608,
"all_sql": 14418
},
"teacher_files": [
"README.md",
"COURSE.md",
"CONTRIBUTING.md",
"Makefile",
"contracts/examples.json",
"contracts/infrastructure.json",
"contracts/openapi.json",
"contracts/README.md",
"tests/client.py",
"tests/load.py",
"tests/README.md",
"tests/resilience.py",
"tests/smoke.py",
".github/pull_request_template.md"
],
"historical_files_count": 33,
"scanned_files": 197,
"sources": {
"src/__init__.py": {
"working_sha256": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"lf_sha256": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"
},
"src/cache.py": {
"working_sha256": "c4cf175579c0f79ea1d512fbd38e9fdb25aace8359729189051dfcbafcd1f557",
"lf_sha256": "c4cf175579c0f79ea1d512fbd38e9fdb25aace8359729189051dfcbafcd1f557"
},
"src/config.py": {
"working_sha256": "7d18c6b03d1130ca633055599f13a002d05a722a86427f2c47700b65908223b5",
"lf_sha256": "7d18c6b03d1130ca633055599f13a002d05a722a86427f2c47700b65908223b5"
},
"src/db.py": {
"working_sha256": "d21da56f3551eef2fb7e930a184264a0731eef8d6eb531929e611f8fa3df4d47",
"lf_sha256": "d21da56f3551eef2fb7e930a184264a0731eef8d6eb531929e611f8fa3df4d47"
},
"src/errors.py": {
"working_sha256": "d34144c2b84b1b0fd15e0da574fe1ff6047d3af3cb3faeacbb1e385f221f46b6",
"lf_sha256": "d34144c2b84b1b0fd15e0da574fe1ff6047d3af3cb3faeacbb1e385f221f46b6"
},
"src/main.py": {
"working_sha256": "5c36a8dc3fa3dc84c69ebbfee94d1536619ee090da8d5d49931a99bfbd25f436",
"lf_sha256": "5c36a8dc3fa3dc84c69ebbfee94d1536619ee090da8d5d49931a99bfbd25f436"
},
"src/models.py": {
"working_sha256": "ce2e14686881f764e00e602a3cb63253cedf698583d3f059b1afd76e4fd94a94",
"lf_sha256": "ce2e14686881f764e00e602a3cb63253cedf698583d3f059b1afd76e4fd94a94"
},
"src/pagination.py": {
"working_sha256": "78baa3549a7e944cdba0f27422f81560544144799a8eb37c8962fa1aa23e80c0",
"lf_sha256": "78baa3549a7e944cdba0f27422f81560544144799a8eb37c8962fa1aa23e80c0"
},
"src/security.py": {
"working_sha256": "43a8b463e41053fe8ab125570eb7e93bbbbc13e4f5b6599457cbec22c00dc4d6",
"lf_sha256": "43a8b463e41053fe8ab125570eb7e93bbbbc13e4f5b6599457cbec22c00dc4d6"
},
"src/store.py": {
"working_sha256": "4834c8c78efa6b60ff681d4e75f5f8f43627ccd0c5b7bd28c061d6262b7d28c5",
"lf_sha256": "4834c8c78efa6b60ff681d4e75f5f8f43627ccd0c5b7bd28c061d6262b7d28c5"
}
},
"images": {
"lab2-g5-20261025-final-api-1": {
"image": "sha256:0bed5b677a58a94af1d5adb000f667310242521eac8377202d1ff35634e1c3f8",
"cpu_nanos": 1000000000,
"memory": 536870912,
"memory_swap": 536870912
},
"lab2-g5-20261025-clean-api-1": {
"image": "sha256:345a85414a671b5ad0a154d5b726f71744796937db95d2406eedd7cb107ab2e9",
"cpu_nanos": 1000000000,
"memory": 536870912,
"memory_swap": 536870912
}
}
}
}
+72
View File
@@ -0,0 +1,72 @@
# Независимый release-audit — 25.10.2026 Europe/Moscow
Вердикт: **READY FOR GRADE 5 REVIEW**. Рубрика сверена заново с оригинальным README
ЛР2 и семантикой contracts; одного старого PASS или успешного smoke недостаточно.
Проверки окончательной версии повторены после исправления обнаруженной ошибки
кодировки, а затем из отдельной чистой копии исходного Compose с новыми volumes.
| Пункт оригинальной рубрики | Основание | Статус |
|---|---|---|
|3.1 Минимум ЛР1; данные/сессии переживают restart|smoke/core + persistence + unchanged expires_at;StartedAt всех трёх сервисов меняются|PASS|
|3.2 PostgreSQL/PK/FK/UNIQUE/migrations0/atomic chat|clean-bootstrap0users/chats/messages;001;реальный FK rollback после parent INSERT; migrations повторены|PASS|
|3.3 Basic только login;Bearer/TTL/logout/X-User-Id/KDF|core/expiry/integration/faults;Argon2id Unicode 128 codepoints;PGtokenhash 32 bytes;cache неавторизует|PASS|
|3.4 make test/persistence;повтор migrations;secrets/volumes вне Git|все цели через Linux tools final+clean; audit secret/ZIP scan;shLF и HEAD 100755|PASS|
|4.1 РеальныйValkey/TTL/истина/восстановление|core hit/TTL/no sliding;loss/realstopstart/refill;истина PG|PASS|
|4.2 ПараметрыSQL/limitedpool/timeouts/username race/rollback|неизменённый db.py;1×201+11×409;FKrollback;boundedfaultHTTP|PASS|
|4.3 EXPLAIN >=10000/no full scan|3 IndexScan using messages_history;51 строка;100 HTTP страниц|PASS|
|4.4 Auto expiry/logout/wrong password/cache+DB outage|final/clean failures;PGdown→503 даже warmcache;anon 401;cachefallback;expired/revoked401|PASS|
|5 трек1: конкурентный stampede ДО|реальные HTTP+PG counters;baseline сохранён ДО src edit;все3 cold повтора имеют повторные profileSELECT|PASS|
|5 трек1: защита и SQL/latency comparison|sameplan/client/counters;candidate1profileSELECT/wave;sessionSQL сохранены;latency+errors+min/max+raw|PASS|
|5 трек1: RAW и cache recovery|чаты/списки/сообщения немедленно черездругойпроцесс;loss/restartrefillиз PG;public persistence|PASS|
|5: hypothesis/repro/results/limits/cost|REPORT+plan/reproduce/aggregate;warm p99 regression;local scope/timeouts;CPUoverhead неизмерен|PASS|
Проверяемые артефакты:
- checks/checks.txt: make check validate. checks/smoke.txt: make test.
- checks/core.txt: собственный grade 4.py core целиком.
- checks/expiry.txt: отдельный API SESSION_TTL_SECONDS=2.
- checks/migrations.txt: два повтора, counts и expiry fingerprints без изменений.
- checks/explain.txt:10000rows,3 EXPLAIN ANALYZE BUFFERS,100 HTTPpages.
- checks/failures.txt:реальныеstop/startValkey/PG;22 boundedHTTP,max 0.451 s;PGrecovery 2.083 s.
- checks/persistence.txt: make test-persistence ACTION_SCRIPT=scripts/restart.sh,
реальные StartedAt до/после; session-persistence.txt: неизменный абсолютный expiry.
- clean-checks/: тот же полный набор на отдельном build --no-cache и пустой БД.
- checks/unit.txt:5 tests (coalescing, independent keys, leaderexception/cleanup,
timeout/fallback, registrylimit), все PASS.
- checks/cache-integration.txt:10corruptvalues/cold/warm/realexpiry, UUID/cursor/
outsider precedence, RAW 2 process, revoked/expiredstates,2 process→2 SQL,
slowleader 1.2 s→8SQL/maxHTTP1.232s.
- checks/cache-recovery.txt:cache loss+restart+refillTTL 60;expiry/logoutwhilecache down;
marker/password/token/Argon2hash absence inAPI/PG/Valkeylogs;HTTP неотражает payload.
- audit.json: raw invariants, реальные2994→192profileSQL/4608→4608 sessionSQL,
teacherfiles и33 historicalevidence неизменны; source bytes final/clean=workingtree;
секретные значения в передаваемых файлах отсутствуют.
## Замечания, обнаруженные и закрытые аудитом
1. UUID URN из cursor раньше валидировался PythonUUID, но передавался PG без
нормализации. Теперь canonical UUID до SQL; реальный HTTPtest urn/upper/hexPASS.
2. Чужой чат с malformedcursor раньше давал400 до проверки доступа; теперь404,
как в актуальной собственной ЛР1 и нормативном access-first; testPASS.
3. CacheJSON с правильными именами полей, но неверными типами мог привести к500.
Теперь валидация miss/refill,10 реальных corruption сценариев PASS.
4. Baseline bind-mount rawwrite failure сохранён, серия повторена до изменения src.
5. Ошибка locale WindowsPython исказила часть русских сообщений при первой записи
двухфайлов; восстановлены исходные строки, выбран finalimage и полностью повторены
benchmark+public/grade4+integration. Interimraw сохранён, в агрегатах не используется.
6. Финальный warm p99 +5.0% и fallback SQL duplication признаны, не скрыты.
## НЕ ПРОВЕРЕНО / НЕ ЗАЯВЛЕНО
Отдельная UbuntuVM/новыйremoteclone/remoteCI; powerloss/OOM/hostloss; HA и backuprestore
(трек2); distributed single-flight; количественнаяCPU/RAMстоимость. Это не обязательные
условия выбранного трека1. Защита локальна процессу, limitedwait намеренно допускает
SQL дублирование. Sharedhost/blockorder/3repeats/512samples дают ограничения измеренияp99.
Не осталось недоказанного обязательного пункта уровней3/4/выбранноготрека5.
Архив текущего дерева включает незакоммиченные исходники, REPORT, PRdraft, сценарии и
необходимые raw; исключает .git/.env/secrets/cache/volumes/.grade5-work/.venv.
Проверка manifest и SHA описаны в review-archive.json. Режимы трёх shell scripts в ZIP 0755;
в HEAD уже100755, содержание LF. Gitindex/ветка/origin/history/PR не изменялись.
Измеренные рабочие src содержат исходные CRLF в неизменённых файлах; audit.json содержит
workingSHA и LF-SHA для объяснения будущей Git нормализации. Raw защищён атрибутом-text.
+95
View File
@@ -0,0 +1,95 @@
#!/usr/bin/env python3
"""Independent local audit. Never mutates Git or Docker. --offline skips image inspection."""
import argparse, ast, csv, hashlib, io, json, subprocess, tarfile, zipfile
from pathlib import Path
ROOT=Path(__file__).resolve().parents[2]; E=ROOT/'evidence/grade5'
def digest(data):return hashlib.sha256(data).hexdigest()
def run(*args):return subprocess.run(args,cwd=ROOT,check=True,capture_output=True).stdout
def main():
p=argparse.ArgumentParser();p.add_argument('--offline',action='store_true');a=p.parse_args();checks={};details={}
for version in ['baseline','candidate']:
folder=E/'raw'/version;rows=list(csv.DictReader((folder/'requests.csv').open(encoding='utf-8')));bursts=json.loads((folder/'bursts.json').read_text(encoding='utf-8'));meta=json.loads((folder/'meta.json').read_text(encoding='utf-8'))
assert len(rows)==4608 and len(bursts)==288
assert all(r['status']=='200' and not r['error'] for r in rows)
assert all(b['counts']['session_select']==16 for b in bursts)
assert all(b['all_sql']==sum(q['calls'] for q in b['queries'])==sum(b['counts'].values()) for b in bursts)
assert all(q['calls']>0 and q['exec_ms']>=0 for b in bursts for q in b['queries'])
if version=='baseline':assert all(any(b['counts']['profile_select']>1 for b in bursts if b['repeat']==r and b['mode']=='cold') for r in [1,2,3])
else:
assert all(b['counts']['profile_select']==(0 if b['mode']=='warm' else 1) for b in bursts)
frozen=json.loads((E/'source-fingerprint.json').read_text(encoding='utf-8'))
assert meta['app_src_sha256']=={Path(name).name:v['working_sha256'] for name,v in frozen.items() if name.startswith('src/')}
for name,v in frozen.items():
assert digest((ROOT/name).read_bytes().replace(b'\r\n',b'\n'))==v['lf_sha256'], name
checks[version+'_raw']='PASS'
details[version]={'requests':len(rows),'profile_select':sum(b['counts']['profile_select'] for b in bursts),'session_select':sum(b['counts']['session_select'] for b in bursts),'all_sql':sum(b['all_sql'] for b in bursts)}
original=json.loads((E/'baseline-source.json').read_text(encoding='utf-8'))['sha256']
with zipfile.ZipFile(E/'baseline-source.zip') as archive:
for name,sha in original.items():assert digest(archive.read(name))==sha,name
assert not any('.git' in Path(n).parts or 'secrets' in Path(n).parts or Path(n).name=='.env' for n in archive.namelist())
checks['baseline_archive_matches_initial_snapshot']='PASS'
teacher=['README.md','COURSE.md','CONTRIBUTING.md','Makefile','contracts','tests','.github/pull_request_template.md']
verified=[]
for entry in teacher:
path=ROOT/entry
for file in ([path] if path.is_file() else sorted(path.rglob('*'))):
if not file.is_file() or '__pycache__' in file.parts:continue
name=file.relative_to(ROOT).as_posix();old=run('git','show','HEAD:'+name)
assert file.read_bytes().replace(b'\r\n',b'\n')==old.replace(b'\r\n',b'\n'),name
verified.append(name)
checks['teacher_files_unchanged']='PASS';details['teacher_files']=verified
history=[]
for f in sorted((ROOT/'evidence').rglob('*')):
if not f.is_file() or 'grade5' in f.parts:continue
name=f.relative_to(ROOT).as_posix();old=run('git','show','HEAD:'+name)
assert f.read_bytes().replace(b'\r\n',b'\n')==old.replace(b'\r\n',b'\n'),name
history.append(name)
checks['historical_grade4_evidence_unchanged']='PASS';details['historical_files_count']=len(history)
for f in list((ROOT/'src').glob('*.py'))+list((ROOT/'student-tests/grade5').glob('*.py'))+list(E.glob('*.py')):ast.parse(f.read_text(encoding='utf-8-sig'))
for name in ['init-env.sh','restart.sh','run-checks.sh']:
content=(ROOT/'scripts'/name).read_bytes();assert b'\r' not in content and content.startswith(b'#!/bin/sh\n')
checks['syntax_and_shell_lf']='PASS'
# Real configured private values are read locally, never printed or persisted.
secret_values=[]
for directory in [ROOT/'secrets',*(ROOT/'.grade5-work').glob('*/secrets')]:
if directory.exists():
for f in directory.iterdir():
if f.is_file():
value=f.read_bytes().strip()
if len(value)>=24:secret_values.append(value)
excluded={'.git','.grade5-work','secrets','.env','.venv','__pycache__','cache','volumes','node_modules'}
scanned=0
def scan(content,label):
assert not any(s in content for s in secret_values),'Private value detected in '+label
for f in ROOT.rglob('*'):
if not f.is_file() or any(x in excluded for x in f.relative_to(ROOT).parts) or f.name.startswith('review-grade5') or f.suffix in ['.pyc']:continue
if f.suffix=='.zip':
with zipfile.ZipFile(f) as archive:
for n in archive.namelist():scan(archive.read(n),f.name+':'+n)
else:scan(f.read_bytes(),f.relative_to(ROOT).as_posix())
scanned+=1
checks['configured_private_values_absent']='PASS';details['scanned_files']=scanned
details['sources']={f.relative_to(ROOT).as_posix():{'working_sha256':digest(f.read_bytes()),'lf_sha256':digest(f.read_bytes().replace(b'\r\n',b'\n'))} for f in sorted((ROOT/'src').glob('*.py'))}
if not a.offline:
containers=['lab2-g5-20261025-final-api-1','lab2-g5-20261025-clean-api-1']
details['images']={}
expected={Path(name).name:v['working_sha256'] for name,v in frozen.items() if name.startswith('src/')}
for container in containers:
with tarfile.open(fileobj=io.BytesIO(run('docker','cp',container+':/app/src/.','-')),mode='r:*') as archive:
actual={Path(m.name).name:digest(archive.extractfile(m).read()) for m in archive.getmembers() if m.isfile() and m.name.endswith('.py') and '__pycache__' not in m.name}
assert actual==expected,container
obj=json.loads(run('docker','inspect',container))[0]
details['images'][container]={'image':obj['Image'],'cpu_nanos':obj['HostConfig']['NanoCpus'],'memory':obj['HostConfig']['Memory'],'memory_swap':obj['HostConfig']['MemorySwap']}
checks['final_and_clean_image_bytes_match_working_source']='PASS'
result={'checks':checks,'details':details}
(E/'audit.json').write_text(json.dumps(result,indent=2),encoding='utf-8')
rawfiles=sorted((E/'raw').rglob('*'))
manifest=''.join(digest(f.read_bytes())+' '+f.relative_to(E).as_posix()+'\n' for f in rawfiles if f.is_file())
manifest_path=E/'raw-sha256.txt'
if manifest_path.exists():
assert manifest_path.read_text(encoding='utf-8')==manifest, 'Raw SHA-256 manifest mismatch'
else:
manifest_path.write_text(manifest,encoding='utf-8')
print(json.dumps(checks,indent=2));print(json.dumps(details['baseline']));print(json.dumps(details['candidate']))
if __name__=='__main__':main()
+109
View File
@@ -0,0 +1,109 @@
Image lab2-g5-20261025:tools Building
Image lab2-g5-20261025:baseline Building
#1 [internal] load local bake definitions
#1 reading from stdin 1.05kB 0.1s done
#1 DONE 0.1s
#2 [api internal] load build definition from Dockerfile
#2 transferring dockerfile: 30B 0.1s
#2 transferring dockerfile: 743B 0.3s done
#2 DONE 0.6s
#3 [tools internal] load build definition from Dockerfile.tools
#3 transferring dockerfile: 378B 0.1s done
#3 DONE 0.7s
#4 [api internal] load metadata for docker.io/library/python:3.12.10-slim-bookworm
#4 DONE 1.8s
#5 [tools internal] load metadata for docker.io/library/docker:27.5.1-cli
#5 DONE 1.9s
#6 [api internal] load .dockerignore
#6 transferring context: 216B 0.0s done
#6 DONE 0.1s
#7 [tools internal] load build context
#7 DONE 0.0s
#8 [api internal] load build context
#8 transferring context: 25.20kB 0.1s done
#8 DONE 0.1s
#9 [api 1/6] FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db
#9 resolve docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db
#9 resolve docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db 0.2s done
#9 DONE 0.2s
#10 [tools 1/5] FROM docker.io/library/docker:27.5.1-cli@sha256:851f91d241214e7c6db86513b270d58776379aacc5eb9c4a87e5b47115e3065c
#10 resolve docker.io/library/docker:27.5.1-cli@sha256:851f91d241214e7c6db86513b270d58776379aacc5eb9c4a87e5b47115e3065c 0.2s done
#10 DONE 0.2s
#11 [api 2/6] WORKDIR /app
#11 CACHED
#12 [api 3/6] COPY requirements.txt requirements.lock ./
#12 CACHED
#13 [api 4/6] RUN pip install --no-cache-dir -r requirements.lock && useradd --create-home --uid 10001 appuser
#13 CACHED
#7 [tools internal] load build context
#7 transferring context: 506B 0.0s done
#7 DONE 0.2s
#14 [tools 2/5] RUN apk add --no-cache python3 py3-pip make && python3 -m venv /opt/venv
#14 CACHED
#15 [tools 3/5] WORKDIR /workspace
#15 CACHED
#16 [tools 4/5] COPY infra/requirements-tools.lock /tmp/requirements-tools.lock
#16 CACHED
#17 [tools 5/5] RUN pip install --no-cache-dir -r /tmp/requirements-tools.lock
#17 CACHED
#18 [api 5/6] COPY --chown=appuser:appuser src ./src
#18 DONE 0.3s
#19 [tools] exporting to image
#19 exporting layers 0.0s done
#19 exporting manifest sha256:2c5c05dc094e49ced6a16605a33b0ac015305c43fc65063fde67d288e2367566 0.1s done
#19 exporting config sha256:07ab69e37453b0d2e966b1d0775de0de63bde1dccf14426de7ca59905d57f1f5
#19 exporting config sha256:07ab69e37453b0d2e966b1d0775de0de63bde1dccf14426de7ca59905d57f1f5 0.0s done
#19 exporting attestation manifest sha256:235642f80e8acc562b9580dd3dcd32c7edc27815709d781eabe20870a6b7426c
#19 ...
#20 [api 6/6] COPY --chown=appuser:appuser migrations ./migrations
#20 DONE 0.3s
#19 [tools] exporting to image
#19 exporting attestation manifest sha256:235642f80e8acc562b9580dd3dcd32c7edc27815709d781eabe20870a6b7426c 0.1s done
#19 exporting manifest list sha256:e2a5288bf0a21581a1587866539a7f8aff98a927af4fc2c96f11cd7716392707
#19 exporting manifest list sha256:e2a5288bf0a21581a1587866539a7f8aff98a927af4fc2c96f11cd7716392707 0.1s done
#19 naming to docker.io/library/lab2-g5-20261025:tools 0.0s done
#19 unpacking to docker.io/library/lab2-g5-20261025:tools
#19 ...
#21 [api] exporting to image
#21 exporting layers 0.4s done
#21 exporting manifest sha256:94169cf2cc602eb4c7702e5732c5cfcee20c1b7966f9e5522eac5270ca4e4d61 0.1s done
#21 exporting config sha256:1f85103e2bbae1f3274945d21051acde1fce9b99814b081db00bb7e2fefe84be 0.1s done
#21 exporting attestation manifest sha256:ede23500706146cf55c223653f9ff5ed72b6374f312edc3d96656a981ffa38f0 0.1s done
#21 exporting manifest list sha256:6f6b9e436cb3d56af50f8625fc6c94f81bf39146e88457975c115ef482c3611a 0.1s done
#21 naming to docker.io/library/lab2-g5-20261025:baseline 0.0s done
#21 unpacking to docker.io/library/lab2-g5-20261025:baseline 0.3s done
#21 DONE 1.3s
#19 [tools] exporting to image
#19 unpacking to docker.io/library/lab2-g5-20261025:tools 1.6s done
#19 DONE 2.2s
#22 [api] resolving provenance for metadata file
#22 DONE 0.1s
#23 [tools] resolving provenance for metadata file
#23 DONE 0.0s
Image lab2-g5-20261025:tools Built
Image lab2-g5-20261025:baseline Built
@@ -0,0 +1,22 @@
Container lab2-g5-20261025-baseline-api-run-4a282358b0a9 Creating
Container lab2-g5-20261025-baseline-api-run-4a282358b0a9 Created
{"repeat": 1, "mode": "cold", "profile_select": 406, "requests": 512}
{"repeat": 1, "mode": "contended", "profile_select": 482, "requests": 512}
{"repeat": 1, "mode": "warm", "profile_select": 68, "requests": 512}
{"repeat": 2, "mode": "contended", "profile_select": 472, "requests": 512}
{"repeat": 2, "mode": "warm", "profile_select": 70, "requests": 512}
{"repeat": 2, "mode": "cold", "profile_select": 420, "requests": 512}
{"repeat": 3, "mode": "warm", "profile_select": 76, "requests": 512}
Traceback (most recent call last):
File "/workspace/student-tests/grade5/benchmark.py", line 97, in <module>
if __name__=='__main__': main()
^^^^^^
File "/workspace/student-tests/grade5/benchmark.py", line 89, in main
(out/'bursts.json').write_text(json.dumps(bursts,indent=2))
File "/usr/local/lib/python3.12/pathlib.py", line 1047, in write_text
with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/pathlib.py", line 1013, in open
return io.open(self, mode, buffering, encoding, errors, newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 22] Invalid argument: '/workspace/evidence/grade5/raw/baseline/bursts.json'
+6
View File
@@ -0,0 +1,6 @@
Container lab2-g5-20261025-baseline-api-run-5105e95d3731 Creating
Container lab2-g5-20261025-baseline-api-run-5105e95d3731 Created
{"repeat": 1, "mode": "cold", "profile_select": 23, "requests": 32}
{"repeat": 1, "mode": "contended", "profile_select": 32, "requests": 32}
{"repeat": 1, "mode": "warm", "profile_select": 3, "requests": 32}
COMPLETE baseline wall_s 1.2
@@ -0,0 +1,3 @@
{"BlockIO":"0B / 0B","CPUPerc":"82.04%","Container":"lab2-g5-20261025-baseline-api-1","ID":"a6242309c6c5","MemPerc":"16.36%","MemUsage":"83.75MiB / 512MiB","Name":"lab2-g5-20261025-baseline-api-1","NetIO":"3.19MB / 4.14MB","PIDs":"26"}
{"BlockIO":"0B / 54.8MB","CPUPerc":"67.16%","Container":"lab2-g5-20261025-baseline-postgres-1","ID":"689df010ec5a","MemPerc":"10.85%","MemUsage":"55.54MiB / 512MiB","Name":"lab2-g5-20261025-baseline-postgres-1","NetIO":"1.75MB / 6.21MB","PIDs":"16"}
{"BlockIO":"217kB / 627kB","CPUPerc":"3.93%","Container":"lab2-g5-20261025-baseline-valkey-1","ID":"2ff28d396d0d","MemPerc":"3.01%","MemUsage":"3.852MiB / 128MiB","Name":"lab2-g5-20261025-baseline-valkey-1","NetIO":"982kB / 533kB","PIDs":"6"}
+12
View File
@@ -0,0 +1,12 @@
Container lab2-g5-baseline-measure Creating
Container lab2-g5-baseline-measure Created
{"repeat": 1, "mode": "cold", "profile_select": 463, "requests": 512}
{"repeat": 1, "mode": "contended", "profile_select": 505, "requests": 512}
{"repeat": 1, "mode": "warm", "profile_select": 42, "requests": 512}
{"repeat": 2, "mode": "contended", "profile_select": 510, "requests": 512}
{"repeat": 2, "mode": "warm", "profile_select": 44, "requests": 512}
{"repeat": 2, "mode": "cold", "profile_select": 405, "requests": 512}
{"repeat": 3, "mode": "warm", "profile_select": 58, "requests": 512}
{"repeat": 3, "mode": "cold", "profile_select": 459, "requests": 512}
{"repeat": 3, "mode": "contended", "profile_select": 508, "requests": 512}
COMPLETE baseline wall_s 56.084
+62
View File
@@ -0,0 +1,62 @@
{
"label": "baseline",
"git_head": "b5b35682c25e99f774596a809a11d2be2aaf83d8",
"dirty_at_start": " M .gitignore\n M REPORT.md\n?? evidence/grade5/\n",
"sha256": {
".dockerignore": "9c307884eda8387a781e8942b4df571ae0eee950c822aff044e7ed3d21e325f9",
".env.example": "e59c9a79b31e32811a7bc25f3bbeb4790c07c01300dbf69305ba53572b414b9d",
".gitattributes": "5500509796bdce1e591c03fd09c16f53b083f7d2370390252c569b4a17154ca6",
".github/pull_request_template.md": "f92e65c920ebc97a6078ba8260183a071240bdd3133000f849e4930cb9676c3c",
".github/workflows/application.yml": "67552988c70ea92d6c9ee229724eaa2d99905d82c51f92f4b125d65d117dc775",
".github/workflows/contracts.yml": "57acaf40811dddc83f27bc52bff3e22e60f817ef1b71d764678562ec56f5ca97",
".gitignore": "af38e822d5760f4632928a22c6a283e3ec6599c1305c4ba56762bcbf3f4bab87",
"compose.example.yaml": "68588e6bfa2f00fea39cbc35a1bac0dc4d5067e5045a27000fe7e2c49153a567",
"compose.yaml": "ce26aef52ee071760a2edd8892eb6d844863bffb11d973db3cfc5b7dcc90f5f7",
"contracts/examples.json": "f566c2a935e583caf919ea8f4faeb8da29a4e05cc5fb7626c38f7be665cb60f5",
"contracts/infrastructure.json": "2697bf8850be8661eb35db4fb0806a909f66c5c5093a990921377dddaad10629",
"contracts/openapi.json": "3aa2a5459902b66c24895db2522868fe283c91012d9f8682113396be2c93bc9c",
"contracts/README.md": "4c04faede4a2ffa35183455b51da21764b7fa3997c0a4b3963614b82586eed28",
"CONTRIBUTING.md": "08f247085938bd1efc4b8f7f48e3d520b1dc11ce569f4259491e8f01b9abd02c",
"COURSE.md": "1e3c65e345b7f89d08ed86a3b50061935ee8157907cb4043cfa40689781f54e0",
"Dockerfile": "ea5d779102372fe8792f4024afc59d23ef87cdbe2d57db6c016a87d5549dea86",
"Dockerfile.example": "37050a40f15e29ee7f5eed7b2123fea9e6531d68b5735256e4c41c60255cffc9",
"examples/requests.http": "c91533d9c88101d9d8e0eaefe473f22f96eb530d0c55c6a59ac3476e5ccff6ab",
"infra/Dockerfile.tools": "3877d05692ba4855e449f90e874a5372c8aff36ed6623e18e09229726710ce2d",
"infra/README.md": "33a4f7b870fd0b2bed98d46daf26d45dd7436176739672925246f8e3fe7c2278",
"infra/requirements-tools.lock": "b5ed5b902a10542416b0af52dacb098d795bd18f73a6fc4935f42ab751f13ab2",
"lab.json": "022ea5b6d584a2fd6c2953db1eac73ca2f0888465a5bfe210422112a3d689464",
"MAINTAINERS.md": "b8ecf2db12f074875bb3425b99a25839e228a3d40097fc38d8ac8ea66214966d",
"Makefile": "766fa4bc7666d380a72f8f6659e47ffe8aab6d223ef35dd99dd848a3de18d883",
"migrations/001_initial.sql": "5154c63cca9b5068821e5270b3d8dbc14c542b88ae5ce65422d72874118a14e5",
"README.md": "eb2f458f8afe7ad955aae85d5bbb7caae097b07667cb006dbc9b2249b0527c21",
"REPORT.md": "42969fd3a74746ec56b171ad3c6f85ed4b3037521b0ccc84cb2623077b3d4aa6",
"requirements-dev.txt": "e70f5e9db859ef3439dc6ae647890a18cd7a2752889598bbd19c822f31b7c499",
"requirements.lock": "85f6cb2e093427af72a15f177fc11452421d027b79e333660f1d56998d3a3fe3",
"requirements.txt": "575e9b5762fd5bc6698112be01f66d91db1d2221e166179fcaf1740b01ef3950",
"scripts/check_contract.py": "61e300fe5c1074360418e24b4653b12f96808247a2beaf2a64859aa360f81493",
"scripts/init-env.ps1": "9975f9ccaada4c35aa9ff476bb22607a5a5aea62a367f41a5fec27bd3ac64397",
"scripts/init-env.sh": "3343228cfc2fedc55b8edd2615589f4561dc3908325fa4f0ffecea2336d70c28",
"scripts/restart.example.sh": "7cbfc7f518b975ee3ca37a645359ff734ab0686789b795a9ac845789eb46fbd9",
"scripts/restart.sh": "0e53843e12c0af6383b365aa2248f0c674311a6a40f175d4b5fb6d089b259f64",
"scripts/run-checks.sh": "aa50996ebefc7f3b428405148f280042aff01963ea9657e015cd17c41c10ec4f",
"scripts/validate_openapi.py": "cd7a33221b1860c5d2330e52afa6cb222d375db671ae9ab379ba51a0d3a77946",
"src/__init__.py": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"src/cache.py": "0f92c67b59f57a1ac5ee44d99bb5d992efa208e1d3c6fa44e5b537b913be926c",
"src/config.py": "7d18c6b03d1130ca633055599f13a002d05a722a86427f2c47700b65908223b5",
"src/db.py": "d21da56f3551eef2fb7e930a184264a0731eef8d6eb531929e611f8fa3df4d47",
"src/errors.py": "d34144c2b84b1b0fd15e0da574fe1ff6047d3af3cb3faeacbb1e385f221f46b6",
"src/main.py": "5c36a8dc3fa3dc84c69ebbfee94d1536619ee090da8d5d49931a99bfbd25f436",
"src/models.py": "ce2e14686881f764e00e602a3cb63253cedf698583d3f059b1afd76e4fd94a94",
"src/pagination.py": "bba67fcab7b6ead93c4848319feccecd5e608287f0e983981b04ce0e1ca4b8f3",
"src/security.py": "43a8b463e41053fe8ab125570eb7e93bbbbc13e4f5b6599457cbec22c00dc4d6",
"src/store.py": "dc8c9512979dba9d54617e27b19beb40ca45972dd8f294263144bb2de716c548",
"student-tests/grade4.py": "0eebbefc66a1aac185742b79a6a3aef1ed1f4566db45cb817b40d1ab18485169",
"student-tests/load_measure.py": "285ee517b4b7b4249bffbbbfeb03681afb93daed1974475c454f33536c58a0e3",
"student-tests/README.md": "ee837bea97ea492791416f95667cc2da1cb0e67b0d2d0f2d69bcb8b4b7a2a5e1",
"tests/client.py": "b318084e2a4c380db91a55d082190bf33979fa556a4c4ca87e01f46ae275775c",
"tests/load.py": "9a9aff05e109630e243c3b092d7bd564344e4872b29e38b6618647a08460a72e",
"tests/README.md": "89afb3063ec0ccd7cb68fdac1de57513f9cc81b77bad96f202daaca2b66a5e82",
"tests/resilience.py": "4ba30b9c81a0664127ddab2b0bea5e76aa2087be8bb25aa13cd5a8e69be23fdd",
"tests/smoke.py": "354e168e1e644145c3ff50bbbe189fd217cce5659aa125f588098025ffab0fdf"
}
}
Binary file not shown.
+28
View File
@@ -0,0 +1,28 @@
Network lab2-g5-20261025-baseline_default Creating
Network lab2-g5-20261025-baseline_default Created
Volume lab2-g5-20261025-baseline_valkey_data Creating
Volume lab2-g5-20261025-baseline_valkey_data Created
Volume lab2-g5-20261025-baseline_postgres_data Creating
Volume lab2-g5-20261025-baseline_postgres_data Created
Container lab2-g5-20261025-baseline-postgres-1 Creating
Container lab2-g5-20261025-baseline-valkey-1 Creating
Container lab2-g5-20261025-baseline-valkey-1 Created
Container lab2-g5-20261025-baseline-postgres-1 Created
Container lab2-g5-20261025-baseline-api-1 Creating
Container lab2-g5-20261025-baseline-api-1 Created
Container lab2-g5-20261025-baseline-valkey-1 Starting
Container lab2-g5-20261025-baseline-postgres-1 Starting
Container lab2-g5-20261025-baseline-valkey-1 Started
Container lab2-g5-20261025-baseline-postgres-1 Started
Container lab2-g5-20261025-baseline-postgres-1 Waiting
Container lab2-g5-20261025-baseline-valkey-1 Waiting
Container lab2-g5-20261025-baseline-valkey-1 Healthy
Container lab2-g5-20261025-baseline-postgres-1 Healthy
Container lab2-g5-20261025-baseline-api-1 Starting
Container lab2-g5-20261025-baseline-api-1 Started
Container lab2-g5-20261025-baseline-api-1 Waiting
Container lab2-g5-20261025-baseline-postgres-1 Waiting
Container lab2-g5-20261025-baseline-valkey-1 Waiting
Container lab2-g5-20261025-baseline-valkey-1 Healthy
Container lab2-g5-20261025-baseline-postgres-1 Healthy
Container lab2-g5-20261025-baseline-api-1 Healthy
+6
View File
@@ -0,0 +1,6 @@
Container lab2-g5-20261025-baseline-api-1 Stopping
Container lab2-g5-20261025-baseline-api-1 Stopped
Container lab2-g5-20261025-baseline-postgres-1 Stopping
Container lab2-g5-20261025-baseline-valkey-1 Stopping
Container lab2-g5-20261025-baseline-valkey-1 Stopped
Container lab2-g5-20261025-baseline-postgres-1 Stopped
@@ -0,0 +1,63 @@
{
"label": "candidate",
"git_head": "b5b35682c25e99f774596a809a11d2be2aaf83d8",
"dirty_at_start": " M .gitignore\n M REPORT.md\n M src/cache.py\n M src/pagination.py\n M src/store.py\n?? evidence/grade5/\n?? student-tests/grade5/\n",
"sha256": {
".dockerignore": "9c307884eda8387a781e8942b4df571ae0eee950c822aff044e7ed3d21e325f9",
".env.example": "e59c9a79b31e32811a7bc25f3bbeb4790c07c01300dbf69305ba53572b414b9d",
".gitattributes": "5500509796bdce1e591c03fd09c16f53b083f7d2370390252c569b4a17154ca6",
".github/pull_request_template.md": "f92e65c920ebc97a6078ba8260183a071240bdd3133000f849e4930cb9676c3c",
".github/workflows/application.yml": "67552988c70ea92d6c9ee229724eaa2d99905d82c51f92f4b125d65d117dc775",
".github/workflows/contracts.yml": "57acaf40811dddc83f27bc52bff3e22e60f817ef1b71d764678562ec56f5ca97",
".gitignore": "af38e822d5760f4632928a22c6a283e3ec6599c1305c4ba56762bcbf3f4bab87",
"compose.example.yaml": "68588e6bfa2f00fea39cbc35a1bac0dc4d5067e5045a27000fe7e2c49153a567",
"compose.yaml": "ce26aef52ee071760a2edd8892eb6d844863bffb11d973db3cfc5b7dcc90f5f7",
"contracts/examples.json": "f566c2a935e583caf919ea8f4faeb8da29a4e05cc5fb7626c38f7be665cb60f5",
"contracts/infrastructure.json": "2697bf8850be8661eb35db4fb0806a909f66c5c5093a990921377dddaad10629",
"contracts/openapi.json": "3aa2a5459902b66c24895db2522868fe283c91012d9f8682113396be2c93bc9c",
"contracts/README.md": "4c04faede4a2ffa35183455b51da21764b7fa3997c0a4b3963614b82586eed28",
"CONTRIBUTING.md": "08f247085938bd1efc4b8f7f48e3d520b1dc11ce569f4259491e8f01b9abd02c",
"COURSE.md": "1e3c65e345b7f89d08ed86a3b50061935ee8157907cb4043cfa40689781f54e0",
"Dockerfile": "ea5d779102372fe8792f4024afc59d23ef87cdbe2d57db6c016a87d5549dea86",
"Dockerfile.example": "37050a40f15e29ee7f5eed7b2123fea9e6531d68b5735256e4c41c60255cffc9",
"examples/requests.http": "c91533d9c88101d9d8e0eaefe473f22f96eb530d0c55c6a59ac3476e5ccff6ab",
"infra/Dockerfile.tools": "3877d05692ba4855e449f90e874a5372c8aff36ed6623e18e09229726710ce2d",
"infra/README.md": "33a4f7b870fd0b2bed98d46daf26d45dd7436176739672925246f8e3fe7c2278",
"infra/requirements-tools.lock": "b5ed5b902a10542416b0af52dacb098d795bd18f73a6fc4935f42ab751f13ab2",
"lab.json": "022ea5b6d584a2fd6c2953db1eac73ca2f0888465a5bfe210422112a3d689464",
"MAINTAINERS.md": "b8ecf2db12f074875bb3425b99a25839e228a3d40097fc38d8ac8ea66214966d",
"Makefile": "766fa4bc7666d380a72f8f6659e47ffe8aab6d223ef35dd99dd848a3de18d883",
"migrations/001_initial.sql": "5154c63cca9b5068821e5270b3d8dbc14c542b88ae5ce65422d72874118a14e5",
"README.md": "eb2f458f8afe7ad955aae85d5bbb7caae097b07667cb006dbc9b2249b0527c21",
"REPORT.md": "42969fd3a74746ec56b171ad3c6f85ed4b3037521b0ccc84cb2623077b3d4aa6",
"requirements-dev.txt": "e70f5e9db859ef3439dc6ae647890a18cd7a2752889598bbd19c822f31b7c499",
"requirements.lock": "85f6cb2e093427af72a15f177fc11452421d027b79e333660f1d56998d3a3fe3",
"requirements.txt": "575e9b5762fd5bc6698112be01f66d91db1d2221e166179fcaf1740b01ef3950",
"scripts/check_contract.py": "61e300fe5c1074360418e24b4653b12f96808247a2beaf2a64859aa360f81493",
"scripts/init-env.ps1": "9975f9ccaada4c35aa9ff476bb22607a5a5aea62a367f41a5fec27bd3ac64397",
"scripts/init-env.sh": "3343228cfc2fedc55b8edd2615589f4561dc3908325fa4f0ffecea2336d70c28",
"scripts/restart.example.sh": "7cbfc7f518b975ee3ca37a645359ff734ab0686789b795a9ac845789eb46fbd9",
"scripts/restart.sh": "0e53843e12c0af6383b365aa2248f0c674311a6a40f175d4b5fb6d089b259f64",
"scripts/run-checks.sh": "aa50996ebefc7f3b428405148f280042aff01963ea9657e015cd17c41c10ec4f",
"scripts/validate_openapi.py": "cd7a33221b1860c5d2330e52afa6cb222d375db671ae9ab379ba51a0d3a77946",
"src/__init__.py": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"src/cache.py": "c4cf175579c0f79ea1d512fbd38e9fdb25aace8359729189051dfcbafcd1f557",
"src/config.py": "7d18c6b03d1130ca633055599f13a002d05a722a86427f2c47700b65908223b5",
"src/db.py": "d21da56f3551eef2fb7e930a184264a0731eef8d6eb531929e611f8fa3df4d47",
"src/errors.py": "d34144c2b84b1b0fd15e0da574fe1ff6047d3af3cb3faeacbb1e385f221f46b6",
"src/main.py": "5c36a8dc3fa3dc84c69ebbfee94d1536619ee090da8d5d49931a99bfbd25f436",
"src/models.py": "ce2e14686881f764e00e602a3cb63253cedf698583d3f059b1afd76e4fd94a94",
"src/pagination.py": "e075a030c5b0fa5b0d462ec09aa42bbd5722b57970120057f04c0830377c586d",
"src/security.py": "43a8b463e41053fe8ab125570eb7e93bbbbc13e4f5b6599457cbec22c00dc4d6",
"src/store.py": "556ec5463ecd63505fa923a7f09bf4b434f37660c7cadd74cde239429a376883",
"student-tests/grade4.py": "0eebbefc66a1aac185742b79a6a3aef1ed1f4566db45cb817b40d1ab18485169",
"student-tests/grade5/benchmark.py": "4423296ee59295e4c0c64dd5c26884af1438ea344aa60e7233f1f25aedbaa657",
"student-tests/load_measure.py": "285ee517b4b7b4249bffbbbfeb03681afb93daed1974475c454f33536c58a0e3",
"student-tests/README.md": "ee837bea97ea492791416f95667cc2da1cb0e67b0d2d0f2d69bcb8b4b7a2a5e1",
"tests/client.py": "b318084e2a4c380db91a55d082190bf33979fa556a4c4ca87e01f46ae275775c",
"tests/load.py": "9a9aff05e109630e243c3b092d7bd564344e4872b29e38b6618647a08460a72e",
"tests/README.md": "89afb3063ec0ccd7cb68fdac1de57513f9cc81b77bad96f202daaca2b66a5e82",
"tests/resilience.py": "4ba30b9c81a0664127ddab2b0bea5e76aa2087be8bb25aa13cd5a8e69be23fdd",
"tests/smoke.py": "354e168e1e644145c3ff50bbbe189fd217cce5659aa125f588098025ffab0fdf"
}
}
@@ -0,0 +1,13 @@
time="2026-10-25T01:57:48+03:00" level=warning msg="Found orphan containers ([lab2-g5-candidate-pilot]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up."
Container lab2-g5-candidate-measure Creating
Container lab2-g5-candidate-measure Created
{"repeat": 1, "mode": "cold", "profile_select": 32, "requests": 512}
{"repeat": 1, "mode": "contended", "profile_select": 32, "requests": 512}
{"repeat": 1, "mode": "warm", "profile_select": 0, "requests": 512}
{"repeat": 2, "mode": "contended", "profile_select": 32, "requests": 512}
{"repeat": 2, "mode": "warm", "profile_select": 0, "requests": 512}
{"repeat": 2, "mode": "cold", "profile_select": 32, "requests": 512}
{"repeat": 3, "mode": "warm", "profile_select": 0, "requests": 512}
{"repeat": 3, "mode": "cold", "profile_select": 32, "requests": 512}
{"repeat": 3, "mode": "contended", "profile_select": 32, "requests": 512}
COMPLETE candidate wall_s 41.232
+56
View File
@@ -0,0 +1,56 @@
Image lab2-g5-20261025:candidate Building
#1 [internal] load local bake definitions
#1 reading from stdin 565B 0.1s done
#1 DONE 0.1s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile:
#2 transferring dockerfile: 743B 0.1s done
#2 DONE 0.3s
#3 [internal] load metadata for docker.io/library/python:3.12.10-slim-bookworm
#3 DONE 1.4s
#4 [internal] load .dockerignore
#4 transferring context:
#4 transferring context: 216B 0.0s done
#4 DONE 0.2s
#5 [internal] load build context
#5 transferring context: 27.55kB 0.1s done
#5 DONE 0.2s
#6 [1/6] FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db
#6 resolve docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db 0.1s done
#6 DONE 0.2s
#7 [2/6] WORKDIR /app
#7 CACHED
#8 [3/6] COPY requirements.txt requirements.lock ./
#8 CACHED
#9 [4/6] RUN pip install --no-cache-dir -r requirements.lock && useradd --create-home --uid 10001 appuser
#9 CACHED
#10 [5/6] COPY --chown=appuser:appuser src ./src
#10 DONE 0.1s
#11 [6/6] COPY --chown=appuser:appuser migrations ./migrations
#11 DONE 0.2s
#12 exporting to image
#12 exporting layers
#12 exporting layers 0.3s done
#12 exporting manifest sha256:b5f76fb2b630832edcca2cb0a40f05f307f4b95aec497674dea9476f0cd842e8 0.0s done
#12 exporting config sha256:62b3429468ac1f05f3527cd80f95676269ec89e901af7d1f4835a3dfb095d3ff 0.0s done
#12 exporting attestation manifest sha256:4ef06e51f0ef2b2b9c2e9e9453fdd783b788821fa86f5b0d43abe016cc3862dd 0.1s done
#12 exporting manifest list sha256:29327f76555981332a4d38c7c36279916123a57b220981c9af359f892e7bdd49
#12 exporting manifest list sha256:29327f76555981332a4d38c7c36279916123a57b220981c9af359f892e7bdd49 0.0s done
#12 naming to docker.io/library/lab2-g5-20261025:candidate done
#12 unpacking to docker.io/library/lab2-g5-20261025:candidate 0.1s done
#12 DONE 0.9s
#13 resolving provenance for metadata file
#13 DONE 0.1s
Image lab2-g5-20261025:candidate Built
+6
View File
@@ -0,0 +1,6 @@
Container lab2-g5-candidate-pilot Creating
Container lab2-g5-candidate-pilot Created
{"repeat": 1, "mode": "cold", "profile_select": 2, "requests": 32}
{"repeat": 1, "mode": "contended", "profile_select": 2, "requests": 32}
{"repeat": 1, "mode": "warm", "profile_select": 0, "requests": 32}
COMPLETE candidate wall_s 1.185
@@ -0,0 +1,2 @@
2
1
@@ -0,0 +1,3 @@
{"BlockIO":"0B / 0B","CPUPerc":"54.40%","Container":"lab2-g5-20261025-candidate-api-1","ID":"79f601c083c1","MemPerc":"16.35%","MemUsage":"83.7MiB / 512MiB","Name":"lab2-g5-20261025-candidate-api-1","NetIO":"3.06MB / 4.31MB","PIDs":"22"}
{"BlockIO":"0B / 54.4MB","CPUPerc":"5.21%","Container":"lab2-g5-20261025-candidate-postgres-1","ID":"9c16ad8347ba","MemPerc":"10.89%","MemUsage":"55.77MiB / 512MiB","Name":"lab2-g5-20261025-candidate-postgres-1","NetIO":"1.85MB / 8.46MB","PIDs":"16"}
{"BlockIO":"123kB / 197kB","CPUPerc":"5.62%","Container":"lab2-g5-20261025-candidate-valkey-1","ID":"d5d967de43c8","MemPerc":"2.89%","MemUsage":"3.695MiB / 128MiB","Name":"lab2-g5-20261025-candidate-valkey-1","NetIO":"285kB / 222kB","PIDs":"6"}
+12
View File
@@ -0,0 +1,12 @@
Container lab2-g5-final-measure Creating
Container lab2-g5-final-measure Created
{"repeat": 1, "mode": "cold", "profile_select": 32, "requests": 512}
{"repeat": 1, "mode": "contended", "profile_select": 32, "requests": 512}
{"repeat": 1, "mode": "warm", "profile_select": 0, "requests": 512}
{"repeat": 2, "mode": "contended", "profile_select": 32, "requests": 512}
{"repeat": 2, "mode": "warm", "profile_select": 0, "requests": 512}
{"repeat": 2, "mode": "cold", "profile_select": 32, "requests": 512}
{"repeat": 3, "mode": "warm", "profile_select": 0, "requests": 512}
{"repeat": 3, "mode": "cold", "profile_select": 32, "requests": 512}
{"repeat": 3, "mode": "contended", "profile_select": 32, "requests": 512}
COMPLETE candidate wall_s 41.205
+28
View File
@@ -0,0 +1,28 @@
Network lab2-g5-20261025-candidate_default Creating
Network lab2-g5-20261025-candidate_default Created
Volume lab2-g5-20261025-candidate_postgres_data Creating
Volume lab2-g5-20261025-candidate_postgres_data Created
Volume lab2-g5-20261025-candidate_valkey_data Creating
Volume lab2-g5-20261025-candidate_valkey_data Created
Container lab2-g5-20261025-candidate-valkey-1 Creating
Container lab2-g5-20261025-candidate-postgres-1 Creating
Container lab2-g5-20261025-candidate-valkey-1 Created
Container lab2-g5-20261025-candidate-postgres-1 Created
Container lab2-g5-20261025-candidate-api-1 Creating
Container lab2-g5-20261025-candidate-api-1 Created
Container lab2-g5-20261025-candidate-valkey-1 Starting
Container lab2-g5-20261025-candidate-postgres-1 Starting
Container lab2-g5-20261025-candidate-valkey-1 Started
Container lab2-g5-20261025-candidate-postgres-1 Started
Container lab2-g5-20261025-candidate-postgres-1 Waiting
Container lab2-g5-20261025-candidate-valkey-1 Waiting
Container lab2-g5-20261025-candidate-valkey-1 Healthy
Container lab2-g5-20261025-candidate-postgres-1 Healthy
Container lab2-g5-20261025-candidate-api-1 Starting
Container lab2-g5-20261025-candidate-api-1 Started
Container lab2-g5-20261025-candidate-api-1 Waiting
Container lab2-g5-20261025-candidate-postgres-1 Waiting
Container lab2-g5-20261025-candidate-valkey-1 Waiting
Container lab2-g5-20261025-candidate-valkey-1 Healthy
Container lab2-g5-20261025-candidate-postgres-1 Healthy
Container lab2-g5-20261025-candidate-api-1 Healthy
+115
View File
@@ -0,0 +1,115 @@
M .gitattributes
M .gitignore
M REPORT.md
M src/cache.py
M src/pagination.py
M src/store.py
?? PR_GRADE5_DRAFT.md
?? evidence/grade5/PUBLISH.md
?? evidence/grade5/README.md
?? evidence/grade5/aggregate.py
?? evidence/grade5/audit.json
?? evidence/grade5/audit.md
?? evidence/grade5/audit.py
?? evidence/grade5/baseline-build.txt
?? evidence/grade5/baseline-failed-attempt-1.txt
?? evidence/grade5/baseline-pilot.txt
?? evidence/grade5/baseline-resources-sample.jsonl
?? evidence/grade5/baseline-run.txt
?? evidence/grade5/baseline-source.json
?? evidence/grade5/baseline-source.zip
?? evidence/grade5/baseline-start.txt
?? evidence/grade5/baseline-stop.txt
?? evidence/grade5/candidate-before-text-fix-source.json
?? evidence/grade5/candidate-before-text-fix.txt
?? evidence/grade5/candidate-build.txt
?? evidence/grade5/candidate-pilot.txt
?? evidence/grade5/candidate-pretests-counts.txt
?? evidence/grade5/candidate-resources-sample.jsonl
?? evidence/grade5/candidate-run.txt
?? evidence/grade5/candidate-start.txt
?? evidence/grade5/changed-files.txt
?? evidence/grade5/checks/cache-integration.txt
?? evidence/grade5/checks/cache-recovery.txt
?? evidence/grade5/checks/checks.txt
?? evidence/grade5/checks/core.txt
?? evidence/grade5/checks/expiry.txt
?? evidence/grade5/checks/explain.txt
?? evidence/grade5/checks/failures.txt
?? evidence/grade5/checks/migrations.txt
?? evidence/grade5/checks/persistence.txt
?? evidence/grade5/checks/session-persistence.txt
?? evidence/grade5/checks/smoke.txt
?? evidence/grade5/checks/unit.txt
?? evidence/grade5/clean-bootstrap.txt
?? evidence/grade5/clean-build.txt
?? evidence/grade5/clean-checks/checks.txt
?? evidence/grade5/clean-checks/core.txt
?? evidence/grade5/clean-checks/expiry.txt
?? evidence/grade5/clean-checks/explain.txt
?? evidence/grade5/clean-checks/failures.txt
?? evidence/grade5/clean-checks/migrations.txt
?? evidence/grade5/clean-checks/persistence.txt
?? evidence/grade5/clean-checks/session-persistence.txt
?? evidence/grade5/clean-checks/smoke.txt
?? evidence/grade5/clean-public-run.txt
?? evidence/grade5/clean-source.json
?? evidence/grade5/clean-start.txt
?? evidence/grade5/clean-stop.txt
?? evidence/grade5/commands.md
?? evidence/grade5/comparison.json
?? evidence/grade5/comparison.svg
?? evidence/grade5/compose.clean-override.yaml
?? evidence/grade5/compose.research.yaml
?? evidence/grade5/docker-environment.json
?? evidence/grade5/final-build.txt
?? evidence/grade5/final-public-run.txt
?? evidence/grade5/final-source.json
?? evidence/grade5/final-start.txt
?? evidence/grade5/final-stop.txt
?? evidence/grade5/final-test-services.txt
?? evidence/grade5/git-final-status.txt
?? evidence/grade5/host-cpu.json
?? evidence/grade5/images-apps.txt
?? evidence/grade5/images-baseline.txt
?? evidence/grade5/initial-candidate-stop.txt
?? evidence/grade5/original-stack-unchanged.txt
?? evidence/grade5/package_review.py
?? evidence/grade5/plan.json
?? evidence/grade5/provenance.md
?? evidence/grade5/public-run.txt
?? evidence/grade5/raw-sha256.txt
?? evidence/grade5/raw/baseline-failed-attempt-1/bursts.json
?? evidence/grade5/raw/baseline-failed-attempt-1/failure.json
?? evidence/grade5/raw/baseline-failed-attempt-1/requests.csv
?? evidence/grade5/raw/baseline-pilot/bursts.json
?? evidence/grade5/raw/baseline-pilot/meta.json
?? evidence/grade5/raw/baseline-pilot/requests.csv
?? evidence/grade5/raw/baseline/bursts.json
?? evidence/grade5/raw/baseline/meta.json
?? evidence/grade5/raw/baseline/requests.csv
?? evidence/grade5/raw/candidate-before-text-fix/bursts.json
?? evidence/grade5/raw/candidate-before-text-fix/meta.json
?? evidence/grade5/raw/candidate-before-text-fix/requests.csv
?? evidence/grade5/raw/candidate-pilot/bursts.json
?? evidence/grade5/raw/candidate-pilot/meta.json
?? evidence/grade5/raw/candidate-pilot/requests.csv
?? evidence/grade5/raw/candidate/bursts.json
?? evidence/grade5/raw/candidate/meta.json
?? evidence/grade5/raw/candidate/requests.csv
?? evidence/grade5/replay-verification.json
?? evidence/grade5/reproduce-check.txt
?? evidence/grade5/reproduce.py
?? evidence/grade5/requirements.md
?? evidence/grade5/results.md
?? evidence/grade5/review-archive.json
?? evidence/grade5/review-inventory.json
?? evidence/grade5/runs.csv
?? evidence/grade5/snapshot.py
?? evidence/grade5/source-fingerprint.json
?? evidence/grade5/test-services-start.txt
?? student-tests/grade5/benchmark.py
?? student-tests/grade5/faults.py
?? student-tests/grade5/integration.py
?? student-tests/grade5/run-public.sh
?? student-tests/grade5/test_singleflight.py
@@ -0,0 +1,10 @@
time="2026-10-25T02:06:10+03:00" level=warning msg="Found orphan containers ([lab2-g5-final-measure]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up."
Container lab2-g5-20261025-final-api-run-cfeaa36dba5c Creating
Container lab2-g5-20261025-final-api-run-cfeaa36dba5c Created
PASS: cold/warm/real TTL expiry; 10 empty/malformed/wrong-id/wrong-type/extra-field values repaired from PG
PASS: member/path/cursor UUID semantics; duplicate aliases 400; malformed timestamps 400; outsider+bad cursor 404; unknown route envelope
PASS: chats/chat lists/messages read-after-write immediately across two API processes in both directions
PASS: revoked/expired sessions 401 in warm/cold/corrupt cache and in another API process
PASS: HTTP C8 lock=0.2s processes=2 real profile SELECT=2 elapsed=0.243s max_http=0.234s
PASS: HTTP C8 lock=1.2s processes=1 real profile SELECT=8 elapsed=1.246s max_http=1.232s
PASS: grade5 additional integration checks completed
@@ -0,0 +1,6 @@
time="2026-10-25T02:06:55+03:00" level=warning msg="Found orphan containers ([lab2-g5-final-measure]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up."
Container lab2-g5-20261025-final-tools-run-1b69563af0d5 Creating
Container lab2-g5-20261025-final-tools-run-1b69563af0d5 Created
PASS: Valkey down: valid user/read-after-write work, expired/revoked/anonymous 401, errors omit input; 0.543s
PASS: own profile lost before actual Valkey restart; refill from PG after cooldown, TTL<=60, expired/revoked stay401; recovery 7.725s
PASS: API/PG/Valkey logs contain no test message marker, five passwords/tokens or Argon2 hashes; cache only public User fields. This is a tested marker scope, not a universal proof.
+4
View File
@@ -0,0 +1,4 @@
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
python3 scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
+7
View File
@@ -0,0 +1,7 @@
PASS: concurrent same username: 12 requests, 1 x 201, 11 x 409
PASS: unknown member FK after parent INSERT rolls back chat and memberships; duplicate/missing owner -> 400
PASS: NUL in display_name/title/text -> 400; PostgreSQL readiness remains 200
PASS: strict types/extra fields, malformed JSON, UUID, limits/cursors, blank/oversized text, outsider isolation
PASS: 40 concurrent writes; tied timestamp UUID ordering; complete keyset traversal, scoped cursors, changing limit, read-after-write
PASS: malformed Basic, wrong/unknown credentials uniform 401, X-User-Id ignored, 128-code-point UTF8 colon password, stored Argon2id
PASS: real Valkey GET hits, TTL <=60 without sliding; expiry/refill; logout rejects cached profile and repeated logout
+1
View File
@@ -0,0 +1 @@
PASS: SESSION_TTL_SECONDS=2: immediate authentication succeeds; after 2.21s cached profile cannot bypass expiry/logout
+33
View File
@@ -0,0 +1,33 @@
Rows in test chat: 10000
Position: 0
Limit (cost=0.29..4.17 rows=51 width=70) (actual time=0.016..0.064 rows=51 loops=1)
Buffers: shared hit=3
-> Index Scan using messages_history on messages (cost=0.29..762.53 rows=10000 width=70) (actual time=0.015..0.030 rows=51 loops=1)
Index Cond: (chat_id = '75f21d02-9989-494a-9028-54436d4d64c8'::uuid)
Buffers: shared hit=3
Planning:
Buffers: shared hit=18
Planning Time: 0.388 ms
Execution Time: 0.157 ms
Position: 5000
Limit (cost=0.29..5.44 rows=51 width=70) (actual time=0.015..0.036 rows=51 loops=1)
Buffers: shared hit=4
-> Index Scan using messages_history on messages (cost=0.29..503.80 rows=4981 width=70) (actual time=0.014..0.029 rows=51 loops=1)
Index Cond: ((chat_id = '75f21d02-9989-494a-9028-54436d4d64c8'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.005001+00'::timestamp with time zone, '3bf71f4a-89cf-43ad-b422-ffe236dc1f2c'::uuid)))
Buffers: shared hit=4
Planning Time: 0.109 ms
Execution Time: 0.135 ms
Position: 9900
Limit (cost=0.29..68.56 rows=51 width=70) (actual time=0.028..0.046 rows=51 loops=1)
Buffers: shared hit=3
-> Index Scan using messages_history on messages (cost=0.29..135.50 rows=101 width=70) (actual time=0.027..0.038 rows=51 loops=1)
Index Cond: ((chat_id = '75f21d02-9989-494a-9028-54436d4d64c8'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009901+00'::timestamp with time zone, 'afbc2087-9faa-444d-b4f8-a2e8e1f28fe0'::uuid)))
Buffers: shared hit=3
Planning Time: 0.178 ms
Execution Time: 0.085 ms
PostgreSQL: 16.8 (Debian 16.8-1.pgdg120+1)
Durability: on on
PASS: actual EXPLAIN ANALYZE BUFFERS at first/middle/tail; API traversal 10000 rows, 100 pages, 2.597s
+4
View File
@@ -0,0 +1,4 @@
PASS: Valkey stopped: ready=200, authenticated read/write via PG, unknown/missing/revoked=401, outsider=404; scenario 0.363s
PASS: PostgreSQL stopped: ready/auth/write=503, live=200, no credentials=401, no cached authentication; scenario 0.153s
PASS: PostgreSQL recovery 2.083s, same valid token/data survive, revoked token remains revoked, rejected write absent
PASS: all 22 HTTP requests bounded below 4.5s; maximum 0.451s
+3
View File
@@ -0,0 +1,3 @@
PASS: versioned migrations applied (already applied versions skipped)
PASS: versioned migrations applied (already applied versions skipped)
PASS: two repeated migrations; all table counts and absolute session expiries unchanged: {'users': 10, 'chats': 3, 'chat_members': 5, 'messages': 43, 'sessions': 7, 'schema_migrations': 1}
+9
View File
@@ -0,0 +1,9 @@
/lab2-g5-20261025-final-api-1 2026-10-24T23:02:50.740678331Z sha256:0bed5b677a58a94af1d5adb000f667310242521eac8377202d1ff35634e1c3f8
/lab2-g5-20261025-final-postgres-1 2026-10-24T23:05:19.222264359Z sha256:301bcb60b8a3ee4ab7e147932723e3abd1cef53516ce5210b39fd9fe5e3602ae
/lab2-g5-20261025-final-valkey-1 2026-10-24T23:05:17.117404887Z sha256:752ba000a58bc8925d11ee863a39b5225617cd2cb3dbc9ec8ac65268b65ebb6d
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://api: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.
/lab2-g5-20261025-final-api-1 2026-10-24T23:05:25.466506921Z sha256:0bed5b677a58a94af1d5adb000f667310242521eac8377202d1ff35634e1c3f8
/lab2-g5-20261025-final-postgres-1 2026-10-24T23:05:25.190802943Z sha256:301bcb60b8a3ee4ab7e147932723e3abd1cef53516ce5210b39fd9fe5e3602ae
/lab2-g5-20261025-final-valkey-1 2026-10-24T23:05:25.183415205Z sha256:752ba000a58bc8925d11ee863a39b5225617cd2cb3dbc9ec8ac65268b65ebb6d
@@ -0,0 +1 @@
PASS: same opaque token authenticates after all services restart; absolute PG expires_at unchanged; only 32-byte token hash stored
+2
View File
@@ -0,0 +1,2 @@
python3 tests/smoke.py --base-url "http://api:8080"
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
+13
View File
@@ -0,0 +1,13 @@
time="2026-10-25T02:06:02+03:00" level=warning msg="Found orphan containers ([lab2-g5-final-measure]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up."
Container lab2-g5-20261025-final-api-run-9ee0b977d673 Creating
Container lab2-g5-20261025-final-api-run-9ee0b977d673 Created
test_different_users_do_not_serialize (__main__.SingleFlightTests.test_different_users_do_not_serialize) ... ok
test_leader_exception_wakes_waiters_and_retry (__main__.SingleFlightTests.test_leader_exception_wakes_waiters_and_retry) ... ok
test_registry_limit_direct_fallback (__main__.SingleFlightTests.test_registry_limit_direct_fallback) ... ok
test_same_user_one_load (__main__.SingleFlightTests.test_same_user_one_load) ... ok
test_wait_timeout_fallback_does_not_replace_leader (__main__.SingleFlightTests.test_wait_timeout_fallback_does_not_replace_leader) ... ok
----------------------------------------------------------------------
Ran 5 tests in 0.330s
OK
+10
View File
@@ -0,0 +1,10 @@
Network lab2-g5-20261025-clean_default Creating
Network lab2-g5-20261025-clean_default Created
Container lab2-g5-20261025-clean-tools-run-88f1b71b699a Creating
Container lab2-g5-20261025-clean-tools-run-88f1b71b699a Created
Local configuration ready; secrets were not printed.
Local configuration ready; secrets were not printed.
0
0
0
001_initial.sql
+125
View File
@@ -0,0 +1,125 @@
Image lab2-g5-20261025:clean Building
#1 [internal] load local bake definitions
#1 reading from stdin 573B 0.2s done
#1 DONE 0.2s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile:
#2 transferring dockerfile: 743B 0.1s done
#2 DONE 0.9s
#3 [internal] load metadata for docker.io/library/python:3.12.10-slim-bookworm
#3 DONE 1.1s
#4 [internal] load .dockerignore
#4 transferring context: 216B 0.0s done
#4 DONE 0.1s
#5 [internal] load build context
#5 transferring context: 27.34kB 0.1s done
#5 DONE 0.2s
#6 [1/6] FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db
#6 resolve docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db 0.1s done
#6 DONE 0.2s
#7 [2/6] WORKDIR /app
#7 CACHED
#8 [3/6] COPY requirements.txt requirements.lock ./
#8 DONE 0.1s
#9 [4/6] RUN pip install --no-cache-dir -r requirements.lock && useradd --create-home --uid 10001 appuser
#9 5.568 Collecting annotated-types==0.8.0 (from -r requirements.lock (line 1))
#9 5.994 Downloading annotated_types-0.8.0-py3-none-any.whl.metadata (15 kB)
#9 6.090 Collecting anyio==4.15.1 (from -r requirements.lock (line 2))
#9 6.149 Downloading anyio-4.15.1-py3-none-any.whl.metadata (4.7 kB)
#9 6.242 Collecting argon2-cffi==23.1.0 (from -r requirements.lock (line 3))
#9 6.307 Downloading argon2_cffi-23.1.0-py3-none-any.whl.metadata (5.2 kB)
#9 6.408 Collecting argon2-cffi-bindings==26.1.0 (from -r requirements.lock (line 4))
#9 6.472 Downloading argon2_cffi_bindings-26.1.0-cp310-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl.metadata (7.5 kB)
#9 6.843 Collecting cffi==2.1.1 (from -r requirements.lock (line 5))
#9 6.906 Downloading cffi-2.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.5 kB)
#9 7.017 Collecting click==8.5.0 (from -r requirements.lock (line 6))
#9 7.094 Downloading click-8.5.0-py3-none-any.whl.metadata (2.6 kB)
#9 7.590 Collecting fastapi==0.115.12 (from -r requirements.lock (line 7))
#9 7.671 Downloading fastapi-0.115.12-py3-none-any.whl.metadata (27 kB)
#9 7.869 Collecting h11==0.16.0 (from -r requirements.lock (line 8))
#9 7.937 Downloading h11-0.16.0-py3-none-any.whl.metadata (8.3 kB)
#9 8.081 Collecting idna==3.20 (from -r requirements.lock (line 9))
#9 8.149 Downloading idna-3.20-py3-none-any.whl.metadata (7.2 kB)
#9 8.325 Collecting psycopg==3.2.6 (from -r requirements.lock (line 10))
#9 8.405 Downloading psycopg-3.2.6-py3-none-any.whl.metadata (4.4 kB)
#9 9.332 Collecting psycopg-binary==3.2.6 (from -r requirements.lock (line 11))
#9 9.430 Downloading psycopg_binary-3.2.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.8 kB)
#9 9.526 Collecting psycopg-pool==3.2.6 (from -r requirements.lock (line 12))
#9 9.588 Downloading psycopg_pool-3.2.6-py3-none-any.whl.metadata (2.6 kB)
#9 9.660 Collecting pycparser==3.12 (from -r requirements.lock (line 13))
#9 9.730 Downloading pycparser-3.12-py3-none-any.whl.metadata (9.7 kB)
#9 10.04 Collecting pydantic==2.11.3 (from -r requirements.lock (line 14))
#9 10.10 Downloading pydantic-2.11.3-py3-none-any.whl.metadata (65 kB)
#9 12.73 Collecting pydantic_core==2.33.1 (from -r requirements.lock (line 15))
#9 12.81 Downloading pydantic_core-2.33.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.8 kB)
#9 13.06 Collecting redis==5.2.1 (from -r requirements.lock (line 16))
#9 13.12 Downloading redis-5.2.1-py3-none-any.whl.metadata (9.1 kB)
#9 13.27 Collecting starlette==0.46.2 (from -r requirements.lock (line 17))
#9 13.34 Downloading starlette-0.46.2-py3-none-any.whl.metadata (6.2 kB)
#9 13.42 Collecting typing-inspection==0.4.4 (from -r requirements.lock (line 18))
#9 13.49 Downloading typing_inspection-0.4.4-py3-none-any.whl.metadata (2.6 kB)
#9 13.58 Collecting typing_extensions==4.16.0 (from -r requirements.lock (line 19))
#9 13.65 Downloading typing_extensions-4.16.0-py3-none-any.whl.metadata (3.3 kB)
#9 13.77 Collecting uvicorn==0.34.2 (from -r requirements.lock (line 20))
#9 13.84 Downloading uvicorn-0.34.2-py3-none-any.whl.metadata (6.5 kB)
#9 14.16 Downloading annotated_types-0.8.0-py3-none-any.whl (13 kB)
#9 14.24 Downloading anyio-4.15.1-py3-none-any.whl (132 kB)
#9 14.32 Downloading argon2_cffi-23.1.0-py3-none-any.whl (15 kB)
#9 14.38 Downloading argon2_cffi_bindings-26.1.0-cp310-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl (26 kB)
#9 14.45 Downloading cffi-2.1.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (221 kB)
#9 14.60 Downloading click-8.5.0-py3-none-any.whl (125 kB)
#9 14.68 Downloading fastapi-0.115.12-py3-none-any.whl (95 kB)
#9 14.77 Downloading h11-0.16.0-py3-none-any.whl (37 kB)
#9 14.84 Downloading idna-3.20-py3-none-any.whl (69 kB)
#9 14.92 Downloading psycopg-3.2.6-py3-none-any.whl (199 kB)
#9 15.03 Downloading psycopg_binary-3.2.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB)
#9 15.71 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 6.6 MB/s eta 0:00:00
#9 15.78 Downloading psycopg_pool-3.2.6-py3-none-any.whl (38 kB)
#9 16.13 Downloading pycparser-3.12-py3-none-any.whl (62 kB)
#9 16.28 Downloading pydantic-2.11.3-py3-none-any.whl (443 kB)
#9 16.50 Downloading pydantic_core-2.33.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB)
#9 16.97 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 5.1 MB/s eta 0:00:00
#9 17.05 Downloading redis-5.2.1-py3-none-any.whl (261 kB)
#9 17.21 Downloading starlette-0.46.2-py3-none-any.whl (72 kB)
#9 17.31 Downloading typing_inspection-0.4.4-py3-none-any.whl (14 kB)
#9 17.38 Downloading typing_extensions-4.16.0-py3-none-any.whl (45 kB)
#9 17.46 Downloading uvicorn-0.34.2-py3-none-any.whl (62 kB)
#9 17.69 Installing collected packages: typing_extensions, redis, pycparser, psycopg-binary, idna, h11, click, annotated-types, uvicorn, typing-inspection, pydantic_core, psycopg-pool, psycopg, cffi, anyio, starlette, pydantic, argon2-cffi-bindings, fastapi, argon2-cffi
#9 22.55 Successfully installed annotated-types-0.8.0 anyio-4.15.1 argon2-cffi-23.1.0 argon2-cffi-bindings-26.1.0 cffi-2.1.1 click-8.5.0 fastapi-0.115.12 h11-0.16.0 idna-3.20 psycopg-3.2.6 psycopg-binary-3.2.6 psycopg-pool-3.2.6 pycparser-3.12 pydantic-2.11.3 pydantic_core-2.33.1 redis-5.2.1 starlette-0.46.2 typing-inspection-0.4.4 typing_extensions-4.16.0 uvicorn-0.34.2
#9 22.55 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
#9 23.27
#9 23.27 [notice] A new release of pip is available: 25.0.1 -> 26.2.2
#9 23.27 [notice] To update, run: pip install --upgrade pip
#9 DONE 23.8s
#10 [5/6] COPY --chown=appuser:appuser src ./src
#10 DONE 0.1s
#11 [6/6] COPY --chown=appuser:appuser migrations ./migrations
#11 DONE 0.1s
#12 exporting to image
#12 exporting layers
#12 exporting layers 4.7s done
#12 exporting manifest sha256:6c6cf45f74386ad1624cc48568ccd9e4c209970e7c7ecda6da3ee4a21fda5598 0.0s done
#12 exporting config sha256:02faa6be66dc44208964b1e72b170eef16572198f3e36f8c9ecc0f398cac1a82 0.0s done
#12 exporting attestation manifest sha256:01f511283e1943676b6a9578e6f2c749e4b29cb6dca223ce9b6ca886797e077c
#12 exporting attestation manifest sha256:01f511283e1943676b6a9578e6f2c749e4b29cb6dca223ce9b6ca886797e077c 0.1s done
#12 exporting manifest list sha256:345a85414a671b5ad0a154d5b726f71744796937db95d2406eedd7cb107ab2e9
#12 exporting manifest list sha256:345a85414a671b5ad0a154d5b726f71744796937db95d2406eedd7cb107ab2e9 0.1s done
#12 naming to docker.io/library/lab2-g5-20261025:clean 0.0s done
#12 unpacking to docker.io/library/lab2-g5-20261025:clean
#12 unpacking to docker.io/library/lab2-g5-20261025:clean 1.6s done
#12 DONE 6.8s
#13 resolving provenance for metadata file
#13 DONE 0.1s
Image lab2-g5-20261025:clean Built
+4
View File
@@ -0,0 +1,4 @@
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
python3 scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
+7
View File
@@ -0,0 +1,7 @@
PASS: concurrent same username: 12 requests, 1 x 201, 11 x 409
PASS: unknown member FK after parent INSERT rolls back chat and memberships; duplicate/missing owner -> 400
PASS: NUL in display_name/title/text -> 400; PostgreSQL readiness remains 200
PASS: strict types/extra fields, malformed JSON, UUID, limits/cursors, blank/oversized text, outsider isolation
PASS: 40 concurrent writes; tied timestamp UUID ordering; complete keyset traversal, scoped cursors, changing limit, read-after-write
PASS: malformed Basic, wrong/unknown credentials uniform 401, X-User-Id ignored, 128-code-point UTF8 colon password, stored Argon2id
PASS: real Valkey GET hits, TTL <=60 without sliding; expiry/refill; logout rejects cached profile and repeated logout
+1
View File
@@ -0,0 +1 @@
PASS: SESSION_TTL_SECONDS=2: immediate authentication succeeds; after 2.25s cached profile cannot bypass expiry/logout
+33
View File
@@ -0,0 +1,33 @@
Rows in test chat: 10000
Position: 0
Limit (cost=0.29..4.17 rows=51 width=70) (actual time=0.017..0.041 rows=51 loops=1)
Buffers: shared hit=3
-> Index Scan using messages_history on messages (cost=0.29..762.53 rows=10000 width=70) (actual time=0.016..0.032 rows=51 loops=1)
Index Cond: (chat_id = '618d27f6-266c-47a9-8d5f-37203cdd6861'::uuid)
Buffers: shared hit=3
Planning:
Buffers: shared hit=20
Planning Time: 0.208 ms
Execution Time: 0.065 ms
Position: 5000
Limit (cost=0.29..5.44 rows=51 width=70) (actual time=0.011..0.023 rows=51 loops=1)
Buffers: shared hit=4
-> Index Scan using messages_history on messages (cost=0.29..503.80 rows=4981 width=70) (actual time=0.010..0.018 rows=51 loops=1)
Index Cond: ((chat_id = '618d27f6-266c-47a9-8d5f-37203cdd6861'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.005001+00'::timestamp with time zone, '670bebbc-8919-425e-8a27-81c9b3bd2180'::uuid)))
Buffers: shared hit=4
Planning Time: 0.140 ms
Execution Time: 0.053 ms
Position: 9900
Limit (cost=0.29..68.56 rows=51 width=70) (actual time=0.015..0.028 rows=51 loops=1)
Buffers: shared hit=3
-> Index Scan using messages_history on messages (cost=0.29..135.50 rows=101 width=70) (actual time=0.014..0.023 rows=51 loops=1)
Index Cond: ((chat_id = '618d27f6-266c-47a9-8d5f-37203cdd6861'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009901+00'::timestamp with time zone, '5d58dc9e-45f6-448f-8316-182dd9f07504'::uuid)))
Buffers: shared hit=3
Planning Time: 0.079 ms
Execution Time: 0.043 ms
PostgreSQL: 16.8 (Debian 16.8-1.pgdg120+1)
Durability: on on
PASS: actual EXPLAIN ANALYZE BUFFERS at first/middle/tail; API traversal 10000 rows, 100 pages, 2.130s
@@ -0,0 +1,4 @@
PASS: Valkey stopped: ready=200, authenticated read/write via PG, unknown/missing/revoked=401, outsider=404; scenario 0.616s
PASS: PostgreSQL stopped: ready/auth/write=503, live=200, no credentials=401, no cached authentication; scenario 0.165s
PASS: PostgreSQL recovery 2.607s, same valid token/data survive, revoked token remains revoked, rejected write absent
PASS: all 22 HTTP requests bounded below 4.5s; maximum 0.272s
@@ -0,0 +1,3 @@
PASS: versioned migrations applied (already applied versions skipped)
PASS: versioned migrations applied (already applied versions skipped)
PASS: two repeated migrations; all table counts and absolute session expiries unchanged: {'users': 9, 'chats': 3, 'chat_members': 5, 'messages': 43, 'sessions': 6, 'schema_migrations': 1}
@@ -0,0 +1,9 @@
/lab2-g5-20261025-clean-api-1 2026-10-24T23:05:44.433989766Z sha256:345a85414a671b5ad0a154d5b726f71744796937db95d2406eedd7cb107ab2e9
/lab2-g5-20261025-clean-postgres-1 2026-10-24T23:07:33.392983752Z sha256:301bcb60b8a3ee4ab7e147932723e3abd1cef53516ce5210b39fd9fe5e3602ae
/lab2-g5-20261025-clean-valkey-1 2026-10-24T23:07:30.251989711Z sha256:752ba000a58bc8925d11ee863a39b5225617cd2cb3dbc9ec8ac65268b65ebb6d
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://api: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.
/lab2-g5-20261025-clean-api-1 2026-10-24T23:07:42.985481562Z sha256:345a85414a671b5ad0a154d5b726f71744796937db95d2406eedd7cb107ab2e9
/lab2-g5-20261025-clean-postgres-1 2026-10-24T23:07:43.115246938Z sha256:301bcb60b8a3ee4ab7e147932723e3abd1cef53516ce5210b39fd9fe5e3602ae
/lab2-g5-20261025-clean-valkey-1 2026-10-24T23:07:42.972426707Z sha256:752ba000a58bc8925d11ee863a39b5225617cd2cb3dbc9ec8ac65268b65ebb6d
@@ -0,0 +1 @@
PASS: same opaque token authenticates after all services restart; absolute PG expires_at unchanged; only 32-byte token hash stored
+2
View File
@@ -0,0 +1,2 @@
python3 tests/smoke.py --base-url "http://api:8080"
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
+3
View File
@@ -0,0 +1,3 @@
Container lab2-g5-20261025-clean-tools-run-fbc3441738f0 Creating
Container lab2-g5-20261025-clean-tools-run-fbc3441738f0 Created
PASS: all public and grade4 tests; isolated Compose project only
+66
View File
@@ -0,0 +1,66 @@
{
"label": "clean",
"git_head": "b5b35682c25e99f774596a809a11d2be2aaf83d8",
"dirty_at_start": " M .gitignore\n M REPORT.md\n M src/cache.py\n M src/pagination.py\n M src/store.py\n?? evidence/grade5/\n?? student-tests/grade5/\n",
"sha256": {
".dockerignore": "9c307884eda8387a781e8942b4df571ae0eee950c822aff044e7ed3d21e325f9",
".env.example": "e59c9a79b31e32811a7bc25f3bbeb4790c07c01300dbf69305ba53572b414b9d",
".gitattributes": "5500509796bdce1e591c03fd09c16f53b083f7d2370390252c569b4a17154ca6",
".github/pull_request_template.md": "f92e65c920ebc97a6078ba8260183a071240bdd3133000f849e4930cb9676c3c",
".github/workflows/application.yml": "67552988c70ea92d6c9ee229724eaa2d99905d82c51f92f4b125d65d117dc775",
".github/workflows/contracts.yml": "57acaf40811dddc83f27bc52bff3e22e60f817ef1b71d764678562ec56f5ca97",
".gitignore": "af38e822d5760f4632928a22c6a283e3ec6599c1305c4ba56762bcbf3f4bab87",
"compose.example.yaml": "68588e6bfa2f00fea39cbc35a1bac0dc4d5067e5045a27000fe7e2c49153a567",
"compose.yaml": "ce26aef52ee071760a2edd8892eb6d844863bffb11d973db3cfc5b7dcc90f5f7",
"contracts/examples.json": "f566c2a935e583caf919ea8f4faeb8da29a4e05cc5fb7626c38f7be665cb60f5",
"contracts/infrastructure.json": "2697bf8850be8661eb35db4fb0806a909f66c5c5093a990921377dddaad10629",
"contracts/openapi.json": "3aa2a5459902b66c24895db2522868fe283c91012d9f8682113396be2c93bc9c",
"contracts/README.md": "4c04faede4a2ffa35183455b51da21764b7fa3997c0a4b3963614b82586eed28",
"CONTRIBUTING.md": "08f247085938bd1efc4b8f7f48e3d520b1dc11ce569f4259491e8f01b9abd02c",
"COURSE.md": "1e3c65e345b7f89d08ed86a3b50061935ee8157907cb4043cfa40689781f54e0",
"Dockerfile": "ea5d779102372fe8792f4024afc59d23ef87cdbe2d57db6c016a87d5549dea86",
"Dockerfile.example": "37050a40f15e29ee7f5eed7b2123fea9e6531d68b5735256e4c41c60255cffc9",
"examples/requests.http": "c91533d9c88101d9d8e0eaefe473f22f96eb530d0c55c6a59ac3476e5ccff6ab",
"infra/Dockerfile.tools": "3877d05692ba4855e449f90e874a5372c8aff36ed6623e18e09229726710ce2d",
"infra/README.md": "33a4f7b870fd0b2bed98d46daf26d45dd7436176739672925246f8e3fe7c2278",
"infra/requirements-tools.lock": "b5ed5b902a10542416b0af52dacb098d795bd18f73a6fc4935f42ab751f13ab2",
"lab.json": "022ea5b6d584a2fd6c2953db1eac73ca2f0888465a5bfe210422112a3d689464",
"MAINTAINERS.md": "b8ecf2db12f074875bb3425b99a25839e228a3d40097fc38d8ac8ea66214966d",
"Makefile": "766fa4bc7666d380a72f8f6659e47ffe8aab6d223ef35dd99dd848a3de18d883",
"migrations/001_initial.sql": "5154c63cca9b5068821e5270b3d8dbc14c542b88ae5ce65422d72874118a14e5",
"README.md": "eb2f458f8afe7ad955aae85d5bbb7caae097b07667cb006dbc9b2249b0527c21",
"REPORT.md": "42969fd3a74746ec56b171ad3c6f85ed4b3037521b0ccc84cb2623077b3d4aa6",
"requirements-dev.txt": "e70f5e9db859ef3439dc6ae647890a18cd7a2752889598bbd19c822f31b7c499",
"requirements.lock": "85f6cb2e093427af72a15f177fc11452421d027b79e333660f1d56998d3a3fe3",
"requirements.txt": "575e9b5762fd5bc6698112be01f66d91db1d2221e166179fcaf1740b01ef3950",
"scripts/check_contract.py": "61e300fe5c1074360418e24b4653b12f96808247a2beaf2a64859aa360f81493",
"scripts/init-env.ps1": "9975f9ccaada4c35aa9ff476bb22607a5a5aea62a367f41a5fec27bd3ac64397",
"scripts/init-env.sh": "3343228cfc2fedc55b8edd2615589f4561dc3908325fa4f0ffecea2336d70c28",
"scripts/restart.example.sh": "7cbfc7f518b975ee3ca37a645359ff734ab0686789b795a9ac845789eb46fbd9",
"scripts/restart.sh": "0e53843e12c0af6383b365aa2248f0c674311a6a40f175d4b5fb6d089b259f64",
"scripts/run-checks.sh": "aa50996ebefc7f3b428405148f280042aff01963ea9657e015cd17c41c10ec4f",
"scripts/validate_openapi.py": "cd7a33221b1860c5d2330e52afa6cb222d375db671ae9ab379ba51a0d3a77946",
"src/__init__.py": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"src/cache.py": "c4cf175579c0f79ea1d512fbd38e9fdb25aace8359729189051dfcbafcd1f557",
"src/config.py": "7d18c6b03d1130ca633055599f13a002d05a722a86427f2c47700b65908223b5",
"src/db.py": "d21da56f3551eef2fb7e930a184264a0731eef8d6eb531929e611f8fa3df4d47",
"src/errors.py": "d34144c2b84b1b0fd15e0da574fe1ff6047d3af3cb3faeacbb1e385f221f46b6",
"src/main.py": "5c36a8dc3fa3dc84c69ebbfee94d1536619ee090da8d5d49931a99bfbd25f436",
"src/models.py": "ce2e14686881f764e00e602a3cb63253cedf698583d3f059b1afd76e4fd94a94",
"src/pagination.py": "78baa3549a7e944cdba0f27422f81560544144799a8eb37c8962fa1aa23e80c0",
"src/security.py": "43a8b463e41053fe8ab125570eb7e93bbbbc13e4f5b6599457cbec22c00dc4d6",
"src/store.py": "4834c8c78efa6b60ff681d4e75f5f8f43627ccd0c5b7bd28c061d6262b7d28c5",
"student-tests/grade4.py": "0eebbefc66a1aac185742b79a6a3aef1ed1f4566db45cb817b40d1ab18485169",
"student-tests/grade5/benchmark.py": "a14f204c2585b5e56ab9e66687606fc81b95b93e63ad47bdc6c6e73d0884fad9",
"student-tests/grade5/integration.py": "97a6b40d811cb739d559c20607c346f07e244a611f6be7d40dcb496e870d4f4e",
"student-tests/grade5/run-public.sh": "91868cb4bd82ba5200b82e69798555b5f82c7bf61eb6b0f9d4aaf09568c28802",
"student-tests/grade5/test_singleflight.py": "73d38843f9b76102b352bc3f7c59a53d9bf95f628379d3cf915c5ef011153cb4",
"student-tests/load_measure.py": "285ee517b4b7b4249bffbbbfeb03681afb93daed1974475c454f33536c58a0e3",
"student-tests/README.md": "ee837bea97ea492791416f95667cc2da1cb0e67b0d2d0f2d69bcb8b4b7a2a5e1",
"tests/client.py": "b318084e2a4c380db91a55d082190bf33979fa556a4c4ca87e01f46ae275775c",
"tests/load.py": "9a9aff05e109630e243c3b092d7bd564344e4872b29e38b6618647a08460a72e",
"tests/README.md": "89afb3063ec0ccd7cb68fdac1de57513f9cc81b77bad96f202daaca2b66a5e82",
"tests/resilience.py": "4ba30b9c81a0664127ddab2b0bea5e76aa2087be8bb25aa13cd5a8e69be23fdd",
"tests/smoke.py": "354e168e1e644145c3ff50bbbe189fd217cce5659aa125f588098025ffab0fdf"
}
}
+36
View File
@@ -0,0 +1,36 @@
Volume lab2-g5-20261025-clean_valkey_data Creating
Volume lab2-g5-20261025-clean_valkey_data Created
Volume lab2-g5-20261025-clean_postgres_data Creating
Volume lab2-g5-20261025-clean_postgres_data Created
Container lab2-g5-20261025-clean-postgres-1 Creating
Container lab2-g5-20261025-clean-valkey-1 Creating
Container lab2-g5-20261025-clean-valkey-1 Created
Container lab2-g5-20261025-clean-postgres-1 Created
Container lab2-g5-20261025-clean-api-1 Creating
Container lab2-g5-20261025-clean-api-expiry-1 Creating
Container lab2-g5-20261025-clean-api-1 Created
Container lab2-g5-20261025-clean-api-expiry-1 Created
Container lab2-g5-20261025-clean-valkey-1 Starting
Container lab2-g5-20261025-clean-postgres-1 Starting
Container lab2-g5-20261025-clean-postgres-1 Started
Container lab2-g5-20261025-clean-valkey-1 Started
Container lab2-g5-20261025-clean-postgres-1 Waiting
Container lab2-g5-20261025-clean-valkey-1 Waiting
Container lab2-g5-20261025-clean-valkey-1 Waiting
Container lab2-g5-20261025-clean-postgres-1 Waiting
Container lab2-g5-20261025-clean-valkey-1 Healthy
Container lab2-g5-20261025-clean-valkey-1 Healthy
Container lab2-g5-20261025-clean-postgres-1 Healthy
Container lab2-g5-20261025-clean-api-expiry-1 Starting
Container lab2-g5-20261025-clean-postgres-1 Healthy
Container lab2-g5-20261025-clean-api-1 Starting
Container lab2-g5-20261025-clean-api-1 Started
Container lab2-g5-20261025-clean-api-expiry-1 Started
Container lab2-g5-20261025-clean-api-1 Waiting
Container lab2-g5-20261025-clean-postgres-1 Waiting
Container lab2-g5-20261025-clean-valkey-1 Waiting
Container lab2-g5-20261025-clean-api-expiry-1 Waiting
Container lab2-g5-20261025-clean-valkey-1 Healthy
Container lab2-g5-20261025-clean-postgres-1 Healthy
Container lab2-g5-20261025-clean-api-1 Healthy
Container lab2-g5-20261025-clean-api-expiry-1 Healthy
+8
View File
@@ -0,0 +1,8 @@
Container lab2-g5-20261025-clean-api-expiry-1 Stopping
Container lab2-g5-20261025-clean-api-1 Stopping
Container lab2-g5-20261025-clean-api-1 Stopped
Container lab2-g5-20261025-clean-api-expiry-1 Stopped
Container lab2-g5-20261025-clean-postgres-1 Stopping
Container lab2-g5-20261025-clean-valkey-1 Stopping
Container lab2-g5-20261025-clean-postgres-1 Stopped
Container lab2-g5-20261025-clean-valkey-1 Stopped
+63
View File
@@ -0,0 +1,63 @@
# Executed commands and isolation
All host commands were run from C:/dev/mtusi/lab2 (PowerShell). Ordinary sandbox
launch failed with setup-refresh error; the approved escalated shell was used.
No external repository mutation or Git-index mutation was performed.
```powershell
# Initial read-only checks
git status --short --branch
git log -1 --format=fuller
git diff -- REPORT.md
git show 65003b6:REPORT.md
docker ps --format '{{.Names}} {{.Image}} {{.Status}}'
# Source snapshot before changing application
py -3.14 evidence/grade5/snapshot.py baseline
$env:G5_API_IMAGE='lab2-g5-20261025:baseline'
$env:COMPOSE_PROJECT_NAME='lab2-g5-20261025-baseline'
# research.yaml copied from evidence/grade5/compose.research.yaml into snapshot
# (-f file at measurement time did not yet contain optional api-peer service)
docker compose --project-directory .grade5-work/baseline -f .grade5-work/baseline/research.yaml build api tools
docker compose --project-directory .grade5-work/baseline -f .grade5-work/baseline/research.yaml up -d --wait api
# Pilot: same driver with --pilot and separate raw directory; original pilot used bind output.
# Completed main series (retained one-off container):
docker compose --project-directory .grade5-work/baseline -f .grade5-work/baseline/research.yaml run --name lab2-g5-baseline-measure --no-deps -v C:/dev/mtusi/lab2:/workspace:ro -w /workspace --entrypoint python api student-tests/grade5/benchmark.py --label baseline --out /tmp/g5raw
docker cp lab2-g5-baseline-measure:/tmp/g5raw evidence/grade5/raw/baseline
# Stop only baseline dependencies before candidate series
docker compose --project-directory .grade5-work/baseline -f .grade5-work/baseline/research.yaml stop api postgres valkey
# After application change; initial candidate also measured and retained separately.
py -3.14 evidence/grade5/snapshot.py final
$env:G5_API_IMAGE='lab2-g5-20261025:final'
$env:COMPOSE_PROJECT_NAME='lab2-g5-20261025-final'
docker compose --project-directory .grade5-work/final -f .grade5-work/final/research.yaml build api
docker compose --project-directory .grade5-work/final -f .grade5-work/final/research.yaml up -d --wait api
docker compose --project-directory .grade5-work/final -f .grade5-work/final/research.yaml run --name lab2-g5-final-measure --no-deps -v C:/dev/mtusi/lab2:/workspace:ro -w /workspace --entrypoint python api student-tests/grade5/benchmark.py --label candidate --out /tmp/g5raw
docker cp lab2-g5-final-measure:/tmp/g5raw evidence/grade5/raw/candidate
py -3.14 evidence/grade5/aggregate.py
# Peer/short-TTL processes started only AFTER measurement
docker compose --project-directory .grade5-work/final -f .grade5-work/final/research.yaml up -d --wait api-peer api-expiry
docker compose --project-directory .grade5-work/final -f .grade5-work/final/research.yaml run --rm tools sh student-tests/grade5/run-public.sh
docker compose --project-directory .grade5-work/final -f .grade5-work/final/research.yaml run --rm --no-deps -v C:/dev/mtusi/lab2:/workspace:ro -w /workspace --entrypoint python api student-tests/grade5/test_singleflight.py
docker compose --project-directory .grade5-work/final -f .grade5-work/final/research.yaml run --rm --no-deps -v C:/dev/mtusi/lab2:/workspace:ro -w /workspace --entrypoint python api student-tests/grade5/integration.py
docker compose --project-directory .grade5-work/final -f .grade5-work/final/research.yaml run --rm tools python student-tests/grade5/faults.py
# Clean export with original compose.yaml, unique images, no published ports
py -3.14 evidence/grade5/snapshot.py clean
$env:COMPOSE_PROJECT_NAME='lab2-g5-20261025-clean'
# Copy compose.clean-override.yaml to .grade5-work/clean/override.yaml.
# For each following command use these arguments as $argsClean:
# --project-directory .grade5-work/clean -f .grade5-work/clean/compose.yaml -f .grade5-work/clean/override.yaml --profile test
docker compose @argsClean config --quiet
docker compose @argsClean run --rm --no-deps tools sh -c 'sh scripts/init-env.sh && sh scripts/init-env.sh'
docker compose @argsClean build --no-cache api
docker compose @argsClean up -d --wait api api-expiry
docker compose @argsClean exec -T postgres psql -U messenger -d messenger -Atc 'select count(*) from users; select count(*) from chats; select count(*) from messages; select version from schema_migrations;'
docker compose @argsClean run --rm tools sh student-tests/grade5/run-public.sh
```
Output redirection goes to NEW evidence/grade5 only. Inside snapshots the Linux
scripts write their own evidence/grade5/checks, then host copies those to the main
new evidence directory. Original evidence/ and evidence/release are not overwritten.
The snapshots exclude .git/.env/secrets/cache/volumes/evidence and generate new secrets.
The clean override changes only image names, host-port publication, resource swap
budget and tools project env. API source, Dockerfile, original compose, migration,
mandatory contract and public tests are unchanged by that override.
+386
View File
@@ -0,0 +1,386 @@
[
{
"mode": "cold",
"metric": "profile_select",
"baseline": {
"median": 459,
"min": 405,
"max": 463,
"total": 1327
},
"candidate": {
"median": 32,
"min": 32,
"max": 32,
"total": 96
}
},
{
"mode": "cold",
"metric": "session_select",
"baseline": {
"median": 512,
"min": 512,
"max": 512,
"total": 1536
},
"candidate": {
"median": 512,
"min": 512,
"max": 512,
"total": 1536
}
},
{
"mode": "cold",
"metric": "all_sql",
"baseline": {
"median": 2916,
"min": 2757,
"max": 2928,
"total": 8601
},
"candidate": {
"median": 1635,
"min": 1632,
"max": 1635,
"total": 4902
}
},
{
"mode": "cold",
"metric": "rps",
"baseline": {
"median": 87.03492268826432,
"min": 78.05585876211542,
"max": 90.12440000125453,
"total": 255.21518145163427
},
"candidate": {
"median": 151.31981779063165,
"min": 147.74772266457134,
"max": 168.72521763202295,
"total": 467.79275808722593
}
},
{
"mode": "cold",
"metric": "p50_ms",
"baseline": {
"median": 151.89587700297125,
"min": 134.1529939963948,
"max": 157.6625210000202,
"total": 443.71139199938625
},
"candidate": {
"median": 69.96186201286037,
"min": 69.02896700194106,
"max": 80.16178599791601,
"total": 219.15261501271743
}
},
{
"mode": "cold",
"metric": "p95_ms",
"baseline": {
"median": 279.2545269912807,
"min": 228.55054700630717,
"max": 307.75639798957855,
"total": 815.5614719871664
},
"candidate": {
"median": 167.42004400293808,
"min": 162.78409799269866,
"max": 176.58259300515056,
"total": 506.7867350007873
}
},
{
"mode": "cold",
"metric": "p99_ms",
"baseline": {
"median": 296.8806980061345,
"min": 280.378240000573,
"max": 419.28696300601587,
"total": 996.5459010127233
},
"candidate": {
"median": 205.41033800691366,
"min": 171.43820199999027,
"max": 379.48528499691747,
"total": 756.3338250038214
}
},
{
"mode": "cold",
"metric": "errors",
"baseline": {
"median": 0,
"min": 0,
"max": 0,
"total": 0
},
"candidate": {
"median": 0,
"min": 0,
"max": 0,
"total": 0
}
},
{
"mode": "contended",
"metric": "profile_select",
"baseline": {
"median": 508,
"min": 505,
"max": 510,
"total": 1523
},
"candidate": {
"median": 32,
"min": 32,
"max": 32,
"total": 96
}
},
{
"mode": "contended",
"metric": "session_select",
"baseline": {
"median": 512,
"min": 512,
"max": 512,
"total": 1536
},
"candidate": {
"median": 512,
"min": 512,
"max": 512,
"total": 1536
}
},
{
"mode": "contended",
"metric": "all_sql",
"baseline": {
"median": 3066,
"min": 3057,
"max": 3069,
"total": 9192
},
"candidate": {
"median": 1635,
"min": 1632,
"max": 1635,
"total": 4902
}
},
{
"mode": "contended",
"metric": "rps",
"baseline": {
"median": 82.85596429159709,
"min": 73.2062135650917,
"max": 83.31293809845943,
"total": 239.3751159551482
},
"candidate": {
"median": 110.7405980395883,
"min": 108.39826722124539,
"max": 111.8132493750527,
"total": 330.9521146358864
}
},
{
"mode": "contended",
"metric": "p50_ms",
"baseline": {
"median": 165.8058409957448,
"min": 164.95823599689174,
"max": 175.41390399856027,
"total": 506.1779809911968
},
"candidate": {
"median": 128.71988299593795,
"min": 127.72483100707177,
"max": 129.90550399990752,
"total": 386.35021800291725
}
},
{
"mode": "contended",
"metric": "p95_ms",
"baseline": {
"median": 288.36483000486623,
"min": 258.85706100962125,
"max": 316.56848000420723,
"total": 863.7903710186947
},
"candidate": {
"median": 169.52931199921295,
"min": 159.63426498638,
"max": 183.96494099579286,
"total": 513.1285179813858
}
},
{
"mode": "contended",
"metric": "p99_ms",
"baseline": {
"median": 313.7811699998565,
"min": 286.3510379975196,
"max": 387.6362229930237,
"total": 987.7684309903998
},
"candidate": {
"median": 196.84646200039424,
"min": 176.83263499930035,
"max": 201.61387498956174,
"total": 575.2929719892563
}
},
{
"mode": "contended",
"metric": "errors",
"baseline": {
"median": 0,
"min": 0,
"max": 0,
"total": 0
},
"candidate": {
"median": 0,
"min": 0,
"max": 0,
"total": 0
}
},
{
"mode": "warm",
"metric": "profile_select",
"baseline": {
"median": 44,
"min": 42,
"max": 58,
"total": 144
},
"candidate": {
"median": 0,
"min": 0,
"max": 0,
"total": 0
}
},
{
"mode": "warm",
"metric": "session_select",
"baseline": {
"median": 512,
"min": 512,
"max": 512,
"total": 1536
},
"candidate": {
"median": 512,
"min": 512,
"max": 512,
"total": 1536
}
},
{
"mode": "warm",
"metric": "all_sql",
"baseline": {
"median": 1668,
"min": 1662,
"max": 1713,
"total": 5043
},
"candidate": {
"median": 1539,
"min": 1536,
"max": 1539,
"total": 4614
}
},
{
"mode": "warm",
"metric": "rps",
"baseline": {
"median": 133.07954381691303,
"min": 122.0172794707367,
"max": 137.76772980572113,
"total": 392.8645530933709
},
"candidate": {
"median": 146.02587392782206,
"min": 120.51917719944686,
"max": 160.5239720657694,
"total": 427.06902319303833
}
},
{
"mode": "warm",
"metric": "p50_ms",
"baseline": {
"median": 88.74791899870615,
"min": 85.84739499201532,
"max": 97.48369500448462,
"total": 272.0790089952061
},
"candidate": {
"median": 80.13000700157136,
"min": 71.1062610062072,
"max": 90.15365700179245,
"total": 241.38992500957102
}
},
{
"mode": "warm",
"metric": "p95_ms",
"baseline": {
"median": 181.4185749972239,
"min": 168.8572719867807,
"max": 195.08890400175005,
"total": 545.3647509857547
},
"candidate": {
"median": 174.7776830015937,
"min": 166.03210500034038,
"max": 215.76649200869724,
"total": 556.5762800106313
}
},
{
"mode": "warm",
"metric": "p99_ms",
"baseline": {
"median": 205.37955399777275,
"min": 199.6612139919307,
"max": 243.43580899585504,
"total": 648.4765769855585
},
"candidate": {
"median": 215.67739298916422,
"min": 183.8017249974655,
"max": 233.37059099867474,
"total": 632.8497089853045
}
},
{
"mode": "warm",
"metric": "errors",
"baseline": {
"median": 0,
"min": 0,
"max": 0,
"total": 0
},
"candidate": {
"median": 0,
"min": 0,
"max": 0,
"total": 0
}
}
]
+44
View File
@@ -0,0 +1,44 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1100" height="570" viewBox="0 0 1100 570"><rect width="1100" height="570" fill="white"/><style>text{font:14px sans-serif;fill:#172033}</style><text x="30" y="30" style="font-size:22px">Cache stampede: medians of 3 repeats; whiskers = min/max</text>
<text x="50" y="65">profile_select per repeat (512 HTTP requests)</text>
<path d="M50 440.0h460" stroke="#ddd"/><text x="50" y="436.0">0.0</text>
<path d="M50 357.5h460" stroke="#ddd"/><text x="50" y="353.5">142.8</text>
<path d="M50 275.0h460" stroke="#ddd"/><text x="50" y="271.0">285.6</text>
<path d="M50 192.5h460" stroke="#ddd"/><text x="50" y="188.5">428.4</text>
<path d="M50 110.0h460" stroke="#ddd"/><text x="50" y="106.0">571.2</text>
<rect x="100" y="174.8214285714286" width="32" height="265.1785714285714" fill="#e47b43"/>
<path d="M116 206.01890756302524V172.5105042016807m-6 0h12M110 206.01890756302524h12" stroke="#172033" fill="none"/><text x="96" y="164.5105042016807">459.0</text>
<rect x="142" y="421.5126050420168" width="32" height="18.48739495798319" fill="#2a8990"/>
<path d="M158 421.5126050420168V421.5126050420168m-6 0h12M152 421.5126050420168h12" stroke="#172033" fill="none"/><text x="138" y="413.5126050420168">32.0</text>
<text x="95" y="465">cold</text>
<rect x="250" y="146.51260504201684" width="32" height="293.48739495798316" fill="#e47b43"/>
<path d="M266 148.24579831932772V145.3571428571429m-6 0h12M260 148.24579831932772h12" stroke="#172033" fill="none"/><text x="246" y="137.3571428571429">508.0</text>
<rect x="292" y="421.5126050420168" width="32" height="18.48739495798319" fill="#2a8990"/>
<path d="M308 421.5126050420168V421.5126050420168m-6 0h12M302 421.5126050420168h12" stroke="#172033" fill="none"/><text x="288" y="413.5126050420168">32.0</text>
<text x="245" y="465">contended</text>
<rect x="400" y="414.5798319327731" width="32" height="25.420168067226886" fill="#e47b43"/>
<path d="M416 415.7352941176471V406.49159663865544m-6 0h12M410 415.7352941176471h12" stroke="#172033" fill="none"/><text x="396" y="398.49159663865544">44.0</text>
<rect x="442" y="440.0" width="32" height="0.0" fill="#2a8990"/>
<path d="M458 440.0V440.0m-6 0h12M452 440.0h12" stroke="#172033" fill="none"/><text x="438" y="432.0">0.0</text>
<text x="395" y="465">warm</text>
<text x="600" y="65">p95_ms per repeat (512 HTTP requests)</text>
<path d="M600 440.0h460" stroke="#ddd"/><text x="600" y="436.0">0.0</text>
<path d="M600 357.5h460" stroke="#ddd"/><text x="600" y="353.5">88.6</text>
<path d="M600 275.0h460" stroke="#ddd"/><text x="600" y="271.0">177.3</text>
<path d="M600 192.5h460" stroke="#ddd"/><text x="600" y="188.5">265.9</text>
<path d="M600 110.0h460" stroke="#ddd"/><text x="600" y="106.0">354.6</text>
<rect x="650" y="180.08672088359987" width="32" height="259.91327911640013" fill="#e47b43"/>
<path d="M666 227.27892880994898V153.5588975679495m-6 0h12M660 227.27892880994898h12" stroke="#172033" fill="none"/><text x="646" y="145.5588975679495">279.3</text>
<rect x="692" y="284.1755158082923" width="32" height="155.82448419170774" fill="#2a8990"/>
<path d="M708 288.4903748808026V275.6475675530287m-6 0h12M702 288.4903748808026h12" stroke="#172033" fill="none"/><text x="688" y="267.6475675530287">167.4</text>
<text x="645" y="465">cold</text>
<rect x="800" y="171.607400044948" width="32" height="268.392599955052" fill="#e47b43"/>
<path d="M816 199.07145257650402V145.3571428571429m-6 0h12M810 199.07145257650402h12" stroke="#172033" fill="none"/><text x="796" y="137.3571428571429">288.4</text>
<rect x="842" y="282.2123363126768" width="32" height="157.7876636873232" fill="#2a8990"/>
<path d="M858 291.42204955824457V268.7765230815236m-6 0h12M852 291.42204955824457h12" stroke="#172033" fill="none"/><text x="838" y="260.7765230815236">169.5</text>
<text x="795" y="465">contended</text>
<rect x="950" y="271.1465270476159" width="32" height="168.85347295238412" fill="#e47b43"/>
<path d="M966 282.8378306429232V258.4230089136472m-6 0h12M960 282.8378306429232h12" stroke="#172033" fill="none"/><text x="946" y="250.4230089136472">181.4</text>
<rect x="992" y="277.32746897696916" width="32" height="162.67253102303087" fill="#2a8990"/>
<path d="M1008 285.4673257612603V239.1775565265086m-6 0h12M1002 285.4673257612603h12" stroke="#172033" fill="none"/><text x="988" y="231.1775565265086">174.8</text>
<text x="945" y="465">warm</text>
<rect x="80" y="500" width="15" height="15" fill="#e47b43"/><text x="100" y="513">baseline</text><rect x="220" y="500" width="15" height="15" fill="#2a8990"/><text x="240" y="513">candidate</text><text x="50" y="548">Contended: observer locks users for ~100 ms; latency includes this controlled delay. No max-RPS claim.</text></svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

@@ -0,0 +1,18 @@
services:
api:
image: lab2-g5-20261025:clean
ports: !reset []
memswap_limit: 512m
api-expiry:
image: lab2-g5-20261025:clean
memswap_limit: 512m
postgres:
memswap_limit: 512m
valkey:
memswap_limit: 128m
tools:
image: lab2-g5-20261025:tools
environment:
COMPOSE_PROJECT_NAME: lab2-g5-20261025-clean
COMPOSE_FILE: /workspace/compose.yaml:/workspace/override.yaml
memswap_limit: 512m
+83
View File
@@ -0,0 +1,83 @@
# Dedicated research stack; run with --project-directory .grade5-work/<version>.
# Never pass the default mtusi-lab2 project name to this file.
services:
api:
image: ${G5_API_IMAGE:?set unique image tag}
build: .
environment: &env
DATABASE_URL_FILE: /run/secrets/database_url
CACHE_URL_FILE: /run/secrets/cache_url
SESSION_STORE: postgres
SESSION_TTL_SECONDS: 3600
secrets: [database_url, cache_url]
depends_on:
postgres: {condition: service_healthy}
valkey: {condition: service_healthy}
cpus: 1
mem_limit: 512m
memswap_limit: 512m
api-peer:
extends: {service: api}
api-expiry:
image: ${G5_API_IMAGE:?set unique image tag}
environment:
<<: *env
SESSION_TTL_SECONDS: 2
secrets: [database_url, cache_url]
depends_on:
postgres: {condition: service_healthy}
valkey: {condition: service_healthy}
cpus: 1
mem_limit: 512m
memswap_limit: 512m
postgres:
image: postgres:16.8-bookworm
command: [postgres, -c, shared_preload_libraries=pg_stat_statements, -c, pg_stat_statements.track=all]
environment:
POSTGRES_USER: messenger
POSTGRES_DB: messenger
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
secrets: [postgres_password]
volumes: [postgres_data:/var/lib/postgresql/data]
healthcheck:
test: [CMD-SHELL, pg_isready -U messenger -d messenger]
interval: 2s
timeout: 2s
retries: 30
cpus: 1
mem_limit: 512m
memswap_limit: 512m
valkey:
image: valkey/valkey:8.0.2-alpine
command: [valkey-server, --appendonly, 'yes', --appendfsync, everysec, --maxmemory, 96mb, --maxmemory-policy, allkeys-lru]
volumes: [valkey_data:/data]
healthcheck:
test: [CMD, valkey-cli, ping]
interval: 2s
timeout: 2s
retries: 20
cpus: 0.5
mem_limit: 128m
memswap_limit: 128m
tools:
image: lab2-g5-20261025:tools
build: {context: ., dockerfile: infra/Dockerfile.tools}
working_dir: /workspace
volumes:
- .:/workspace
- /var/run/docker.sock:/var/run/docker.sock
environment:
BASE_URL: http://api:8080
COMPOSE_PROJECT_NAME: ${COMPOSE_PROJECT_NAME:?unique test project required}
COMPOSE_FILE: /workspace/research.yaml
G5_API_IMAGE: ${G5_API_IMAGE}
cpus: 1
mem_limit: 512m
memswap_limit: 512m
secrets:
postgres_password: {file: ./secrets/postgres_password}
database_url: {file: ./secrets/database_url}
cache_url: {file: ./secrets/cache_url}
volumes:
postgres_data:
valkey_data:
+9
View File
@@ -0,0 +1,9 @@
{
"ServerVersion": "29.5.2",
"OperatingSystem": "Docker Desktop (containerized)",
"OSType": "linux",
"Architecture": "x86_64",
"NCPU": 4,
"MemTotal": 8242409472,
"KernelVersion": "6.18.54.1-microsoft-standard-WSL2"
}
+55
View File
@@ -0,0 +1,55 @@
Image lab2-g5-20261025:final Building
#1 [internal] load local bake definitions
#1 reading from stdin 549B 0.1s done
#1 DONE 0.1s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile:
#2 transferring dockerfile: 743B 0.0s done
#2 DONE 0.2s
#3 [internal] load metadata for docker.io/library/python:3.12.10-slim-bookworm
#3 DONE 1.9s
#4 [internal] load .dockerignore
#4 transferring context: 216B 0.0s done
#4 DONE 0.1s
#5 [1/6] FROM docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db
#5 resolve docker.io/library/python:3.12.10-slim-bookworm@sha256:fd95fa221297a88e1cf49c55ec1828edd7c5a428187e67b5d1805692d11588db 0.1s done
#5 DONE 0.1s
#6 [internal] load build context
#6 transferring context: 27.34kB 0.0s done
#6 DONE 0.1s
#7 [2/6] WORKDIR /app
#7 CACHED
#8 [3/6] COPY requirements.txt requirements.lock ./
#8 CACHED
#9 [4/6] RUN pip install --no-cache-dir -r requirements.lock && useradd --create-home --uid 10001 appuser
#9 CACHED
#10 [5/6] COPY --chown=appuser:appuser src ./src
#10 DONE 0.1s
#11 [6/6] COPY --chown=appuser:appuser migrations ./migrations
#11 DONE 0.1s
#12 exporting to image
#12 exporting layers
#12 exporting layers 0.2s done
#12 exporting manifest sha256:283bcf0820008a5dd65c1d96c0411e79a79e403f3e2414dc59ac20ad200d4528 0.0s done
#12 exporting config sha256:c61ee3158cd7ba5eda76ba803334dd40059079e73025822d278917793f5645a9 0.0s done
#12 exporting attestation manifest sha256:373914f32bcb1ce4a7462732b50ddac4bf791915f712b420dab943a728fd0e87 0.1s done
#12 exporting manifest list sha256:0bed5b677a58a94af1d5adb000f667310242521eac8377202d1ff35634e1c3f8
#12 exporting manifest list sha256:0bed5b677a58a94af1d5adb000f667310242521eac8377202d1ff35634e1c3f8 0.1s done
#12 naming to docker.io/library/lab2-g5-20261025:final done
#12 unpacking to docker.io/library/lab2-g5-20261025:final 0.1s done
#12 DONE 0.6s
#13 resolving provenance for metadata file
#13 DONE 0.0s
Image lab2-g5-20261025:final Built
+4
View File
@@ -0,0 +1,4 @@
time="2026-10-25T02:04:13+03:00" level=warning msg="Found orphan containers ([lab2-g5-final-measure]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up."
Container lab2-g5-20261025-final-tools-run-4abbfe8f448e Creating
Container lab2-g5-20261025-final-tools-run-4abbfe8f448e Created
PASS: all public and grade4 tests; isolated Compose project only
+66
View File
@@ -0,0 +1,66 @@
{
"label": "final",
"git_head": "b5b35682c25e99f774596a809a11d2be2aaf83d8",
"dirty_at_start": " M .gitignore\n M REPORT.md\n M src/cache.py\n M src/pagination.py\n M src/store.py\n?? evidence/grade5/\n?? student-tests/grade5/\n",
"sha256": {
".dockerignore": "9c307884eda8387a781e8942b4df571ae0eee950c822aff044e7ed3d21e325f9",
".env.example": "e59c9a79b31e32811a7bc25f3bbeb4790c07c01300dbf69305ba53572b414b9d",
".gitattributes": "5500509796bdce1e591c03fd09c16f53b083f7d2370390252c569b4a17154ca6",
".github/pull_request_template.md": "f92e65c920ebc97a6078ba8260183a071240bdd3133000f849e4930cb9676c3c",
".github/workflows/application.yml": "67552988c70ea92d6c9ee229724eaa2d99905d82c51f92f4b125d65d117dc775",
".github/workflows/contracts.yml": "57acaf40811dddc83f27bc52bff3e22e60f817ef1b71d764678562ec56f5ca97",
".gitignore": "af38e822d5760f4632928a22c6a283e3ec6599c1305c4ba56762bcbf3f4bab87",
"compose.example.yaml": "68588e6bfa2f00fea39cbc35a1bac0dc4d5067e5045a27000fe7e2c49153a567",
"compose.yaml": "ce26aef52ee071760a2edd8892eb6d844863bffb11d973db3cfc5b7dcc90f5f7",
"contracts/examples.json": "f566c2a935e583caf919ea8f4faeb8da29a4e05cc5fb7626c38f7be665cb60f5",
"contracts/infrastructure.json": "2697bf8850be8661eb35db4fb0806a909f66c5c5093a990921377dddaad10629",
"contracts/openapi.json": "3aa2a5459902b66c24895db2522868fe283c91012d9f8682113396be2c93bc9c",
"contracts/README.md": "4c04faede4a2ffa35183455b51da21764b7fa3997c0a4b3963614b82586eed28",
"CONTRIBUTING.md": "08f247085938bd1efc4b8f7f48e3d520b1dc11ce569f4259491e8f01b9abd02c",
"COURSE.md": "1e3c65e345b7f89d08ed86a3b50061935ee8157907cb4043cfa40689781f54e0",
"Dockerfile": "ea5d779102372fe8792f4024afc59d23ef87cdbe2d57db6c016a87d5549dea86",
"Dockerfile.example": "37050a40f15e29ee7f5eed7b2123fea9e6531d68b5735256e4c41c60255cffc9",
"examples/requests.http": "c91533d9c88101d9d8e0eaefe473f22f96eb530d0c55c6a59ac3476e5ccff6ab",
"infra/Dockerfile.tools": "3877d05692ba4855e449f90e874a5372c8aff36ed6623e18e09229726710ce2d",
"infra/README.md": "33a4f7b870fd0b2bed98d46daf26d45dd7436176739672925246f8e3fe7c2278",
"infra/requirements-tools.lock": "b5ed5b902a10542416b0af52dacb098d795bd18f73a6fc4935f42ab751f13ab2",
"lab.json": "022ea5b6d584a2fd6c2953db1eac73ca2f0888465a5bfe210422112a3d689464",
"MAINTAINERS.md": "b8ecf2db12f074875bb3425b99a25839e228a3d40097fc38d8ac8ea66214966d",
"Makefile": "766fa4bc7666d380a72f8f6659e47ffe8aab6d223ef35dd99dd848a3de18d883",
"migrations/001_initial.sql": "5154c63cca9b5068821e5270b3d8dbc14c542b88ae5ce65422d72874118a14e5",
"README.md": "eb2f458f8afe7ad955aae85d5bbb7caae097b07667cb006dbc9b2249b0527c21",
"REPORT.md": "42969fd3a74746ec56b171ad3c6f85ed4b3037521b0ccc84cb2623077b3d4aa6",
"requirements-dev.txt": "e70f5e9db859ef3439dc6ae647890a18cd7a2752889598bbd19c822f31b7c499",
"requirements.lock": "85f6cb2e093427af72a15f177fc11452421d027b79e333660f1d56998d3a3fe3",
"requirements.txt": "575e9b5762fd5bc6698112be01f66d91db1d2221e166179fcaf1740b01ef3950",
"scripts/check_contract.py": "61e300fe5c1074360418e24b4653b12f96808247a2beaf2a64859aa360f81493",
"scripts/init-env.ps1": "9975f9ccaada4c35aa9ff476bb22607a5a5aea62a367f41a5fec27bd3ac64397",
"scripts/init-env.sh": "3343228cfc2fedc55b8edd2615589f4561dc3908325fa4f0ffecea2336d70c28",
"scripts/restart.example.sh": "7cbfc7f518b975ee3ca37a645359ff734ab0686789b795a9ac845789eb46fbd9",
"scripts/restart.sh": "0e53843e12c0af6383b365aa2248f0c674311a6a40f175d4b5fb6d089b259f64",
"scripts/run-checks.sh": "aa50996ebefc7f3b428405148f280042aff01963ea9657e015cd17c41c10ec4f",
"scripts/validate_openapi.py": "cd7a33221b1860c5d2330e52afa6cb222d375db671ae9ab379ba51a0d3a77946",
"src/__init__.py": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"src/cache.py": "c4cf175579c0f79ea1d512fbd38e9fdb25aace8359729189051dfcbafcd1f557",
"src/config.py": "7d18c6b03d1130ca633055599f13a002d05a722a86427f2c47700b65908223b5",
"src/db.py": "d21da56f3551eef2fb7e930a184264a0731eef8d6eb531929e611f8fa3df4d47",
"src/errors.py": "d34144c2b84b1b0fd15e0da574fe1ff6047d3af3cb3faeacbb1e385f221f46b6",
"src/main.py": "5c36a8dc3fa3dc84c69ebbfee94d1536619ee090da8d5d49931a99bfbd25f436",
"src/models.py": "ce2e14686881f764e00e602a3cb63253cedf698583d3f059b1afd76e4fd94a94",
"src/pagination.py": "78baa3549a7e944cdba0f27422f81560544144799a8eb37c8962fa1aa23e80c0",
"src/security.py": "43a8b463e41053fe8ab125570eb7e93bbbbc13e4f5b6599457cbec22c00dc4d6",
"src/store.py": "4834c8c78efa6b60ff681d4e75f5f8f43627ccd0c5b7bd28c061d6262b7d28c5",
"student-tests/grade4.py": "0eebbefc66a1aac185742b79a6a3aef1ed1f4566db45cb817b40d1ab18485169",
"student-tests/grade5/benchmark.py": "a14f204c2585b5e56ab9e66687606fc81b95b93e63ad47bdc6c6e73d0884fad9",
"student-tests/grade5/integration.py": "97a6b40d811cb739d559c20607c346f07e244a611f6be7d40dcb496e870d4f4e",
"student-tests/grade5/run-public.sh": "91868cb4bd82ba5200b82e69798555b5f82c7bf61eb6b0f9d4aaf09568c28802",
"student-tests/grade5/test_singleflight.py": "73d38843f9b76102b352bc3f7c59a53d9bf95f628379d3cf915c5ef011153cb4",
"student-tests/load_measure.py": "285ee517b4b7b4249bffbbbfeb03681afb93daed1974475c454f33536c58a0e3",
"student-tests/README.md": "ee837bea97ea492791416f95667cc2da1cb0e67b0d2d0f2d69bcb8b4b7a2a5e1",
"tests/client.py": "b318084e2a4c380db91a55d082190bf33979fa556a4c4ca87e01f46ae275775c",
"tests/load.py": "9a9aff05e109630e243c3b092d7bd564344e4872b29e38b6618647a08460a72e",
"tests/README.md": "89afb3063ec0ccd7cb68fdac1de57513f9cc81b77bad96f202daaca2b66a5e82",
"tests/resilience.py": "4ba30b9c81a0664127ddab2b0bea5e76aa2087be8bb25aa13cd5a8e69be23fdd",
"tests/smoke.py": "354e168e1e644145c3ff50bbbe189fd217cce5659aa125f588098025ffab0fdf"
}
}
+28
View File
@@ -0,0 +1,28 @@
Network lab2-g5-20261025-final_default Creating
Network lab2-g5-20261025-final_default Created
Volume lab2-g5-20261025-final_postgres_data Creating
Volume lab2-g5-20261025-final_postgres_data Created
Volume lab2-g5-20261025-final_valkey_data Creating
Volume lab2-g5-20261025-final_valkey_data Created
Container lab2-g5-20261025-final-valkey-1 Creating
Container lab2-g5-20261025-final-postgres-1 Creating
Container lab2-g5-20261025-final-valkey-1 Created
Container lab2-g5-20261025-final-postgres-1 Created
Container lab2-g5-20261025-final-api-1 Creating
Container lab2-g5-20261025-final-api-1 Created
Container lab2-g5-20261025-final-valkey-1 Starting
Container lab2-g5-20261025-final-postgres-1 Starting
Container lab2-g5-20261025-final-valkey-1 Started
Container lab2-g5-20261025-final-postgres-1 Started
Container lab2-g5-20261025-final-postgres-1 Waiting
Container lab2-g5-20261025-final-valkey-1 Waiting
Container lab2-g5-20261025-final-valkey-1 Healthy
Container lab2-g5-20261025-final-postgres-1 Healthy
Container lab2-g5-20261025-final-api-1 Starting
Container lab2-g5-20261025-final-api-1 Started
Container lab2-g5-20261025-final-valkey-1 Waiting
Container lab2-g5-20261025-final-api-1 Waiting
Container lab2-g5-20261025-final-postgres-1 Waiting
Container lab2-g5-20261025-final-postgres-1 Healthy
Container lab2-g5-20261025-final-valkey-1 Healthy
Container lab2-g5-20261025-final-api-1 Healthy
+10
View File
@@ -0,0 +1,10 @@
Container lab2-g5-20261025-final-api-peer-1 Stopping
Container lab2-g5-20261025-final-api-expiry-1 Stopping
Container lab2-g5-20261025-final-api-1 Stopping
Container lab2-g5-20261025-final-api-peer-1 Stopped
Container lab2-g5-20261025-final-api-expiry-1 Stopped
Container lab2-g5-20261025-final-api-1 Stopped
Container lab2-g5-20261025-final-postgres-1 Stopping
Container lab2-g5-20261025-final-valkey-1 Stopping
Container lab2-g5-20261025-final-valkey-1 Stopped
Container lab2-g5-20261025-final-postgres-1 Stopped
+27
View File
@@ -0,0 +1,27 @@
time="2026-10-25T02:04:03+03:00" level=warning msg="Found orphan containers ([lab2-g5-final-measure]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up."
Container lab2-g5-20261025-final-postgres-1 Running
Container lab2-g5-20261025-final-valkey-1 Running
Container lab2-g5-20261025-final-api-peer-1 Creating
Container lab2-g5-20261025-final-api-expiry-1 Creating
Container lab2-g5-20261025-final-api-peer-1 Created
Container lab2-g5-20261025-final-api-expiry-1 Created
Container lab2-g5-20261025-final-postgres-1 Waiting
Container lab2-g5-20261025-final-valkey-1 Waiting
Container lab2-g5-20261025-final-valkey-1 Waiting
Container lab2-g5-20261025-final-postgres-1 Waiting
Container lab2-g5-20261025-final-postgres-1 Healthy
Container lab2-g5-20261025-final-valkey-1 Healthy
Container lab2-g5-20261025-final-api-expiry-1 Starting
Container lab2-g5-20261025-final-valkey-1 Healthy
Container lab2-g5-20261025-final-postgres-1 Healthy
Container lab2-g5-20261025-final-api-peer-1 Starting
Container lab2-g5-20261025-final-api-expiry-1 Started
Container lab2-g5-20261025-final-api-peer-1 Started
Container lab2-g5-20261025-final-postgres-1 Waiting
Container lab2-g5-20261025-final-valkey-1 Waiting
Container lab2-g5-20261025-final-api-peer-1 Waiting
Container lab2-g5-20261025-final-api-expiry-1 Waiting
Container lab2-g5-20261025-final-valkey-1 Healthy
Container lab2-g5-20261025-final-postgres-1 Healthy
Container lab2-g5-20261025-final-api-expiry-1 Healthy
Container lab2-g5-20261025-final-api-peer-1 Healthy
+10
View File
@@ -0,0 +1,10 @@
## solution/bvt2301-gamayunov...origin/solution/bvt2301-gamayunov
M .gitattributes
M .gitignore
M REPORT.md
M src/cache.py
M src/pagination.py
M src/store.py
?? PR_GRADE5_DRAFT.md
?? evidence/grade5/
?? student-tests/grade5/
+5
View File
@@ -0,0 +1,5 @@
{
"Name": "Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz",
"NumberOfCores": 2,
"NumberOfLogicalProcessors": 4
}
+3
View File
@@ -0,0 +1,3 @@
["lab2-g5-20261025:baseline"] sha256:6f6b9e436cb3d56af50f8625fc6c94f81bf39146e88457975c115ef482c3611a
["lab2-g5-20261025:candidate"] sha256:29327f76555981332a4d38c7c36279916123a57b220981c9af359f892e7bdd49
["lab2-g5-20261025:final"] sha256:0bed5b677a58a94af1d5adb000f667310242521eac8377202d1ff35634e1c3f8
+4
View File
@@ -0,0 +1,4 @@
["lab2-g5-20261025:baseline"] sha256:6f6b9e436cb3d56af50f8625fc6c94f81bf39146e88457975c115ef482c3611a ["lab2-g5-20261025@sha256:6f6b9e436cb3d56af50f8625fc6c94f81bf39146e88457975c115ef482c3611a"]
["lab2-g5-20261025:tools"] sha256:e2a5288bf0a21581a1587866539a7f8aff98a927af4fc2c96f11cd7716392707 ["lab2-g5-20261025@sha256:e2a5288bf0a21581a1587866539a7f8aff98a927af4fc2c96f11cd7716392707"]
["postgres:16.8-bookworm"] sha256:301bcb60b8a3ee4ab7e147932723e3abd1cef53516ce5210b39fd9fe5e3602ae ["postgres@sha256:301bcb60b8a3ee4ab7e147932723e3abd1cef53516ce5210b39fd9fe5e3602ae"]
["valkey/valkey:8.0.2-alpine"] sha256:752ba000a58bc8925d11ee863a39b5225617cd2cb3dbc9ec8ac65268b65ebb6d ["valkey/valkey@sha256:752ba000a58bc8925d11ee863a39b5225617cd2cb3dbc9ec8ac65268b65ebb6d"]
@@ -0,0 +1,10 @@
Container lab2-g5-20261025-candidate-api-1 Stopping
Container lab2-g5-20261025-candidate-api-peer-1 Stopping
Container lab2-g5-20261025-candidate-api-expiry-1 Stopping
Container lab2-g5-20261025-candidate-api-1 Stopped
Container lab2-g5-20261025-candidate-api-peer-1 Stopped
Container lab2-g5-20261025-candidate-api-expiry-1 Stopped
Container lab2-g5-20261025-candidate-postgres-1 Stopping
Container lab2-g5-20261025-candidate-valkey-1 Stopping
Container lab2-g5-20261025-candidate-valkey-1 Stopped
Container lab2-g5-20261025-candidate-postgres-1 Stopped
@@ -0,0 +1,3 @@
/mtusi-lab2-api-1 sha256:cbe9af6839830fd268490f97f97c9eae922339b03a6f9983914a330355a27568 2026-10-23T14:45:58.34525479Z running
/mtusi-lab2-postgres-1 sha256:301bcb60b8a3ee4ab7e147932723e3abd1cef53516ce5210b39fd9fe5e3602ae 2026-10-23T14:03:28.945403946Z running
/mtusi-lab2-valkey-1 sha256:752ba000a58bc8925d11ee863a39b5225617cd2cb3dbc9ec8ac65268b65ebb6d 2026-10-23T14:03:29.035085194Z running
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
"""Create a review ZIP entirely under the repo; never stages or publishes anything."""
import datetime, hashlib, json, stat, zipfile
from pathlib import Path
ROOT=Path(__file__).resolve().parents[2];E=ROOT/'evidence/grade5'
EXCLUDE={'.git','.grade5-work','.env','secrets','cache','volumes','.venv','__pycache__','node_modules','data','backups'}
RECORD='evidence/grade5/review-archive.json';INVENTORY='evidence/grade5/review-inventory.json'
def allowed(p):
rel=p.relative_to(ROOT)
return p.is_file() and not any(v in EXCLUDE for v in rel.parts) and not p.name.startswith('review-grade5') and p.suffix not in ['.pyc','.pyo','.log','.key','.pem','.p12','.pfx'] and not (p.name.startswith('.env.') and p.name!='.env.example') and rel.as_posix() not in [RECORD,INVENTORY]
def sha(data):return hashlib.sha256(data).hexdigest()
def main():
files=sorted(p for p in ROOT.rglob('*') if allowed(p));manifest={p.relative_to(ROOT).as_posix():sha(p.read_bytes()) for p in files}
(ROOT/INVENTORY).write_text(json.dumps({'files_sha256':manifest,'excluded_metadata':[RECORD,INVENTORY],'note':'Inventory omits its own hash and external archive checksum record to avoid self-reference. All source/raw bytes preserved.'},indent=2),encoding='utf-8')
files.append(ROOT/INVENTORY)
target=ROOT/'review-grade5-2026-10-25.zip'
with zipfile.ZipFile(target,'w',zipfile.ZIP_DEFLATED,compresslevel=6) as archive:
for f in files:
info=zipfile.ZipInfo.from_file(f,f.relative_to(ROOT).as_posix());info.create_system=3
mode=0o755 if f.suffix=='.sh' else 0o644
info.external_attr=(stat.S_IFREG|mode)<<16
info.compress_type=zipfile.ZIP_DEFLATED
archive.writestr(info,f.read_bytes())
configured=[]
for folder in [ROOT/'secrets',*(ROOT/'.grade5-work').glob('*/secrets')]:
if folder.exists():
for f in folder.iterdir():
if f.is_file():
value=f.read_bytes().strip()
if len(value)>=24:configured.append(value)
with zipfile.ZipFile(target) as archive:
assert archive.testzip() is None
for entry in archive.infolist():
assert not any(p in EXCLUDE for p in Path(entry.filename).parts),entry.filename
content=archive.read(entry)
assert not any(v in content for v in configured),'private value in '+entry.filename
if entry.filename in manifest:assert sha(content)==manifest[entry.filename]
modes={n:oct((archive.getinfo(n).external_attr>>16)&0o777) for n in ['scripts/init-env.sh','scripts/restart.sh','scripts/run-checks.sh']}
assert all(v=='0o755' for v in modes.values())
record={'archive':target.name,'sha256':sha(target.read_bytes()),'bytes':target.stat().st_size,'file_count':len(files),'scripts_modes':modes,'verified':'CRC, every source/raw SHA, exclusions and configured secrets checked; no Git writes','metadata_outside_zip':RECORD}
(ROOT/RECORD).write_text(json.dumps(record,indent=2),encoding='utf-8')
print(json.dumps(record,indent=2))
if __name__=='__main__':main()
+20
View File
@@ -0,0 +1,20 @@
{
"date_local": "2026-10-25 Europe/Moscow",
"clients": 16,
"repeats": 3,
"bursts_per_mode_repeat": 32,
"modes": ["cold", "contended", "warm"],
"contended_users_lock_seconds": 0.1,
"request_budget_per_version": 4608,
"warmup": "one GET me and one health/live per persistent client before modes; TTL reset only for synthetic user",
"cache_reset": "DEL own profile UUID before each cold/contended burst; warm primed before burst; no FLUSH",
"sql": "pg_stat_statements app-role deltas before/after each burst; observer role excluded; all app statements including transaction/health statements retained",
"ordering": "baseline then candidate, repeat modes rotate; identical plan; pilot excluded",
"http_timeout_seconds": 6,
"api": {"cpu": 1, "memory_mib": 512, "swap_mib": 0, "workers": 1, "threads": 16, "pg_pool": [1,8], "pg_pool_wait_seconds": 2},
"postgres": {"cpu": 1, "memory_mib": 512, "swap_mib": 0},
"valkey": {"cpu": 0.5, "memory_mib": 128, "swap_mib": 0},
"driver": {"cpu": 1, "memory_mib": 512, "swap_mib": 0},
"raw": "per-request CSV plus per-burst normalized real SQL deltas and duration; no bodies, tokens or credentials",
"quantiles": "nearest rank over successful requests per mode/repeat; median and min/max across repeats; only 512 observations per percentile, limited p99 precision"
}
+47
View File
@@ -0,0 +1,47 @@
# Provenance and diagnostic attempts
The primary comparison uses **raw/baseline/** and **raw/candidate/** only.
The primary baseline was completed before any application algorithm change.
`baseline-source.json` + `baseline-source.zip` preserve the initial tree (HEAD
b5b35682c25e99f774596a809a11d2be2aaf83d8, original REPORT edit already present).
`final-source.json` and raw/candidate/meta.json identify the final measured candidate.
Per-source hashes in measured images are checked against the final working tree.
Excluded observations are preserved, never silently called successful repeats:
- baseline-pilot: 96 HTTP requests, load and duration pilot, outside main aggregates.
- baseline-failed-attempt-1: partial series stopped by Windows bind-mount
OSError errno22 while rewriting bursts.json; see failure.json/stdout. Requests.csv
may include the last wave for which SQL deltas were not saved. No completed
metadata. Entire series repeated using /tmp in container + docker cp afterward.
- candidate-pilot: 96 HTTP requests on initial implementation, outside aggregates.
- candidate-before-text-fix: completed 4608 requests, initial implementation with
accidental mojibake in some Russian error messages caused by Windows Python's
default read_text encoding. This does not exercise the changed error strings
in GET me, but this image is nevertheless NOT the delivered candidate. Text was
restored from original baseline; whole candidate benchmark, public/grade4 and
additional integration checks were repeated on the final image. The initial
candidate observations remain historical and are excluded from comparisons.
Resource samples are diagnostic only: baseline-resources-sample.jsonl was sampled
in the interrupted baseline attempt; candidate-resources-sample.jsonl in the
initial candidate (before text fix). They are NOT synchronized CPU averages/peaks,
NOT the final pair, and do not support a CPU/RAM improvement claim. Budgets and
measured image resource limits are recorded separately. No before/after CPU cost
measurement was made. Final CPU overhead and peak memory remain unquantified.
Benchmark phases use exactly the same HTTP generator, plan and PG counters.
Only raw persistence was moved from a Windows bind mount into container /tmp.
Driver UTF-8 BOM normalization does not change executable code; no source delay,
HTTP barrier hook or metrics endpoint was inserted into API. The observer role
owns counter inspection and explicit users-table locks; app-role SQL excludes
these observer statements. Ordinary API healthcheck SQL is included and classified.
Experiment figures and median/min/max tables are generated only by aggregate.py.
Per-request 4xx/5xx/timeouts and per-statement SQL deltas stay in raw files.
The date in meta.json's historical `started_utc` field was recorded at completion;
interpret it as completion UTC, not as exact start time; subtract wall_s only for
an approximation. Host file timestamps and build/run logs add chronology.
The original grade4 evidence files are unchanged and retain historical statuses,
image tags and Git instructions. The current report supersedes those old statuses.
+4
View File
@@ -0,0 +1,4 @@
time="2026-10-25T01:59:33+03:00" level=warning msg="Found orphan containers ([lab2-g5-candidate-measure lab2-g5-candidate-pilot]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up."
Container lab2-g5-20261025-candidate-tools-run-b1a91ff96461 Creating
Container lab2-g5-20261025-candidate-tools-run-b1a91ff96461 Created
PASS: all public and grade4 tests; isolated Compose project only
+276
View File
@@ -0,0 +1,276 @@
{
"status": "READY",
"scope": "publication preparation only; no source logic changes or new load series",
"temporary_repo": "C:\\dev\\mtusi\\lab2\\.grade5-work\\publication-20261025-115550\\staging-repo",
"core_autocrlf": true,
"core_whitespace": "blank-at-eol,blank-at-eof,space-before-tab",
"raw_files": 18,
"raw_sha256_before_after_identical": true,
"raw_checksums": [
"281dcf2317cb42c064d9c9fd1ee43294106f9d400347e077e48cb7be847747c2 raw/baseline/bursts.json",
"5b423a05ca05ad36c7707c1527d60796fce1ce525b4e83e0fe2ed8cfbb3ba33d raw/baseline/meta.json",
"a00c7ef0d6f76808f878de5b109d8bd3986c7f98da27074561bf87da8b847e6a raw/baseline/requests.csv",
"ca5e3453014f4ea421340fa7c0220b5ad6c3cc28e94e36b745e3f0f45e8d7197 raw/baseline-failed-attempt-1/bursts.json",
"08561c7abc68af078fa18d200a35cd48805b2462e786a534cadc0f39b0de2658 raw/baseline-failed-attempt-1/failure.json",
"0ef08f062abe5d5645f2c507c44d5e67ac78ef9dab3758b7e5ca7215a26cf138 raw/baseline-failed-attempt-1/requests.csv",
"a9e19b5c244166c83d3a8a84364f523429be194db9e8e153d0fe50c7a9b2d1bf raw/baseline-pilot/bursts.json",
"f1c2b0863883b8f3300b971c8ff026729fdac52dd24bd0a7a096c2a6a239c9af raw/baseline-pilot/meta.json",
"a9d2fb5273829ee410b930001ab79832b939d7ef2e92368749fca226f140151c raw/baseline-pilot/requests.csv",
"9b65a150fa94e400f6cf5feffbad2fd097560ec80536f4bcd4ebc331d90d04b8 raw/candidate/bursts.json",
"e1f79416708bf9ef7b8447945b1b620a531c1744e5c7b298d7d90eb768859446 raw/candidate/meta.json",
"1147cf49a59b131736c74bcc5ca8ca2097eaa09801c1538af43838ff87eb24e7 raw/candidate/requests.csv",
"bc88927933cc583f6d81e71a69f8ec5a3691535d9de5b5c3bb49da76835e0dd1 raw/candidate-before-text-fix/bursts.json",
"3a4fa47d8a115ae128db2ec16eb0ca58669b71bd93add785a321cb07cbfb01d0 raw/candidate-before-text-fix/meta.json",
"9e4b727cfe6dec678f63f918c8f01ad983443b29682958fa240af80463b785b6 raw/candidate-before-text-fix/requests.csv",
"9e91f09e24f13b014bb4119d2454ba0b06855cbeb0b1eea429df9845325833f9 raw/candidate-pilot/bursts.json",
"07aca84c528ab212d95222ec5198bc10f1383a9b848e9aee83092b81acc091ef raw/candidate-pilot/meta.json",
"0267a684e0816ebc3a2aca903b1803fa93981f4ed3d3d3c144c2be94daf18078 raw/candidate-pilot/requests.csv"
],
"baseline_source_zip_sha256": "0339196ea48433e5a041ce5592a3834e788e774ef566ce03e3095bd781404c47",
"baseline_source_zip_unchanged": true,
"src_sha256_before_after_identical": true,
"src_sha256": {
"src/__init__.py": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"src/cache.py": "c4cf175579c0f79ea1d512fbd38e9fdb25aace8359729189051dfcbafcd1f557",
"src/config.py": "7d18c6b03d1130ca633055599f13a002d05a722a86427f2c47700b65908223b5",
"src/db.py": "d21da56f3551eef2fb7e930a184264a0731eef8d6eb531929e611f8fa3df4d47",
"src/errors.py": "d34144c2b84b1b0fd15e0da574fe1ff6047d3af3cb3faeacbb1e385f221f46b6",
"src/main.py": "5c36a8dc3fa3dc84c69ebbfee94d1536619ee090da8d5d49931a99bfbd25f436",
"src/models.py": "ce2e14686881f764e00e602a3cb63253cedf698583d3f059b1afd76e4fd94a94",
"src/pagination.py": "78baa3549a7e944cdba0f27422f81560544144799a8eb37c8962fa1aa23e80c0",
"src/security.py": "43a8b463e41053fe8ab125570eb7e93bbbbc13e4f5b6599457cbec22c00dc4d6",
"src/store.py": "4834c8c78efa6b60ff681d4e75f5f8f43627ccd0c5b7bd28c061d6262b7d28c5"
},
"main_git_metadata_before_after_identical": true,
"protected_files_verified": 99,
"normalized_text_files": [
"evidence/grade5/audit.json",
"evidence/grade5/audit.md",
"evidence/grade5/baseline-build.txt",
"evidence/grade5/baseline-failed-attempt-1.txt",
"evidence/grade5/baseline-pilot.txt",
"evidence/grade5/baseline-run.txt",
"evidence/grade5/baseline-source.json",
"evidence/grade5/baseline-start.txt",
"evidence/grade5/baseline-stop.txt",
"evidence/grade5/candidate-before-text-fix-source.json",
"evidence/grade5/candidate-before-text-fix.txt",
"evidence/grade5/candidate-build.txt",
"evidence/grade5/candidate-pilot.txt",
"evidence/grade5/candidate-run.txt",
"evidence/grade5/candidate-start.txt",
"evidence/grade5/checks/cache-integration.txt",
"evidence/grade5/checks/cache-recovery.txt",
"evidence/grade5/checks/explain.txt",
"evidence/grade5/checks/persistence.txt",
"evidence/grade5/checks/smoke.txt",
"evidence/grade5/checks/unit.txt",
"evidence/grade5/clean-bootstrap.txt",
"evidence/grade5/clean-build.txt",
"evidence/grade5/clean-checks/explain.txt",
"evidence/grade5/clean-checks/persistence.txt",
"evidence/grade5/clean-checks/smoke.txt",
"evidence/grade5/clean-public-run.txt",
"evidence/grade5/clean-source.json",
"evidence/grade5/clean-start.txt",
"evidence/grade5/clean-stop.txt",
"evidence/grade5/commands.md",
"evidence/grade5/comparison.json",
"evidence/grade5/comparison.svg",
"evidence/grade5/compose.clean-override.yaml",
"evidence/grade5/docker-environment.json",
"evidence/grade5/final-build.txt",
"evidence/grade5/final-public-run.txt",
"evidence/grade5/final-source.json",
"evidence/grade5/final-start.txt",
"evidence/grade5/final-stop.txt",
"evidence/grade5/final-test-services.txt",
"evidence/grade5/host-cpu.json",
"evidence/grade5/initial-candidate-stop.txt",
"evidence/grade5/package_review.py",
"evidence/grade5/plan.json",
"evidence/grade5/provenance.md",
"evidence/grade5/public-run.txt",
"evidence/grade5/PUBLISH.md",
"evidence/grade5/raw-sha256.txt",
"evidence/grade5/README.md",
"evidence/grade5/replay-verification.json",
"evidence/grade5/reproduce-check.txt",
"evidence/grade5/requirements.md",
"evidence/grade5/results.md",
"evidence/grade5/review-archive.json",
"evidence/grade5/review-inventory.json",
"evidence/grade5/runs.csv",
"evidence/grade5/source-fingerprint.json",
"evidence/grade5/test-services-start.txt"
],
"offline_audit": "PASS",
"independent_aggregate_recalculation": {
"runs": 18,
"result": "unchanged",
"profile_select": [
2994,
192
],
"session_select": [
4608,
4608
],
"all_sql": [
22836,
14418
],
"successful_http": [
4608,
4608
]
},
"unit_tests": {
"passed": 5,
"network": "none",
"image": "lab2-g5-20261025:final"
},
"staging_check": {
"exit_code": 0,
"output_bytes": 0
},
"negative_whitespace_control": "real trailing spaces rejected, including raw path",
"raw_and_zip_index_byte_identity": true,
"shell_modes": {
"scripts/init-env.sh": "100755",
"scripts/restart.sh": "100755",
"scripts/run-checks.sh": "100755"
},
"staged_paths": [
".gitattributes",
".gitignore",
"REPORT.md",
"evidence/grade5/PUBLISH.md",
"evidence/grade5/README.md",
"evidence/grade5/aggregate.py",
"evidence/grade5/audit.json",
"evidence/grade5/audit.md",
"evidence/grade5/audit.py",
"evidence/grade5/baseline-build.txt",
"evidence/grade5/baseline-failed-attempt-1.txt",
"evidence/grade5/baseline-pilot.txt",
"evidence/grade5/baseline-resources-sample.jsonl",
"evidence/grade5/baseline-run.txt",
"evidence/grade5/baseline-source.json",
"evidence/grade5/baseline-source.zip",
"evidence/grade5/baseline-start.txt",
"evidence/grade5/baseline-stop.txt",
"evidence/grade5/candidate-before-text-fix-source.json",
"evidence/grade5/candidate-before-text-fix.txt",
"evidence/grade5/candidate-build.txt",
"evidence/grade5/candidate-pilot.txt",
"evidence/grade5/candidate-pretests-counts.txt",
"evidence/grade5/candidate-resources-sample.jsonl",
"evidence/grade5/candidate-run.txt",
"evidence/grade5/candidate-start.txt",
"evidence/grade5/changed-files.txt",
"evidence/grade5/checks/cache-integration.txt",
"evidence/grade5/checks/cache-recovery.txt",
"evidence/grade5/checks/checks.txt",
"evidence/grade5/checks/core.txt",
"evidence/grade5/checks/expiry.txt",
"evidence/grade5/checks/explain.txt",
"evidence/grade5/checks/failures.txt",
"evidence/grade5/checks/migrations.txt",
"evidence/grade5/checks/persistence.txt",
"evidence/grade5/checks/session-persistence.txt",
"evidence/grade5/checks/smoke.txt",
"evidence/grade5/checks/unit.txt",
"evidence/grade5/clean-bootstrap.txt",
"evidence/grade5/clean-build.txt",
"evidence/grade5/clean-checks/checks.txt",
"evidence/grade5/clean-checks/core.txt",
"evidence/grade5/clean-checks/expiry.txt",
"evidence/grade5/clean-checks/explain.txt",
"evidence/grade5/clean-checks/failures.txt",
"evidence/grade5/clean-checks/migrations.txt",
"evidence/grade5/clean-checks/persistence.txt",
"evidence/grade5/clean-checks/session-persistence.txt",
"evidence/grade5/clean-checks/smoke.txt",
"evidence/grade5/clean-public-run.txt",
"evidence/grade5/clean-source.json",
"evidence/grade5/clean-start.txt",
"evidence/grade5/clean-stop.txt",
"evidence/grade5/commands.md",
"evidence/grade5/comparison.json",
"evidence/grade5/comparison.svg",
"evidence/grade5/compose.clean-override.yaml",
"evidence/grade5/compose.research.yaml",
"evidence/grade5/docker-environment.json",
"evidence/grade5/final-build.txt",
"evidence/grade5/final-public-run.txt",
"evidence/grade5/final-source.json",
"evidence/grade5/final-start.txt",
"evidence/grade5/final-stop.txt",
"evidence/grade5/final-test-services.txt",
"evidence/grade5/git-final-status.txt",
"evidence/grade5/host-cpu.json",
"evidence/grade5/images-apps.txt",
"evidence/grade5/images-baseline.txt",
"evidence/grade5/initial-candidate-stop.txt",
"evidence/grade5/original-stack-unchanged.txt",
"evidence/grade5/package_review.py",
"evidence/grade5/plan.json",
"evidence/grade5/provenance.md",
"evidence/grade5/public-run.txt",
"evidence/grade5/publication-audit.json",
"evidence/grade5/publication-checks.txt",
"evidence/grade5/raw-sha256.txt",
"evidence/grade5/raw/baseline-failed-attempt-1/bursts.json",
"evidence/grade5/raw/baseline-failed-attempt-1/failure.json",
"evidence/grade5/raw/baseline-failed-attempt-1/requests.csv",
"evidence/grade5/raw/baseline-pilot/bursts.json",
"evidence/grade5/raw/baseline-pilot/meta.json",
"evidence/grade5/raw/baseline-pilot/requests.csv",
"evidence/grade5/raw/baseline/bursts.json",
"evidence/grade5/raw/baseline/meta.json",
"evidence/grade5/raw/baseline/requests.csv",
"evidence/grade5/raw/candidate-before-text-fix/bursts.json",
"evidence/grade5/raw/candidate-before-text-fix/meta.json",
"evidence/grade5/raw/candidate-before-text-fix/requests.csv",
"evidence/grade5/raw/candidate-pilot/bursts.json",
"evidence/grade5/raw/candidate-pilot/meta.json",
"evidence/grade5/raw/candidate-pilot/requests.csv",
"evidence/grade5/raw/candidate/bursts.json",
"evidence/grade5/raw/candidate/meta.json",
"evidence/grade5/raw/candidate/requests.csv",
"evidence/grade5/replay-verification.json",
"evidence/grade5/reproduce-check.txt",
"evidence/grade5/reproduce.py",
"evidence/grade5/requirements.md",
"evidence/grade5/results.md",
"evidence/grade5/review-archive.json",
"evidence/grade5/review-inventory.json",
"evidence/grade5/runs.csv",
"evidence/grade5/snapshot.py",
"evidence/grade5/source-fingerprint.json",
"evidence/grade5/test-services-start.txt",
"src/cache.py",
"src/pagination.py",
"src/store.py",
"student-tests/grade5/benchmark.py",
"student-tests/grade5/faults.py",
"student-tests/grade5/integration.py",
"student-tests/grade5/run-public.sh",
"student-tests/grade5/test_singleflight.py"
],
"pr_draft": "local only, ignored and not staged",
"report_local_draft_link_removed": true,
"attributes": [
"evidence/grade5/raw/baseline/requests.csv: text: unset",
"evidence/grade5/raw/baseline/requests.csv: eol: unspecified",
"evidence/grade5/raw/baseline/requests.csv: whitespace: cr-at-eol",
"evidence/grade5/baseline-source.zip: text: unset",
"evidence/grade5/baseline-source.zip: eol: unspecified",
"evidence/grade5/baseline-source.zip: whitespace: unspecified",
"evidence/grade5/baseline-build.txt: text: set",
"evidence/grade5/baseline-build.txt: eol: lf",
"evidence/grade5/baseline-build.txt: whitespace: unspecified"
],
"documented_powershell_staging_commands": "PASS on Windows PowerShell 5.1 in temporary repository/throwaway index; commit/push intentionally omitted"
}
+16
View File
@@ -0,0 +1,16 @@
Publication-only verification; no benchmark, API or DB series run.
Main repository: no Git index, branch, remotes, history or PR mutations.
Protected source/teacher/historical evidence/secret bytes and main Git metadata: PASS.
18 raw checksums and baseline-source.zip SHA-256 unchanged: PASS.
Independent arithmetic: 18/18 runs, aggregates unchanged; baseline/candidate HTTP 4608/4608 each.
Profile SELECT 2994 -> 192; session SELECT 4608 -> 4608; all SQL 22836 -> 14418.
Existing offline audit: PASS (executed in temporary copy; historical audit.json preserved).
Existing single-flight unit tests: 5/5 PASS, network=none, 0.232 seconds.
Temporary Git clone: core.autocrlf=true, ordinary whitespace checks enabled.
Selective staging: git diff --cached --check exit=0, stdout/stderr empty.
Negative control: trailing spaces in a synthetic raw path ARE rejected; CR-at-EOL exception does not disable whitespace checks.
Index verification: all 18 raw blobs and binary baseline-source.zip match working-byte SHA-256.
Shell script modes: init-env.sh, restart.sh, run-checks.sh all 100755.
No staged teacher files, previous evidence, secrets, .env, .grade5-work, PR draft or local review ZIP.
Archive inventory/checksum files in grade5 are historical review-ZIP metadata, not the current commit manifest.
Documented PowerShell staging/check block executed successfully in Windows PowerShell 5.1, temporary repository and separate index; commit/push omitted.
+18
View File
@@ -0,0 +1,18 @@
281dcf2317cb42c064d9c9fd1ee43294106f9d400347e077e48cb7be847747c2 raw/baseline/bursts.json
5b423a05ca05ad36c7707c1527d60796fce1ce525b4e83e0fe2ed8cfbb3ba33d raw/baseline/meta.json
a00c7ef0d6f76808f878de5b109d8bd3986c7f98da27074561bf87da8b847e6a raw/baseline/requests.csv
ca5e3453014f4ea421340fa7c0220b5ad6c3cc28e94e36b745e3f0f45e8d7197 raw/baseline-failed-attempt-1/bursts.json
08561c7abc68af078fa18d200a35cd48805b2462e786a534cadc0f39b0de2658 raw/baseline-failed-attempt-1/failure.json
0ef08f062abe5d5645f2c507c44d5e67ac78ef9dab3758b7e5ca7215a26cf138 raw/baseline-failed-attempt-1/requests.csv
a9e19b5c244166c83d3a8a84364f523429be194db9e8e153d0fe50c7a9b2d1bf raw/baseline-pilot/bursts.json
f1c2b0863883b8f3300b971c8ff026729fdac52dd24bd0a7a096c2a6a239c9af raw/baseline-pilot/meta.json
a9d2fb5273829ee410b930001ab79832b939d7ef2e92368749fca226f140151c raw/baseline-pilot/requests.csv
9b65a150fa94e400f6cf5feffbad2fd097560ec80536f4bcd4ebc331d90d04b8 raw/candidate/bursts.json
e1f79416708bf9ef7b8447945b1b620a531c1744e5c7b298d7d90eb768859446 raw/candidate/meta.json
1147cf49a59b131736c74bcc5ca8ca2097eaa09801c1538af43838ff87eb24e7 raw/candidate/requests.csv
bc88927933cc583f6d81e71a69f8ec5a3691535d9de5b5c3bb49da76835e0dd1 raw/candidate-before-text-fix/bursts.json
3a4fa47d8a115ae128db2ec16eb0ca58669b71bd93add785a321cb07cbfb01d0 raw/candidate-before-text-fix/meta.json
9e4b727cfe6dec678f63f918c8f01ad983443b29682958fa240af80463b785b6 raw/candidate-before-text-fix/requests.csv
9e91f09e24f13b014bb4119d2454ba0b06855cbeb0b1eea429df9845325833f9 raw/candidate-pilot/bursts.json
07aca84c528ab212d95222ec5198bc10f1383a9b848e9aee83092b81acc091ef raw/candidate-pilot/meta.json
0267a684e0816ebc3a2aca903b1803fa93981f4ed3d3d3c144c2be94daf18078 raw/candidate-pilot/requests.csv
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
{"completed": false, "included_in_aggregates": false, "phase":"baseline repeat 3 cold burst 21, saving SQL deltas", "reason":"OSError errno 22 writing bursts.json on Windows bind mount", "action":"Preserved partial raw. Whole baseline series rerun; raw written to container /tmp then docker cp. Same load and counter methodology for candidate."}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,302 @@
[
{
"mode": "cold",
"repeat": 1,
"burst": 1,
"elapsed_s": 0.2220929869945394,
"lock_elapsed_s": 0,
"profile_lock_waiters": null,
"counts": {
"session_select": 16,
"profile_select": 9,
"transaction": 50,
"health_or_constant": 0,
"other": 0
},
"all_sql": 75,
"queries": [
{
"queryid": "2298459207537179847",
"query": "SELECT id,username,display_name,created_at FROM users WHERE id=$1",
"category": "profile_select",
"calls": 9,
"exec_ms": 0.193823,
"rows": 9
},
{
"queryid": "-3253990237086934723",
"query": "SELECT user_id FROM sessions WHERE token_hash=$1 AND expires_at > clock_timestamp()",
"category": "session_select",
"calls": 16,
"exec_ms": 0.469749,
"rows": 16
},
{
"queryid": "2064869707185898531",
"query": "COMMIT",
"category": "transaction",
"calls": 25,
"exec_ms": 0.048205,
"rows": 0
},
{
"queryid": "6650430479887907887",
"query": "BEGIN",
"category": "transaction",
"calls": 25,
"exec_ms": 0.059608000000000036,
"rows": 0
}
]
},
{
"mode": "cold",
"repeat": 1,
"burst": 2,
"elapsed_s": 0.1807730750006158,
"lock_elapsed_s": 0,
"profile_lock_waiters": null,
"counts": {
"session_select": 16,
"profile_select": 14,
"transaction": 60,
"health_or_constant": 0,
"other": 0
},
"all_sql": 90,
"queries": [
{
"queryid": "2298459207537179847",
"query": "SELECT id,username,display_name,created_at FROM users WHERE id=$1",
"category": "profile_select",
"calls": 14,
"exec_ms": 0.389343,
"rows": 14
},
{
"queryid": "-3253990237086934723",
"query": "SELECT user_id FROM sessions WHERE token_hash=$1 AND expires_at > clock_timestamp()",
"category": "session_select",
"calls": 16,
"exec_ms": 0.35593800000000014,
"rows": 16
},
{
"queryid": "2064869707185898531",
"query": "COMMIT",
"category": "transaction",
"calls": 30,
"exec_ms": 0.04130299999999997,
"rows": 0
},
{
"queryid": "6650430479887907887",
"query": "BEGIN",
"category": "transaction",
"calls": 30,
"exec_ms": 0.059209,
"rows": 0
}
]
},
{
"mode": "contended",
"repeat": 1,
"burst": 1,
"elapsed_s": 0.1747419019957306,
"lock_elapsed_s": 0.11086977299419232,
"profile_lock_waiters": 8,
"counts": {
"session_select": 16,
"profile_select": 16,
"transaction": 64,
"health_or_constant": 0,
"other": 0
},
"all_sql": 96,
"queries": [
{
"queryid": "2298459207537179847",
"query": "SELECT id,username,display_name,created_at FROM users WHERE id=$1",
"category": "profile_select",
"calls": 16,
"exec_ms": 0.43374800000000013,
"rows": 16
},
{
"queryid": "-3253990237086934723",
"query": "SELECT user_id FROM sessions WHERE token_hash=$1 AND expires_at > clock_timestamp()",
"category": "session_select",
"calls": 16,
"exec_ms": 0.4717499999999999,
"rows": 16
},
{
"queryid": "2064869707185898531",
"query": "COMMIT",
"category": "transaction",
"calls": 32,
"exec_ms": 0.056005000000000055,
"rows": 0
},
{
"queryid": "6650430479887907887",
"query": "BEGIN",
"category": "transaction",
"calls": 32,
"exec_ms": 0.04750699999999994,
"rows": 0
}
]
},
{
"mode": "contended",
"repeat": 1,
"burst": 2,
"elapsed_s": 0.20583527199050877,
"lock_elapsed_s": 0.11452008099877276,
"profile_lock_waiters": 8,
"counts": {
"session_select": 16,
"profile_select": 16,
"transaction": 64,
"health_or_constant": 0,
"other": 0
},
"all_sql": 96,
"queries": [
{
"queryid": "2298459207537179847",
"query": "SELECT id,username,display_name,created_at FROM users WHERE id=$1",
"category": "profile_select",
"calls": 16,
"exec_ms": 1.0047139999999999,
"rows": 16
},
{
"queryid": "-3253990237086934723",
"query": "SELECT user_id FROM sessions WHERE token_hash=$1 AND expires_at > clock_timestamp()",
"category": "session_select",
"calls": 16,
"exec_ms": 0.5137580000000002,
"rows": 16
},
{
"queryid": "2064869707185898531",
"query": "COMMIT",
"category": "transaction",
"calls": 32,
"exec_ms": 0.04620500000000008,
"rows": 0
},
{
"queryid": "6650430479887907887",
"query": "BEGIN",
"category": "transaction",
"calls": 32,
"exec_ms": 0.03990500000000011,
"rows": 0
}
]
},
{
"mode": "warm",
"repeat": 1,
"burst": 1,
"elapsed_s": 0.12914951400307473,
"lock_elapsed_s": 0,
"profile_lock_waiters": null,
"counts": {
"session_select": 16,
"profile_select": 2,
"transaction": 36,
"health_or_constant": 0,
"other": 0
},
"all_sql": 54,
"queries": [
{
"queryid": "2298459207537179847",
"query": "SELECT id,username,display_name,created_at FROM users WHERE id=$1",
"category": "profile_select",
"calls": 2,
"exec_ms": 0.08560899999999982,
"rows": 2
},
{
"queryid": "-3253990237086934723",
"query": "SELECT user_id FROM sessions WHERE token_hash=$1 AND expires_at > clock_timestamp()",
"category": "session_select",
"calls": 16,
"exec_ms": 0.7238830000000003,
"rows": 16
},
{
"queryid": "2064869707185898531",
"query": "COMMIT",
"category": "transaction",
"calls": 18,
"exec_ms": 0.024902000000000035,
"rows": 0
},
{
"queryid": "6650430479887907887",
"query": "BEGIN",
"category": "transaction",
"calls": 18,
"exec_ms": 0.02330199999999999,
"rows": 0
}
]
},
{
"mode": "warm",
"repeat": 1,
"burst": 2,
"elapsed_s": 0.14709751699410845,
"lock_elapsed_s": 0,
"profile_lock_waiters": null,
"counts": {
"session_select": 16,
"profile_select": 1,
"transaction": 34,
"health_or_constant": 0,
"other": 0
},
"all_sql": 51,
"queries": [
{
"queryid": "2298459207537179847",
"query": "SELECT id,username,display_name,created_at FROM users WHERE id=$1",
"category": "profile_select",
"calls": 1,
"exec_ms": 0.05270600000000014,
"rows": 1
},
{
"queryid": "-3253990237086934723",
"query": "SELECT user_id FROM sessions WHERE token_hash=$1 AND expires_at > clock_timestamp()",
"category": "session_select",
"calls": 16,
"exec_ms": 0.3898420000000007,
"rows": 16
},
{
"queryid": "2064869707185898531",
"query": "COMMIT",
"category": "transaction",
"calls": 17,
"exec_ms": 0.025302999999999992,
"rows": 0
},
{
"queryid": "6650430479887907887",
"query": "BEGIN",
"category": "transaction",
"calls": 17,
"exec_ms": 0.01469999999999999,
"rows": 0
}
]
}
]
@@ -0,0 +1,68 @@
{
"label": "baseline",
"pilot": true,
"started_utc": "2026-10-24T22:52:49.095538+00:00",
"wall_s": 1.2004241770046065,
"plan": {
"date_local": "2026-10-25 Europe/Moscow",
"clients": 16,
"repeats": 3,
"bursts_per_mode_repeat": 32,
"modes": [
"cold",
"contended",
"warm"
],
"contended_users_lock_seconds": 0.1,
"request_budget_per_version": 4608,
"warmup": "one GET me and one health/live per persistent client before modes; TTL reset only for synthetic user",
"cache_reset": "DEL own profile UUID before each cold/contended burst; warm primed before burst; no FLUSH",
"sql": "pg_stat_statements app-role deltas before/after each burst; observer role excluded; all app statements including transaction/health statements retained",
"ordering": "baseline then candidate, repeat modes rotate; identical plan; pilot excluded",
"http_timeout_seconds": 6,
"api": {
"cpu": 1,
"memory_mib": 512,
"swap_mib": 0,
"workers": 1,
"threads": 16,
"pg_pool": [
1,
8
],
"pg_pool_wait_seconds": 2
},
"postgres": {
"cpu": 1,
"memory_mib": 512,
"swap_mib": 0
},
"valkey": {
"cpu": 0.5,
"memory_mib": 128,
"swap_mib": 0
},
"driver": {
"cpu": 1,
"memory_mib": 512,
"swap_mib": 0
},
"raw": "per-request CSV plus per-burst normalized real SQL deltas and duration; no bodies, tokens or credentials",
"quantiles": "nearest rank over successful requests per mode/repeat; median and min/max across repeats; only 512 observations per percentile, limited p99 precision"
},
"python": "3.12.10 (main, May 21 2025, 23:34:56) [GCC 12.2.0]",
"app_src_sha256": {
"__init__.py": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"cache.py": "0f92c67b59f57a1ac5ee44d99bb5d992efa208e1d3c6fa44e5b537b913be926c",
"config.py": "7d18c6b03d1130ca633055599f13a002d05a722a86427f2c47700b65908223b5",
"db.py": "d21da56f3551eef2fb7e930a184264a0731eef8d6eb531929e611f8fa3df4d47",
"errors.py": "d34144c2b84b1b0fd15e0da574fe1ff6047d3af3cb3faeacbb1e385f221f46b6",
"main.py": "5c36a8dc3fa3dc84c69ebbfee94d1536619ee090da8d5d49931a99bfbd25f436",
"models.py": "ce2e14686881f764e00e602a3cb63253cedf698583d3f059b1afd76e4fd94a94",
"pagination.py": "bba67fcab7b6ead93c4848319feccecd5e608287f0e983981b04ce0e1ca4b8f3",
"security.py": "43a8b463e41053fe8ab125570eb7e93bbbbc13e4f5b6599457cbec22c00dc4d6",
"store.py": "dc8c9512979dba9d54617e27b19beb40ca45972dd8f294263144bb2de716c548"
},
"pg_version": "16.8 (Debian 16.8-1.pgdg120+1)",
"cache_version": "7.2.4"
}
@@ -0,0 +1,97 @@
mode,repeat,burst,client,status,latency_ms,error
cold,1,1,0,200,114.54448499716818,
cold,1,1,1,200,75.70444900193252,
cold,1,1,2,200,214.79187300428748,
cold,1,1,3,200,155.3872429940384,
cold,1,1,4,200,157.157940993784,
cold,1,1,5,200,108.89555299945641,
cold,1,1,6,200,207.6564760063775,
cold,1,1,7,200,127.89257400436327,
cold,1,1,8,200,216.95431400439702,
cold,1,1,9,200,205.6366509932559,
cold,1,1,10,200,134.8086450016126,
cold,1,1,11,200,215.0307999982033,
cold,1,1,12,200,215.30682999582496,
cold,1,1,13,200,105.13073399488349,
cold,1,1,14,200,132.20585499948356,
cold,1,1,15,200,219.2032650054898,
cold,1,2,0,200,175.49218599742744,
cold,1,2,1,200,134.45000599313062,
cold,1,2,2,200,116.85804200533312,
cold,1,2,3,200,127.76715999643784,
cold,1,2,4,200,171.27961700316519,
cold,1,2,5,200,175.63380200590473,
cold,1,2,6,200,172.52855500555597,
cold,1,2,7,200,145.17940299992915,
cold,1,2,8,200,174.72990200622007,
cold,1,2,9,200,176.71882300055586,
cold,1,2,10,200,173.20583100081421,
cold,1,2,11,200,136.93718299327884,
cold,1,2,12,200,118.93267399864271,
cold,1,2,13,200,143.43270899553318,
cold,1,2,14,200,143.00866100529674,
cold,1,2,15,200,143.41400700504892,
contended,1,1,0,200,172.10030800197273,
contended,1,1,1,200,140.6498980068136,
contended,1,1,2,200,156.53247000591364,
contended,1,1,3,200,167.21936299290974,
contended,1,1,4,200,167.1783579949988,
contended,1,1,5,200,134.9639629916055,
contended,1,1,6,200,160.83655100374017,
contended,1,1,7,200,149.02793300279882,
contended,1,1,8,200,127.30950900004245,
contended,1,1,9,200,164.31313900102396,
contended,1,1,10,200,141.3234729989199,
contended,1,1,11,200,165.12502999103162,
contended,1,1,12,200,164.93110699229874,
contended,1,1,13,200,168.77943700819742,
contended,1,1,14,200,170.5655370024033,
contended,1,1,15,200,154.53184700163547,
contended,1,2,0,200,201.39957799983677,
contended,1,2,1,200,190.9531120036263,
contended,1,2,2,200,189.22601899248548,
contended,1,2,3,200,190.18552600755356,
contended,1,2,4,200,191.20634099817835,
contended,1,2,5,200,197.81727800727822,
contended,1,2,6,200,154.7597730095731,
contended,1,2,7,200,199.776296998607,
contended,1,2,8,200,192.3813710018294,
contended,1,2,9,200,191.91521899483632,
contended,1,2,10,200,200.25204999546986,
contended,1,2,11,200,198.89349800359923,
contended,1,2,12,200,141.31177199305966,
contended,1,2,13,200,199.15682698774617,
contended,1,2,14,200,176.45759400329553,
contended,1,2,15,200,177.2034769965103,
warm,1,1,0,200,125.39089399797376,
warm,1,1,1,200,108.16427200916223,
warm,1,1,2,200,103.68377200211398,
warm,1,1,3,200,110.25440499361139,
warm,1,1,4,200,84.89937501144595,
warm,1,1,5,200,117.50681500416249,
warm,1,1,6,200,95.960210004705,
warm,1,1,7,200,108.77074000018183,
warm,1,1,8,200,118.54773100640159,
warm,1,1,9,200,83.01696499984246,
warm,1,1,10,200,120.59815999236889,
warm,1,1,11,200,102.29001600237098,
warm,1,1,12,200,123.35816799895838,
warm,1,1,13,200,112.43304901290685,
warm,1,1,14,200,121.45415499981027,
warm,1,1,15,200,101.27010199357755,
warm,1,2,0,200,67.38972100720275,
warm,1,2,1,200,120.55375399359036,
warm,1,2,2,200,79.41476300766226,
warm,1,2,3,200,141.67881300090812,
warm,1,2,4,200,56.08185900200624,
warm,1,2,5,200,138.26223099022172,
warm,1,2,6,200,112.37384199921507,
warm,1,2,7,200,141.67621200613212,
warm,1,2,8,200,143.98717098811176,
warm,1,2,9,200,136.47443200170528,
warm,1,2,10,200,120.11510599404573,
warm,1,2,11,200,138.49245698656887,
warm,1,2,12,200,124.68641600571573,
warm,1,2,13,200,139.07372200628743,
warm,1,2,14,200,128.72996799706016,
warm,1,2,15,200,71.33616200007964,
1 mode repeat burst client status latency_ms error
2 cold 1 1 0 200 114.54448499716818
3 cold 1 1 1 200 75.70444900193252
4 cold 1 1 2 200 214.79187300428748
5 cold 1 1 3 200 155.3872429940384
6 cold 1 1 4 200 157.157940993784
7 cold 1 1 5 200 108.89555299945641
8 cold 1 1 6 200 207.6564760063775
9 cold 1 1 7 200 127.89257400436327
10 cold 1 1 8 200 216.95431400439702
11 cold 1 1 9 200 205.6366509932559
12 cold 1 1 10 200 134.8086450016126
13 cold 1 1 11 200 215.0307999982033
14 cold 1 1 12 200 215.30682999582496
15 cold 1 1 13 200 105.13073399488349
16 cold 1 1 14 200 132.20585499948356
17 cold 1 1 15 200 219.2032650054898
18 cold 1 2 0 200 175.49218599742744
19 cold 1 2 1 200 134.45000599313062
20 cold 1 2 2 200 116.85804200533312
21 cold 1 2 3 200 127.76715999643784
22 cold 1 2 4 200 171.27961700316519
23 cold 1 2 5 200 175.63380200590473
24 cold 1 2 6 200 172.52855500555597
25 cold 1 2 7 200 145.17940299992915
26 cold 1 2 8 200 174.72990200622007
27 cold 1 2 9 200 176.71882300055586
28 cold 1 2 10 200 173.20583100081421
29 cold 1 2 11 200 136.93718299327884
30 cold 1 2 12 200 118.93267399864271
31 cold 1 2 13 200 143.43270899553318
32 cold 1 2 14 200 143.00866100529674
33 cold 1 2 15 200 143.41400700504892
34 contended 1 1 0 200 172.10030800197273
35 contended 1 1 1 200 140.6498980068136
36 contended 1 1 2 200 156.53247000591364
37 contended 1 1 3 200 167.21936299290974
38 contended 1 1 4 200 167.1783579949988
39 contended 1 1 5 200 134.9639629916055
40 contended 1 1 6 200 160.83655100374017
41 contended 1 1 7 200 149.02793300279882
42 contended 1 1 8 200 127.30950900004245
43 contended 1 1 9 200 164.31313900102396
44 contended 1 1 10 200 141.3234729989199
45 contended 1 1 11 200 165.12502999103162
46 contended 1 1 12 200 164.93110699229874
47 contended 1 1 13 200 168.77943700819742
48 contended 1 1 14 200 170.5655370024033
49 contended 1 1 15 200 154.53184700163547
50 contended 1 2 0 200 201.39957799983677
51 contended 1 2 1 200 190.9531120036263
52 contended 1 2 2 200 189.22601899248548
53 contended 1 2 3 200 190.18552600755356
54 contended 1 2 4 200 191.20634099817835
55 contended 1 2 5 200 197.81727800727822
56 contended 1 2 6 200 154.7597730095731
57 contended 1 2 7 200 199.776296998607
58 contended 1 2 8 200 192.3813710018294
59 contended 1 2 9 200 191.91521899483632
60 contended 1 2 10 200 200.25204999546986
61 contended 1 2 11 200 198.89349800359923
62 contended 1 2 12 200 141.31177199305966
63 contended 1 2 13 200 199.15682698774617
64 contended 1 2 14 200 176.45759400329553
65 contended 1 2 15 200 177.2034769965103
66 warm 1 1 0 200 125.39089399797376
67 warm 1 1 1 200 108.16427200916223
68 warm 1 1 2 200 103.68377200211398
69 warm 1 1 3 200 110.25440499361139
70 warm 1 1 4 200 84.89937501144595
71 warm 1 1 5 200 117.50681500416249
72 warm 1 1 6 200 95.960210004705
73 warm 1 1 7 200 108.77074000018183
74 warm 1 1 8 200 118.54773100640159
75 warm 1 1 9 200 83.01696499984246
76 warm 1 1 10 200 120.59815999236889
77 warm 1 1 11 200 102.29001600237098
78 warm 1 1 12 200 123.35816799895838
79 warm 1 1 13 200 112.43304901290685
80 warm 1 1 14 200 121.45415499981027
81 warm 1 1 15 200 101.27010199357755
82 warm 1 2 0 200 67.38972100720275
83 warm 1 2 1 200 120.55375399359036
84 warm 1 2 2 200 79.41476300766226
85 warm 1 2 3 200 141.67881300090812
86 warm 1 2 4 200 56.08185900200624
87 warm 1 2 5 200 138.26223099022172
88 warm 1 2 6 200 112.37384199921507
89 warm 1 2 7 200 141.67621200613212
90 warm 1 2 8 200 143.98717098811176
91 warm 1 2 9 200 136.47443200170528
92 warm 1 2 10 200 120.11510599404573
93 warm 1 2 11 200 138.49245698656887
94 warm 1 2 12 200 124.68641600571573
95 warm 1 2 13 200 139.07372200628743
96 warm 1 2 14 200 128.72996799706016
97 warm 1 2 15 200 71.33616200007964
File diff suppressed because it is too large Load Diff
+68
View File
@@ -0,0 +1,68 @@
{
"label": "baseline",
"pilot": false,
"started_utc": "2026-10-24T22:56:05.498042+00:00",
"wall_s": 56.084041081005125,
"plan": {
"date_local": "2026-10-25 Europe/Moscow",
"clients": 16,
"repeats": 3,
"bursts_per_mode_repeat": 32,
"modes": [
"cold",
"contended",
"warm"
],
"contended_users_lock_seconds": 0.1,
"request_budget_per_version": 4608,
"warmup": "one GET me and one health/live per persistent client before modes; TTL reset only for synthetic user",
"cache_reset": "DEL own profile UUID before each cold/contended burst; warm primed before burst; no FLUSH",
"sql": "pg_stat_statements app-role deltas before/after each burst; observer role excluded; all app statements including transaction/health statements retained",
"ordering": "baseline then candidate, repeat modes rotate; identical plan; pilot excluded",
"http_timeout_seconds": 6,
"api": {
"cpu": 1,
"memory_mib": 512,
"swap_mib": 0,
"workers": 1,
"threads": 16,
"pg_pool": [
1,
8
],
"pg_pool_wait_seconds": 2
},
"postgres": {
"cpu": 1,
"memory_mib": 512,
"swap_mib": 0
},
"valkey": {
"cpu": 0.5,
"memory_mib": 128,
"swap_mib": 0
},
"driver": {
"cpu": 1,
"memory_mib": 512,
"swap_mib": 0
},
"raw": "per-request CSV plus per-burst normalized real SQL deltas and duration; no bodies, tokens or credentials",
"quantiles": "nearest rank over successful requests per mode/repeat; median and min/max across repeats; only 512 observations per percentile, limited p99 precision"
},
"python": "3.12.10 (main, May 21 2025, 23:34:56) [GCC 12.2.0]",
"app_src_sha256": {
"__init__.py": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b",
"cache.py": "0f92c67b59f57a1ac5ee44d99bb5d992efa208e1d3c6fa44e5b537b913be926c",
"config.py": "7d18c6b03d1130ca633055599f13a002d05a722a86427f2c47700b65908223b5",
"db.py": "d21da56f3551eef2fb7e930a184264a0731eef8d6eb531929e611f8fa3df4d47",
"errors.py": "d34144c2b84b1b0fd15e0da574fe1ff6047d3af3cb3faeacbb1e385f221f46b6",
"main.py": "5c36a8dc3fa3dc84c69ebbfee94d1536619ee090da8d5d49931a99bfbd25f436",
"models.py": "ce2e14686881f764e00e602a3cb63253cedf698583d3f059b1afd76e4fd94a94",
"pagination.py": "bba67fcab7b6ead93c4848319feccecd5e608287f0e983981b04ce0e1ca4b8f3",
"security.py": "43a8b463e41053fe8ab125570eb7e93bbbbc13e4f5b6599457cbec22c00dc4d6",
"store.py": "dc8c9512979dba9d54617e27b19beb40ca45972dd8f294263144bb2de716c548"
},
"pg_version": "16.8 (Debian 16.8-1.pgdg120+1)",
"cache_version": "7.2.4"
}
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More