fix cached history pagination and setup docs
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
Матвей
2026-10-09 21:06:31 +03:00
parent 7cda433085
commit b538b2db39
4 changed files with 33 additions and 5 deletions
+5 -4
View File
@@ -2,7 +2,7 @@
- Автор, группа: Козырев Матвей БВТ2301
- Целевая оценка: 5; трек 1 — согласованность кэша
- Commit/PR: TODO после публикации
- PR: https://gitea.privcloud.tech/mtusi2026/mtusi2026lab2/pulls/22
- Использованные библиотеки: FastAPI 0.141.1, Uvicorn 0.40.0, asyncpg 0.31.0, argon2-cffi 25.1.0, redis 5.0.8; зафиксированы в `pyproject.toml` и `uv.lock`.
## Запуск из чистого clone
@@ -13,10 +13,11 @@
```sh
mkdir -p secrets
openssl rand -hex 32 -out secrets/postgres_password
awk '{printf "postgresql://messenger:%s@postgres:5432/messenger\\n", $0}' \
awk '{printf "postgresql://messenger:%s@postgres:5432/messenger\n", $0}' \
secrets/postgres_password > secrets/database_url
printf '%s\n' 'redis://redis:6379/0' > secrets/cache_url
chmod 700 secrets
chmod 600 secrets/postgres_password secrets/database_url
chmod 600 secrets/postgres_password secrets/database_url secrets/cache_url
docker compose --env-file .env.example config --quiet
docker compose --env-file .env.example up -d --build
```
@@ -100,7 +101,7 @@ AOF и named volume `redis_data`.
| Согласованность lock-файла | `uv lock --check` | PASS | выполнено |
| Публичный smoke | `make test` | `PASS: lab2 public API scenario` | `evidence/smoke-2026-10-08.txt` |
| Persistence | `make test-persistence ACTION_SCRIPT=scripts/restart.sh` | `PASS: persistence preserved confirmed data and existing session` | `evidence/persistence-2026-10-08.txt` |
| Redis cache | `make test-grade4`; `redis-cli --scan` | read-after-write без stale read; создан ключ `history:first:…` | `evidence/redis-cache-2026-10-08.txt` |
| Redis cache и курсор | `make test-grade4`; `redis-cli --scan` | read-after-write без stale read; повторный GET кэшированной страницы и её continuation возвращают 200 | `evidence/cache-pagination-2026-10-09.txt` |
| Гонка и rollback | `make test-grade4` | Ровно одна регистрация успешна; неуспешный чат не виден | `evidence/grade4-checks-2026-10-08.txt` |
| TTL и зависимости | `make test-grade4`; TTL=2 | Expired session → 401; Redis fallback проходит smoke; DB readiness → 503 | `evidence/grade4-checks-2026-10-08.txt` |
| Индекс истории | `./scripts/explain_history.sh` | Index Scan, 50 строк, shared hit=3 | `evidence/explain-history-2026-10-08.txt` |