diff --git a/.dockerignore b/.dockerignore index bc16e556..1aab37b5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -16,5 +16,10 @@ backups .venv __pycache__ node_modules +src/generated +dist +coverage +*.tsbuildinfo +.pnpm-store evidence .DS_Store diff --git a/.env.example b/.env.example index 714c8076..aad79852 100644 --- a/.env.example +++ b/.env.example @@ -1,11 +1,13 @@ -# Copy to .env for your LOCAL synthetic test environment; never commit .env. -# These are logical interface suggestions; map actual framework names in REPORT.md. APP_HOST=0.0.0.0 APP_PORT=8080 APP_ENV=lab SESSION_TTL_SECONDS=3600 -# Choose credentials locally. File paths contain no secret values. -DATABASE_URL_FILE=/run/secrets/database_url -# Optional on 3, required use on 4 in lab2; Redis OR Valkey: +POSTGRES_DB=chat +POSTGRES_USER=app +POSTGRES_PASSWORD=local_dev_password +POSTGRES_PORT=5432 +DATABASE_URL=postgresql://app:local_dev_password@localhost:5432/chat +CACHE_URL=redis://localhost:6379/0 +REDIS_PORT=6379 +CACHE_PREFIX=messenger:cache:v1 SESSION_STORE=postgres -CACHE_URL_FILE=/run/secrets/cache_url diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..c52d61a8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +test/*.sh text eol=lf +test/*.cmd text eol=crlf +scripts/*.sh text eol=lf +scripts/*.cmd text eol=crlf diff --git a/.gitignore b/.gitignore index b5a71896..df37236e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -# Local/private state .env .env.* !.env.example @@ -13,7 +12,6 @@ certs/private/ volumes/ data/ backups/ -# Runtime/build artifacts .venv/ __pycache__/ *.py[cod] @@ -24,9 +22,10 @@ target/ bin/ obj/ coverage/ +*.tsbuildinfo +.pnpm-store/ +src/generated/prisma/ *.log .DS_Store .idea/ .vscode/ -# Keep small, sanitized evidence summaries in evidence/ under version control. -# Inspect git diff --cached: ignore rules are not a secret scanner. diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 00000000..fd932650 --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,11 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "ignorePatterns": ["src/generated/**"], + "rules": { + "typescript/no-explicit-any": "off", + "typescript/no-floating-promises": "error" + }, + "env": { + "node": true + } +} diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..a20502b7 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "trailingComma": "all" +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..5a5cc6e1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,54 @@ +FROM node:24.20.0-bookworm-slim AS base + +WORKDIR /app +RUN apt-get update \ + && apt-get install -y --no-install-recommends openssl \ + && rm -rf /var/lib/apt/lists/* +RUN npm install --global pnpm@10.14.0 + +FROM base AS dependencies + +COPY package.json pnpm-lock.yaml ./ +RUN pnpm install --frozen-lockfile + +FROM dependencies AS migrate + +COPY prisma ./prisma +COPY prisma.config.ts ./ +CMD ["pnpm", "db:deploy"] + +FROM migrate AS build + +COPY nest-cli.json tsconfig.json tsconfig.build.json ./ +COPY src ./src +RUN pnpm build + +FROM base AS production-dependencies + +COPY package.json pnpm-lock.yaml ./ +RUN pnpm install --prod --frozen-lockfile + +FROM node:24.20.0-bookworm-slim AS runtime + +ENV NODE_ENV=production \ + APP_HOST=0.0.0.0 \ + APP_PORT=8080 + +WORKDIR /app + +RUN groupadd --system --gid 10001 app \ + && useradd --system --uid 10001 --gid app --home-dir /app --shell /usr/sbin/nologin app + +RUN mkdir -p /app/data && chown 10001:10001 /app/data + +COPY --from=production-dependencies --chown=10001:10001 /app/node_modules ./node_modules +COPY --from=build --chown=10001:10001 /app/dist ./dist +COPY --from=build --chown=10001:10001 /app/package.json ./package.json + +USER 10001:10001 +EXPOSE 8080 + +HEALTHCHECK --interval=30s --timeout=3s --start-period=15s --retries=3 \ + CMD node -e "fetch('http://127.0.0.1:' + (process.env.APP_PORT || '8080') + '/health/ready').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))" + +CMD ["node", "dist/main.js"] diff --git a/Dockerfile.example b/Dockerfile.example deleted file mode 100644 index e333a12e..00000000 --- a/Dockerfile.example +++ /dev/null @@ -1,8 +0,0 @@ -# Teaching outline, not a runnable Dockerfile. Implement your own Dockerfile. -# 1. Choose a runtime/toolchain version and pin the base image tag/digest. -# 2. Copy dependency manifests first; install from the language lockfile. -# 3. Copy source and build. For compiled languages use a separate runtime stage. -# 4. Run the HTTP process as PID 1; listen on 0.0.0.0:8080. -# 5. Add non-root, signals and healthcheck according to the current rubric. -# 6. Pass runtime config/secrets at startup, never COPY .env or secret files. -# This file deliberately has no FROM/CMD: selecting/implementing them is the task. diff --git a/REPORT.md b/REPORT.md index e42f2b05..347fa455 100644 --- a/REPORT.md +++ b/REPORT.md @@ -1,37 +1,83 @@ # Отчёт — лабораторная 2 -- Автор, группа: TODO -- Целевая оценка; выбранный трек 5, если нужен: TODO -- Commit/PR: TODO после публикации -- Использованные источники, библиотеки и помощь ИИ: TODO +- Автор, группа: **Пинаев Олег Константинович, БПИ2302**. +- Целевая оценка: **5, трек 1 — согласованность кэша**. +- Коммиты: API `6fff618`, инфраструктура `1dc5f08`, проверки `6cccda1`, инструменты замеров `6866407`. Хеши измеренных модулей и образов сохранены в `evidence/`. +- Источники: `README.md`, `contracts/`, документация PostgreSQL, Redis и Node.js; ИИ использовался для разработки, подготовки тестов, замеров и черновика отчёта. ## Запуск из чистого clone -TODO: версии runtime/образов, prerequisites, команды создания локальных secrets/.env, build, миграций, запуска, ожидания готовности, тестов и остановки. Указать необходимые действия оператора. Не вставлять секреты. Отдельно указать безопасную остановку и команду намеренного удаления учебных данных. +Docker с Compose, Python 3.9+ и `make`. Для локальной сборки и собственных тестов — Node.js **24.20.0**, pnpm **10.14.0**. + +```sh +cp .env.example .env +docker compose --env-file .env config --quiet +docker compose --env-file .env up -d --build --wait +make test PYTHON=python BASE_URL=http://127.0.0.1:8080 +make test-persistence ACTION_SCRIPT=scripts/restart.sh PYTHON=python BASE_URL=http://127.0.0.1:8080 +``` + +`APP_PORT` задаёт опубликованный порт API; `POSTGRES_*` — настройки БД, `REDIS_PORT` — локальный порт Redis. Внутри Compose `DATABASE_URL` и `CACHE_URL` указывают на сервисы `postgres` и `redis`; локальные команды используют адреса из `.env`. `SESSION_TTL_SECONDS` — срок сессии, `CACHE_PREFIX` — пространство ключей; `SESSION_STORE=postgres`. Учебный пароль в `.env.example` следует заменить в локальном `.env`. + ## Архитектура и решения -TODO: схема процессов/хранилищ, источник истины, транзакционные границы, ограничения. Что перенесено из lab1, что изменено в этой работе. Соответствие переменных из .env.example реальной конфигурации. +NestJS/Fastify → PostgreSQL; Redis используется как кэш. Из lab1 сохранены пользователи, чаты, проверка членства, формат ошибок и cursor-пагинация. Состояние перенесено из памяти в таблицы `users`, `chats`, `chat_members`, `messages`, `sessions`; добавлены PK/FK, уникальность username и индексы. Создание чата, участников и увеличение эпох списков выполняются одной транзакцией. История упорядочена по `(created_at, id)` и имеет индекс `(chat_id, created_at, id)`; поздние страницы используют сравнение пары, без OFFSET. + +Пароли хранятся как **Argon2id** в PHC-формате: 19 MiB, 2 прохода, parallelism=1, соль 16 байт, ключ 32 байта. Basic применяется при входе; бизнес-запросы требуют opaque Bearer. В PostgreSQL хранится SHA-256 токена, срок истечения и признак отзыва. По умолчанию сессия действует 3600 секунд, logout отзывает её; + +PostgreSQL — источник истины. Redis хранит сущности на 300 секунд, страницы на 30 секунд. Ключ истории включает эпоху из БД и параметры страницы. Эпоха — сумма до **16 счётчиков** `chat_message_epochs`: запись атомарно увеличивает один из них и вставляет сообщение одним CTE. Это распределяет блокировки записей одного чата. Проверка сессии, публичный профиль, членство и эпоха для GET истории получаются одним SQL. Эпоха списка чатов хранится в `users.chats_epoch` и меняется вместе с созданием чата. + +После подтверждённой записи следующий GET получает новую эпоху и не использует старый ключ, даже если Redis пропустил инвалидацию. Задержавшаяся загрузка может заполнить только ключ старой эпохи; он исчезнет по TTL. При недоступном Redis API читает PostgreSQL; при недоступной БД возвращает 503. Ожидание подключения и SQL — 5 секунд, транзакция — 10 секунд; Redis-команда — 300 мс. Dockerfile разделяет сборку, миграции и runtime, запускает API от UID/GID 10001. ## Доказательства критериев -| Критерий README | Команда/сценарий | Наблюдаемый результат | Файл доказательства | -| --- | --- | --- | --- | -| Публичный smoke | make test | TODO | TODO | -| Остальные пункты уровня 3 | TODO | TODO | TODO | -| Все пункты уровня 4, если заявлен | TODO | TODO | TODO | -| Выбранный трек 5, если заявлен | TODO | TODO | TODO | +| Проверка | Команда/сценарий | Результат | +| --- | --- | --- | +| Сборка, миграции, линтер | `docker compose build backend migrate`, `docker compose up -d backend`, `pnpm.cmd lint` | PASS, backend healthy; [проверки выбранной версии](evidence/epoch-variants-validation.json) | +| Публичный smoke | `python -X utf8 tests/smoke.py --base-url http://127.0.0.1:8080` | PASS на текущем образе; [повторные проверки](evidence/checks-rerun.json) | +| Полный перезапуск | `python -X utf8 scripts/test-persistence.py --scenario full-restart --base-url http://127.0.0.1:8080 --output evidence/cache-epochs-full-restart.json` | Сохранён PASS, 49,081 с на весь сценарий: те же контейнеры и volumes, данные и прежние токены сохранены; [JSON](evidence/cache-epochs-full-restart.json) | +| Публичная сохранность | `python -X utf8 scripts/test-persistence.py --scenario public --base-url http://127.0.0.1:8080 --output evidence/persistence-public.json` | PASS на текущем образе, исходный HTTP-дедлайн 2 с; 34,502 с на сценарий. Все три сервиса перезапущены, контейнеры и volumes сохранены; [JSON](evidence/persistence-public.json) | +| KDF, сессии, гонки и rollback | Проверки `test/passwords.mjs`, `test/persistence.mjs`, `test/resilience.mjs` через `node --test` в benchmark-контейнере | PASS на текущем образе, включая короткий TTL, logout, неверный пароль и отказы зависимостей; вместе с кэшем и пагинацией 15/15, [команда и результат](evidence/checks-rerun.json) | +| Кэш и актуальные эпохи | `docker compose -f compose.yaml -f test/compose.benchmark.yaml run --rm --no-deps --pull never benchmark node --test test/cache-epochs.mjs test/cache.mjs` | PASS: 3 теста на текущей схеме, свежесть, конкурентная запись и rollback; [JSON](evidence/epoch-variants-validation.json) | +| Индекс и пагинация | `node test/explain-history.mjs`, `pnpm test:pagination` | EXPLAIN на 60 000 сообщений; проверены границы timestamp, отсутствие пропусков/дублей и изоляция чатов; +| Трек 1 | Конкурентный старый SELECT, пропущенная инвалидация, восстановление Redis со старыми ключами | Stale read воспроизведён до защиты; после — PASS. -TODO: добавить отдельную строку для каждого заявленного критерия. PASS без команды и наблюдения не является доказательством. Проверка инфраструктурного hook требует подтверждения, какие реальные процессы/хранилища перезапущены. +Hook `scripts/restart.sh` останавливает backend, PostgreSQL и Redis, запускает существующие контейнеры, ждёт готовности хранилищ и сохраняет volumes. `scripts/restart.cmd` вызывает его через Git Bash. Публичная проверка с HTTP-дедлайном 2 секунды прошла; проверки KDF, сессий, отказов, кэша и пагинации — 15/15 PASS. Запуск из чистого clone пока не проверен. ## Эксперименты и отказы -TODO: гипотеза, hardware/лимиты, версии, объём данных, профиль нагрузки, concurrency/arrival rate, длительность/прогрев, повторы, успешные RPS, ошибки, p50/p95/p99, CPU/RAM. Сохранить raw summary без tokens и объяснить ограничения измерения. +Гипотеза трека 1: эпоха в PostgreSQL, изменяемая атомарно с сообщением, устраняет stale read при отказе Redis и запоздалом заполнении кэша. До защиты два сценария возвращали старую историю: восстановление Redis с прежними ключами и завершение старого SELECT после новой записи. После добавления эпох оба проходят. Первое сравнение: 10 000 сообщений, конкурентность 16, прогрев 3 с, чтение 10 с, 512 записей, три повтора. Медианы до / после: чтение — SQL/HTTP **1,412 / 2,011**, p95 **292,651 / 332,510 мс**; запись — SQL/HTTP **2,313 / 4**, p95 **216,752 / 894,578 мс**. Свежесть исправлена ценой дополнительных SQL и блокировки счётчика; -| Воздействие | Что ожидаем | Что наблюдали | Время восстановления / потеря данных | -| --- | --- | --- | --- | -| TODO | TODO | TODO | TODO | +Затем запись сведена к одному CTE, профиль включён в проверку сессии, проверки доступа объединены, общая эпоха разделена на 16 счётчиков. Матрица с меняющимся порядком, три повтора, 100 000 сообщений, 32 клиента, чтения по минуте и 4096 записей: + +| Вариант | Чтение, RPS | Запись, RPS | SQL/HTTP чтения | +| --- | ---: | ---: | ---: | +| Прежний CTE и один счётчик | 226,076 | 90,772 | 2,004 | +| Профиль из JOIN сессии | 170,523 | 141,474 | 2,010 | +| Единая проверка сессии/членства/эпохи | 246,934 | 117,777 | 1,006 | +| Та же проверка и 16 счётчиков | **242,548** | **165,061** | **1,004** | + +Выбран последний вариант: близкая скорость чтения и лучшая средняя скорость записи в этой матрице. + +Отдельный контроль сравнивает выбранный код с теми же SQL-оптимизациями, но без Redis и чтения/обновления эпох. Три повтора, 100 000 сообщений, limit=50, конкурентность 32, прогрев 10 с, чтение 60 с, 4096 записей на повтор: + +| Метрика | Redis и эпохи | Без кэша и эпох | +| --- | ---: | ---: | +| Средний RPS чтения | **184,211** | 130,213 | +| Средняя задержка чтения, мс | **173,466** | 245,478 | +| Среднее p95 чтения, мс | **427,674** | 762,396 | +| SQL/HTTP чтения | **1,009** | 2 | +| Средний RPS записи | 120,634 | **128,279** | +| Средняя задержка записи, мс | 264,880 | **249,032** | +| Среднее p95 записи, мс | 666,798 | **556,831** | + +Чтение быстрее по среднему RPS на **41,5%**, запись медленнее на **6,0%**. Всего **81 693 успешных запроса**, ошибок нет. С Redis чтение быстрее во всех трёх повторах, но преимущество меняется от 5,7% до 120,2%; результаты записи пересекаются. + +Индекс исследован отдельно через `EXPLAIN (ANALYZE, BUFFERS)` на 60 000 сообщений. Медиана первой страницы — **28,718 → 0,094 мс** после индекса. На странице после 18 000 сообщений замена OR на сравнение пары снижает проверенные строки **18 051 → 51**, время **10,479 → 0,080 мс**. Результаты выборок совпадают; изменения экспериментальной схемы отменены ROLLBACK. [Планы](evidence/history-index-plans.txt). ## Ограничения и следующие шаги -TODO: какие отказы выдерживаются и какие нет; что не реализовано; где учебное упрощение; какое улучшение подтверждено, а какое пока гипотеза. +Один PostgreSQL и один Docker-host: проверена устойчивость к потере кэша, высокая доступность БД не реализована. Гарантия свежести относится к GET, начатому после подтверждения записи; чтения идут в основной PostgreSQL. Изменения данных в обход приложения должны увеличивать эпоху. После восстановления БД из старого backup нужно сменить `CACHE_PREFIX` или очистить Redis. Cache stampede отдельно не устранён. + +Нагрузка closed-loop; API, генератор и инструментация делят процесс, другие контейнеры делят host. CPU/RSS и p50/p95/p99 сохранены в сырых JSON; CPU PostgreSQL отдельно не измерялся. Средние p95 в таблице — среднее перцентилей повторов. Синтетические сессии обходят KDF; нагрузка измеряет первую страницу и запись в один чат. Последовательное сравнение с отключённым кэшем не позволяет точно отделить стоимость Redis от стоимости эпох. diff --git a/compose.example.yaml b/compose.example.yaml deleted file mode 100644 index 52524b0c..00000000 --- a/compose.example.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# Topology worksheet, deliberately NOT a runnable stack (no application supplied). -# Implement compose.yaml or stack.yaml; do not submit this empty file as deployment. -# Service names below are logical roles, not imposed container names. -x-lab-number: 2 -x-required-roles: - - api - - postgres -# TODO: implement real images/builds, network wiring, volumes, healthchecks, -# credentials and bootstrap. Details: contracts/infrastructure.json and README.md. -services: {} diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000..f9291625 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,90 @@ +services: + backend: + build: + context: . + target: runtime + restart: unless-stopped + init: true + environment: + NODE_ENV: production + APP_ENV: ${APP_ENV:-lab} + APP_HOST: 0.0.0.0 + APP_PORT: 8080 + DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-local_dev_password}@postgres:5432/${POSTGRES_DB:-chat} + CACHE_URL: redis://redis:6379/0 + CACHE_PREFIX: ${CACHE_PREFIX:-messenger:cache:v1} + SESSION_STORE: ${SESSION_STORE:-postgres} + SESSION_TTL_SECONDS: ${SESSION_TTL_SECONDS:-3600} + APP_DATA_DIR: /app/data + ports: + - '127.0.0.1:${APP_PORT:-8080}:8080' + volumes: + - backend_data:/app/data + depends_on: + migrate: + condition: service_completed_successfully + postgres: + condition: service_healthy + redis: + condition: service_started + healthcheck: + test: + - CMD + - node + - -e + - "fetch('http://127.0.0.1:8080/health/ready').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))" + interval: 10s + timeout: 3s + start_period: 20s + retries: 5 + stop_grace_period: 30s + + migrate: + build: + context: . + target: migrate + environment: + DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-local_dev_password}@postgres:5432/${POSTGRES_DB:-chat} + depends_on: + postgres: + condition: service_healthy + + postgres: + image: postgres:17.6-bookworm + restart: unless-stopped + environment: + POSTGRES_DB: ${POSTGRES_DB:-chat} + POSTGRES_USER: ${POSTGRES_USER:-app} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-local_dev_password} + ports: + - '127.0.0.1:${POSTGRES_PORT:-5432}:5432' + volumes: + - postgres_data:/var/lib/postgresql/data + healthcheck: + test: ['CMD-SHELL', 'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"'] + interval: 5s + timeout: 3s + start_period: 10s + retries: 10 + stop_grace_period: 30s + + redis: + image: redis:7.4.5-alpine + restart: unless-stopped + command: + ['redis-server', '--appendonly', 'yes', '--appendfsync', 'everysec'] + ports: + - '127.0.0.1:${REDIS_PORT:-6379}:6379' + volumes: + - redis_data:/data + healthcheck: + test: ['CMD', 'redis-cli', 'ping'] + interval: 5s + timeout: 3s + retries: 10 + stop_grace_period: 30s + +volumes: + postgres_data: + redis_data: + backend_data: diff --git a/evidence/cache-epochs-after-short.json b/evidence/cache-epochs-after-short.json new file mode 100644 index 00000000..e8be7bf9 --- /dev/null +++ b/evidence/cache-epochs-after-short.json @@ -0,0 +1,372 @@ +{ + "stage": "after", + "recorded_at": "2026-10-13T10:03:46.698Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented separate API process in running backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 16, + "duration_seconds": 5, + "repetitions": 3, + "seed_messages": 10000, + "cold_burst_requests": 32, + "writes_per_repeat": 128, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; idle production backend shares container; no capacity/SLA claim; fixtures bypass password KDF" + }, + "dist_sha256": { + "Chat/chat.service.js": "6fefd2a334e97f595e86699f8ec3832792b353c9f3a47568da802d36f1495027", + "cache/cache.service.js": "ec7c09ef55f9054176ace8c62a3690df6e717b54c36db9ef66b91bc34a761693" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 1.945, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 16.45, + "latency_ms": { + "p50": 1799.65, + "p95": 1899.363, + "p99": 1908.217 + }, + "sql_queries": 66, + "sql_per_request": 2.0625, + "sql_calls": { + "SELECT:sessions": 51, + "SELECT:chat_members": 51, + "SELECT:messages": 2 + }, + "process_cpu_percent_one_core": 88.25, + "peak_process_rss_mib": 325.54 + }, + { + "workload": "warm-history", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 5.508, + "successes": 142, + "errors": 0, + "error_ratio": 0, + "successful_rps": 25.78, + "latency_ms": { + "p50": 585.765, + "p95": 844.356, + "p99": 977.564 + }, + "sql_queries": 300, + "sql_per_request": 2.1127, + "sql_calls": { + "SELECT:sessions": 179, + "SELECT:chat_members": 186, + "SELECT:chats": 7, + "SELECT:messages": 38, + "SELECT:users": 1 + }, + "process_cpu_percent_one_core": 68.2, + "peak_process_rss_mib": 314.38 + }, + { + "workload": "history-cache-bypassed", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 5.218, + "successes": 261, + "errors": 0, + "error_ratio": 0, + "successful_rps": 50.023, + "latency_ms": { + "p50": 246.755, + "p95": 745.696, + "p99": 939.045 + }, + "sql_queries": 794, + "sql_per_request": 3.0421, + "sql_calls": { + "SELECT:sessions": 262, + "SELECT:chat_members": 268, + "SELECT:messages": 261, + "SELECT:users": 1, + "SELECT:chats": 7, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 99.49, + "peak_process_rss_mib": 332.13 + }, + { + "workload": "writes-single-chat", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 6.953, + "successes": 128, + "errors": 0, + "error_ratio": 0, + "successful_rps": 18.409, + "latency_ms": { + "p50": 573.249, + "p95": 2180.804, + "p99": 2490.244 + }, + "sql_queries": 532, + "sql_per_request": 4.1563, + "sql_calls": { + "SELECT:sessions": 129, + "SELECT:chat_members": 140, + "BEGIN:other": 128, + "UPDATE:chats": 128, + "SELECT:chats": 11, + "INSERT:messages": 128, + "COMMIT:other": 128, + "SELECT:messages": 1, + "SELECT:users": 1 + }, + "process_cpu_percent_one_core": 92.16, + "peak_process_rss_mib": 333.42 + }, + { + "workload": "cold-history-burst", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 0.436, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 73.396, + "latency_ms": { + "p50": 392.182, + "p95": 407.46, + "p99": 430.132 + }, + "sql_queries": 96, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 54, + "SELECT:chat_members": 54, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 105.73, + "peak_process_rss_mib": 333.79 + }, + { + "workload": "warm-history", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 5.376, + "successes": 230, + "errors": 0, + "error_ratio": 0, + "successful_rps": 42.787, + "latency_ms": { + "p50": 273.166, + "p95": 1119.423, + "p99": 1464.099 + }, + "sql_queries": 490, + "sql_per_request": 2.1304, + "sql_calls": { + "SELECT:sessions": 241, + "SELECT:chat_members": 251, + "SELECT:chats": 10, + "SELECT:users": 8, + "SELECT:messages": 13 + }, + "process_cpu_percent_one_core": 65.23, + "peak_process_rss_mib": 334.04 + }, + { + "workload": "history-cache-bypassed", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 5.546, + "successes": 126, + "errors": 0, + "error_ratio": 0, + "successful_rps": 22.721, + "latency_ms": { + "p50": 710.161, + "p95": 1038.287, + "p99": 1090.633 + }, + "sql_queries": 378, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 127, + "SELECT:chat_members": 128, + "SELECT:messages": 126, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 67.71, + "peak_process_rss_mib": 334.54 + }, + { + "workload": "writes-single-chat", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 2.104, + "successes": 128, + "errors": 0, + "error_ratio": 0, + "successful_rps": 60.838, + "latency_ms": { + "p50": 169.632, + "p95": 445.91, + "p99": 625.63 + }, + "sql_queries": 512, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 129, + "SELECT:chat_members": 130, + "BEGIN:other": 128, + "UPDATE:chats": 128, + "INSERT:messages": 128, + "COMMIT:other": 128, + "SELECT:messages": 1, + "SELECT:users": 1, + "SELECT:chats": 1 + }, + "process_cpu_percent_one_core": 162.61, + "peak_process_rss_mib": 335.29 + }, + { + "workload": "cold-history-burst", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 0.53, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 60.386, + "latency_ms": { + "p50": 237.037, + "p95": 441.614, + "p99": 519.501 + }, + "sql_queries": 96, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 114, + "SELECT:chat_members": 114, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 108.61, + "peak_process_rss_mib": 335.29 + }, + { + "workload": "warm-history", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 5.076, + "successes": 959, + "errors": 0, + "error_ratio": 0, + "successful_rps": 188.921, + "latency_ms": { + "p50": 66.867, + "p95": 192.487, + "p99": 286.838 + }, + "sql_queries": 1918, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 997, + "SELECT:chat_members": 997, + "SELECT:messages": 38 + }, + "process_cpu_percent_one_core": 116.88, + "peak_process_rss_mib": 338.79 + }, + { + "workload": "history-cache-bypassed", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 5.099, + "successes": 190, + "errors": 0, + "error_ratio": 0, + "successful_rps": 37.26, + "latency_ms": { + "p50": 329.709, + "p95": 1031.744, + "p99": 1254.223 + }, + "sql_queries": 585, + "sql_per_request": 3.0789, + "sql_calls": { + "SELECT:sessions": 191, + "SELECT:chat_members": 198, + "SELECT:messages": 190, + "SELECT:chats": 8, + "SELECT:users": 3, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 71.36, + "peak_process_rss_mib": 338.79 + }, + { + "workload": "writes-single-chat", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 1.849, + "successes": 128, + "errors": 0, + "error_ratio": 0, + "successful_rps": 69.223, + "latency_ms": { + "p50": 209.047, + "p95": 381.466, + "p99": 495.091 + }, + "sql_queries": 512, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 136, + "SELECT:chat_members": 142, + "BEGIN:other": 132, + "UPDATE:chats": 130, + "INSERT:messages": 130, + "COMMIT:other": 132, + "SELECT:messages": 7, + "INSERT:chats": 2, + "INSERT:chat_members": 2, + "SELECT:chats": 8, + "SELECT:users": 4, + "DELETE:chats": 1, + "DELETE:users": 1 + }, + "process_cpu_percent_one_core": 108.54, + "peak_process_rss_mib": 338.79 + } + ], + "correctness": { + "redis_reconnect": { + "old_keys_retained": true, + "read_after_write_during_outage": true, + "read_after_write_after_reconnect_other_replica": true + }, + "empty_cache_recovery": true, + "delayed_old_fill": true + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed" +} diff --git a/evidence/cache-epochs-after.json b/evidence/cache-epochs-after.json new file mode 100644 index 00000000..a92fc28b --- /dev/null +++ b/evidence/cache-epochs-after.json @@ -0,0 +1,373 @@ +{ + "stage": "after", + "recorded_at": "2026-10-13T10:10:30.537Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented API process in measured backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 16, + "duration_seconds": 10, + "warmup_seconds": 3, + "repetitions": 3, + "seed_messages": 10000, + "cold_burst_requests": 32, + "writes_per_repeat": 512, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; other Docker workloads share host resources; no capacity/SLA claim; fixtures bypass password KDF" + }, + "dist_sha256": { + "Chat/chat.service.js": "6fefd2a334e97f595e86699f8ec3832792b353c9f3a47568da802d36f1495027", + "cache/cache.service.js": "ec7c09ef55f9054176ace8c62a3690df6e717b54c36db9ef66b91bc34a761693" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 0.691, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 46.329, + "latency_ms": { + "p50": 611.222, + "p95": 672.153, + "p99": 672.232 + }, + "sql_queries": 66, + "sql_per_request": 2.0625, + "sql_calls": { + "SELECT:sessions": 106, + "SELECT:chat_members": 106, + "SELECT:messages": 2 + }, + "process_cpu_percent_one_core": 149.33, + "peak_process_rss_mib": 320.66 + }, + { + "workload": "warm-history", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.244, + "successes": 638, + "errors": 0, + "error_ratio": 0, + "successful_rps": 62.279, + "latency_ms": { + "p50": 169.157, + "p95": 677.14, + "p99": 952.33 + }, + "sql_queries": 1289, + "sql_per_request": 2.0204, + "sql_calls": { + "SELECT:sessions": 719, + "SELECT:chat_members": 723, + "SELECT:chats": 4, + "SELECT:users": 1, + "SELECT:messages": 85 + }, + "process_cpu_percent_one_core": 100.85, + "peak_process_rss_mib": 336.96 + }, + { + "workload": "history-cache-bypassed", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.317, + "successes": 397, + "errors": 0, + "error_ratio": 0, + "successful_rps": 38.482, + "latency_ms": { + "p50": 423.359, + "p95": 719.312, + "p99": 974.855 + }, + "sql_queries": 1203, + "sql_per_request": 3.0302, + "sql_calls": { + "SELECT:sessions": 398, + "SELECT:chat_members": 404, + "SELECT:messages": 397, + "SELECT:chats": 7, + "SELECT:users": 2, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 85.4, + "peak_process_rss_mib": 337.38 + }, + { + "workload": "writes-single-chat", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 12.201, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 41.963, + "latency_ms": { + "p50": 270.615, + "p95": 1006.641, + "p99": 1396.859 + }, + "sql_queries": 2053, + "sql_per_request": 4.0098, + "sql_calls": { + "SELECT:sessions": 513, + "SELECT:chat_members": 516, + "BEGIN:other": 512, + "UPDATE:chats": 512, + "INSERT:messages": 512, + "COMMIT:other": 512, + "SELECT:chats": 3, + "SELECT:users": 2, + "SELECT:messages": 1 + }, + "process_cpu_percent_one_core": 83.81, + "peak_process_rss_mib": 338.63 + }, + { + "workload": "cold-history-burst", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 0.146, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 219.517, + "latency_ms": { + "p50": 138.981, + "p95": 142.972, + "p99": 143.135 + }, + "sql_queries": 96, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 230, + "SELECT:chat_members": 230, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 131.45, + "peak_process_rss_mib": 338.75 + }, + { + "workload": "warm-history", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.025, + "successes": 1394, + "errors": 0, + "error_ratio": 0, + "successful_rps": 139.051, + "latency_ms": { + "p50": 67.992, + "p95": 332.51, + "p99": 672.764 + }, + "sql_queries": 2788, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 1645, + "SELECT:chat_members": 1645, + "SELECT:messages": 251 + }, + "process_cpu_percent_one_core": 97.71, + "peak_process_rss_mib": 341.38 + }, + { + "workload": "history-cache-bypassed", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.185, + "successes": 1024, + "errors": 0, + "error_ratio": 0, + "successful_rps": 100.544, + "latency_ms": { + "p50": 124.908, + "p95": 373.546, + "p99": 531.859 + }, + "sql_queries": 3072, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 1025, + "SELECT:chat_members": 1026, + "SELECT:messages": 1024, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 108.45, + "peak_process_rss_mib": 341.75 + }, + { + "workload": "writes-single-chat", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 12.073, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 42.407, + "latency_ms": { + "p50": 286.47, + "p95": 894.578, + "p99": 1310.622 + }, + "sql_queries": 2048, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 513, + "SELECT:chat_members": 514, + "BEGIN:other": 512, + "UPDATE:chats": 512, + "INSERT:messages": 512, + "COMMIT:other": 512, + "SELECT:messages": 1, + "SELECT:users": 1, + "SELECT:chats": 1 + }, + "process_cpu_percent_one_core": 83.69, + "peak_process_rss_mib": 337.67 + }, + { + "workload": "cold-history-burst", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 0.333, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 96.08, + "latency_ms": { + "p50": 284.727, + "p95": 327.815, + "p99": 330.075 + }, + "sql_queries": 94, + "sql_per_request": 2.9375, + "sql_calls": { + "SELECT:sessions": 287, + "SELECT:chat_members": 287, + "SELECT:messages": 30 + }, + "process_cpu_percent_one_core": 118.44, + "peak_process_rss_mib": 337.67 + }, + { + "workload": "warm-history", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.044, + "successes": 1223, + "errors": 0, + "error_ratio": 0, + "successful_rps": 121.768, + "latency_ms": { + "p50": 91.481, + "p95": 321.382, + "p99": 734.962 + }, + "sql_queries": 2459, + "sql_per_request": 2.0106, + "sql_calls": { + "SELECT:sessions": 1473, + "SELECT:chat_members": 1478, + "SELECT:users": 3, + "SELECT:chats": 5, + "SELECT:messages": 250 + }, + "process_cpu_percent_one_core": 89.51, + "peak_process_rss_mib": 338.67 + }, + { + "workload": "history-cache-bypassed", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.068, + "successes": 1546, + "errors": 0, + "error_ratio": 0, + "successful_rps": 153.558, + "latency_ms": { + "p50": 80.795, + "p95": 232.002, + "p99": 308.766 + }, + "sql_queries": 4638, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 1547, + "SELECT:chat_members": 1548, + "SELECT:messages": 1546, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 110.91, + "peak_process_rss_mib": 340.04 + }, + { + "workload": "writes-single-chat", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 5.183, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 98.793, + "latency_ms": { + "p50": 128.122, + "p95": 353.18, + "p99": 583.008 + }, + "sql_queries": 2048, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 520, + "SELECT:chat_members": 526, + "BEGIN:other": 516, + "UPDATE:chats": 514, + "INSERT:messages": 514, + "COMMIT:other": 516, + "SELECT:messages": 7, + "INSERT:chats": 2, + "INSERT:chat_members": 2, + "SELECT:chats": 8, + "SELECT:users": 4, + "DELETE:chats": 1, + "DELETE:users": 1 + }, + "process_cpu_percent_one_core": 111.91, + "peak_process_rss_mib": 340.17 + } + ], + "correctness": { + "redis_reconnect": { + "old_keys_retained": true, + "read_after_write_during_outage": true, + "read_after_write_after_reconnect_other_replica": true + }, + "empty_cache_recovery": true, + "delayed_old_fill": true + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed", + "provenance_note": "Final measurements ran in dedicated benchmark containers via test/compose.benchmark.yaml; inherited exec-harness descriptions corrected; numeric measurements unchanged." +} diff --git a/evidence/cache-epochs-before-short.json b/evidence/cache-epochs-before-short.json new file mode 100644 index 00000000..f2fd7e6d --- /dev/null +++ b/evidence/cache-epochs-before-short.json @@ -0,0 +1,359 @@ +{ + "stage": "before", + "recorded_at": "2026-10-13T09:59:22.646Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented separate API process in running backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 16, + "duration_seconds": 5, + "repetitions": 3, + "seed_messages": 10000, + "cold_burst_requests": 32, + "writes_per_repeat": 128, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; idle production backend shares container; no capacity/SLA claim; fixtures bypass password KDF" + }, + "dist_sha256": { + "Chat/chat.service.js": "ea872420afc90a45acbffaebcc88137b8347928c9c13b9c4bdaa2d5a6feb1afb", + "cache/cache.service.js": "734ab028e3f492b5c85834b83f2a1cd099a1103f5ede165d4122d3d117a90e11" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 0.563, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 56.794, + "latency_ms": { + "p50": 514.259, + "p95": 549.926, + "p99": 550.079 + }, + "sql_queries": 50, + "sql_per_request": 1.5625, + "sql_calls": { + "SELECT:sessions": 81, + "SELECT:chat_members": 64, + "SELECT:messages": 3 + }, + "process_cpu_percent_one_core": 150.22, + "peak_process_rss_mib": 315.73 + }, + { + "workload": "warm-history", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 5.073, + "successes": 548, + "errors": 0, + "error_ratio": 0, + "successful_rps": 108.032, + "latency_ms": { + "p50": 130.008, + "p95": 291.287, + "p99": 356.116 + }, + "sql_queries": 769, + "sql_per_request": 1.4033, + "sql_calls": { + "SELECT:sessions": 620, + "SELECT:chat_members": 293, + "SELECT:messages": 72 + }, + "process_cpu_percent_one_core": 129.91, + "peak_process_rss_mib": 342.21 + }, + { + "workload": "history-cache-bypassed", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 5.068, + "successes": 367, + "errors": 0, + "error_ratio": 0, + "successful_rps": 72.409, + "latency_ms": { + "p50": 181.984, + "p95": 561.768, + "p99": 733.63 + }, + "sql_queries": 864, + "sql_per_request": 2.3542, + "sql_calls": { + "SELECT:sessions": 368, + "SELECT:chat_members": 132, + "SELECT:messages": 367, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 84.44, + "peak_process_rss_mib": 341.98 + }, + { + "workload": "writes-single-chat", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 1.191, + "successes": 128, + "errors": 0, + "error_ratio": 0, + "successful_rps": 107.445, + "latency_ms": { + "p50": 124.085, + "p95": 255.319, + "p99": 275.39 + }, + "sql_queries": 287, + "sql_per_request": 2.2422, + "sql_calls": { + "SELECT:sessions": 129, + "SELECT:chat_members": 33, + "INSERT:messages": 128, + "SELECT:messages": 1, + "SELECT:users": 1, + "SELECT:chats": 1 + }, + "process_cpu_percent_one_core": 107.51, + "peak_process_rss_mib": 342.6 + }, + { + "workload": "cold-history-burst", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 0.139, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 230.08, + "latency_ms": { + "p50": 106.698, + "p95": 133.11, + "p99": 134.927 + }, + "sql_queries": 53, + "sql_per_request": 1.6563, + "sql_calls": { + "SELECT:sessions": 125, + "SELECT:chat_members": 95, + "SELECT:messages": 19 + }, + "process_cpu_percent_one_core": 164.26, + "peak_process_rss_mib": 342.85 + }, + { + "workload": "warm-history", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 5.037, + "successes": 944, + "errors": 0, + "error_ratio": 0, + "successful_rps": 187.429, + "latency_ms": { + "p50": 70.743, + "p95": 135.177, + "p99": 358.38 + }, + "sql_queries": 1439, + "sql_per_request": 1.5244, + "sql_calls": { + "SELECT:sessions": 1015, + "SELECT:chat_members": 566, + "SELECT:messages": 71 + }, + "process_cpu_percent_one_core": 114.96, + "peak_process_rss_mib": 345.48 + }, + { + "workload": "history-cache-bypassed", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 5.098, + "successes": 366, + "errors": 0, + "error_ratio": 0, + "successful_rps": 71.799, + "latency_ms": { + "p50": 184.166, + "p95": 436.018, + "p99": 589.32 + }, + "sql_queries": 833, + "sql_per_request": 2.276, + "sql_calls": { + "SELECT:sessions": 367, + "SELECT:chat_members": 103, + "SELECT:messages": 366, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 88.68, + "peak_process_rss_mib": 345.6 + }, + { + "workload": "writes-single-chat", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 0.922, + "successes": 128, + "errors": 0, + "error_ratio": 0, + "successful_rps": 138.768, + "latency_ms": { + "p50": 95.911, + "p95": 195.872, + "p99": 199.522 + }, + "sql_queries": 293, + "sql_per_request": 2.2891, + "sql_calls": { + "SELECT:sessions": 129, + "SELECT:chat_members": 39, + "INSERT:messages": 128, + "SELECT:messages": 1, + "SELECT:users": 1, + "SELECT:chats": 1 + }, + "process_cpu_percent_one_core": 127.07, + "peak_process_rss_mib": 345.6 + }, + { + "workload": "cold-history-burst", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 0.179, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 179.248, + "latency_ms": { + "p50": 162.178, + "p95": 171.677, + "p99": 171.76 + }, + "sql_queries": 54, + "sql_per_request": 1.6875, + "sql_calls": { + "SELECT:sessions": 84, + "SELECT:chat_members": 54, + "SELECT:messages": 20 + }, + "process_cpu_percent_one_core": 142.84, + "peak_process_rss_mib": 345.6 + }, + { + "workload": "warm-history", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 5.034, + "successes": 901, + "errors": 0, + "error_ratio": 0, + "successful_rps": 178.972, + "latency_ms": { + "p50": 77.543, + "p95": 176.298, + "p99": 237.299 + }, + "sql_queries": 1312, + "sql_per_request": 1.4562, + "sql_calls": { + "SELECT:sessions": 937, + "SELECT:chat_members": 447, + "SELECT:messages": 36 + }, + "process_cpu_percent_one_core": 112.3, + "peak_process_rss_mib": 345.37 + }, + { + "workload": "history-cache-bypassed", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 5.178, + "successes": 306, + "errors": 0, + "error_ratio": 0, + "successful_rps": 59.098, + "latency_ms": { + "p50": 260.185, + "p95": 428.119, + "p99": 458.774 + }, + "sql_queries": 686, + "sql_per_request": 2.2418, + "sql_calls": { + "SELECT:sessions": 307, + "SELECT:chat_members": 76, + "SELECT:messages": 306, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 86.24, + "peak_process_rss_mib": 345.37 + }, + { + "workload": "writes-single-chat", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 1.401, + "successes": 128, + "errors": 0, + "error_ratio": 0, + "successful_rps": 91.365, + "latency_ms": { + "p50": 150.748, + "p95": 257.31, + "p99": 349.809 + }, + "sql_queries": 298, + "sql_per_request": 2.3281, + "sql_calls": { + "SELECT:sessions": 136, + "SELECT:chat_members": 56, + "INSERT:messages": 130, + "SELECT:messages": 5, + "BEGIN:other": 2, + "INSERT:chats": 2, + "INSERT:chat_members": 2, + "SELECT:chats": 8, + "COMMIT:other": 2, + "SELECT:users": 4, + "DELETE:chats": 1, + "DELETE:users": 1 + }, + "process_cpu_percent_one_core": 109.86, + "peak_process_rss_mib": 345.49 + } + ], + "correctness": { + "redis_reconnect": { + "old_keys_retained": true, + "read_after_write_during_outage": true, + "read_after_write_after_reconnect_other_replica": false + }, + "empty_cache_recovery": true, + "delayed_old_fill": false + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed" +} diff --git a/evidence/cache-epochs-before.json b/evidence/cache-epochs-before.json new file mode 100644 index 00000000..8151f1e3 --- /dev/null +++ b/evidence/cache-epochs-before.json @@ -0,0 +1,364 @@ +{ + "stage": "before", + "recorded_at": "2026-10-13T10:07:18.394Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented API process in measured backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 16, + "duration_seconds": 10, + "warmup_seconds": 3, + "repetitions": 3, + "seed_messages": 10000, + "cold_burst_requests": 32, + "writes_per_repeat": 512, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; other Docker workloads share host resources; no capacity/SLA claim; fixtures bypass password KDF" + }, + "dist_sha256": { + "Chat/chat.service.js": "ea872420afc90a45acbffaebcc88137b8347928c9c13b9c4bdaa2d5a6feb1afb", + "cache/cache.service.js": "734ab028e3f492b5c85834b83f2a1cd099a1103f5ede165d4122d3d117a90e11" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 0.447, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 71.563, + "latency_ms": { + "p50": 401.423, + "p95": 423.105, + "p99": 425.045 + }, + "sql_queries": 51, + "sql_per_request": 1.5938, + "sql_calls": { + "SELECT:sessions": 232, + "SELECT:chat_members": 216, + "SELECT:messages": 3 + }, + "process_cpu_percent_one_core": 155.27, + "peak_process_rss_mib": 324.13 + }, + { + "workload": "warm-history", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.269, + "successes": 1129, + "errors": 0, + "error_ratio": 0, + "successful_rps": 109.938, + "latency_ms": { + "p50": 122.379, + "p95": 292.651, + "p99": 616.608 + }, + "sql_queries": 1562, + "sql_per_request": 1.3835, + "sql_calls": { + "SELECT:sessions": 1197, + "SELECT:chat_members": 501, + "SELECT:messages": 68, + "SELECT:users": 1 + }, + "process_cpu_percent_one_core": 110.56, + "peak_process_rss_mib": 347.14 + }, + { + "workload": "history-cache-bypassed", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.322, + "successes": 1222, + "errors": 0, + "error_ratio": 0, + "successful_rps": 118.389, + "latency_ms": { + "p50": 102.258, + "p95": 343.74, + "p99": 535.564 + }, + "sql_queries": 2859, + "sql_per_request": 2.3396, + "sql_calls": { + "SELECT:sessions": 1223, + "SELECT:chat_members": 416, + "SELECT:messages": 1222, + "SELECT:users": 1, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 102.93, + "peak_process_rss_mib": 347.76 + }, + { + "workload": "writes-single-chat", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 13.557, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 37.766, + "latency_ms": { + "p50": 326.629, + "p95": 922.782, + "p99": 1374.53 + }, + "sql_queries": 1179, + "sql_per_request": 2.3027, + "sql_calls": { + "SELECT:sessions": 513, + "SELECT:chat_members": 155, + "INSERT:messages": 512, + "SELECT:users": 3, + "SELECT:messages": 1, + "SELECT:chats": 1 + }, + "process_cpu_percent_one_core": 83.01, + "peak_process_rss_mib": 348.89 + }, + { + "workload": "cold-history-burst", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 0.945, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 33.861, + "latency_ms": { + "p50": 822.475, + "p95": 920.815, + "p99": 929.771 + }, + "sql_queries": 66, + "sql_per_request": 2.0625, + "sql_calls": { + "SELECT:sessions": 93, + "SELECT:chat_members": 63, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 72.88, + "peak_process_rss_mib": 349.01 + }, + { + "workload": "warm-history", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.065, + "successes": 937, + "errors": 0, + "error_ratio": 0, + "successful_rps": 93.097, + "latency_ms": { + "p50": 142.64, + "p95": 332.841, + "p99": 1107.841 + }, + "sql_queries": 1323, + "sql_per_request": 1.412, + "sql_calls": { + "SELECT:sessions": 1180, + "SELECT:chat_members": 614, + "SELECT:users": 6, + "SELECT:messages": 252 + }, + "process_cpu_percent_one_core": 105.28, + "peak_process_rss_mib": 350.01 + }, + { + "workload": "history-cache-bypassed", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.047, + "successes": 1286, + "errors": 0, + "error_ratio": 0, + "successful_rps": 127.998, + "latency_ms": { + "p50": 98.94, + "p95": 288.491, + "p99": 565.282 + }, + "sql_queries": 3059, + "sql_per_request": 2.3787, + "sql_calls": { + "SELECT:sessions": 1287, + "SELECT:chat_members": 489, + "SELECT:messages": 1286, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 108.02, + "peak_process_rss_mib": 346.76 + }, + { + "workload": "writes-single-chat", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 3.862, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 132.588, + "latency_ms": { + "p50": 106.471, + "p95": 216.752, + "p99": 308.493 + }, + "sql_queries": 1184, + "sql_per_request": 2.3125, + "sql_calls": { + "SELECT:sessions": 513, + "SELECT:chat_members": 162, + "INSERT:messages": 512, + "SELECT:messages": 1, + "SELECT:users": 1, + "SELECT:chats": 1 + }, + "process_cpu_percent_one_core": 114.95, + "peak_process_rss_mib": 347.01 + }, + { + "workload": "cold-history-burst", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 0.161, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 199.281, + "latency_ms": { + "p50": 120.258, + "p95": 158.674, + "p99": 158.852 + }, + "sql_queries": 66, + "sql_per_request": 2.0625, + "sql_calls": { + "SELECT:sessions": 281, + "SELECT:chat_members": 251, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 100.51, + "peak_process_rss_mib": 347.01 + }, + { + "workload": "warm-history", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.023, + "successes": 1156, + "errors": 0, + "error_ratio": 0, + "successful_rps": 115.338, + "latency_ms": { + "p50": 125.309, + "p95": 267.044, + "p99": 339.122 + }, + "sql_queries": 1658, + "sql_per_request": 1.4343, + "sql_calls": { + "SELECT:sessions": 1340, + "SELECT:chat_members": 686, + "SELECT:messages": 184 + }, + "process_cpu_percent_one_core": 98.86, + "peak_process_rss_mib": 348.14 + }, + { + "workload": "history-cache-bypassed", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.177, + "successes": 1261, + "errors": 0, + "error_ratio": 0, + "successful_rps": 123.902, + "latency_ms": { + "p50": 81.035, + "p95": 385.746, + "p99": 562.039 + }, + "sql_queries": 3074, + "sql_per_request": 2.4377, + "sql_calls": { + "SELECT:sessions": 1262, + "SELECT:chat_members": 554, + "SELECT:messages": 1261, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 101.1, + "peak_process_rss_mib": 348.26 + }, + { + "workload": "writes-single-chat", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 4.582, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 111.731, + "latency_ms": { + "p50": 142.22, + "p95": 206.768, + "p99": 278.867 + }, + "sql_queries": 1222, + "sql_per_request": 2.3867, + "sql_calls": { + "SELECT:sessions": 520, + "SELECT:chat_members": 212, + "INSERT:messages": 514, + "SELECT:messages": 5, + "BEGIN:other": 2, + "INSERT:chats": 2, + "INSERT:chat_members": 2, + "SELECT:chats": 8, + "COMMIT:other": 2, + "SELECT:users": 4, + "DELETE:chats": 1, + "DELETE:users": 1 + }, + "process_cpu_percent_one_core": 97.65, + "peak_process_rss_mib": 348.26 + } + ], + "correctness": { + "redis_reconnect": { + "old_keys_retained": true, + "read_after_write_during_outage": true, + "read_after_write_after_reconnect_other_replica": false + }, + "empty_cache_recovery": true, + "delayed_old_fill": false + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed", + "provenance_note": "Final measurements ran in dedicated benchmark containers via test/compose.benchmark.yaml; inherited exec-harness descriptions corrected; numeric measurements unchanged." +} diff --git a/evidence/cache-epochs-environment.json b/evidence/cache-epochs-environment.json new file mode 100644 index 00000000..8f41a1ac --- /dev/null +++ b/evidence/cache-epochs-environment.json @@ -0,0 +1,36 @@ +{ + "recorded_at": "2026-10-13T10:08:09.0775006Z", + "host_cpu": "AMD Ryzen 3 3250U with Radeon Graphics ", + "host_physical_cores": 2, + "host_logical_processors": 4, + "host_ram_bytes": 6358704128, + "docker_version": "28.3.2", + "docker_cpu_count": 4, + "docker_ram_bytes": 3008614400, + "docker_kernel": "6.6.87.2-microsoft-standard-WSL2", + "containers": [ + { + "name": "/mtusi2026lab2-fork-backend-1", + "image": "sha256:3f5578294952186fbdcf8c100f866b2397d17d08073cab66f1543f0a121e0196", + "memory_limit_bytes": 0, + "nano_cpus_limit": 0, + "cpu_quota": 0 + }, + { + "name": "/mtusi2026lab2-fork-postgres-1", + "image": "sha256:f3bd19c606e442c3d7bdfa8002e03fe260a1023351e0ea4598032022b68dd6e3", + "memory_limit_bytes": 0, + "nano_cpus_limit": 0, + "cpu_quota": 0 + }, + { + "name": "/mtusi2026lab2-fork-redis-1", + "image": "sha256:bb186d083732f669da90be8b0f975a37812b15e913465bb14d845db72a4e3e08", + "memory_limit_bytes": 0, + "nano_cpus_limit": 0, + "cpu_quota": 0 + } + ], + "before_image": "sha256:075170aed76a42aa98b435cfb918d83879259b7e17177275d5274e328198e119", + "before_image_local_tag": "lab2-cache-epochs:before" +} diff --git a/evidence/cache-epochs-full-restart.json b/evidence/cache-epochs-full-restart.json new file mode 100644 index 00000000..ded51169 --- /dev/null +++ b/evidence/cache-epochs-full-restart.json @@ -0,0 +1,79 @@ +{ + "recorded_at": "2026-10-13T10:15:19.958451+00:00", + "scenario": "full-restart", + "command": "python test/test-persistence.py --scenario full-restart --base-url http://127.0.0.1:8080", + "hook": "test/restart.cmd", + "elapsed_seconds": 49.081, + "result": "PASS", + "test_output": "Restarting backend, PostgreSQL and Redis; hook output suppressed.\nPASS: users, chat, membership, confirmed message and all existing sessions survived; access control, new writes and logout work after restart.", + "before": { + "backend": { + "id": "3bbcc8a6cb099f673f0fa5ab017c4a3e0a3a392eefc45c3b87478b2209c6f737", + "started_at": "2026-10-13T10:02:49.349051437Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_backend_data", + "destination": "/app/data" + } + ] + }, + "postgres": { + "id": "c2fbbfded445fbedeff7ae87dcc06b05bedb0d2b2c89050e4a1a2236b06398f5", + "started_at": "2026-10-13T09:02:55.540382028Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_postgres_data", + "destination": "/var/lib/postgresql/data" + } + ] + }, + "redis": { + "id": "547184576f5e04a076d8c41e504cb0669c4f7c17daed437a6ae1db41ee5d1435", + "started_at": "2026-10-13T09:02:55.507017233Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_redis_data", + "destination": "/data" + } + ] + } + }, + "after": { + "backend": { + "id": "3bbcc8a6cb099f673f0fa5ab017c4a3e0a3a392eefc45c3b87478b2209c6f737", + "started_at": "2026-10-13T10:15:01.980331864Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_backend_data", + "destination": "/app/data" + } + ] + }, + "postgres": { + "id": "c2fbbfded445fbedeff7ae87dcc06b05bedb0d2b2c89050e4a1a2236b06398f5", + "started_at": "2026-10-13T10:14:53.938044159Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_postgres_data", + "destination": "/var/lib/postgresql/data" + } + ] + }, + "redis": { + "id": "547184576f5e04a076d8c41e504cb0669c4f7c17daed437a6ae1db41ee5d1435", + "started_at": "2026-10-13T10:14:53.936011949Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_redis_data", + "destination": "/data" + } + ] + } + } +} diff --git a/evidence/cache-epochs-optimization-environment.json b/evidence/cache-epochs-optimization-environment.json new file mode 100644 index 00000000..696f95b1 --- /dev/null +++ b/evidence/cache-epochs-optimization-environment.json @@ -0,0 +1,14 @@ +{ + "recorded_on": "2026-10-13", + "build_command": "docker compose build backend migrate", + "startup_command": "docker compose up -d backend", + "backend_image": "sha256:a4799affbf3b82d4a120296b16306e7693c13007013061a911fb5d38ceb6d945", + "backend_status_after_measurement": "running healthy", + "benchmark_command": "docker compose -f compose.yaml -f test/compose.benchmark.yaml run --rm --no-deps --pull never benchmark node test/cache-benchmark.mjs after /results/cache-epochs-optimized.json", + "baseline": "cache-epochs-after.json", + "baseline_rerun": false, + "baseline_rerun_note": "The old image was unavailable after rebuilding and recreating backend; comparison uses the previously recorded measurement.", + "result": "cache-epochs-optimized.json", + "shared_host": true, + "password_kdf_measured": false +} diff --git a/evidence/cache-epochs-optimized.json b/evidence/cache-epochs-optimized.json new file mode 100644 index 00000000..663ca8f0 --- /dev/null +++ b/evidence/cache-epochs-optimized.json @@ -0,0 +1,364 @@ +{ + "stage": "after", + "recorded_at": "2026-10-13T12:44:51.207Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented API process in measured backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 16, + "duration_seconds": 10, + "warmup_seconds": 3, + "repetitions": 3, + "seed_messages": 10000, + "cold_burst_requests": 32, + "writes_per_repeat": 512, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; other Docker workloads share host resources; no capacity/SLA claim; fixtures bypass password KDF" + }, + "dist_sha256": { + "Chat/chat.service.js": "f0f8b0cd357dcbb2ba6f401e30dadfcf19ab0deb7c1a812b306126d0478289e2", + "cache/cache.service.js": "ec7c09ef55f9054176ace8c62a3690df6e717b54c36db9ef66b91bc34a761693" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 0.98, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 32.646, + "latency_ms": { + "p50": 810.778, + "p95": 904.858, + "p99": 925.845 + }, + "sql_queries": 68, + "sql_per_request": 2.125, + "sql_calls": { + "SELECT:sessions": 309, + "SELECT:chat_members": 309, + "SELECT:messages": 4 + }, + "process_cpu_percent_one_core": 137.76, + "peak_process_rss_mib": 324.18 + }, + { + "workload": "warm-history", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.11, + "successes": 1488, + "errors": 0, + "error_ratio": 0, + "successful_rps": 147.176, + "latency_ms": { + "p50": 86.063, + "p95": 234.439, + "p99": 312.104 + }, + "sql_queries": 2976, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 1545, + "SELECT:chat_members": 1545, + "SELECT:messages": 57 + }, + "process_cpu_percent_one_core": 106.27, + "peak_process_rss_mib": 337.46 + }, + { + "workload": "history-cache-bypassed", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.374, + "successes": 322, + "errors": 0, + "error_ratio": 0, + "successful_rps": 31.039, + "latency_ms": { + "p50": 436.283, + "p95": 929.932, + "p99": 1474.923 + }, + "sql_queries": 976, + "sql_per_request": 3.0311, + "sql_calls": { + "SELECT:sessions": 323, + "SELECT:chat_members": 324, + "SELECT:messages": 322, + "SELECT:users": 10, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 66.54, + "peak_process_rss_mib": 337.96 + }, + { + "workload": "writes-single-chat", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.287, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 49.771, + "latency_ms": { + "p50": 260.806, + "p95": 738.898, + "p99": 965.908 + }, + "sql_queries": 1034, + "sql_per_request": 2.0195, + "sql_calls": { + "SELECT:sessions": 513, + "WITH:messages": 512, + "SELECT:users": 11, + "SELECT:messages": 1, + "SELECT:chat_members": 2, + "SELECT:chats": 1 + }, + "process_cpu_percent_one_core": 93.87, + "peak_process_rss_mib": 338.84 + }, + { + "workload": "cold-history-burst", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 0.77, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 41.537, + "latency_ms": { + "p50": 672.643, + "p95": 745.713, + "p99": 748.905 + }, + "sql_queries": 96, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 93, + "SELECT:chat_members": 93, + "SELECT:messages": 32, + "SELECT:users": 1 + }, + "process_cpu_percent_one_core": 58.09, + "peak_process_rss_mib": 338.96 + }, + { + "workload": "warm-history", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.214, + "successes": 833, + "errors": 0, + "error_ratio": 0, + "successful_rps": 81.558, + "latency_ms": { + "p50": 128.736, + "p95": 448.026, + "p99": 1544.627 + }, + "sql_queries": 1681, + "sql_per_request": 2.018, + "sql_calls": { + "SELECT:sessions": 930, + "SELECT:chat_members": 930, + "SELECT:messages": 107, + "SELECT:users": 5 + }, + "process_cpu_percent_one_core": 94.41, + "peak_process_rss_mib": 340.34 + }, + { + "workload": "history-cache-bypassed", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.064, + "successes": 1255, + "errors": 0, + "error_ratio": 0, + "successful_rps": 124.707, + "latency_ms": { + "p50": 106.65, + "p95": 266.189, + "p99": 359.971 + }, + "sql_queries": 3765, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 1256, + "SELECT:chat_members": 1257, + "SELECT:messages": 1255, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 111.86, + "peak_process_rss_mib": 340.84 + }, + { + "workload": "writes-single-chat", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 6.533, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 78.376, + "latency_ms": { + "p50": 177.2, + "p95": 449.017, + "p99": 845.318 + }, + "sql_queries": 1024, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 513, + "WITH:messages": 512, + "SELECT:messages": 1, + "SELECT:users": 1, + "SELECT:chat_members": 2, + "SELECT:chats": 1 + }, + "process_cpu_percent_one_core": 73.1, + "peak_process_rss_mib": 336.5 + }, + { + "workload": "cold-history-burst", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 0.195, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 164.292, + "latency_ms": { + "p50": 154.84, + "p95": 192.727, + "p99": 193.302 + }, + "sql_queries": 96, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 363, + "SELECT:chat_members": 363, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 145.63, + "peak_process_rss_mib": 336.5 + }, + { + "workload": "warm-history", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.083, + "successes": 1743, + "errors": 0, + "error_ratio": 0, + "successful_rps": 172.865, + "latency_ms": { + "p50": 70.009, + "p95": 264.654, + "p99": 375.625 + }, + "sql_queries": 3486, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 2064, + "SELECT:chat_members": 2064, + "SELECT:messages": 321 + }, + "process_cpu_percent_one_core": 99.18, + "peak_process_rss_mib": 337.63 + }, + { + "workload": "history-cache-bypassed", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.049, + "successes": 1211, + "errors": 0, + "error_ratio": 0, + "successful_rps": 120.513, + "latency_ms": { + "p50": 95.552, + "p95": 318.854, + "p99": 545.995 + }, + "sql_queries": 3634, + "sql_per_request": 3.0008, + "sql_calls": { + "SELECT:sessions": 1212, + "SELECT:chat_members": 1213, + "SELECT:messages": 1211, + "SELECT:users": 1, + "BEGIN:other": 1, + "INSERT:chats": 1, + "INSERT:chat_members": 1, + "SELECT:chats": 2, + "COMMIT:other": 1 + }, + "process_cpu_percent_one_core": 103.04, + "peak_process_rss_mib": 337.88 + }, + { + "workload": "writes-single-chat", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 2.292, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 223.362, + "latency_ms": { + "p50": 67.388, + "p95": 116.128, + "p99": 143.105 + }, + "sql_queries": 1024, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 520, + "WITH:messages": 514, + "SELECT:messages": 7, + "BEGIN:other": 2, + "INSERT:chats": 2, + "INSERT:chat_members": 2, + "SELECT:chats": 2, + "COMMIT:other": 2, + "SELECT:chat_members": 6, + "SELECT:users": 4, + "DELETE:chats": 1, + "DELETE:users": 1 + }, + "process_cpu_percent_one_core": 116.59, + "peak_process_rss_mib": 337.88 + } + ], + "correctness": { + "redis_reconnect": { + "old_keys_retained": true, + "read_after_write_during_outage": true, + "read_after_write_after_reconnect_other_replica": true + }, + "empty_cache_recovery": true, + "delayed_old_fill": true + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed" +} diff --git a/evidence/cache-epochs-smoke.txt b/evidence/cache-epochs-smoke.txt new file mode 100644 index 00000000..92154196 --- /dev/null +++ b/evidence/cache-epochs-smoke.txt @@ -0,0 +1 @@ +PASS: lab2 public API scenario; infrastructure and grading evidence remain separate. diff --git a/evidence/cache-strategy-averages.json b/evidence/cache-strategy-averages.json new file mode 100644 index 00000000..5edffc08 --- /dev/null +++ b/evidence/cache-strategy-averages.json @@ -0,0 +1,130 @@ +[ + { + "workload": "cold-history-burst", + "variant": "Redis и эпохи", + "successes": 96, + "errors": 0, + "mean_rps": 40.78164825828378, + "mean_latency_ms": 696.118, + "mean_p95_ms": 747.7330000000001, + "sql_per_request": 2.6875, + "median_rps": 152.051, + "repeat_rps": [ + 15.856, + 253.886, + 152.051 + ] + }, + { + "workload": "cold-history-burst", + "variant": "Без Redis и эпох", + "successes": 96, + "errors": 0, + "mean_rps": 13.292716698975354, + "mean_latency_ms": 1928.236666666667, + "mean_p95_ms": 2329.4153333333334, + "sql_per_request": 4, + "median_rps": 14.503, + "repeat_rps": [ + 7.221, + 14.503, + 54.771 + ] + }, + { + "workload": "warm-history", + "variant": "Redis и эпохи", + "successes": 5021, + "errors": 0, + "mean_rps": 166.20324395895398, + "mean_latency_ms": 95.88716530571598, + "mean_p95_ms": 234.04766666666663, + "sql_per_request": 2.0005974905397332, + "median_rps": 164.773, + "repeat_rps": [ + 117.759, + 215.98, + 164.773 + ] + }, + { + "workload": "warm-history", + "variant": "Без Redis и эпох", + "successes": 1328, + "errors": 0, + "mean_rps": 42.89544235924932, + "mean_latency_ms": 367.9795504518072, + "mean_p95_ms": 1276.5203333333334, + "sql_per_request": 4, + "median_rps": 32.229, + "repeat_rps": [ + 10.493, + 32.229, + 87.24 + ] + }, + { + "workload": "history-cache-bypassed", + "variant": "Redis и эпохи", + "successes": 4361, + "errors": 0, + "mean_rps": 144.25112463614713, + "mean_latency_ms": 110.48886677367577, + "mean_p95_ms": 245.43433333333334, + "sql_per_request": 3, + "median_rps": 138.041, + "repeat_rps": [ + 121.508, + 173.29, + 138.041 + ] + }, + { + "workload": "history-cache-bypassed", + "variant": "Без Redis и эпох", + "successes": 2310, + "errors": 0, + "mean_rps": 75.05360972122945, + "mean_latency_ms": 211.4604606060606, + "mean_p95_ms": 652.2803333333334, + "sql_per_request": 4, + "median_rps": 85.347, + "repeat_rps": [ + 29.122, + 85.347, + 111.971 + ] + }, + { + "workload": "writes-single-chat", + "variant": "Redis и эпохи", + "successes": 1536, + "errors": 0, + "mean_rps": 125.02034836399152, + "mean_latency_ms": 126.96133333333334, + "mean_p95_ms": 288.68533333333335, + "sql_per_request": 2, + "median_rps": 144.623, + "repeat_rps": [ + 144.623, + 230.243, + 78.507 + ] + }, + { + "workload": "writes-single-chat", + "variant": "Без Redis и эпох", + "successes": 1536, + "errors": 0, + "mean_rps": 38.749716188602136, + "mean_latency_ms": 410.8933333333334, + "mean_p95_ms": 903.404, + "sql_per_request": 3, + "median_rps": 57.224, + "repeat_rps": [ + 20.933, + 57.224, + 82.146 + ] + } +] diff --git a/evidence/cache-strategy-buckets-averages.json b/evidence/cache-strategy-buckets-averages.json new file mode 100644 index 00000000..a688f79e --- /dev/null +++ b/evidence/cache-strategy-buckets-averages.json @@ -0,0 +1,98 @@ +[ + { + "workload": "cold-history-burst", + "variant": "Redis и эпохи", + "successes": 192, + "errors": 0, + "mean_rps": 46.66990763247448, + "mean_latency_ms": 999.8886666666667, + "mean_p95_ms": 1320.421, + "sql_per_request": 1.6354166666666667, + "median_rps": 146.31, + "repeat_rps": [ + 18.471, + 146.31, + 301.879 + ] + }, + { + "workload": "cold-history-burst", + "variant": "Без Redis и эпох", + "successes": 192, + "errors": 0, + "mean_rps": 25.29977599156674, + "mean_latency_ms": 1941.6126666666669, + "mean_p95_ms": 2450.7083333333335, + "sql_per_request": 2, + "median_rps": 205.101, + "repeat_rps": [ + 9.141, + 231.506, + 205.101 + ] + }, + { + "workload": "warm-history", + "variant": "Redis и эпохи", + "successes": 33260, + "errors": 0, + "mean_rps": 184.21081781627657, + "mean_latency_ms": 173.46601040288635, + "mean_p95_ms": 427.6743333333334, + "sql_per_request": 1.0089897775105232, + "median_rps": 174.524, + "repeat_rps": [ + 156.764, + 221.493, + 174.524 + ] + }, + { + "workload": "warm-history", + "variant": "Без Redis и эпох", + "successes": 23473, + "errors": 0, + "mean_rps": 130.21312948642563, + "mean_latency_ms": 245.4783085672901, + "mean_p95_ms": 762.3959999999998, + "sql_per_request": 2, + "median_rps": 154.284, + "repeat_rps": [ + 71.208, + 154.284, + 165.155 + ] + }, + { + "workload": "writes-single-chat", + "variant": "Redis и эпохи", + "successes": 12288, + "errors": 0, + "mean_rps": 120.6337986687872, + "mean_latency_ms": 264.88033333333334, + "mean_p95_ms": 666.798, + "sql_per_request": 2, + "median_rps": 112.463, + "repeat_rps": [ + 86.54, + 226.178, + 112.463 + ] + }, + { + "workload": "writes-single-chat", + "variant": "Без Redis и эпох", + "successes": 12288, + "errors": 0, + "mean_rps": 128.2792746708981, + "mean_latency_ms": 249.03166666666667, + "mean_p95_ms": 556.831, + "sql_per_request": 2, + "median_rps": 135.958, + "repeat_rps": [ + 114.551, + 136.96, + 135.958 + ] + } +] diff --git a/evidence/cache-strategy-buckets-experiment.json b/evidence/cache-strategy-buckets-experiment.json new file mode 100644 index 00000000..ab2e5d6e --- /dev/null +++ b/evidence/cache-strategy-buckets-experiment.json @@ -0,0 +1,79 @@ +{ + "recorded_at": "2026-10-13T15:33:12.472Z", + "image": "sha256:02a5d9ca3816781e5931a82926b6a62858b1abf1eb9a0244da79d45e5787b020", + "modified_sources": { + "Chat/chat.service.ts": { + "original_source": "31261ecc0c40ddb40de947e8b7dc27d9a4b0269e0d8c4ff7818c5449953f36bc", + "experiment_source": "5941c5311816cfcaedad4ec40952d29b9b3f464b2d039e0345b7dbc9285c1ffa", + "experiment_js": "8d5b8d2072c8d3f2ea5736a065782778f58cd8932ea69877a41e45b555b99536" + }, + "Auth/auth.service.ts": { + "original_source": "78c7c8567a12347a9a65343d3ead5c931cecba34f0b83565f41205f8d61aa5b1", + "experiment_source": "2a87a69ec2f7e66602c3f601da8568520a7a89c2539fd1802f01e43e2a1cf105", + "experiment_js": "75af4ff945f2c3af7a224ca773e0d4357e27e0fbe64cdc050bc6b1875c04d0e9" + }, + "User/user.guard.ts": { + "original_source": "20b05a0e5272a4ee1ccbddef83494e62621ffb0236e56a15c17e7f8f0083f6d7", + "experiment_source": "508995073333183df4bda2fb5a0b97311ba40ebec6cbcd56bf8d947b3849a6e4", + "experiment_js": "4c2b79845c3e83b84d0a219b233c0b7d6f3782ecd80758cd7be6e461ce87cdd7" + }, + "Chat/chat.controller.ts": { + "original_source": "1e3b1e0a5abc053625c5b1a6dc14f5b5b3e87676b1af0bdd73e78ad95d1eb325", + "experiment_source": "a08adb9a951725731262f4332901fac2a6653441442b184800b12e02a47a36f3", + "experiment_js": "df7593892dcf458e23c7f85dde69b945b137c6226373e3ee4b75df5d82b45aba" + }, + "cache/cache.service.ts": { + "original_source": "f27ab6ff5a0f8da05936272bafbc7cea38198074e5c7d17c2e01ae0bf29986b3", + "experiment_source": "d9abf1e2b368010934214a8730ca99d085eda57c748bbc69ccd5a0a085d66a9a", + "experiment_js": "fa132f28aa07f0a7118d308a073c296dd319131b63c15bd9a700d8ac874cd7a1" + }, + "User/user.service.ts": { + "original_source": "0737e88c408510bc17ec0597c3812be855c03499dfc2ad5ba6a4b1e85bb1c5e7", + "experiment_source": "7596e2b9a5aacb4f19f5de32cd502c89b09080235ae5b8cf821f35b95ae8056c", + "experiment_js": "90cfd8c45b02a6d4a5220a869d86ab5bac66b6b4c6a9f79685cd7c24a97fc2cb" + } + }, + "command": [ + "docker", + "compose", + "-f", + "compose.yaml", + "-f", + "test/compose.benchmark.yaml", + "-f", + "C:\\Users\\olpin\\AppData\\Local\\Temp\\lab2-no-epochs-y2Di7V\\compose.no-epochs.yaml", + "run", + "--rm", + "--no-deps", + "--pull", + "never", + "benchmark", + "node", + "/experiment/cache-benchmark.mjs", + "after", + "/results/cache-strategy-buckets-no-redis-no-epochs.json", + "--concurrency", + "32", + "--duration-seconds", + "60", + "--warmup-seconds", + "10", + "--repetitions", + "3", + "--seed-messages", + "100000", + "--cold-burst", + "64", + "--writes-per-repeat", + "4096", + "--skip-history-control" + ], + "implementation": "Separate temporary source copies compiled with TypeScript and mounted over six application modules. Workspace sources and running backend remain unchanged.", + "schema": "Epoch storage remains in the database; experiment API paths do not update counters or read authoritative epoch values.", + "redis": "Application starts without CACHE_URL. Observer/proxy are retained only for benchmark setup and cleanup.", + "full_result": "cache-strategy-buckets-full.json", + "experiment_result": "cache-strategy-buckets-no-redis-no-epochs.json", + "exit_code": 0, + "signal": null, + "sources_unchanged": true +} diff --git a/evidence/cache-strategy-buckets-full.json b/evidence/cache-strategy-buckets-full.json new file mode 100644 index 00000000..a0c82bc1 --- /dev/null +++ b/evidence/cache-strategy-buckets-full.json @@ -0,0 +1,262 @@ +{ + "stage": "after", + "recorded_at": "2026-10-13T15:25:47.899Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented API process in measured backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 32, + "duration_seconds": 60, + "warmup_seconds": 10, + "repetitions": 3, + "seed_messages": 100000, + "cold_burst_requests": 64, + "writes_per_repeat": 4096, + "history_control": false, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; other Docker workloads share host resources; no capacity/SLA claim; fixtures bypass password KDF" + }, + "dist_sha256": { + "Chat/chat.service.js": "d2b548d5ecb769de012a710d04a04658096b60a05e3776ec5aa05d30b827cb8b", + "cache/cache.service.js": "ec7c09ef55f9054176ace8c62a3690df6e717b54c36db9ef66b91bc34a761693", + "Auth/auth.service.js": "813d4cd5152687f4a32b4f12c1852c2070fea9ec3540a6951e691e3a7f975787", + "User/user.guard.js": "7b0ac310735e9678c36b2996b960f7719a6e590463b2ece04719b79919fbcc2d", + "Chat/chat.controller.js": "cce401ec9757fb9b074219f2c6e54b7ae029c18d857bcd3b1e45d9c205bbb5f0" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst", + "repeat": 1, + "concurrency": 64, + "elapsed_seconds": 3.465, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 18.471, + "latency_ms": { + "mean": 2479.197, + "p50": 2606.245, + "p95": 3324.299, + "p99": 3354.605 + }, + "sql_queries": 69, + "sql_per_request": 1.0781, + "sql_calls": { + "SELECT:chat_members": 64, + "SELECT:messages": 5 + }, + "process_cpu_percent_one_core": 76.08, + "peak_process_rss_mib": 518.86 + }, + { + "workload": "warm-history", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 60.416, + "successes": 9471, + "errors": 0, + "error_ratio": 0, + "successful_rps": 156.764, + "latency_ms": { + "mean": 203.598, + "p50": 139.567, + "p95": 525.738, + "p99": 1023.581 + }, + "sql_queries": 9628, + "sql_per_request": 1.0166, + "sql_calls": { + "SELECT:chat_members": 9471, + "SELECT:messages": 157 + }, + "process_cpu_percent_one_core": 101.3, + "peak_process_rss_mib": 535.37 + }, + { + "workload": "writes-single-chat", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 47.331, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 86.54, + "latency_ms": { + "mean": 369.031, + "p50": 280.196, + "p95": 924.786, + "p99": 1332.847 + }, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 4096, + "WITH:messages": 4096 + }, + "process_cpu_percent_one_core": 88.15, + "peak_process_rss_mib": 536.11 + }, + { + "workload": "cold-history-burst", + "repeat": 2, + "concurrency": 64, + "elapsed_seconds": 0.437, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 146.31, + "latency_ms": { + "mean": 359.503, + "p50": 353.104, + "p95": 428.472, + "p99": 433.08 + }, + "sql_queries": 122, + "sql_per_request": 1.9063, + "sql_calls": { + "SELECT:chat_members": 64, + "SELECT:messages": 58 + }, + "process_cpu_percent_one_core": 114.66, + "peak_process_rss_mib": 536.23 + }, + { + "workload": "warm-history", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 60.083, + "successes": 13308, + "errors": 0, + "error_ratio": 0, + "successful_rps": 221.493, + "latency_ms": { + "mean": 144.365, + "p50": 115.355, + "p95": 319.893, + "p99": 425.247 + }, + "sql_queries": 13345, + "sql_per_request": 1.0028, + "sql_calls": { + "SELECT:chat_members": 13308, + "SELECT:messages": 37 + }, + "process_cpu_percent_one_core": 102.17, + "peak_process_rss_mib": 538.23 + }, + { + "workload": "writes-single-chat", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 18.11, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 226.178, + "latency_ms": { + "mean": 141.366, + "p50": 107.516, + "p95": 342.712, + "p99": 584.61 + }, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 4096, + "WITH:messages": 4096 + }, + "process_cpu_percent_one_core": 105.53, + "peak_process_rss_mib": 538.23 + }, + { + "workload": "cold-history-burst", + "repeat": 3, + "concurrency": 64, + "elapsed_seconds": 0.212, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 301.879, + "latency_ms": { + "mean": 160.966, + "p50": 166.123, + "p95": 208.492, + "p99": 209.047 + }, + "sql_queries": 123, + "sql_per_request": 1.9219, + "sql_calls": { + "SELECT:chat_members": 64, + "SELECT:messages": 59 + }, + "process_cpu_percent_one_core": 97.81, + "peak_process_rss_mib": 538.23 + }, + { + "workload": "warm-history", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 60.055, + "successes": 10481, + "errors": 0, + "error_ratio": 0, + "successful_rps": 174.524, + "latency_ms": { + "mean": 183.188, + "p50": 129.296, + "p95": 437.392, + "p99": 820.34 + }, + "sql_queries": 10586, + "sql_per_request": 1.01, + "sql_calls": { + "SELECT:chat_members": 10481, + "SELECT:messages": 105 + }, + "process_cpu_percent_one_core": 89.54, + "peak_process_rss_mib": 538.86 + }, + { + "workload": "writes-single-chat", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 36.421, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 112.463, + "latency_ms": { + "mean": 284.244, + "p50": 205.933, + "p95": 732.896, + "p99": 1066.21 + }, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 4096, + "WITH:messages": 4096 + }, + "process_cpu_percent_one_core": 81.25, + "peak_process_rss_mib": 538.98 + } + ], + "correctness": { + "redis_reconnect": { + "old_keys_retained": true, + "read_after_write_during_outage": true, + "read_after_write_after_reconnect_other_replica": true + }, + "empty_cache_recovery": true, + "delayed_old_fill": true + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed" +} diff --git a/evidence/cache-strategy-buckets-no-redis-no-epochs.json b/evidence/cache-strategy-buckets-no-redis-no-epochs.json new file mode 100644 index 00000000..8806b2d5 --- /dev/null +++ b/evidence/cache-strategy-buckets-no-redis-no-epochs.json @@ -0,0 +1,258 @@ +{ + "stage": "after", + "recorded_at": "2026-10-13T15:33:56.329Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented API process in measured backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 32, + "duration_seconds": 60, + "warmup_seconds": 10, + "repetitions": 3, + "seed_messages": 100000, + "cold_burst_requests": 64, + "writes_per_repeat": 4096, + "history_control": false, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; other Docker workloads share host resources; no capacity/SLA claim; fixtures bypass password KDF" + }, + "dist_sha256": { + "Chat/chat.service.js": "8d5b8d2072c8d3f2ea5736a065782778f58cd8932ea69877a41e45b555b99536", + "cache/cache.service.js": "fa132f28aa07f0a7118d308a073c296dd319131b63c15bd9a700d8ac874cd7a1", + "Auth/auth.service.js": "75af4ff945f2c3af7a224ca773e0d4357e27e0fbe64cdc050bc6b1875c04d0e9", + "User/user.guard.js": "4c2b79845c3e83b84d0a219b233c0b7d6f3782ecd80758cd7be6e461ce87cdd7", + "Chat/chat.controller.js": "df7593892dcf458e23c7f85dde69b945b137c6226373e3ee4b75df5d82b45aba" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst", + "repeat": 1, + "concurrency": 64, + "elapsed_seconds": 7.001, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 9.141, + "latency_ms": { + "mean": 5440.542, + "p50": 5886.145, + "p95": 6793.244, + "p99": 6815.613 + }, + "sql_queries": 128, + "sql_per_request": 2, + "sql_calls": { + "SELECT:chat_members": 64, + "SELECT:messages": 64 + }, + "process_cpu_percent_one_core": 51.46, + "peak_process_rss_mib": 510.95 + }, + { + "workload": "warm-history", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 60.092, + "successes": 4279, + "errors": 0, + "error_ratio": 0, + "successful_rps": 71.208, + "latency_ms": { + "mean": 448.479, + "p50": 320.114, + "p95": 1342.793, + "p99": 2414.964 + }, + "sql_queries": 8558, + "sql_per_request": 2, + "sql_calls": { + "SELECT:chat_members": 4279, + "SELECT:messages": 4279 + }, + "process_cpu_percent_one_core": 88.25, + "peak_process_rss_mib": 537.16 + }, + { + "workload": "writes-single-chat", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 35.757, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 114.551, + "latency_ms": { + "mean": 278.841, + "p50": 236.409, + "p95": 590.17, + "p99": 1432.035 + }, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 4096, + "INSERT:messages": 4096 + }, + "process_cpu_percent_one_core": 96.82, + "peak_process_rss_mib": 535.46 + }, + { + "workload": "cold-history-burst", + "repeat": 2, + "concurrency": 64, + "elapsed_seconds": 0.276, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 231.506, + "latency_ms": { + "mean": 183.505, + "p50": 176.559, + "p95": 263.688, + "p99": 267.248 + }, + "sql_queries": 128, + "sql_per_request": 2, + "sql_calls": { + "SELECT:chat_members": 64, + "SELECT:messages": 64 + }, + "process_cpu_percent_one_core": 135.45, + "peak_process_rss_mib": 535.71 + }, + { + "workload": "warm-history", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 60.091, + "successes": 9271, + "errors": 0, + "error_ratio": 0, + "successful_rps": 154.284, + "latency_ms": { + "mean": 207.269, + "p50": 150.569, + "p95": 474.167, + "p99": 718.176 + }, + "sql_queries": 18542, + "sql_per_request": 2, + "sql_calls": { + "SELECT:chat_members": 9271, + "SELECT:messages": 9271 + }, + "process_cpu_percent_one_core": 106.99, + "peak_process_rss_mib": 537.71 + }, + { + "workload": "writes-single-chat", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 29.907, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 136.96, + "latency_ms": { + "mean": 233.316, + "p50": 172.903, + "p95": 521.985, + "p99": 1168.736 + }, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 4096, + "INSERT:messages": 4096 + }, + "process_cpu_percent_one_core": 94.66, + "peak_process_rss_mib": 537.71 + }, + { + "workload": "cold-history-burst", + "repeat": 3, + "concurrency": 64, + "elapsed_seconds": 0.312, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 205.101, + "latency_ms": { + "mean": 200.791, + "p50": 195.491, + "p95": 295.193, + "p99": 304.063 + }, + "sql_queries": 128, + "sql_per_request": 2, + "sql_calls": { + "SELECT:chat_members": 64, + "SELECT:messages": 64 + }, + "process_cpu_percent_one_core": 123.32, + "peak_process_rss_mib": 537.84 + }, + { + "workload": "warm-history", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 60.083, + "successes": 9923, + "errors": 0, + "error_ratio": 0, + "successful_rps": 165.155, + "latency_ms": { + "mean": 193.639, + "p50": 142.886, + "p95": 470.228, + "p99": 718.957 + }, + "sql_queries": 19846, + "sql_per_request": 2, + "sql_calls": { + "SELECT:chat_members": 9923, + "SELECT:messages": 9923 + }, + "process_cpu_percent_one_core": 100.11, + "peak_process_rss_mib": 537.96 + }, + { + "workload": "writes-single-chat", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 30.127, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 135.958, + "latency_ms": { + "mean": 234.938, + "p50": 186.87, + "p95": 558.338, + "p99": 794.478 + }, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 4096, + "INSERT:messages": 4096 + }, + "process_cpu_percent_one_core": 97.46, + "peak_process_rss_mib": 539.09 + } + ], + "correctness": { + "no_redis_client": true, + "epochs_unchanged": true, + "read_after_write": true + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed" +} diff --git a/evidence/cache-strategy-experiment.json b/evidence/cache-strategy-experiment.json new file mode 100644 index 00000000..ec24415f --- /dev/null +++ b/evidence/cache-strategy-experiment.json @@ -0,0 +1,64 @@ +{ + "recorded_at": "2026-10-13T13:04:30.585Z", + "image": "sha256:a4799affbf3b82d4a120296b16306e7693c13007013061a911fb5d38ceb6d945", + "modified_sources": { + "Chat/chat.service.ts": { + "original_source": "11b6b6d361d5599667318540b2c83a1b8e397db6d4d3665bbfa526e0b349d430", + "experiment_source": "b2aaf10ea1994df9418e157f3d61747182f0dc7f8ac7b1faa70caf6e9b936395", + "experiment_js": "d8228f1bb09e50cba1dc604cf2494a43f5a36db35631bdc28cca55c8bb6ea013" + }, + "Auth/auth.service.ts": { + "original_source": "86599b6e89cd66483cb10aff0d85cc29fe092ab24bbb849960079dcae347b8bf", + "experiment_source": "09a6ee6599c1e4434fe1ad00cac973ea3b5c189e93aa72c3f9b353f5ff2695b2", + "experiment_js": "15b5e9104116f6eb4a214622f754fdd97b14f20f0c93c8b5644820392129671e" + }, + "User/user.guard.ts": { + "original_source": "b84d95633fbd89b4fdbc505c51dd64e657611651b757bed1aea8eee3f0eac3d9", + "experiment_source": "61542fe2b85fb5b83ba8bfb8ddee0d34a8f8216eb0283b0987489666bb4f87fd", + "experiment_js": "187bc710bb75421c098fcde7e2ee9004c2b01f6b569f639c20779f4d5ed47d99" + }, + "Chat/chat.controller.ts": { + "original_source": "700becb64112538a6551c5775ccc09ff9d750755dcffe6ec916782afed1dae11", + "experiment_source": "29f56fcb998e4fc115fbad3705e9c6c7738e528165c4c012fa662c1a7a0e35f5", + "experiment_js": "e6a9a63bf5a17d5f7e3138077ea4874f2c25b6e378f1d86691f08c87d2d23da0" + }, + "cache/cache.service.ts": { + "original_source": "f27ab6ff5a0f8da05936272bafbc7cea38198074e5c7d17c2e01ae0bf29986b3", + "experiment_source": "d9abf1e2b368010934214a8730ca99d085eda57c748bbc69ccd5a0a085d66a9a", + "experiment_js": "fa132f28aa07f0a7118d308a073c296dd319131b63c15bd9a700d8ac874cd7a1" + }, + "User/user.service.ts": { + "original_source": "de158e39c114c610cc7ea6c850108c8dd69c9bc3d643bac94557d272621f3cfb", + "experiment_source": "532bbba837fcbc9ad6b431316680dc0bdd7a910b9870fe0ec625c7d81fa53ddd", + "experiment_js": "90cfd8c45b02a6d4a5220a869d86ab5bac66b6b4c6a9f79685cd7c24a97fc2cb" + } + }, + "command": [ + "docker", + "compose", + "-f", + "compose.yaml", + "-f", + "test/compose.benchmark.yaml", + "-f", + "C:\\Users\\olpin\\AppData\\Local\\Temp\\lab2-no-epochs-fxZFbE\\compose.no-epochs.yaml", + "run", + "--rm", + "--no-deps", + "--pull", + "never", + "benchmark", + "node", + "/experiment/cache-benchmark.mjs", + "after", + "/results/cache-strategy-no-redis-no-epochs.json" + ], + "implementation": "Separate temporary source copies compiled with TypeScript and mounted over six application modules. Workspace sources and running backend remain unchanged.", + "schema": "Unused epoch columns remain; no migration, counter update or authoritative epoch read in the experiment API paths.", + "redis": "Application starts without CACHE_URL. Observer/proxy are retained only for benchmark setup and cleanup.", + "full_result": "cache-strategy-full.json", + "experiment_result": "cache-strategy-no-redis-no-epochs.json", + "exit_code": 0, + "signal": null, + "sources_unchanged": true +} diff --git a/evidence/cache-strategy-full.json b/evidence/cache-strategy-full.json new file mode 100644 index 00000000..f4adad80 --- /dev/null +++ b/evidence/cache-strategy-full.json @@ -0,0 +1,338 @@ +{ + "stage": "after", + "recorded_at": "2026-10-13T13:00:23.771Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented API process in measured backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 16, + "duration_seconds": 10, + "warmup_seconds": 3, + "repetitions": 3, + "seed_messages": 10000, + "cold_burst_requests": 32, + "writes_per_repeat": 512, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; other Docker workloads share host resources; no capacity/SLA claim; fixtures bypass password KDF" + }, + "dist_sha256": { + "Chat/chat.service.js": "f0f8b0cd357dcbb2ba6f401e30dadfcf19ab0deb7c1a812b306126d0478289e2", + "cache/cache.service.js": "ec7c09ef55f9054176ace8c62a3690df6e717b54c36db9ef66b91bc34a761693" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 2.018, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 15.856, + "latency_ms": { + "mean": 1796.174, + "p50": 1840.086, + "p95": 1916.159, + "p99": 1926.09 + }, + "sql_queries": 68, + "sql_per_request": 2.125, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:chat_members": 32, + "SELECT:messages": 2, + "SELECT:users": 2 + }, + "process_cpu_percent_one_core": 72.84, + "peak_process_rss_mib": 330.04 + }, + { + "workload": "warm-history", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.08, + "successes": 1187, + "errors": 0, + "error_ratio": 0, + "successful_rps": 117.759, + "latency_ms": { + "mean": 135.17, + "p50": 93.299, + "p95": 314.09, + "p99": 1264.56 + }, + "sql_queries": 2377, + "sql_per_request": 2.0025, + "sql_calls": { + "SELECT:sessions": 1187, + "SELECT:chat_members": 1187, + "SELECT:users": 3 + }, + "process_cpu_percent_one_core": 120.31, + "peak_process_rss_mib": 350.43 + }, + { + "workload": "history-cache-bypassed", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.049, + "successes": 1221, + "errors": 0, + "error_ratio": 0, + "successful_rps": 121.508, + "latency_ms": { + "mean": 131.408, + "p50": 94.183, + "p95": 315.506, + "p99": 465.341 + }, + "sql_queries": 3663, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 1221, + "SELECT:chat_members": 1221, + "SELECT:messages": 1221 + }, + "process_cpu_percent_one_core": 107.31, + "peak_process_rss_mib": 351.05 + }, + { + "workload": "writes-single-chat", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 3.54, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 144.623, + "latency_ms": { + "mean": 109.902, + "p50": 87.761, + "p95": 244.052, + "p99": 343.535 + }, + "sql_queries": 1024, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 512, + "WITH:messages": 512 + }, + "process_cpu_percent_one_core": 121.51, + "peak_process_rss_mib": 351.68 + }, + { + "workload": "cold-history-burst", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 0.126, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 253.886, + "latency_ms": { + "mean": 115.632, + "p50": 114.914, + "p95": 120.78, + "p99": 123.616 + }, + "sql_queries": 96, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:chat_members": 32, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 122.64, + "peak_process_rss_mib": 347.61 + }, + { + "workload": "warm-history", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.098, + "successes": 2181, + "errors": 0, + "error_ratio": 0, + "successful_rps": 215.98, + "latency_ms": { + "mean": 73.643, + "p50": 58.478, + "p95": 167.898, + "p99": 255.596 + }, + "sql_queries": 4362, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 2181, + "SELECT:chat_members": 2181 + }, + "process_cpu_percent_one_core": 114.09, + "peak_process_rss_mib": 348.86 + }, + { + "workload": "history-cache-bypassed", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.041, + "successes": 1740, + "errors": 0, + "error_ratio": 0, + "successful_rps": 173.29, + "latency_ms": { + "mean": 92.117, + "p50": 74.146, + "p95": 195.93, + "p99": 429.858 + }, + "sql_queries": 5220, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 1740, + "SELECT:chat_members": 1740, + "SELECT:messages": 1740 + }, + "process_cpu_percent_one_core": 113.81, + "peak_process_rss_mib": 349.33 + }, + { + "workload": "writes-single-chat", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 2.224, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 230.243, + "latency_ms": { + "mean": 68.974, + "p50": 61.759, + "p95": 113.761, + "p99": 210.209 + }, + "sql_queries": 1024, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 512, + "WITH:messages": 512 + }, + "process_cpu_percent_one_core": 119.03, + "peak_process_rss_mib": 349.33 + }, + { + "workload": "cold-history-burst", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 0.21, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 152.051, + "latency_ms": { + "mean": 176.548, + "p50": 179.571, + "p95": 206.26, + "p99": 207.106 + }, + "sql_queries": 94, + "sql_per_request": 2.9375, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:chat_members": 32, + "SELECT:messages": 30 + }, + "process_cpu_percent_one_core": 126.37, + "peak_process_rss_mib": 349.33 + }, + { + "workload": "warm-history", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.032, + "successes": 1653, + "errors": 0, + "error_ratio": 0, + "successful_rps": 164.773, + "latency_ms": { + "mean": 97.028, + "p50": 76.509, + "p95": 220.155, + "p99": 339.868 + }, + "sql_queries": 3306, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 1653, + "SELECT:chat_members": 1653 + }, + "process_cpu_percent_one_core": 106, + "peak_process_rss_mib": 349.83 + }, + { + "workload": "history-cache-bypassed", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.142, + "successes": 1400, + "errors": 0, + "error_ratio": 0, + "successful_rps": 138.041, + "latency_ms": { + "mean": 115.078, + "p50": 94.485, + "p95": 224.867, + "p99": 389.849 + }, + "sql_queries": 4200, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 1400, + "SELECT:chat_members": 1400, + "SELECT:messages": 1400 + }, + "process_cpu_percent_one_core": 118.4, + "peak_process_rss_mib": 350.33 + }, + { + "workload": "writes-single-chat", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 6.522, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 78.507, + "latency_ms": { + "mean": 202.008, + "p50": 149.193, + "p95": 508.243, + "p99": 1019.547 + }, + "sql_queries": 1024, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 512, + "WITH:messages": 512 + }, + "process_cpu_percent_one_core": 68.33, + "peak_process_rss_mib": 350.58 + } + ], + "correctness": { + "redis_reconnect": { + "old_keys_retained": true, + "read_after_write_during_outage": true, + "read_after_write_after_reconnect_other_replica": true + }, + "empty_cache_recovery": true, + "delayed_old_fill": true + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed" +} diff --git a/evidence/cache-strategy-long-averages.json b/evidence/cache-strategy-long-averages.json new file mode 100644 index 00000000..7c2480ef --- /dev/null +++ b/evidence/cache-strategy-long-averages.json @@ -0,0 +1,98 @@ +[ + { + "workload": "cold-history-burst", + "variant": "Redis и эпохи", + "successes": 192, + "errors": 0, + "mean_rps": 65.91143151390318, + "mean_latency_ms": 754.3346666666666, + "mean_p95_ms": 933.4383333333334, + "sql_per_request": 2.5885416666666665, + "median_rps": 84.922, + "repeat_rps": [ + 84.922, + 174.993, + 35.695 + ] + }, + { + "workload": "cold-history-burst", + "variant": "Без Redis и эпох", + "successes": 192, + "errors": 0, + "mean_rps": 35.52923760177646, + "mean_latency_ms": 1207.2706666666666, + "mean_p95_ms": 1730.9593333333332, + "sql_per_request": 4, + "median_rps": 97.303, + "repeat_rps": [ + 14.688, + 164.482, + 97.303 + ] + }, + { + "workload": "warm-history", + "variant": "Redis и эпохи", + "successes": 20193, + "errors": 0, + "mean_rps": 111.93521028387076, + "mean_latency_ms": 285.5940715594513, + "mean_p95_ms": 921.5433333333334, + "sql_per_request": 2.0226811271232603, + "median_rps": 98.432, + "repeat_rps": [ + 98.432, + 171.599, + 65.786 + ] + }, + { + "workload": "warm-history", + "variant": "Без Redis и эпох", + "successes": 20812, + "errors": 0, + "mean_rps": 115.21130191206917, + "mean_latency_ms": 277.44751691331925, + "mean_p95_ms": 769.9786666666665, + "sql_per_request": 4, + "median_rps": 116.919, + "repeat_rps": [ + 116.919, + 87.18, + 141.665 + ] + }, + { + "workload": "writes-single-chat", + "variant": "Redis и эпохи", + "successes": 12288, + "errors": 0, + "mean_rps": 67.13213360867996, + "mean_latency_ms": 476.11233333333325, + "mean_p95_ms": 1289.0003333333334, + "sql_per_request": 2.05517578125, + "median_rps": 104.129, + "repeat_rps": [ + 104.129, + 37.944, + 114.545 + ] + }, + { + "workload": "writes-single-chat", + "variant": "Без Redis и эпох", + "successes": 12288, + "errors": 0, + "mean_rps": 98.20422450789998, + "mean_latency_ms": 325.492, + "mean_p95_ms": 790.6086666666666, + "sql_per_request": 3, + "median_rps": 93.775, + "repeat_rps": [ + 93.775, + 86.854, + 119.458 + ] + } +] diff --git a/evidence/cache-strategy-long-experiment.json b/evidence/cache-strategy-long-experiment.json new file mode 100644 index 00000000..edd39603 --- /dev/null +++ b/evidence/cache-strategy-long-experiment.json @@ -0,0 +1,79 @@ +{ + "recorded_at": "2026-10-13T13:24:50.458Z", + "image": "sha256:a4799affbf3b82d4a120296b16306e7693c13007013061a911fb5d38ceb6d945", + "modified_sources": { + "Chat/chat.service.ts": { + "original_source": "11b6b6d361d5599667318540b2c83a1b8e397db6d4d3665bbfa526e0b349d430", + "experiment_source": "b2aaf10ea1994df9418e157f3d61747182f0dc7f8ac7b1faa70caf6e9b936395", + "experiment_js": "d8228f1bb09e50cba1dc604cf2494a43f5a36db35631bdc28cca55c8bb6ea013" + }, + "Auth/auth.service.ts": { + "original_source": "86599b6e89cd66483cb10aff0d85cc29fe092ab24bbb849960079dcae347b8bf", + "experiment_source": "09a6ee6599c1e4434fe1ad00cac973ea3b5c189e93aa72c3f9b353f5ff2695b2", + "experiment_js": "15b5e9104116f6eb4a214622f754fdd97b14f20f0c93c8b5644820392129671e" + }, + "User/user.guard.ts": { + "original_source": "b84d95633fbd89b4fdbc505c51dd64e657611651b757bed1aea8eee3f0eac3d9", + "experiment_source": "61542fe2b85fb5b83ba8bfb8ddee0d34a8f8216eb0283b0987489666bb4f87fd", + "experiment_js": "187bc710bb75421c098fcde7e2ee9004c2b01f6b569f639c20779f4d5ed47d99" + }, + "Chat/chat.controller.ts": { + "original_source": "700becb64112538a6551c5775ccc09ff9d750755dcffe6ec916782afed1dae11", + "experiment_source": "29f56fcb998e4fc115fbad3705e9c6c7738e528165c4c012fa662c1a7a0e35f5", + "experiment_js": "e6a9a63bf5a17d5f7e3138077ea4874f2c25b6e378f1d86691f08c87d2d23da0" + }, + "cache/cache.service.ts": { + "original_source": "f27ab6ff5a0f8da05936272bafbc7cea38198074e5c7d17c2e01ae0bf29986b3", + "experiment_source": "d9abf1e2b368010934214a8730ca99d085eda57c748bbc69ccd5a0a085d66a9a", + "experiment_js": "fa132f28aa07f0a7118d308a073c296dd319131b63c15bd9a700d8ac874cd7a1" + }, + "User/user.service.ts": { + "original_source": "de158e39c114c610cc7ea6c850108c8dd69c9bc3d643bac94557d272621f3cfb", + "experiment_source": "532bbba837fcbc9ad6b431316680dc0bdd7a910b9870fe0ec625c7d81fa53ddd", + "experiment_js": "90cfd8c45b02a6d4a5220a869d86ab5bac66b6b4c6a9f79685cd7c24a97fc2cb" + } + }, + "command": [ + "docker", + "compose", + "-f", + "compose.yaml", + "-f", + "test/compose.benchmark.yaml", + "-f", + "C:\\Users\\olpin\\AppData\\Local\\Temp\\lab2-no-epochs-8CcNxV\\compose.no-epochs.yaml", + "run", + "--rm", + "--no-deps", + "--pull", + "never", + "benchmark", + "node", + "/experiment/cache-benchmark.mjs", + "after", + "/results/cache-strategy-long-no-redis-no-epochs.json", + "--concurrency", + "32", + "--duration-seconds", + "60", + "--warmup-seconds", + "10", + "--repetitions", + "3", + "--seed-messages", + "100000", + "--cold-burst", + "64", + "--writes-per-repeat", + "4096", + "--skip-history-control" + ], + "implementation": "Separate temporary source copies compiled with TypeScript and mounted over six application modules. Workspace sources and running backend remain unchanged.", + "schema": "Unused epoch columns remain; no migration, counter update or authoritative epoch read in the experiment API paths.", + "redis": "Application starts without CACHE_URL. Observer/proxy are retained only for benchmark setup and cleanup.", + "full_result": "cache-strategy-long-full.json", + "experiment_result": "cache-strategy-long-no-redis-no-epochs.json", + "exit_code": 0, + "signal": null, + "sources_unchanged": true +} diff --git a/evidence/cache-strategy-long-full.json b/evidence/cache-strategy-long-full.json new file mode 100644 index 00000000..88fb6cd4 --- /dev/null +++ b/evidence/cache-strategy-long-full.json @@ -0,0 +1,271 @@ +{ + "stage": "after", + "recorded_at": "2026-10-13T13:15:26.986Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented API process in measured backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 32, + "duration_seconds": 60, + "warmup_seconds": 10, + "repetitions": 3, + "seed_messages": 100000, + "cold_burst_requests": 64, + "writes_per_repeat": 4096, + "history_control": false, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; other Docker workloads share host resources; no capacity/SLA claim; fixtures bypass password KDF" + }, + "dist_sha256": { + "Chat/chat.service.js": "f0f8b0cd357dcbb2ba6f401e30dadfcf19ab0deb7c1a812b306126d0478289e2", + "cache/cache.service.js": "ec7c09ef55f9054176ace8c62a3690df6e717b54c36db9ef66b91bc34a761693" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst", + "repeat": 1, + "concurrency": 64, + "elapsed_seconds": 0.754, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 84.922, + "latency_ms": { + "mean": 523.232, + "p50": 529.229, + "p95": 714.717, + "p99": 719.659 + }, + "sql_queries": 130, + "sql_per_request": 2.0313, + "sql_calls": { + "SELECT:sessions": 64, + "SELECT:chat_members": 64, + "SELECT:messages": 2 + }, + "process_cpu_percent_one_core": 179.07, + "peak_process_rss_mib": 508.06 + }, + { + "workload": "warm-history", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 60.052, + "successes": 5911, + "errors": 0, + "error_ratio": 0, + "successful_rps": 98.432, + "latency_ms": { + "mean": 324.995, + "p50": 178.39, + "p95": 924.623, + "p99": 2499.571 + }, + "sql_queries": 11971, + "sql_per_request": 2.0252, + "sql_calls": { + "SELECT:sessions": 5911, + "SELECT:chat_members": 5911, + "SELECT:messages": 58, + "SELECT:users": 91 + }, + "process_cpu_percent_one_core": 87.65, + "peak_process_rss_mib": 540.81 + }, + { + "workload": "writes-single-chat", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 39.336, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 104.129, + "latency_ms": { + "mean": 306.991, + "p50": 238.36, + "p95": 709.191, + "p99": 1377.125 + }, + "sql_queries": 8239, + "sql_per_request": 2.0115, + "sql_calls": { + "SELECT:sessions": 4096, + "WITH:messages": 4096, + "SELECT:users": 47 + }, + "process_cpu_percent_one_core": 93.48, + "peak_process_rss_mib": 540.61 + }, + { + "workload": "cold-history-burst", + "repeat": 2, + "concurrency": 64, + "elapsed_seconds": 0.366, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 174.993, + "latency_ms": { + "mean": 321.618, + "p50": 321.769, + "p95": 357.118, + "p99": 358.633 + }, + "sql_queries": 183, + "sql_per_request": 2.8594, + "sql_calls": { + "SELECT:sessions": 64, + "SELECT:chat_members": 64, + "SELECT:messages": 55 + }, + "process_cpu_percent_one_core": 191.09, + "peak_process_rss_mib": 540.61 + }, + { + "workload": "warm-history", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 60.152, + "successes": 10322, + "errors": 0, + "error_ratio": 0, + "successful_rps": 171.599, + "latency_ms": { + "mean": 186.321, + "p50": 141.563, + "p95": 451.313, + "p99": 611.536 + }, + "sql_queries": 20653, + "sql_per_request": 2.0009, + "sql_calls": { + "SELECT:sessions": 10322, + "SELECT:chat_members": 10322, + "SELECT:messages": 9 + }, + "process_cpu_percent_one_core": 104.21, + "peak_process_rss_mib": 542.23 + }, + { + "workload": "writes-single-chat", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 107.947, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 37.944, + "latency_ms": { + "mean": 842.343, + "p50": 609.049, + "p95": 2335.301, + "p99": 3656.624 + }, + "sql_queries": 8769, + "sql_per_request": 2.1409, + "sql_calls": { + "SELECT:sessions": 4096, + "WITH:messages": 4096, + "SELECT:users": 577 + }, + "process_cpu_percent_one_core": 78.49, + "peak_process_rss_mib": 542.23 + }, + { + "workload": "cold-history-burst", + "repeat": 3, + "concurrency": 64, + "elapsed_seconds": 1.793, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 35.695, + "latency_ms": { + "mean": 1418.154, + "p50": 1552.772, + "p95": 1728.48, + "p99": 1764.616 + }, + "sql_queries": 184, + "sql_per_request": 2.875, + "sql_calls": { + "SELECT:sessions": 64, + "SELECT:chat_members": 64, + "SELECT:messages": 50, + "SELECT:users": 6 + }, + "process_cpu_percent_one_core": 85.4, + "peak_process_rss_mib": 541.23 + }, + { + "workload": "warm-history", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 60.195, + "successes": 3960, + "errors": 0, + "error_ratio": 0, + "successful_rps": 65.786, + "latency_ms": { + "mean": 485.543, + "p50": 309.711, + "p95": 1388.694, + "p99": 2972.275 + }, + "sql_queries": 8220, + "sql_per_request": 2.0758, + "sql_calls": { + "SELECT:sessions": 3960, + "SELECT:chat_members": 3960, + "SELECT:messages": 96, + "SELECT:users": 204 + }, + "process_cpu_percent_one_core": 78.06, + "peak_process_rss_mib": 541.23 + }, + { + "workload": "writes-single-chat", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 35.759, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 114.545, + "latency_ms": { + "mean": 279.003, + "p50": 181.143, + "p95": 822.509, + "p99": 1351.269 + }, + "sql_queries": 8246, + "sql_per_request": 2.0132, + "sql_calls": { + "SELECT:sessions": 4096, + "WITH:messages": 4096, + "SELECT:users": 54 + }, + "process_cpu_percent_one_core": 90.87, + "peak_process_rss_mib": 539.98 + } + ], + "correctness": { + "redis_reconnect": { + "old_keys_retained": true, + "read_after_write_during_outage": true, + "read_after_write_after_reconnect_other_replica": true + }, + "empty_cache_recovery": true, + "delayed_old_fill": true + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed" +} diff --git a/evidence/cache-strategy-long-no-redis-no-epochs.json b/evidence/cache-strategy-long-no-redis-no-epochs.json new file mode 100644 index 00000000..e0d301c7 --- /dev/null +++ b/evidence/cache-strategy-long-no-redis-no-epochs.json @@ -0,0 +1,270 @@ +{ + "stage": "after", + "recorded_at": "2026-10-13T13:25:17.453Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented API process in measured backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 32, + "duration_seconds": 60, + "warmup_seconds": 10, + "repetitions": 3, + "seed_messages": 100000, + "cold_burst_requests": 64, + "writes_per_repeat": 4096, + "history_control": false, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; other Docker workloads share host resources; no capacity/SLA claim; fixtures bypass password KDF" + }, + "dist_sha256": { + "Chat/chat.service.js": "d8228f1bb09e50cba1dc604cf2494a43f5a36db35631bdc28cca55c8bb6ea013", + "cache/cache.service.js": "fa132f28aa07f0a7118d308a073c296dd319131b63c15bd9a700d8ac874cd7a1" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst", + "repeat": 1, + "concurrency": 64, + "elapsed_seconds": 4.357, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 14.688, + "latency_ms": { + "mean": 2832.374, + "p50": 2680.746, + "p95": 4178.552, + "p99": 4204.4 + }, + "sql_queries": 256, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 64, + "SELECT:users": 64, + "SELECT:chat_members": 64, + "SELECT:messages": 64 + }, + "process_cpu_percent_one_core": 66.4, + "peak_process_rss_mib": 503.43 + }, + { + "workload": "warm-history", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 60.213, + "successes": 7040, + "errors": 0, + "error_ratio": 0, + "successful_rps": 116.919, + "latency_ms": { + "mean": 273.324, + "p50": 208.077, + "p95": 647.394, + "p99": 867.928 + }, + "sql_queries": 28160, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 7040, + "SELECT:users": 7040, + "SELECT:chat_members": 7040, + "SELECT:messages": 7040 + }, + "process_cpu_percent_one_core": 110.35, + "peak_process_rss_mib": 529.98 + }, + { + "workload": "writes-single-chat", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 43.679, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 93.775, + "latency_ms": { + "mean": 340.995, + "p50": 273.072, + "p95": 867.22, + "p99": 1314.603 + }, + "sql_queries": 12288, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 4096, + "SELECT:users": 4096, + "INSERT:messages": 4096 + }, + "process_cpu_percent_one_core": 96.06, + "peak_process_rss_mib": 528.34 + }, + { + "workload": "cold-history-burst", + "repeat": 2, + "concurrency": 64, + "elapsed_seconds": 0.389, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 164.482, + "latency_ms": { + "mean": 302.238, + "p50": 295.632, + "p95": 378.2, + "p99": 380.864 + }, + "sql_queries": 256, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 64, + "SELECT:users": 64, + "SELECT:chat_members": 64, + "SELECT:messages": 64 + }, + "process_cpu_percent_one_core": 129.37, + "peak_process_rss_mib": 528.59 + }, + { + "workload": "warm-history", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 60.358, + "successes": 5262, + "errors": 0, + "error_ratio": 0, + "successful_rps": 87.18, + "latency_ms": { + "mean": 366.511, + "p50": 224.132, + "p95": 1186.254, + "p99": 2821.087 + }, + "sql_queries": 21048, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 5262, + "SELECT:users": 5262, + "SELECT:chat_members": 5262, + "SELECT:messages": 5262 + }, + "process_cpu_percent_one_core": 91.61, + "peak_process_rss_mib": 528.84 + }, + { + "workload": "writes-single-chat", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 47.16, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 86.854, + "latency_ms": { + "mean": 368.096, + "p50": 301.578, + "p95": 828.432, + "p99": 1193.829 + }, + "sql_queries": 12288, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 4096, + "SELECT:users": 4096, + "INSERT:messages": 4096 + }, + "process_cpu_percent_one_core": 92.17, + "peak_process_rss_mib": 528.34 + }, + { + "workload": "cold-history-burst", + "repeat": 3, + "concurrency": 64, + "elapsed_seconds": 0.658, + "successes": 64, + "errors": 0, + "error_ratio": 0, + "successful_rps": 97.303, + "latency_ms": { + "mean": 487.2, + "p50": 499.068, + "p95": 636.126, + "p99": 646.102 + }, + "sql_queries": 256, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 64, + "SELECT:users": 64, + "SELECT:chat_members": 64, + "SELECT:messages": 64 + }, + "process_cpu_percent_one_core": 143.09, + "peak_process_rss_mib": 527.84 + }, + { + "workload": "warm-history", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 60.071, + "successes": 8510, + "errors": 0, + "error_ratio": 0, + "successful_rps": 141.665, + "latency_ms": { + "mean": 225.788, + "p50": 182.322, + "p95": 476.288, + "p99": 663.291 + }, + "sql_queries": 34040, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 8510, + "SELECT:users": 8510, + "SELECT:chat_members": 8510, + "SELECT:messages": 8510 + }, + "process_cpu_percent_one_core": 108.52, + "peak_process_rss_mib": 527.84 + }, + { + "workload": "writes-single-chat", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 34.288, + "successes": 4096, + "errors": 0, + "error_ratio": 0, + "successful_rps": 119.458, + "latency_ms": { + "mean": 267.385, + "p50": 202.874, + "p95": 676.174, + "p99": 934.633 + }, + "sql_queries": 12288, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 4096, + "SELECT:users": 4096, + "INSERT:messages": 4096 + }, + "process_cpu_percent_one_core": 100.89, + "peak_process_rss_mib": 527.84 + } + ], + "correctness": { + "no_redis_client": true, + "epochs_unchanged": true, + "read_after_write": true + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed" +} diff --git a/evidence/cache-strategy-no-redis-no-epochs.json b/evidence/cache-strategy-no-redis-no-epochs.json new file mode 100644 index 00000000..ad52d553 --- /dev/null +++ b/evidence/cache-strategy-no-redis-no-epochs.json @@ -0,0 +1,347 @@ +{ + "stage": "after", + "recorded_at": "2026-10-13T13:05:02.777Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented API process in measured backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 16, + "duration_seconds": 10, + "warmup_seconds": 3, + "repetitions": 3, + "seed_messages": 10000, + "cold_burst_requests": 32, + "writes_per_repeat": 512, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; other Docker workloads share host resources; no capacity/SLA claim; fixtures bypass password KDF" + }, + "dist_sha256": { + "Chat/chat.service.js": "d8228f1bb09e50cba1dc604cf2494a43f5a36db35631bdc28cca55c8bb6ea013", + "cache/cache.service.js": "fa132f28aa07f0a7118d308a073c296dd319131b63c15bd9a700d8ac874cd7a1" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 4.432, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 7.221, + "latency_ms": { + "mean": 3223.831, + "p50": 3472.532, + "p95": 4242.166, + "p99": 4291.418 + }, + "sql_queries": 128, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:users": 32, + "SELECT:chat_members": 32, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 76.08, + "peak_process_rss_mib": 322.23 + }, + { + "workload": "warm-history", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.483, + "successes": 110, + "errors": 0, + "error_ratio": 0, + "successful_rps": 10.493, + "latency_ms": { + "mean": 1498.767, + "p50": 1448.568, + "p95": 2199.117, + "p99": 2286.128 + }, + "sql_queries": 440, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 110, + "SELECT:users": 110, + "SELECT:chat_members": 110, + "SELECT:messages": 110 + }, + "process_cpu_percent_one_core": 69.42, + "peak_process_rss_mib": 325.3 + }, + { + "workload": "history-cache-bypassed", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.439, + "successes": 304, + "errors": 0, + "error_ratio": 0, + "successful_rps": 29.122, + "latency_ms": { + "mean": 542.086, + "p50": 390.773, + "p95": 1283.803, + "p99": 1945.359 + }, + "sql_queries": 1216, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 304, + "SELECT:users": 304, + "SELECT:chat_members": 304, + "SELECT:messages": 304 + }, + "process_cpu_percent_one_core": 98.33, + "peak_process_rss_mib": 348.39 + }, + { + "workload": "writes-single-chat", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 24.459, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 20.933, + "latency_ms": { + "mean": 760.483, + "p50": 598.938, + "p95": 1799.757, + "p99": 3162.945 + }, + "sql_queries": 1536, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 512, + "SELECT:users": 512, + "INSERT:messages": 512 + }, + "process_cpu_percent_one_core": 66.68, + "peak_process_rss_mib": 350.14 + }, + { + "workload": "cold-history-burst", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 2.206, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 14.503, + "latency_ms": { + "mean": 2020.556, + "p50": 1987.51, + "p95": 2166.607, + "p99": 2167.749 + }, + "sql_queries": 128, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:users": 32, + "SELECT:chat_members": 32, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 90.24, + "peak_process_rss_mib": 350.76 + }, + { + "workload": "warm-history", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.332, + "successes": 333, + "errors": 0, + "error_ratio": 0, + "successful_rps": 32.229, + "latency_ms": { + "mean": 488.166, + "p50": 378.127, + "p95": 1153.736, + "p99": 1400.961 + }, + "sql_queries": 1332, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 333, + "SELECT:users": 333, + "SELECT:chat_members": 333, + "SELECT:messages": 333 + }, + "process_cpu_percent_one_core": 88.94, + "peak_process_rss_mib": 351.14 + }, + { + "workload": "history-cache-bypassed", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.194, + "successes": 870, + "errors": 0, + "error_ratio": 0, + "successful_rps": 85.347, + "latency_ms": { + "mean": 186.44, + "p50": 159.038, + "p95": 411.49, + "p99": 565.075 + }, + "sql_queries": 3480, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 870, + "SELECT:users": 870, + "SELECT:chat_members": 870, + "SELECT:messages": 870 + }, + "process_cpu_percent_one_core": 109.42, + "peak_process_rss_mib": 351.26 + }, + { + "workload": "writes-single-chat", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 8.947, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 57.224, + "latency_ms": { + "mean": 278.524, + "p50": 232.781, + "p95": 528.251, + "p99": 758.496 + }, + "sql_queries": 1536, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 512, + "SELECT:users": 512, + "INSERT:messages": 512 + }, + "process_cpu_percent_one_core": 89.77, + "peak_process_rss_mib": 351.39 + }, + { + "workload": "cold-history-burst", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 0.584, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 54.771, + "latency_ms": { + "mean": 540.323, + "p50": 560.057, + "p95": 579.473, + "p99": 579.723 + }, + "sql_queries": 128, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:users": 32, + "SELECT:chat_members": 32, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 121.78, + "peak_process_rss_mib": 351.39 + }, + { + "workload": "warm-history", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.144, + "successes": 885, + "errors": 0, + "error_ratio": 0, + "successful_rps": 87.24, + "latency_ms": { + "mean": 182.207, + "p50": 138.17, + "p95": 476.708, + "p99": 686.502 + }, + "sql_queries": 3540, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 885, + "SELECT:users": 885, + "SELECT:chat_members": 885, + "SELECT:messages": 885 + }, + "process_cpu_percent_one_core": 111.32, + "peak_process_rss_mib": 351.51 + }, + { + "workload": "history-cache-bypassed", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.145, + "successes": 1136, + "errors": 0, + "error_ratio": 0, + "successful_rps": 111.971, + "latency_ms": { + "mean": 142.145, + "p50": 119.222, + "p95": 261.548, + "p99": 493.224 + }, + "sql_queries": 4544, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 1136, + "SELECT:users": 1136, + "SELECT:chat_members": 1136, + "SELECT:messages": 1136 + }, + "process_cpu_percent_one_core": 113.63, + "peak_process_rss_mib": 347.39 + }, + { + "workload": "writes-single-chat", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 6.233, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 82.146, + "latency_ms": { + "mean": 193.673, + "p50": 182.46, + "p95": 382.204, + "p99": 437.929 + }, + "sql_queries": 1536, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 512, + "SELECT:users": 512, + "INSERT:messages": 512 + }, + "process_cpu_percent_one_core": 102.54, + "peak_process_rss_mib": 347.64 + } + ], + "correctness": { + "no_redis_client": true, + "epochs_unchanged": true, + "read_after_write": true + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed" +} diff --git a/evidence/checks-rerun.json b/evidence/checks-rerun.json new file mode 100644 index 00000000..a062ece1 --- /dev/null +++ b/evidence/checks-rerun.json @@ -0,0 +1,37 @@ +{ + "recorded_on": "2026-10-13", + "backend_image": "sha256:02a5d9ca3816781e5931a82926b6a62858b1abf1eb9a0244da79d45e5787b020", + "scope": "Current built image; no rebuild, no changes to tests or HTTP deadlines.", + "checks": [ + { + "command": "python -X utf8 scripts/test-persistence.py --scenario public --base-url http://127.0.0.1:8080 --output evidence/persistence-public.json", + "result": "PASS", + "evidence": "persistence-public.json", + "http_deadline_seconds": 2, + "elapsed_seconds": 34.502 + }, + { + "command": "docker compose -f compose.yaml -f test/compose.benchmark.yaml run --rm --no-deps --pull never benchmark node --test test/passwords.mjs test/persistence.mjs test/resilience.mjs test/cache.mjs test/cache-epochs.mjs test/message-pagination.mjs", + "result": "PASS", + "exit_code": 0, + "tests": 15, + "passed": 15, + "failed": 0, + "skipped": 0, + "duration_ms": 48905.3297, + "output_extract": "checks-rerun.txt" + }, + { + "command": "python -X utf8 tests/smoke.py --base-url http://127.0.0.1:8080", + "result": "PASS", + "exit_code": 0, + "stdout": "PASS: lab2 public API scenario; infrastructure and grading evidence remain separate." + } + ], + "removed_superseded_failed_reports": [ + "argon2-public-persistence.json", + "cache-epochs-public-persistence.json" + ], + "historical_before_fix_cache_results_retained": true, + "clean_clone_not_checked": true +} diff --git a/evidence/checks-rerun.txt b/evidence/checks-rerun.txt new file mode 100644 index 00000000..ea27e83f --- /dev/null +++ b/evidence/checks-rerun.txt @@ -0,0 +1,24 @@ +Extract of node --test output; application HTTP logs omitted. +✔ DB cache epochs: two replicas, retained Redis keys, concurrent writes and atomic rollback (6434.557331ms) +✔ Redis cache: hits, expiry, invalidation race and unavailable-server fallback (1292.252866ms) +✔ API cache: fewer SQL reads, write invalidation, permissions, logout and Redis fallback (3126.628974ms) +✔ message keyset pagination: timestamp ties, chat isolation and deleted cursor row (3942.163363ms) +✔ Argon2id only: PHC format, independent derivation, unique salts, Unicode and invalid hashes (934.867797ms) +✔ PostgreSQL storage: constraints, pagination, access and application restart (16185.472827ms) +▶ Auth and dependency failures remain bounded and fail closed + ✔ incorrect password is 401 with Basic challenge (427.894703ms) + ✔ SESSION_TTL_SECONDS=2 expires without renewing on reads (2817.902277ms) + ✔ Redis disconnect: SQL fallback and anonymous callers remain unauthorized (2220.317988ms) + ✔ Redis hangs: command timeout bypasses cache (2547.996445ms) + ✔ PostgreSQL disconnect: bounded 503, no cached authorization bypass (564.359592ms) + ✔ PostgreSQL hangs on an established connection: client query timeout (5310.926248ms) + ✔ both services unavailable: fail closed and recover confirmed data (319.237936ms) +✔ Auth and dependency failures remain bounded and fail closed (22602.846427ms) +ℹ tests 15 +ℹ suites 0 +ℹ pass 15 +ℹ fail 0 +ℹ cancelled 0 +ℹ skipped 0 +ℹ todo 0 +ℹ duration_ms 48905.3297 diff --git a/evidence/epoch-variants-averages.json b/evidence/epoch-variants-averages.json new file mode 100644 index 00000000..b2417020 --- /dev/null +++ b/evidence/epoch-variants-averages.json @@ -0,0 +1,122 @@ +[ + { + "variant": "baseline", + "workload": "warm-history", + "successes": 40749, + "errors": 0, + "rps": 226.07561929595826, + "mean_latency_ms": 141.4230803946109, + "mean_p95_ms": 338.26133333333337, + "sql_per_request": 2.0037056124076664, + "repeat_rps": [ + 188.018, + 243.914, + 246.313 + ] + }, + { + "variant": "profile-join", + "workload": "warm-history", + "successes": 30756, + "errors": 0, + "rps": 170.52277906222452, + "mean_latency_ms": 187.38915626219273, + "mean_p95_ms": 516.1243333333333, + "sql_per_request": 2.0104695018858108, + "repeat_rps": [ + 135.713, + 209.749, + 166.141 + ] + }, + { + "variant": "access-join", + "workload": "warm-history", + "successes": 44662, + "errors": 0, + "rps": 246.93419437594684, + "mean_latency_ms": 129.50623859209173, + "mean_p95_ms": 331.749, + "sql_per_request": 1.0056199901482243, + "repeat_rps": [ + 282.567, + 271.362, + 186.487 + ] + }, + { + "variant": "striped", + "workload": "warm-history", + "successes": 43795, + "errors": 0, + "rps": 242.54826596958387, + "mean_latency_ms": 131.7491905468661, + "mean_p95_ms": 313.2903333333333, + "sql_per_request": 1.0040187235985842, + "repeat_rps": [ + 264.672, + 238.233, + 224.738 + ] + }, + { + "variant": "baseline", + "workload": "writes-single-chat", + "successes": 12288, + "errors": 0, + "rps": 90.77209467245811, + "mean_latency_ms": 352.00066666666663, + "mean_p95_ms": 985.9113333333333, + "sql_per_request": 2.0240885416666665, + "repeat_rps": [ + 51.084, + 133.969, + 166.398 + ] + }, + { + "variant": "profile-join", + "workload": "writes-single-chat", + "successes": 12288, + "errors": 0, + "rps": 141.47391689788964, + "mean_latency_ms": 225.99266666666665, + "mean_p95_ms": 524.0226666666666, + "sql_per_request": 2, + "repeat_rps": [ + 114.318, + 137.555, + 192.755 + ] + }, + { + "variant": "access-join", + "workload": "writes-single-chat", + "successes": 12288, + "errors": 0, + "rps": 117.7767341109716, + "mean_latency_ms": 271.309, + "mean_p95_ms": 624.231, + "sql_per_request": 2, + "repeat_rps": [ + 78.403, + 181, + 139.035 + ] + }, + { + "variant": "striped", + "workload": "writes-single-chat", + "successes": 12288, + "errors": 0, + "rps": 165.06145476526297, + "mean_latency_ms": 193.265, + "mean_p95_ms": 475.6803333333334, + "sql_per_request": 2, + "repeat_rps": [ + 182.806, + 160.668, + 154.303 + ] + } +] diff --git a/evidence/epoch-variants-code.json b/evidence/epoch-variants-code.json new file mode 100644 index 00000000..c0bef15c --- /dev/null +++ b/evidence/epoch-variants-code.json @@ -0,0 +1,111 @@ +{ + "variants": [ + { + "name": "baseline", + "modules": { + "Auth/auth.service.ts": { + "source_sha256": "86599b6e89cd66483cb10aff0d85cc29fe092ab24bbb849960079dcae347b8bf", + "js_sha256": "70e4c149faff62a38f3009816994c349096a8300495ecd57128a07af2acfb78f" + }, + "User/user.service.ts": { + "source_sha256": "de158e39c114c610cc7ea6c850108c8dd69c9bc3d643bac94557d272621f3cfb", + "js_sha256": "e71c703979ae29963546f88602d4c98735562163749af06c966474e1670e4b7c" + }, + "User/user.guard.ts": { + "source_sha256": "b84d95633fbd89b4fdbc505c51dd64e657611651b757bed1aea8eee3f0eac3d9", + "js_sha256": "16bc70f6d4df0809637b16f569dda973085128775f29c29d6154aecf9a45be52" + }, + "Chat/chat.service.ts": { + "source_sha256": "11b6b6d361d5599667318540b2c83a1b8e397db6d4d3665bbfa526e0b349d430", + "js_sha256": "42cc729f6f8f6da1a4b6b66746d7ea8299c4a26cfc29f6cfcb436d865107dfad" + }, + "Chat/chat.controller.ts": { + "source_sha256": "700becb64112538a6551c5775ccc09ff9d750755dcffe6ec916782afed1dae11", + "js_sha256": "32ebfcf009fce603c8637da701e33756868a3a4b1dda3e93cf7007b3a8b14ec7" + } + }, + "striped": false + }, + { + "name": "profile-join", + "modules": { + "Auth/auth.service.ts": { + "source_sha256": "63e6ad3117bf8adda51bab735ee7b975179e68a6af060aafe63416a8c9b90107", + "js_sha256": "5da0f49def86501c34c2f8d02dbd86dde37b9b7d1d98b57df3e334fc557dcffd" + }, + "User/user.service.ts": { + "source_sha256": "0737e88c408510bc17ec0597c3812be855c03499dfc2ad5ba6a4b1e85bb1c5e7", + "js_sha256": "e71c703979ae29963546f88602d4c98735562163749af06c966474e1670e4b7c" + }, + "User/user.guard.ts": { + "source_sha256": "b84d95633fbd89b4fdbc505c51dd64e657611651b757bed1aea8eee3f0eac3d9", + "js_sha256": "16bc70f6d4df0809637b16f569dda973085128775f29c29d6154aecf9a45be52" + }, + "Chat/chat.service.ts": { + "source_sha256": "11b6b6d361d5599667318540b2c83a1b8e397db6d4d3665bbfa526e0b349d430", + "js_sha256": "42cc729f6f8f6da1a4b6b66746d7ea8299c4a26cfc29f6cfcb436d865107dfad" + }, + "Chat/chat.controller.ts": { + "source_sha256": "700becb64112538a6551c5775ccc09ff9d750755dcffe6ec916782afed1dae11", + "js_sha256": "32ebfcf009fce603c8637da701e33756868a3a4b1dda3e93cf7007b3a8b14ec7" + } + }, + "striped": false + }, + { + "name": "access-join", + "modules": { + "Auth/auth.service.ts": { + "source_sha256": "c577b5c9d8ad52eae065359f1614de2d74b1bc7588ac2676d513f4aba2fc9c6f", + "js_sha256": "8fc180339017f373771a1abeed9f6dc978ee8a1c051df9f6fb69f054ca45bf0f" + }, + "User/user.service.ts": { + "source_sha256": "0737e88c408510bc17ec0597c3812be855c03499dfc2ad5ba6a4b1e85bb1c5e7", + "js_sha256": "e71c703979ae29963546f88602d4c98735562163749af06c966474e1670e4b7c" + }, + "User/user.guard.ts": { + "source_sha256": "20b05a0e5272a4ee1ccbddef83494e62621ffb0236e56a15c17e7f8f0083f6d7", + "js_sha256": "a078cc3065d6f87ee441f2bc0ff43af25094e66db4bd661d74cf3cd1c501fc2a" + }, + "Chat/chat.service.ts": { + "source_sha256": "11a44d19390d1e605fb72fabbc6111a25917e292a1aab4132e26390887128219", + "js_sha256": "3759d025e679f2b1694e486c460361a96979f8b67a1a8e811e589c722e8fb55f" + }, + "Chat/chat.controller.ts": { + "source_sha256": "1e3b1e0a5abc053625c5b1a6dc14f5b5b3e87676b1af0bdd73e78ad95d1eb325", + "js_sha256": "6ac78b848b82f03a4134a9e19e2b802fef59d06b938f2e747fa361c2293fd5c7" + } + }, + "striped": false + }, + { + "name": "striped", + "modules": { + "Auth/auth.service.ts": { + "source_sha256": "f99168697aa79d7c5c1fd9f35083448c97f68a0bfecdbfbca49fa279445d79b1", + "js_sha256": "73fe21965e7f1fc421b501c5760ee8dfc4ca7edb606477db1682dd04a9c885d1" + }, + "User/user.service.ts": { + "source_sha256": "0737e88c408510bc17ec0597c3812be855c03499dfc2ad5ba6a4b1e85bb1c5e7", + "js_sha256": "e71c703979ae29963546f88602d4c98735562163749af06c966474e1670e4b7c" + }, + "User/user.guard.ts": { + "source_sha256": "20b05a0e5272a4ee1ccbddef83494e62621ffb0236e56a15c17e7f8f0083f6d7", + "js_sha256": "a078cc3065d6f87ee441f2bc0ff43af25094e66db4bd661d74cf3cd1c501fc2a" + }, + "Chat/chat.service.ts": { + "source_sha256": "b43a57b6e6e17a3133f2061d5660f8e36b62e049975b0d6d800517f99d942699", + "js_sha256": "208e1298e119284bb587ba80b8ef650e7c8fd9031a17ff5079f50732902a62c7" + }, + "Chat/chat.controller.ts": { + "source_sha256": "1e3b1e0a5abc053625c5b1a6dc14f5b5b3e87676b1af0bdd73e78ad95d1eb325", + "js_sha256": "6ac78b848b82f03a4134a9e19e2b802fef59d06b938f2e747fa361c2293fd5c7" + } + }, + "striped": true + } + ], + "schema": "epoch_variants_0302fea1e5264f72a02693f65cb217b7", + "exit_code": 0, + "implementation": "TypeScript source snapshots; variant methods activated sequentially before HTTP workloads. Separate cache prefixes and API instances, shared fixtures and Node process." +} \ No newline at end of file diff --git a/evidence/epoch-variants-sources.json b/evidence/epoch-variants-sources.json new file mode 100644 index 00000000..283a4605 --- /dev/null +++ b/evidence/epoch-variants-sources.json @@ -0,0 +1,30 @@ +{ + "baseline": { + "Auth/auth.service.ts": "import { Injectable } from '@nestjs/common';\nimport { createHash, randomBytes } from 'node:crypto';\nimport { TextDecoder } from 'node:util';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { Prisma } from '../generated/prisma/client';\nimport { UserService } from '../User/user.service';\nimport type { User } from '../User/user.schema';\nimport { invalidRequest } from '../common/validation';\nimport { AuthException } from './auth.exception';\nimport { PasswordService, validPassword } from './password.service';\nimport type { Session } from './auth.schema';\n\n@Injectable()\nexport class AuthService {\n private readonly ttlSeconds: number;\n\n constructor(\n private readonly prisma: PrismaService,\n private readonly users: UserService,\n private readonly passwords: PasswordService,\n ) {\n this.ttlSeconds = Number(process.env.SESSION_TTL_SECONDS ?? 3600);\n if (\n !Number.isSafeInteger(this.ttlSeconds) ||\n this.ttlSeconds <= 0 ||\n Number.isNaN(new Date(Date.now() + this.ttlSeconds * 1000).getTime())\n ) {\n throw new Error(\n 'SESSION_TTL_SECONDS must be a positive integer representing a valid expiry',\n );\n }\n }\n\n async login(authorization: unknown, body: unknown): Promise {\n const { username, password } = this.basicCredentials(authorization);\n const user = await this.prisma.user.findUnique({ where: { username } });\n const verified = await this.passwords.verify(\n password,\n user?.passwordHash ?? null,\n );\n if (!user || !verified) throw new AuthException('Basic');\n if (body !== undefined)\n return invalidRequest('Вход через Basic не принимает тело запроса');\n const token = randomBytes(32).toString('base64url');\n const session = await this.prisma.session.create({\n data: {\n userId: user.id,\n tokenHash: this.tokenHash(token),\n expiresAt: new Date(Date.now() + this.ttlSeconds * 1000),\n },\n });\n return {\n token,\n token_type: 'Bearer',\n expires_at: session.expiresAt.toISOString(),\n user: this.users.serialize(user),\n };\n }\n\n async authenticate(\n authorization: unknown,\n ): Promise<{ user: User; sessionId: string; chatsEpoch: string }> {\n const match =\n typeof authorization === 'string' &&\n /^Bearer +([A-Za-z0-9_-]{43})$/i.exec(authorization);\n if (!match) throw new AuthException('Bearer');\n const [session] = await this.prisma.$queryRaw<\n { id: string; userId: string; chatsEpoch: bigint }[]\n >(Prisma.sql`\n SELECT s.id, s.user_id AS \"userId\", u.chats_epoch AS \"chatsEpoch\"\n FROM sessions AS s\n JOIN users AS u ON u.id = s.user_id\n WHERE s.token_hash = ${this.tokenHash(match[1])}\n AND s.revoked_at IS NULL AND s.expires_at > ${new Date()}\n LIMIT 1\n `);\n if (!session) throw new AuthException('Bearer');\n const user = await this.users.get(session.userId);\n if (!user) throw new AuthException('Bearer');\n return {\n user,\n sessionId: session.id,\n chatsEpoch: session.chatsEpoch.toString(),\n };\n }\n\n async logout(sessionId: string): Promise {\n const now = new Date();\n const result = await this.prisma.session.updateMany({\n where: { id: sessionId, revokedAt: null, expiresAt: { gt: now } },\n data: { revokedAt: now },\n });\n if (result.count !== 1) throw new AuthException('Bearer');\n }\n\n private tokenHash(token: string): string {\n return createHash('sha256').update(token).digest('hex');\n }\n\n private basicCredentials(authorization: unknown): {\n username: string;\n password: string;\n } {\n const match =\n typeof authorization === 'string' &&\n /^Basic +([A-Za-z0-9+/]+={0,2})$/i.exec(authorization);\n if (!match) throw new AuthException('Basic');\n try {\n const bytes = Buffer.from(match[1], 'base64');\n if (\n bytes.toString('base64').replace(/=+$/, '') !==\n match[1].replace(/=+$/, '')\n )\n throw new AuthException('Basic');\n const value = new TextDecoder('utf-8', { fatal: true }).decode(bytes);\n const colon = value.indexOf(':');\n const username = value.slice(0, colon);\n const password = value.slice(colon + 1);\n if (\n colon < 0 ||\n !/^[a-z0-9_]{3,32}$/.test(username) ||\n !validPassword(password)\n )\n throw new AuthException('Basic');\n return { username, password };\n } catch {\n throw new AuthException('Basic');\n }\n }\n}\n", + "User/user.service.ts": "import { HttpStatus, Injectable } from '@nestjs/common';\nimport { Prisma, type User as StoredUser } from '../generated/prisma/client';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { ApiException } from '../common/exceptions/api.exception';\nimport { objectBody, requiredText } from '../common/validation';\nimport {\n PasswordService,\n registrationPassword,\n} from '../Auth/password.service';\nimport type { User } from './user.schema';\nimport { CacheService, CACHE_TTL } from '../cache/cache.service';\n\n@Injectable()\nexport class UserService {\n constructor(\n private readonly prisma: PrismaService,\n private readonly passwords: PasswordService,\n private readonly cache: CacheService,\n ) {}\n\n async create(value: unknown): Promise {\n const body = objectBody(value, ['username', 'display_name', 'password']);\n const username = body.username;\n if (typeof username !== 'string' || !/^[a-z0-9_]{3,32}$/.test(username)) {\n throw new ApiException(\n HttpStatus.BAD_REQUEST,\n 'invalid_request',\n 'Некорректный username',\n );\n }\n const displayName = requiredText(body.display_name, 'display_name', 100);\n const password = registrationPassword(body.password);\n const passwordHash = await this.passwords.hash(password);\n try {\n return this.serialize(\n await this.prisma.user.create({\n data: { username, displayName, passwordHash },\n }),\n );\n } catch (error) {\n if (\n error instanceof Prisma.PrismaClientKnownRequestError &&\n error.code === 'P2002'\n ) {\n throw new ApiException(\n HttpStatus.CONFLICT,\n 'conflict',\n 'Username уже занят',\n );\n }\n throw error;\n }\n }\n\n async get(id: string): Promise {\n return this.cache.remember(\n `user:${id}`,\n 'profile',\n CACHE_TTL.entity,\n async () => {\n const user = await this.prisma.user.findUnique({ where: { id } });\n return user ? this.serialize(user) : undefined;\n },\n );\n }\n\n serialize(user: StoredUser): User {\n return {\n id: user.id,\n username: user.username,\n display_name: user.displayName,\n created_at: user.createdAt.toISOString(),\n };\n }\n}\n", + "User/user.guard.ts": "import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';\nimport type { FastifyRequest } from 'fastify';\nimport { AuthService } from '../Auth/auth.service';\nimport type { User } from './user.schema';\n\nexport type AuthenticatedRequest = FastifyRequest & {\n currentUser: User;\n currentSessionId: string;\n currentChatsEpoch: string;\n};\n\n@Injectable()\nexport class UserGuard implements CanActivate {\n constructor(private readonly auth: AuthService) {}\n\n async canActivate(context: ExecutionContext): Promise {\n const request = context.switchToHttp().getRequest();\n const session = await this.auth.authenticate(request.headers.authorization);\n request.currentUser = session.user;\n request.currentSessionId = session.sessionId;\n request.currentChatsEpoch = session.chatsEpoch;\n return true;\n }\n}\n", + "Chat/chat.service.ts": "import { HttpStatus, Injectable } from '@nestjs/common';\nimport { randomUUID } from 'node:crypto';\nimport {\n Prisma,\n type Message as StoredMessage,\n} from '../generated/prisma/client';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { ApiException } from '../common/exceptions/api.exception';\nimport {\n invalidRequest,\n objectBody,\n pageLimit,\n requiredText,\n uuid,\n} from '../common/validation';\nimport type { Chat, Message, Page } from './chat.schema';\nimport { CacheService, CACHE_TTL } from '../cache/cache.service';\n\ninterface Cursor {\n scope: string;\n created_at: string;\n id: string;\n}\n\nconst chatInclude = {\n members: { orderBy: { position: 'asc' as const } },\n} satisfies Prisma.ChatInclude;\ntype StoredChat = Prisma.ChatGetPayload<{ include: typeof chatInclude }>;\n\n@Injectable()\nexport class ChatService {\n constructor(\n private readonly prisma: PrismaService,\n private readonly cache: CacheService,\n ) {}\n\n async create(value: unknown, userId: string): Promise {\n const body = objectBody(value, ['title', 'member_ids']);\n const title = requiredText(body.title, 'title', 100);\n if (\n !Array.isArray(body.member_ids) ||\n body.member_ids.length < 1 ||\n body.member_ids.length > 100\n ) {\n return invalidRequest('Некорректный member_ids');\n }\n const memberIds = body.member_ids.map((id: unknown) =>\n uuid(id, 'member_ids'),\n );\n if (\n new Set(memberIds).size !== memberIds.length ||\n !memberIds.includes(userId)\n ) {\n return invalidRequest(\n 'Список участников содержит дубликат или не содержит вызывающего',\n );\n }\n try {\n const chat = await this.prisma.$transaction(async (tx) => {\n const count = await tx.user.count({ where: { id: { in: memberIds } } });\n if (count !== memberIds.length)\n return invalidRequest('Неизвестный участник чата');\n const created = await tx.chat.create({\n data: {\n title,\n members: {\n create: memberIds.map((userId, position) => ({\n userId,\n position,\n })),\n },\n },\n include: chatInclude,\n });\n await tx.$executeRaw(Prisma.sql`\n WITH locked AS MATERIALIZED (\n SELECT id FROM users\n WHERE id IN (${Prisma.join(memberIds.map((id) => Prisma.sql`${id}::uuid`))})\n ORDER BY id FOR UPDATE\n )\n UPDATE users AS u SET chats_epoch = u.chats_epoch + 1\n FROM locked WHERE u.id = locked.id\n `);\n return created;\n });\n return this.serializeChat(chat);\n } catch (error) {\n if (\n error instanceof Prisma.PrismaClientKnownRequestError &&\n error.code === 'P2003'\n ) {\n return invalidRequest('Неизвестный участник чата');\n }\n throw error;\n }\n }\n\n async list(\n userId: string,\n limitValue: unknown,\n cursorValue: unknown,\n epoch: string,\n ): Promise> {\n const limit = pageLimit(limitValue);\n const scope = `chats:${userId}`;\n const cursor = this.decodeCursor(cursorValue, scope);\n return this.cache.remember(\n scope,\n { limit, cursor },\n CACHE_TTL.page,\n async () => {\n const chats = await this.prisma.chat.findMany({\n where: { members: { some: { userId } }, ...this.after(cursor) },\n include: chatInclude,\n orderBy: [{ createdAt: 'asc' }, { id: 'asc' }],\n take: limit + 1,\n });\n return this.page(\n chats.map((chat) => this.serializeChat(chat)),\n limit,\n scope,\n );\n },\n epoch,\n );\n }\n\n async get(value: unknown, userId: string): Promise {\n const { id } = await this.authorizeChat(value, userId);\n return this.getMetadata(id);\n }\n\n private async authorizeChat(value: unknown, userId: string) {\n const id = uuid(value, 'chat_id');\n const [membership] = await this.prisma.$queryRaw<\n { id: string; messagesEpoch: bigint }[]\n >(Prisma.sql`\n SELECT c.id, c.messages_epoch AS \"messagesEpoch\"\n FROM chat_members AS cm JOIN chats AS c ON c.id = cm.chat_id\n WHERE cm.chat_id = ${id}::uuid AND cm.user_id = ${userId}::uuid\n `);\n if (!membership) {\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n }\n return membership;\n }\n\n private getMetadata(id: string): Promise {\n return this.cache.remember(\n `chat:${id}`,\n 'metadata',\n CACHE_TTL.entity,\n async () => {\n const chat = await this.prisma.chat.findUnique({\n where: { id },\n include: chatInclude,\n });\n if (!chat)\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n return this.serializeChat(chat);\n },\n );\n }\n\n async createMessage(\n chatId: unknown,\n value: unknown,\n userId: string,\n ): Promise {\n const id = uuid(chatId, 'chat_id');\n const body = objectBody(value, ['text']);\n const text = requiredText(body.text, 'text', 4000);\n const [message] = await this.prisma.$queryRaw(Prisma.sql`\n WITH updated AS (\n UPDATE chats AS c\n SET messages_epoch = c.messages_epoch + 1\n WHERE c.id = ${id}::uuid\n AND EXISTS (\n SELECT 1 FROM chat_members AS cm\n WHERE cm.chat_id = c.id AND cm.user_id = ${userId}::uuid\n )\n RETURNING c.id\n )\n INSERT INTO messages (id, chat_id, sender_id, text)\n SELECT ${randomUUID()}::uuid, updated.id, ${userId}::uuid, ${text}\n FROM updated\n RETURNING id, chat_id AS \"chatId\", sender_id AS \"senderId\",\n text, created_at AS \"createdAt\"\n `);\n if (!message)\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n return this.serializeMessage(message);\n }\n\n async listMessages(\n chatId: unknown,\n userId: string,\n limitValue: unknown,\n cursorValue: unknown,\n ): Promise> {\n const chat = await this.authorizeChat(chatId, userId);\n const limit = pageLimit(limitValue);\n const scope = `messages:${chat.id}`;\n const cursor = this.decodeCursor(cursorValue, scope);\n return this.cache.remember(\n scope,\n { limit, cursor },\n CACHE_TTL.page,\n async () => {\n const messages = cursor\n ? await this.prisma.$queryRaw(Prisma.sql`\n SELECT id, chat_id AS \"chatId\", sender_id AS \"senderId\",\n text, created_at AS \"createdAt\"\n FROM \"public\".\"messages\"\n WHERE chat_id = ${chat.id}::uuid\n AND (created_at, id) >\n (${new Date(cursor.created_at)}::timestamptz, ${cursor.id}::uuid)\n ORDER BY created_at ASC, id ASC\n LIMIT ${limit + 1}\n `)\n : await this.prisma.message.findMany({\n where: { chatId: chat.id },\n orderBy: [{ createdAt: 'asc' }, { id: 'asc' }],\n take: limit + 1,\n });\n return this.page(\n messages.map((message) => this.serializeMessage(message)),\n limit,\n scope,\n );\n },\n chat.messagesEpoch.toString(),\n );\n }\n\n private after(cursor: Cursor | null) {\n if (!cursor) return {};\n const createdAt = new Date(cursor.created_at);\n return {\n OR: [\n { createdAt: { gt: createdAt } },\n { createdAt, id: { gt: cursor.id } },\n ],\n };\n }\n\n private serializeChat(chat: StoredChat): Chat {\n return {\n id: chat.id,\n title: chat.title,\n member_ids: chat.members.map((member) => member.userId),\n created_at: chat.createdAt.toISOString(),\n };\n }\n\n private serializeMessage(message: StoredMessage): Message {\n return {\n id: message.id,\n chat_id: message.chatId,\n sender_id: message.senderId,\n text: message.text,\n created_at: message.createdAt.toISOString(),\n };\n }\n\n private page(\n items: T[],\n limit: number,\n scope: string,\n ): Page {\n const result = items.slice(0, limit);\n const last = result.at(-1);\n return {\n items: result,\n next_cursor:\n items.length > limit && last\n ? Buffer.from(\n JSON.stringify({\n scope,\n created_at: last.created_at,\n id: last.id,\n }),\n ).toString('base64url')\n : null,\n };\n }\n\n private decodeCursor(value: unknown, scope: string): Cursor | null {\n if (value === undefined) return null;\n if (typeof value !== 'string' || !/^[A-Za-z0-9_-]+$/.test(value))\n return invalidRequest('Некорректный cursor');\n try {\n const cursor: unknown = JSON.parse(\n Buffer.from(value, 'base64url').toString('utf8'),\n );\n if (\n typeof cursor !== 'object' ||\n cursor === null ||\n Array.isArray(cursor)\n )\n return invalidRequest('Некорректный cursor');\n const data = cursor as Record;\n if (\n data.scope !== scope ||\n typeof data.created_at !== 'string' ||\n Number.isNaN(Date.parse(data.created_at)) ||\n typeof data.id !== 'string'\n ) {\n return invalidRequest('Некорректный cursor');\n }\n return {\n scope,\n created_at: data.created_at,\n id: uuid(data.id, 'cursor'),\n };\n } catch {\n return invalidRequest('Некорректный cursor');\n }\n }\n}\n", + "Chat/chat.controller.ts": "import {\n Body,\n Controller,\n Get,\n HttpCode,\n HttpStatus,\n Param,\n Post,\n Query,\n Req,\n UseGuards,\n} from '@nestjs/common';\nimport {\n ApiBody,\n ApiBearerAuth,\n ApiCreatedResponse,\n ApiOkResponse,\n ApiOperation,\n ApiQuery,\n ApiTags,\n} from '@nestjs/swagger';\nimport { UserGuard, type AuthenticatedRequest } from '../User/user.guard';\nimport {\n CreateChatDto,\n CreateMessageDto,\n Chat,\n Message,\n ChatPage,\n MessagePage,\n} from './chat.schema';\nimport { ChatService } from './chat.service';\n\n@ApiTags('chats')\n@ApiBearerAuth('bearerAuth')\n@UseGuards(UserGuard)\n@Controller('api/v1/chats')\nexport class ChatController {\n constructor(private readonly chats: ChatService) {}\n\n @Post()\n @HttpCode(HttpStatus.CREATED)\n @ApiBody({ type: CreateChatDto })\n @ApiOperation({ operationId: 'createChat' })\n @ApiCreatedResponse({ type: Chat })\n create(@Req() request: AuthenticatedRequest, @Body() body: unknown) {\n return this.chats.create(body, request.currentUser.id);\n }\n\n @Get()\n @ApiOperation({ operationId: 'listChats' })\n @ApiOkResponse({ type: ChatPage })\n @ApiQuery({\n name: 'limit',\n required: false,\n schema: { type: 'integer', minimum: 1, maximum: 100, default: 50 },\n })\n @ApiQuery({ name: 'cursor', required: false, type: String })\n list(\n @Req() request: AuthenticatedRequest,\n @Query('limit') limit: unknown,\n @Query('cursor') cursor: unknown,\n ) {\n return this.chats.list(\n request.currentUser.id,\n limit,\n cursor,\n request.currentChatsEpoch,\n );\n }\n\n @Get(':chat_id')\n @ApiOperation({ operationId: 'getChat' })\n @ApiOkResponse({ type: Chat })\n get(@Req() request: AuthenticatedRequest, @Param('chat_id') chatId: string) {\n return this.chats.get(chatId, request.currentUser.id);\n }\n\n @Post(':chat_id/messages')\n @HttpCode(HttpStatus.CREATED)\n @ApiBody({ type: CreateMessageDto })\n @ApiOperation({ operationId: 'createMessage' })\n @ApiCreatedResponse({ type: Message })\n createMessage(\n @Req() request: AuthenticatedRequest,\n @Param('chat_id') chatId: string,\n @Body() body: unknown,\n ) {\n return this.chats.createMessage(chatId, body, request.currentUser.id);\n }\n\n @Get(':chat_id/messages')\n @ApiOperation({ operationId: 'listMessages' })\n @ApiOkResponse({ type: MessagePage })\n @ApiQuery({\n name: 'limit',\n required: false,\n schema: { type: 'integer', minimum: 1, maximum: 100, default: 50 },\n })\n @ApiQuery({ name: 'cursor', required: false, type: String })\n listMessages(\n @Req() request: AuthenticatedRequest,\n @Param('chat_id') chatId: string,\n @Query('limit') limit: unknown,\n @Query('cursor') cursor: unknown,\n ) {\n return this.chats.listMessages(\n chatId,\n request.currentUser.id,\n limit,\n cursor,\n );\n }\n}\n" + }, + "profile-join": { + "Auth/auth.service.ts": "import { Injectable } from '@nestjs/common';\nimport { createHash, randomBytes } from 'node:crypto';\nimport { TextDecoder } from 'node:util';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { Prisma } from '../generated/prisma/client';\nimport { UserService } from '../User/user.service';\nimport type { User } from '../User/user.schema';\nimport { invalidRequest } from '../common/validation';\nimport { AuthException } from './auth.exception';\nimport { PasswordService, validPassword } from './password.service';\nimport type { Session } from './auth.schema';\n\n@Injectable()\nexport class AuthService {\n private readonly ttlSeconds: number;\n\n constructor(\n private readonly prisma: PrismaService,\n private readonly users: UserService,\n private readonly passwords: PasswordService,\n ) {\n this.ttlSeconds = Number(process.env.SESSION_TTL_SECONDS ?? 3600);\n if (\n !Number.isSafeInteger(this.ttlSeconds) ||\n this.ttlSeconds <= 0 ||\n Number.isNaN(new Date(Date.now() + this.ttlSeconds * 1000).getTime())\n ) {\n throw new Error(\n 'SESSION_TTL_SECONDS must be a positive integer representing a valid expiry',\n );\n }\n }\n\n async login(authorization: unknown, body: unknown): Promise {\n const { username, password } = this.basicCredentials(authorization);\n const user = await this.prisma.user.findUnique({ where: { username } });\n const verified = await this.passwords.verify(\n password,\n user?.passwordHash ?? null,\n );\n if (!user || !verified) throw new AuthException('Basic');\n if (body !== undefined)\n return invalidRequest('Вход через Basic не принимает тело запроса');\n const token = randomBytes(32).toString('base64url');\n const session = await this.prisma.session.create({\n data: {\n userId: user.id,\n tokenHash: this.tokenHash(token),\n expiresAt: new Date(Date.now() + this.ttlSeconds * 1000),\n },\n });\n return {\n token,\n token_type: 'Bearer',\n expires_at: session.expiresAt.toISOString(),\n user: this.users.serialize(user),\n };\n }\n\n async authenticate(\n authorization: unknown,\n ): Promise<{ user: User; sessionId: string; chatsEpoch: string }> {\n const match =\n typeof authorization === 'string' &&\n /^Bearer +([A-Za-z0-9_-]{43})$/i.exec(authorization);\n if (!match) throw new AuthException('Bearer');\n const [session] = await this.prisma.$queryRaw<\n {\n id: string;\n userId: string;\n username: string;\n displayName: string;\n createdAt: Date;\n chatsEpoch: bigint;\n }[]\n >(Prisma.sql`\n SELECT s.id, s.user_id AS \"userId\", u.chats_epoch AS \"chatsEpoch\",\n u.username, u.display_name AS \"displayName\", u.created_at AS \"createdAt\"\n FROM sessions AS s\n JOIN users AS u ON u.id = s.user_id\n WHERE s.token_hash = ${this.tokenHash(match[1])}\n AND s.revoked_at IS NULL AND s.expires_at > ${new Date()}\n LIMIT 1\n `);\n if (!session) throw new AuthException('Bearer');\n return {\n user: this.users.serialize({ ...session, id: session.userId }),\n sessionId: session.id,\n chatsEpoch: session.chatsEpoch.toString(),\n };\n }\n\n async logout(sessionId: string): Promise {\n const now = new Date();\n const result = await this.prisma.session.updateMany({\n where: { id: sessionId, revokedAt: null, expiresAt: { gt: now } },\n data: { revokedAt: now },\n });\n if (result.count !== 1) throw new AuthException('Bearer');\n }\n\n private tokenHash(token: string): string {\n return createHash('sha256').update(token).digest('hex');\n }\n\n private basicCredentials(authorization: unknown): {\n username: string;\n password: string;\n } {\n const match =\n typeof authorization === 'string' &&\n /^Basic +([A-Za-z0-9+/]+={0,2})$/i.exec(authorization);\n if (!match) throw new AuthException('Basic');\n try {\n const bytes = Buffer.from(match[1], 'base64');\n if (\n bytes.toString('base64').replace(/=+$/, '') !==\n match[1].replace(/=+$/, '')\n )\n throw new AuthException('Basic');\n const value = new TextDecoder('utf-8', { fatal: true }).decode(bytes);\n const colon = value.indexOf(':');\n const username = value.slice(0, colon);\n const password = value.slice(colon + 1);\n if (\n colon < 0 ||\n !/^[a-z0-9_]{3,32}$/.test(username) ||\n !validPassword(password)\n )\n throw new AuthException('Basic');\n return { username, password };\n } catch {\n throw new AuthException('Basic');\n }\n }\n}\n", + "User/user.service.ts": "import { HttpStatus, Injectable } from '@nestjs/common';\nimport { Prisma, type User as StoredUser } from '../generated/prisma/client';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { ApiException } from '../common/exceptions/api.exception';\nimport { objectBody, requiredText } from '../common/validation';\nimport {\n PasswordService,\n registrationPassword,\n} from '../Auth/password.service';\nimport type { User } from './user.schema';\nimport { CacheService, CACHE_TTL } from '../cache/cache.service';\n\n@Injectable()\nexport class UserService {\n constructor(\n private readonly prisma: PrismaService,\n private readonly passwords: PasswordService,\n private readonly cache: CacheService,\n ) {}\n\n async create(value: unknown): Promise {\n const body = objectBody(value, ['username', 'display_name', 'password']);\n const username = body.username;\n if (typeof username !== 'string' || !/^[a-z0-9_]{3,32}$/.test(username)) {\n throw new ApiException(\n HttpStatus.BAD_REQUEST,\n 'invalid_request',\n 'Некорректный username',\n );\n }\n const displayName = requiredText(body.display_name, 'display_name', 100);\n const password = registrationPassword(body.password);\n const passwordHash = await this.passwords.hash(password);\n try {\n return this.serialize(\n await this.prisma.user.create({\n data: { username, displayName, passwordHash },\n }),\n );\n } catch (error) {\n if (\n error instanceof Prisma.PrismaClientKnownRequestError &&\n error.code === 'P2002'\n ) {\n throw new ApiException(\n HttpStatus.CONFLICT,\n 'conflict',\n 'Username уже занят',\n );\n }\n throw error;\n }\n }\n\n async get(id: string): Promise {\n return this.cache.remember(\n `user:${id}`,\n 'profile',\n CACHE_TTL.entity,\n async () => {\n const user = await this.prisma.user.findUnique({ where: { id } });\n return user ? this.serialize(user) : undefined;\n },\n );\n }\n\n serialize(\n user: Pick,\n ): User {\n return {\n id: user.id,\n username: user.username,\n display_name: user.displayName,\n created_at: user.createdAt.toISOString(),\n };\n }\n}\n", + "User/user.guard.ts": "import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';\nimport type { FastifyRequest } from 'fastify';\nimport { AuthService } from '../Auth/auth.service';\nimport type { User } from './user.schema';\n\nexport type AuthenticatedRequest = FastifyRequest & {\n currentUser: User;\n currentSessionId: string;\n currentChatsEpoch: string;\n};\n\n@Injectable()\nexport class UserGuard implements CanActivate {\n constructor(private readonly auth: AuthService) {}\n\n async canActivate(context: ExecutionContext): Promise {\n const request = context.switchToHttp().getRequest();\n const session = await this.auth.authenticate(request.headers.authorization);\n request.currentUser = session.user;\n request.currentSessionId = session.sessionId;\n request.currentChatsEpoch = session.chatsEpoch;\n return true;\n }\n}\n", + "Chat/chat.service.ts": "import { HttpStatus, Injectable } from '@nestjs/common';\nimport { randomUUID } from 'node:crypto';\nimport {\n Prisma,\n type Message as StoredMessage,\n} from '../generated/prisma/client';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { ApiException } from '../common/exceptions/api.exception';\nimport {\n invalidRequest,\n objectBody,\n pageLimit,\n requiredText,\n uuid,\n} from '../common/validation';\nimport type { Chat, Message, Page } from './chat.schema';\nimport { CacheService, CACHE_TTL } from '../cache/cache.service';\n\ninterface Cursor {\n scope: string;\n created_at: string;\n id: string;\n}\n\nconst chatInclude = {\n members: { orderBy: { position: 'asc' as const } },\n} satisfies Prisma.ChatInclude;\ntype StoredChat = Prisma.ChatGetPayload<{ include: typeof chatInclude }>;\n\n@Injectable()\nexport class ChatService {\n constructor(\n private readonly prisma: PrismaService,\n private readonly cache: CacheService,\n ) {}\n\n async create(value: unknown, userId: string): Promise {\n const body = objectBody(value, ['title', 'member_ids']);\n const title = requiredText(body.title, 'title', 100);\n if (\n !Array.isArray(body.member_ids) ||\n body.member_ids.length < 1 ||\n body.member_ids.length > 100\n ) {\n return invalidRequest('Некорректный member_ids');\n }\n const memberIds = body.member_ids.map((id: unknown) =>\n uuid(id, 'member_ids'),\n );\n if (\n new Set(memberIds).size !== memberIds.length ||\n !memberIds.includes(userId)\n ) {\n return invalidRequest(\n 'Список участников содержит дубликат или не содержит вызывающего',\n );\n }\n try {\n const chat = await this.prisma.$transaction(async (tx) => {\n const count = await tx.user.count({ where: { id: { in: memberIds } } });\n if (count !== memberIds.length)\n return invalidRequest('Неизвестный участник чата');\n const created = await tx.chat.create({\n data: {\n title,\n members: {\n create: memberIds.map((userId, position) => ({\n userId,\n position,\n })),\n },\n },\n include: chatInclude,\n });\n await tx.$executeRaw(Prisma.sql`\n WITH locked AS MATERIALIZED (\n SELECT id FROM users\n WHERE id IN (${Prisma.join(memberIds.map((id) => Prisma.sql`${id}::uuid`))})\n ORDER BY id FOR UPDATE\n )\n UPDATE users AS u SET chats_epoch = u.chats_epoch + 1\n FROM locked WHERE u.id = locked.id\n `);\n return created;\n });\n return this.serializeChat(chat);\n } catch (error) {\n if (\n error instanceof Prisma.PrismaClientKnownRequestError &&\n error.code === 'P2003'\n ) {\n return invalidRequest('Неизвестный участник чата');\n }\n throw error;\n }\n }\n\n async list(\n userId: string,\n limitValue: unknown,\n cursorValue: unknown,\n epoch: string,\n ): Promise> {\n const limit = pageLimit(limitValue);\n const scope = `chats:${userId}`;\n const cursor = this.decodeCursor(cursorValue, scope);\n return this.cache.remember(\n scope,\n { limit, cursor },\n CACHE_TTL.page,\n async () => {\n const chats = await this.prisma.chat.findMany({\n where: { members: { some: { userId } }, ...this.after(cursor) },\n include: chatInclude,\n orderBy: [{ createdAt: 'asc' }, { id: 'asc' }],\n take: limit + 1,\n });\n return this.page(\n chats.map((chat) => this.serializeChat(chat)),\n limit,\n scope,\n );\n },\n epoch,\n );\n }\n\n async get(value: unknown, userId: string): Promise {\n const { id } = await this.authorizeChat(value, userId);\n return this.getMetadata(id);\n }\n\n private async authorizeChat(value: unknown, userId: string) {\n const id = uuid(value, 'chat_id');\n const [membership] = await this.prisma.$queryRaw<\n { id: string; messagesEpoch: bigint }[]\n >(Prisma.sql`\n SELECT c.id, c.messages_epoch AS \"messagesEpoch\"\n FROM chat_members AS cm JOIN chats AS c ON c.id = cm.chat_id\n WHERE cm.chat_id = ${id}::uuid AND cm.user_id = ${userId}::uuid\n `);\n if (!membership) {\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n }\n return membership;\n }\n\n private getMetadata(id: string): Promise {\n return this.cache.remember(\n `chat:${id}`,\n 'metadata',\n CACHE_TTL.entity,\n async () => {\n const chat = await this.prisma.chat.findUnique({\n where: { id },\n include: chatInclude,\n });\n if (!chat)\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n return this.serializeChat(chat);\n },\n );\n }\n\n async createMessage(\n chatId: unknown,\n value: unknown,\n userId: string,\n ): Promise {\n const id = uuid(chatId, 'chat_id');\n const body = objectBody(value, ['text']);\n const text = requiredText(body.text, 'text', 4000);\n const [message] = await this.prisma.$queryRaw(Prisma.sql`\n WITH updated AS (\n UPDATE chats AS c\n SET messages_epoch = c.messages_epoch + 1\n WHERE c.id = ${id}::uuid\n AND EXISTS (\n SELECT 1 FROM chat_members AS cm\n WHERE cm.chat_id = c.id AND cm.user_id = ${userId}::uuid\n )\n RETURNING c.id\n )\n INSERT INTO messages (id, chat_id, sender_id, text)\n SELECT ${randomUUID()}::uuid, updated.id, ${userId}::uuid, ${text}\n FROM updated\n RETURNING id, chat_id AS \"chatId\", sender_id AS \"senderId\",\n text, created_at AS \"createdAt\"\n `);\n if (!message)\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n return this.serializeMessage(message);\n }\n\n async listMessages(\n chatId: unknown,\n userId: string,\n limitValue: unknown,\n cursorValue: unknown,\n ): Promise> {\n const chat = await this.authorizeChat(chatId, userId);\n const limit = pageLimit(limitValue);\n const scope = `messages:${chat.id}`;\n const cursor = this.decodeCursor(cursorValue, scope);\n return this.cache.remember(\n scope,\n { limit, cursor },\n CACHE_TTL.page,\n async () => {\n const messages = cursor\n ? await this.prisma.$queryRaw(Prisma.sql`\n SELECT id, chat_id AS \"chatId\", sender_id AS \"senderId\",\n text, created_at AS \"createdAt\"\n FROM \"public\".\"messages\"\n WHERE chat_id = ${chat.id}::uuid\n AND (created_at, id) >\n (${new Date(cursor.created_at)}::timestamptz, ${cursor.id}::uuid)\n ORDER BY created_at ASC, id ASC\n LIMIT ${limit + 1}\n `)\n : await this.prisma.message.findMany({\n where: { chatId: chat.id },\n orderBy: [{ createdAt: 'asc' }, { id: 'asc' }],\n take: limit + 1,\n });\n return this.page(\n messages.map((message) => this.serializeMessage(message)),\n limit,\n scope,\n );\n },\n chat.messagesEpoch.toString(),\n );\n }\n\n private after(cursor: Cursor | null) {\n if (!cursor) return {};\n const createdAt = new Date(cursor.created_at);\n return {\n OR: [\n { createdAt: { gt: createdAt } },\n { createdAt, id: { gt: cursor.id } },\n ],\n };\n }\n\n private serializeChat(chat: StoredChat): Chat {\n return {\n id: chat.id,\n title: chat.title,\n member_ids: chat.members.map((member) => member.userId),\n created_at: chat.createdAt.toISOString(),\n };\n }\n\n private serializeMessage(message: StoredMessage): Message {\n return {\n id: message.id,\n chat_id: message.chatId,\n sender_id: message.senderId,\n text: message.text,\n created_at: message.createdAt.toISOString(),\n };\n }\n\n private page(\n items: T[],\n limit: number,\n scope: string,\n ): Page {\n const result = items.slice(0, limit);\n const last = result.at(-1);\n return {\n items: result,\n next_cursor:\n items.length > limit && last\n ? Buffer.from(\n JSON.stringify({\n scope,\n created_at: last.created_at,\n id: last.id,\n }),\n ).toString('base64url')\n : null,\n };\n }\n\n private decodeCursor(value: unknown, scope: string): Cursor | null {\n if (value === undefined) return null;\n if (typeof value !== 'string' || !/^[A-Za-z0-9_-]+$/.test(value))\n return invalidRequest('Некорректный cursor');\n try {\n const cursor: unknown = JSON.parse(\n Buffer.from(value, 'base64url').toString('utf8'),\n );\n if (\n typeof cursor !== 'object' ||\n cursor === null ||\n Array.isArray(cursor)\n )\n return invalidRequest('Некорректный cursor');\n const data = cursor as Record;\n if (\n data.scope !== scope ||\n typeof data.created_at !== 'string' ||\n Number.isNaN(Date.parse(data.created_at)) ||\n typeof data.id !== 'string'\n ) {\n return invalidRequest('Некорректный cursor');\n }\n return {\n scope,\n created_at: data.created_at,\n id: uuid(data.id, 'cursor'),\n };\n } catch {\n return invalidRequest('Некорректный cursor');\n }\n }\n}\n", + "Chat/chat.controller.ts": "import {\n Body,\n Controller,\n Get,\n HttpCode,\n HttpStatus,\n Param,\n Post,\n Query,\n Req,\n UseGuards,\n} from '@nestjs/common';\nimport {\n ApiBody,\n ApiBearerAuth,\n ApiCreatedResponse,\n ApiOkResponse,\n ApiOperation,\n ApiQuery,\n ApiTags,\n} from '@nestjs/swagger';\nimport { UserGuard, type AuthenticatedRequest } from '../User/user.guard';\nimport {\n CreateChatDto,\n CreateMessageDto,\n Chat,\n Message,\n ChatPage,\n MessagePage,\n} from './chat.schema';\nimport { ChatService } from './chat.service';\n\n@ApiTags('chats')\n@ApiBearerAuth('bearerAuth')\n@UseGuards(UserGuard)\n@Controller('api/v1/chats')\nexport class ChatController {\n constructor(private readonly chats: ChatService) {}\n\n @Post()\n @HttpCode(HttpStatus.CREATED)\n @ApiBody({ type: CreateChatDto })\n @ApiOperation({ operationId: 'createChat' })\n @ApiCreatedResponse({ type: Chat })\n create(@Req() request: AuthenticatedRequest, @Body() body: unknown) {\n return this.chats.create(body, request.currentUser.id);\n }\n\n @Get()\n @ApiOperation({ operationId: 'listChats' })\n @ApiOkResponse({ type: ChatPage })\n @ApiQuery({\n name: 'limit',\n required: false,\n schema: { type: 'integer', minimum: 1, maximum: 100, default: 50 },\n })\n @ApiQuery({ name: 'cursor', required: false, type: String })\n list(\n @Req() request: AuthenticatedRequest,\n @Query('limit') limit: unknown,\n @Query('cursor') cursor: unknown,\n ) {\n return this.chats.list(\n request.currentUser.id,\n limit,\n cursor,\n request.currentChatsEpoch,\n );\n }\n\n @Get(':chat_id')\n @ApiOperation({ operationId: 'getChat' })\n @ApiOkResponse({ type: Chat })\n get(@Req() request: AuthenticatedRequest, @Param('chat_id') chatId: string) {\n return this.chats.get(chatId, request.currentUser.id);\n }\n\n @Post(':chat_id/messages')\n @HttpCode(HttpStatus.CREATED)\n @ApiBody({ type: CreateMessageDto })\n @ApiOperation({ operationId: 'createMessage' })\n @ApiCreatedResponse({ type: Message })\n createMessage(\n @Req() request: AuthenticatedRequest,\n @Param('chat_id') chatId: string,\n @Body() body: unknown,\n ) {\n return this.chats.createMessage(chatId, body, request.currentUser.id);\n }\n\n @Get(':chat_id/messages')\n @ApiOperation({ operationId: 'listMessages' })\n @ApiOkResponse({ type: MessagePage })\n @ApiQuery({\n name: 'limit',\n required: false,\n schema: { type: 'integer', minimum: 1, maximum: 100, default: 50 },\n })\n @ApiQuery({ name: 'cursor', required: false, type: String })\n listMessages(\n @Req() request: AuthenticatedRequest,\n @Param('chat_id') chatId: string,\n @Query('limit') limit: unknown,\n @Query('cursor') cursor: unknown,\n ) {\n return this.chats.listMessages(\n chatId,\n request.currentUser.id,\n limit,\n cursor,\n );\n }\n}\n" + }, + "access-join": { + "Auth/auth.service.ts": "import { Injectable } from '@nestjs/common';\nimport { createHash, randomBytes } from 'node:crypto';\nimport { TextDecoder } from 'node:util';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { Prisma } from '../generated/prisma/client';\nimport { UserService } from '../User/user.service';\nimport type { User } from '../User/user.schema';\nimport { invalidRequest, uuid, uuidPattern } from '../common/validation';\nimport { ApiException } from '../common/exceptions/api.exception';\nimport { AuthException } from './auth.exception';\nimport { PasswordService, validPassword } from './password.service';\nimport type { Session } from './auth.schema';\n\nexport interface ChatAccess {\n chatId: string;\n userId: string;\n messagesEpoch: string;\n}\n\n@Injectable()\nexport class AuthService {\n private readonly ttlSeconds: number;\n\n constructor(\n private readonly prisma: PrismaService,\n private readonly users: UserService,\n private readonly passwords: PasswordService,\n ) {\n this.ttlSeconds = Number(process.env.SESSION_TTL_SECONDS ?? 3600);\n if (\n !Number.isSafeInteger(this.ttlSeconds) ||\n this.ttlSeconds <= 0 ||\n Number.isNaN(new Date(Date.now() + this.ttlSeconds * 1000).getTime())\n ) {\n throw new Error(\n 'SESSION_TTL_SECONDS must be a positive integer representing a valid expiry',\n );\n }\n }\n\n async login(authorization: unknown, body: unknown): Promise {\n const { username, password } = this.basicCredentials(authorization);\n const user = await this.prisma.user.findUnique({ where: { username } });\n const verified = await this.passwords.verify(\n password,\n user?.passwordHash ?? null,\n );\n if (!user || !verified) throw new AuthException('Basic');\n if (body !== undefined)\n return invalidRequest('Вход через Basic не принимает тело запроса');\n const token = randomBytes(32).toString('base64url');\n const session = await this.prisma.session.create({\n data: {\n userId: user.id,\n tokenHash: this.tokenHash(token),\n expiresAt: new Date(Date.now() + this.ttlSeconds * 1000),\n },\n });\n return {\n token,\n token_type: 'Bearer',\n expires_at: session.expiresAt.toISOString(),\n user: this.users.serialize(user),\n };\n }\n\n async authenticate(\n authorization: unknown,\n chatId?: unknown,\n ): Promise<{\n user: User;\n sessionId: string;\n chatsEpoch: string;\n chatAccess?: ChatAccess;\n }> {\n const match =\n typeof authorization === 'string' &&\n /^Bearer +([A-Za-z0-9_-]{43})$/i.exec(authorization);\n if (!match) throw new AuthException('Bearer');\n const requestedChat =\n typeof chatId === 'string' && uuidPattern.test(chatId)\n ? chatId.toLowerCase()\n : null;\n const [session] = await this.prisma.$queryRaw<\n {\n id: string;\n userId: string;\n username: string;\n displayName: string;\n createdAt: Date;\n chatsEpoch: bigint;\n chatId: string | null;\n messagesEpoch: bigint | null;\n }[]\n >(Prisma.sql`\n SELECT s.id, s.user_id AS \"userId\", u.chats_epoch AS \"chatsEpoch\",\n u.username, u.display_name AS \"displayName\", u.created_at AS \"createdAt\",\n ${\n chatId === undefined\n ? Prisma.sql`NULL::uuid AS \"chatId\", NULL::bigint AS \"messagesEpoch\"`\n : Prisma.sql`c.id AS \"chatId\", c.messages_epoch AS \"messagesEpoch\"`\n }\n FROM sessions AS s\n JOIN users AS u ON u.id = s.user_id\n ${\n chatId === undefined\n ? Prisma.empty\n : Prisma.sql`\n LEFT JOIN chat_members AS cm\n ON cm.user_id = s.user_id AND cm.chat_id = ${requestedChat}::uuid\n LEFT JOIN chats AS c ON c.id = cm.chat_id\n `\n }\n WHERE s.token_hash = ${this.tokenHash(match[1])}\n AND s.revoked_at IS NULL AND s.expires_at > ${new Date()}\n LIMIT 1\n `);\n if (!session) throw new AuthException('Bearer');\n if (chatId !== undefined) {\n uuid(chatId, 'chat_id');\n if (session.chatId === null || session.messagesEpoch === null)\n throw new ApiException(404, 'not_found', 'Объект не найден');\n }\n return {\n user: this.users.serialize({ ...session, id: session.userId }),\n sessionId: session.id,\n chatsEpoch: session.chatsEpoch.toString(),\n chatAccess:\n session.chatId !== null && session.messagesEpoch !== null\n ? {\n chatId: session.chatId,\n userId: session.userId,\n messagesEpoch: session.messagesEpoch.toString(),\n }\n : undefined,\n };\n }\n\n async logout(sessionId: string): Promise {\n const now = new Date();\n const result = await this.prisma.session.updateMany({\n where: { id: sessionId, revokedAt: null, expiresAt: { gt: now } },\n data: { revokedAt: now },\n });\n if (result.count !== 1) throw new AuthException('Bearer');\n }\n\n private tokenHash(token: string): string {\n return createHash('sha256').update(token).digest('hex');\n }\n\n private basicCredentials(authorization: unknown): {\n username: string;\n password: string;\n } {\n const match =\n typeof authorization === 'string' &&\n /^Basic +([A-Za-z0-9+/]+={0,2})$/i.exec(authorization);\n if (!match) throw new AuthException('Basic');\n try {\n const bytes = Buffer.from(match[1], 'base64');\n if (\n bytes.toString('base64').replace(/=+$/, '') !==\n match[1].replace(/=+$/, '')\n )\n throw new AuthException('Basic');\n const value = new TextDecoder('utf-8', { fatal: true }).decode(bytes);\n const colon = value.indexOf(':');\n const username = value.slice(0, colon);\n const password = value.slice(colon + 1);\n if (\n colon < 0 ||\n !/^[a-z0-9_]{3,32}$/.test(username) ||\n !validPassword(password)\n )\n throw new AuthException('Basic');\n return { username, password };\n } catch {\n throw new AuthException('Basic');\n }\n }\n}\n", + "User/user.service.ts": "import { HttpStatus, Injectable } from '@nestjs/common';\nimport { Prisma, type User as StoredUser } from '../generated/prisma/client';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { ApiException } from '../common/exceptions/api.exception';\nimport { objectBody, requiredText } from '../common/validation';\nimport {\n PasswordService,\n registrationPassword,\n} from '../Auth/password.service';\nimport type { User } from './user.schema';\nimport { CacheService, CACHE_TTL } from '../cache/cache.service';\n\n@Injectable()\nexport class UserService {\n constructor(\n private readonly prisma: PrismaService,\n private readonly passwords: PasswordService,\n private readonly cache: CacheService,\n ) {}\n\n async create(value: unknown): Promise {\n const body = objectBody(value, ['username', 'display_name', 'password']);\n const username = body.username;\n if (typeof username !== 'string' || !/^[a-z0-9_]{3,32}$/.test(username)) {\n throw new ApiException(\n HttpStatus.BAD_REQUEST,\n 'invalid_request',\n 'Некорректный username',\n );\n }\n const displayName = requiredText(body.display_name, 'display_name', 100);\n const password = registrationPassword(body.password);\n const passwordHash = await this.passwords.hash(password);\n try {\n return this.serialize(\n await this.prisma.user.create({\n data: { username, displayName, passwordHash },\n }),\n );\n } catch (error) {\n if (\n error instanceof Prisma.PrismaClientKnownRequestError &&\n error.code === 'P2002'\n ) {\n throw new ApiException(\n HttpStatus.CONFLICT,\n 'conflict',\n 'Username уже занят',\n );\n }\n throw error;\n }\n }\n\n async get(id: string): Promise {\n return this.cache.remember(\n `user:${id}`,\n 'profile',\n CACHE_TTL.entity,\n async () => {\n const user = await this.prisma.user.findUnique({ where: { id } });\n return user ? this.serialize(user) : undefined;\n },\n );\n }\n\n serialize(\n user: Pick,\n ): User {\n return {\n id: user.id,\n username: user.username,\n display_name: user.displayName,\n created_at: user.createdAt.toISOString(),\n };\n }\n}\n", + "User/user.guard.ts": "import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';\nimport type { FastifyRequest } from 'fastify';\nimport { AuthService, type ChatAccess } from '../Auth/auth.service';\nimport type { User } from './user.schema';\n\nexport type AuthenticatedRequest = FastifyRequest & {\n currentUser: User;\n currentSessionId: string;\n currentChatsEpoch: string;\n currentChatAccess?: ChatAccess;\n};\n\n@Injectable()\nexport class UserGuard implements CanActivate {\n constructor(private readonly auth: AuthService) {}\n\n async canActivate(context: ExecutionContext): Promise {\n const request = context.switchToHttp().getRequest();\n const chatId =\n request.method === 'GET' &&\n request.routeOptions.url === '/api/v1/chats/:chat_id/messages'\n ? (request.params as { chat_id: string }).chat_id\n : undefined;\n const session = await this.auth.authenticate(\n request.headers.authorization,\n chatId,\n );\n request.currentUser = session.user;\n request.currentSessionId = session.sessionId;\n request.currentChatsEpoch = session.chatsEpoch;\n request.currentChatAccess = session.chatAccess;\n return true;\n }\n}\n", + "Chat/chat.service.ts": "import { HttpStatus, Injectable } from '@nestjs/common';\nimport { randomUUID } from 'node:crypto';\nimport type { ChatAccess } from '../Auth/auth.service';\nimport {\n Prisma,\n type Message as StoredMessage,\n} from '../generated/prisma/client';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { ApiException } from '../common/exceptions/api.exception';\nimport {\n invalidRequest,\n objectBody,\n pageLimit,\n requiredText,\n uuid,\n} from '../common/validation';\nimport type { Chat, Message, Page } from './chat.schema';\nimport { CacheService, CACHE_TTL } from '../cache/cache.service';\n\ninterface Cursor {\n scope: string;\n created_at: string;\n id: string;\n}\n\nconst chatInclude = {\n members: { orderBy: { position: 'asc' as const } },\n} satisfies Prisma.ChatInclude;\ntype StoredChat = Prisma.ChatGetPayload<{ include: typeof chatInclude }>;\n\n@Injectable()\nexport class ChatService {\n constructor(\n private readonly prisma: PrismaService,\n private readonly cache: CacheService,\n ) {}\n\n async create(value: unknown, userId: string): Promise {\n const body = objectBody(value, ['title', 'member_ids']);\n const title = requiredText(body.title, 'title', 100);\n if (\n !Array.isArray(body.member_ids) ||\n body.member_ids.length < 1 ||\n body.member_ids.length > 100\n ) {\n return invalidRequest('Некорректный member_ids');\n }\n const memberIds = body.member_ids.map((id: unknown) =>\n uuid(id, 'member_ids'),\n );\n if (\n new Set(memberIds).size !== memberIds.length ||\n !memberIds.includes(userId)\n ) {\n return invalidRequest(\n 'Список участников содержит дубликат или не содержит вызывающего',\n );\n }\n try {\n const chat = await this.prisma.$transaction(async (tx) => {\n const count = await tx.user.count({ where: { id: { in: memberIds } } });\n if (count !== memberIds.length)\n return invalidRequest('Неизвестный участник чата');\n const created = await tx.chat.create({\n data: {\n title,\n members: {\n create: memberIds.map((userId, position) => ({\n userId,\n position,\n })),\n },\n },\n include: chatInclude,\n });\n await tx.$executeRaw(Prisma.sql`\n WITH locked AS MATERIALIZED (\n SELECT id FROM users\n WHERE id IN (${Prisma.join(memberIds.map((id) => Prisma.sql`${id}::uuid`))})\n ORDER BY id FOR UPDATE\n )\n UPDATE users AS u SET chats_epoch = u.chats_epoch + 1\n FROM locked WHERE u.id = locked.id\n `);\n return created;\n });\n return this.serializeChat(chat);\n } catch (error) {\n if (\n error instanceof Prisma.PrismaClientKnownRequestError &&\n error.code === 'P2003'\n ) {\n return invalidRequest('Неизвестный участник чата');\n }\n throw error;\n }\n }\n\n async list(\n userId: string,\n limitValue: unknown,\n cursorValue: unknown,\n epoch: string,\n ): Promise> {\n const limit = pageLimit(limitValue);\n const scope = `chats:${userId}`;\n const cursor = this.decodeCursor(cursorValue, scope);\n return this.cache.remember(\n scope,\n { limit, cursor },\n CACHE_TTL.page,\n async () => {\n const chats = await this.prisma.chat.findMany({\n where: { members: { some: { userId } }, ...this.after(cursor) },\n include: chatInclude,\n orderBy: [{ createdAt: 'asc' }, { id: 'asc' }],\n take: limit + 1,\n });\n return this.page(\n chats.map((chat) => this.serializeChat(chat)),\n limit,\n scope,\n );\n },\n epoch,\n );\n }\n\n async get(value: unknown, userId: string): Promise {\n const { id } = await this.authorizeChat(value, userId);\n return this.getMetadata(id);\n }\n\n private async authorizeChat(value: unknown, userId: string) {\n const id = uuid(value, 'chat_id');\n const [membership] = await this.prisma.$queryRaw<\n { id: string; messagesEpoch: bigint }[]\n >(Prisma.sql`\n SELECT c.id, c.messages_epoch AS \"messagesEpoch\"\n FROM chat_members AS cm JOIN chats AS c ON c.id = cm.chat_id\n WHERE cm.chat_id = ${id}::uuid AND cm.user_id = ${userId}::uuid\n `);\n if (!membership) {\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n }\n return membership;\n }\n\n private getMetadata(id: string): Promise {\n return this.cache.remember(\n `chat:${id}`,\n 'metadata',\n CACHE_TTL.entity,\n async () => {\n const chat = await this.prisma.chat.findUnique({\n where: { id },\n include: chatInclude,\n });\n if (!chat)\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n return this.serializeChat(chat);\n },\n );\n }\n\n async createMessage(\n chatId: unknown,\n value: unknown,\n userId: string,\n ): Promise {\n const id = uuid(chatId, 'chat_id');\n const body = objectBody(value, ['text']);\n const text = requiredText(body.text, 'text', 4000);\n const [message] = await this.prisma.$queryRaw(Prisma.sql`\n WITH updated AS (\n UPDATE chats AS c\n SET messages_epoch = c.messages_epoch + 1\n WHERE c.id = ${id}::uuid\n AND EXISTS (\n SELECT 1 FROM chat_members AS cm\n WHERE cm.chat_id = c.id AND cm.user_id = ${userId}::uuid\n )\n RETURNING c.id\n )\n INSERT INTO messages (id, chat_id, sender_id, text)\n SELECT ${randomUUID()}::uuid, updated.id, ${userId}::uuid, ${text}\n FROM updated\n RETURNING id, chat_id AS \"chatId\", sender_id AS \"senderId\",\n text, created_at AS \"createdAt\"\n `);\n if (!message)\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n return this.serializeMessage(message);\n }\n\n async listMessages(\n chatId: unknown,\n userId: string,\n limitValue: unknown,\n cursorValue: unknown,\n access?: ChatAccess,\n ): Promise> {\n const id = uuid(chatId, 'chat_id');\n const chat =\n access?.chatId === id && access.userId === userId\n ? { id, messagesEpoch: access.messagesEpoch }\n : await this.authorizeChat(id, userId);\n const limit = pageLimit(limitValue);\n const scope = `messages:${chat.id}`;\n const cursor = this.decodeCursor(cursorValue, scope);\n return this.cache.remember(\n scope,\n { limit, cursor },\n CACHE_TTL.page,\n async () => {\n const messages = cursor\n ? await this.prisma.$queryRaw(Prisma.sql`\n SELECT id, chat_id AS \"chatId\", sender_id AS \"senderId\",\n text, created_at AS \"createdAt\"\n FROM \"public\".\"messages\"\n WHERE chat_id = ${chat.id}::uuid\n AND (created_at, id) >\n (${new Date(cursor.created_at)}::timestamptz, ${cursor.id}::uuid)\n ORDER BY created_at ASC, id ASC\n LIMIT ${limit + 1}\n `)\n : await this.prisma.message.findMany({\n where: { chatId: chat.id },\n orderBy: [{ createdAt: 'asc' }, { id: 'asc' }],\n take: limit + 1,\n });\n return this.page(\n messages.map((message) => this.serializeMessage(message)),\n limit,\n scope,\n );\n },\n chat.messagesEpoch.toString(),\n );\n }\n\n private after(cursor: Cursor | null) {\n if (!cursor) return {};\n const createdAt = new Date(cursor.created_at);\n return {\n OR: [\n { createdAt: { gt: createdAt } },\n { createdAt, id: { gt: cursor.id } },\n ],\n };\n }\n\n private serializeChat(chat: StoredChat): Chat {\n return {\n id: chat.id,\n title: chat.title,\n member_ids: chat.members.map((member) => member.userId),\n created_at: chat.createdAt.toISOString(),\n };\n }\n\n private serializeMessage(message: StoredMessage): Message {\n return {\n id: message.id,\n chat_id: message.chatId,\n sender_id: message.senderId,\n text: message.text,\n created_at: message.createdAt.toISOString(),\n };\n }\n\n private page(\n items: T[],\n limit: number,\n scope: string,\n ): Page {\n const result = items.slice(0, limit);\n const last = result.at(-1);\n return {\n items: result,\n next_cursor:\n items.length > limit && last\n ? Buffer.from(\n JSON.stringify({\n scope,\n created_at: last.created_at,\n id: last.id,\n }),\n ).toString('base64url')\n : null,\n };\n }\n\n private decodeCursor(value: unknown, scope: string): Cursor | null {\n if (value === undefined) return null;\n if (typeof value !== 'string' || !/^[A-Za-z0-9_-]+$/.test(value))\n return invalidRequest('Некорректный cursor');\n try {\n const cursor: unknown = JSON.parse(\n Buffer.from(value, 'base64url').toString('utf8'),\n );\n if (\n typeof cursor !== 'object' ||\n cursor === null ||\n Array.isArray(cursor)\n )\n return invalidRequest('Некорректный cursor');\n const data = cursor as Record;\n if (\n data.scope !== scope ||\n typeof data.created_at !== 'string' ||\n Number.isNaN(Date.parse(data.created_at)) ||\n typeof data.id !== 'string'\n ) {\n return invalidRequest('Некорректный cursor');\n }\n return {\n scope,\n created_at: data.created_at,\n id: uuid(data.id, 'cursor'),\n };\n } catch {\n return invalidRequest('Некорректный cursor');\n }\n }\n}\n", + "Chat/chat.controller.ts": "import {\n Body,\n Controller,\n Get,\n HttpCode,\n HttpStatus,\n Param,\n Post,\n Query,\n Req,\n UseGuards,\n} from '@nestjs/common';\nimport {\n ApiBody,\n ApiBearerAuth,\n ApiCreatedResponse,\n ApiOkResponse,\n ApiOperation,\n ApiQuery,\n ApiTags,\n} from '@nestjs/swagger';\nimport { UserGuard, type AuthenticatedRequest } from '../User/user.guard';\nimport {\n CreateChatDto,\n CreateMessageDto,\n Chat,\n Message,\n ChatPage,\n MessagePage,\n} from './chat.schema';\nimport { ChatService } from './chat.service';\n\n@ApiTags('chats')\n@ApiBearerAuth('bearerAuth')\n@UseGuards(UserGuard)\n@Controller('api/v1/chats')\nexport class ChatController {\n constructor(private readonly chats: ChatService) {}\n\n @Post()\n @HttpCode(HttpStatus.CREATED)\n @ApiBody({ type: CreateChatDto })\n @ApiOperation({ operationId: 'createChat' })\n @ApiCreatedResponse({ type: Chat })\n create(@Req() request: AuthenticatedRequest, @Body() body: unknown) {\n return this.chats.create(body, request.currentUser.id);\n }\n\n @Get()\n @ApiOperation({ operationId: 'listChats' })\n @ApiOkResponse({ type: ChatPage })\n @ApiQuery({\n name: 'limit',\n required: false,\n schema: { type: 'integer', minimum: 1, maximum: 100, default: 50 },\n })\n @ApiQuery({ name: 'cursor', required: false, type: String })\n list(\n @Req() request: AuthenticatedRequest,\n @Query('limit') limit: unknown,\n @Query('cursor') cursor: unknown,\n ) {\n return this.chats.list(\n request.currentUser.id,\n limit,\n cursor,\n request.currentChatsEpoch,\n );\n }\n\n @Get(':chat_id')\n @ApiOperation({ operationId: 'getChat' })\n @ApiOkResponse({ type: Chat })\n get(@Req() request: AuthenticatedRequest, @Param('chat_id') chatId: string) {\n return this.chats.get(chatId, request.currentUser.id);\n }\n\n @Post(':chat_id/messages')\n @HttpCode(HttpStatus.CREATED)\n @ApiBody({ type: CreateMessageDto })\n @ApiOperation({ operationId: 'createMessage' })\n @ApiCreatedResponse({ type: Message })\n createMessage(\n @Req() request: AuthenticatedRequest,\n @Param('chat_id') chatId: string,\n @Body() body: unknown,\n ) {\n return this.chats.createMessage(chatId, body, request.currentUser.id);\n }\n\n @Get(':chat_id/messages')\n @ApiOperation({ operationId: 'listMessages' })\n @ApiOkResponse({ type: MessagePage })\n @ApiQuery({\n name: 'limit',\n required: false,\n schema: { type: 'integer', minimum: 1, maximum: 100, default: 50 },\n })\n @ApiQuery({ name: 'cursor', required: false, type: String })\n listMessages(\n @Req() request: AuthenticatedRequest,\n @Param('chat_id') chatId: string,\n @Query('limit') limit: unknown,\n @Query('cursor') cursor: unknown,\n ) {\n return this.chats.listMessages(\n chatId,\n request.currentUser.id,\n limit,\n cursor,\n request.currentChatAccess,\n );\n }\n}\n" + }, + "striped": { + "Auth/auth.service.ts": "import { Injectable } from '@nestjs/common';\nimport { createHash, randomBytes } from 'node:crypto';\nimport { TextDecoder } from 'node:util';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { Prisma } from '../generated/prisma/client';\nimport { UserService } from '../User/user.service';\nimport type { User } from '../User/user.schema';\nimport { invalidRequest, uuid, uuidPattern } from '../common/validation';\nimport { ApiException } from '../common/exceptions/api.exception';\nimport { AuthException } from './auth.exception';\nimport { PasswordService, validPassword } from './password.service';\nimport type { Session } from './auth.schema';\n\nexport interface ChatAccess {\n chatId: string;\n userId: string;\n messagesEpoch: string;\n}\n\n@Injectable()\nexport class AuthService {\n private readonly ttlSeconds: number;\n\n constructor(\n private readonly prisma: PrismaService,\n private readonly users: UserService,\n private readonly passwords: PasswordService,\n ) {\n this.ttlSeconds = Number(process.env.SESSION_TTL_SECONDS ?? 3600);\n if (\n !Number.isSafeInteger(this.ttlSeconds) ||\n this.ttlSeconds <= 0 ||\n Number.isNaN(new Date(Date.now() + this.ttlSeconds * 1000).getTime())\n ) {\n throw new Error(\n 'SESSION_TTL_SECONDS must be a positive integer representing a valid expiry',\n );\n }\n }\n\n async login(authorization: unknown, body: unknown): Promise {\n const { username, password } = this.basicCredentials(authorization);\n const user = await this.prisma.user.findUnique({ where: { username } });\n const verified = await this.passwords.verify(\n password,\n user?.passwordHash ?? null,\n );\n if (!user || !verified) throw new AuthException('Basic');\n if (body !== undefined)\n return invalidRequest('Вход через Basic не принимает тело запроса');\n const token = randomBytes(32).toString('base64url');\n const session = await this.prisma.session.create({\n data: {\n userId: user.id,\n tokenHash: this.tokenHash(token),\n expiresAt: new Date(Date.now() + this.ttlSeconds * 1000),\n },\n });\n return {\n token,\n token_type: 'Bearer',\n expires_at: session.expiresAt.toISOString(),\n user: this.users.serialize(user),\n };\n }\n\n async authenticate(\n authorization: unknown,\n chatId?: unknown,\n ): Promise<{\n user: User;\n sessionId: string;\n chatsEpoch: string;\n chatAccess?: ChatAccess;\n }> {\n const match =\n typeof authorization === 'string' &&\n /^Bearer +([A-Za-z0-9_-]{43})$/i.exec(authorization);\n if (!match) throw new AuthException('Bearer');\n const requestedChat =\n typeof chatId === 'string' && uuidPattern.test(chatId)\n ? chatId.toLowerCase()\n : null;\n const [session] = await this.prisma.$queryRaw<\n {\n id: string;\n userId: string;\n username: string;\n displayName: string;\n createdAt: Date;\n chatsEpoch: bigint;\n chatId: string | null;\n messagesEpoch: bigint | null;\n }[]\n >(Prisma.sql`\n SELECT s.id, s.user_id AS \"userId\", u.chats_epoch AS \"chatsEpoch\",\n u.username, u.display_name AS \"displayName\", u.created_at AS \"createdAt\",\n ${\n chatId === undefined\n ? Prisma.sql`NULL::uuid AS \"chatId\", NULL::bigint AS \"messagesEpoch\"`\n : Prisma.sql`c.id AS \"chatId\", COALESCE((SELECT SUM(e.epoch) FROM \"epoch_variants_0302fea1e5264f72a02693f65cb217b7\".chat_message_epochs AS e WHERE e.chat_id = c.id), 0)::bigint AS \"messagesEpoch\"`\n }\n FROM sessions AS s\n JOIN users AS u ON u.id = s.user_id\n ${\n chatId === undefined\n ? Prisma.empty\n : Prisma.sql`\n LEFT JOIN chat_members AS cm\n ON cm.user_id = s.user_id AND cm.chat_id = ${requestedChat}::uuid\n LEFT JOIN chats AS c ON c.id = cm.chat_id\n `\n }\n WHERE s.token_hash = ${this.tokenHash(match[1])}\n AND s.revoked_at IS NULL AND s.expires_at > ${new Date()}\n LIMIT 1\n `);\n if (!session) throw new AuthException('Bearer');\n if (chatId !== undefined) {\n uuid(chatId, 'chat_id');\n if (session.chatId === null || session.messagesEpoch === null)\n throw new ApiException(404, 'not_found', 'Объект не найден');\n }\n return {\n user: this.users.serialize({ ...session, id: session.userId }),\n sessionId: session.id,\n chatsEpoch: session.chatsEpoch.toString(),\n chatAccess:\n session.chatId !== null && session.messagesEpoch !== null\n ? {\n chatId: session.chatId,\n userId: session.userId,\n messagesEpoch: session.messagesEpoch.toString(),\n }\n : undefined,\n };\n }\n\n async logout(sessionId: string): Promise {\n const now = new Date();\n const result = await this.prisma.session.updateMany({\n where: { id: sessionId, revokedAt: null, expiresAt: { gt: now } },\n data: { revokedAt: now },\n });\n if (result.count !== 1) throw new AuthException('Bearer');\n }\n\n private tokenHash(token: string): string {\n return createHash('sha256').update(token).digest('hex');\n }\n\n private basicCredentials(authorization: unknown): {\n username: string;\n password: string;\n } {\n const match =\n typeof authorization === 'string' &&\n /^Basic +([A-Za-z0-9+/]+={0,2})$/i.exec(authorization);\n if (!match) throw new AuthException('Basic');\n try {\n const bytes = Buffer.from(match[1], 'base64');\n if (\n bytes.toString('base64').replace(/=+$/, '') !==\n match[1].replace(/=+$/, '')\n )\n throw new AuthException('Basic');\n const value = new TextDecoder('utf-8', { fatal: true }).decode(bytes);\n const colon = value.indexOf(':');\n const username = value.slice(0, colon);\n const password = value.slice(colon + 1);\n if (\n colon < 0 ||\n !/^[a-z0-9_]{3,32}$/.test(username) ||\n !validPassword(password)\n )\n throw new AuthException('Basic');\n return { username, password };\n } catch {\n throw new AuthException('Basic');\n }\n }\n}\n", + "User/user.service.ts": "import { HttpStatus, Injectable } from '@nestjs/common';\nimport { Prisma, type User as StoredUser } from '../generated/prisma/client';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { ApiException } from '../common/exceptions/api.exception';\nimport { objectBody, requiredText } from '../common/validation';\nimport {\n PasswordService,\n registrationPassword,\n} from '../Auth/password.service';\nimport type { User } from './user.schema';\nimport { CacheService, CACHE_TTL } from '../cache/cache.service';\n\n@Injectable()\nexport class UserService {\n constructor(\n private readonly prisma: PrismaService,\n private readonly passwords: PasswordService,\n private readonly cache: CacheService,\n ) {}\n\n async create(value: unknown): Promise {\n const body = objectBody(value, ['username', 'display_name', 'password']);\n const username = body.username;\n if (typeof username !== 'string' || !/^[a-z0-9_]{3,32}$/.test(username)) {\n throw new ApiException(\n HttpStatus.BAD_REQUEST,\n 'invalid_request',\n 'Некорректный username',\n );\n }\n const displayName = requiredText(body.display_name, 'display_name', 100);\n const password = registrationPassword(body.password);\n const passwordHash = await this.passwords.hash(password);\n try {\n return this.serialize(\n await this.prisma.user.create({\n data: { username, displayName, passwordHash },\n }),\n );\n } catch (error) {\n if (\n error instanceof Prisma.PrismaClientKnownRequestError &&\n error.code === 'P2002'\n ) {\n throw new ApiException(\n HttpStatus.CONFLICT,\n 'conflict',\n 'Username уже занят',\n );\n }\n throw error;\n }\n }\n\n async get(id: string): Promise {\n return this.cache.remember(\n `user:${id}`,\n 'profile',\n CACHE_TTL.entity,\n async () => {\n const user = await this.prisma.user.findUnique({ where: { id } });\n return user ? this.serialize(user) : undefined;\n },\n );\n }\n\n serialize(\n user: Pick,\n ): User {\n return {\n id: user.id,\n username: user.username,\n display_name: user.displayName,\n created_at: user.createdAt.toISOString(),\n };\n }\n}\n", + "User/user.guard.ts": "import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';\nimport type { FastifyRequest } from 'fastify';\nimport { AuthService, type ChatAccess } from '../Auth/auth.service';\nimport type { User } from './user.schema';\n\nexport type AuthenticatedRequest = FastifyRequest & {\n currentUser: User;\n currentSessionId: string;\n currentChatsEpoch: string;\n currentChatAccess?: ChatAccess;\n};\n\n@Injectable()\nexport class UserGuard implements CanActivate {\n constructor(private readonly auth: AuthService) {}\n\n async canActivate(context: ExecutionContext): Promise {\n const request = context.switchToHttp().getRequest();\n const chatId =\n request.method === 'GET' &&\n request.routeOptions.url === '/api/v1/chats/:chat_id/messages'\n ? (request.params as { chat_id: string }).chat_id\n : undefined;\n const session = await this.auth.authenticate(\n request.headers.authorization,\n chatId,\n );\n request.currentUser = session.user;\n request.currentSessionId = session.sessionId;\n request.currentChatsEpoch = session.chatsEpoch;\n request.currentChatAccess = session.chatAccess;\n return true;\n }\n}\n", + "Chat/chat.service.ts": "import { HttpStatus, Injectable } from '@nestjs/common';\nimport { randomUUID } from 'node:crypto';\nimport type { ChatAccess } from '../Auth/auth.service';\nimport {\n Prisma,\n type Message as StoredMessage,\n} from '../generated/prisma/client';\nimport { PrismaService } from '../prisma/prisma.service';\nimport { ApiException } from '../common/exceptions/api.exception';\nimport {\n invalidRequest,\n objectBody,\n pageLimit,\n requiredText,\n uuid,\n} from '../common/validation';\nimport type { Chat, Message, Page } from './chat.schema';\nimport { CacheService, CACHE_TTL } from '../cache/cache.service';\n\ninterface Cursor {\n scope: string;\n created_at: string;\n id: string;\n}\n\nconst chatInclude = {\n members: { orderBy: { position: 'asc' as const } },\n} satisfies Prisma.ChatInclude;\ntype StoredChat = Prisma.ChatGetPayload<{ include: typeof chatInclude }>;\n\n@Injectable()\nexport class ChatService {\n constructor(\n private readonly prisma: PrismaService,\n private readonly cache: CacheService,\n ) {}\n\n async create(value: unknown, userId: string): Promise {\n const body = objectBody(value, ['title', 'member_ids']);\n const title = requiredText(body.title, 'title', 100);\n if (\n !Array.isArray(body.member_ids) ||\n body.member_ids.length < 1 ||\n body.member_ids.length > 100\n ) {\n return invalidRequest('Некорректный member_ids');\n }\n const memberIds = body.member_ids.map((id: unknown) =>\n uuid(id, 'member_ids'),\n );\n if (\n new Set(memberIds).size !== memberIds.length ||\n !memberIds.includes(userId)\n ) {\n return invalidRequest(\n 'Список участников содержит дубликат или не содержит вызывающего',\n );\n }\n try {\n const chat = await this.prisma.$transaction(async (tx) => {\n const count = await tx.user.count({ where: { id: { in: memberIds } } });\n if (count !== memberIds.length)\n return invalidRequest('Неизвестный участник чата');\n const created = await tx.chat.create({\n data: {\n title,\n members: {\n create: memberIds.map((userId, position) => ({\n userId,\n position,\n })),\n },\n },\n include: chatInclude,\n });\n await tx.$executeRaw(Prisma.sql`\n WITH locked AS MATERIALIZED (\n SELECT id FROM users\n WHERE id IN (${Prisma.join(memberIds.map((id) => Prisma.sql`${id}::uuid`))})\n ORDER BY id FOR UPDATE\n )\n UPDATE users AS u SET chats_epoch = u.chats_epoch + 1\n FROM locked WHERE u.id = locked.id\n `);\n return created;\n });\n return this.serializeChat(chat);\n } catch (error) {\n if (\n error instanceof Prisma.PrismaClientKnownRequestError &&\n error.code === 'P2003'\n ) {\n return invalidRequest('Неизвестный участник чата');\n }\n throw error;\n }\n }\n\n async list(\n userId: string,\n limitValue: unknown,\n cursorValue: unknown,\n epoch: string,\n ): Promise> {\n const limit = pageLimit(limitValue);\n const scope = `chats:${userId}`;\n const cursor = this.decodeCursor(cursorValue, scope);\n return this.cache.remember(\n scope,\n { limit, cursor },\n CACHE_TTL.page,\n async () => {\n const chats = await this.prisma.chat.findMany({\n where: { members: { some: { userId } }, ...this.after(cursor) },\n include: chatInclude,\n orderBy: [{ createdAt: 'asc' }, { id: 'asc' }],\n take: limit + 1,\n });\n return this.page(\n chats.map((chat) => this.serializeChat(chat)),\n limit,\n scope,\n );\n },\n epoch,\n );\n }\n\n async get(value: unknown, userId: string): Promise {\n const { id } = await this.authorizeChat(value, userId);\n return this.getMetadata(id);\n }\n\n private async authorizeChat(value: unknown, userId: string) {\n const id = uuid(value, 'chat_id');\n const [membership] = await this.prisma.$queryRaw<\n { id: string; messagesEpoch: bigint }[]\n >(Prisma.sql`\n SELECT c.id, COALESCE((SELECT SUM(e.epoch) FROM \"epoch_variants_0302fea1e5264f72a02693f65cb217b7\".chat_message_epochs AS e WHERE e.chat_id = c.id), 0)::bigint AS \"messagesEpoch\"\n FROM chat_members AS cm JOIN chats AS c ON c.id = cm.chat_id\n WHERE cm.chat_id = ${id}::uuid AND cm.user_id = ${userId}::uuid\n `);\n if (!membership) {\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n }\n return membership;\n }\n\n private getMetadata(id: string): Promise {\n return this.cache.remember(\n `chat:${id}`,\n 'metadata',\n CACHE_TTL.entity,\n async () => {\n const chat = await this.prisma.chat.findUnique({\n where: { id },\n include: chatInclude,\n });\n if (!chat)\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n return this.serializeChat(chat);\n },\n );\n }\n\n async createMessage(\n chatId: unknown,\n value: unknown,\n userId: string,\n ): Promise {\n const id = uuid(chatId, 'chat_id');\n const body = objectBody(value, ['text']);\n const text = requiredText(body.text, 'text', 4000);\n const messageId = randomUUID();\n const bucket = parseInt(messageId.slice(0, 2), 16) % 16;\n const [message] = await this.prisma.$queryRaw(Prisma.sql`\n WITH updated AS (\n INSERT INTO \"epoch_variants_0302fea1e5264f72a02693f65cb217b7\".chat_message_epochs AS e (chat_id, bucket, epoch)\n SELECT cm.chat_id, ${bucket}::smallint, 1 FROM chat_members AS cm\n WHERE cm.chat_id = ${id}::uuid AND cm.user_id = ${userId}::uuid\n ON CONFLICT (chat_id, bucket) DO UPDATE SET epoch = e.epoch + 1\n RETURNING chat_id\n )\n INSERT INTO messages (id, chat_id, sender_id, text)\n SELECT ${messageId}::uuid, updated.chat_id, ${userId}::uuid, ${text} FROM updated\n RETURNING id, chat_id AS \"chatId\", sender_id AS \"senderId\", text, created_at AS \"createdAt\"\n `);\n if (!message)\n throw new ApiException(\n HttpStatus.NOT_FOUND,\n 'not_found',\n 'Объект не найден',\n );\n return this.serializeMessage(message);\n }\n\n async listMessages(\n chatId: unknown,\n userId: string,\n limitValue: unknown,\n cursorValue: unknown,\n access?: ChatAccess,\n ): Promise> {\n const id = uuid(chatId, 'chat_id');\n const chat =\n access?.chatId === id && access.userId === userId\n ? { id, messagesEpoch: access.messagesEpoch }\n : await this.authorizeChat(id, userId);\n const limit = pageLimit(limitValue);\n const scope = `messages:${chat.id}`;\n const cursor = this.decodeCursor(cursorValue, scope);\n return this.cache.remember(\n scope,\n { limit, cursor },\n CACHE_TTL.page,\n async () => {\n const messages = cursor\n ? await this.prisma.$queryRaw(Prisma.sql`\n SELECT id, chat_id AS \"chatId\", sender_id AS \"senderId\",\n text, created_at AS \"createdAt\"\n FROM \"public\".\"messages\"\n WHERE chat_id = ${chat.id}::uuid\n AND (created_at, id) >\n (${new Date(cursor.created_at)}::timestamptz, ${cursor.id}::uuid)\n ORDER BY created_at ASC, id ASC\n LIMIT ${limit + 1}\n `)\n : await this.prisma.message.findMany({\n where: { chatId: chat.id },\n orderBy: [{ createdAt: 'asc' }, { id: 'asc' }],\n take: limit + 1,\n });\n return this.page(\n messages.map((message) => this.serializeMessage(message)),\n limit,\n scope,\n );\n },\n chat.messagesEpoch.toString(),\n );\n }\n\n private after(cursor: Cursor | null) {\n if (!cursor) return {};\n const createdAt = new Date(cursor.created_at);\n return {\n OR: [\n { createdAt: { gt: createdAt } },\n { createdAt, id: { gt: cursor.id } },\n ],\n };\n }\n\n private serializeChat(chat: StoredChat): Chat {\n return {\n id: chat.id,\n title: chat.title,\n member_ids: chat.members.map((member) => member.userId),\n created_at: chat.createdAt.toISOString(),\n };\n }\n\n private serializeMessage(message: StoredMessage): Message {\n return {\n id: message.id,\n chat_id: message.chatId,\n sender_id: message.senderId,\n text: message.text,\n created_at: message.createdAt.toISOString(),\n };\n }\n\n private page(\n items: T[],\n limit: number,\n scope: string,\n ): Page {\n const result = items.slice(0, limit);\n const last = result.at(-1);\n return {\n items: result,\n next_cursor:\n items.length > limit && last\n ? Buffer.from(\n JSON.stringify({\n scope,\n created_at: last.created_at,\n id: last.id,\n }),\n ).toString('base64url')\n : null,\n };\n }\n\n private decodeCursor(value: unknown, scope: string): Cursor | null {\n if (value === undefined) return null;\n if (typeof value !== 'string' || !/^[A-Za-z0-9_-]+$/.test(value))\n return invalidRequest('Некорректный cursor');\n try {\n const cursor: unknown = JSON.parse(\n Buffer.from(value, 'base64url').toString('utf8'),\n );\n if (\n typeof cursor !== 'object' ||\n cursor === null ||\n Array.isArray(cursor)\n )\n return invalidRequest('Некорректный cursor');\n const data = cursor as Record;\n if (\n data.scope !== scope ||\n typeof data.created_at !== 'string' ||\n Number.isNaN(Date.parse(data.created_at)) ||\n typeof data.id !== 'string'\n ) {\n return invalidRequest('Некорректный cursor');\n }\n return {\n scope,\n created_at: data.created_at,\n id: uuid(data.id, 'cursor'),\n };\n } catch {\n return invalidRequest('Некорректный cursor');\n }\n }\n}\n", + "Chat/chat.controller.ts": "import {\n Body,\n Controller,\n Get,\n HttpCode,\n HttpStatus,\n Param,\n Post,\n Query,\n Req,\n UseGuards,\n} from '@nestjs/common';\nimport {\n ApiBody,\n ApiBearerAuth,\n ApiCreatedResponse,\n ApiOkResponse,\n ApiOperation,\n ApiQuery,\n ApiTags,\n} from '@nestjs/swagger';\nimport { UserGuard, type AuthenticatedRequest } from '../User/user.guard';\nimport {\n CreateChatDto,\n CreateMessageDto,\n Chat,\n Message,\n ChatPage,\n MessagePage,\n} from './chat.schema';\nimport { ChatService } from './chat.service';\n\n@ApiTags('chats')\n@ApiBearerAuth('bearerAuth')\n@UseGuards(UserGuard)\n@Controller('api/v1/chats')\nexport class ChatController {\n constructor(private readonly chats: ChatService) {}\n\n @Post()\n @HttpCode(HttpStatus.CREATED)\n @ApiBody({ type: CreateChatDto })\n @ApiOperation({ operationId: 'createChat' })\n @ApiCreatedResponse({ type: Chat })\n create(@Req() request: AuthenticatedRequest, @Body() body: unknown) {\n return this.chats.create(body, request.currentUser.id);\n }\n\n @Get()\n @ApiOperation({ operationId: 'listChats' })\n @ApiOkResponse({ type: ChatPage })\n @ApiQuery({\n name: 'limit',\n required: false,\n schema: { type: 'integer', minimum: 1, maximum: 100, default: 50 },\n })\n @ApiQuery({ name: 'cursor', required: false, type: String })\n list(\n @Req() request: AuthenticatedRequest,\n @Query('limit') limit: unknown,\n @Query('cursor') cursor: unknown,\n ) {\n return this.chats.list(\n request.currentUser.id,\n limit,\n cursor,\n request.currentChatsEpoch,\n );\n }\n\n @Get(':chat_id')\n @ApiOperation({ operationId: 'getChat' })\n @ApiOkResponse({ type: Chat })\n get(@Req() request: AuthenticatedRequest, @Param('chat_id') chatId: string) {\n return this.chats.get(chatId, request.currentUser.id);\n }\n\n @Post(':chat_id/messages')\n @HttpCode(HttpStatus.CREATED)\n @ApiBody({ type: CreateMessageDto })\n @ApiOperation({ operationId: 'createMessage' })\n @ApiCreatedResponse({ type: Message })\n createMessage(\n @Req() request: AuthenticatedRequest,\n @Param('chat_id') chatId: string,\n @Body() body: unknown,\n ) {\n return this.chats.createMessage(chatId, body, request.currentUser.id);\n }\n\n @Get(':chat_id/messages')\n @ApiOperation({ operationId: 'listMessages' })\n @ApiOkResponse({ type: MessagePage })\n @ApiQuery({\n name: 'limit',\n required: false,\n schema: { type: 'integer', minimum: 1, maximum: 100, default: 50 },\n })\n @ApiQuery({ name: 'cursor', required: false, type: String })\n listMessages(\n @Req() request: AuthenticatedRequest,\n @Param('chat_id') chatId: string,\n @Query('limit') limit: unknown,\n @Query('cursor') cursor: unknown,\n ) {\n return this.chats.listMessages(\n chatId,\n request.currentUser.id,\n limit,\n cursor,\n request.currentChatAccess,\n );\n }\n}\n" + } +} diff --git a/evidence/epoch-variants-validation.json b/evidence/epoch-variants-validation.json new file mode 100644 index 00000000..9116c125 --- /dev/null +++ b/evidence/epoch-variants-validation.json @@ -0,0 +1,15 @@ +{ + "recorded_on": "2026-10-13", + "selected_variant": "profile join + combined session/membership/epoch check + 16 message epoch buckets", + "backend_image": "sha256:02a5d9ca3816781e5931a82926b6a62858b1abf1eb9a0244da79d45e5787b020", + "migration": "20261013150000_message_epoch_buckets", + "checks": [ + { "command": "docker compose build backend migrate", "result": "PASS" }, + { "command": "docker compose up -d backend", "result": "PASS", "migration_applied": true }, + { "command": "docker compose -f compose.yaml -f test/compose.benchmark.yaml run --rm --no-deps --pull never benchmark node --test test/cache-epochs.mjs test/cache.mjs", "result": "PASS", "tests": 3, "failed": 0 }, + { "command": "pnpm.cmd lint", "result": "PASS" } + ], + "backend_status": "running healthy", + "experiment_schema_removed": true, + "previous_epoch_values_preserved_by_migration": true +} diff --git a/evidence/epoch-variants.json b/evidence/epoch-variants.json new file mode 100644 index 00000000..7f5dad8b --- /dev/null +++ b/evidence/epoch-variants.json @@ -0,0 +1,617 @@ +{ + "recorded_at": "2026-10-13T14:18:08.573Z", + "methodology": { + "concurrency": 32, + "duration_seconds": 60, + "warmup_seconds": 10, + "repetitions": 3, + "seed_messages": 100000, + "writes_per_repeat": 4096, + "order": [ + [ + "baseline", + "profile-join", + "access-join", + "striped" + ], + [ + "striped", + "access-join", + "profile-join", + "baseline" + ], + [ + "profile-join", + "striped", + "baseline", + "access-join" + ] + ], + "requests": "Real loopback HTTP; shared read fixtures, separate write chats and cache prefixes", + "resources": "Four idle/active API instances and HTTP generator share one Node process; only one workload active at a time", + "sql": "pg.Client.query; transaction-control commands excluded; no changes to database pool size" + }, + "variants": [ + { + "name": "baseline", + "modules": { + "Auth/auth.service.ts": { + "source_sha256": "86599b6e89cd66483cb10aff0d85cc29fe092ab24bbb849960079dcae347b8bf", + "js_sha256": "70e4c149faff62a38f3009816994c349096a8300495ecd57128a07af2acfb78f" + }, + "User/user.service.ts": { + "source_sha256": "de158e39c114c610cc7ea6c850108c8dd69c9bc3d643bac94557d272621f3cfb", + "js_sha256": "e71c703979ae29963546f88602d4c98735562163749af06c966474e1670e4b7c" + }, + "User/user.guard.ts": { + "source_sha256": "b84d95633fbd89b4fdbc505c51dd64e657611651b757bed1aea8eee3f0eac3d9", + "js_sha256": "16bc70f6d4df0809637b16f569dda973085128775f29c29d6154aecf9a45be52" + }, + "Chat/chat.service.ts": { + "source_sha256": "11b6b6d361d5599667318540b2c83a1b8e397db6d4d3665bbfa526e0b349d430", + "js_sha256": "42cc729f6f8f6da1a4b6b66746d7ea8299c4a26cfc29f6cfcb436d865107dfad" + }, + "Chat/chat.controller.ts": { + "source_sha256": "700becb64112538a6551c5775ccc09ff9d750755dcffe6ec916782afed1dae11", + "js_sha256": "32ebfcf009fce603c8637da701e33756868a3a4b1dda3e93cf7007b3a8b14ec7" + } + }, + "striped": false + }, + { + "name": "profile-join", + "modules": { + "Auth/auth.service.ts": { + "source_sha256": "63e6ad3117bf8adda51bab735ee7b975179e68a6af060aafe63416a8c9b90107", + "js_sha256": "5da0f49def86501c34c2f8d02dbd86dde37b9b7d1d98b57df3e334fc557dcffd" + }, + "User/user.service.ts": { + "source_sha256": "0737e88c408510bc17ec0597c3812be855c03499dfc2ad5ba6a4b1e85bb1c5e7", + "js_sha256": "e71c703979ae29963546f88602d4c98735562163749af06c966474e1670e4b7c" + }, + "User/user.guard.ts": { + "source_sha256": "b84d95633fbd89b4fdbc505c51dd64e657611651b757bed1aea8eee3f0eac3d9", + "js_sha256": "16bc70f6d4df0809637b16f569dda973085128775f29c29d6154aecf9a45be52" + }, + "Chat/chat.service.ts": { + "source_sha256": "11b6b6d361d5599667318540b2c83a1b8e397db6d4d3665bbfa526e0b349d430", + "js_sha256": "42cc729f6f8f6da1a4b6b66746d7ea8299c4a26cfc29f6cfcb436d865107dfad" + }, + "Chat/chat.controller.ts": { + "source_sha256": "700becb64112538a6551c5775ccc09ff9d750755dcffe6ec916782afed1dae11", + "js_sha256": "32ebfcf009fce603c8637da701e33756868a3a4b1dda3e93cf7007b3a8b14ec7" + } + }, + "striped": false + }, + { + "name": "access-join", + "modules": { + "Auth/auth.service.ts": { + "source_sha256": "c577b5c9d8ad52eae065359f1614de2d74b1bc7588ac2676d513f4aba2fc9c6f", + "js_sha256": "8fc180339017f373771a1abeed9f6dc978ee8a1c051df9f6fb69f054ca45bf0f" + }, + "User/user.service.ts": { + "source_sha256": "0737e88c408510bc17ec0597c3812be855c03499dfc2ad5ba6a4b1e85bb1c5e7", + "js_sha256": "e71c703979ae29963546f88602d4c98735562163749af06c966474e1670e4b7c" + }, + "User/user.guard.ts": { + "source_sha256": "20b05a0e5272a4ee1ccbddef83494e62621ffb0236e56a15c17e7f8f0083f6d7", + "js_sha256": "a078cc3065d6f87ee441f2bc0ff43af25094e66db4bd661d74cf3cd1c501fc2a" + }, + "Chat/chat.service.ts": { + "source_sha256": "11a44d19390d1e605fb72fabbc6111a25917e292a1aab4132e26390887128219", + "js_sha256": "3759d025e679f2b1694e486c460361a96979f8b67a1a8e811e589c722e8fb55f" + }, + "Chat/chat.controller.ts": { + "source_sha256": "1e3b1e0a5abc053625c5b1a6dc14f5b5b3e87676b1af0bdd73e78ad95d1eb325", + "js_sha256": "6ac78b848b82f03a4134a9e19e2b802fef59d06b938f2e747fa361c2293fd5c7" + } + }, + "striped": false + }, + { + "name": "striped", + "modules": { + "Auth/auth.service.ts": { + "source_sha256": "f99168697aa79d7c5c1fd9f35083448c97f68a0bfecdbfbca49fa279445d79b1", + "js_sha256": "73fe21965e7f1fc421b501c5760ee8dfc4ca7edb606477db1682dd04a9c885d1" + }, + "User/user.service.ts": { + "source_sha256": "0737e88c408510bc17ec0597c3812be855c03499dfc2ad5ba6a4b1e85bb1c5e7", + "js_sha256": "e71c703979ae29963546f88602d4c98735562163749af06c966474e1670e4b7c" + }, + "User/user.guard.ts": { + "source_sha256": "20b05a0e5272a4ee1ccbddef83494e62621ffb0236e56a15c17e7f8f0083f6d7", + "js_sha256": "a078cc3065d6f87ee441f2bc0ff43af25094e66db4bd661d74cf3cd1c501fc2a" + }, + "Chat/chat.service.ts": { + "source_sha256": "b43a57b6e6e17a3133f2061d5660f8e36b62e049975b0d6d800517f99d942699", + "js_sha256": "208e1298e119284bb587ba80b8ef650e7c8fd9031a17ff5079f50732902a62c7" + }, + "Chat/chat.controller.ts": { + "source_sha256": "1e3b1e0a5abc053625c5b1a6dc14f5b5b3e87676b1af0bdd73e78ad95d1eb325", + "js_sha256": "6ac78b848b82f03a4134a9e19e2b802fef59d06b938f2e747fa361c2293fd5c7" + } + }, + "striped": true + } + ], + "samples": [ + { + "variant": "baseline", + "workload": "warm-history", + "repeat": 1, + "successes": 11300, + "errors": 0, + "elapsed_seconds": 60.101, + "rps": 188.018, + "mean_latency_ms": 170.03, + "p95_ms": 437.91, + "sql_queries": 22651, + "sql_per_request": 2.0045, + "sql_calls": { + "SELECT": 22651 + }, + "cpu_percent_one_core": 110.44, + "rss_mib": 572.86 + }, + { + "variant": "baseline", + "workload": "writes-single-chat", + "repeat": 1, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 80.182, + "rps": 51.084, + "mean_latency_ms": 625.658, + "p95_ms": 1960.791, + "sql_queries": 8470, + "sql_per_request": 2.0679, + "sql_calls": { + "SELECT": 4374, + "WITH": 4096 + }, + "cpu_percent_one_core": 81.41, + "rss_mib": 567.86 + }, + { + "variant": "profile-join", + "workload": "warm-history", + "repeat": 1, + "successes": 8162, + "errors": 0, + "elapsed_seconds": 60.142, + "rps": 135.713, + "mean_latency_ms": 235.249, + "p95_ms": 646.713, + "sql_queries": 16463, + "sql_per_request": 2.017, + "sql_calls": { + "SELECT": 16463 + }, + "cpu_percent_one_core": 90.2, + "rss_mib": 571.11 + }, + { + "variant": "profile-join", + "workload": "writes-single-chat", + "repeat": 1, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 35.83, + "rps": 114.318, + "mean_latency_ms": 279.681, + "p95_ms": 723.32, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT": 4096, + "WITH": 4096 + }, + "cpu_percent_one_core": 94.92, + "rss_mib": 571.23 + }, + { + "variant": "access-join", + "workload": "warm-history", + "repeat": 1, + "successes": 17153, + "errors": 0, + "elapsed_seconds": 60.704, + "rps": 282.567, + "mean_latency_ms": 113.157, + "p95_ms": 243.983, + "sql_queries": 17206, + "sql_per_request": 1.0031, + "sql_calls": { + "SELECT": 17206 + }, + "cpu_percent_one_core": 106.31, + "rss_mib": 576.19 + }, + { + "variant": "access-join", + "workload": "writes-single-chat", + "repeat": 1, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 52.243, + "rps": 78.403, + "mean_latency_ms": 407.523, + "p95_ms": 987.832, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT": 4096, + "WITH": 4096 + }, + "cpu_percent_one_core": 80.45, + "rss_mib": 576.19 + }, + { + "variant": "striped", + "workload": "warm-history", + "repeat": 1, + "successes": 15925, + "errors": 0, + "elapsed_seconds": 60.169, + "rps": 264.672, + "mean_latency_ms": 120.746, + "p95_ms": 268.879, + "sql_queries": 15977, + "sql_per_request": 1.0033, + "sql_calls": { + "SELECT": 15977 + }, + "cpu_percent_one_core": 105.46, + "rss_mib": 576.48 + }, + { + "variant": "striped", + "workload": "writes-single-chat", + "repeat": 1, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 22.406, + "rps": 182.806, + "mean_latency_ms": 174.946, + "p95_ms": 414.242, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT": 4096, + "WITH": 4096 + }, + "cpu_percent_one_core": 103.49, + "rss_mib": 576.33 + }, + { + "variant": "striped", + "workload": "warm-history", + "repeat": 2, + "successes": 14354, + "errors": 0, + "elapsed_seconds": 60.252, + "rps": 238.233, + "mean_latency_ms": 134.067, + "p95_ms": 305.055, + "sql_queries": 14406, + "sql_per_request": 1.0036, + "sql_calls": { + "SELECT": 14406 + }, + "cpu_percent_one_core": 103.01, + "rss_mib": 576.27 + }, + { + "variant": "striped", + "workload": "writes-single-chat", + "repeat": 2, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 25.494, + "rps": 160.668, + "mean_latency_ms": 198.958, + "p95_ms": 427.198, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT": 4096, + "WITH": 4096 + }, + "cpu_percent_one_core": 99.91, + "rss_mib": 576.27 + }, + { + "variant": "access-join", + "workload": "warm-history", + "repeat": 2, + "successes": 16307, + "errors": 0, + "elapsed_seconds": 60.093, + "rps": 271.362, + "mean_latency_ms": 117.835, + "p95_ms": 277.764, + "sql_queries": 16339, + "sql_per_request": 1.002, + "sql_calls": { + "SELECT": 16339 + }, + "cpu_percent_one_core": 103.54, + "rss_mib": 576.77 + }, + { + "variant": "access-join", + "workload": "writes-single-chat", + "repeat": 2, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 22.63, + "rps": 181, + "mean_latency_ms": 176.596, + "p95_ms": 359.748, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT": 4096, + "WITH": 4096 + }, + "cpu_percent_one_core": 102.17, + "rss_mib": 576.38 + }, + { + "variant": "profile-join", + "workload": "warm-history", + "repeat": 2, + "successes": 12604, + "errors": 0, + "elapsed_seconds": 60.091, + "rps": 209.749, + "mean_latency_ms": 152.428, + "p95_ms": 398.121, + "sql_queries": 25278, + "sql_per_request": 2.0056, + "sql_calls": { + "SELECT": 25278 + }, + "cpu_percent_one_core": 104.2, + "rss_mib": 576.5 + }, + { + "variant": "profile-join", + "workload": "writes-single-chat", + "repeat": 2, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 29.777, + "rps": 137.555, + "mean_latency_ms": 232.438, + "p95_ms": 530.581, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT": 4096, + "WITH": 4096 + }, + "cpu_percent_one_core": 96.07, + "rss_mib": 576.5 + }, + { + "variant": "baseline", + "workload": "warm-history", + "repeat": 2, + "successes": 14650, + "errors": 0, + "elapsed_seconds": 60.062, + "rps": 243.914, + "mean_latency_ms": 131.102, + "p95_ms": 298.279, + "sql_queries": 29335, + "sql_per_request": 2.0024, + "sql_calls": { + "SELECT": 29335 + }, + "cpu_percent_one_core": 106, + "rss_mib": 576.5 + }, + { + "variant": "baseline", + "workload": "writes-single-chat", + "repeat": 2, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 30.574, + "rps": 133.969, + "mean_latency_ms": 238.29, + "p95_ms": 521.311, + "sql_queries": 8210, + "sql_per_request": 2.0044, + "sql_calls": { + "SELECT": 4114, + "WITH": 4096 + }, + "cpu_percent_one_core": 91.63, + "rss_mib": 576.63 + }, + { + "variant": "profile-join", + "workload": "warm-history", + "repeat": 3, + "successes": 9990, + "errors": 0, + "elapsed_seconds": 60.13, + "rps": 166.141, + "mean_latency_ms": 192.396, + "p95_ms": 503.539, + "sql_queries": 20093, + "sql_per_request": 2.0113, + "sql_calls": { + "SELECT": 20093 + }, + "cpu_percent_one_core": 92.44, + "rss_mib": 576.6 + }, + { + "variant": "profile-join", + "workload": "writes-single-chat", + "repeat": 3, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 21.25, + "rps": 192.755, + "mean_latency_ms": 165.859, + "p95_ms": 318.167, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT": 4096, + "WITH": 4096 + }, + "cpu_percent_one_core": 107.92, + "rss_mib": 576.6 + }, + { + "variant": "striped", + "workload": "warm-history", + "repeat": 3, + "successes": 13516, + "errors": 0, + "elapsed_seconds": 60.141, + "rps": 224.738, + "mean_latency_ms": 142.252, + "p95_ms": 365.937, + "sql_queries": 13588, + "sql_per_request": 1.0053, + "sql_calls": { + "SELECT": 13588 + }, + "cpu_percent_one_core": 98.43, + "rss_mib": 576.85 + }, + { + "variant": "striped", + "workload": "writes-single-chat", + "repeat": 3, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 26.545, + "rps": 154.303, + "mean_latency_ms": 205.891, + "p95_ms": 585.601, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT": 4096, + "WITH": 4096 + }, + "cpu_percent_one_core": 102.74, + "rss_mib": 576.66 + }, + { + "variant": "baseline", + "workload": "warm-history", + "repeat": 3, + "successes": 14799, + "errors": 0, + "elapsed_seconds": 60.082, + "rps": 246.313, + "mean_latency_ms": 129.797, + "p95_ms": 278.595, + "sql_queries": 29663, + "sql_per_request": 2.0044, + "sql_calls": { + "SELECT": 29663 + }, + "cpu_percent_one_core": 105.5, + "rss_mib": 577.03 + }, + { + "variant": "baseline", + "workload": "writes-single-chat", + "repeat": 3, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 24.616, + "rps": 166.398, + "mean_latency_ms": 192.054, + "p95_ms": 475.632, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT": 4096, + "WITH": 4096 + }, + "cpu_percent_one_core": 94.84, + "rss_mib": 576.8 + }, + { + "variant": "access-join", + "workload": "warm-history", + "repeat": 3, + "successes": 11202, + "errors": 0, + "elapsed_seconds": 60.069, + "rps": 186.487, + "mean_latency_ms": 171.531, + "p95_ms": 473.5, + "sql_queries": 11368, + "sql_per_request": 1.0148, + "sql_calls": { + "SELECT": 11368 + }, + "cpu_percent_one_core": 89.43, + "rss_mib": 577.13 + }, + { + "variant": "access-join", + "workload": "writes-single-chat", + "repeat": 3, + "successes": 4096, + "errors": 0, + "elapsed_seconds": 29.46, + "rps": 139.035, + "mean_latency_ms": 229.808, + "p95_ms": 525.113, + "sql_queries": 8192, + "sql_per_request": 2, + "sql_calls": { + "SELECT": 4096, + "WITH": 4096 + }, + "cpu_percent_one_core": 94.07, + "rss_mib": 577.13 + } + ], + "correctness": { + "baseline": { + "access_statuses": true, + "redis_outage_and_retained_keys": true, + "rollback": true, + "delayed_old_fill": true, + "empty_cache": true + }, + "profile-join": { + "access_statuses": true, + "redis_outage_and_retained_keys": true, + "rollback": true, + "delayed_old_fill": true, + "empty_cache": true + }, + "access-join": { + "access_statuses": true, + "redis_outage_and_retained_keys": true, + "rollback": true, + "delayed_old_fill": true, + "empty_cache": true + }, + "striped": { + "access_statuses": true, + "redis_outage_and_retained_keys": true, + "rollback": true, + "delayed_old_fill": true, + "empty_cache": true + } + }, + "completed": true +} diff --git a/evidence/history-index-explain.json b/evidence/history-index-explain.json new file mode 100644 index 00000000..84d38e97 --- /dev/null +++ b/evidence/history-index-explain.json @@ -0,0 +1,7277 @@ +{ + "recorded_at": "2026-10-12T08:45:43.120Z", + "command": "node scripts/explain-history.mjs", + "node_version": "v24.20.0", + "docker": { + "cpus": 4, + "memory_bytes": 3008614400, + "server_version": "28.3.2", + "os": "Docker Desktop", + "arch": "x86_64", + "postgres_container": { + "image": "postgres:17.6-bookworm", + "memory_limit_bytes": 0, + "nano_cpus": 0, + "cpu_quota": 0, + "cpu_period": 0, + "cpuset_cpus": "" + } + }, + "settings": [ + { + "name": "block_size", + "setting": "8192", + "unit": null + }, + { + "name": "effective_cache_size", + "setting": "524288", + "unit": "8kB" + }, + { + "name": "jit", + "setting": "on", + "unit": null + }, + { + "name": "max_parallel_workers_per_gather", + "setting": "2", + "unit": null + }, + { + "name": "random_page_cost", + "setting": "4", + "unit": null + }, + { + "name": "server_version", + "setting": "17.6 (Debian 17.6-2.pgdg12+1)", + "unit": null + }, + { + "name": "shared_buffers", + "setting": "16384", + "unit": "8kB" + }, + { + "name": "work_mem", + "setting": "4096", + "unit": "kB" + } + ], + "source_table_indexes_before": [ + { + "indexname": "messages_chat_id_created_at_id_idx", + "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON public.messages USING btree (chat_id, created_at, id)" + }, + { + "indexname": "messages_pkey", + "indexdef": "CREATE UNIQUE INDEX messages_pkey ON public.messages USING btree (id)" + }, + { + "indexname": "messages_sender_id_idx", + "indexdef": "CREATE INDEX messages_sender_id_idx ON public.messages USING btree (sender_id)" + } + ], + "dataset": { + "total_messages": 60000, + "target_chat_messages": 20000, + "chats": 5, + "distribution": [ + { + "chat_id": "fb372790-4b73-5a45-c97c-7e4287fa05be", + "messages": 20000 + }, + { + "chat_id": "096d532a-b923-0f13-8dc9-243f47b54ac3", + "messages": 10000 + }, + { + "chat_id": "118c4ce4-f95c-c2a2-0ecf-f2aeb0cc0b49", + "messages": 10000 + }, + { + "chat_id": "35bbad77-7634-ca61-4fd8-5d37539c23b8", + "messages": 10000 + }, + { + "chat_id": "a3c16613-13f1-93e3-af30-521782e6eb21", + "messages": 10000 + } + ], + "text_length": 256, + "timestamp_ties": 10, + "insertion_order": "interleaved chats" + }, + "method": { + "warmup_runs_per_query_per_phase": 1, + "measured_runs": 5, + "page_size": 50, + "fetched_rows": 51, + "cursor_positions": [ + 10000, + 18000 + ], + "cache": "warm PostgreSQL buffers; Redis is bypassed", + "cleanup": "ROLLBACK the experiment schema; live tables and indexes unchanged", + "planner": "default scan settings; no forced index or disabled sequential scans", + "schema_difference": "copied columns/checks/defaults; foreign keys omitted equally in all phases", + "tuple_variant": "proposed equivalent SQL, not currently used by Prisma listMessages" + }, + "source_table_indexes_after": [ + { + "indexname": "messages_chat_id_created_at_id_idx", + "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON public.messages USING btree (chat_id, created_at, id)" + }, + { + "indexname": "messages_pkey", + "indexdef": "CREATE UNIQUE INDEX messages_pkey ON public.messages USING btree (id)" + }, + { + "indexname": "messages_sender_id_idx", + "indexdef": "CREATE INDEX messages_sender_id_idx ON public.messages USING btree (sender_id)" + } + ], + "experiment_schema_absent": true, + "cleanup_completed": true, + "runs": [ + { + "phase": "no_indexes", + "query": "first_page", + "indexes": [], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid ORDER BY created_at ASC, id ASC LIMIT $2", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + 51 + ], + "result_sha256": "138ed492cb091c27b09f072b1658e219e66907e30679526b9b475db438b40c6a", + "execution_ms": [ + 24.433, + 23.558, + 35.517, + 28.718, + 43.21 + ], + "median_execution_ms": 28.718, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4027.9, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 28.676, + "Actual Total Time": 28.686, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4077.89, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 28.675, + "Actual Total Time": 28.679, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 0.014, + "Actual Total Time": 19.873, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.076, + "Triggers": [], + "Execution Time": 28.718 + }, + "scan_type": "Seq Scan", + "index_name": null, + "rows_removed_by_filter": 40000, + "scanned_rows": 60000, + "sort": true, + "shared_buffer_hits": 2609, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4027.9, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 24.389, + "Actual Total Time": 24.401, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4077.89, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 24.388, + "Actual Total Time": 24.393, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 0.013, + "Actual Total Time": 17.477, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.131, + "Triggers": [], + "Execution Time": 24.433 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4027.9, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 23.516, + "Actual Total Time": 23.529, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4077.89, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 23.515, + "Actual Total Time": 23.521, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 0.016, + "Actual Total Time": 17.133, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.073, + "Triggers": [], + "Execution Time": 23.558 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4027.9, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 35.472, + "Actual Total Time": 35.483, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4077.89, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 35.471, + "Actual Total Time": 35.476, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 0.019, + "Actual Total Time": 27.687, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.093, + "Triggers": [], + "Execution Time": 35.517 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4027.9, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 28.676, + "Actual Total Time": 28.686, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4077.89, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 28.675, + "Actual Total Time": 28.679, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 0.014, + "Actual Total Time": 19.873, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.076, + "Triggers": [], + "Execution Time": 28.718 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4027.9, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 43.07, + "Actual Total Time": 43.179, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4027.78, + "Total Cost": 4077.89, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 43.069, + "Actual Total Time": 43.074, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 20046, + "Plan Width": 316, + "Actual Startup Time": 0.019, + "Actual Total Time": 24.581, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.114, + "Triggers": [], + "Execution Time": 43.21 + } + ] + }, + { + "phase": "no_indexes", + "query": "middle_page_or", + "indexes": [], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + "2026-01-01T00:16:39.000Z", + "f47542f1-8089-6114-80cd-9f75fcae23e0", + 51 + ], + "result_sha256": "0e8cef00f3d683111579ca25950a3f21ecd8225ae703020f0ba49b5303ce0921", + "execution_ms": [ + 20.653, + 50.299, + 20.652, + 23.885, + 21.733 + ], + "median_execution_ms": 21.733, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3922.53, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 21.694, + "Actual Total Time": 21.702, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3930.9, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 21.692, + "Actual Total Time": 21.696, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 9.327, + "Actual Total Time": 18.539, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.12, + "Triggers": [], + "Execution Time": 21.733 + }, + "scan_type": "Seq Scan", + "index_name": null, + "rows_removed_by_filter": 50000, + "scanned_rows": 60000, + "sort": true, + "shared_buffer_hits": 2609, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3922.53, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 20.554, + "Actual Total Time": 20.609, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3930.9, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 20.552, + "Actual Total Time": 20.587, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 9.678, + "Actual Total Time": 17.635, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.872, + "Triggers": [], + "Execution Time": 20.653 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3922.53, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 50.245, + "Actual Total Time": 50.257, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3930.9, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 50.244, + "Actual Total Time": 50.25, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 15.516, + "Actual Total Time": 23.855, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.302, + "Triggers": [], + "Execution Time": 50.299 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3922.53, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 20.613, + "Actual Total Time": 20.621, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3930.9, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 20.612, + "Actual Total Time": 20.616, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 7.28, + "Actual Total Time": 16.101, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.326, + "Triggers": [], + "Execution Time": 20.652 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3922.53, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 23.845, + "Actual Total Time": 23.854, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3930.9, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 23.844, + "Actual Total Time": 23.848, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 12.075, + "Actual Total Time": 20.032, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.095, + "Triggers": [], + "Execution Time": 23.885 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3922.53, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 21.694, + "Actual Total Time": 21.702, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.4, + "Total Cost": 3930.9, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 21.692, + "Actual Total Time": 21.696, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3399, + "Plan Width": 316, + "Actual Startup Time": 9.327, + "Actual Total Time": 18.539, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.12, + "Triggers": [], + "Execution Time": 21.733 + } + ] + }, + { + "phase": "no_indexes", + "query": "late_page_or", + "indexes": [], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + "2026-01-01T00:29:59.000Z", + "fd35e333-189b-af5a-fdcf-c376bd20e02b", + 51 + ], + "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", + "execution_ms": [ + 17.752, + 25.704, + 10.384, + 22.61, + 16.779 + ], + "median_execution_ms": 17.752, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3831.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 17.702, + "Actual Total Time": 17.715, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3833.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 17.7, + "Actual Total Time": 17.706, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 16.019, + "Actual Total Time": 17.183, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.316, + "Triggers": [], + "Execution Time": 17.752 + }, + "scan_type": "Seq Scan", + "index_name": null, + "rows_removed_by_filter": 58000, + "scanned_rows": 60000, + "sort": true, + "shared_buffer_hits": 2609, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3831.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 17.702, + "Actual Total Time": 17.715, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3833.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 17.7, + "Actual Total Time": 17.706, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 16.019, + "Actual Total Time": 17.183, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.316, + "Triggers": [], + "Execution Time": 17.752 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3831.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 25.662, + "Actual Total Time": 25.671, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3833.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 25.66, + "Actual Total Time": 25.665, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 23.949, + "Actual Total Time": 25.119, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.101, + "Triggers": [], + "Execution Time": 25.704 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3831.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 10.347, + "Actual Total Time": 10.357, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3833.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 10.345, + "Actual Total Time": 10.35, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 8.703, + "Actual Total Time": 9.72, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.093, + "Triggers": [], + "Execution Time": 10.384 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3831.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 22.558, + "Actual Total Time": 22.576, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3833.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 22.557, + "Actual Total Time": 22.565, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 19.407, + "Actual Total Time": 21.905, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.104, + "Triggers": [], + "Execution Time": 22.61 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3831.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 16.741, + "Actual Total Time": 16.75, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.45, + "Total Cost": 3833.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 16.739, + "Actual Total Time": 16.744, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 9.807, + "Actual Total Time": 15.753, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.181, + "Triggers": [], + "Execution Time": 16.779 + } + ] + }, + { + "phase": "no_indexes", + "query": "late_page_tuple", + "indexes": [], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid AND (created_at, id) > ($2::timestamptz, $3::uuid)\nORDER BY created_at ASC, id ASC LIMIT $4", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + "2026-01-01T00:29:59.000Z", + "fd35e333-189b-af5a-fdcf-c376bd20e02b", + 51 + ], + "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", + "execution_ms": [ + 12.468, + 22.145, + 22.897, + 22.697, + 12.853 + ], + "median_execution_ms": 22.145, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3681.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 22.09, + "Actual Total Time": 22.1, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3683.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 22.088, + "Actual Total Time": 22.092, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 19.54, + "Actual Total Time": 21.483, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.106, + "Triggers": [], + "Execution Time": 22.145 + }, + "scan_type": "Seq Scan", + "index_name": null, + "rows_removed_by_filter": 58000, + "scanned_rows": 60000, + "sort": true, + "shared_buffer_hits": 2609, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3681.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 12.428, + "Actual Total Time": 12.436, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3683.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 12.427, + "Actual Total Time": 12.43, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 10.752, + "Actual Total Time": 11.989, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.102, + "Triggers": [], + "Execution Time": 12.468 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3681.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 22.09, + "Actual Total Time": 22.1, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3683.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 22.088, + "Actual Total Time": 22.092, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 19.54, + "Actual Total Time": 21.483, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.106, + "Triggers": [], + "Execution Time": 22.145 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3681.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 22.86, + "Actual Total Time": 22.87, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3683.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 22.859, + "Actual Total Time": 22.863, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 20.021, + "Actual Total Time": 22.173, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.084, + "Triggers": [], + "Execution Time": 22.897 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3681.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 22.655, + "Actual Total Time": 22.664, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3683.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 22.653, + "Actual Total Time": 22.657, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 16.697, + "Actual Total Time": 21.99, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.096, + "Triggers": [], + "Execution Time": 22.697 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3681.58, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 12.816, + "Actual Total Time": 12.824, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.45, + "Total Cost": 3683.14, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 12.814, + "Actual Total Time": 12.818, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 673, + "Plan Width": 316, + "Actual Startup Time": 10.546, + "Actual Total Time": 11.861, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.072, + "Triggers": [], + "Execution Time": 12.853 + } + ] + }, + { + "phase": "without_history_index", + "query": "first_page", + "indexes": [ + { + "indexname": "messages_pkey", + "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" + }, + { + "indexname": "messages_sender_id_idx", + "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" + } + ], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid ORDER BY created_at ASC, id ASC LIMIT $2", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + 51 + ], + "result_sha256": "138ed492cb091c27b09f072b1658e219e66907e30679526b9b475db438b40c6a", + "execution_ms": [ + 16.619, + 17.94, + 13.889, + 12.897, + 48.033 + ], + "median_execution_ms": 16.619, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4025.44, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 16.588, + "Actual Total Time": 16.597, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4075.24, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 16.587, + "Actual Total Time": 16.591, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 0.012, + "Actual Total Time": 10.485, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.074, + "Triggers": [], + "Execution Time": 16.619 + }, + "scan_type": "Seq Scan", + "index_name": null, + "rows_removed_by_filter": 40000, + "scanned_rows": 60000, + "sort": true, + "shared_buffer_hits": 2609, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4025.44, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 16.588, + "Actual Total Time": 16.597, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4075.24, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 16.587, + "Actual Total Time": 16.591, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 0.012, + "Actual Total Time": 10.485, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.074, + "Triggers": [], + "Execution Time": 16.619 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4025.44, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 17.908, + "Actual Total Time": 17.916, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4075.24, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 17.906, + "Actual Total Time": 17.91, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 0.02, + "Actual Total Time": 12.207, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.097, + "Triggers": [], + "Execution Time": 17.94 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4025.44, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 13.853, + "Actual Total Time": 13.861, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4075.24, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 13.851, + "Actual Total Time": 13.855, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 0.018, + "Actual Total Time": 9.364, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.097, + "Triggers": [], + "Execution Time": 13.889 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4025.44, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 12.857, + "Actual Total Time": 12.865, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4075.24, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 12.856, + "Actual Total Time": 12.859, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 0.016, + "Actual Total Time": 8.773, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.102, + "Triggers": [], + "Execution Time": 12.897 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4025.44, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 47.967, + "Actual Total Time": 47.98, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 4025.31, + "Total Cost": 4075.24, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 47.966, + "Actual Total Time": 47.971, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 52, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3359, + "Plan Rows": 19972, + "Plan Width": 316, + "Actual Startup Time": 0.015, + "Actual Total Time": 32.15, + "Actual Rows": 20000, + "Actual Loops": 1, + "Filter": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Filter": 40000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.094, + "Triggers": [], + "Execution Time": 48.033 + } + ] + }, + { + "phase": "without_history_index", + "query": "middle_page_or", + "indexes": [ + { + "indexname": "messages_pkey", + "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" + }, + { + "indexname": "messages_sender_id_idx", + "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" + } + ], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + "2026-01-01T00:16:39.000Z", + "f47542f1-8089-6114-80cd-9f75fcae23e0", + 51 + ], + "result_sha256": "0e8cef00f3d683111579ca25950a3f21ecd8225ae703020f0ba49b5303ce0921", + "execution_ms": [ + 13.029, + 11.602, + 11.838, + 9.89, + 29.564 + ], + "median_execution_ms": 11.838, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3922.33, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 11.8, + "Actual Total Time": 11.808, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3930.68, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 11.798, + "Actual Total Time": 11.802, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 5.784, + "Actual Total Time": 10.064, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.132, + "Triggers": [], + "Execution Time": 11.838 + }, + "scan_type": "Seq Scan", + "index_name": null, + "rows_removed_by_filter": 50000, + "scanned_rows": 60000, + "sort": true, + "shared_buffer_hits": 2609, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3922.33, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 12.996, + "Actual Total Time": 13.004, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3930.68, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 12.994, + "Actual Total Time": 12.997, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 5, + "Actual Total Time": 10.988, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.113, + "Triggers": [], + "Execution Time": 13.029 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3922.33, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 11.566, + "Actual Total Time": 11.576, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3930.68, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 11.565, + "Actual Total Time": 11.569, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 5.094, + "Actual Total Time": 9.765, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.096, + "Triggers": [], + "Execution Time": 11.602 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3922.33, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 11.8, + "Actual Total Time": 11.808, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3930.68, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 11.798, + "Actual Total Time": 11.802, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 5.784, + "Actual Total Time": 10.064, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.132, + "Triggers": [], + "Execution Time": 11.838 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3922.33, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 9.861, + "Actual Total Time": 9.868, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3930.68, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 9.859, + "Actual Total Time": 9.862, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 3.325, + "Actual Total Time": 8.124, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.142, + "Triggers": [], + "Execution Time": 9.89 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3922.33, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 29.522, + "Actual Total Time": 29.532, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3922.2, + "Total Cost": 3930.68, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 29.52, + "Actual Total Time": 29.524, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 3393, + "Plan Width": 316, + "Actual Startup Time": 6.796, + "Actual Total Time": 21.488, + "Actual Rows": 10000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))))", + "Rows Removed by Filter": 50000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.16, + "Triggers": [], + "Execution Time": 29.564 + } + ] + }, + { + "phase": "without_history_index", + "query": "late_page_or", + "indexes": [ + { + "indexname": "messages_pkey", + "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" + }, + { + "indexname": "messages_sender_id_idx", + "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" + } + ], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + "2026-01-01T00:29:59.000Z", + "fd35e333-189b-af5a-fdcf-c376bd20e02b", + 51 + ], + "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", + "execution_ms": [ + 10.002, + 8.746, + 9.652, + 9.041, + 37.533 + ], + "median_execution_ms": 9.652, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3831.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 9.623, + "Actual Total Time": 9.631, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3833.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 9.622, + "Actual Total Time": 9.625, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 8.477, + "Actual Total Time": 9.291, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.12, + "Triggers": [], + "Execution Time": 9.652 + }, + "scan_type": "Seq Scan", + "index_name": null, + "rows_removed_by_filter": 58000, + "scanned_rows": 60000, + "sort": true, + "shared_buffer_hits": 2609, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3831.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 9.964, + "Actual Total Time": 9.973, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3833.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 9.962, + "Actual Total Time": 9.966, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 8.659, + "Actual Total Time": 9.615, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.166, + "Triggers": [], + "Execution Time": 10.002 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3831.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 8.715, + "Actual Total Time": 8.723, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3833.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 8.714, + "Actual Total Time": 8.718, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 7.159, + "Actual Total Time": 8.25, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.126, + "Triggers": [], + "Execution Time": 8.746 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3831.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 9.623, + "Actual Total Time": 9.631, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3833.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 9.622, + "Actual Total Time": 9.625, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 8.477, + "Actual Total Time": 9.291, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.12, + "Triggers": [], + "Execution Time": 9.652 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3831.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 8.999, + "Actual Total Time": 9.013, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3833.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 8.997, + "Actual Total Time": 9.003, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 7.133, + "Actual Total Time": 8.367, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.123, + "Triggers": [], + "Execution Time": 9.041 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3831.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 37.493, + "Actual Total Time": 37.503, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3831.75, + "Total Cost": 3833.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 37.491, + "Actual Total Time": 37.495, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3809, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 27.785, + "Actual Total Time": 29.553, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.165, + "Triggers": [], + "Execution Time": 37.533 + } + ] + }, + { + "phase": "without_history_index", + "query": "late_page_tuple", + "indexes": [ + { + "indexname": "messages_pkey", + "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" + }, + { + "indexname": "messages_sender_id_idx", + "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" + } + ], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid AND (created_at, id) > ($2::timestamptz, $3::uuid)\nORDER BY created_at ASC, id ASC LIMIT $4", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + "2026-01-01T00:29:59.000Z", + "fd35e333-189b-af5a-fdcf-c376bd20e02b", + 51 + ], + "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", + "execution_ms": [ + 9.253, + 8.872, + 9.809, + 21.15, + 25.266 + ], + "median_execution_ms": 9.809, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3681.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 9.776, + "Actual Total Time": 9.784, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3683.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 9.774, + "Actual Total Time": 9.778, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 8.472, + "Actual Total Time": 9.399, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.087, + "Triggers": [], + "Execution Time": 9.809 + }, + "scan_type": "Seq Scan", + "index_name": null, + "rows_removed_by_filter": 58000, + "scanned_rows": 60000, + "sort": true, + "shared_buffer_hits": 2609, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3681.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 9.212, + "Actual Total Time": 9.22, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3683.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 9.21, + "Actual Total Time": 9.214, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 7.92, + "Actual Total Time": 8.835, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.127, + "Triggers": [], + "Execution Time": 9.253 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3681.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 8.839, + "Actual Total Time": 8.848, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3683.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 8.838, + "Actual Total Time": 8.842, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 7.598, + "Actual Total Time": 8.464, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.087, + "Triggers": [], + "Execution Time": 8.872 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3681.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 9.776, + "Actual Total Time": 9.784, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3683.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 9.774, + "Actual Total Time": 9.778, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 8.472, + "Actual Total Time": 9.399, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.087, + "Triggers": [], + "Execution Time": 9.809 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3681.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 21.102, + "Actual Total Time": 21.116, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3683.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 21.1, + "Actual Total Time": 21.107, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 19.135, + "Actual Total Time": 20.538, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.121, + "Triggers": [], + "Execution Time": 21.15 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3681.88, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 25.22, + "Actual Total Time": 25.232, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Sort", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 3681.75, + "Total Cost": 3683.46, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 25.218, + "Actual Total Time": 25.223, + "Actual Rows": 51, + "Actual Loops": 1, + "Sort Key": [ + "created_at", + "id" + ], + "Sort Method": "top-N heapsort", + "Sort Space Used": 51, + "Sort Space Type": "Memory", + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Seq Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0, + "Total Cost": 3659, + "Plan Rows": 682, + "Plan Width": 316, + "Actual Startup Time": 23.106, + "Actual Total Time": 24.62, + "Actual Rows": 2000, + "Actual Loops": 1, + "Filter": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 58000, + "Shared Hit Blocks": 2609, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.107, + "Triggers": [], + "Execution Time": 25.266 + } + ] + }, + { + "phase": "with_history_index", + "query": "first_page", + "indexes": [ + { + "indexname": "messages_chat_id_created_at_id_idx", + "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (chat_id, created_at, id)" + }, + { + "indexname": "messages_pkey", + "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" + }, + { + "indexname": "messages_sender_id_idx", + "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" + } + ], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid ORDER BY created_at ASC, id ASC LIMIT $2", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + 51 + ], + "result_sha256": "138ed492cb091c27b09f072b1658e219e66907e30679526b9b475db438b40c6a", + "execution_ms": [ + 0.1, + 0.089, + 0.07, + 0.131, + 0.094 + ], + "median_execution_ms": 0.094, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 28.95, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.024, + "Actual Total Time": 0.071, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11101.66, + "Plan Rows": 19840, + "Plan Width": 316, + "Actual Startup Time": 0.023, + "Actual Total Time": 0.064, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.111, + "Triggers": [], + "Execution Time": 0.094 + }, + "scan_type": "Index Scan", + "index_name": "messages_chat_id_created_at_id_idx", + "rows_removed_by_filter": 0, + "scanned_rows": 51, + "sort": false, + "shared_buffer_hits": 31, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 28.95, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.031, + "Actual Total Time": 0.073, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11101.66, + "Plan Rows": 19840, + "Plan Width": 316, + "Actual Startup Time": 0.029, + "Actual Total Time": 0.067, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.114, + "Triggers": [], + "Execution Time": 0.1 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 28.95, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.027, + "Actual Total Time": 0.065, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11101.66, + "Plan Rows": 19840, + "Plan Width": 316, + "Actual Startup Time": 0.026, + "Actual Total Time": 0.059, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.622, + "Triggers": [], + "Execution Time": 0.089 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 28.95, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.022, + "Actual Total Time": 0.053, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11101.66, + "Plan Rows": 19840, + "Plan Width": 316, + "Actual Startup Time": 0.021, + "Actual Total Time": 0.047, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.082, + "Triggers": [], + "Execution Time": 0.07 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 28.95, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.021, + "Actual Total Time": 0.112, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11101.66, + "Plan Rows": 19840, + "Plan Width": 316, + "Actual Startup Time": 0.02, + "Actual Total Time": 0.088, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.09, + "Triggers": [], + "Execution Time": 0.131 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 28.95, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.024, + "Actual Total Time": 0.071, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11101.66, + "Plan Rows": 19840, + "Plan Width": 316, + "Actual Startup Time": 0.023, + "Actual Total Time": 0.064, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 31, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.111, + "Triggers": [], + "Execution Time": 0.094 + } + ] + }, + { + "phase": "with_history_index", + "query": "middle_page_or", + "indexes": [ + { + "indexname": "messages_chat_id_created_at_id_idx", + "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (chat_id, created_at, id)" + }, + { + "indexname": "messages_pkey", + "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" + }, + { + "indexname": "messages_sender_id_idx", + "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" + } + ], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + "2026-01-01T00:16:39.000Z", + "f47542f1-8089-6114-80cd-9f75fcae23e0", + 51 + ], + "result_sha256": "0e8cef00f3d683111579ca25950a3f21ecd8225ae703020f0ba49b5303ce0921", + "execution_ms": [ + 4.782, + 6.997, + 5.595, + 5.111, + 6.055 + ], + "median_execution_ms": 5.595, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 172.25, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 5.535, + "Actual Total Time": 5.567, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 3339, + "Plan Width": 316, + "Actual Startup Time": 5.534, + "Actual Total Time": 5.559, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", + "Rows Removed by Filter": 10000, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.129, + "Triggers": [], + "Execution Time": 5.595 + }, + "scan_type": "Index Scan", + "index_name": "messages_chat_id_created_at_id_idx", + "rows_removed_by_filter": 10000, + "scanned_rows": 10051, + "sort": false, + "shared_buffer_hits": 5203, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 172.25, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 4.712, + "Actual Total Time": 4.748, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 3339, + "Plan Width": 316, + "Actual Startup Time": 4.709, + "Actual Total Time": 4.738, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", + "Rows Removed by Filter": 10000, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.144, + "Triggers": [], + "Execution Time": 4.782 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 172.25, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 6.933, + "Actual Total Time": 6.968, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 3339, + "Plan Width": 316, + "Actual Startup Time": 6.931, + "Actual Total Time": 6.96, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", + "Rows Removed by Filter": 10000, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.139, + "Triggers": [], + "Execution Time": 6.997 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 172.25, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 5.535, + "Actual Total Time": 5.567, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 3339, + "Plan Width": 316, + "Actual Startup Time": 5.534, + "Actual Total Time": 5.559, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", + "Rows Removed by Filter": 10000, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.129, + "Triggers": [], + "Execution Time": 5.595 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 172.25, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 5.059, + "Actual Total Time": 5.084, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 3339, + "Plan Width": 316, + "Actual Startup Time": 5.057, + "Actual Total Time": 5.078, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", + "Rows Removed by Filter": 10000, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.116, + "Triggers": [], + "Execution Time": 5.111 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 172.25, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 5.987, + "Actual Total Time": 6.026, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 3339, + "Plan Width": 316, + "Actual Startup Time": 5.985, + "Actual Total Time": 6.016, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))", + "Rows Removed by Filter": 10000, + "Shared Hit Blocks": 5203, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.116, + "Triggers": [], + "Execution Time": 6.055 + } + ] + }, + { + "phase": "with_history_index", + "query": "late_page_or", + "indexes": [ + { + "indexname": "messages_chat_id_created_at_id_idx", + "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (chat_id, created_at, id)" + }, + { + "indexname": "messages_pkey", + "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" + }, + { + "indexname": "messages_sender_id_idx", + "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" + } + ], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid\n AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid))\nORDER BY created_at ASC, id ASC LIMIT $4", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + "2026-01-01T00:29:59.000Z", + "fd35e333-189b-af5a-fdcf-c376bd20e02b", + 51 + ], + "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", + "execution_ms": [ + 7.771, + 8.029, + 12.242, + 10.479, + 10.829 + ], + "median_execution_ms": 10.479, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 905.39, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 10.421, + "Actual Total Time": 10.452, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 10.419, + "Actual Total Time": 10.444, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 18000, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.241, + "Triggers": [], + "Execution Time": 10.479 + }, + "scan_type": "Index Scan", + "index_name": "messages_chat_id_created_at_id_idx", + "rows_removed_by_filter": 18000, + "scanned_rows": 18051, + "sort": false, + "shared_buffer_hits": 9355, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 905.39, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 7.723, + "Actual Total Time": 7.748, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 7.722, + "Actual Total Time": 7.742, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 18000, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.143, + "Triggers": [], + "Execution Time": 7.771 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 905.39, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 7.978, + "Actual Total Time": 8.004, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 7.977, + "Actual Total Time": 7.997, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 18000, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.146, + "Triggers": [], + "Execution Time": 8.029 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 905.39, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 12.174, + "Actual Total Time": 12.2, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 12.172, + "Actual Total Time": 12.193, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 18000, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.187, + "Triggers": [], + "Execution Time": 12.242 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 905.39, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 10.421, + "Actual Total Time": 10.452, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 10.419, + "Actual Total Time": 10.444, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 18000, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.241, + "Triggers": [], + "Execution Time": 10.479 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 905.39, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 10.768, + "Actual Total Time": 10.798, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 11250.46, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 10.766, + "Actual Total Time": 10.79, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "(chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid)", + "Rows Removed by Index Recheck": 0, + "Filter": "((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Filter": 18000, + "Shared Hit Blocks": 9355, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 4, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.214, + "Triggers": [], + "Execution Time": 10.829 + } + ] + }, + { + "phase": "with_history_index", + "query": "late_page_tuple", + "indexes": [ + { + "indexname": "messages_chat_id_created_at_id_idx", + "indexdef": "CREATE INDEX messages_chat_id_created_at_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (chat_id, created_at, id)" + }, + { + "indexname": "messages_pkey", + "indexdef": "CREATE UNIQUE INDEX messages_pkey ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (id)" + }, + { + "indexname": "messages_sender_id_idx", + "indexdef": "CREATE INDEX messages_sender_id_idx ON explain_history_0e94bd9d82394e1497f4949dc0f81a1c.messages USING btree (sender_id)" + } + ], + "sql": "SELECT id, chat_id, sender_id, text, created_at FROM \"explain_history_0e94bd9d82394e1497f4949dc0f81a1c\".\"messages\"\nWHERE chat_id = $1::uuid AND (created_at, id) > ($2::timestamptz, $3::uuid)\nORDER BY created_at ASC, id ASC LIMIT $4", + "parameters": [ + "fb372790-4b73-5a45-c97c-7e4287fa05be", + "2026-01-01T00:29:59.000Z", + "fd35e333-189b-af5a-fdcf-c376bd20e02b", + 51 + ], + "result_sha256": "68c26a91a60dd54adb6bfeec93181c3d7d9669095c2ed0a04481a27d08475d65", + "execution_ms": [ + 0.082, + 0.08, + 0.165, + 0.08, + 0.079 + ], + "median_execution_ms": 0.08, + "representative_plan": { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 180.32, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.029, + "Actual Total Time": 0.058, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 2236.91, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 0.028, + "Actual Total Time": 0.051, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.113, + "Triggers": [], + "Execution Time": 0.08 + }, + "scan_type": "Index Scan", + "index_name": "messages_chat_id_created_at_id_idx", + "rows_removed_by_filter": 0, + "scanned_rows": 51, + "sort": false, + "shared_buffer_hits": 29, + "shared_buffer_reads": 0, + "raw_plans": [ + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 180.32, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.03, + "Actual Total Time": 0.058, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 2236.91, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 0.029, + "Actual Total Time": 0.052, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.116, + "Triggers": [], + "Execution Time": 0.082 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 180.32, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.029, + "Actual Total Time": 0.058, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 2236.91, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 0.028, + "Actual Total Time": 0.051, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.113, + "Triggers": [], + "Execution Time": 0.08 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 180.32, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.041, + "Actual Total Time": 0.091, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 2236.91, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 0.039, + "Actual Total Time": 0.073, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.166, + "Triggers": [], + "Execution Time": 0.165 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 180.32, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.029, + "Actual Total Time": 0.057, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 2236.91, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 0.028, + "Actual Total Time": 0.051, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.168, + "Triggers": [], + "Execution Time": 0.08 + }, + { + "Plan": { + "Node Type": "Limit", + "Parallel Aware": false, + "Async Capable": false, + "Startup Cost": 0.41, + "Total Cost": 180.32, + "Plan Rows": 51, + "Plan Width": 316, + "Actual Startup Time": 0.029, + "Actual Total Time": 0.057, + "Actual Rows": 51, + "Actual Loops": 1, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0, + "Plans": [ + { + "Node Type": "Index Scan", + "Parent Relationship": "Outer", + "Parallel Aware": false, + "Async Capable": false, + "Scan Direction": "Forward", + "Index Name": "messages_chat_id_created_at_id_idx", + "Relation Name": "messages", + "Alias": "messages", + "Startup Cost": 0.41, + "Total Cost": 2236.91, + "Plan Rows": 634, + "Plan Width": 316, + "Actual Startup Time": 0.028, + "Actual Total Time": 0.051, + "Actual Rows": 51, + "Actual Loops": 1, + "Index Cond": "((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))", + "Rows Removed by Index Recheck": 0, + "Shared Hit Blocks": 29, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + } + ] + }, + "Planning": { + "Shared Hit Blocks": 0, + "Shared Read Blocks": 0, + "Shared Dirtied Blocks": 0, + "Shared Written Blocks": 0, + "Local Hit Blocks": 0, + "Local Read Blocks": 0, + "Local Dirtied Blocks": 0, + "Local Written Blocks": 0, + "Temp Read Blocks": 0, + "Temp Written Blocks": 0 + }, + "Planning Time": 0.108, + "Triggers": [], + "Execution Time": 0.079 + } + ] + } + ] +} diff --git a/evidence/history-index-plans.txt b/evidence/history-index-plans.txt new file mode 100644 index 00000000..1a8ba1d6 --- /dev/null +++ b/evidence/history-index-plans.txt @@ -0,0 +1,242 @@ +=== no_indexes / first_page === +Indexes: (none) +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid ORDER BY created_at ASC, id ASC LIMIT $2 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be",51] + +Limit (cost=4027.78..4027.90 rows=51 width=316) (actual time=17.915..17.960 rows=51 loops=1) + Buffers: shared hit=2609 + -> Sort (cost=4027.78..4077.89 rows=20046 width=316) (actual time=17.913..17.953 rows=51 loops=1) + Sort Key: created_at, id + Sort Method: top-N heapsort Memory: 52kB + Buffers: shared hit=2609 + -> Seq Scan on messages (cost=0.00..3359.00 rows=20046 width=316) (actual time=0.015..11.329 rows=20000 loops=1) + Filter: (chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) + Rows Removed by Filter: 40000 + Buffers: shared hit=2609 +Planning Time: 0.082 ms +Execution Time: 17.989 ms + +=== no_indexes / middle_page_or === +Indexes: (none) +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid + AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid)) +ORDER BY created_at ASC, id ASC LIMIT $4 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be","2026-01-01T00:16:39.000Z","f47542f1-8089-6114-80cd-9f75fcae23e0",51] + +Limit (cost=3922.40..3922.53 rows=51 width=316) (actual time=18.519..18.529 rows=51 loops=1) + Buffers: shared hit=2609 + -> Sort (cost=3922.40..3930.90 rows=3399 width=316) (actual time=18.517..18.521 rows=51 loops=1) + Sort Key: created_at, id + Sort Method: top-N heapsort Memory: 51kB + Buffers: shared hit=2609 + -> Seq Scan on messages (cost=0.00..3809.00 rows=3399 width=316) (actual time=6.148..13.726 rows=10000 loops=1) + Filter: ((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))) + Rows Removed by Filter: 50000 + Buffers: shared hit=2609 +Planning Time: 0.112 ms +Execution Time: 18.559 ms + +=== no_indexes / late_page_or === +Indexes: (none) +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid + AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid)) +ORDER BY created_at ASC, id ASC LIMIT $4 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be","2026-01-01T00:29:59.000Z","fd35e333-189b-af5a-fdcf-c376bd20e02b",51] + +Limit (cost=3831.45..3831.58 rows=51 width=316) (actual time=16.897..16.908 rows=51 loops=1) + Buffers: shared hit=2609 + -> Sort (cost=3831.45..3833.14 rows=673 width=316) (actual time=16.895..16.900 rows=51 loops=1) + Sort Key: created_at, id + Sort Method: top-N heapsort Memory: 51kB + Buffers: shared hit=2609 + -> Seq Scan on messages (cost=0.00..3809.00 rows=673 width=316) (actual time=15.036..16.370 rows=2000 loops=1) + Filter: ((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))) + Rows Removed by Filter: 58000 + Buffers: shared hit=2609 +Planning Time: 0.114 ms +Execution Time: 16.993 ms + +=== no_indexes / late_page_tuple === +Indexes: (none) +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid AND (created_at, id) > ($2::timestamptz, $3::uuid) +ORDER BY created_at ASC, id ASC LIMIT $4 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be","2026-01-01T00:29:59.000Z","fd35e333-189b-af5a-fdcf-c376bd20e02b",51] + +Limit (cost=3681.45..3681.58 rows=51 width=316) (actual time=21.195..21.205 rows=51 loops=1) + Buffers: shared hit=2609 + -> Sort (cost=3681.45..3683.14 rows=673 width=316) (actual time=21.194..21.198 rows=51 loops=1) + Sort Key: created_at, id + Sort Method: top-N heapsort Memory: 51kB + Buffers: shared hit=2609 + -> Seq Scan on messages (cost=0.00..3659.00 rows=673 width=316) (actual time=13.066..16.387 rows=2000 loops=1) + Filter: ((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))) + Rows Removed by Filter: 58000 + Buffers: shared hit=2609 +Planning Time: 0.163 ms +Execution Time: 21.242 ms + +=== without_history_index / first_page === +Indexes: messages_pkey, messages_sender_id_idx +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid ORDER BY created_at ASC, id ASC LIMIT $2 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be",51] + +Limit (cost=4025.31..4025.44 rows=51 width=316) (actual time=39.169..39.182 rows=51 loops=1) + Buffers: shared hit=2609 + -> Sort (cost=4025.31..4075.24 rows=19972 width=316) (actual time=39.167..39.174 rows=51 loops=1) + Sort Key: created_at, id + Sort Method: top-N heapsort Memory: 52kB + Buffers: shared hit=2609 + -> Seq Scan on messages (cost=0.00..3359.00 rows=19972 width=316) (actual time=0.017..30.929 rows=20000 loops=1) + Filter: (chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) + Rows Removed by Filter: 40000 + Buffers: shared hit=2609 +Planning Time: 0.104 ms +Execution Time: 39.214 ms + +=== without_history_index / middle_page_or === +Indexes: messages_pkey, messages_sender_id_idx +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid + AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid)) +ORDER BY created_at ASC, id ASC LIMIT $4 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be","2026-01-01T00:16:39.000Z","f47542f1-8089-6114-80cd-9f75fcae23e0",51] + +Limit (cost=3922.20..3922.33 rows=51 width=316) (actual time=22.514..22.524 rows=51 loops=1) + Buffers: shared hit=2609 + -> Sort (cost=3922.20..3930.68 rows=3393 width=316) (actual time=22.512..22.517 rows=51 loops=1) + Sort Key: created_at, id + Sort Method: top-N heapsort Memory: 51kB + Buffers: shared hit=2609 + -> Seq Scan on messages (cost=0.00..3809.00 rows=3393 width=316) (actual time=7.398..15.354 rows=10000 loops=1) + Filter: ((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid)))) + Rows Removed by Filter: 50000 + Buffers: shared hit=2609 +Planning Time: 0.168 ms +Execution Time: 22.562 ms + +=== without_history_index / late_page_or === +Indexes: messages_pkey, messages_sender_id_idx +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid + AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid)) +ORDER BY created_at ASC, id ASC LIMIT $4 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be","2026-01-01T00:29:59.000Z","fd35e333-189b-af5a-fdcf-c376bd20e02b",51] + +Limit (cost=3831.75..3831.88 rows=51 width=316) (actual time=13.129..13.138 rows=51 loops=1) + Buffers: shared hit=2609 + -> Sort (cost=3831.75..3833.46 rows=682 width=316) (actual time=13.127..13.131 rows=51 loops=1) + Sort Key: created_at, id + Sort Method: top-N heapsort Memory: 51kB + Buffers: shared hit=2609 + -> Seq Scan on messages (cost=0.00..3809.00 rows=682 width=316) (actual time=10.949..12.462 rows=2000 loops=1) + Filter: ((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid)))) + Rows Removed by Filter: 58000 + Buffers: shared hit=2609 +Planning: + Buffers: shared hit=4 +Planning Time: 0.170 ms +Execution Time: 13.163 ms + +=== without_history_index / late_page_tuple === +Indexes: messages_pkey, messages_sender_id_idx +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid AND (created_at, id) > ($2::timestamptz, $3::uuid) +ORDER BY created_at ASC, id ASC LIMIT $4 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be","2026-01-01T00:29:59.000Z","fd35e333-189b-af5a-fdcf-c376bd20e02b",51] + +Limit (cost=3681.75..3681.88 rows=51 width=316) (actual time=18.320..18.331 rows=51 loops=1) + Buffers: shared hit=2609 + -> Sort (cost=3681.75..3683.46 rows=682 width=316) (actual time=18.318..18.323 rows=51 loops=1) + Sort Key: created_at, id + Sort Method: top-N heapsort Memory: 51kB + Buffers: shared hit=2609 + -> Seq Scan on messages (cost=0.00..3659.00 rows=682 width=316) (actual time=14.704..16.910 rows=2000 loops=1) + Filter: ((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))) + Rows Removed by Filter: 58000 + Buffers: shared hit=2609 +Planning Time: 0.169 ms +Execution Time: 18.368 ms + +=== with_history_index / first_page === +Indexes: messages_chat_id_created_at_id_idx, messages_pkey, messages_sender_id_idx +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid ORDER BY created_at ASC, id ASC LIMIT $2 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be",51] + +Limit (cost=0.41..28.95 rows=51 width=316) (actual time=0.024..0.060 rows=51 loops=1) + Buffers: shared hit=31 + -> Index Scan using messages_chat_id_created_at_id_idx on messages (cost=0.41..11101.66 rows=19840 width=316) (actual time=0.022..0.054 rows=51 loops=1) + Index Cond: (chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) + Buffers: shared hit=31 +Planning Time: 0.100 ms +Execution Time: 0.081 ms + +=== with_history_index / middle_page_or === +Indexes: messages_chat_id_created_at_id_idx, messages_pkey, messages_sender_id_idx +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid + AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid)) +ORDER BY created_at ASC, id ASC LIMIT $4 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be","2026-01-01T00:16:39.000Z","f47542f1-8089-6114-80cd-9f75fcae23e0",51] + +Limit (cost=0.41..172.25 rows=51 width=316) (actual time=6.295..6.365 rows=51 loops=1) + Buffers: shared hit=5203 + -> Index Scan using messages_chat_id_created_at_id_idx on messages (cost=0.41..11250.46 rows=3339 width=316) (actual time=6.293..6.355 rows=51 loops=1) + Index Cond: (chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) + Filter: ((created_at > '2026-01-01 00:16:39+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:16:39+00'::timestamp with time zone) AND (id > 'f47542f1-8089-6114-80cd-9f75fcae23e0'::uuid))) + Rows Removed by Filter: 10000 + Buffers: shared hit=5203 +Planning Time: 0.136 ms +Execution Time: 6.397 ms + +=== with_history_index / late_page_or === +Indexes: messages_chat_id_created_at_id_idx, messages_pkey, messages_sender_id_idx +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid + AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid)) +ORDER BY created_at ASC, id ASC LIMIT $4 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be","2026-01-01T00:29:59.000Z","fd35e333-189b-af5a-fdcf-c376bd20e02b",51] + +Limit (cost=0.41..905.39 rows=51 width=316) (actual time=15.793..15.831 rows=51 loops=1) + Buffers: shared hit=9355 + -> Index Scan using messages_chat_id_created_at_id_idx on messages (cost=0.41..11250.46 rows=634 width=316) (actual time=15.791..15.822 rows=51 loops=1) + Index Cond: (chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) + Filter: ((created_at > '2026-01-01 00:29:59+00'::timestamp with time zone) OR ((created_at = '2026-01-01 00:29:59+00'::timestamp with time zone) AND (id > 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))) + Rows Removed by Filter: 18000 + Buffers: shared hit=9355 +Planning: + Buffers: shared hit=4 +Planning Time: 0.194 ms +Execution Time: 16.039 ms + +=== with_history_index / late_page_tuple === +Indexes: messages_chat_id_created_at_id_idx, messages_pkey, messages_sender_id_idx +SQL: +SELECT id, chat_id, sender_id, text, created_at FROM "explain_history_0e94bd9d82394e1497f4949dc0f81a1c"."messages" +WHERE chat_id = $1::uuid AND (created_at, id) > ($2::timestamptz, $3::uuid) +ORDER BY created_at ASC, id ASC LIMIT $4 +Parameters: ["fb372790-4b73-5a45-c97c-7e4287fa05be","2026-01-01T00:29:59.000Z","fd35e333-189b-af5a-fdcf-c376bd20e02b",51] + +Limit (cost=0.41..180.32 rows=51 width=316) (actual time=0.029..0.066 rows=51 loops=1) + Buffers: shared hit=29 + -> Index Scan using messages_chat_id_created_at_id_idx on messages (cost=0.41..2236.91 rows=634 width=316) (actual time=0.028..0.059 rows=51 loops=1) + Index Cond: ((chat_id = 'fb372790-4b73-5a45-c97c-7e4287fa05be'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:29:59+00'::timestamp with time zone, 'fd35e333-189b-af5a-fdcf-c376bd20e02b'::uuid))) + Buffers: shared hit=29 +Planning Time: 0.132 ms +Execution Time: 0.090 ms diff --git a/evidence/persistence-full-restart.json b/evidence/persistence-full-restart.json new file mode 100644 index 00000000..ad758e5b --- /dev/null +++ b/evidence/persistence-full-restart.json @@ -0,0 +1,79 @@ +{ + "recorded_at": "2026-10-12T06:25:43.133804+00:00", + "scenario": "full-restart", + "command": "python scripts/test-persistence.py --scenario full-restart --base-url http://127.0.0.1:8080", + "hook": "scripts/restart.cmd", + "elapsed_seconds": 40.779, + "result": "PASS", + "test_output": "Restarting backend, PostgreSQL and Redis; hook output suppressed.\nPASS: users, chat, membership, confirmed message and all existing sessions survived; access control, new writes and logout work after restart.", + "before": { + "backend": { + "id": "e65385c8d35f102e3e50ff45e965ce720a952cc3bce6781c666379a30280037b", + "started_at": "2026-10-12T06:21:19.516993813Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_backend_data", + "destination": "/app/data" + } + ] + }, + "postgres": { + "id": "c2fbbfded445fbedeff7ae87dcc06b05bedb0d2b2c89050e4a1a2236b06398f5", + "started_at": "2026-10-12T06:20:41.596732919Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_postgres_data", + "destination": "/var/lib/postgresql/data" + } + ] + }, + "redis": { + "id": "547184576f5e04a076d8c41e504cb0669c4f7c17daed437a6ae1db41ee5d1435", + "started_at": "2026-10-12T06:20:41.592548143Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_redis_data", + "destination": "/data" + } + ] + } + }, + "after": { + "backend": { + "id": "e65385c8d35f102e3e50ff45e965ce720a952cc3bce6781c666379a30280037b", + "started_at": "2026-10-12T06:25:33.943246182Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_backend_data", + "destination": "/app/data" + } + ] + }, + "postgres": { + "id": "c2fbbfded445fbedeff7ae87dcc06b05bedb0d2b2c89050e4a1a2236b06398f5", + "started_at": "2026-10-12T06:25:26.025429573Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_postgres_data", + "destination": "/var/lib/postgresql/data" + } + ] + }, + "redis": { + "id": "547184576f5e04a076d8c41e504cb0669c4f7c17daed437a6ae1db41ee5d1435", + "started_at": "2026-10-12T06:25:26.023339878Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_redis_data", + "destination": "/data" + } + ] + } + } +} diff --git a/evidence/persistence-public.json b/evidence/persistence-public.json new file mode 100644 index 00000000..695b2ef9 --- /dev/null +++ b/evidence/persistence-public.json @@ -0,0 +1,79 @@ +{ + "recorded_at": "2026-10-13T16:23:55.211338+00:00", + "scenario": "public", + "command": "python scripts/test-persistence.py --scenario public --base-url http://127.0.0.1:8080", + "hook": "scripts/restart.cmd", + "elapsed_seconds": 34.502, + "result": "PASS", + "test_output": "Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.\nPASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.", + "before": { + "backend": { + "id": "ce5c956eb323254c98154e780e8a8f69e9937404e11c878d0c7ea6fcc37ed2ca", + "started_at": "2026-10-13T14:54:54.227123416Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_backend_data", + "destination": "/app/data" + } + ] + }, + "postgres": { + "id": "c2fbbfded445fbedeff7ae87dcc06b05bedb0d2b2c89050e4a1a2236b06398f5", + "started_at": "2026-10-13T11:49:19.784511713Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_postgres_data", + "destination": "/var/lib/postgresql/data" + } + ] + }, + "redis": { + "id": "547184576f5e04a076d8c41e504cb0669c4f7c17daed437a6ae1db41ee5d1435", + "started_at": "2026-10-13T11:49:19.787195443Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_redis_data", + "destination": "/data" + } + ] + } + }, + "after": { + "backend": { + "id": "ce5c956eb323254c98154e780e8a8f69e9937404e11c878d0c7ea6fcc37ed2ca", + "started_at": "2026-10-13T16:23:45.40376979Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_backend_data", + "destination": "/app/data" + } + ] + }, + "postgres": { + "id": "c2fbbfded445fbedeff7ae87dcc06b05bedb0d2b2c89050e4a1a2236b06398f5", + "started_at": "2026-10-13T16:23:37.596580347Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_postgres_data", + "destination": "/var/lib/postgresql/data" + } + ] + }, + "redis": { + "id": "547184576f5e04a076d8c41e504cb0669c4f7c17daed437a6ae1db41ee5d1435", + "started_at": "2026-10-13T16:23:37.593428721Z", + "running": true, + "volumes": [ + { + "name": "mtusi2026lab2-fork_redis_data", + "destination": "/data" + } + ] + } + } +} diff --git a/evidence/redis-comparison-averages.json b/evidence/redis-comparison-averages.json new file mode 100644 index 00000000..f629d96a --- /dev/null +++ b/evidence/redis-comparison-averages.json @@ -0,0 +1,68 @@ +[ + { + "workload": "cold-history-burst", + "mode": "redis", + "successes": 96, + "errors": 0, + "rps": 31.88309531717038, + "mean_latency_ms": 861.2799999999999, + "mean_p95_ms": 974.8576666666668, + "sql_per_request": 2.59375, + "cpu_percent_one_core": 81.53158419129858 + }, + { + "workload": "cold-history-burst", + "mode": "no-redis", + "successes": 96, + "errors": 0, + "rps": 71.53502235469448, + "mean_latency_ms": 391.2333333333333, + "mean_p95_ms": 441.25466666666665, + "sql_per_request": 4, + "cpu_percent_one_core": 96.23474664679583 + }, + { + "workload": "warm-history", + "mode": "redis", + "successes": 3789, + "errors": 0, + "rps": 122.20215442172483, + "mean_latency_ms": 129.60684771707574, + "mean_p95_ms": 1052.4756666666667, + "sql_per_request": 2.0084455001319608, + "cpu_percent_one_core": 94.85495742759466 + }, + { + "workload": "warm-history", + "mode": "no-redis", + "successes": 1711, + "errors": 0, + "rps": 55.36141849479065, + "mean_latency_ms": 287.3598059614261, + "mean_p95_ms": 622.4456666666666, + "sql_per_request": 4, + "cpu_percent_one_core": 91.36944962143274 + }, + { + "workload": "writes-single-chat", + "mode": "redis", + "successes": 1536, + "errors": 0, + "rps": 64.84569595136574, + "mean_latency_ms": 245.36233333333334, + "mean_p95_ms": 688.5626666666667, + "sql_per_request": 2.0364583333333335, + "cpu_percent_one_core": 88.20568201967323 + }, + { + "workload": "writes-single-chat", + "mode": "no-redis", + "successes": 1536, + "errors": 0, + "rps": 90.58206050598572, + "mean_latency_ms": 174.03833333333333, + "mean_p95_ms": 421.7203333333334, + "sql_per_request": 3, + "cpu_percent_one_core": 102.17294037860471 + } +] diff --git a/evidence/redis-comparison.json b/evidence/redis-comparison.json new file mode 100644 index 00000000..e118f730 --- /dev/null +++ b/evidence/redis-comparison.json @@ -0,0 +1,509 @@ +{ + "stage": "after", + "recorded_at": "2026-10-13T12:52:54.446Z", + "node": "v24.20.0", + "methodology": { + "requests": "real loopback HTTP; instrumented API process in measured backend image", + "sql": "pg.Client.query calls; transaction control counted separately", + "concurrency": 16, + "duration_seconds": 10, + "warmup_seconds": 3, + "repetitions": 3, + "seed_messages": 10000, + "cold_burst_requests": 32, + "writes_per_repeat": 512, + "resources": "process CPU/RSS includes HTTP generator and instrumentation; not container CPU", + "limitations": "closed loop, client and API share process/CPU; other Docker workloads share host resources; no capacity/SLA claim; fixtures bypass password KDF", + "comparison": { + "modes": [ + "redis", + "no-redis" + ], + "no_redis": "API started without CACHE_URL; all application Redis caches disabled", + "epochs": "PostgreSQL epochs and atomic CTE writes retained in both modes", + "order": "redis first in repeats 1/3, no-redis first in repeat 2", + "processes": "both API instances and HTTP generator share one measured Node process" + } + }, + "dist_sha256": { + "Chat/chat.service.js": "f0f8b0cd357dcbb2ba6f401e30dadfcf19ab0deb7c1a812b306126d0478289e2", + "cache/cache.service.js": "ec7c09ef55f9054176ace8c62a3690df6e717b54c36db9ef66b91bc34a761693" + }, + "dependencies": { + "@nestjs/core": "package metadata not exported", + "@prisma/adapter-pg": "package metadata not exported", + "pg": "8.23.1", + "ioredis": "6.0.0", + "fastify": "5.12.1" + }, + "samples": [ + { + "workload": "cold-history-burst:redis", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 1.837, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 17.42, + "latency_ms": { + "mean": 1530.045, + "p50": 1546.818, + "p95": 1755.189, + "p99": 1770.661 + }, + "sql_queries": 71, + "sql_per_request": 2.2188, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:users": 5, + "SELECT:chat_members": 32, + "SELECT:messages": 2 + }, + "process_cpu_percent_one_core": 86.19, + "peak_process_rss_mib": 319.89 + }, + { + "workload": "warm-history:redis", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.873, + "successes": 191, + "errors": 0, + "error_ratio": 0, + "successful_rps": 17.566, + "latency_ms": { + "mean": 890.11, + "p50": 663.435, + "p95": 2777.896, + "p99": 2907.685 + }, + "sql_queries": 414, + "sql_per_request": 2.1675, + "sql_calls": { + "SELECT:sessions": 191, + "SELECT:chat_members": 191, + "SELECT:messages": 14, + "SELECT:users": 18 + }, + "process_cpu_percent_one_core": 66.76, + "peak_process_rss_mib": 315.13 + }, + { + "workload": "writes-single-chat:redis", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 17.874, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 28.645, + "latency_ms": { + "mean": 555.497, + "p50": 399.725, + "p95": 1666.381, + "p99": 2243.938 + }, + "sql_queries": 1080, + "sql_per_request": 2.1094, + "sql_calls": { + "SELECT:sessions": 512, + "WITH:messages": 512, + "SELECT:users": 56 + }, + "process_cpu_percent_one_core": 81.97, + "peak_process_rss_mib": 336.75 + }, + { + "workload": "cold-history-burst:no-redis", + "repeat": 1, + "concurrency": 32, + "elapsed_seconds": 0.841, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 38.059, + "latency_ms": { + "mean": 763.242, + "p50": 770.663, + "p95": 829.822, + "p99": 830.022 + }, + "sql_queries": 128, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:users": 32, + "SELECT:chat_members": 32, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 91.64, + "peak_process_rss_mib": 337 + }, + { + "workload": "warm-history:no-redis", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 10.345, + "successes": 381, + "errors": 0, + "error_ratio": 0, + "successful_rps": 36.828, + "latency_ms": { + "mean": 430.415, + "p50": 421.069, + "p95": 734.11, + "p99": 820.689 + }, + "sql_queries": 1524, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 381, + "SELECT:users": 381, + "SELECT:chat_members": 381, + "SELECT:messages": 381 + }, + "process_cpu_percent_one_core": 85.89, + "peak_process_rss_mib": 337.75 + }, + { + "workload": "writes-single-chat:no-redis", + "repeat": 1, + "concurrency": 16, + "elapsed_seconds": 4.754, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 107.691, + "latency_ms": { + "mean": 147.905, + "p50": 100.917, + "p95": 466.346, + "p99": 610.975 + }, + "sql_queries": 1536, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 512, + "SELECT:users": 512, + "WITH:messages": 512 + }, + "process_cpu_percent_one_core": 128.47, + "peak_process_rss_mib": 338.37 + }, + { + "workload": "cold-history-burst:no-redis", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 0.286, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 112.082, + "latency_ms": { + "mean": 205.996, + "p50": 195.439, + "p95": 280.506, + "p99": 281.494 + }, + "sql_queries": 128, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:users": 32, + "SELECT:chat_members": 32, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 90.64, + "peak_process_rss_mib": 338.5 + }, + { + "workload": "warm-history:no-redis", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.489, + "successes": 393, + "errors": 0, + "error_ratio": 0, + "successful_rps": 37.468, + "latency_ms": { + "mean": 425.185, + "p50": 392.661, + "p95": 791.784, + "p99": 958.484 + }, + "sql_queries": 1572, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 393, + "SELECT:users": 393, + "SELECT:chat_members": 393, + "SELECT:messages": 393 + }, + "process_cpu_percent_one_core": 89.12, + "peak_process_rss_mib": 338.5 + }, + { + "workload": "writes-single-chat:no-redis", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 5.905, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 86.709, + "latency_ms": { + "mean": 182.799, + "p50": 137.282, + "p95": 388.273, + "p99": 791.35 + }, + "sql_queries": 1536, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 512, + "SELECT:users": 512, + "WITH:messages": 512 + }, + "process_cpu_percent_one_core": 82.53, + "peak_process_rss_mib": 338.75 + }, + { + "workload": "cold-history-burst:redis", + "repeat": 2, + "concurrency": 32, + "elapsed_seconds": 1.029, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 31.09, + "latency_ms": { + "mean": 918.771, + "p50": 972.749, + "p95": 1025.929, + "p99": 1026.358 + }, + "sql_queries": 92, + "sql_per_request": 2.875, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:users": 5, + "SELECT:chat_members": 32, + "SELECT:messages": 23 + }, + "process_cpu_percent_one_core": 61.08, + "peak_process_rss_mib": 338.75 + }, + { + "workload": "warm-history:redis", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 10.105, + "successes": 1978, + "errors": 0, + "error_ratio": 0, + "successful_rps": 195.742, + "latency_ms": { + "mean": 81.312, + "p50": 65.517, + "p95": 165.58, + "p99": 255.442 + }, + "sql_queries": 3956, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 1978, + "SELECT:chat_members": 1978 + }, + "process_cpu_percent_one_core": 117.29, + "peak_process_rss_mib": 340.5 + }, + { + "workload": "writes-single-chat:redis", + "repeat": 2, + "concurrency": 16, + "elapsed_seconds": 2.802, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 182.731, + "latency_ms": { + "mean": 86.914, + "p50": 72.205, + "p95": 174.511, + "p99": 249.039 + }, + "sql_queries": 1024, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 512, + "WITH:messages": 512 + }, + "process_cpu_percent_one_core": 116.33, + "peak_process_rss_mib": 339.81 + }, + { + "workload": "cold-history-burst:redis", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 0.145, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 220.143, + "latency_ms": { + "mean": 135.024, + "p50": 137.463, + "p95": 143.455, + "p99": 143.876 + }, + "sql_queries": 86, + "sql_per_request": 2.6875, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:users": 2, + "SELECT:chat_members": 32, + "SELECT:messages": 20 + }, + "process_cpu_percent_one_core": 167.65, + "peak_process_rss_mib": 339.81 + }, + { + "workload": "warm-history:redis", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.028, + "successes": 1620, + "errors": 0, + "error_ratio": 0, + "successful_rps": 161.555, + "latency_ms": { + "mean": 98.91, + "p50": 76.732, + "p95": 213.951, + "p99": 404.794 + }, + "sql_queries": 3240, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 1620, + "SELECT:chat_members": 1620 + }, + "process_cpu_percent_one_core": 102.71, + "peak_process_rss_mib": 340.31 + }, + { + "workload": "writes-single-chat:redis", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 3.011, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 170.063, + "latency_ms": { + "mean": 93.676, + "p50": 67.99, + "p95": 224.796, + "p99": 264.354 + }, + "sql_queries": 1024, + "sql_per_request": 2, + "sql_calls": { + "SELECT:sessions": 512, + "WITH:messages": 512 + }, + "process_cpu_percent_one_core": 99.05, + "peak_process_rss_mib": 340.43 + }, + { + "workload": "cold-history-burst:no-redis", + "repeat": 3, + "concurrency": 32, + "elapsed_seconds": 0.215, + "successes": 32, + "errors": 0, + "error_ratio": 0, + "successful_rps": 149.175, + "latency_ms": { + "mean": 204.462, + "p50": 206.7, + "p95": 213.436, + "p99": 213.79 + }, + "sql_queries": 128, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 32, + "SELECT:users": 32, + "SELECT:chat_members": 32, + "SELECT:messages": 32 + }, + "process_cpu_percent_one_core": 121.65, + "peak_process_rss_mib": 340.43 + }, + { + "workload": "warm-history:no-redis", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 10.072, + "successes": 937, + "errors": 0, + "error_ratio": 0, + "successful_rps": 93.032, + "latency_ms": { + "mean": 171.384, + "p50": 154.642, + "p95": 341.443, + "p99": 697.848 + }, + "sql_queries": 3748, + "sql_per_request": 4, + "sql_calls": { + "SELECT:sessions": 937, + "SELECT:users": 937, + "SELECT:chat_members": 937, + "SELECT:messages": 937 + }, + "process_cpu_percent_one_core": 99.34, + "peak_process_rss_mib": 340.93 + }, + { + "workload": "writes-single-chat:no-redis", + "repeat": 3, + "concurrency": 16, + "elapsed_seconds": 6.298, + "successes": 512, + "errors": 0, + "error_ratio": 0, + "successful_rps": 81.295, + "latency_ms": { + "mean": 191.411, + "p50": 155.363, + "p95": 410.542, + "p99": 517.121 + }, + "sql_queries": 1536, + "sql_per_request": 3, + "sql_calls": { + "SELECT:sessions": 512, + "SELECT:users": 512, + "WITH:messages": 512 + }, + "process_cpu_percent_one_core": 100.74, + "peak_process_rss_mib": 340.93 + } + ], + "correctness": { + "read_after_write": { + "redis:1": true, + "no-redis:1": true, + "no-redis:2": true, + "redis:2": true, + "redis:3": true, + "no-redis:3": true + } + }, + "completed": true, + "cleanup": "only experiment chats/user/cache prefix removed" +} diff --git a/jest.config.ts b/jest.config.ts new file mode 100644 index 00000000..82bea3de --- /dev/null +++ b/jest.config.ts @@ -0,0 +1,31 @@ +import type { Config } from 'jest'; +import { pathsToModuleNameMapper } from 'ts-jest'; +import ts from 'typescript'; + +const { config: tsconfig } = ts.readConfigFile( + './tsconfig.json', + ts.sys.readFile, +); +const paths = tsconfig?.compilerOptions?.paths ?? {}; + +const config: Config = { + moduleFileExtensions: ['js', 'json', 'ts'], + rootDir: '.', + testRegex: '.*\\.spec\\.ts$', + transform: { + '^.+\\.(t|j)s$': 'ts-jest', + }, + moduleNameMapper: { + ...pathsToModuleNameMapper(paths, { prefix: '/' }), + '^(\\.{1,2}/.*)\\.js$': '$1', + }, + collectCoverageFrom: [ + 'src/**/*.(t|j)s', + 'libs/**/*.(t|j)s', + 'apps/**/*.(t|j)s', + ], + coverageDirectory: './coverage', + testEnvironment: 'node', +}; + +export default config; diff --git a/nest-cli.json b/nest-cli.json new file mode 100644 index 00000000..f9aa683b --- /dev/null +++ b/nest-cli.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/nest-cli", + "collection": "@nestjs/schematics", + "sourceRoot": "src", + "compilerOptions": { + "deleteOutDir": true + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..afe0be2c --- /dev/null +++ b/package.json @@ -0,0 +1,75 @@ +{ + "name": "mtusi2026lab1-fork", + "version": "0.0.1", + "description": "", + "author": "", + "private": true, + "license": "UNLICENSED", + "scripts": { + "db:generate": "prisma generate", + "db:validate": "prisma validate", + "db:migrate": "prisma migrate dev", + "db:deploy": "prisma migrate deploy", + "test:persistence": "pnpm build && node --test test/persistence.mjs", + "test:cache": "pnpm build && node --test test/cache.mjs", + "test:resilience": "pnpm build && node --test test/resilience.mjs", + "test:pagination": "pnpm build && node --test test/message-pagination.mjs", + "prebuild": "pnpm db:generate", + "prestart:dev": "pnpm db:generate", + "prestart": "pnpm db:generate", + "pretest": "pnpm db:generate", + "build": "nest build", + "deploy": "nest deploy", + "format": "prettier --write \"src/**/*.ts\"", + "start": "nest start", + "start:dev": "nest start --watch", + "start:debug": "nest start --debug --watch", + "start:prod": "node dist/main", + "lint": "oxlint --type-aware src/", + "test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js", + "test:watch": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --watch", + "test:cov": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --coverage", + "test:debug": "node --inspect-brk --experimental-vm-modules -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand" + }, + "dependencies": { + "@fastify/static": "^10.1.4", + "@nestjs/common": "^12.0.1", + "@nestjs/core": "^12.0.1", + "@nestjs/platform-fastify": "12.0.1", + "@nestjs/swagger": "^12.0.1", + "@prisma/adapter-pg": "^7.10.0", + "@prisma/client": "^7.10.0", + "@scalar/nestjs-api-reference": "^1.2.19", + "dotenv": "^18.0.7", + "fastify": "5.12.1", + "ioredis": "^6.0.0", + "nestjs-pino": "^5.2.0", + "pg": "^8.23.1", + "pino-http": "^11.0.0", + "reflect-metadata": "^0.2.2", + "rxjs": "^7.8.1" + }, + "devDependencies": { + "@nestjs/cli": "^12.0.0", + "@nestjs/mau": "^0.2.6", + "@nestjs/schematics": "^12.0.0", + "@nestjs/testing": "^12.0.1", + "@types/jest": "^30.0.0", + "@types/node": "^24.0.0", + "@types/pg": "^8.23.1", + "@types/supertest": "^7.0.0", + "jest": "^30.0.0", + "oxlint": "^1.58.0", + "oxlint-tsgolint": "^7.0.2001", + "pino-pretty": "^13.1.3", + "prettier": "^3.4.2", + "prisma": "7.10.0", + "source-map-support": "^0.5.21", + "supertest": "^7.0.0", + "ts-jest": "^29.4.0", + "ts-loader": "^9.5.2", + "ts-node": "^10.9.2", + "tsconfig-paths": "^4.2.0", + "typescript": "^6.0.2" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 00000000..10e66cae --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,7698 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@fastify/static': + specifier: ^10.1.4 + version: 10.1.4 + '@nestjs/common': + specifier: ^12.0.1 + version: 12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/core': + specifier: ^12.0.1 + version: 12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@12.0.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/platform-fastify': + specifier: 12.0.1 + version: 12.0.1(@fastify/static@10.1.4)(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@12.0.4) + '@nestjs/swagger': + specifier: ^12.0.1 + version: 12.0.1(@fastify/static@10.1.4)(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@12.0.4)(reflect-metadata@0.2.2) + '@prisma/adapter-pg': + specifier: ^7.10.0 + version: 7.10.0 + '@prisma/client': + specifier: ^7.10.0 + version: 7.10.0(prisma@7.10.0(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(typescript@6.0.3))(typescript@6.0.3) + '@scalar/nestjs-api-reference': + specifier: ^1.2.19 + version: 1.2.19 + dotenv: + specifier: ^18.0.7 + version: 18.0.7 + fastify: + specifier: 5.12.1 + version: 5.12.1 + ioredis: + specifier: ^6.0.0 + version: 6.0.0 + nestjs-pino: + specifier: ^5.2.0 + version: 5.2.0(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@12.0.4)(pino-http@11.0.0)(pino@10.3.1)(rxjs@7.8.2) + pg: + specifier: ^8.23.1 + version: 8.23.1 + pino-http: + specifier: ^11.0.0 + version: 11.0.0 + reflect-metadata: + specifier: ^0.2.2 + version: 0.2.2 + rxjs: + specifier: ^7.8.1 + version: 7.8.2 + devDependencies: + '@nestjs/cli': + specifier: ^12.0.0 + version: 12.0.3(@types/node@24.13.6)(prettier@3.9.8)(ts-loader@9.6.2(typescript@6.0.3)(webpack@5.111.1))(webpack@5.111.1) + '@nestjs/mau': + specifier: ^0.2.6 + version: 0.2.8 + '@nestjs/schematics': + specifier: ^12.0.0 + version: 12.0.4(chokidar@5.0.0)(prettier@3.9.8)(typescript@6.0.3) + '@nestjs/testing': + specifier: ^12.0.1 + version: 12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@12.0.4)(@nestjs/platform-express@12.0.4) + '@types/jest': + specifier: ^30.0.0 + version: 30.0.0 + '@types/node': + specifier: ^24.0.0 + version: 24.13.6 + '@types/pg': + specifier: ^8.23.1 + version: 8.23.1 + '@types/supertest': + specifier: ^7.0.0 + version: 7.2.1 + jest: + specifier: ^30.0.0 + version: 30.5.2(@types/node@24.13.6)(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)) + oxlint: + specifier: ^1.58.0 + version: 1.83.0(oxlint-tsgolint@7.0.2002) + oxlint-tsgolint: + specifier: ^7.0.2001 + version: 7.0.2002 + pino-pretty: + specifier: ^13.1.3 + version: 13.1.3 + prettier: + specifier: ^3.4.2 + version: 3.9.8 + prisma: + specifier: 7.10.0 + version: 7.10.0(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(typescript@6.0.3) + source-map-support: + specifier: ^0.5.21 + version: 0.5.21 + supertest: + specifier: ^7.0.0 + version: 7.2.2 + ts-jest: + specifier: ^29.4.0 + version: 29.4.12(@babel/core@7.29.7)(@jest/transform@30.5.2)(@jest/types@30.5.1)(babel-jest@30.5.2(@babel/core@7.29.7))(jest-util@30.5.1)(jest@30.5.2(@types/node@24.13.6)(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)))(typescript@6.0.3) + ts-loader: + specifier: ^9.5.2 + version: 9.6.2(typescript@6.0.3)(webpack@5.111.1) + ts-node: + specifier: ^10.9.2 + version: 10.9.2(@types/node@24.13.6)(typescript@6.0.3) + tsconfig-paths: + specifier: ^4.2.0 + version: 4.2.0 + typescript: + specifier: ^6.0.2 + version: 6.0.3 + +packages: + + '@angular-devkit/core@22.1.8': + resolution: {integrity: sha512-34lsgg2FwMVBX7nR/ZqzRUcdvdYPvSB8XAEr2GudXAyZwLI9ehzfQlagAWR/gEb8p4uCFZW0r7uU0toxydq4Rw==} + engines: {node: ^22.22.3 || ^24.15.0 || >=26.0.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + peerDependencies: + chokidar: ^5.0.0 + peerDependenciesMeta: + chokidar: + optional: true + + '@angular-devkit/schematics-cli@22.1.8': + resolution: {integrity: sha512-SsGG8ompVzprmYE9sHi2L7DYZ+i1sD+YDfun6Rg2vkTCusejtD4SSGVxwuR6++dT22ZpN16OqUTmii/0bhE4xA==} + engines: {node: ^22.22.3 || ^24.15.0 || >=26.0.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + hasBin: true + + '@angular-devkit/schematics@22.1.8': + resolution: {integrity: sha512-Pv3cPa/44kvEwYcqwx4Ns5dhIDmcFNSHhbpheqiEG1Z/u4e2t4zHKDtE3eHZB+8o+IcC7xJj+d+AqGR44RoZDA==} + engines: {node: ^22.22.3 || ^24.15.0 || >=26.0.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + + '@babel/code-frame@7.29.7': + resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==} + engines: {node: '>=6.9.0'} + + '@babel/compat-data@7.29.7': + resolution: {integrity: sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==} + engines: {node: '>=6.9.0'} + + '@babel/core@7.29.7': + resolution: {integrity: sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==} + engines: {node: '>=6.9.0'} + + '@babel/generator@7.29.8': + resolution: {integrity: sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==} + engines: {node: '>=6.9.0'} + + '@babel/helper-compilation-targets@7.29.7': + resolution: {integrity: sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==} + engines: {node: '>=6.9.0'} + + '@babel/helper-globals@7.29.7': + resolution: {integrity: sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==} + engines: {node: '>=6.9.0'} + + '@babel/helper-module-imports@7.29.7': + resolution: {integrity: sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==} + engines: {node: '>=6.9.0'} + + '@babel/helper-module-transforms@7.29.7': + resolution: {integrity: sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-plugin-utils@7.29.7': + resolution: {integrity: sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-string-parser@7.29.7': + resolution: {integrity: sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-identifier@7.29.7': + resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-option@7.29.7': + resolution: {integrity: sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==} + engines: {node: '>=6.9.0'} + + '@babel/helpers@7.29.7': + resolution: {integrity: sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==} + engines: {node: '>=6.9.0'} + + '@babel/parser@7.29.9': + resolution: {integrity: sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==} + engines: {node: '>=6.0.0'} + hasBin: true + + '@babel/plugin-syntax-async-generators@7.8.4': + resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-bigint@7.8.3': + resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-class-properties@7.12.13': + resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-class-static-block@7.14.5': + resolution: {integrity: sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-import-attributes@7.29.7': + resolution: {integrity: sha512-zGYcYfq/WmZ4V+kBIXQon9dSSc8ircGZqw9ZaNhhGj9nZkeBu1jHLBDQqYYi5WA9uawvA2sIMbry2nCFhf5Djg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-import-meta@7.10.4': + resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-json-strings@7.8.3': + resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-jsx@7.29.7': + resolution: {integrity: sha512-TSu8+mHCoEaaCDEZ0I3+6mvTBYR4PCxQwf2z9/r5Tbztv6NaLR3B9thGTTxX2WGuGHJqRiAbKPeGTJ5XWXVg6A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-logical-assignment-operators@7.10.4': + resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3': + resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-numeric-separator@7.10.4': + resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-object-rest-spread@7.8.3': + resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-optional-catch-binding@7.8.3': + resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-optional-chaining@7.8.3': + resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-private-property-in-object@7.14.5': + resolution: {integrity: sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-top-level-await@7.14.5': + resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-typescript@7.29.7': + resolution: {integrity: sha512-ngr+82Sh0xMz25TPCZi+nC2iTzjfCdWS2ONXTp/PtSCHCgaCNBpdMqgvJ2ccdLlClVZ7sisIgB914j/JFe+RZA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/template@7.29.7': + resolution: {integrity: sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==} + engines: {node: '>=6.9.0'} + + '@babel/traverse@7.29.8': + resolution: {integrity: sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==} + engines: {node: '>=6.9.0'} + + '@babel/types@7.29.8': + resolution: {integrity: sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==} + engines: {node: '>=6.9.0'} + + '@bcoe/v8-coverage@0.2.3': + resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} + + '@borewit/text-codec@0.2.2': + resolution: {integrity: sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==} + + '@colors/colors@1.5.0': + resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} + engines: {node: '>=0.1.90'} + + '@cspotcode/source-map-support@0.8.1': + resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} + engines: {node: '>=12'} + + '@electric-sql/pglite-socket@0.1.3': + resolution: {integrity: sha512-LAciWM0M1dCL8hlsxu2venbVZcdxema0BtDfpWYVqr+Y468UADw0pFWidhKw1M8sfJ8rdLT71tjMmnirf/IZRQ==} + hasBin: true + peerDependencies: + '@electric-sql/pglite': 0.4.3 + + '@electric-sql/pglite-tools@0.3.3': + resolution: {integrity: sha512-AlzLJTRJ8+UFgK8CmxIpyIpJ0+YaFw02IiOSdYrqxwPXdSyeIShz8aa9Tq+tYFXdPwcaMp/Fc80mQZ1dkOQ/wg==} + peerDependencies: + '@electric-sql/pglite': 0.4.3 + + '@electric-sql/pglite@0.4.3': + resolution: {integrity: sha512-ichuWTgtd4mOM1G4SpyGJa5trT03lWbMypDV0fUXUCXg5hiHqVAz/bZyV68NqmkLB7WcYmj1RMJVSp8HV/v/ZQ==} + + '@emnapi/core@1.10.0': + resolution: {integrity: sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==} + + '@emnapi/runtime@1.10.0': + resolution: {integrity: sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==} + + '@emnapi/wasi-threads@1.2.1': + resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==} + + '@fastify/accept-negotiator@2.1.0': + resolution: {integrity: sha512-F3EVbzWt+xcnVaOHmWyIlpuFtbxOln7HDZQsh09MtMmMm/CipMayNt8hnIL8VQi54u2ZociDbf+iluGYkf7B1A==} + + '@fastify/ajv-compiler@4.0.6': + resolution: {integrity: sha512-NtuzM0SfaMJbGlnjr9LWQUN5LzgSrbB8tf/wRZNas+4E1O/Nmzl53e7ruT61HDZyRCJGC6FxIogmNZO1c5ETBA==} + + '@fastify/cors@11.3.0': + resolution: {integrity: sha512-ggQGua+xHv1MvePbPr0v//xLYEsCXbWspquXCJS9Ot5YoRXq8J8ZWzHnxDBVnbtXosvistXo6LtNzOJswf64Fw==} + + '@fastify/error@4.2.0': + resolution: {integrity: sha512-RSo3sVDXfHskiBZKBPRgnQTtIqpi/7zhJOEmAxCiBcM7d0uwdGdxLlsCaLzGs8v8NnxIRlfG0N51p5yFaOentQ==} + + '@fastify/fast-json-stringify-compiler@5.1.0': + resolution: {integrity: sha512-PxcYtKLbQ8Z+yApiqjK8FwxIwvEj38k2OiLc17u8dkJSlmfi2wHHPaSnaoqBPQqtvF8YVsDgDpP2snDCfFrpfw==} + + '@fastify/formbody@9.0.0': + resolution: {integrity: sha512-T/af26CSrUARBCvsEmv+DJLPfZlrRKESzqironxP1j7qzuLyKcoZtj6MuTGShuKx1THXugoie2oFbUJxXfGFzA==} + + '@fastify/forwarded@3.0.2': + resolution: {integrity: sha512-NE8HgKLgYejV9lDpqkEFaDKMLYelJBVfHekhB0UKvX0ghagXRJqg68feg8er1NPXxG4N9i6vPxzt8E+3wHfcmA==} + + '@fastify/merge-json-schemas@0.2.1': + resolution: {integrity: sha512-OA3KGBCy6KtIvLf8DINC5880o5iBlDX4SxzLQS8HorJAbqluzLRn80UXU0bxZn7UOFhFgpRJDasfwn9nG4FG4A==} + + '@fastify/proxy-addr@5.1.1': + resolution: {integrity: sha512-zv07Y9GEuDsJPegZoDFd4SDWaZOW8N2pa0GSrYmKpId/tjt1Hgo3BjZBVjdVpfVrHaA+Qv5jawtS2O50J5xM9g==} + + '@fastify/send@4.1.1': + resolution: {integrity: sha512-BYo+EiaKwlxH+WetGk6hAs1d39iP0y1gqB8lGF/qwkJ9ZZ/cBY1vx5NvExb9Sc3yRMFjD5X4Eyh4e4+TzRkzdw==} + + '@fastify/static@10.1.4': + resolution: {integrity: sha512-YWYmXV0c3t/3DDyV32kRXJTgTY16FOkqtQ4mmBjbkWeukGR5n+Sr+7ppknNpS7hiRPrLU9zcySZZ1nLJVHTZkg==} + + '@inquirer/ansi@2.0.8': + resolution: {integrity: sha512-WpQM+Ti6Z40EFwwt+uL2p4UabT+W179zHp6HhLVOzfbwnVn05IPO/eXIZXGNqcT1jbQ15SujNLzQ39k4QPPxBQ==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + + '@inquirer/checkbox@5.2.5': + resolution: {integrity: sha512-bRt8J8m+Fot9CXv+zNQGXUq2ET0MggR1fPz7v6edN6MFYmsbfGnMmkmWZJEegMKqrAC8ej/o1sqisHZXZJMAfQ==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/confirm@6.3.2': + resolution: {integrity: sha512-Xvr/0HggjddPtGppuqVmxhTw+Hr8PvsZ/k0HmOEaAqQEt80OITNkFWnsdNmyT0/eM4Ab+iJLx2R8rctlEyfSVg==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/core@12.0.3': + resolution: {integrity: sha512-wsSy0sznmXwkty+2PzZwx00Cazc/E0r0B7mAzdGROz2Ct+DFZXaK7WDjGZvgjRldxH5ZhFVfF2lgkYrqgOw2KA==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/editor@5.3.3': + resolution: {integrity: sha512-YsKkS2q63IiLtaDK/9nqzdComN97SDQrmKiyNggN+ceP4ty+Z6VwyTz3FpjeUWeW1Efss2xHFKCC9sx7hnrsxg==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/expand@5.1.5': + resolution: {integrity: sha512-uHuXLmXW+TtIfT/9vSBotypAkqn1n34Ul+CLGPos/xANyO4Ff5xZzkYhbKR4NEcfVK4a9mHQOpwVZzluSHFRGw==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/external-editor@3.0.5': + resolution: {integrity: sha512-f3QQJRIX5ZEneBHNUIuPjmbdzHnmRFJA8r2dkcb8q+OM5Uv5KtnuAttQumnrjcBVBM3mcTX1CkmtAkU58VRZxg==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/figures@2.0.9': + resolution: {integrity: sha512-EAWgUTGQ/Umgga51dE3B2PUHbufuXarDfg86uVgoSgNHNNQnyFKcOrQLWVqYMghuSyHh8+2HUH0Js9cTC1WAdg==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + + '@inquirer/input@5.1.6': + resolution: {integrity: sha512-HtcJhB2QFVXbLuJ5S3syhNbTUVxYvwqV4VRBDkQceBloC9bmTViUoRFP5PbSaDZb3HzfPmpuU/gG4ybVBz4FHA==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/number@4.2.3': + resolution: {integrity: sha512-6Yuwh1NGSbu1Lo4N1EWjXs1jKRntLg/ZCwhmeorEHde90v1XxAozdbd4Iu30eOQLW+6h1hp2O9ujNfLSbTPJnA==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/password@5.2.2': + resolution: {integrity: sha512-W9zYdyzogK+6110mqwaSJWCBu2yA5Q/OfnGSjjZB1bNpHlmUozXxTl0+QOZBNeVd6Qo81/qT75gW05gLAtITxw==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/prompts@8.5.2': + resolution: {integrity: sha512-IYR/3C/paEVVQYQvdDlFZVjRCJVYHHON0XXMH91KO9GSxs0TdKYWlUdvfQl2EfAHDxUaN3IBffkE/BDTh5nJ6g==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/prompts@8.7.2': + resolution: {integrity: sha512-QoRB4wFIjgH5iOhSjoIKMkTvSHDuV+O3OITlIqAYO0oK5x364GJILXiMBvlPiE+klg7Xx9tq5XVqQHcGUDYYPA==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/rawlist@5.3.5': + resolution: {integrity: sha512-1oHky1ONfCOwNrnkQGDE1oaSij/3fI6HFMSf2H/WsGO2lEyDX9My82iggITSy9ddSZ8yk8j9v41OI0fVoSIoaA==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/search@4.3.3': + resolution: {integrity: sha512-fyuIU1Nbpvwlikjg3gXwJFDI11+EFjqQ7P+iByfmivIKQ1vmaykNrD/vy5unHuUqUpsOsnvJ25//tPF7E/RBRA==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/select@5.2.5': + resolution: {integrity: sha512-9kc15hr8r/kI+3DO/xLog5nOzTz1jqsHXa6JBFzmQKhkoJ8Slda1I1L/uD8ZSZ9tF1yp79wwXe7mclvX1rqR2Q==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@inquirer/type@4.1.1': + resolution: {integrity: sha512-yJoHYrMnxIsJZCY+0Vb66Dy3he3kL3e2wOBKhoSwWWAzZAY82emlxwgprCtp6yRixvNRNq9ztfRWQYPNr3Go7A==} + engines: {node: '>=23.5.0 || ^22.13.0 || ^20.17.0'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + + '@ioredis/commands@2.0.0': + resolution: {integrity: sha512-vrx0AE/T0h7cRZwfo1M39Cr+ZhZrkf0V8mQN75wucKCxCLD9l/VX6no3gFvrLqD1IlG/1LtzWovqEw3t0Vr9zg==} + + '@isaacs/cliui@8.0.2': + resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} + engines: {node: '>=12'} + + '@istanbuljs/load-nyc-config@1.1.0': + resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} + engines: {node: '>=8'} + + '@istanbuljs/schema@0.1.6': + resolution: {integrity: sha512-+Sg6GCR/wy1oSmQDFq4LQDAhm3ETKnorxN+y5nbLULOR3P0c14f2Wurzj3/xqPXtasLFfHd5iRFQ7AJt4KH2cw==} + engines: {node: '>=8'} + + '@jest/console@30.5.2': + resolution: {integrity: sha512-e8sQC4pCMHPBrPX7Hk8TJr+DM5dkUnImSTNag8SEWFAFAF6xIz4AJvCKapnrdHnZxep4bxw4PhG+ZbimYBMyKw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/core@30.5.2': + resolution: {integrity: sha512-/jqvFWoJF7LV1a6AUpYMbMm+2yIYsHJfR474H0SCzr9k8tnO/jl9wRg6zSG6lxgf6EozNlCG4amFzWsbZSvvZA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + '@jest/diff-sequences@30.5.0': + resolution: {integrity: sha512-OsqBjHXCn8cadasoAZBP6nWYvMsRhpMzGXTpxJ5aO04NlbdhIz+FVe3q49l0AwVhsz/cEmIpBes6gAFl1/dWQg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/environment@30.5.2': + resolution: {integrity: sha512-nwFPOUMbmsjNNRCpnJpB9HbSZu4C07wDDds++5j+j1MezzPLxMPDdbdUVjr2o4RULDOValnDd70taPFI1EtxAg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/expect-utils@30.5.2': + resolution: {integrity: sha512-d/HOLSrJUlBIl6n3LzOa7cjW3xdePm5H5gQw2lixZ/0h157l9sw3mLblzFqnPcTbhDzhRQdBOX3A3KcG73nm5Q==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/expect@30.5.2': + resolution: {integrity: sha512-2E+1Pg6jJxbRjLNLpciC71iri/3qsKJL222/aXJEFwC0VdUSvfS+JZQQLEVjUYYc8t8pQu2MGE3cF2+bNTYRsg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/fake-timers@30.5.2': + resolution: {integrity: sha512-GKk0h0tKT5SpDPxDhPg3r9mm5s8/YCBzVNMOGdRiQXwUiMsjU10mVPlMaQstH6/cu50vOb8N9oQUMETHuwwxKw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/get-type@30.5.0': + resolution: {integrity: sha512-9/2VUPitAjmBzbvDvqrxmvB7BzWsBW0WmkkojX1ODuxX1NLGxx9gfaZpHB0z8DtJ9uhGNmZG/VXBhf8uO0OV8Q==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/globals@30.5.2': + resolution: {integrity: sha512-62zfS+dL+M5aTNHXCNLyqD+j4oqxTIzDYrZbpqMP8Yn+gvlAGyzC6BSPNb1ZmFOakV1RtFYX/O3FCQXSWmQdgg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/pattern@30.5.0': + resolution: {integrity: sha512-HdNQYSdRTEBNrginaqzQtTjG0HRMfrra/z6Ok7uL3S87vSlarIVohEsJsSj5edu3MiHoHjAkvPROz5ZjoKai+w==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/reporters@30.5.2': + resolution: {integrity: sha512-ev6E9iG73twQcfAfoTnviuYkr3yOrYbzAtMFCimv2fxHXPIp9PBt2u1wNMt0aYWgl8FPwIcS8oqRJg6alnht4Q==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + '@jest/schemas@30.5.0': + resolution: {integrity: sha512-/hunigyNpc4RCjC0VaW3f5RCUZVM2+WQ65qP7z083Gmvac7or2LI50XVNOtE4YPgBpV0yxYiAgorAPGniCoJmg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/snapshot-utils@30.5.1': + resolution: {integrity: sha512-V3wnxNtiVmw5PPVg433Cn3VdXnsOeu/ofLw3KC04Bn2y1wIlU5kozXQn48rhrgj/02LrCVtntTEF1yBha0XSUw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/source-map@30.5.2': + resolution: {integrity: sha512-c5CehvkbfHX6yyNg7bMn2ylqlp9AHXuZ/3hPH/Lh5bxD/vefd/lV9HBjMqXef9yQNqkdwyZvkLSVSwB38hy8Qw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/test-result@30.5.2': + resolution: {integrity: sha512-eO6YU5rsLfs60ne694e0IAmRgeBnoA8mu0nlxXDbl/1j5km0o2vO9/VbbUIKIH+WRKKEI+ELgwraRGn2Lhep8g==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/test-sequencer@30.5.2': + resolution: {integrity: sha512-bmij8jZyYAC47ExT2GeP7PcrlwSNS+Bp3KeRuBH88gpcxqDv6fljN8PemS4J/lLZ79xb6mpaennQTTq0zUAVVg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/transform@30.5.2': + resolution: {integrity: sha512-LBGwmaE886C41jDZ65eqR1YbXM7642MK3ZhTowZd5+xDlrDLuf4ePuDdDmVSvcr8NTVJ3MqxLkMbUCzuigUaoQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/types@30.5.1': + resolution: {integrity: sha512-LvVYn83nnXPl+Rg98nvcFgjx6nRMTArhSn6RAX/w3ELn54S8A42TYZvsCMdGUqTM8S0wyXbtlQdU6Hi6dykj9g==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jridgewell/gen-mapping@0.3.13': + resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} + + '@jridgewell/remapping@2.3.5': + resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/source-map@0.3.11': + resolution: {integrity: sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==} + + '@jridgewell/sourcemap-codec@1.6.0': + resolution: {integrity: sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==} + + '@jridgewell/trace-mapping@0.3.31': + resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + + '@jridgewell/trace-mapping@0.3.9': + resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + + '@lukeed/csprng@1.1.0': + resolution: {integrity: sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==} + engines: {node: '>=8'} + + '@lukeed/ms@2.0.2': + resolution: {integrity: sha512-9I2Zn6+NJLfaGoz9jN3lpwDgAYvfGeNYdbAIjJOqzs4Tpc+VU3Jqq4IofSUBKajiDS8k9fZIg18/z13mpk1bsA==} + engines: {node: '>=8'} + + '@microsoft/tsdoc@0.16.0': + resolution: {integrity: sha512-xgAyonlVVS+q7Vc7qLW0UrJU7rSFcETRWsqdXZtjzRU8dF+6CkozTK4V4y1LwOX7j8r/vHphjDeMeGI4tNGeGA==} + + '@napi-rs/wasm-runtime@1.2.4': + resolution: {integrity: sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g==} + engines: {node: ^20.19.0 || ^22.13.0 || >=23.5.0} + peerDependencies: + '@emnapi/core': ^1.7.1 || ^2.0.0-alpha.4 + '@emnapi/runtime': ^1.7.1 || ^2.0.0-alpha.4 + + '@nestjs/cli@12.0.3': + resolution: {integrity: sha512-HofsPoiWsx6gZ7/IivaZJrgsq/3CTCb4FkCQzFu/Q3J2V+4xC7GYnit/HNB66EfuY8j3gWJCzasMKmF5VugmOA==} + engines: {node: '>= 20.11'} + hasBin: true + peerDependencies: + '@rspack/core': ^1.7.7 || ^2.1.10 + '@swc/cli': ^0.8.0 + '@swc/core': ^1.15.18 + fork-ts-checker-webpack-plugin: ^9.1.0 + ts-loader: ^9.5.4 + tsconfig-paths-webpack-plugin: ^4.2.0 + webpack: ^5.105.4 + webpack-node-externals: ^3.0.0 + peerDependenciesMeta: + '@rspack/core': + optional: true + '@swc/cli': + optional: true + '@swc/core': + optional: true + fork-ts-checker-webpack-plugin: + optional: true + ts-loader: + optional: true + tsconfig-paths-webpack-plugin: + optional: true + webpack: + optional: true + webpack-node-externals: + optional: true + + '@nestjs/common@12.0.4': + resolution: {integrity: sha512-maEf5KhcQMCXQW9/SsLDDoFO0l73sbwBmiaCRrkqrFHyNG9ekN8CoYbzcvlboNKgiydWx8pogoFnuOEl8+7+tw==} + peerDependencies: + class-transformer: '>=0.4.1' + class-validator: '>=0.13.2' + reflect-metadata: ^0.1.12 || ^0.2.0 + rxjs: ^7.1.0 + peerDependenciesMeta: + class-transformer: + optional: true + class-validator: + optional: true + + '@nestjs/core@12.0.4': + resolution: {integrity: sha512-3jd8RaYxYAs8OxjHdTOgxmS9vUm3I9JFnRrgBxdQAVbHjyRx/QYiGnuVCmuUBm4AOHPMij/I74xfg8En3Erm7A==} + engines: {node: '>= 20'} + peerDependencies: + '@nestjs/common': ^12.0.0 + '@nestjs/microservices': ^12.0.0 + '@nestjs/platform-express': ^12.0.0 + '@nestjs/websockets': ^12.0.0 + reflect-metadata: ^0.1.12 || ^0.2.0 + rxjs: ^7.1.0 + peerDependenciesMeta: + '@nestjs/microservices': + optional: true + '@nestjs/platform-express': + optional: true + '@nestjs/websockets': + optional: true + + '@nestjs/mapped-types@12.0.0': + resolution: {integrity: sha512-aX7lxZcqXldtnSr0bgT2ZPQvpTpIwBMW1GMX29o4s3q02vmq6JoTYuPW0GwYXa8BiFMRX7WbGZVDA703pNqOMQ==} + engines: {node: '>=20.19.0'} + peerDependencies: + '@nestjs/common': ^10.0.0 || ^11.0.0 || ^12.0.0 + class-transformer: ^0.4.0 || ^0.5.0 + class-validator: ^0.13.0 || ^0.14.0 || ^0.15.0 + reflect-metadata: ^0.1.12 || ^0.2.0 + peerDependenciesMeta: + class-transformer: + optional: true + class-validator: + optional: true + + '@nestjs/mau@0.2.8': + resolution: {integrity: sha512-nIb0i3c/KhKEbxZfYMEKv9Mcvk5miBdZcexnvkgnAUhoMO2BUjOGT+Khf2cZzu7B51Y7v01NG2JVl/HdQEUQ6w==} + engines: {node: '>= 20.0.0'} + hasBin: true + + '@nestjs/platform-express@12.0.4': + resolution: {integrity: sha512-oL6zHjeMeqwKoAlY1Y+bpCfFy6Yat6wfWnmcTgp7IE3A6TAftu6Vgu/eRi9VY5bErw4dMcYGtzvxvKP1QXr8JA==} + peerDependencies: + '@nestjs/common': ^12.0.0 + '@nestjs/core': ^12.0.0 + + '@nestjs/platform-fastify@12.0.1': + resolution: {integrity: sha512-LqR0kOahuZAei3wJK+SJfHc9o9H/OSdA7gMSMaW+Kfjy6GtpTNPdfpHeq3w2PuiPgUGk2QIX/dqUAYntJ5arSw==} + peerDependencies: + '@fastify/static': ^10.1.2 + '@fastify/view': ^10.0.0 || ^11.0.0 || ^12.0.0 + '@nestjs/common': ^12.0.0 + '@nestjs/core': ^12.0.0 + peerDependenciesMeta: + '@fastify/static': + optional: true + '@fastify/view': + optional: true + + '@nestjs/schematics@12.0.4': + resolution: {integrity: sha512-iUQkaQKoKmcUgu0TZQwDnlHXs8RgeIf3Tzay6s8lfANtmu/3SQZFzg7eXbB/I2iN4I/nnngQb2Pnr3mqQRW7kw==} + engines: {node: ^22.22.3 || ^24.15.0 || >=26.0.0} + peerDependencies: + prettier: ^3.0.0 + typescript: '>=6.0.0' + peerDependenciesMeta: + prettier: + optional: true + + '@nestjs/swagger@12.0.1': + resolution: {integrity: sha512-fQ0WyutSSHedO9HzSkOFKFaRygYNGBno5EggcZljs+KL8tHzPPTO5oyJpaf3BoOKFGGsN/0B13EbIpH2pkPx8g==} + engines: {node: ^20.19.0 || >=22.12.0} + peerDependencies: + '@fastify/static': ^8.0.0 || ^9.0.0 || ^10.0.0 + '@nestjs/common': ^12.0.0 + '@nestjs/core': ^12.0.0 + class-transformer: '*' + class-validator: '*' + reflect-metadata: ^0.1.12 || ^0.2.0 + peerDependenciesMeta: + '@fastify/static': + optional: true + class-transformer: + optional: true + class-validator: + optional: true + + '@nestjs/testing@12.0.4': + resolution: {integrity: sha512-cL1vfg0VyEd1cHEge6gcppLsptYiCYRxjseuvelIX++ddgzeg9hIQQdg0sT7CJrBIJxI1dt6+7PW6NHbl3laYQ==} + peerDependencies: + '@nestjs/common': ^12.0.0 + '@nestjs/core': ^12.0.0 + '@nestjs/microservices': ^12.0.0 + '@nestjs/platform-express': ^12.0.0 + peerDependenciesMeta: + '@nestjs/microservices': + optional: true + '@nestjs/platform-express': + optional: true + + '@noble/hashes@1.8.0': + resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} + engines: {node: ^14.21.3 || >=16} + + '@oxlint-tsgolint/darwin-arm64@7.0.2002': + resolution: {integrity: sha512-E3yYb/tI+5M3SqGgKwrwUD0nmjA2FMGD1xFbma46qi8Y7+nPTlGY6bZk/hqxijc9Vda/tdtUxQ2d5zGIEX9qlg==} + cpu: [arm64] + os: [darwin] + + '@oxlint-tsgolint/darwin-x64@7.0.2002': + resolution: {integrity: sha512-qEaMySdvzs8faaJwMO4dFtPFCa+degFCz+HbkFQ0REcIJqJ16KmC0smt30FAI9TeEHCoAtz6sU/6acJvi4uaxg==} + cpu: [x64] + os: [darwin] + + '@oxlint-tsgolint/linux-arm64@7.0.2002': + resolution: {integrity: sha512-bqPObCNIR6tDQSc0Xn9Nu7EfWRXFB+qFzADRl/q6YA8zT9YUg3pGUbmicV2hV91uLpiot74so9ocGjx35SaX6w==} + cpu: [arm64] + os: [linux] + + '@oxlint-tsgolint/linux-x64@7.0.2002': + resolution: {integrity: sha512-E5CcRALAYdiQMbdYjEqlLOiYuEdt21RtXiyxIoD8bfypdfkpWppacijKOR4i0DtLXFRVwCGQggZBWk5bOIpU1A==} + cpu: [x64] + os: [linux] + + '@oxlint-tsgolint/win32-arm64@7.0.2002': + resolution: {integrity: sha512-L+ul0ZFDiz/ZmTwCQ1J/qS7S6s45ktiaFqb+ZIzx+1sSdtdRxm8/H0+p4VDQYrCKBFzKNb6VjUlm48bNEe3BUg==} + cpu: [arm64] + os: [win32] + + '@oxlint-tsgolint/win32-x64@7.0.2002': + resolution: {integrity: sha512-zkZeJfo4UmYiCzj77u85eCDpdxOiQiSAsV6j9Pvj5e7Vu5+MvwLtK1xmVutE77tJmUJ3eBOSXHR6WgY4AwHHGQ==} + cpu: [x64] + os: [win32] + + '@oxlint/binding-android-arm-eabi@1.83.0': + resolution: {integrity: sha512-0yGY24EwsLk5YDe6F+VkmZyRHSwJDALa3nIrPpq7FXmp2lV2d0TzvBCGeZk+wgiULRGr5blhyr4QMp5KCXJUqA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxlint/binding-android-arm64@1.83.0': + resolution: {integrity: sha512-hHfJ0vc17A4iUjH5p9BsTUPYbYRNxGpvD2lbu1aBRk54bzNIx9o5TtYF39QPZcV95DagZd+4DEAw2RH3G2ZsMg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxlint/binding-darwin-arm64@1.83.0': + resolution: {integrity: sha512-hsOjYjszLb/3zym/TkzUMPAoQlTJcuzSyEPOAyA+skXJIX9M0o+4JfOtqopX/Vf4hSLrJ98j0nvFo23gzk8auQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxlint/binding-darwin-x64@1.83.0': + resolution: {integrity: sha512-mjh5oH2EA+wl5yRJYT9K9G61O2zFlpuv+yf2JwZOi0+dq2FnTUtm1h8i+5Ik0fXPWIu/k84I1psZR9aQsLAnyA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxlint/binding-freebsd-x64@1.83.0': + resolution: {integrity: sha512-fNHr64/YaO8YssuoDVC8+F4Uk5enR86q5uxfHkQrjAPs1dbAILOrD2uaud+J7MO8Fx774g44ERLD0IGIvZE48w==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxlint/binding-linux-arm-gnueabihf@1.83.0': + resolution: {integrity: sha512-Qpwy3zzAwMj+8/lyYItHmkSMwbkprFNWTK7jPYDOxSyxEhaSLOWYUTCMkjF334J8/WD0nznCCsoBbIH6hpsuIw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm-musleabihf@1.83.0': + resolution: {integrity: sha512-s+BirYLFq7JL2k9sP0XI3ZXJ9dYvJ8sX3jLCLoag7tt+zrSHpZxP0jqznfL+Gdgwu7ay0dYgGYJXrQvq3iWloA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm64-gnu@1.83.0': + resolution: {integrity: sha512-7lihXt3vKr+GIyapNbHrnFHm/biiW30le6Zv/DExbAFPF6YwCQXVFlONPFehxs0CpGO4CBfYPM9rdDT+XMoIlg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@oxlint/binding-linux-arm64-musl@1.83.0': + resolution: {integrity: sha512-q63JalLYVkZiZvls1z3PPUnpmQluOMXp0khqQMznCeAPLGydfNY8JhvuA4WlK57JfrvikU8wB5lPVveqpIXvew==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + + '@oxlint/binding-linux-ppc64-gnu@1.83.0': + resolution: {integrity: sha512-krQmDF+dRbxvdqVPV88ZuOoPPu8X5BuqDA8Hd+qcS4YMRQCb+nexA57DazgGsc/rGdKBe3QmV0mnv0bdpW/p5g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + + '@oxlint/binding-linux-riscv64-gnu@1.83.0': + resolution: {integrity: sha512-MmOl8Y6txEAXZU1RG8Rr264jQ6D7VPmqFsU/45x/FeWsGe32hklTqGrLE6UxHzp5Rjt0wP+20tY8YXKgSFB3mw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + + '@oxlint/binding-linux-riscv64-musl@1.83.0': + resolution: {integrity: sha512-u1rMymh0W3JZkq370kzQsYPULGWqhE09pZRqnZvUSoYaI9pVO5yVX+iYIslmWuEgwuzH9YAaOsScJiobWCHoOw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + + '@oxlint/binding-linux-s390x-gnu@1.83.0': + resolution: {integrity: sha512-y0zK3HNwGysu7rqtE+BQG/d0bx5gh/KwlOtghN8oWeK1KcWzeaLqtZrbm8owqdma1lFyrce/hTO5ismuNu+INQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + + '@oxlint/binding-linux-x64-gnu@1.83.0': + resolution: {integrity: sha512-rS5gM0NgD7ngmuJmbIehsidtrOwKkLFwCQbKEeb9KuyQrrWNq5Zkn0uV6AYdXOMJ0grrWEiLwBuvMxt8w5vsNw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@oxlint/binding-linux-x64-musl@1.83.0': + resolution: {integrity: sha512-W2IH4EtpcPaWcvNGCA95YoDg4vxqE/ZiPCi3arrxEEpsK7+JQN9WYwrlYFx9pcdP6KPXqRqkv3zdQPHcx7b6YQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + + '@oxlint/binding-openharmony-arm64@1.83.0': + resolution: {integrity: sha512-6LyKkUyoajssTPLlZmDbZIbu4IZ5B4bGuRUnBgCGpEvHP3FQMaYITncHA/unPUo7q+Z+pIu2HhdkQ+8d1SG7iA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxlint/binding-win32-arm64-msvc@1.83.0': + resolution: {integrity: sha512-Uz/fObEtF0jmNJQJ8CGRBKfefYstS0/wjD3s6IGzP8nUwsJykHQJBiN3npHwKiGRGn/vvBEgNr4B3cCzmmatvg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxlint/binding-win32-ia32-msvc@1.83.0': + resolution: {integrity: sha512-u7XcvPW6Bk58tY5iWs2ESb0vJjoE/kuSpHxopbwp/p3ZtWVQXZ6wor5w3ssVTHOqd/v8b+QdhSFWQ4grEUNWpA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxlint/binding-win32-x64-msvc@1.83.0': + resolution: {integrity: sha512-LZRubd7ph13QmAg4fFecTYVZkiYbROR2Htaxh/ufWRkDhPOm2wrwaEYR89e0YpPFD3dqBrPoxS7myBw5hmYA7Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@paralleldrive/cuid2@2.3.1': + resolution: {integrity: sha512-XO7cAxhnTZl0Yggq6jOgjiOHhbgcO4NqFqwSmQpjK3b6TEE6Uj/jfSk6wzYyemh3+I0sHirKSetjQwn5cZktFw==} + + '@parcel/watcher-android-arm64@2.6.0': + resolution: {integrity: sha512-trgpLSCKRC/huFjXX/Smh+0sWe4+YtKfktIToiMl59ghz7z+qkH6kMvNnUbLyRs9N11t8l4svSCs1+5B3rOAhA==} + engines: {node: '>= 10.0.0'} + cpu: [arm64] + os: [android] + + '@parcel/watcher-darwin-arm64@2.6.0': + resolution: {integrity: sha512-Y3QV0gl7Q1zbfueunkWIERICbEojQFCgpyG7YqOGNFLsckXyI1xu9mAIUpKY9QBYzBtSkN8dBPwd3yiAO9ovMw==} + engines: {node: '>= 10.0.0'} + cpu: [arm64] + os: [darwin] + + '@parcel/watcher-darwin-x64@2.6.0': + resolution: {integrity: sha512-Ohv6OpzhUfKYD7Beb8kDvG0jbIxORCYY1JRdZnaBtnjjkJxgD7ZVL0nw2sCYd0yTMKTvz3nnTnOF3cDifK+kvw==} + engines: {node: '>= 10.0.0'} + cpu: [x64] + os: [darwin] + + '@parcel/watcher-freebsd-x64@2.6.0': + resolution: {integrity: sha512-5HmXvDgs8VK+74jF9y9/2FE3/OnlcKmc56tjmSrEuZjpSZOGL+fvAu+HKJBdPs9uwoP2hE6TlSUpXZ/C5jUFmQ==} + engines: {node: '>= 10.0.0'} + cpu: [x64] + os: [freebsd] + + '@parcel/watcher-linux-arm-glibc@2.6.0': + resolution: {integrity: sha512-Ps/hui3A+vMbjdqlqAowK2ZL8+BO8dBjxeWXj6npTBs3jx4wWmbPpaLuqwrQrSqIVMCnpWo238bJ1U37GhQOYg==} + engines: {node: '>= 10.0.0'} + cpu: [arm] + os: [linux] + + '@parcel/watcher-linux-arm-musl@2.6.0': + resolution: {integrity: sha512-9c6AUHgHoG+IY88MRIHupztQiQnrbqHYQjkM2btA+Bf/wQnQMuiD0Wfk1EVv3TlNT3x41uU71rn6E4xh/+zvkw==} + engines: {node: '>= 10.0.0'} + cpu: [arm] + os: [linux] + + '@parcel/watcher-linux-arm64-glibc@2.6.0': + resolution: {integrity: sha512-yHRqS2owEXe6Hic9z6Mh1ECsCd+ODVOGvZDyciqRd21+v+o+DnXMOrw50DSpIG2sb8GPEaPPmfeCAWKPJdq46g==} + engines: {node: '>= 10.0.0'} + cpu: [arm64] + os: [linux] + + '@parcel/watcher-linux-arm64-musl@2.6.0': + resolution: {integrity: sha512-WhB2e/V7rqdHHWZusBSPuy5Ei8S6lSz6FE5TKKQz5h3a0O+C+mhY7vxU9b/stqvMb8beLnPY82ZrFTLKs+SrKA==} + engines: {node: '>= 10.0.0'} + cpu: [arm64] + os: [linux] + + '@parcel/watcher-linux-x64-glibc@2.6.0': + resolution: {integrity: sha512-ulGE6x6Oz6iAwg75T8YQSoguBWasniIbX+QWpaYPcCnDOpdWX3k+4xbEYPZVLxOuoJI+svJJPD3sEj8G7lrQ3A==} + engines: {node: '>= 10.0.0'} + cpu: [x64] + os: [linux] + + '@parcel/watcher-linux-x64-musl@2.6.0': + resolution: {integrity: sha512-tkBYKt7YQrjIJWYDnto2YgO8MRkjlMTSNoRHzsXinBqbLdeOM3L32wPZJvIZxqaLMfSlS/4sUjH/6STVP/XDLw==} + engines: {node: '>= 10.0.0'} + cpu: [x64] + os: [linux] + + '@parcel/watcher-win32-arm64@2.6.0': + resolution: {integrity: sha512-gIZAP23jaHjGWasY/TY6yL7NHFClf0Ga7FN+iINvk+KN94rhm94lYZhFsbYFNcA04/onvGD9kKmiJLJB2HbNwQ==} + engines: {node: '>= 10.0.0'} + cpu: [arm64] + os: [win32] + + '@parcel/watcher-win32-x64@2.6.0': + resolution: {integrity: sha512-cA+/pXV2YkfxlIcXOQ5fSWqAzzPyD78/x5qbK/I0vUkrlYHA8TIz+MXjAbGouguKVSI4bOmkTSJ1/poVSsgt+A==} + engines: {node: '>= 10.0.0'} + cpu: [x64] + os: [win32] + + '@parcel/watcher@2.6.0': + resolution: {integrity: sha512-7FNeNl8NCE7aINx7WXiKQrPYZWC/hvrTsmk6zmxbI7LTXE7hVek/n8AfVgpe2y82zl3w0HvCHN0bVKMBoJcC0w==} + engines: {node: '>= 10.0.0'} + + '@pinojs/redact@0.4.0': + resolution: {integrity: sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==} + + '@pkgjs/parseargs@0.11.0': + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + + '@pkgr/core@0.3.6': + resolution: {integrity: sha512-SEeaJLb3qBNF/OaXnaR1NmmBbFYk1zC0ZH/52fATcRPLFg/p791YrcyFFy44Bo9sLaGuSuLp5Q6axbb/O+v/RA==} + engines: {node: ^14.18.0 || >=16.0.0} + + '@prisma/adapter-pg@7.10.0': + resolution: {integrity: sha512-N7nwSor0HO1Kz6xBv0TPAjAPysKK0fac6p4fVN3ensLOuzc/83Fgmln5k92eK/cvzqdkSR/2kkAqlbcdwVrwpw==} + + '@prisma/client-runtime-utils@7.10.0': + resolution: {integrity: sha512-cnCy7lUV8/CctgKVEmqAbSLAmwqJdE/qAlqTBk/0NDk59zEb2cZ0M0M0E4vVPnqbSEYudRroQDvOWfUZH6RIfw==} + + '@prisma/client@7.10.0': + resolution: {integrity: sha512-Ubw/QS9JGIBSBUsyxAUQuK/Jcu0Tsva7le7QbLd91Kix9yJvYDdj5QkwgEbbZniH80dd+sziQcALPc+HnvQC8Q==} + engines: {node: ^20.19 || ^22.12 || >=24.0} + peerDependencies: + prisma: '*' + typescript: '>=5.4.0' + peerDependenciesMeta: + prisma: + optional: true + typescript: + optional: true + + '@prisma/config@7.10.0': + resolution: {integrity: sha512-Rcg828gIRE3HOQ3pOATFjV5d/P0U9OIobxhd/IMxlfWjA4vru0eGwb0AIwFw0rmcLMVShohZYWPixVxkBHsxUA==} + + '@prisma/debug@7.10.0': + resolution: {integrity: sha512-caygJKtltmRIgdJ3jRpkOr7yM4DW6zxo5uOmojKWFb3asnxWoRkQOwZmXBgD8FZp4htrX+nMpcWqDwzlQ1+Y4g==} + + '@prisma/debug@7.2.0': + resolution: {integrity: sha512-YSGTiSlBAVJPzX4ONZmMotL+ozJwQjRmZweQNIq/ER0tQJKJynNkRB3kyvt37eOfsbMCXk3gnLF6J9OJ4QWftw==} + + '@prisma/dev@0.24.17': + resolution: {integrity: sha512-UvdZzmpFwknnfreh6Jije84ekkYGPYEJhXG1tFzCsCfQyzJifrOo38eZc0qajzvaC6OLUOrN9ML5XfCnEZL9DA==} + + '@prisma/driver-adapter-utils@7.10.0': + resolution: {integrity: sha512-u8zkcRLlaryO652T4qavBg0HmzNW5tSKdsCn6hc1PhWAp/J6k0vrxLuUs+b9o+HcjsK7Dfa01o4OFSn0frauJA==} + + '@prisma/engines-version@7.10.0-4.0edf323efd1d98336f3f0a68684b56f689b900d3': + resolution: {integrity: sha512-8OJ6RuZTZ06eFUOtBwxVmv8XMmOW6HWN5F+uxUbZkGxR0Bfab1dfAdXaHPmR5mb59E+fmUo8IOzXlbLY1SClbw==} + + '@prisma/engines@7.10.0': + resolution: {integrity: sha512-KNumN6NHFwybvfdYzTee9pqwx5PvknpWAaHn6L5NsbrKdl+SQrsVZs9opKs6U6SAsvB26HDt3WybRjOhgoWOYQ==} + + '@prisma/fetch-engine@7.10.0': + resolution: {integrity: sha512-Zqyu8DY14t6W/xwmAxUYWCXtHrvQnSvT644EAZSsdM8NSmCS74vJJbBKdVsK3ucFpnUWkEpbO1a0CxJXrg130g==} + + '@prisma/get-platform@7.10.0': + resolution: {integrity: sha512-0bra1LFYi8xNw0yqV62bHJNQk4BKleOngZiqPWIQc7a3+9q6rqsnqJ15BuepP8943PFMvtmgnP52juZsyYkA6w==} + + '@prisma/get-platform@7.2.0': + resolution: {integrity: sha512-k1V0l0Td1732EHpAfi2eySTezyllok9dXb6UQanajkJQzPUGi3vO2z7jdkz67SypFTdmbnyGYxvEvYZdZsMAVA==} + + '@prisma/query-plan-executor@7.2.0': + resolution: {integrity: sha512-EOZmNzcV8uJ0mae3DhTsiHgoNCuu1J9mULQpGCh62zN3PxPTd+qI9tJvk5jOst8WHKQNwJWR3b39t0XvfBB0WQ==} + + '@prisma/streams-local@0.1.11': + resolution: {integrity: sha512-0TcebL559MByKqTJ+SsrFIEg228iw8UCVRFckzgfRSiJqczhs+MuAgWOF9lnOIV/IVqvu+KMnFTH0eDeTQMpUg==} + engines: {bun: '>=1.2.0', node: '>=22.0.0'} + + '@prisma/studio-core@0.33.0': + resolution: {integrity: sha512-V2fX/nKEymNTrHXwfP26PGjoLStO35Ogu+ex7CFJbLrMYEcZxxZpiSNOs7px23Hk5mzLWvM5RsqG6Ka+rha+wg==} + engines: {node: ^20.19 || ^22.12 || >=24.0, pnpm: '8'} + peerDependencies: + '@types/react': ^18.0.0 || ^19.0.0 + react: ^18.0.0 || ^19.0.0 + react-dom: ^18.0.0 || ^19.0.0 + + '@radix-ui/primitive@1.1.3': + resolution: {integrity: sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==} + + '@radix-ui/react-compose-refs@1.1.2': + resolution: {integrity: sha512-z4eqJvfiNnFMHIIvXP3CY57y2WJs5g2v3X0zm9mEJkrkNv4rDxu+sg9Jh8EkXyeqBkB7SOcboo9dMVqhyrACIg==} + peerDependencies: + '@types/react': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + + '@radix-ui/react-primitive@2.1.3': + resolution: {integrity: sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==} + peerDependencies: + '@types/react': '*' + '@types/react-dom': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + + '@radix-ui/react-slot@1.2.3': + resolution: {integrity: sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==} + peerDependencies: + '@types/react': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + + '@radix-ui/react-toggle@1.1.10': + resolution: {integrity: sha512-lS1odchhFTeZv3xwHH31YPObmJn8gOg7Lq12inrr0+BH/l3Tsq32VfjqH1oh80ARM3mlkfMic15n0kg4sD1poQ==} + peerDependencies: + '@types/react': '*' + '@types/react-dom': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + + '@radix-ui/react-use-controllable-state@1.2.2': + resolution: {integrity: sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg==} + peerDependencies: + '@types/react': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + + '@radix-ui/react-use-effect-event@0.0.2': + resolution: {integrity: sha512-Qp8WbZOBe+blgpuUT+lw2xheLP8q0oatc9UpmiemEICxGvFLYmHm9QowVZGHtJlGbS6A6yJ3iViad/2cVjnOiA==} + peerDependencies: + '@types/react': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + + '@radix-ui/react-use-layout-effect@1.1.1': + resolution: {integrity: sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ==} + peerDependencies: + '@types/react': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + + '@scalar/client-side-rendering@0.4.1': + resolution: {integrity: sha512-4Ha2ihIPFwmhheSU6U9DlpjgRQ2YOqq2JSmc4ubT2ERApaA/HzuZ1IMyLXDvRICI+KbDducfGw5th9O+TQf+6A==} + engines: {node: '>=22'} + + '@scalar/helpers@0.12.0': + resolution: {integrity: sha512-rcX0rFLiWWc0VBr/E+HkatubL0I0ZzxASQkd3032NWEMAEfNd2TiJ9kH46HwbSAOOl696ghxymWegjpjjvxwzA==} + engines: {node: '>=22'} + + '@scalar/nestjs-api-reference@1.2.19': + resolution: {integrity: sha512-DYaZv+JQrLxG5B439+sHY0UbYwqwLip5bHYGnJhfO1SXKcjWCbNxwOV0yIxp8VGR+96g+pc2LPww7/b8ma0oEQ==} + engines: {node: '>=22'} + + '@scalar/schemas@0.10.0': + resolution: {integrity: sha512-jFqfd+oqqlTfs87V+QkIrR9DiRv+/h1x3GzSGbGe1qrM6togeXwvVG4aurn+LZ+Ej9of54/6FmoI8DPuLOKx7A==} + engines: {node: '>=22'} + + '@scalar/types@0.20.0': + resolution: {integrity: sha512-+05slk/Q6MRMqEQt6eM77Jt9DnDPAvfcc/6r7mbrXhIqJSp3oAPrixpAnp1knBSlFaxgixcK/GMKw9QDfD+Zgg==} + engines: {node: '>=22'} + + '@scalar/validation@0.6.3': + resolution: {integrity: sha512-j3s9XPv8Wo1EG5/naBi4XGF0uXYQ2A3QZNI0NKWgCMxRHVrDJGlZEYymcHDHY7fquRm73P8U3c8xqJqB5yad6w==} + engines: {node: '>=20'} + + '@scarf/scarf@1.4.0': + resolution: {integrity: sha512-xxeapPiUXdZAE3che6f3xogoJPeZgig6omHEy1rIY5WVsB3H2BHNnZH+gHG6x91SCWyQCzWGsuL2Hh3ClO5/qQ==} + + '@sinclair/typebox@0.34.52': + resolution: {integrity: sha512-XiMQh7qqVlxZzcVD+kkGMNGMzcTrDMLWI7S4x7z1MkCkbDPrekpZXEUK0eZqZFMuHQg2a2DZOcDIh9o5v3Gonw==} + + '@sindresorhus/is@4.6.0': + resolution: {integrity: sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==} + engines: {node: '>=10'} + + '@sinonjs/commons@3.0.1': + resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==} + + '@sinonjs/fake-timers@15.4.0': + resolution: {integrity: sha512-DsG+8/LscQIQg68J6Ef3dv10u6nVyetYn923s3/sus5eaGfTo1of5WMZSLf0UJc9KDuKPilPH0UDJCjvNbDNCA==} + + '@standard-schema/spec@1.1.0': + resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} + + '@tokenizer/inflate@0.4.1': + resolution: {integrity: sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA==} + engines: {node: '>=18'} + + '@tokenizer/token@0.3.0': + resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} + + '@tsconfig/node10@1.0.13': + resolution: {integrity: sha512-gcLdvR9HO1ZJBypsOGqaP6TFEzb6vIta0KSTLt9NAQ6pXQO3cRgSVyCN6pzYqI9DlJgY71XKO0dpDhCf08b3pg==} + + '@tsconfig/node12@1.0.11': + resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} + + '@tsconfig/node14@1.0.3': + resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} + + '@tsconfig/node16@1.0.4': + resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} + + '@tybys/wasm-util@0.10.4': + resolution: {integrity: sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==} + + '@types/babel__core@7.20.5': + resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} + + '@types/babel__generator@7.27.0': + resolution: {integrity: sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==} + + '@types/babel__template@7.4.4': + resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} + + '@types/babel__traverse@7.28.0': + resolution: {integrity: sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==} + + '@types/cookiejar@2.1.5': + resolution: {integrity: sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q==} + + '@types/d3-array@3.0.3': + resolution: {integrity: sha512-Reoy+pKnvsksN0lQUlcH6dOGjRZ/3WRwXR//m+/8lt1BXeI4xyaUZoqULNjyXXRuh0Mj4LNpkCvhUpQlY3X5xQ==} + + '@types/d3-color@3.1.0': + resolution: {integrity: sha512-HKuicPHJuvPgCD+np6Se9MQvS6OCbJmOjGvylzMJRlDwUXjKTTXs6Pwgk79O09Vj/ho3u1ofXnhFOaEWWPrlwA==} + + '@types/d3-delaunay@6.0.1': + resolution: {integrity: sha512-tLxQ2sfT0p6sxdG75c6f/ekqxjyYR0+LwPrsO1mbC9YDBzPJhs2HbJJRrn8Ez1DBoHRo2yx7YEATI+8V1nGMnQ==} + + '@types/d3-format@3.0.1': + resolution: {integrity: sha512-5KY70ifCCzorkLuIkDe0Z9YTf9RR2CjBX1iaJG+rgM/cPP+sO+q9YdQ9WdhQcgPj1EQiJ2/0+yUkkziTG6Lubg==} + + '@types/d3-geo@3.1.0': + resolution: {integrity: sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ==} + + '@types/d3-interpolate@3.0.1': + resolution: {integrity: sha512-jx5leotSeac3jr0RePOH1KdR9rISG91QIE4Q2PYTu4OymLTZfA3SrnURSLzKH48HmXVUru50b8nje4E79oQSQw==} + + '@types/d3-path@3.1.1': + resolution: {integrity: sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==} + + '@types/d3-scale@4.0.2': + resolution: {integrity: sha512-Yk4htunhPAwN0XGlIwArRomOjdoBFXC3+kCxK2Ubg7I9shQlVSJy/pG/Ht5ASN+gdMIalpk8TJ5xV74jFsetLA==} + + '@types/d3-shape@3.1.7': + resolution: {integrity: sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==} + + '@types/d3-time-format@2.1.0': + resolution: {integrity: sha512-/myT3I7EwlukNOX2xVdMzb8FRgNzRMpsZddwst9Ld/VFe6LyJyRp0s32l/V9XoUzk+Gqu56F/oGk6507+8BxrA==} + + '@types/d3-time@3.0.0': + resolution: {integrity: sha512-sZLCdHvBUcNby1cB6Fd3ZBrABbjz3v1Vm90nysCQ6Vt7vd6e/h9Lt7SiJUoEX0l4Dzc7P5llKyhqSi1ycSf1Hg==} + + '@types/estree@1.0.9': + resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==} + + '@types/geojson@7946.0.16': + resolution: {integrity: sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==} + + '@types/istanbul-lib-coverage@2.0.6': + resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} + + '@types/istanbul-lib-report@3.0.3': + resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==} + + '@types/istanbul-reports@3.0.4': + resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} + + '@types/jest@30.0.0': + resolution: {integrity: sha512-XTYugzhuwqWjws0CVz8QpM36+T+Dz5mTEBKhNs/esGLnCIlGdRy+Dq78NRjd7ls7r8BC8ZRMOrKlkO1hU0JOwA==} + + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + + '@types/lodash@4.17.26': + resolution: {integrity: sha512-48NWfiY6oNcKOh47Z4h+sIvwcQR91h6KPhaYKgeMIrkT2jV82Gy90SErj60vW8jQbeMSOSbhIv3bZ7JoqPPVhA==} + + '@types/methods@1.1.4': + resolution: {integrity: sha512-ymXWVrDiCxTBE3+RIrrP533E70eA+9qu7zdWoHuOmGujkYtzf4HQF96b8nwHLqhuf4ykX61IGRIB38CC6/sImQ==} + + '@types/node@24.13.6': + resolution: {integrity: sha512-SGrw/h3KPFshy3OE6ZL53LMBG5vGQQ8/gIpiqz/kRZhPJ7HgwCEs8LBuNtWLa8dvGZVpSF7+Bf+c11HUrCb/yg==} + + '@types/pg@8.23.1': + resolution: {integrity: sha512-fKVHpikPdg4GKks3JuLEhvwSyvwzF23hnabPy6DD8ljVbC7+6J5dQzdv4arV6jqq57djnMgs1HKBxX4P8aBI3A==} + + '@types/react@19.3.0': + resolution: {integrity: sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==} + + '@types/stack-utils@2.0.3': + resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} + + '@types/superagent@8.1.11': + resolution: {integrity: sha512-KA7srSW/HENDtOw9DOqaFLgWuMqN9WgjEw62lh9dpvRaZDkhdOkazASd7X7i2eMUYLHa1U37ZttnePsH5zTDHw==} + + '@types/supertest@7.2.1': + resolution: {integrity: sha512-4CbBvoYVLHL7+yhbYrZET0vsvuyXTC05aRe7dNQkwMzm56auceoy6Yu3K50uZmwfHna1os3CMSgM/3QVkUtPTw==} + + '@types/yargs-parser@21.0.3': + resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} + + '@types/yargs@17.0.35': + resolution: {integrity: sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==} + + '@ungap/structured-clone@1.4.0': + resolution: {integrity: sha512-1mEZtMKPM09vDmQt5y7YvmN2+DFTP7Tg0EWXdic8/C6VRnpb33e4ghisCIE3WZjsE2N8mf+QV1Zqh7ZFYLWInQ==} + + '@unrs/resolver-binding-android-arm-eabi@1.12.2': + resolution: {integrity: sha512-g5T90pqg1bo/7mytQx6F4iBNC0Wsh9cu+z9veDbFjc7HjpesJFWD7QMS0NGStXM075+7dJPPVvBbpZlnrdpi/w==} + cpu: [arm] + os: [android] + + '@unrs/resolver-binding-android-arm64@1.12.2': + resolution: {integrity: sha512-YGCRZv/9GLhwmz6mYDeTsm/92BAyR28l6c2ReweVW5pWgfsitWLY8upvfRlGdoyD8HjeTHSYJWyZGD4KJA/nFQ==} + cpu: [arm64] + os: [android] + + '@unrs/resolver-binding-darwin-arm64@1.12.2': + resolution: {integrity: sha512-u9DiNT1auQMO20A9SyTuG3wUgQWB9Z7KjAg0uFuCDR1FsAY8A0CG2S6JpHS1xwm/w1G08bjXZDcyOCjv1WAm2w==} + cpu: [arm64] + os: [darwin] + + '@unrs/resolver-binding-darwin-x64@1.12.2': + resolution: {integrity: sha512-f7rPLi/T1HVKZu/u6t87lroib16n8vrSzcyxI7lg4BGO9UF26KhQL44sd9eOUgrTYhvRXtWOIZT5PejdPyJfUA==} + cpu: [x64] + os: [darwin] + + '@unrs/resolver-binding-freebsd-x64@1.12.2': + resolution: {integrity: sha512-BpcOjWCJub6nRZUS2zA20pmLvjtqAtGejETaIyRLiZiQf++cbrjltLA5NN/xaXfqeOBOSlMFbemIl5/S5tljmg==} + cpu: [x64] + os: [freebsd] + + '@unrs/resolver-binding-linux-arm-gnueabihf@1.12.2': + resolution: {integrity: sha512-vZTDvdSISZjJx66OzJqtsOhzifbqRjbmI1Mnu49fQDwog5GtDI4QidRiEAYbZCRj9C8YZEW+3ZjqsyS9GR4k2A==} + cpu: [arm] + os: [linux] + + '@unrs/resolver-binding-linux-arm-musleabihf@1.12.2': + resolution: {integrity: sha512-BiPI+IrIlwcW4nLLMM21+B1dFPzd55yAVgVGrdgDjNef+ch03GdxrcyaIz8X9SsQirh/kCQ7mviyWlMxdh2D7g==} + cpu: [arm] + os: [linux] + + '@unrs/resolver-binding-linux-arm64-gnu@1.12.2': + resolution: {integrity: sha512-zJc0H99FEPoFfSrNpa91HYfxzfAJCr502oxNK1cfdC9hlaFI43RT+JFCann9JUgZmLzzntChHyn13Sgn9ljHNg==} + cpu: [arm64] + os: [linux] + + '@unrs/resolver-binding-linux-arm64-musl@1.12.2': + resolution: {integrity: sha512-KQ3Lki6l+Pz1k/eBipN41ES+YUK30beLGb9YqcB1O542cyLCNE6GaxrfcY3T6EezmGGk84wb5XyO9loTM9tkcA==} + cpu: [arm64] + os: [linux] + + '@unrs/resolver-binding-linux-loong64-gnu@1.12.2': + resolution: {integrity: sha512-3SJGEh1DborhG6pyxvhPzCT4bbSIVihsvgJc13P1bHG7KLdNDaF9T3gsTwFc7Jw/5Y5/iWOjkEx7Zy0NvCGX3Q==} + cpu: [loong64] + os: [linux] + + '@unrs/resolver-binding-linux-loong64-musl@1.12.2': + resolution: {integrity: sha512-jiuG/Obbel7uw1PwHNFfrkiKhLAF6mnyZ6aWlOAVN9WqKm8v0OFGnciJIHu8+CMvXLQ8AD51LPzAoUfT21D5Ew==} + cpu: [loong64] + os: [linux] + + '@unrs/resolver-binding-linux-ppc64-gnu@1.12.2': + resolution: {integrity: sha512-q7xRvVpmcfeL+LlZg8Pbbo6QaTZwDU5BaGZbwfhkEsXJn3Was8xYfE0RBH266xZt0rM6B7i8xAYIvjthuUIWHg==} + cpu: [ppc64] + os: [linux] + + '@unrs/resolver-binding-linux-riscv64-gnu@1.12.2': + resolution: {integrity: sha512-0CVdx6lcnT3Q9inOH8tsMIOJ6ImndllMjqJHg8RLVdB7Vq4SfkEXl9mCSsVNuNA4MCYycRicCUxPCabVHJRr6A==} + cpu: [riscv64] + os: [linux] + + '@unrs/resolver-binding-linux-riscv64-musl@1.12.2': + resolution: {integrity: sha512-iOwlRo9vnp6R6ohHQS11n0NnfdXx/omhkocmIfaPRpQhKZ+3BDMkkdRVh53qjkFkpPddf+FETA28NwGN7l5l+w==} + cpu: [riscv64] + os: [linux] + + '@unrs/resolver-binding-linux-s390x-gnu@1.12.2': + resolution: {integrity: sha512-HYJtLfXq94q8iZNFT1lknx258wlkkWhZeUXJRqzKBBUJ00CvZ+N33zgbCqimLjsyw5Va6uUxhVa12mI+kaveEw==} + cpu: [s390x] + os: [linux] + + '@unrs/resolver-binding-linux-x64-gnu@1.12.2': + resolution: {integrity: sha512-mPsUhunKKDih5O96Y6enDQyHc1SqBPlY1E/SfMWDM3EdJ95Z9CArPeCVwCCqbP45ljvivdEk8Fxn+SIb1rDAJQ==} + cpu: [x64] + os: [linux] + + '@unrs/resolver-binding-linux-x64-musl@1.12.2': + resolution: {integrity: sha512-azrt6+5ydLd8Vt210AAFis/lZevSfPw93EJRIJG+xPu4WCJ8K0kppCTpMyLPcKT7H15M4Jnt2tMp5bOvCkRC6A==} + cpu: [x64] + os: [linux] + + '@unrs/resolver-binding-openharmony-arm64@1.12.2': + resolution: {integrity: sha512-YZ9hP4O0X9PQb8eO980qmLNGH4zT3I9+SZTdt0Pr0YyuGQhYKoOZkV02VzrzyOZJ5xIJ3UFIenKkUkGg8GjgWQ==} + cpu: [arm64] + os: [openharmony] + + '@unrs/resolver-binding-wasm32-wasi@1.12.2': + resolution: {integrity: sha512-tYFDIkMxSflfEc/h92ZWNsZlHSwgimbNHSO3PL2JWQHfCuC2q316jMyYU9TIWZsFK2bQwyK5VAdYgn8ygPj69A==} + engines: {node: '>=14.0.0'} + cpu: [wasm32] + + '@unrs/resolver-binding-win32-arm64-msvc@1.12.2': + resolution: {integrity: sha512-qzNyg3xL0VPQmCaUh+N5jSitce6k+uCBfMDesWRnlULOZaqUkaJ0ybdT+UqlAWJoQjuqfIU/0Ptx9bteN4D82g==} + cpu: [arm64] + os: [win32] + + '@unrs/resolver-binding-win32-ia32-msvc@1.12.2': + resolution: {integrity: sha512-WD9sY00OfpHVGfsnHZoA8jVT+esS/Bg8z8jzxp5BnDCjjwsuKsPQrzswwpFy4J1AUJbXPRfkpcX0mXrzeXW79g==} + cpu: [ia32] + os: [win32] + + '@unrs/resolver-binding-win32-x64-msvc@1.12.2': + resolution: {integrity: sha512-nAB74NfSNKknqQ1RrYj6uz8FcXEomu/MATJZxh/x+BArzN2U3JbOYC0APYzUIGhVY3m5hRxA8VPNdPBoG8txlA==} + cpu: [x64] + os: [win32] + + '@visx/curve@4.0.1-alpha.0': + resolution: {integrity: sha512-jRu61Uz274pV1zyioXmboyrLutYbnKsgjj4njSGCnhdXj5GkZvZbg+ThDb6oOzoAnJOBRLz4rzPlWvNJOzuVMg==} + + '@visx/event@4.0.1-alpha.0': + resolution: {integrity: sha512-EQqCMSv/s8NbFjo+hz3FKsvvYfP+2QslsFJ/24/O5l/W+7UC6J6aAvO0ujVwrTwdYbuQ+vhxKi1xdPdKR/qj1g==} + + '@visx/grid@4.0.1-alpha.0': + resolution: {integrity: sha512-rycutGmTHO+znNdPumheWMglm7YfpffvRwUkVy5zy4WoORIuKTMkDxwnOzHG2xMxU3EE/YCd37xFV5AxA30yeg==} + peerDependencies: + react: ^16.14.0 || ^17.0.0-0 || ^18.0.0-0 || ^19.0.0-0 + + '@visx/group@4.0.1-alpha.0': + resolution: {integrity: sha512-V19l7iQ7jccBv8kao/EByuI6o4xtxzzLV9nqVI1hRvmdzTVsuLpqlwzYCZUXJaTVvUWf8s4D2SQFjGkj/Nw+0w==} + peerDependencies: + react: ^16.14.0 || ^17.0.0-0 || ^18.0.0-0 || ^19.0.0-0 + + '@visx/point@4.0.1-alpha.0': + resolution: {integrity: sha512-ijTfr/Nx09f03vIj9nyTr3z4Xth4Y75427UaogJh6dnIRLMEFHQOwNu791sbfiNj0a+ZXuaE32h0vKrFe4/8Qg==} + + '@visx/responsive@4.0.1-alpha.0': + resolution: {integrity: sha512-o+1zGywQZY0+yOx3Iw87wc4bbPJRr/HnIukTwfOz4UVyj9pB1OQNVHB7OORO1+LBHJceWpB31co/ZV9KHncKrA==} + peerDependencies: + react: ^16.14.0 || ^17.0.0-0 || ^18.0.0-0 || ^19.0.0-0 + + '@visx/scale@4.0.1-alpha.0': + resolution: {integrity: sha512-nzjeE87vFSAXGWFiiNfBpNLAf0Q8Qmf6syvKLjqNi4kGZkdhbUll3E/59YsgWXmjM8+llPLWzGsP+JPvo5eq1A==} + + '@visx/shape@4.0.1-alpha.0': + resolution: {integrity: sha512-62QeiVNmPlterQGwhkEDcbq7M0MqY0lBsK5QKXtM9ZoPZWkuGV3aykA3+Xu20B2FAvyJq4LqJzBc7Sxr+EAdbA==} + peerDependencies: + react: ^16.14.0 || ^17.0.0-0 || ^18.0.0-0 || ^19.0.0-0 + + '@visx/vendor@4.0.0-alpha.0': + resolution: {integrity: sha512-6I+MuqXBcv9jnlcVowHoHKSdk9gXTWkHLKyqBwRWg7LY6A3Ei8SHfubpqGV5rBUSppxMq2RszPJUS6w+H0YgmQ==} + + '@webassemblyjs/ast@1.14.1': + resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==} + + '@webassemblyjs/floating-point-hex-parser@1.13.2': + resolution: {integrity: sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==} + + '@webassemblyjs/helper-api-error@1.13.2': + resolution: {integrity: sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==} + + '@webassemblyjs/helper-buffer@1.14.1': + resolution: {integrity: sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==} + + '@webassemblyjs/helper-numbers@1.13.2': + resolution: {integrity: sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==} + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': + resolution: {integrity: sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==} + + '@webassemblyjs/helper-wasm-section@1.14.1': + resolution: {integrity: sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==} + + '@webassemblyjs/ieee754@1.13.2': + resolution: {integrity: sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==} + + '@webassemblyjs/leb128@1.13.2': + resolution: {integrity: sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==} + + '@webassemblyjs/utf8@1.13.2': + resolution: {integrity: sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==} + + '@webassemblyjs/wasm-edit@1.14.1': + resolution: {integrity: sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==} + + '@webassemblyjs/wasm-gen@1.14.1': + resolution: {integrity: sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==} + + '@webassemblyjs/wasm-opt@1.14.1': + resolution: {integrity: sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==} + + '@webassemblyjs/wasm-parser@1.14.1': + resolution: {integrity: sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==} + + '@webassemblyjs/wast-printer@1.14.1': + resolution: {integrity: sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==} + + '@xtuc/ieee754@1.2.0': + resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} + + '@xtuc/long@4.2.2': + resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} + + abstract-logging@2.0.1: + resolution: {integrity: sha512-2BjRTZxTPvheOvGbBslFSYOUkr+SjPtOnrLP33f+VIWLzezQpZcqVg7ja3L4dBXmzzgwT+a029jRx5PCi3JuiA==} + + accepts@2.0.0: + resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==} + engines: {node: '>= 0.6'} + + acorn-walk@8.3.5: + resolution: {integrity: sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==} + engines: {node: '>=0.4.0'} + + acorn@8.18.0: + resolution: {integrity: sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==} + engines: {node: '>=0.4.0'} + hasBin: true + + ajv-formats@3.0.1: + resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + + ajv-keywords@5.1.0: + resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==} + peerDependencies: + ajv: ^8.8.2 + + ajv@8.20.0: + resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==} + + ansi-escapes@4.3.2: + resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} + engines: {node: '>=8'} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-regex@6.3.0: + resolution: {integrity: sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==} + engines: {node: '>=12'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + ansi-styles@5.2.0: + resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} + engines: {node: '>=10'} + + ansi-styles@6.2.3: + resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==} + engines: {node: '>=12'} + + ansis@4.4.0: + resolution: {integrity: sha512-9k3v7xcHwgdO/DruxGIg4HtjvlAZlcnsX/mzqUb1t3NkYnl9kK2UJ+Gq0io+vQf7iT//BD/HB/NBkUR1LWxoeA==} + engines: {node: '>=14'} + + anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + + append-field@1.0.0: + resolution: {integrity: sha512-klpgFSWLW1ZEs8svjfb7g4qWY0YS5imI82dTg+QahUvJ8YqAY0P10Uk8tTyh9ZGuYEZEMaeJYCF5BFuX552hsw==} + + arg@4.1.3: + resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + + argparse@1.0.10: + resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + + array-timsort@1.0.3: + resolution: {integrity: sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==} + + asap@2.0.6: + resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} + + asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + + atomic-sleep@1.0.0: + resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==} + engines: {node: '>=8.0.0'} + + avvio@9.3.0: + resolution: {integrity: sha512-g2tQ7LE7oOSqDfwEm3M+ZCMTJc7KiZCdJ4UwyZJb5ckTKyYu50OYmvv0mCFXPuYXoM4zkSt8zM9XQ9KCvxA74A==} + + aws-ssl-profiles@1.1.2: + resolution: {integrity: sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==} + engines: {node: '>= 6.0.0'} + + babel-jest@30.5.2: + resolution: {integrity: sha512-ES8WeJ2fNWPEDunyAtUfJ12nHyaWUloCHdkfK2oW5uSoQSUmjNKdWiGaXJITJwvFEWoD/evHEg/QoCXAvLaQqQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + '@babel/core': ^7.11.0 || ^8.0.0-0 + + babel-plugin-istanbul@8.0.0: + resolution: {integrity: sha512-18wCskrN3DgbuBmp1gr7LBGT8xdz5xhQQqFvFhVxbkl8VBCrMKQ2YtqBWtUal1Zrc1HTuX0011+Brjw78TCFkg==} + engines: {node: '>=18'} + + babel-plugin-jest-hoist@30.5.0: + resolution: {integrity: sha512-gtGo1B+u14jrZQv6TdSWIWkTqclboo7Qn+dFAGUOIuXLFuJKAdg3U5MIWzZnW4vfUb4dX9skmAMiby86e/SF4A==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + babel-preset-current-node-syntax@1.2.0: + resolution: {integrity: sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg==} + peerDependencies: + '@babel/core': ^7.0.0 || ^8.0.0-0 + + babel-preset-jest@30.5.0: + resolution: {integrity: sha512-ZGPn5ClP4lBDpuOK8W1yQIOy359HmbnZv3suucAlIe+SEE9yDsxV4S2PjSbH2Vc97U+WmzYD7vw3kr8NsQ/i6w==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + '@babel/core': ^7.11.0 || ^8.0.0-beta.1 || ^8.0.0 + + balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + + balanced-match@4.0.4: + resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} + engines: {node: 18 || 20 || >=22} + + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + baseline-browser-mapping@2.11.25: + resolution: {integrity: sha512-gMmEShwwq7FJqMwvfRwvCl00v4kN+KOfJqXn+f4nrufak5gNHJOksd/60Dvjuz7sI8Y5WiSFBa8FEYr+zoyqCw==} + engines: {node: '>=6.0.0'} + hasBin: true + + better-result@2.10.0: + resolution: {integrity: sha512-oQhh0y1qo2/ZKdAAEvHZAqKKiHOFU5k/bW96fE2ScgQOVkJRiHwB+nOS1SgFsYqRlxMDWvefXi9Q3px7QvgNDw==} + + bl@4.1.0: + resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} + + body-parser@2.3.0: + resolution: {integrity: sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw==} + engines: {node: '>=18'} + + brace-expansion@2.1.7: + resolution: {integrity: sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==} + + brace-expansion@5.0.12: + resolution: {integrity: sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==} + engines: {node: 20 || >=22} + + browserslist@4.29.0: + resolution: {integrity: sha512-3GSvyjvDI4Dur1Meg2BekJquu5uF+9R9a1+5M1Mde192eZoXbeXjzgOsgqPS2V8D5wrrip0gR5Hf/GhWQ9ZzaA==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + + bs-logger@0.2.6: + resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==} + engines: {node: '>= 6'} + + bser@2.1.1: + resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + buffer@5.7.1: + resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + + busboy@1.6.0: + resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} + engines: {node: '>=10.16.0'} + + bytes@3.1.2: + resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} + engines: {node: '>= 0.8'} + + c12@3.3.4: + resolution: {integrity: sha512-cM0ApFQSBXuourJejzwv/AuPRvAxordTyParRVcHjjtXirtkzM0uK2L9TTn9s0cXZbG7E55jCivRQzoxYmRAlA==} + peerDependencies: + magicast: '*' + peerDependenciesMeta: + magicast: + optional: true + + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + + call-bound@1.0.4: + resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==} + engines: {node: '>= 0.4'} + + callsites@3.1.0: + resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} + engines: {node: '>=6'} + + camelcase@5.3.1: + resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} + engines: {node: '>=6'} + + camelcase@6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + + caniuse-lite@1.0.30001810: + resolution: {integrity: sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==} + + chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + + chalk@5.6.2: + resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + + char-regex@1.0.2: + resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} + engines: {node: '>=10'} + + chardet@0.7.0: + resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} + + chardet@2.2.0: + resolution: {integrity: sha512-rddelWYNPRrXq6PtNEN2S3f6t9ILzvqaN5pVgi4kqt9jHQaXIial9PznB5iSPVlQSLNaaH22ItWz3EJtQ10+OA==} + + chokidar@5.0.0: + resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==} + engines: {node: '>= 20.19.0'} + + chrome-trace-event@1.0.4: + resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} + engines: {node: '>=6.0'} + + ci-info@4.4.0: + resolution: {integrity: sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==} + engines: {node: '>=8'} + + cjs-module-lexer@2.2.1: + resolution: {integrity: sha512-Ca8swihM+/4yKecYHY52kgJd300hi2lADU/a1RxNTRe+RJ9jvqQlESpbz9DnG9mowez8qwXHB8qYdIUw9e+F5Q==} + + classnames@2.5.1: + resolution: {integrity: sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==} + + cli-cursor@3.1.0: + resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==} + engines: {node: '>=8'} + + cli-cursor@5.0.0: + resolution: {integrity: sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==} + engines: {node: '>=18'} + + cli-progress@3.12.0: + resolution: {integrity: sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==} + engines: {node: '>=4'} + + cli-spinners@2.9.2: + resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==} + engines: {node: '>=6'} + + cli-spinners@3.4.0: + resolution: {integrity: sha512-bXfOC4QcT1tKXGorxL3wbJm6XJPDqEnij2gQ2m7ESQuE+/z9YFIWnl/5RpTiKWbMq3EVKR4fRLJGn6DVfu0mpw==} + engines: {node: '>=18.20'} + + cli-table3@0.6.5: + resolution: {integrity: sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==} + engines: {node: 10.* || >= 12.*} + + cli-width@3.0.0: + resolution: {integrity: sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==} + engines: {node: '>= 10'} + + cli-width@4.1.0: + resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==} + engines: {node: '>= 12'} + + cliui@8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} + + clone@1.0.4: + resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} + engines: {node: '>=0.8'} + + cluster-key-slot@1.1.1: + resolution: {integrity: sha512-rwHwUfXL40Chm1r08yrhU3qpUvdVlgkKNeyeGPOxnW8/SyVDvgRaed/Uz54AqWNaTCAThlj6QAs3TZcKI0xDEw==} + engines: {node: '>=0.10.0'} + + co@4.6.0: + resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==} + engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} + + collect-v8-coverage@1.0.3: + resolution: {integrity: sha512-1L5aqIkwPfiodaMgQunkF1zRhNqifHBmtbbbxcr6yVxxBnliw4TDOW6NxpO8DJLgJ16OT+Y4ztZqP6p/FtXnAw==} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + colorette@2.0.20: + resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + + combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + + commander@15.0.0: + resolution: {integrity: sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==} + engines: {node: '>=22.12.0'} + + commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + + commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + + comment-json@5.0.0: + resolution: {integrity: sha512-uiqLcOiVDJtBP8WGkZHEP+FZIhTzP1dxvn59EfoYUi9gqupjrBWVQkO2atDrbnKPwLeotFYDsuNb26uBMqB+hw==} + engines: {node: '>= 6'} + + component-emitter@1.3.1: + resolution: {integrity: sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==} + + confbox@0.2.4: + resolution: {integrity: sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ==} + + confbox@0.3.1: + resolution: {integrity: sha512-cKUSoKa8YxFZZSmraVi7onONx3amu77ngK3kGpsYHDH7drPwCRkQE1RYMPlLRrMtnciRj274XNRxcHxnKmDSnA==} + + content-disposition@1.1.0: + resolution: {integrity: sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==} + engines: {node: '>=18'} + + content-disposition@3.0.0: + resolution: {integrity: sha512-ZH/0Xs9rMIFWCOmGdmS9eHBTF62qqQYNz4nVjQhkdIO/a0fCP4UIM3mRz/wiqL0L14YgAz/1xio4OaSY4+ON/A==} + engines: {node: '>=22'} + + content-type@1.0.5: + resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} + engines: {node: '>= 0.6'} + + content-type@2.1.0: + resolution: {integrity: sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==} + engines: {node: '>=18'} + + convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + + cookie-signature@1.2.2: + resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==} + engines: {node: '>=6.6.0'} + + cookie@0.7.2: + resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} + engines: {node: '>= 0.6'} + + cookie@1.1.1: + resolution: {integrity: sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==} + engines: {node: '>=18'} + + cookiejar@2.1.4: + resolution: {integrity: sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==} + + cors@2.8.6: + resolution: {integrity: sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==} + engines: {node: '>= 0.10'} + + create-require@1.1.1: + resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + + csstype@3.2.3: + resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==} + + d3-array@3.2.1: + resolution: {integrity: sha512-gUY/qeHq/yNqqoCKNq4vtpFLdoCdvyNpWoC/KNjhGbhDuQpAM9sIQQKkXSNpXa9h5KySs/gzm7R88WkUutgwWQ==} + engines: {node: '>=12'} + + d3-array@3.2.4: + resolution: {integrity: sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==} + engines: {node: '>=12'} + + d3-color@3.1.0: + resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==} + engines: {node: '>=12'} + + d3-delaunay@6.0.2: + resolution: {integrity: sha512-IMLNldruDQScrcfT+MWnazhHbDJhcRJyOEBAJfwQnHle1RPh6WDuLvxNArUju2VSMSUuKlY5BGHRJ2cYyoFLQQ==} + engines: {node: '>=12'} + + d3-format@3.1.0: + resolution: {integrity: sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==} + engines: {node: '>=12'} + + d3-geo@3.1.0: + resolution: {integrity: sha512-JEo5HxXDdDYXCaWdwLRt79y7giK8SbhZJbFWXqbRTolCHFI5jRqteLzCsq51NKbUoX0PjBVSohxrx+NoOUujYA==} + engines: {node: '>=12'} + + d3-interpolate@3.0.1: + resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==} + engines: {node: '>=12'} + + d3-path@3.1.0: + resolution: {integrity: sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==} + engines: {node: '>=12'} + + d3-scale@4.0.2: + resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==} + engines: {node: '>=12'} + + d3-shape@3.2.0: + resolution: {integrity: sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==} + engines: {node: '>=12'} + + d3-time-format@4.1.0: + resolution: {integrity: sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==} + engines: {node: '>=12'} + + d3-time@3.1.0: + resolution: {integrity: sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==} + engines: {node: '>=12'} + + dateformat@4.6.3: + resolution: {integrity: sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==} + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + dedent@1.7.2: + resolution: {integrity: sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA==} + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true + + deepmerge-ts@7.1.5: + resolution: {integrity: sha512-HOJkrhaYsweh+W+e74Yn7YStZOilkoPb6fycpwNLKzSPtruFs48nYis0zy5yJz1+ktUhHxoRDJ27RQAWLIJVJw==} + engines: {node: '>=16.0.0'} + + deepmerge@4.3.1: + resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} + engines: {node: '>=0.10.0'} + + defaults@1.0.4: + resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} + + defu@6.1.7: + resolution: {integrity: sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==} + + delaunator@5.1.0: + resolution: {integrity: sha512-AGrQ4QSgssa1NGmWmLPqN5NY2KajF5MqxetNEO+o0n3ZwZZeTmt7bBnvzHWrmkZFxGgr4HdyFgelzgi06otLuQ==} + + delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + + denque@2.1.0: + resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==} + engines: {node: '>=0.10'} + + depd@2.0.0: + resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} + engines: {node: '>= 0.8'} + + dequal@2.0.3: + resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} + engines: {node: '>=6'} + + destr@2.0.5: + resolution: {integrity: sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + detect-newline@3.1.0: + resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} + engines: {node: '>=8'} + + dezalgo@1.0.4: + resolution: {integrity: sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==} + + diff@4.0.4: + resolution: {integrity: sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==} + engines: {node: '>=0.3.1'} + + dotenv@17.4.2: + resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==} + engines: {node: '>=12'} + + dotenv@18.0.7: + resolution: {integrity: sha512-QEvMEF8ca3GNZJJnAbOgxpj5ULhBvnMcURp+XKrtvqFNPgjBvYoswQ0Jl2cO7JzCjxZjJhr9ZuIEhlrRxMft/Q==} + engines: {node: '>=12'} + hasBin: true + + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + + eastasianwidth@0.2.0: + resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + + ee-first@1.1.1: + resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + + effect@3.20.0: + resolution: {integrity: sha512-qMLfDJscrNG8p/aw+IkT9W7fgj50Z4wG5bLBy0Txsxz8iUHjDIkOgO3SV0WZfnQbNG2VJYb0b+rDLMrhM4+Krw==} + + electron-to-chromium@1.5.433: + resolution: {integrity: sha512-5lCAbyZBjtmUt/RAGHRqrL2q0oEFRThDAsZHHDn9XHa89Qw7gMYOeSicBTy+AHfvo0r6vwsZvqNJTQIQy1BLzA==} + + elkjs@0.11.1: + resolution: {integrity: sha512-zxxR9k+rx5ktMwT/FwyLdPCrq7xN6e4VGGHH8hA01vVYKjTFik7nHOxBnAYtrgYUB1RpAiLvA1/U2YraWxyKKg==} + + emittery@0.13.1: + resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==} + engines: {node: '>=12'} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + emoji-regex@9.2.2: + resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + + emojilib@2.4.0: + resolution: {integrity: sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==} + + empathic@2.0.0: + resolution: {integrity: sha512-i6UzDscO/XfAcNYD75CfICkmfLedpyPDdozrLMmQc5ORaQcdMoc21OnlEylMIqI7U8eniKrPMxxtj8k0vhmJhA==} + engines: {node: '>=14'} + + encodeurl@2.0.0: + resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==} + engines: {node: '>= 0.8'} + + end-of-stream@1.4.5: + resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==} + + enhanced-resolve@5.25.1: + resolution: {integrity: sha512-nGXts5znJzmWPu+mIE9izCOzdg63oJca2mDzGWWTth7sr4aCToKcoyFVBQwN75Ij5Pf6p510EwkTqViTRzDV+w==} + engines: {node: '>=10.13.0'} + + env-paths@3.0.0: + resolution: {integrity: sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + error-ex@1.3.4: + resolution: {integrity: sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==} + + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + + es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + + es-module-lexer@2.3.2: + resolution: {integrity: sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==} + + es-object-atoms@1.1.2: + resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==} + engines: {node: '>= 0.4'} + + es-set-tostringtag@2.1.0: + resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} + engines: {node: '>= 0.4'} + + es-toolkit@1.51.0: + resolution: {integrity: sha512-zC2lQGkM7QX+Gm6iM3+WIdZJzthsEd14LvRNJneSO2hzyz/zNBENR8+YXWo1cKxgPBtV6ksPYHELbcwBRzmdCw==} + + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + + escape-html@1.0.3: + resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} + + escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + + escape-string-regexp@2.0.0: + resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} + engines: {node: '>=8'} + + esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + + etag@1.8.1: + resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} + engines: {node: '>= 0.6'} + + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + + execa@5.1.1: + resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} + engines: {node: '>=10'} + + exit-x@0.2.2: + resolution: {integrity: sha512-+I6B/IkJc1o/2tiURyz/ivu/O0nKNEArIUB5O7zBrlDVJr22SCLH3xTeEry428LvFhRzIA1g8izguxJ/gbNcVQ==} + engines: {node: '>= 0.8.0'} + + expect@30.5.2: + resolution: {integrity: sha512-0LNuMvs8/5mRYhnCR4k+lGV7fqPMs6Bnksda4S3zsCUmdxBpAn4zU4NNzXdq1pMKe/H4W5t/zVIDSJ/H3e0vDA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + express@5.2.1: + resolution: {integrity: sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==} + engines: {node: '>= 18'} + + exsolve@1.1.3: + resolution: {integrity: sha512-kuzL9zherLQoqDeQaS55AiiIg1kb4KYXaSusTtgZTPlvKP2gGCI82LNmBNh5RjDVUXIcmgx+/Mx7vPwRzBbhJA==} + + external-editor@3.1.0: + resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} + engines: {node: '>=4'} + + fast-check@3.23.2: + resolution: {integrity: sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==} + engines: {node: '>=8.0.0'} + + fast-copy@4.1.1: + resolution: {integrity: sha512-A4QTJmuiztpGtr6AMeJts9R4hbj2ZBUwtOaKrG6rw2y7t6+IaJKjz5M3XDs8BUznxDH43FVc6A0y/gWlMl4UtA==} + + fast-decode-uri-component@1.0.1: + resolution: {integrity: sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + + fast-json-stringify@7.0.1: + resolution: {integrity: sha512-eRSayARSbbwlBjpP4vnTTIRD5QPcIrmihPxDeN1DtKnHPg66UuJLx+8hlK1kaFdjvzyQ/dzALoi4vwAQ+T+iZA==} + + fast-querystring@1.1.2: + resolution: {integrity: sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg==} + + fast-safe-stringify@2.1.1: + resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} + + fast-string-truncated-width@3.0.3: + resolution: {integrity: sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==} + + fast-string-width@3.0.2: + resolution: {integrity: sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==} + + fast-uri@3.1.8: + resolution: {integrity: sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==} + + fast-uri@4.2.1: + resolution: {integrity: sha512-TmHQgewjHtMq1E5QKA0tOE0yeYGQs25KZC/ziJpubRtWI15W92e6vPFydWOeZBVROSHBYw/QhD9d5OefdD6LDg==} + + fast-wrap-ansi@0.2.2: + resolution: {integrity: sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q==} + + fastify-plugin@6.0.0: + resolution: {integrity: sha512-fZOty7z3O7vOliF6d8bHE3wiEh1KcNnKEQensSgTk9C1DvN6nRLS++XVd86v33Hw/8u9Un8A1zDrQ8ujcQDHEg==} + + fastify@5.12.1: + resolution: {integrity: sha512-FWi+tQvwxR/PeRX7Z2mhfEF5ozJ3jn9asiiclzKXNSzJRHAYcU924aIOKAdHFJ+YIKieh3cqr1IwCOvTr41B3Q==} + + fastq@1.20.3: + resolution: {integrity: sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==} + + fb-watchman@2.0.2: + resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} + + fdir@6.5.0: + resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} + engines: {node: '>=12.0.0'} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + figures@3.2.0: + resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} + engines: {node: '>=8'} + + file-type@22.1.1: + resolution: {integrity: sha512-sEB0oStmeLGtpmSAD88RDNuLsvhv4iC3u0lE25CUvfCULvj49xoQ3l3K525Vn+ZzsZ6DOLajQCV6RmhwwhqiJg==} + engines: {node: '>=22'} + + finalhandler@2.1.1: + resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==} + engines: {node: '>= 18.0.0'} + + find-my-way@9.7.0: + resolution: {integrity: sha512-f2JHn75x2JlwUwLenZypgczR7YWMb/uO9BvUXtus+JMgkbIkLADd38cI4EiV+OQqrGo1Zlq6V8wnqMJ8e62wUQ==} + engines: {node: '>=20'} + + find-my-way@9.9.0: + resolution: {integrity: sha512-sJsgZ1sQH2UDuowPuMKg8az7Qc8F0jnj+SKkFWU/+T0xcFlgV5skgXOGUqmQzOdmW6ALA7AhJINWx3qFBkbLHA==} + engines: {node: '>=20'} + + find-up@4.1.0: + resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} + engines: {node: '>=8'} + + foreground-child@3.3.1: + resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} + engines: {node: '>=14'} + + form-data@4.0.6: + resolution: {integrity: sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==} + engines: {node: '>= 6'} + + formidable@3.5.4: + resolution: {integrity: sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug==} + engines: {node: '>=14.0.0'} + + forwarded@0.2.0: + resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} + engines: {node: '>= 0.6'} + + fresh@2.0.0: + resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} + engines: {node: '>= 0.8'} + + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + generate-function@2.3.1: + resolution: {integrity: sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==} + + gensync@1.0.0-beta.2: + resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} + engines: {node: '>=6.9.0'} + + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + + get-east-asian-width@1.7.0: + resolution: {integrity: sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q==} + engines: {node: '>=18'} + + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + + get-package-type@0.1.0: + resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} + engines: {node: '>=8.0.0'} + + get-port-please@3.2.0: + resolution: {integrity: sha512-I9QVvBw5U/hw3RmWpYKRumUeaDgxTPd401x364rLmWBJcOQ753eov1eTgzDqRG9bqFIfDc7gfzcQEWrUri3o1A==} + + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + + get-stream@6.0.1: + resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} + engines: {node: '>=10'} + + giget@3.3.1: + resolution: {integrity: sha512-r+mvuDjrjMpsdw46Kmeydb8bdHm7wOKw8wNBtTndkjbPjgAp5oUJUxRE76wZFknxIPokfWvep2qSXK37aXE6zg==} + hasBin: true + + glob@10.5.0: + resolution: {integrity: sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + hasBin: true + + glob@13.0.6: + resolution: {integrity: sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==} + engines: {node: 18 || 20 || >=22} + + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + + grammex@3.1.13: + resolution: {integrity: sha512-LnPnhOBLEJEVKS8WFDVaA397L9Kq55Q9oSITJiVLHVdhAclfUkWzQv74KhvZHKL2Q09Pb1XdsrOsZ4LfTFFTEg==} + + graphmatch@1.1.1: + resolution: {integrity: sha512-5ykVn/EXM1hF0XCaWh05VbYvEiOL2lY1kBxZtaYsyvjp7cmWOU1XsAdfQBwClraEofXDT197lFbXOEVMHpvQOg==} + + handlebars@4.7.9: + resolution: {integrity: sha512-4E71E0rpOaQuJR2A3xDZ+GM1HyWYv1clR58tC8emQNeQe3RH7MAzSbat+V0wG78LQBo6m6bzSG/L4pBuCsgnUQ==} + engines: {node: '>=0.4.7'} + hasBin: true + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + + hasown@2.0.4: + resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==} + engines: {node: '>= 0.4'} + + help-me@5.0.0: + resolution: {integrity: sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==} + + html-escaper@2.0.2: + resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} + + http-errors@2.0.1: + resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==} + engines: {node: '>= 0.8'} + + human-signals@2.1.0: + resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} + engines: {node: '>=10.17.0'} + + iconv-lite@0.4.24: + resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} + engines: {node: '>=0.10.0'} + + iconv-lite@0.7.3: + resolution: {integrity: sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ==} + engines: {node: '>=0.10.0'} + + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + + import-local@3.2.0: + resolution: {integrity: sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==} + engines: {node: '>=8'} + hasBin: true + + imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + inquirer@8.2.6: + resolution: {integrity: sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==} + engines: {node: '>=12.0.0'} + + internmap@2.0.3: + resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==} + engines: {node: '>=12'} + + ioredis@6.0.0: + resolution: {integrity: sha512-f+Dtubxfpf6KYFq7WVXJoOLn0bk4TJrMrN9SzeE+jrWrCWj7XX3fA6vkryafhADX+GMymRxgDJDOI33COkJc0w==} + engines: {node: '>=20.0.0'} + + ipaddr.js@1.9.1: + resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} + engines: {node: '>= 0.10'} + + ipaddr.js@2.5.0: + resolution: {integrity: sha512-aq+t5NAc+cS6rZQQVWC2x98CPqGtKKTMDd4Gaodv0wShnItdKg/51djkGJ1hqH+Oy0ivDftCbSLCQob8zso01w==} + engines: {node: '>= 10'} + + is-arrayish@0.2.1: + resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-generator-fn@2.1.0: + resolution: {integrity: sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==} + engines: {node: '>=6'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-interactive@1.0.0: + resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==} + engines: {node: '>=8'} + + is-interactive@2.0.0: + resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} + engines: {node: '>=12'} + + is-promise@4.0.0: + resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} + + is-property@1.0.2: + resolution: {integrity: sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==} + + is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + + is-unicode-supported@0.1.0: + resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} + engines: {node: '>=10'} + + is-unicode-supported@2.1.0: + resolution: {integrity: sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==} + engines: {node: '>=18'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + istanbul-lib-coverage@3.2.2: + resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} + engines: {node: '>=8'} + + istanbul-lib-instrument@6.0.3: + resolution: {integrity: sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==} + engines: {node: '>=10'} + + istanbul-lib-report@3.0.1: + resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} + engines: {node: '>=10'} + + istanbul-lib-source-maps@5.0.6: + resolution: {integrity: sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==} + engines: {node: '>=10'} + + istanbul-reports@3.2.0: + resolution: {integrity: sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==} + engines: {node: '>=8'} + + iterare@1.2.1: + resolution: {integrity: sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==} + engines: {node: '>=6'} + + jackspeak@3.4.3: + resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + + jest-changed-files@30.5.1: + resolution: {integrity: sha512-0+bvMM/ENhDI29Z8q1r4HxiDIi4G5tnBmSw4esfPQoj9q8Nik7KIyuxHkTVnnniJQf05SxpGaKDQ+4h28ynGPg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-circus@30.5.2: + resolution: {integrity: sha512-vffFgjs5JSJ9q4ds1vNW3klKYPJfYfIY61LT/zaZgvTeASJOWZUt8LBfHgIcV4rwxlPBLl/ePBGccHEclS4PlQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-cli@30.5.2: + resolution: {integrity: sha512-YYYxUUVjFgPvgEleKNKMaYGIFgR3l3832Cl0kRL/oCiDZ03v7wImUtquHl2OOBCCNgprjZgBN5bczS/JklPBDg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + hasBin: true + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + jest-config@30.5.2: + resolution: {integrity: sha512-U6221OZekabePvGcGPf4raIBKMvYQWFHvhobDJRojOYaFMj2HaGytAdknjDhYc6JTz2fdHW9+6k0wWUDaNeOFQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + '@types/node': '*' + esbuild-register: '>=3.4.0' + ts-node: '>=9.0.0' + peerDependenciesMeta: + '@types/node': + optional: true + esbuild-register: + optional: true + ts-node: + optional: true + + jest-diff@30.5.2: + resolution: {integrity: sha512-rBtHnI6BWTiWj3lM7fOLVfChx7R9B0u9VV3PRHawKs79x6ZjW1QoSrKenaigNGWlvhtoi2BqvDbABDie+Os3xQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-docblock@30.5.0: + resolution: {integrity: sha512-NwDqcxtoZi33RhuW+zJS/RVA3rmheQ8BnwpYZuc/Eruaz6seQb7+aoCeDZu/3X7W2XmD8DbSo9Pn72DbKsBFYw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-each@30.5.2: + resolution: {integrity: sha512-GRrW+7fmmgmkvyfEBqc1QFdWnF1Ex5yG6Y6AWL4TTxnkWlKIT98dsKh3P3UuWm6v4XsQwVE6DEzXIPMzWJ3ZbA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-environment-node@30.5.2: + resolution: {integrity: sha512-Ciz4KgTGIbojxSKpuFImgWJj5EyqfE8xMq9NxWmOXnQywHHS03H9Mv+vaCB29J5pr3JBrY27WbRV18rBdjh8Dg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-haste-map@30.5.1: + resolution: {integrity: sha512-VIFgt67jW480YDxKfEv9IYQKrFpYt7bOCMn3VsnjK7AK9qo7p6acpnA1DHwsVOULE3dTaYew/6JaTD/d0VDHoQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-leak-detector@30.5.1: + resolution: {integrity: sha512-gt4GT2aWgEoCNTcBe4rqS74xTIUJxi+UD9SNSu9aOk5LmTEd6fS5KSTmAKAfitCCktQHNN+upUuL6EkBfFbMDQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-matcher-utils@30.5.2: + resolution: {integrity: sha512-lFkB365PTIHOhPzwrb9T6gvlDnPpOZ7/c3ewOKKB7bzztqjVrtlyRL2MkyfJXpyY2u2SKw001JKrTx14fBUFcQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-message-util@30.5.1: + resolution: {integrity: sha512-UdQlLdd9wL/Ys7xRErckqwD6wPlSZYueosSWuHc1r2ztGLwlgPvtSJq2+BPEgaEY13WLvfFbmhTj8pba0Sd1jg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-mock@30.5.2: + resolution: {integrity: sha512-KTHb37Fhj8xY8qPFvTFaFJHcdsumQp+ExsUlgoX232Agmc706gagBs53+CYvulV7MVQo9AgXOUxsqzzVBoJlrA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-regex-util@30.5.0: + resolution: {integrity: sha512-Mg0WK7A6xRHLSA1udJ8y9f3lM0uUhFTBnLKzwPmqB9AylvpleJ6BLemR8K9dK27DY+cesDryoA7yLZCAHsPG1A==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-resolve-dependencies@30.5.2: + resolution: {integrity: sha512-GMI0DP5enX9Z2qW2zFy1bOkrCfWAOPRJQ7qHt0pdfrxBPsgWxglMPrRSK2TX/wRWYxcPRSLFg3Z88qPOzHx7FQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-resolve@30.5.1: + resolution: {integrity: sha512-wprhLejRtwN6h8ZgaqC0eYjGJ1uMdGPT/+b3eFncbG4NWuuP9QL+vWwRinu9waw7hkOLcpMJGVJAMgBwsPssMQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-runner@30.5.2: + resolution: {integrity: sha512-/B6px7hiiNhVSRwuv9AGn0nawYvwsHeQZ3ItTd5Gp2diFd0EOKaWVeWqcbw3L88vx1GfpCKjQkxWItZCTl11Rw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-runtime@30.5.2: + resolution: {integrity: sha512-0paUAHBlheai10A3XSy9Xh+YBG0IROy+/qzcDPzQ/nbbXrznQzeWy5qniICWK6d3W3scaRQCVAbXdcK0ibBq4w==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-snapshot@30.5.2: + resolution: {integrity: sha512-jKIdes25AnAH73dOCi2qE6J6vHJ6L2vyBS11M89kT50DVJcLTf2AOjvcc+2vVaN8lUbY5v2R83aqXo3Ro9fqYA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-util@30.5.1: + resolution: {integrity: sha512-yKuxmNy2rSbTXw+3SIPanJo+nV4/BS1p26v44IYBFMsswSQySfMMcPHErnOncda7i9HEz0q605rIhSTBVgrZTg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-validate@30.5.1: + resolution: {integrity: sha512-i/buJ56wTpxihE93hQYNMfdOThS87+HGvLZzZJmU4xggPcdTYQq051iwALLCHp3q+SkCGH+EFejQZz5EbBSkkg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-watcher@30.5.2: + resolution: {integrity: sha512-rqRgg4R11GA9m1UsEZwQeixHsgZReCn6TOHAHtIH33yXrIvoX0OGPA20Yzzjkz7X40fZvcRSxEpQppYPcWzmcQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-worker@27.5.1: + resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} + engines: {node: '>= 10.13.0'} + + jest-worker@30.5.1: + resolution: {integrity: sha512-Cbxh5v7AoLuFRmFJSM4/aHdQ68rjXvUWr716EE0Dh3I7T+T/3FgFKhOERGXHcU2Meftq9+9zxPM3TSNyI9D+HA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest@30.5.2: + resolution: {integrity: sha512-3gnpdBIza8ijCl3iMV9ChE3hSt1+46865qqod863gQtJr1DixOkAU5DoGbi3u+XlRcw++BhZQMu/y4xBdHBvSQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + hasBin: true + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + jiti@2.7.0: + resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==} + hasBin: true + + joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + + js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + + js-yaml@3.15.2: + resolution: {integrity: sha512-6EuL879VkRA+1Cz578mKMiKvjPNEuk6+r1JaFzoSWejZmtf7xWbIyw1e3KkxlkzTIt9Taw6JBhEppG7utc1P+w==} + hasBin: true + + js-yaml@5.4.1: + resolution: {integrity: sha512-28R/k+NAjeuf7+CKlTxWZVExJGwVVLwY06DgEnOMz2gEpfNkDcD7QvyiVPT0xy0XXhU8vHsd4Ot42OOPdJG7dQ==} + hasBin: true + + jsesc@3.1.0: + resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==} + engines: {node: '>=6'} + hasBin: true + + json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + + json-schema-ref-resolver@3.0.0: + resolution: {integrity: sha512-hOrZIVL5jyYFjzk7+y7n5JDzGlU8rfWDuYyHwGa2WA8/pcmMHezp2xsVwxrebD/Q9t8Nc5DboieySDpCp4WG4A==} + + json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + + json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + + jsonc-parser@3.3.1: + resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==} + + leven@3.1.0: + resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} + engines: {node: '>=6'} + + light-my-request@6.6.0: + resolution: {integrity: sha512-CHYbu8RtboSIoVsHZ6Ye4cj4Aw/yg2oAFimlF7mNvfDV192LR7nDiKtSIfCuLT7KokPSTn/9kfVLm5OGN0A28A==} + + lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + + load-esm@1.0.3: + resolution: {integrity: sha512-v5xlu8eHD1+6r8EHTg6hfmO97LN8ugKtiXcy5e6oN72iD2r6u0RPfLl6fxM+7Wnh2ZRq15o0russMst44WauPA==} + engines: {node: '>=13.2.0'} + + locate-path@5.0.0: + resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} + engines: {node: '>=8'} + + lodash.memoize@4.1.2: + resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==} + + lodash@4.18.1: + resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==} + + log-symbols@4.1.0: + resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} + engines: {node: '>=10'} + + log-symbols@7.0.1: + resolution: {integrity: sha512-ja1E3yCr9i/0hmBVaM0bfwDjnGy8I/s6PP4DFp+yP+a+mrHO4Rm7DtmnqROTUkHIkqffC84YY7AeqX6oFk0WFg==} + engines: {node: '>=18'} + + long@5.3.2: + resolution: {integrity: sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==} + + lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + + lru-cache@11.5.3: + resolution: {integrity: sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==} + engines: {node: 20 || >=22} + + lru-cache@5.1.1: + resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + + lru.min@1.1.5: + resolution: {integrity: sha512-5J9ysMYUpYIg9RF2vJpy9SinEmSviFSe0GyPpCQ4L5QSkLAgeLXlTAOu2ZwWUU5m+0SBl6gUU1R1ZQB3aKypfA==} + engines: {bun: '>=1.0.0', deno: '>=1.30.0', node: '>=8.0.0'} + + magic-string@1.0.0: + resolution: {integrity: sha512-CGvjzMN08iv6w1mm4/x3Gh1hLb4VnyRUA15FFpl6CsCIGGoe36k7kY5KNz9QDbSBN5I/fWHM6ZlIkUTa5xdUEA==} + + make-dir@4.0.0: + resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} + engines: {node: '>=10'} + + make-error@1.3.6: + resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + + media-typer@0.3.0: + resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} + engines: {node: '>= 0.6'} + + media-typer@1.1.1: + resolution: {integrity: sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==} + engines: {node: '>= 0.8'} + + merge-descriptors@2.0.0: + resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==} + engines: {node: '>=18'} + + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + + methods@1.1.2: + resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} + engines: {node: '>= 0.6'} + + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-db@1.54.0: + resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + mime-types@3.0.2: + resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==} + engines: {node: '>=18'} + + mime@2.6.0: + resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} + engines: {node: '>=4.0.0'} + hasBin: true + + mime@3.0.0: + resolution: {integrity: sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==} + engines: {node: '>=10.0.0'} + hasBin: true + + mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + + mimic-function@5.0.1: + resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==} + engines: {node: '>=18'} + + minimatch@10.2.6: + resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==} + engines: {node: 18 || 20 || >=22} + + minimatch@9.0.9: + resolution: {integrity: sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==} + engines: {node: '>=16 || 14 >=14.17'} + + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + + minimizer-webpack-plugin@5.11.0: + resolution: {integrity: sha512-2JVy2DY+iBtfRyrQB5cRM7lfurnJIi6jFTgLip/7FxDu0WxswrIRzr4fBySQ0X7HqM7BcwE28zm+HfQ5V6y4Cg==} + engines: {node: '>= 10.13.0'} + peerDependencies: + '@minify-html/node': '*' + '@napi-rs/image': '*' + '@swc/core': '*' + '@swc/css': '*' + '@swc/html': '*' + clean-css: '*' + cssnano: '*' + csso: '*' + esbuild: '*' + html-minifier-terser: '*' + imagemin: '*' + lightningcss: '*' + postcss: '*' + sharp: '*' + svgo: '*' + uglify-js: '*' + webpack: ^5.1.0 + peerDependenciesMeta: + '@minify-html/node': + optional: true + '@napi-rs/image': + optional: true + '@swc/core': + optional: true + '@swc/css': + optional: true + '@swc/html': + optional: true + clean-css: + optional: true + cssnano: + optional: true + csso: + optional: true + esbuild: + optional: true + html-minifier-terser: + optional: true + imagemin: + optional: true + lightningcss: + optional: true + postcss: + optional: true + sharp: + optional: true + svgo: + optional: true + uglify-js: + optional: true + + minipass@7.1.3: + resolution: {integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==} + engines: {node: '>=16 || 14 >=14.17'} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + multer@2.4.0: + resolution: {integrity: sha512-7dqa0ZcFfzbefdTuIkzOSMvZWC0J7FLqBOjJUZvDCXShIURWKxAyTT1wHhnE5q19c7jOJf43IYYKjBmZVZmvhg==} + engines: {node: '>= 10.16.0'} + + mute-stream@0.0.8: + resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} + + mute-stream@3.0.0: + resolution: {integrity: sha512-dkEJPVvun4FryqBmZ5KhDo0K9iDXAwn08tMLDinNdRBNPcYEDiWYysLcc6k3mjTMlbP9KyylvRpd4wFtwrT9rw==} + engines: {node: ^20.17.0 || >=22.9.0} + + mysql2@3.15.3: + resolution: {integrity: sha512-FBrGau0IXmuqg4haEZRBfHNWB5mUARw6hNwPDXXGg0XzVJ50mr/9hb267lvpVMnhZ1FON3qNd4Xfcez1rbFwSg==} + engines: {node: '>= 8.0'} + + named-placeholders@1.1.6: + resolution: {integrity: sha512-Tz09sEL2EEuv5fFowm419c1+a/jSMiBjI9gHxVLrVdbUkkNUUfjsVYs9pVZu5oCon/kmRh9TfLEObFtkVxmY0w==} + engines: {node: '>=8.0.0'} + + nanoid@5.1.16: + resolution: {integrity: sha512-kVrnsrJqMR8+oLJnGEmSWw9BivK5mt7H3FZatVRjrc5wGqFYuBxX1yG7+A7Gi5AefkX6t/oCkizcQgpu0cY1dQ==} + engines: {node: ^18 || >=20} + hasBin: true + + napi-postinstall@0.3.4: + resolution: {integrity: sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + hasBin: true + + natural-compare@1.4.0: + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + + negotiator@1.1.0: + resolution: {integrity: sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==} + engines: {node: '>=18'} + + neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + + nestjs-pino@5.2.0: + resolution: {integrity: sha512-w7zIidjqzhvB7TSDBttC//NxKBAz2rr2d6pNctsglWqb/VqNbDj/Hko2VsgHMYmLpIoZ5pka5gASbGc60V8Qvw==} + engines: {node: '>=22.12.0'} + peerDependencies: + '@nestjs/common': ^11.0.8 || ^12.0.2 + '@nestjs/core': ^11.0.8 || ^12.0.2 + pino: ^10.0.0 + pino-http: ^11.0.0 + rxjs: ^7.1.0 + + node-addon-api@7.1.1: + resolution: {integrity: sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==} + + node-emoji@2.1.3: + resolution: {integrity: sha512-E2WEOVsgs7O16zsURJ/eH8BqhF029wGpEOnv7Urwdo2wmQanOACwJQh0devF9D9RhoZru0+9JXIS0dBXIAz+lA==} + engines: {node: '>=18'} + + node-emoji@2.2.0: + resolution: {integrity: sha512-Z3lTE9pLaJF47NyMhd4ww1yFTAP8YhYI8SleJiHzM46Fgpm5cnNzSl9XfzFNqbaz+VlJrIj3fXQ4DeN1Rjm6cw==} + engines: {node: '>=18'} + + node-int64@0.4.0: + resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} + + node-releases@2.0.56: + resolution: {integrity: sha512-x0InOIyzgdk+eyaWaRJFH5snEtiImgBgblZ2CyPrLmqqcuMQkEvcDPHbzqbD8eDsSeJbVOjn+crzyzHaM4D+/A==} + engines: {node: '>=18'} + + normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + + npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} + + object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + + object-inspect@1.13.4: + resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} + engines: {node: '>= 0.4'} + + ohash@2.0.12: + resolution: {integrity: sha512-65S/5gk9YSsaRjcyf7Nfa6h/d3E8/1gslpXfI4W7Dxn/oap8IKRuNT5VXkLQ1YFKIEg4apRY4Pj6aiwFzrDdmw==} + + on-exit-leak-free@2.1.2: + resolution: {integrity: sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==} + engines: {node: '>=14.0.0'} + + on-finished@2.4.1: + resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} + engines: {node: '>= 0.8'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + + onetime@7.0.0: + resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==} + engines: {node: '>=18'} + + ora@5.4.1: + resolution: {integrity: sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==} + engines: {node: '>=10'} + + ora@9.4.1: + resolution: {integrity: sha512-6VlU9MLXbjVQD04AZCMX28hVtA5bUoadvUqO76MUCVA0ilwJbMiHsITRPfyVm6p/BC0Av/BXMujx39WCe1LEqw==} + engines: {node: '>=20'} + + os-tmpdir@1.0.2: + resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} + engines: {node: '>=0.10.0'} + + oxlint-tsgolint@7.0.2002: + resolution: {integrity: sha512-rQAj2RAQM57nCwTd3PhtnAkREGW2StqI47tzudNlJF8WwGommM7rVpeP4O1O8/ZiuDZ9f2GnTESzLHGTluwkvQ==} + hasBin: true + + oxlint@1.83.0: + resolution: {integrity: sha512-cyDzSzaw3uzP0TeCeq3lLRPPoaUxkbB4ZOXj+kn+5r+BX9V+4bNVGk9lxer+WrgcpebH4JxLlJ3KQjveVztOLQ==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + oxlint-tsgolint: '>=7.0.2001' + vite-plus: '*' + peerDependenciesMeta: + oxlint-tsgolint: + optional: true + vite-plus: + optional: true + + p-limit@2.3.0: + resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} + engines: {node: '>=6'} + + p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + + p-locate@4.1.0: + resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} + engines: {node: '>=8'} + + p-try@2.2.0: + resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} + engines: {node: '>=6'} + + package-json-from-dist@1.0.1: + resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} + + parse-json@5.2.0: + resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} + engines: {node: '>=8'} + + parseurl@1.3.3: + resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} + engines: {node: '>= 0.8'} + + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-scurry@1.11.1: + resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} + engines: {node: '>=16 || 14 >=14.18'} + + path-scurry@2.0.2: + resolution: {integrity: sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==} + engines: {node: 18 || 20 || >=22} + + path-to-regexp@8.4.2: + resolution: {integrity: sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==} + + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + + perfect-debounce@2.1.0: + resolution: {integrity: sha512-LjgdTytVFXeUgtHZr9WYViYSM/g8MkcTPYDlPa3cDqMirHjKiSZPYd6DoL7pK8AJQr+uWkQvCjHNdiMqsrJs+g==} + + pg-cloudflare@1.4.1: + resolution: {integrity: sha512-6PQbsFWZcp9EmJEwy5cGQ2La+AMWpP46lgbb8X+U/XsHIUweYDNCpeuKck5RxL2MdVFi7krbbEi5nX4Zh7JhrQ==} + + pg-connection-string@2.14.1: + resolution: {integrity: sha512-qR3kGNPBLpCNtz0evbKA0Y/MRFXwSSdT+pTJvYp/bXTcReZbvX1kzF0IyTc1QnxqF7AZbOeBhNL8R5mYQZV/MA==} + + pg-int8@1.0.1: + resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} + engines: {node: '>=4.0.0'} + + pg-pool@3.14.0: + resolution: {integrity: sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw==} + peerDependencies: + pg: '>=8.0' + + pg-protocol@1.16.1: + resolution: {integrity: sha512-p9VOFMiHB/ZbJATetbg+99PxssTVSQRnyuPSQ67mN1+1KBOjZaZ83ZQzltnxPhJwSsC3nwVjJ10DVJlerbFzLg==} + + pg-types@2.2.0: + resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} + engines: {node: '>=4'} + + pg@8.23.1: + resolution: {integrity: sha512-aL96AHANtWjPLDOLqnhx+ngp9+UK7ETEU8VJrDCGvsSSi/mGLcWYsS6Herg7lmaBJe4uwrfqsa7gTEFaSizDoQ==} + engines: {node: '>= 16.0.0'} + peerDependencies: + pg-native: '>=3.0.1' + peerDependenciesMeta: + pg-native: + optional: true + + pgpass@1.0.5: + resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@2.3.2: + resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} + engines: {node: '>=8.6'} + + picomatch@4.0.5: + resolution: {integrity: sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==} + engines: {node: '>=12'} + + picomatch@4.0.7: + resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} + engines: {node: '>=12'} + + pino-abstract-transport@3.0.0: + resolution: {integrity: sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==} + + pino-http@11.0.0: + resolution: {integrity: sha512-wqg5XIAGRRIWtTk8qPGxkbrfiwEWz1lgedVLvhLALudKXvg1/L2lTFgTGPJ4Z2e3qcRmxoFxDuSdMdMGNM6I1g==} + + pino-pretty@13.1.3: + resolution: {integrity: sha512-ttXRkkOz6WWC95KeY9+xxWL6AtImwbyMHrL1mSwqwW9u+vLp/WIElvHvCSDg0xO/Dzrggz1zv3rN5ovTRVowKg==} + hasBin: true + + pino-std-serializers@7.1.0: + resolution: {integrity: sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==} + + pino@10.3.1: + resolution: {integrity: sha512-r34yH/GlQpKZbU1BvFFqOjhISRo1MNx1tWYsYvmj6KIRHSPMT2+yHOEb1SG6NMvRoHRF0a07kCOox/9yakl1vg==} + hasBin: true + + pirates@4.0.7: + resolution: {integrity: sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==} + engines: {node: '>= 6'} + + pkg-dir@4.2.0: + resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} + engines: {node: '>=8'} + + pkg-types@2.3.3: + resolution: {integrity: sha512-j/lCFdcppV0JxWpCEITdbDltBxPP6cHT+yNJ6Go2OgoSA9518X847X9z0p6LtA4Nc16+eQzCZjRrWanTGvHJ5w==} + + pluralize@8.0.0: + resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} + engines: {node: '>=4'} + + postgres-array@2.0.0: + resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} + engines: {node: '>=4'} + + postgres-array@3.0.4: + resolution: {integrity: sha512-nAUSGfSDGOaOAEGwqsRY27GPOea7CNipJPOA7lPbdEpx5Kg3qzdP0AaWC5MlhTWV9s4hFX39nomVZ+C4tnGOJQ==} + engines: {node: '>=12'} + + postgres-bytea@1.0.1: + resolution: {integrity: sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==} + engines: {node: '>=0.10.0'} + + postgres-date@1.0.7: + resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==} + engines: {node: '>=0.10.0'} + + postgres-interval@1.2.0: + resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} + engines: {node: '>=0.10.0'} + + postgres@3.4.7: + resolution: {integrity: sha512-Jtc2612XINuBjIl/QTWsV5UvE8UHuNblcO3vVADSrKsrc6RqGX6lOW1cEo3CM2v0XG4Nat8nI+YM7/f26VxXLw==} + engines: {node: '>=12'} + + prettier@3.9.8: + resolution: {integrity: sha512-WRFq3Wn3WId7LLROfMLdH7xaFr2jR62wU8nLO6rQUOLOxNZUviyJQs1M0iIhLexSFy+L+w0ch66wtoO2jRjG0A==} + engines: {node: '>=14'} + hasBin: true + + pretty-format@30.5.1: + resolution: {integrity: sha512-byhRAPguVKMQIj4kjJwJ5lAskVhfuiSdiYl/aLTWpgkGEmic2jYhJh1yE9ih8Ox44Xg9ccCT11/S6QrzSJuNrg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + prisma@7.10.0: + resolution: {integrity: sha512-o0ornyJOWgygVAzGCpr8PdXV8EJLHyVGDDUr/voBQt8Azzw8cYTByzzPGcA/m4tCkPcnJA8raEOv2CslsKhPEw==} + engines: {node: ^20.19 || ^22.12 || >=24.0} + hasBin: true + peerDependencies: + better-sqlite3: '>=9.0.0' + typescript: '>=5.4.0' + peerDependenciesMeta: + better-sqlite3: + optional: true + typescript: + optional: true + + process-warning@4.0.1: + resolution: {integrity: sha512-3c2LzQ3rY9d0hc1emcsHhfT9Jwz0cChib/QN89oME2R451w5fy3f0afAhERFZAwrbDU43wk12d0ORBpDVME50Q==} + + process-warning@5.1.0: + resolution: {integrity: sha512-jQSaVHsPgtyw60e1rQ/A+/ArPEj/S8pS/vFnyGa/gYFXrKk/6RuDkoqVDQ5NI5MmS01698ltlAk0NoDBNLujRw==} + + proper-lockfile@4.1.2: + resolution: {integrity: sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==} + + proxy-addr@2.0.8: + resolution: {integrity: sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==} + engines: {node: '>= 0.10'} + + pump@3.0.4: + resolution: {integrity: sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==} + + pure-rand@6.1.0: + resolution: {integrity: sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==} + + pure-rand@7.0.1: + resolution: {integrity: sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ==} + + qs@6.16.0: + resolution: {integrity: sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==} + engines: {node: '>=0.6'} + + quick-format-unescaped@4.0.4: + resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==} + + range-parser@1.3.0: + resolution: {integrity: sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==} + engines: {node: '>= 0.6'} + + raw-body@3.0.2: + resolution: {integrity: sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==} + engines: {node: '>= 0.10'} + + rc9@3.1.0: + resolution: {integrity: sha512-ufjkNVzbRHKcCOmTahZkmVsyc3W+MSk3jY03m+a7tGHkIsdVMG9l10/3HvFbWkkKzY5VFp3pkRsIo/UYgmFL7Q==} + + react-dom@19.3.0: + resolution: {integrity: sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q==} + peerDependencies: + react: ^19.3.0 + + react-is@18.3.1: + resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} + + react-is@19.3.0: + resolution: {integrity: sha512-UpMYezM4v5/18F28aC66AEsjXIgE02kyEMH6yLdgLXu/UTfa1Ntwck/nNLrbqJsEXW7gPb0coNO9FQse9WTovA==} + + react@19.3.0: + resolution: {integrity: sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog==} + engines: {node: '>=0.10.0'} + + readable-stream@3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + + readdirp@5.1.1: + resolution: {integrity: sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==} + engines: {node: '>= 20.19.0'} + + real-require@0.2.0: + resolution: {integrity: sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==} + engines: {node: '>= 12.13.0'} + + real-require@1.0.0: + resolution: {integrity: sha512-P4nbQYQfePJxRSmY+v/KINxVucm4NF3p3s7pJveMTtom52FR4YGltUQLB8idDXwDDWW+eYrWDFbuzUnjoWHF7g==} + + redis-errors@1.2.0: + resolution: {integrity: sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==} + engines: {node: '>=4'} + + reflect-metadata@0.2.2: + resolution: {integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==} + + remeda@2.33.4: + resolution: {integrity: sha512-ygHswjlc/opg2VrtiYvUOPLjxjtdKvjGz1/plDhkG66hjNjFr1xmfrs2ClNFo/E6TyUFiwYNh53bKV26oBoMGQ==} + + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + + resolve-cwd@3.0.0: + resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} + engines: {node: '>=8'} + + resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + + restore-cursor@3.1.0: + resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==} + engines: {node: '>=8'} + + restore-cursor@5.1.0: + resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==} + engines: {node: '>=18'} + + ret@0.5.0: + resolution: {integrity: sha512-I1XxrZSQ+oErkRR4jYbAyEEu2I0avBvvMM5JN+6EBprOGRCs63ENqZ3vjavq8fBw2+62G5LF5XelKwuJpcvcxw==} + engines: {node: '>=10'} + + retry@0.12.0: + resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==} + engines: {node: '>= 4'} + + reusify@1.1.0: + resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + + rfdc@1.4.1: + resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} + + robust-predicates@3.0.3: + resolution: {integrity: sha512-NS3levdsRIUOmiJ8FZWCP7LG3QpJyrs/TE0Zpf1yvZu8cAJJ6QMW92H1c7kWpdIHo8RvmLxN/o2JXTKHp74lUA==} + + router@2.2.0: + resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==} + engines: {node: '>= 18'} + + run-async@2.4.1: + resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} + engines: {node: '>=0.12.0'} + + rxjs@7.8.2: + resolution: {integrity: sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + safe-regex2@5.1.1: + resolution: {integrity: sha512-mOSBvHGDZMuIEZMdOz/aCEYDCv0E7nfcNsIhUF+/P+xC7Hyf3FkvymqgPbg9D1EdSGu+uKbJgy09K/RKKc7kJA==} + hasBin: true + + safe-stable-stringify@2.5.0: + resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==} + engines: {node: '>=10'} + + safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + + scheduler@0.28.0: + resolution: {integrity: sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==} + + schema-utils@4.5.0: + resolution: {integrity: sha512-zJlMCZ0cAR5p/Y4oVpRoqioDMJcGxaXRrQ/4rP4WyR84vc5z/DolXdbvXeDpTwbtocDFr2rhPqHPErDCUtz2kA==} + engines: {node: '>= 10.13.0'} + + secure-json-parse@4.1.0: + resolution: {integrity: sha512-l4KnYfEyqYJxDwlNVyRfO2E4NTHfMKAWdUuA8J0yve2Dz/E/PdBepY03RvyJpssIpRFwJoCD55wA+mEDs6ByWA==} + + semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} + hasBin: true + + semver@7.8.5: + resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==} + engines: {node: '>=10'} + hasBin: true + + send@1.2.1: + resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==} + engines: {node: '>= 18'} + + seq-queue@0.0.5: + resolution: {integrity: sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q==} + + serve-static@2.2.1: + resolution: {integrity: sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==} + engines: {node: '>= 18'} + + set-cookie-parser@2.7.2: + resolution: {integrity: sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==} + + setprototypeof@1.2.0: + resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + side-channel-list@1.0.1: + resolution: {integrity: sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==} + engines: {node: '>= 0.4'} + + side-channel-map@1.0.1: + resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==} + engines: {node: '>= 0.4'} + + side-channel-weakmap@1.0.2: + resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==} + engines: {node: '>= 0.4'} + + side-channel@1.1.1: + resolution: {integrity: sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==} + engines: {node: '>= 0.4'} + + signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + + skin-tone@2.0.0: + resolution: {integrity: sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==} + engines: {node: '>=8'} + + slash@3.0.0: + resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} + engines: {node: '>=8'} + + sonic-boom@4.2.1: + resolution: {integrity: sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q==} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + source-map@0.7.6: + resolution: {integrity: sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==} + engines: {node: '>= 12'} + + split2@4.2.0: + resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} + engines: {node: '>= 10.x'} + + sprintf-js@1.0.3: + resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + + sqlstring@2.3.3: + resolution: {integrity: sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==} + engines: {node: '>= 0.6'} + + stack-utils@2.0.6: + resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} + engines: {node: '>=10'} + + standard-as-callback@2.1.0: + resolution: {integrity: sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==} + + statuses@2.0.2: + resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} + engines: {node: '>= 0.8'} + + std-env@3.10.0: + resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} + + stdin-discarder@0.3.2: + resolution: {integrity: sha512-eCPu1qRxPVkl5605OTWF8Wz40b4Mf45NY5LQmVPQ599knfs5QhASUm9GbJ5BDMDOXgrnh0wyEdvzmL//YMlw0A==} + engines: {node: '>=18'} + + streamsearch@1.1.0: + resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==} + engines: {node: '>=10.0.0'} + + string-length@4.0.2: + resolution: {integrity: sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==} + engines: {node: '>=10'} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + string-width@5.1.2: + resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} + engines: {node: '>=12'} + + string-width@8.2.2: + resolution: {integrity: sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg==} + engines: {node: '>=20'} + + string_decoder@1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-ansi@7.2.0: + resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==} + engines: {node: '>=12'} + + strip-bom@3.0.0: + resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} + engines: {node: '>=4'} + + strip-bom@4.0.0: + resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} + engines: {node: '>=8'} + + strip-final-newline@2.0.0: + resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} + engines: {node: '>=6'} + + strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + + strip-json-comments@5.0.3: + resolution: {integrity: sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==} + engines: {node: '>=14.16'} + + strtok3@10.3.5: + resolution: {integrity: sha512-ki4hZQfh5rX0QDLLkOCj+h+CVNkqmp/CMf8v8kZpkNVK6jGQooMytqzLZYUVYIZcFZ6yDB70EfD8POcFXiF5oA==} + engines: {node: '>=18'} + + superagent@10.3.0: + resolution: {integrity: sha512-B+4Ik7ROgVKrQsXTV0Jwp2u+PXYLSlqtDAhYnkkD+zn3yg8s/zjA2MeGayPoY/KICrbitwneDHrjSotxKL+0XQ==} + engines: {node: '>=14.18.0'} + + supertest@7.2.2: + resolution: {integrity: sha512-oK8WG9diS3DlhdUkcFn4tkNIiIbBx9lI2ClF8K+b2/m8Eyv47LSawxUzZQSNKUrVb2KsqeTDCcjAAVPYaSLVTA==} + engines: {node: '>=14.18.0'} + + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + swagger-ui-dist@5.32.14: + resolution: {integrity: sha512-nOA2pSQhcmODMUQZpJHYKNuwniDUqcOWGNaSCOoZv12FdOSJ9JxV95HtyRGNMqEBj6h6lCNTy20TgZDYTSuUIg==} + + synckit@0.11.13: + resolution: {integrity: sha512-eNRKgb3z66Yp3D2CixVujOUvXLFUTij/zVnV8KRyvFdQwpz7I5DS8UfRkTeLzb64u+dkzDSdelE24izu+zSSUg==} + engines: {node: ^14.18.0 || >=16.0.0} + + tagged-tag@1.0.0: + resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==} + engines: {node: '>=20'} + + tapable@2.3.3: + resolution: {integrity: sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==} + engines: {node: '>=6'} + + terser@5.51.2: + resolution: {integrity: sha512-bWnjSNscmuI+GJze6ZupnHP8G/cTcsJF+bXCeQknk2SHQsgbNJnLrqiH9jZ2W4STPVXH2mDKKRX3iwPhc9Cn/Q==} + engines: {node: '>=10'} + hasBin: true + + test-exclude@7.0.2: + resolution: {integrity: sha512-u9E6A+ZDYdp7a4WnarkXPZOx8Ilz46+kby6p1yZ8zsGTz9gYa6FIS7lj2oezzNKmtdyyJNNmmXDppga5GB7kSw==} + engines: {node: '>=18'} + + thread-stream@4.2.0: + resolution: {integrity: sha512-e2zZ96wSChazBsbENf/Pcm/4swHt2cEKQ92rhUjkL9GCKiTDJIaTBenjE/m9DXi0QBmTMDkFDdOomUy20A1tDQ==} + engines: {node: '>=20'} + + through@2.3.8: + resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} + + tmp@0.0.33: + resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} + engines: {node: '>=0.6.0'} + + toad-cache@3.7.4: + resolution: {integrity: sha512-m1TdR/rvT7kgGJZhspNtXdsdYk0fddFpJJFlG5s+UkPFo6lkLoZ3YLOaovPYjq1R75NP5JfeTlSHaOsE09peCg==} + engines: {node: '>=20'} + + toidentifier@1.0.1: + resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} + engines: {node: '>=0.6'} + + token-types@6.1.2: + resolution: {integrity: sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww==} + engines: {node: '>=14.16'} + + ts-jest@29.4.12: + resolution: {integrity: sha512-Ov6ClY53Fflh6BGAnY2DlTq1hYDrTycz2PVTXBWFW2CU+9zrEqAp9fWdGXl42EXO5RLSFAcAZ2JFKbP+zBTFfw==} + engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@babel/core': '>=7.0.0-beta.0 <8' + '@jest/transform': ^29.0.0 || ^30.0.0 + '@jest/types': ^29.0.0 || ^30.0.0 + babel-jest: ^29.0.0 || ^30.0.0 + esbuild: '*' + jest: ^29.0.0 || ^30.0.0 + jest-util: ^29.0.0 || ^30.0.0 + typescript: '>=4.3 <7' + peerDependenciesMeta: + '@babel/core': + optional: true + '@jest/transform': + optional: true + '@jest/types': + optional: true + babel-jest: + optional: true + esbuild: + optional: true + jest-util: + optional: true + + ts-loader@9.6.2: + resolution: {integrity: sha512-R4iuczmtgxvtuI556s+hTZ6/7Ee03VCAk/l/M8LY1OAsUgB7YydsCxkgq9D9pKRaD7GJqUi2u8fp9zZP/ufjKA==} + engines: {node: '>=12.0.0'} + peerDependencies: + loader-utils: '*' + typescript: '*' + webpack: ^4.0.0 || ^5.0.0 + peerDependenciesMeta: + loader-utils: + optional: true + + ts-node@10.9.2: + resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + + tsconfig-paths@4.2.0: + resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==} + engines: {node: '>=6'} + + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + + type-detect@4.0.8: + resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} + engines: {node: '>=4'} + + type-fest@0.21.3: + resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} + engines: {node: '>=10'} + + type-fest@4.41.0: + resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==} + engines: {node: '>=16'} + + type-fest@5.10.0: + resolution: {integrity: sha512-NoSdpq/WEiAg5sjmBkmV/hfxv6HJH4NqPNrqjtSO5CwRmpsDfaf4begxW34KdJykH/l1yHtwBWQkCRdoXO8mPA==} + engines: {node: '>=20'} + + type-is@1.6.18: + resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} + engines: {node: '>= 0.6'} + + type-is@2.1.0: + resolution: {integrity: sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==} + engines: {node: '>= 18'} + + typescript@6.0.3: + resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==} + engines: {node: '>=14.17'} + hasBin: true + + uglify-js@3.19.3: + resolution: {integrity: sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==} + engines: {node: '>=0.8.0'} + hasBin: true + + uid@2.0.2: + resolution: {integrity: sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==} + engines: {node: '>=8'} + + uint8array-extras@1.5.0: + resolution: {integrity: sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A==} + engines: {node: '>=18'} + + undici-types@7.18.2: + resolution: {integrity: sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==} + + undici@6.20.1: + resolution: {integrity: sha512-AjQF1QsmqfJys+LXfGTNum+qw4S88CojRInG/6t31W/1fk6G59s92bnAvGz5Cmur+kQv2SURXEvvudLmbrE8QA==} + engines: {node: '>=18.17'} + + unicode-emoji-modifier-base@1.0.0: + resolution: {integrity: sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==} + engines: {node: '>=4'} + + unpipe@1.0.0: + resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} + engines: {node: '>= 0.8'} + + unrs-resolver@1.12.2: + resolution: {integrity: sha512-dmlRxBJJayXjqTwC+JtF1HhJmgf3ftQ3YejFcZrf4+KKtJv0qDsK1pjqaaVjG7wJ5NJ6UVP1OqRMQ71Z4C3rxQ==} + + update-browserslist-db@1.3.3: + resolution: {integrity: sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + + util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + + v8-compile-cache-lib@3.0.1: + resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + + v8-to-istanbul@9.3.0: + resolution: {integrity: sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==} + engines: {node: '>=10.12.0'} + + valibot@1.4.2: + resolution: {integrity: sha512-gjdCvJ6d3RyHAneqxMYMW9QMCwYMb3jpOO0IyHZV1bnRHFBHrX3VkIILt5XYR0WhwHiH7Mty8ovuPZ/O3gamrg==} + peerDependencies: + typescript: '>=5' + peerDependenciesMeta: + typescript: + optional: true + + vary@1.1.2: + resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} + engines: {node: '>= 0.8'} + + watchpack@2.5.2: + resolution: {integrity: sha512-6i/00NBjP4yGPs+caKSyRfpTF/8Torsu0MOW3mMzIbhgISFder8i7xbqgHlLMwJrdiN8ndBV3UA1/AfzPSr+jg==} + engines: {node: '>=10.13.0'} + + wcwidth@1.0.1: + resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} + + webpack-sources@3.5.1: + resolution: {integrity: sha512-jyuiGJdtvY434z5bUZrjz67v76/ePNvFZTp9Mdz29IlH4+GPsgyGjiv0fKI+M7BdkU6ADjulUcKAd3tUK3WlEw==} + engines: {node: '>=10.13.0'} + + webpack@5.111.1: + resolution: {integrity: sha512-cNypaz0RP+S4cvQVi1M/3bRUkvNP0xZpL0TjFx+c6jg64VbxD+2weWDgY9UnjRI6dhZgtaj8DU76GGFcJ79xPQ==} + engines: {node: '>=10.13.0'} + hasBin: true + peerDependencies: + webpack-cli: '*' + peerDependenciesMeta: + webpack-cli: + optional: true + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + wordwrap@1.0.0: + resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} + + wrap-ansi@6.2.0: + resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} + engines: {node: '>=8'} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + wrap-ansi@8.1.0: + resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} + engines: {node: '>=12'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + write-file-atomic@5.0.1: + resolution: {integrity: sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + + xtend@4.0.2: + resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} + engines: {node: '>=0.4'} + + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yallist@3.1.1: + resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + + yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + + yargs@17.7.3: + resolution: {integrity: sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==} + engines: {node: '>=12'} + + yn@3.1.1: + resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} + engines: {node: '>=6'} + + yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + + yoctocolors@2.2.0: + resolution: {integrity: sha512-xYqdZFUK/VYazNl/oCDYN+3WloWQwMfZxBoiNt6qNyk+xfOdi598muWE42rNZFp1kNOiqW936q5RhUdnpqElSg==} + engines: {node: '>=18'} + + zeptomatch@2.1.0: + resolution: {integrity: sha512-KiGErG2J0G82LSpniV0CtIzjlJ10E04j02VOudJsPyPwNZgGnRKQy7I1R7GMyg/QswnE4l7ohSGrQbQbjXPPDA==} + + zod@4.6.5: + resolution: {integrity: sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==} + +snapshots: + + '@angular-devkit/core@22.1.8(chokidar@5.0.0)': + dependencies: + ajv: 8.20.0 + ajv-formats: 3.0.1(ajv@8.20.0) + jsonc-parser: 3.3.1 + picomatch: 4.0.5 + rxjs: 7.8.2 + source-map: 0.7.6 + optionalDependencies: + chokidar: 5.0.0 + + '@angular-devkit/schematics-cli@22.1.8(@types/node@24.13.6)(chokidar@5.0.0)': + dependencies: + '@angular-devkit/core': 22.1.8(chokidar@5.0.0) + '@angular-devkit/schematics': 22.1.8(chokidar@5.0.0) + '@inquirer/prompts': 8.5.2(@types/node@24.13.6) + transitivePeerDependencies: + - '@types/node' + - chokidar + + '@angular-devkit/schematics@22.1.8(chokidar@5.0.0)': + dependencies: + '@angular-devkit/core': 22.1.8(chokidar@5.0.0) + jsonc-parser: 3.3.1 + magic-string: 1.0.0 + ora: 9.4.1 + rxjs: 7.8.2 + transitivePeerDependencies: + - chokidar + + '@babel/code-frame@7.29.7': + dependencies: + '@babel/helper-validator-identifier': 7.29.7 + js-tokens: 4.0.0 + picocolors: 1.1.1 + + '@babel/compat-data@7.29.7': {} + + '@babel/core@7.29.7': + dependencies: + '@babel/code-frame': 7.29.7 + '@babel/generator': 7.29.8 + '@babel/helper-compilation-targets': 7.29.7 + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7) + '@babel/helpers': 7.29.7 + '@babel/parser': 7.29.9 + '@babel/template': 7.29.7 + '@babel/traverse': 7.29.8 + '@babel/types': 7.29.8 + '@jridgewell/remapping': 2.3.5 + convert-source-map: 2.0.0 + debug: 4.4.3 + gensync: 1.0.0-beta.2 + json5: 2.2.3 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + '@babel/generator@7.29.8': + dependencies: + '@babel/parser': 7.29.9 + '@babel/types': 7.29.8 + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + jsesc: 3.1.0 + + '@babel/helper-compilation-targets@7.29.7': + dependencies: + '@babel/compat-data': 7.29.7 + '@babel/helper-validator-option': 7.29.7 + browserslist: 4.29.0 + lru-cache: 5.1.1 + semver: 6.3.1 + + '@babel/helper-globals@7.29.7': {} + + '@babel/helper-module-imports@7.29.7': + dependencies: + '@babel/traverse': 7.29.8 + '@babel/types': 7.29.8 + transitivePeerDependencies: + - supports-color + + '@babel/helper-module-transforms@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-module-imports': 7.29.7 + '@babel/helper-validator-identifier': 7.29.7 + '@babel/traverse': 7.29.8 + transitivePeerDependencies: + - supports-color + + '@babel/helper-plugin-utils@7.29.7': {} + + '@babel/helper-string-parser@7.29.7': {} + + '@babel/helper-validator-identifier@7.29.7': {} + + '@babel/helper-validator-option@7.29.7': {} + + '@babel/helpers@7.29.7': + dependencies: + '@babel/template': 7.29.7 + '@babel/types': 7.29.8 + + '@babel/parser@7.29.9': + dependencies: + '@babel/types': 7.29.8 + + '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-import-attributes@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/template@7.29.7': + dependencies: + '@babel/code-frame': 7.29.7 + '@babel/parser': 7.29.9 + '@babel/types': 7.29.8 + + '@babel/traverse@7.29.8': + dependencies: + '@babel/code-frame': 7.29.7 + '@babel/generator': 7.29.8 + '@babel/helper-globals': 7.29.7 + '@babel/parser': 7.29.9 + '@babel/template': 7.29.7 + '@babel/types': 7.29.8 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + '@babel/types@7.29.8': + dependencies: + '@babel/helper-string-parser': 7.29.7 + '@babel/helper-validator-identifier': 7.29.7 + + '@bcoe/v8-coverage@0.2.3': {} + + '@borewit/text-codec@0.2.2': {} + + '@colors/colors@1.5.0': + optional: true + + '@cspotcode/source-map-support@0.8.1': + dependencies: + '@jridgewell/trace-mapping': 0.3.9 + + '@electric-sql/pglite-socket@0.1.3(@electric-sql/pglite@0.4.3)': + dependencies: + '@electric-sql/pglite': 0.4.3 + + '@electric-sql/pglite-tools@0.3.3(@electric-sql/pglite@0.4.3)': + dependencies: + '@electric-sql/pglite': 0.4.3 + + '@electric-sql/pglite@0.4.3': {} + + '@emnapi/core@1.10.0': + dependencies: + '@emnapi/wasi-threads': 1.2.1 + tslib: 2.8.1 + optional: true + + '@emnapi/runtime@1.10.0': + dependencies: + tslib: 2.8.1 + optional: true + + '@emnapi/wasi-threads@1.2.1': + dependencies: + tslib: 2.8.1 + optional: true + + '@fastify/accept-negotiator@2.1.0': {} + + '@fastify/ajv-compiler@4.0.6': + dependencies: + ajv: 8.20.0 + ajv-formats: 3.0.1(ajv@8.20.0) + fast-uri: 4.2.1 + + '@fastify/cors@11.3.0': + dependencies: + fastify-plugin: 6.0.0 + toad-cache: 3.7.4 + + '@fastify/error@4.2.0': {} + + '@fastify/fast-json-stringify-compiler@5.1.0': + dependencies: + fast-json-stringify: 7.0.1 + + '@fastify/formbody@9.0.0': + dependencies: + fast-querystring: 1.1.2 + fastify-plugin: 6.0.0 + + '@fastify/forwarded@3.0.2': {} + + '@fastify/merge-json-schemas@0.2.1': + dependencies: + dequal: 2.0.3 + + '@fastify/proxy-addr@5.1.1': + dependencies: + '@fastify/forwarded': 3.0.2 + ipaddr.js: 2.5.0 + + '@fastify/send@4.1.1': + dependencies: + '@lukeed/ms': 2.0.2 + escape-html: 1.0.3 + fast-decode-uri-component: 1.0.1 + http-errors: 2.0.1 + mime: 3.0.0 + + '@fastify/static@10.1.4': + dependencies: + '@fastify/accept-negotiator': 2.1.0 + '@fastify/error': 4.2.0 + '@fastify/send': 4.1.1 + content-disposition: 3.0.0 + fastify-plugin: 6.0.0 + fastq: 1.20.3 + glob: 13.0.6 + + '@inquirer/ansi@2.0.8': {} + + '@inquirer/checkbox@5.2.5(@types/node@24.13.6)': + dependencies: + '@inquirer/ansi': 2.0.8 + '@inquirer/core': 12.0.3(@types/node@24.13.6) + '@inquirer/figures': 2.0.9 + '@inquirer/type': 4.1.1(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/confirm@6.3.2(@types/node@24.13.6)': + dependencies: + '@inquirer/core': 12.0.3(@types/node@24.13.6) + '@inquirer/type': 4.1.1(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/core@12.0.3(@types/node@24.13.6)': + dependencies: + '@inquirer/ansi': 2.0.8 + '@inquirer/figures': 2.0.9 + '@inquirer/type': 4.1.1(@types/node@24.13.6) + cli-width: 4.1.0 + fast-wrap-ansi: 0.2.2 + mute-stream: 3.0.0 + signal-exit: 4.1.0 + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/editor@5.3.3(@types/node@24.13.6)': + dependencies: + '@inquirer/core': 12.0.3(@types/node@24.13.6) + '@inquirer/external-editor': 3.0.5(@types/node@24.13.6) + '@inquirer/type': 4.1.1(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/expand@5.1.5(@types/node@24.13.6)': + dependencies: + '@inquirer/core': 12.0.3(@types/node@24.13.6) + '@inquirer/type': 4.1.1(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/external-editor@3.0.5(@types/node@24.13.6)': + dependencies: + chardet: 2.2.0 + iconv-lite: 0.7.3 + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/figures@2.0.9': {} + + '@inquirer/input@5.1.6(@types/node@24.13.6)': + dependencies: + '@inquirer/core': 12.0.3(@types/node@24.13.6) + '@inquirer/type': 4.1.1(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/number@4.2.3(@types/node@24.13.6)': + dependencies: + '@inquirer/core': 12.0.3(@types/node@24.13.6) + '@inquirer/type': 4.1.1(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/password@5.2.2(@types/node@24.13.6)': + dependencies: + '@inquirer/ansi': 2.0.8 + '@inquirer/core': 12.0.3(@types/node@24.13.6) + '@inquirer/type': 4.1.1(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/prompts@8.5.2(@types/node@24.13.6)': + dependencies: + '@inquirer/checkbox': 5.2.5(@types/node@24.13.6) + '@inquirer/confirm': 6.3.2(@types/node@24.13.6) + '@inquirer/editor': 5.3.3(@types/node@24.13.6) + '@inquirer/expand': 5.1.5(@types/node@24.13.6) + '@inquirer/input': 5.1.6(@types/node@24.13.6) + '@inquirer/number': 4.2.3(@types/node@24.13.6) + '@inquirer/password': 5.2.2(@types/node@24.13.6) + '@inquirer/rawlist': 5.3.5(@types/node@24.13.6) + '@inquirer/search': 4.3.3(@types/node@24.13.6) + '@inquirer/select': 5.2.5(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/prompts@8.7.2(@types/node@24.13.6)': + dependencies: + '@inquirer/checkbox': 5.2.5(@types/node@24.13.6) + '@inquirer/confirm': 6.3.2(@types/node@24.13.6) + '@inquirer/editor': 5.3.3(@types/node@24.13.6) + '@inquirer/expand': 5.1.5(@types/node@24.13.6) + '@inquirer/input': 5.1.6(@types/node@24.13.6) + '@inquirer/number': 4.2.3(@types/node@24.13.6) + '@inquirer/password': 5.2.2(@types/node@24.13.6) + '@inquirer/rawlist': 5.3.5(@types/node@24.13.6) + '@inquirer/search': 4.3.3(@types/node@24.13.6) + '@inquirer/select': 5.2.5(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/rawlist@5.3.5(@types/node@24.13.6)': + dependencies: + '@inquirer/core': 12.0.3(@types/node@24.13.6) + '@inquirer/type': 4.1.1(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/search@4.3.3(@types/node@24.13.6)': + dependencies: + '@inquirer/core': 12.0.3(@types/node@24.13.6) + '@inquirer/figures': 2.0.9 + '@inquirer/type': 4.1.1(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/select@5.2.5(@types/node@24.13.6)': + dependencies: + '@inquirer/ansi': 2.0.8 + '@inquirer/core': 12.0.3(@types/node@24.13.6) + '@inquirer/figures': 2.0.9 + '@inquirer/type': 4.1.1(@types/node@24.13.6) + optionalDependencies: + '@types/node': 24.13.6 + + '@inquirer/type@4.1.1(@types/node@24.13.6)': + optionalDependencies: + '@types/node': 24.13.6 + + '@ioredis/commands@2.0.0': {} + + '@isaacs/cliui@8.0.2': + dependencies: + string-width: 5.1.2 + string-width-cjs: string-width@4.2.3 + strip-ansi: 7.2.0 + strip-ansi-cjs: strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: wrap-ansi@7.0.0 + + '@istanbuljs/load-nyc-config@1.1.0': + dependencies: + camelcase: 5.3.1 + find-up: 4.1.0 + get-package-type: 0.1.0 + js-yaml: 3.15.2 + resolve-from: 5.0.0 + + '@istanbuljs/schema@0.1.6': {} + + '@jest/console@30.5.2': + dependencies: + '@jest/types': 30.5.1 + '@types/node': 24.13.6 + chalk: 4.1.2 + jest-message-util: 30.5.1 + jest-util: 30.5.1 + slash: 3.0.0 + + '@jest/core@30.5.2(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3))': + dependencies: + '@jest/console': 30.5.2 + '@jest/pattern': 30.5.0 + '@jest/reporters': 30.5.2 + '@jest/test-result': 30.5.2 + '@jest/transform': 30.5.2 + '@jest/types': 30.5.1 + '@types/node': 24.13.6 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + ci-info: 4.4.0 + exit-x: 0.2.2 + fast-json-stable-stringify: 2.1.0 + graceful-fs: 4.2.11 + jest-changed-files: 30.5.1 + jest-config: 30.5.2(@types/node@24.13.6)(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)) + jest-haste-map: 30.5.1 + jest-message-util: 30.5.1 + jest-regex-util: 30.5.0 + jest-resolve: 30.5.1 + jest-resolve-dependencies: 30.5.2 + jest-runner: 30.5.2 + jest-runtime: 30.5.2 + jest-snapshot: 30.5.2 + jest-util: 30.5.1 + jest-validate: 30.5.1 + jest-watcher: 30.5.2 + pretty-format: 30.5.1 + slash: 3.0.0 + transitivePeerDependencies: + - babel-plugin-macros + - esbuild-register + - supports-color + - ts-node + + '@jest/diff-sequences@30.5.0': {} + + '@jest/environment@30.5.2': + dependencies: + '@jest/fake-timers': 30.5.2 + '@jest/types': 30.5.1 + '@types/node': 24.13.6 + jest-mock: 30.5.2 + + '@jest/expect-utils@30.5.2': + dependencies: + '@jest/get-type': 30.5.0 + + '@jest/expect@30.5.2': + dependencies: + expect: 30.5.2 + jest-snapshot: 30.5.2 + transitivePeerDependencies: + - supports-color + + '@jest/fake-timers@30.5.2': + dependencies: + '@jest/types': 30.5.1 + '@sinonjs/fake-timers': 15.4.0 + '@types/node': 24.13.6 + jest-message-util: 30.5.1 + jest-mock: 30.5.2 + jest-util: 30.5.1 + + '@jest/get-type@30.5.0': {} + + '@jest/globals@30.5.2': + dependencies: + '@jest/environment': 30.5.2 + '@jest/expect': 30.5.2 + '@jest/types': 30.5.1 + jest-mock: 30.5.2 + transitivePeerDependencies: + - supports-color + + '@jest/pattern@30.5.0': + dependencies: + '@types/node': 24.13.6 + jest-regex-util: 30.5.0 + + '@jest/reporters@30.5.2': + dependencies: + '@bcoe/v8-coverage': 0.2.3 + '@jest/console': 30.5.2 + '@jest/test-result': 30.5.2 + '@jest/transform': 30.5.2 + '@jest/types': 30.5.1 + '@jridgewell/trace-mapping': 0.3.31 + '@types/node': 24.13.6 + chalk: 4.1.2 + collect-v8-coverage: 1.0.3 + exit-x: 0.2.2 + glob: 13.0.6 + graceful-fs: 4.2.11 + istanbul-lib-coverage: 3.2.2 + istanbul-lib-instrument: 6.0.3 + istanbul-lib-report: 3.0.1 + istanbul-lib-source-maps: 5.0.6 + istanbul-reports: 3.2.0 + jest-message-util: 30.5.1 + jest-util: 30.5.1 + jest-worker: 30.5.1 + slash: 3.0.0 + string-length: 4.0.2 + v8-to-istanbul: 9.3.0 + transitivePeerDependencies: + - supports-color + + '@jest/schemas@30.5.0': + dependencies: + '@sinclair/typebox': 0.34.52 + + '@jest/snapshot-utils@30.5.1': + dependencies: + '@jest/types': 30.5.1 + chalk: 4.1.2 + graceful-fs: 4.2.11 + natural-compare: 1.4.0 + + '@jest/source-map@30.5.2': + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + callsites: 3.1.0 + convert-source-map: 2.0.0 + graceful-fs: 4.2.11 + + '@jest/test-result@30.5.2': + dependencies: + '@jest/console': 30.5.2 + '@jest/types': 30.5.1 + '@types/istanbul-lib-coverage': 2.0.6 + collect-v8-coverage: 1.0.3 + + '@jest/test-sequencer@30.5.2': + dependencies: + '@jest/test-result': 30.5.2 + graceful-fs: 4.2.11 + jest-haste-map: 30.5.1 + slash: 3.0.0 + + '@jest/transform@30.5.2': + dependencies: + '@babel/core': 7.29.7 + '@jest/types': 30.5.1 + '@jridgewell/trace-mapping': 0.3.31 + babel-plugin-istanbul: 8.0.0 + chalk: 4.1.2 + convert-source-map: 2.0.0 + fast-json-stable-stringify: 2.1.0 + graceful-fs: 4.2.11 + jest-haste-map: 30.5.1 + jest-regex-util: 30.5.0 + jest-util: 30.5.1 + pirates: 4.0.7 + slash: 3.0.0 + write-file-atomic: 5.0.1 + transitivePeerDependencies: + - supports-color + + '@jest/types@30.5.1': + dependencies: + '@jest/pattern': 30.5.0 + '@jest/schemas': 30.5.0 + '@types/istanbul-lib-coverage': 2.0.6 + '@types/istanbul-reports': 3.0.4 + '@types/node': 24.13.6 + '@types/yargs': 17.0.35 + chalk: 4.1.2 + + '@jridgewell/gen-mapping@0.3.13': + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/remapping@2.3.5': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/source-map@0.3.11': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/sourcemap-codec@1.6.0': {} + + '@jridgewell/trace-mapping@0.3.31': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.6.0 + + '@jridgewell/trace-mapping@0.3.9': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.6.0 + + '@lukeed/csprng@1.1.0': {} + + '@lukeed/ms@2.0.2': {} + + '@microsoft/tsdoc@0.16.0': {} + + '@napi-rs/wasm-runtime@1.2.4(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)': + dependencies: + '@emnapi/core': 1.10.0 + '@emnapi/runtime': 1.10.0 + '@tybys/wasm-util': 0.10.4 + optional: true + + '@nestjs/cli@12.0.3(@types/node@24.13.6)(prettier@3.9.8)(ts-loader@9.6.2(typescript@6.0.3)(webpack@5.111.1))(webpack@5.111.1)': + dependencies: + '@angular-devkit/core': 22.1.8(chokidar@5.0.0) + '@angular-devkit/schematics': 22.1.8(chokidar@5.0.0) + '@angular-devkit/schematics-cli': 22.1.8(@types/node@24.13.6)(chokidar@5.0.0) + '@inquirer/prompts': 8.7.2(@types/node@24.13.6) + '@nestjs/schematics': 12.0.4(chokidar@5.0.0)(prettier@3.9.8)(typescript@6.0.3) + ansis: 4.4.0 + chokidar: 5.0.0 + cli-table3: 0.6.5 + commander: 15.0.0 + minimatch: 10.2.6 + node-emoji: 2.2.0 + ora: 9.4.1 + tsconfig-paths: 4.2.0 + typescript: 6.0.3 + optionalDependencies: + ts-loader: 9.6.2(typescript@6.0.3)(webpack@5.111.1) + webpack: 5.111.1 + transitivePeerDependencies: + - '@types/node' + - prettier + + '@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2)': + dependencies: + '@standard-schema/spec': 1.1.0 + file-type: 22.1.1 + iterare: 1.2.1 + load-esm: 1.0.3 + reflect-metadata: 0.2.2 + rxjs: 7.8.2 + tslib: 2.8.1 + uid: 2.0.2 + transitivePeerDependencies: + - supports-color + + '@nestjs/core@12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@12.0.4)(reflect-metadata@0.2.2)(rxjs@7.8.2)': + dependencies: + '@nestjs/common': 12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2) + fast-safe-stringify: 2.1.1 + iterare: 1.2.1 + path-to-regexp: 8.4.2 + reflect-metadata: 0.2.2 + rxjs: 7.8.2 + tslib: 2.8.1 + uid: 2.0.2 + optionalDependencies: + '@nestjs/platform-express': 12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@12.0.4) + + '@nestjs/mapped-types@12.0.0(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(reflect-metadata@0.2.2)': + dependencies: + '@nestjs/common': 12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2) + reflect-metadata: 0.2.2 + + '@nestjs/mau@0.2.8': + dependencies: + chalk: 4.1.2 + cli-progress: 3.12.0 + commander: 4.1.1 + inquirer: 8.2.6 + node-emoji: 2.1.3 + ora: 5.4.1 + undici: 6.20.1 + + '@nestjs/platform-express@12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@12.0.4)': + dependencies: + '@nestjs/common': 12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/core': 12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@12.0.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + cors: 2.8.6 + express: 5.2.1 + multer: 2.4.0 + path-to-regexp: 8.4.2 + tslib: 2.8.1 + transitivePeerDependencies: + - supports-color + optional: true + + '@nestjs/platform-fastify@12.0.1(@fastify/static@10.1.4)(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@12.0.4)': + dependencies: + '@fastify/cors': 11.3.0 + '@fastify/formbody': 9.0.0 + '@nestjs/common': 12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/core': 12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@12.0.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + fast-querystring: 1.1.2 + fastify: 5.12.1 + fastify-plugin: 6.0.0 + find-my-way: 9.9.0 + light-my-request: 6.6.0 + path-to-regexp: 8.4.2 + reusify: 1.1.0 + tslib: 2.8.1 + optionalDependencies: + '@fastify/static': 10.1.4 + + '@nestjs/schematics@12.0.4(chokidar@5.0.0)(prettier@3.9.8)(typescript@6.0.3)': + dependencies: + '@angular-devkit/core': 22.1.8(chokidar@5.0.0) + '@angular-devkit/schematics': 22.1.8(chokidar@5.0.0) + comment-json: 5.0.0 + jsonc-parser: 3.3.1 + pluralize: 8.0.0 + typescript: 6.0.3 + optionalDependencies: + prettier: 3.9.8 + transitivePeerDependencies: + - chokidar + + '@nestjs/swagger@12.0.1(@fastify/static@10.1.4)(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@12.0.4)(reflect-metadata@0.2.2)': + dependencies: + '@microsoft/tsdoc': 0.16.0 + '@nestjs/common': 12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/core': 12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@12.0.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/mapped-types': 12.0.0(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(reflect-metadata@0.2.2) + '@standard-schema/spec': 1.1.0 + es-toolkit: 1.51.0 + js-yaml: 5.4.1 + path-to-regexp: 8.4.2 + reflect-metadata: 0.2.2 + swagger-ui-dist: 5.32.14 + optionalDependencies: + '@fastify/static': 10.1.4 + + '@nestjs/testing@12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@12.0.4)(@nestjs/platform-express@12.0.4)': + dependencies: + '@nestjs/common': 12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/core': 12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@12.0.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + tslib: 2.8.1 + optionalDependencies: + '@nestjs/platform-express': 12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@12.0.4) + + '@noble/hashes@1.8.0': {} + + '@oxlint-tsgolint/darwin-arm64@7.0.2002': + optional: true + + '@oxlint-tsgolint/darwin-x64@7.0.2002': + optional: true + + '@oxlint-tsgolint/linux-arm64@7.0.2002': + optional: true + + '@oxlint-tsgolint/linux-x64@7.0.2002': + optional: true + + '@oxlint-tsgolint/win32-arm64@7.0.2002': + optional: true + + '@oxlint-tsgolint/win32-x64@7.0.2002': + optional: true + + '@oxlint/binding-android-arm-eabi@1.83.0': + optional: true + + '@oxlint/binding-android-arm64@1.83.0': + optional: true + + '@oxlint/binding-darwin-arm64@1.83.0': + optional: true + + '@oxlint/binding-darwin-x64@1.83.0': + optional: true + + '@oxlint/binding-freebsd-x64@1.83.0': + optional: true + + '@oxlint/binding-linux-arm-gnueabihf@1.83.0': + optional: true + + '@oxlint/binding-linux-arm-musleabihf@1.83.0': + optional: true + + '@oxlint/binding-linux-arm64-gnu@1.83.0': + optional: true + + '@oxlint/binding-linux-arm64-musl@1.83.0': + optional: true + + '@oxlint/binding-linux-ppc64-gnu@1.83.0': + optional: true + + '@oxlint/binding-linux-riscv64-gnu@1.83.0': + optional: true + + '@oxlint/binding-linux-riscv64-musl@1.83.0': + optional: true + + '@oxlint/binding-linux-s390x-gnu@1.83.0': + optional: true + + '@oxlint/binding-linux-x64-gnu@1.83.0': + optional: true + + '@oxlint/binding-linux-x64-musl@1.83.0': + optional: true + + '@oxlint/binding-openharmony-arm64@1.83.0': + optional: true + + '@oxlint/binding-win32-arm64-msvc@1.83.0': + optional: true + + '@oxlint/binding-win32-ia32-msvc@1.83.0': + optional: true + + '@oxlint/binding-win32-x64-msvc@1.83.0': + optional: true + + '@paralleldrive/cuid2@2.3.1': + dependencies: + '@noble/hashes': 1.8.0 + + '@parcel/watcher-android-arm64@2.6.0': + optional: true + + '@parcel/watcher-darwin-arm64@2.6.0': + optional: true + + '@parcel/watcher-darwin-x64@2.6.0': + optional: true + + '@parcel/watcher-freebsd-x64@2.6.0': + optional: true + + '@parcel/watcher-linux-arm-glibc@2.6.0': + optional: true + + '@parcel/watcher-linux-arm-musl@2.6.0': + optional: true + + '@parcel/watcher-linux-arm64-glibc@2.6.0': + optional: true + + '@parcel/watcher-linux-arm64-musl@2.6.0': + optional: true + + '@parcel/watcher-linux-x64-glibc@2.6.0': + optional: true + + '@parcel/watcher-linux-x64-musl@2.6.0': + optional: true + + '@parcel/watcher-win32-arm64@2.6.0': + optional: true + + '@parcel/watcher-win32-x64@2.6.0': + optional: true + + '@parcel/watcher@2.6.0': + dependencies: + detect-libc: 2.1.2 + is-glob: 4.0.3 + node-addon-api: 7.1.1 + picomatch: 4.0.7 + optionalDependencies: + '@parcel/watcher-android-arm64': 2.6.0 + '@parcel/watcher-darwin-arm64': 2.6.0 + '@parcel/watcher-darwin-x64': 2.6.0 + '@parcel/watcher-freebsd-x64': 2.6.0 + '@parcel/watcher-linux-arm-glibc': 2.6.0 + '@parcel/watcher-linux-arm-musl': 2.6.0 + '@parcel/watcher-linux-arm64-glibc': 2.6.0 + '@parcel/watcher-linux-arm64-musl': 2.6.0 + '@parcel/watcher-linux-x64-glibc': 2.6.0 + '@parcel/watcher-linux-x64-musl': 2.6.0 + '@parcel/watcher-win32-arm64': 2.6.0 + '@parcel/watcher-win32-x64': 2.6.0 + + '@pinojs/redact@0.4.0': {} + + '@pkgjs/parseargs@0.11.0': + optional: true + + '@pkgr/core@0.3.6': {} + + '@prisma/adapter-pg@7.10.0': + dependencies: + '@prisma/driver-adapter-utils': 7.10.0 + '@types/pg': 8.23.1 + pg: 8.23.1 + postgres-array: 3.0.4 + transitivePeerDependencies: + - pg-native + + '@prisma/client-runtime-utils@7.10.0': {} + + '@prisma/client@7.10.0(prisma@7.10.0(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(typescript@6.0.3))(typescript@6.0.3)': + dependencies: + '@prisma/client-runtime-utils': 7.10.0 + optionalDependencies: + prisma: 7.10.0(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(typescript@6.0.3) + typescript: 6.0.3 + + '@prisma/config@7.10.0': + dependencies: + c12: 3.3.4 + deepmerge-ts: 7.1.5 + effect: 3.20.0 + empathic: 2.0.0 + transitivePeerDependencies: + - magicast + + '@prisma/debug@7.10.0': {} + + '@prisma/debug@7.2.0': {} + + '@prisma/dev@0.24.17(typescript@6.0.3)': + dependencies: + '@electric-sql/pglite': 0.4.3 + '@electric-sql/pglite-socket': 0.1.3(@electric-sql/pglite@0.4.3) + '@electric-sql/pglite-tools': 0.3.3(@electric-sql/pglite@0.4.3) + '@prisma/get-platform': 7.2.0 + '@prisma/query-plan-executor': 7.2.0 + '@prisma/streams-local': 0.1.11 + find-my-way: 9.7.0 + foreground-child: 3.3.1 + get-port-please: 3.2.0 + pathe: 2.0.3 + proper-lockfile: 4.1.2 + remeda: 2.33.4 + std-env: 3.10.0 + valibot: 1.4.2(typescript@6.0.3) + zeptomatch: 2.1.0 + transitivePeerDependencies: + - typescript + + '@prisma/driver-adapter-utils@7.10.0': + dependencies: + '@prisma/debug': 7.10.0 + + '@prisma/engines-version@7.10.0-4.0edf323efd1d98336f3f0a68684b56f689b900d3': {} + + '@prisma/engines@7.10.0': + dependencies: + '@prisma/debug': 7.10.0 + '@prisma/engines-version': 7.10.0-4.0edf323efd1d98336f3f0a68684b56f689b900d3 + '@prisma/fetch-engine': 7.10.0 + '@prisma/get-platform': 7.10.0 + + '@prisma/fetch-engine@7.10.0': + dependencies: + '@prisma/debug': 7.10.0 + '@prisma/engines-version': 7.10.0-4.0edf323efd1d98336f3f0a68684b56f689b900d3 + '@prisma/get-platform': 7.10.0 + + '@prisma/get-platform@7.10.0': + dependencies: + '@prisma/debug': 7.10.0 + + '@prisma/get-platform@7.2.0': + dependencies: + '@prisma/debug': 7.2.0 + + '@prisma/query-plan-executor@7.2.0': {} + + '@prisma/streams-local@0.1.11': + dependencies: + ajv: 8.20.0 + better-result: 2.10.0 + env-paths: 3.0.0 + proper-lockfile: 4.1.2 + + '@prisma/studio-core@0.33.0(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)': + dependencies: + '@radix-ui/react-toggle': 1.1.10(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0) + '@types/react': 19.3.0 + '@visx/curve': 4.0.1-alpha.0 + '@visx/event': 4.0.1-alpha.0 + '@visx/grid': 4.0.1-alpha.0(react@19.3.0) + '@visx/group': 4.0.1-alpha.0(react@19.3.0) + '@visx/responsive': 4.0.1-alpha.0(react@19.3.0) + '@visx/scale': 4.0.1-alpha.0 + '@visx/shape': 4.0.1-alpha.0(react@19.3.0) + d3-array: 3.2.4 + d3-shape: 3.2.0 + elkjs: 0.11.1 + react: 19.3.0 + react-dom: 19.3.0(react@19.3.0) + transitivePeerDependencies: + - '@types/react-dom' + + '@radix-ui/primitive@1.1.3': {} + + '@radix-ui/react-compose-refs@1.1.2(@types/react@19.3.0)(react@19.3.0)': + dependencies: + react: 19.3.0 + optionalDependencies: + '@types/react': 19.3.0 + + '@radix-ui/react-primitive@2.1.3(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)': + dependencies: + '@radix-ui/react-slot': 1.2.3(@types/react@19.3.0)(react@19.3.0) + react: 19.3.0 + react-dom: 19.3.0(react@19.3.0) + optionalDependencies: + '@types/react': 19.3.0 + + '@radix-ui/react-slot@1.2.3(@types/react@19.3.0)(react@19.3.0)': + dependencies: + '@radix-ui/react-compose-refs': 1.1.2(@types/react@19.3.0)(react@19.3.0) + react: 19.3.0 + optionalDependencies: + '@types/react': 19.3.0 + + '@radix-ui/react-toggle@1.1.10(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)': + dependencies: + '@radix-ui/primitive': 1.1.3 + '@radix-ui/react-primitive': 2.1.3(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0) + '@radix-ui/react-use-controllable-state': 1.2.2(@types/react@19.3.0)(react@19.3.0) + react: 19.3.0 + react-dom: 19.3.0(react@19.3.0) + optionalDependencies: + '@types/react': 19.3.0 + + '@radix-ui/react-use-controllable-state@1.2.2(@types/react@19.3.0)(react@19.3.0)': + dependencies: + '@radix-ui/react-use-effect-event': 0.0.2(@types/react@19.3.0)(react@19.3.0) + '@radix-ui/react-use-layout-effect': 1.1.1(@types/react@19.3.0)(react@19.3.0) + react: 19.3.0 + optionalDependencies: + '@types/react': 19.3.0 + + '@radix-ui/react-use-effect-event@0.0.2(@types/react@19.3.0)(react@19.3.0)': + dependencies: + '@radix-ui/react-use-layout-effect': 1.1.1(@types/react@19.3.0)(react@19.3.0) + react: 19.3.0 + optionalDependencies: + '@types/react': 19.3.0 + + '@radix-ui/react-use-layout-effect@1.1.1(@types/react@19.3.0)(react@19.3.0)': + dependencies: + react: 19.3.0 + optionalDependencies: + '@types/react': 19.3.0 + + '@scalar/client-side-rendering@0.4.1': + dependencies: + '@scalar/schemas': 0.10.0 + '@scalar/types': 0.20.0 + '@scalar/validation': 0.6.3 + + '@scalar/helpers@0.12.0': {} + + '@scalar/nestjs-api-reference@1.2.19': + dependencies: + '@scalar/client-side-rendering': 0.4.1 + + '@scalar/schemas@0.10.0': + dependencies: + '@scalar/helpers': 0.12.0 + '@scalar/validation': 0.6.3 + + '@scalar/types@0.20.0': + dependencies: + '@scalar/helpers': 0.12.0 + nanoid: 5.1.16 + type-fest: 5.10.0 + zod: 4.6.5 + + '@scalar/validation@0.6.3': {} + + '@scarf/scarf@1.4.0': {} + + '@sinclair/typebox@0.34.52': {} + + '@sindresorhus/is@4.6.0': {} + + '@sinonjs/commons@3.0.1': + dependencies: + type-detect: 4.0.8 + + '@sinonjs/fake-timers@15.4.0': + dependencies: + '@sinonjs/commons': 3.0.1 + + '@standard-schema/spec@1.1.0': {} + + '@tokenizer/inflate@0.4.1': + dependencies: + debug: 4.4.3 + token-types: 6.1.2 + transitivePeerDependencies: + - supports-color + + '@tokenizer/token@0.3.0': {} + + '@tsconfig/node10@1.0.13': {} + + '@tsconfig/node12@1.0.11': {} + + '@tsconfig/node14@1.0.3': {} + + '@tsconfig/node16@1.0.4': {} + + '@tybys/wasm-util@0.10.4': + dependencies: + tslib: 2.8.1 + optional: true + + '@types/babel__core@7.20.5': + dependencies: + '@babel/parser': 7.29.9 + '@babel/types': 7.29.8 + '@types/babel__generator': 7.27.0 + '@types/babel__template': 7.4.4 + '@types/babel__traverse': 7.28.0 + + '@types/babel__generator@7.27.0': + dependencies: + '@babel/types': 7.29.8 + + '@types/babel__template@7.4.4': + dependencies: + '@babel/parser': 7.29.9 + '@babel/types': 7.29.8 + + '@types/babel__traverse@7.28.0': + dependencies: + '@babel/types': 7.29.8 + + '@types/cookiejar@2.1.5': {} + + '@types/d3-array@3.0.3': {} + + '@types/d3-color@3.1.0': {} + + '@types/d3-delaunay@6.0.1': {} + + '@types/d3-format@3.0.1': {} + + '@types/d3-geo@3.1.0': + dependencies: + '@types/geojson': 7946.0.16 + + '@types/d3-interpolate@3.0.1': + dependencies: + '@types/d3-color': 3.1.0 + + '@types/d3-path@3.1.1': {} + + '@types/d3-scale@4.0.2': + dependencies: + '@types/d3-time': 3.0.0 + + '@types/d3-shape@3.1.7': + dependencies: + '@types/d3-path': 3.1.1 + + '@types/d3-time-format@2.1.0': {} + + '@types/d3-time@3.0.0': {} + + '@types/estree@1.0.9': {} + + '@types/geojson@7946.0.16': {} + + '@types/istanbul-lib-coverage@2.0.6': {} + + '@types/istanbul-lib-report@3.0.3': + dependencies: + '@types/istanbul-lib-coverage': 2.0.6 + + '@types/istanbul-reports@3.0.4': + dependencies: + '@types/istanbul-lib-report': 3.0.3 + + '@types/jest@30.0.0': + dependencies: + expect: 30.5.2 + pretty-format: 30.5.1 + + '@types/json-schema@7.0.15': {} + + '@types/lodash@4.17.26': {} + + '@types/methods@1.1.4': {} + + '@types/node@24.13.6': + dependencies: + undici-types: 7.18.2 + + '@types/pg@8.23.1': + dependencies: + '@types/node': 24.13.6 + pg-protocol: 1.16.1 + pg-types: 2.2.0 + + '@types/react@19.3.0': + dependencies: + csstype: 3.2.3 + + '@types/stack-utils@2.0.3': {} + + '@types/superagent@8.1.11': + dependencies: + '@types/cookiejar': 2.1.5 + '@types/methods': 1.1.4 + '@types/node': 24.13.6 + form-data: 4.0.6 + + '@types/supertest@7.2.1': + dependencies: + '@types/methods': 1.1.4 + '@types/superagent': 8.1.11 + + '@types/yargs-parser@21.0.3': {} + + '@types/yargs@17.0.35': + dependencies: + '@types/yargs-parser': 21.0.3 + + '@ungap/structured-clone@1.4.0': {} + + '@unrs/resolver-binding-android-arm-eabi@1.12.2': + optional: true + + '@unrs/resolver-binding-android-arm64@1.12.2': + optional: true + + '@unrs/resolver-binding-darwin-arm64@1.12.2': + optional: true + + '@unrs/resolver-binding-darwin-x64@1.12.2': + optional: true + + '@unrs/resolver-binding-freebsd-x64@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-arm-gnueabihf@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-arm-musleabihf@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-arm64-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-arm64-musl@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-loong64-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-loong64-musl@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-ppc64-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-riscv64-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-riscv64-musl@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-s390x-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-x64-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-x64-musl@1.12.2': + optional: true + + '@unrs/resolver-binding-openharmony-arm64@1.12.2': + optional: true + + '@unrs/resolver-binding-wasm32-wasi@1.12.2': + dependencies: + '@emnapi/core': 1.10.0 + '@emnapi/runtime': 1.10.0 + '@napi-rs/wasm-runtime': 1.2.4(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0) + optional: true + + '@unrs/resolver-binding-win32-arm64-msvc@1.12.2': + optional: true + + '@unrs/resolver-binding-win32-ia32-msvc@1.12.2': + optional: true + + '@unrs/resolver-binding-win32-x64-msvc@1.12.2': + optional: true + + '@visx/curve@4.0.1-alpha.0': + dependencies: + '@visx/vendor': 4.0.0-alpha.0 + + '@visx/event@4.0.1-alpha.0': + dependencies: + '@types/react': 19.3.0 + '@visx/point': 4.0.1-alpha.0 + + '@visx/grid@4.0.1-alpha.0(react@19.3.0)': + dependencies: + '@types/react': 19.3.0 + '@visx/curve': 4.0.1-alpha.0 + '@visx/group': 4.0.1-alpha.0(react@19.3.0) + '@visx/point': 4.0.1-alpha.0 + '@visx/scale': 4.0.1-alpha.0 + '@visx/shape': 4.0.1-alpha.0(react@19.3.0) + classnames: 2.5.1 + react: 19.3.0 + + '@visx/group@4.0.1-alpha.0(react@19.3.0)': + dependencies: + '@types/react': 19.3.0 + classnames: 2.5.1 + react: 19.3.0 + + '@visx/point@4.0.1-alpha.0': {} + + '@visx/responsive@4.0.1-alpha.0(react@19.3.0)': + dependencies: + '@types/lodash': 4.17.26 + '@types/react': 19.3.0 + lodash: 4.18.1 + react: 19.3.0 + + '@visx/scale@4.0.1-alpha.0': + dependencies: + '@visx/vendor': 4.0.0-alpha.0 + + '@visx/shape@4.0.1-alpha.0(react@19.3.0)': + dependencies: + '@types/lodash': 4.17.26 + '@types/react': 19.3.0 + '@visx/curve': 4.0.1-alpha.0 + '@visx/group': 4.0.1-alpha.0(react@19.3.0) + '@visx/scale': 4.0.1-alpha.0 + '@visx/vendor': 4.0.0-alpha.0 + classnames: 2.5.1 + lodash: 4.18.1 + react: 19.3.0 + + '@visx/vendor@4.0.0-alpha.0': + dependencies: + '@types/d3-array': 3.0.3 + '@types/d3-color': 3.1.0 + '@types/d3-delaunay': 6.0.1 + '@types/d3-format': 3.0.1 + '@types/d3-geo': 3.1.0 + '@types/d3-interpolate': 3.0.1 + '@types/d3-path': 3.1.1 + '@types/d3-scale': 4.0.2 + '@types/d3-shape': 3.1.7 + '@types/d3-time': 3.0.0 + '@types/d3-time-format': 2.1.0 + d3-array: 3.2.1 + d3-color: 3.1.0 + d3-delaunay: 6.0.2 + d3-format: 3.1.0 + d3-geo: 3.1.0 + d3-interpolate: 3.0.1 + d3-path: 3.1.0 + d3-scale: 4.0.2 + d3-shape: 3.2.0 + d3-time: 3.1.0 + d3-time-format: 4.1.0 + internmap: 2.0.3 + + '@webassemblyjs/ast@1.14.1': + dependencies: + '@webassemblyjs/helper-numbers': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + + '@webassemblyjs/floating-point-hex-parser@1.13.2': {} + + '@webassemblyjs/helper-api-error@1.13.2': {} + + '@webassemblyjs/helper-buffer@1.14.1': {} + + '@webassemblyjs/helper-numbers@1.13.2': + dependencies: + '@webassemblyjs/floating-point-hex-parser': 1.13.2 + '@webassemblyjs/helper-api-error': 1.13.2 + '@xtuc/long': 4.2.2 + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': {} + + '@webassemblyjs/helper-wasm-section@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/wasm-gen': 1.14.1 + + '@webassemblyjs/ieee754@1.13.2': + dependencies: + '@xtuc/ieee754': 1.2.0 + + '@webassemblyjs/leb128@1.13.2': + dependencies: + '@xtuc/long': 4.2.2 + + '@webassemblyjs/utf8@1.13.2': {} + + '@webassemblyjs/wasm-edit@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/helper-wasm-section': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-opt': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + '@webassemblyjs/wast-printer': 1.14.1 + + '@webassemblyjs/wasm-gen@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wasm-opt@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + + '@webassemblyjs/wasm-parser@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-api-error': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wast-printer@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@xtuc/long': 4.2.2 + + '@xtuc/ieee754@1.2.0': {} + + '@xtuc/long@4.2.2': {} + + abstract-logging@2.0.1: {} + + accepts@2.0.0: + dependencies: + mime-types: 3.0.2 + negotiator: 1.1.0 + optional: true + + acorn-walk@8.3.5: + dependencies: + acorn: 8.18.0 + + acorn@8.18.0: {} + + ajv-formats@3.0.1(ajv@8.20.0): + optionalDependencies: + ajv: 8.20.0 + + ajv-keywords@5.1.0(ajv@8.20.0): + dependencies: + ajv: 8.20.0 + fast-deep-equal: 3.1.3 + + ajv@8.20.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-uri: 3.1.8 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + + ansi-escapes@4.3.2: + dependencies: + type-fest: 0.21.3 + + ansi-regex@5.0.1: {} + + ansi-regex@6.3.0: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + ansi-styles@5.2.0: {} + + ansi-styles@6.2.3: {} + + ansis@4.4.0: {} + + anymatch@3.1.3: + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.2 + + append-field@1.0.0: + optional: true + + arg@4.1.3: {} + + argparse@1.0.10: + dependencies: + sprintf-js: 1.0.3 + + argparse@2.0.1: {} + + array-timsort@1.0.3: {} + + asap@2.0.6: {} + + asynckit@0.4.0: {} + + atomic-sleep@1.0.0: {} + + avvio@9.3.0: + dependencies: + '@fastify/error': 4.2.0 + fastq: 1.20.3 + + aws-ssl-profiles@1.1.2: {} + + babel-jest@30.5.2(@babel/core@7.29.7): + dependencies: + '@babel/core': 7.29.7 + '@jest/transform': 30.5.2 + '@types/babel__core': 7.20.5 + babel-plugin-istanbul: 8.0.0 + babel-preset-jest: 30.5.0(@babel/core@7.29.7) + chalk: 4.1.2 + graceful-fs: 4.2.11 + slash: 3.0.0 + transitivePeerDependencies: + - supports-color + + babel-plugin-istanbul@8.0.0: + dependencies: + '@babel/helper-plugin-utils': 7.29.7 + '@istanbuljs/load-nyc-config': 1.1.0 + '@istanbuljs/schema': 0.1.6 + istanbul-lib-instrument: 6.0.3 + test-exclude: 7.0.2 + transitivePeerDependencies: + - supports-color + + babel-plugin-jest-hoist@30.5.0: + dependencies: + '@types/babel__core': 7.20.5 + + babel-preset-current-node-syntax@1.2.0(@babel/core@7.29.7): + dependencies: + '@babel/core': 7.29.7 + '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.29.7) + '@babel/plugin-syntax-bigint': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.29.7) + '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.29.7) + '@babel/plugin-syntax-import-attributes': 7.29.7(@babel/core@7.29.7) + '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.29.7) + '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.29.7) + '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.29.7) + '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.29.7) + '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.29.7) + + babel-preset-jest@30.5.0(@babel/core@7.29.7): + dependencies: + '@babel/core': 7.29.7 + babel-plugin-jest-hoist: 30.5.0 + babel-preset-current-node-syntax: 1.2.0(@babel/core@7.29.7) + + balanced-match@1.0.2: {} + + balanced-match@4.0.4: {} + + base64-js@1.5.1: {} + + baseline-browser-mapping@2.11.25: {} + + better-result@2.10.0: {} + + bl@4.1.0: + dependencies: + buffer: 5.7.1 + inherits: 2.0.4 + readable-stream: 3.6.2 + + body-parser@2.3.0: + dependencies: + bytes: 3.1.2 + content-type: 2.1.0 + debug: 4.4.3 + http-errors: 2.0.1 + iconv-lite: 0.7.3 + on-finished: 2.4.1 + qs: 6.16.0 + raw-body: 3.0.2 + type-is: 2.1.0 + transitivePeerDependencies: + - supports-color + optional: true + + brace-expansion@2.1.7: + dependencies: + balanced-match: 1.0.2 + + brace-expansion@5.0.12: + dependencies: + balanced-match: 4.0.4 + + browserslist@4.29.0: + dependencies: + baseline-browser-mapping: 2.11.25 + caniuse-lite: 1.0.30001810 + electron-to-chromium: 1.5.433 + node-releases: 2.0.56 + update-browserslist-db: 1.3.3(browserslist@4.29.0) + + bs-logger@0.2.6: + dependencies: + fast-json-stable-stringify: 2.1.0 + + bser@2.1.1: + dependencies: + node-int64: 0.4.0 + + buffer-from@1.1.2: {} + + buffer@5.7.1: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + busboy@1.6.0: + dependencies: + streamsearch: 1.1.0 + optional: true + + bytes@3.1.2: + optional: true + + c12@3.3.4: + dependencies: + chokidar: 5.0.0 + confbox: 0.2.4 + defu: 6.1.7 + dotenv: 17.4.2 + exsolve: 1.1.3 + giget: 3.3.1 + jiti: 2.7.0 + ohash: 2.0.12 + pathe: 2.0.3 + perfect-debounce: 2.1.0 + pkg-types: 2.3.3 + rc9: 3.1.0 + + call-bind-apply-helpers@1.0.2: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + + call-bound@1.0.4: + dependencies: + call-bind-apply-helpers: 1.0.2 + get-intrinsic: 1.3.0 + + callsites@3.1.0: {} + + camelcase@5.3.1: {} + + camelcase@6.3.0: {} + + caniuse-lite@1.0.30001810: {} + + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + chalk@5.6.2: {} + + char-regex@1.0.2: {} + + chardet@0.7.0: {} + + chardet@2.2.0: {} + + chokidar@5.0.0: + dependencies: + readdirp: 5.1.1 + + chrome-trace-event@1.0.4: {} + + ci-info@4.4.0: {} + + cjs-module-lexer@2.2.1: {} + + classnames@2.5.1: {} + + cli-cursor@3.1.0: + dependencies: + restore-cursor: 3.1.0 + + cli-cursor@5.0.0: + dependencies: + restore-cursor: 5.1.0 + + cli-progress@3.12.0: + dependencies: + string-width: 4.2.3 + + cli-spinners@2.9.2: {} + + cli-spinners@3.4.0: {} + + cli-table3@0.6.5: + dependencies: + string-width: 4.2.3 + optionalDependencies: + '@colors/colors': 1.5.0 + + cli-width@3.0.0: {} + + cli-width@4.1.0: {} + + cliui@8.0.1: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + + clone@1.0.4: {} + + cluster-key-slot@1.1.1: {} + + co@4.6.0: {} + + collect-v8-coverage@1.0.3: {} + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + + colorette@2.0.20: {} + + combined-stream@1.0.8: + dependencies: + delayed-stream: 1.0.0 + + commander@15.0.0: {} + + commander@2.20.3: {} + + commander@4.1.1: {} + + comment-json@5.0.0: + dependencies: + array-timsort: 1.0.3 + esprima: 4.0.1 + + component-emitter@1.3.1: {} + + confbox@0.2.4: {} + + confbox@0.3.1: {} + + content-disposition@1.1.0: + optional: true + + content-disposition@3.0.0: {} + + content-type@1.0.5: + optional: true + + content-type@2.1.0: + optional: true + + convert-source-map@2.0.0: {} + + cookie-signature@1.2.2: {} + + cookie@0.7.2: + optional: true + + cookie@1.1.1: {} + + cookiejar@2.1.4: {} + + cors@2.8.6: + dependencies: + object-assign: 4.1.1 + vary: 1.1.2 + optional: true + + create-require@1.1.1: {} + + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + csstype@3.2.3: {} + + d3-array@3.2.1: + dependencies: + internmap: 2.0.3 + + d3-array@3.2.4: + dependencies: + internmap: 2.0.3 + + d3-color@3.1.0: {} + + d3-delaunay@6.0.2: + dependencies: + delaunator: 5.1.0 + + d3-format@3.1.0: {} + + d3-geo@3.1.0: + dependencies: + d3-array: 3.2.4 + + d3-interpolate@3.0.1: + dependencies: + d3-color: 3.1.0 + + d3-path@3.1.0: {} + + d3-scale@4.0.2: + dependencies: + d3-array: 3.2.4 + d3-format: 3.1.0 + d3-interpolate: 3.0.1 + d3-time: 3.1.0 + d3-time-format: 4.1.0 + + d3-shape@3.2.0: + dependencies: + d3-path: 3.1.0 + + d3-time-format@4.1.0: + dependencies: + d3-time: 3.1.0 + + d3-time@3.1.0: + dependencies: + d3-array: 3.2.4 + + dateformat@4.6.3: {} + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + dedent@1.7.2: {} + + deepmerge-ts@7.1.5: {} + + deepmerge@4.3.1: {} + + defaults@1.0.4: + dependencies: + clone: 1.0.4 + + defu@6.1.7: {} + + delaunator@5.1.0: + dependencies: + robust-predicates: 3.0.3 + + delayed-stream@1.0.0: {} + + denque@2.1.0: {} + + depd@2.0.0: {} + + dequal@2.0.3: {} + + destr@2.0.5: {} + + detect-libc@2.1.2: {} + + detect-newline@3.1.0: {} + + dezalgo@1.0.4: + dependencies: + asap: 2.0.6 + wrappy: 1.0.2 + + diff@4.0.4: {} + + dotenv@17.4.2: {} + + dotenv@18.0.7: {} + + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-errors: 1.3.0 + gopd: 1.2.0 + + eastasianwidth@0.2.0: {} + + ee-first@1.1.1: + optional: true + + effect@3.20.0: + dependencies: + '@standard-schema/spec': 1.1.0 + fast-check: 3.23.2 + + electron-to-chromium@1.5.433: {} + + elkjs@0.11.1: {} + + emittery@0.13.1: {} + + emoji-regex@8.0.0: {} + + emoji-regex@9.2.2: {} + + emojilib@2.4.0: {} + + empathic@2.0.0: {} + + encodeurl@2.0.0: + optional: true + + end-of-stream@1.4.5: + dependencies: + once: 1.4.0 + + enhanced-resolve@5.25.1: + dependencies: + graceful-fs: 4.2.11 + tapable: 2.3.3 + + env-paths@3.0.0: {} + + error-ex@1.3.4: + dependencies: + is-arrayish: 0.2.1 + + es-define-property@1.0.1: {} + + es-errors@1.3.0: {} + + es-module-lexer@2.3.2: {} + + es-object-atoms@1.1.2: + dependencies: + es-errors: 1.3.0 + + es-set-tostringtag@2.1.0: + dependencies: + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + has-tostringtag: 1.0.2 + hasown: 2.0.4 + + es-toolkit@1.51.0: {} + + escalade@3.2.0: {} + + escape-html@1.0.3: {} + + escape-string-regexp@1.0.5: {} + + escape-string-regexp@2.0.0: {} + + esprima@4.0.1: {} + + etag@1.8.1: + optional: true + + events@3.3.0: {} + + execa@5.1.1: + dependencies: + cross-spawn: 7.0.6 + get-stream: 6.0.1 + human-signals: 2.1.0 + is-stream: 2.0.1 + merge-stream: 2.0.0 + npm-run-path: 4.0.1 + onetime: 5.1.2 + signal-exit: 3.0.7 + strip-final-newline: 2.0.0 + + exit-x@0.2.2: {} + + expect@30.5.2: + dependencies: + '@jest/expect-utils': 30.5.2 + '@jest/get-type': 30.5.0 + jest-matcher-utils: 30.5.2 + jest-message-util: 30.5.1 + jest-mock: 30.5.2 + jest-util: 30.5.1 + + express@5.2.1: + dependencies: + accepts: 2.0.0 + body-parser: 2.3.0 + content-disposition: 1.1.0 + content-type: 1.0.5 + cookie: 0.7.2 + cookie-signature: 1.2.2 + debug: 4.4.3 + depd: 2.0.0 + encodeurl: 2.0.0 + escape-html: 1.0.3 + etag: 1.8.1 + finalhandler: 2.1.1 + fresh: 2.0.0 + http-errors: 2.0.1 + merge-descriptors: 2.0.0 + mime-types: 3.0.2 + on-finished: 2.4.1 + once: 1.4.0 + parseurl: 1.3.3 + proxy-addr: 2.0.8 + qs: 6.16.0 + range-parser: 1.3.0 + router: 2.2.0 + send: 1.2.1 + serve-static: 2.2.1 + statuses: 2.0.2 + type-is: 2.1.0 + vary: 1.1.2 + transitivePeerDependencies: + - supports-color + optional: true + + exsolve@1.1.3: {} + + external-editor@3.1.0: + dependencies: + chardet: 0.7.0 + iconv-lite: 0.4.24 + tmp: 0.0.33 + + fast-check@3.23.2: + dependencies: + pure-rand: 6.1.0 + + fast-copy@4.1.1: {} + + fast-decode-uri-component@1.0.1: {} + + fast-deep-equal@3.1.3: {} + + fast-json-stable-stringify@2.1.0: {} + + fast-json-stringify@7.0.1: + dependencies: + '@fastify/merge-json-schemas': 0.2.1 + ajv: 8.20.0 + ajv-formats: 3.0.1(ajv@8.20.0) + fast-uri: 4.2.1 + json-schema-ref-resolver: 3.0.0 + rfdc: 1.4.1 + + fast-querystring@1.1.2: + dependencies: + fast-decode-uri-component: 1.0.1 + + fast-safe-stringify@2.1.1: {} + + fast-string-truncated-width@3.0.3: {} + + fast-string-width@3.0.2: + dependencies: + fast-string-truncated-width: 3.0.3 + + fast-uri@3.1.8: {} + + fast-uri@4.2.1: {} + + fast-wrap-ansi@0.2.2: + dependencies: + fast-string-width: 3.0.2 + + fastify-plugin@6.0.0: {} + + fastify@5.12.1: + dependencies: + '@fastify/ajv-compiler': 4.0.6 + '@fastify/error': 4.2.0 + '@fastify/fast-json-stringify-compiler': 5.1.0 + '@fastify/proxy-addr': 5.1.1 + abstract-logging: 2.0.1 + avvio: 9.3.0 + fast-json-stringify: 7.0.1 + find-my-way: 9.9.0 + light-my-request: 6.6.0 + pino: 10.3.1 + process-warning: 5.1.0 + rfdc: 1.4.1 + secure-json-parse: 4.1.0 + semver: 7.8.5 + toad-cache: 3.7.4 + + fastq@1.20.3: + dependencies: + reusify: 1.1.0 + + fb-watchman@2.0.2: + dependencies: + bser: 2.1.1 + + fdir@6.5.0(picomatch@4.0.7): + optionalDependencies: + picomatch: 4.0.7 + + figures@3.2.0: + dependencies: + escape-string-regexp: 1.0.5 + + file-type@22.1.1: + dependencies: + '@tokenizer/inflate': 0.4.1 + strtok3: 10.3.5 + token-types: 6.1.2 + uint8array-extras: 1.5.0 + transitivePeerDependencies: + - supports-color + + finalhandler@2.1.1: + dependencies: + debug: 4.4.3 + encodeurl: 2.0.0 + escape-html: 1.0.3 + on-finished: 2.4.1 + parseurl: 1.3.3 + statuses: 2.0.2 + transitivePeerDependencies: + - supports-color + optional: true + + find-my-way@9.7.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-querystring: 1.1.2 + safe-regex2: 5.1.1 + + find-my-way@9.9.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-querystring: 1.1.2 + safe-regex2: 5.1.1 + + find-up@4.1.0: + dependencies: + locate-path: 5.0.0 + path-exists: 4.0.0 + + foreground-child@3.3.1: + dependencies: + cross-spawn: 7.0.6 + signal-exit: 4.1.0 + + form-data@4.0.6: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + es-set-tostringtag: 2.1.0 + hasown: 2.0.4 + mime-types: 2.1.35 + + formidable@3.5.4: + dependencies: + '@paralleldrive/cuid2': 2.3.1 + dezalgo: 1.0.4 + once: 1.4.0 + + forwarded@0.2.0: + optional: true + + fresh@2.0.0: + optional: true + + function-bind@1.1.2: {} + + generate-function@2.3.1: + dependencies: + is-property: 1.0.2 + + gensync@1.0.0-beta.2: {} + + get-caller-file@2.0.5: {} + + get-east-asian-width@1.7.0: {} + + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.2 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.4 + math-intrinsics: 1.1.0 + + get-package-type@0.1.0: {} + + get-port-please@3.2.0: {} + + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.1.2 + + get-stream@6.0.1: {} + + giget@3.3.1: {} + + glob@10.5.0: + dependencies: + foreground-child: 3.3.1 + jackspeak: 3.4.3 + minimatch: 9.0.9 + minipass: 7.1.3 + package-json-from-dist: 1.0.1 + path-scurry: 1.11.1 + + glob@13.0.6: + dependencies: + minimatch: 10.2.6 + minipass: 7.1.3 + path-scurry: 2.0.2 + + gopd@1.2.0: {} + + graceful-fs@4.2.11: {} + + grammex@3.1.13: {} + + graphmatch@1.1.1: {} + + handlebars@4.7.9: + dependencies: + minimist: 1.2.8 + neo-async: 2.6.2 + source-map: 0.6.1 + wordwrap: 1.0.0 + optionalDependencies: + uglify-js: 3.19.3 + + has-flag@4.0.0: {} + + has-symbols@1.1.0: {} + + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.1.0 + + hasown@2.0.4: + dependencies: + function-bind: 1.1.2 + + help-me@5.0.0: {} + + html-escaper@2.0.2: {} + + http-errors@2.0.1: + dependencies: + depd: 2.0.0 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 2.0.2 + toidentifier: 1.0.1 + + human-signals@2.1.0: {} + + iconv-lite@0.4.24: + dependencies: + safer-buffer: 2.1.2 + + iconv-lite@0.7.3: + dependencies: + safer-buffer: 2.1.2 + + ieee754@1.2.1: {} + + import-local@3.2.0: + dependencies: + pkg-dir: 4.2.0 + resolve-cwd: 3.0.0 + + imurmurhash@0.1.4: {} + + inherits@2.0.4: {} + + inquirer@8.2.6: + dependencies: + ansi-escapes: 4.3.2 + chalk: 4.1.2 + cli-cursor: 3.1.0 + cli-width: 3.0.0 + external-editor: 3.1.0 + figures: 3.2.0 + lodash: 4.18.1 + mute-stream: 0.0.8 + ora: 5.4.1 + run-async: 2.4.1 + rxjs: 7.8.2 + string-width: 4.2.3 + strip-ansi: 6.0.1 + through: 2.3.8 + wrap-ansi: 6.2.0 + + internmap@2.0.3: {} + + ioredis@6.0.0: + dependencies: + '@ioredis/commands': 2.0.0 + cluster-key-slot: 1.1.1 + debug: 4.4.3 + denque: 2.1.0 + redis-errors: 1.2.0 + standard-as-callback: 2.1.0 + transitivePeerDependencies: + - supports-color + + ipaddr.js@1.9.1: + optional: true + + ipaddr.js@2.5.0: {} + + is-arrayish@0.2.1: {} + + is-extglob@2.1.1: {} + + is-fullwidth-code-point@3.0.0: {} + + is-generator-fn@2.1.0: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + is-interactive@1.0.0: {} + + is-interactive@2.0.0: {} + + is-promise@4.0.0: + optional: true + + is-property@1.0.2: {} + + is-stream@2.0.1: {} + + is-unicode-supported@0.1.0: {} + + is-unicode-supported@2.1.0: {} + + isexe@2.0.0: {} + + istanbul-lib-coverage@3.2.2: {} + + istanbul-lib-instrument@6.0.3: + dependencies: + '@babel/core': 7.29.7 + '@babel/parser': 7.29.9 + '@istanbuljs/schema': 0.1.6 + istanbul-lib-coverage: 3.2.2 + semver: 7.8.5 + transitivePeerDependencies: + - supports-color + + istanbul-lib-report@3.0.1: + dependencies: + istanbul-lib-coverage: 3.2.2 + make-dir: 4.0.0 + supports-color: 7.2.0 + + istanbul-lib-source-maps@5.0.6: + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + debug: 4.4.3 + istanbul-lib-coverage: 3.2.2 + transitivePeerDependencies: + - supports-color + + istanbul-reports@3.2.0: + dependencies: + html-escaper: 2.0.2 + istanbul-lib-report: 3.0.1 + + iterare@1.2.1: {} + + jackspeak@3.4.3: + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + + jest-changed-files@30.5.1: + dependencies: + execa: 5.1.1 + jest-util: 30.5.1 + p-limit: 3.1.0 + + jest-circus@30.5.2: + dependencies: + '@jest/environment': 30.5.2 + '@jest/expect': 30.5.2 + '@jest/test-result': 30.5.2 + '@jest/types': 30.5.1 + '@types/node': 24.13.6 + chalk: 4.1.2 + co: 4.6.0 + dedent: 1.7.2 + is-generator-fn: 2.1.0 + jest-each: 30.5.2 + jest-matcher-utils: 30.5.2 + jest-message-util: 30.5.1 + jest-runtime: 30.5.2 + jest-snapshot: 30.5.2 + jest-util: 30.5.1 + p-limit: 3.1.0 + pretty-format: 30.5.1 + pure-rand: 7.0.1 + slash: 3.0.0 + stack-utils: 2.0.6 + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + + jest-cli@30.5.2(@types/node@24.13.6)(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)): + dependencies: + '@jest/core': 30.5.2(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)) + '@jest/test-result': 30.5.2 + '@jest/types': 30.5.1 + chalk: 4.1.2 + exit-x: 0.2.2 + import-local: 3.2.0 + jest-config: 30.5.2(@types/node@24.13.6)(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)) + jest-util: 30.5.1 + jest-validate: 30.5.1 + yargs: 17.7.3 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - esbuild-register + - supports-color + - ts-node + + jest-config@30.5.2(@types/node@24.13.6)(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)): + dependencies: + '@babel/core': 7.29.7 + '@jest/get-type': 30.5.0 + '@jest/pattern': 30.5.0 + '@jest/test-sequencer': 30.5.2 + '@jest/types': 30.5.1 + babel-jest: 30.5.2(@babel/core@7.29.7) + chalk: 4.1.2 + ci-info: 4.4.0 + deepmerge: 4.3.1 + glob: 13.0.6 + graceful-fs: 4.2.11 + jest-circus: 30.5.2 + jest-docblock: 30.5.0 + jest-environment-node: 30.5.2 + jest-regex-util: 30.5.0 + jest-resolve: 30.5.1 + jest-runner: 30.5.2 + jest-util: 30.5.1 + jest-validate: 30.5.1 + parse-json: 5.2.0 + pretty-format: 30.5.1 + slash: 3.0.0 + strip-json-comments: 3.1.1 + optionalDependencies: + '@types/node': 24.13.6 + ts-node: 10.9.2(@types/node@24.13.6)(typescript@6.0.3) + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + + jest-diff@30.5.2: + dependencies: + '@jest/diff-sequences': 30.5.0 + '@jest/get-type': 30.5.0 + chalk: 4.1.2 + pretty-format: 30.5.1 + + jest-docblock@30.5.0: + dependencies: + detect-newline: 3.1.0 + + jest-each@30.5.2: + dependencies: + '@jest/get-type': 30.5.0 + '@jest/types': 30.5.1 + chalk: 4.1.2 + jest-regex-util: 30.5.0 + jest-util: 30.5.1 + pretty-format: 30.5.1 + + jest-environment-node@30.5.2: + dependencies: + '@jest/environment': 30.5.2 + '@jest/fake-timers': 30.5.2 + '@jest/types': 30.5.1 + '@types/node': 24.13.6 + jest-mock: 30.5.2 + jest-util: 30.5.1 + jest-validate: 30.5.1 + + jest-haste-map@30.5.1: + dependencies: + '@jest/types': 30.5.1 + '@parcel/watcher': 2.6.0 + '@types/node': 24.13.6 + anymatch: 3.1.3 + fb-watchman: 2.0.2 + fdir: 6.5.0(picomatch@4.0.7) + graceful-fs: 4.2.11 + jest-regex-util: 30.5.0 + jest-util: 30.5.1 + jest-worker: 30.5.1 + picomatch: 4.0.7 + + jest-leak-detector@30.5.1: + dependencies: + '@jest/get-type': 30.5.0 + pretty-format: 30.5.1 + + jest-matcher-utils@30.5.2: + dependencies: + '@jest/get-type': 30.5.0 + chalk: 4.1.2 + jest-diff: 30.5.2 + pretty-format: 30.5.1 + + jest-message-util@30.5.1: + dependencies: + '@babel/code-frame': 7.29.7 + '@jest/types': 30.5.1 + '@types/stack-utils': 2.0.3 + chalk: 4.1.2 + graceful-fs: 4.2.11 + jest-util: 30.5.1 + picomatch: 4.0.7 + pretty-format: 30.5.1 + slash: 3.0.0 + stack-utils: 2.0.6 + + jest-mock@30.5.2: + dependencies: + '@jest/expect-utils': 30.5.2 + '@jest/types': 30.5.1 + '@types/node': 24.13.6 + jest-util: 30.5.1 + + jest-regex-util@30.5.0: {} + + jest-resolve-dependencies@30.5.2: + dependencies: + jest-regex-util: 30.5.0 + jest-snapshot: 30.5.2 + transitivePeerDependencies: + - supports-color + + jest-resolve@30.5.1: + dependencies: + chalk: 4.1.2 + graceful-fs: 4.2.11 + jest-haste-map: 30.5.1 + jest-util: 30.5.1 + jest-validate: 30.5.1 + slash: 3.0.0 + unrs-resolver: 1.12.2 + + jest-runner@30.5.2: + dependencies: + '@jest/console': 30.5.2 + '@jest/environment': 30.5.2 + '@jest/source-map': 30.5.2 + '@jest/test-result': 30.5.2 + '@jest/transform': 30.5.2 + '@jest/types': 30.5.1 + '@types/node': 24.13.6 + chalk: 4.1.2 + emittery: 0.13.1 + exit-x: 0.2.2 + graceful-fs: 4.2.11 + jest-docblock: 30.5.0 + jest-environment-node: 30.5.2 + jest-haste-map: 30.5.1 + jest-leak-detector: 30.5.1 + jest-message-util: 30.5.1 + jest-resolve: 30.5.1 + jest-runtime: 30.5.2 + jest-util: 30.5.1 + jest-watcher: 30.5.2 + jest-worker: 30.5.1 + p-limit: 3.1.0 + transitivePeerDependencies: + - supports-color + + jest-runtime@30.5.2: + dependencies: + '@jest/environment': 30.5.2 + '@jest/fake-timers': 30.5.2 + '@jest/globals': 30.5.2 + '@jest/source-map': 30.5.2 + '@jest/test-result': 30.5.2 + '@jest/transform': 30.5.2 + '@jest/types': 30.5.1 + '@types/node': 24.13.6 + chalk: 4.1.2 + cjs-module-lexer: 2.2.1 + collect-v8-coverage: 1.0.3 + es-module-lexer: 2.3.2 + glob: 13.0.6 + graceful-fs: 4.2.11 + jest-haste-map: 30.5.1 + jest-message-util: 30.5.1 + jest-mock: 30.5.2 + jest-regex-util: 30.5.0 + jest-resolve: 30.5.1 + jest-snapshot: 30.5.2 + jest-util: 30.5.1 + slash: 3.0.0 + strip-bom: 4.0.0 + transitivePeerDependencies: + - supports-color + + jest-snapshot@30.5.2: + dependencies: + '@babel/core': 7.29.7 + '@babel/generator': 7.29.8 + '@babel/plugin-syntax-jsx': 7.29.7(@babel/core@7.29.7) + '@babel/plugin-syntax-typescript': 7.29.7(@babel/core@7.29.7) + '@babel/types': 7.29.8 + '@jest/expect-utils': 30.5.2 + '@jest/get-type': 30.5.0 + '@jest/snapshot-utils': 30.5.1 + '@jest/transform': 30.5.2 + '@jest/types': 30.5.1 + babel-preset-current-node-syntax: 1.2.0(@babel/core@7.29.7) + chalk: 4.1.2 + expect: 30.5.2 + graceful-fs: 4.2.11 + jest-diff: 30.5.2 + jest-matcher-utils: 30.5.2 + jest-message-util: 30.5.1 + jest-util: 30.5.1 + pretty-format: 30.5.1 + semver: 7.8.5 + synckit: 0.11.13 + transitivePeerDependencies: + - supports-color + + jest-util@30.5.1: + dependencies: + '@jest/types': 30.5.1 + '@types/node': 24.13.6 + chalk: 4.1.2 + ci-info: 4.4.0 + graceful-fs: 4.2.11 + picomatch: 4.0.7 + + jest-validate@30.5.1: + dependencies: + '@jest/get-type': 30.5.0 + '@jest/types': 30.5.1 + camelcase: 6.3.0 + chalk: 4.1.2 + leven: 3.1.0 + pretty-format: 30.5.1 + + jest-watcher@30.5.2: + dependencies: + '@jest/test-result': 30.5.2 + '@jest/types': 30.5.1 + '@types/node': 24.13.6 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + emittery: 0.13.1 + jest-util: 30.5.1 + string-length: 4.0.2 + + jest-worker@27.5.1: + dependencies: + '@types/node': 24.13.6 + merge-stream: 2.0.0 + supports-color: 8.1.1 + + jest-worker@30.5.1: + dependencies: + '@types/node': 24.13.6 + '@ungap/structured-clone': 1.4.0 + jest-util: 30.5.1 + merge-stream: 2.0.0 + supports-color: 8.1.1 + + jest@30.5.2(@types/node@24.13.6)(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)): + dependencies: + '@jest/core': 30.5.2(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)) + '@jest/types': 30.5.1 + import-local: 3.2.0 + jest-cli: 30.5.2(@types/node@24.13.6)(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)) + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - esbuild-register + - supports-color + - ts-node + + jiti@2.7.0: {} + + joycon@3.1.1: {} + + js-tokens@4.0.0: {} + + js-yaml@3.15.2: + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + + js-yaml@5.4.1: + dependencies: + argparse: 2.0.1 + + jsesc@3.1.0: {} + + json-parse-even-better-errors@2.3.1: {} + + json-schema-ref-resolver@3.0.0: + dependencies: + dequal: 2.0.3 + + json-schema-traverse@1.0.0: {} + + json5@2.2.3: {} + + jsonc-parser@3.3.1: {} + + leven@3.1.0: {} + + light-my-request@6.6.0: + dependencies: + cookie: 1.1.1 + process-warning: 4.0.1 + set-cookie-parser: 2.7.2 + + lines-and-columns@1.2.4: {} + + load-esm@1.0.3: {} + + locate-path@5.0.0: + dependencies: + p-locate: 4.1.0 + + lodash.memoize@4.1.2: {} + + lodash@4.18.1: {} + + log-symbols@4.1.0: + dependencies: + chalk: 4.1.2 + is-unicode-supported: 0.1.0 + + log-symbols@7.0.1: + dependencies: + is-unicode-supported: 2.1.0 + yoctocolors: 2.2.0 + + long@5.3.2: {} + + lru-cache@10.4.3: {} + + lru-cache@11.5.3: {} + + lru-cache@5.1.1: + dependencies: + yallist: 3.1.1 + + lru.min@1.1.5: {} + + magic-string@1.0.0: + dependencies: + '@jridgewell/sourcemap-codec': 1.6.0 + + make-dir@4.0.0: + dependencies: + semver: 7.8.5 + + make-error@1.3.6: {} + + math-intrinsics@1.1.0: {} + + media-typer@0.3.0: + optional: true + + media-typer@1.1.1: + optional: true + + merge-descriptors@2.0.0: + optional: true + + merge-stream@2.0.0: {} + + methods@1.1.2: {} + + mime-db@1.52.0: {} + + mime-db@1.54.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + mime-types@3.0.2: + dependencies: + mime-db: 1.54.0 + optional: true + + mime@2.6.0: {} + + mime@3.0.0: {} + + mimic-fn@2.1.0: {} + + mimic-function@5.0.1: {} + + minimatch@10.2.6: + dependencies: + brace-expansion: 5.0.12 + + minimatch@9.0.9: + dependencies: + brace-expansion: 2.1.7 + + minimist@1.2.8: {} + + minimizer-webpack-plugin@5.11.0(webpack@5.111.1): + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + jest-worker: 27.5.1 + schema-utils: 4.5.0 + terser: 5.51.2 + webpack: 5.111.1 + + minipass@7.1.3: {} + + ms@2.1.3: {} + + multer@2.4.0: + dependencies: + append-field: 1.0.0 + busboy: 1.6.0 + type-is: 1.6.18 + optional: true + + mute-stream@0.0.8: {} + + mute-stream@3.0.0: {} + + mysql2@3.15.3: + dependencies: + aws-ssl-profiles: 1.1.2 + denque: 2.1.0 + generate-function: 2.3.1 + iconv-lite: 0.7.3 + long: 5.3.2 + lru.min: 1.1.5 + named-placeholders: 1.1.6 + seq-queue: 0.0.5 + sqlstring: 2.3.3 + + named-placeholders@1.1.6: + dependencies: + lru.min: 1.1.5 + + nanoid@5.1.16: {} + + napi-postinstall@0.3.4: {} + + natural-compare@1.4.0: {} + + negotiator@1.1.0: + dependencies: + content-type: 2.1.0 + optional: true + + neo-async@2.6.2: {} + + nestjs-pino@5.2.0(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@12.0.4)(pino-http@11.0.0)(pino@10.3.1)(rxjs@7.8.2): + dependencies: + '@nestjs/common': 12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2) + '@nestjs/core': 12.0.4(@nestjs/common@12.0.4(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/platform-express@12.0.4)(reflect-metadata@0.2.2)(rxjs@7.8.2) + pino: 10.3.1 + pino-http: 11.0.0 + rxjs: 7.8.2 + + node-addon-api@7.1.1: {} + + node-emoji@2.1.3: + dependencies: + '@sindresorhus/is': 4.6.0 + char-regex: 1.0.2 + emojilib: 2.4.0 + skin-tone: 2.0.0 + + node-emoji@2.2.0: + dependencies: + '@sindresorhus/is': 4.6.0 + char-regex: 1.0.2 + emojilib: 2.4.0 + skin-tone: 2.0.0 + + node-int64@0.4.0: {} + + node-releases@2.0.56: {} + + normalize-path@3.0.0: {} + + npm-run-path@4.0.1: + dependencies: + path-key: 3.1.1 + + object-assign@4.1.1: + optional: true + + object-inspect@1.13.4: {} + + ohash@2.0.12: {} + + on-exit-leak-free@2.1.2: {} + + on-finished@2.4.1: + dependencies: + ee-first: 1.1.1 + optional: true + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + onetime@5.1.2: + dependencies: + mimic-fn: 2.1.0 + + onetime@7.0.0: + dependencies: + mimic-function: 5.0.1 + + ora@5.4.1: + dependencies: + bl: 4.1.0 + chalk: 4.1.2 + cli-cursor: 3.1.0 + cli-spinners: 2.9.2 + is-interactive: 1.0.0 + is-unicode-supported: 0.1.0 + log-symbols: 4.1.0 + strip-ansi: 6.0.1 + wcwidth: 1.0.1 + + ora@9.4.1: + dependencies: + chalk: 5.6.2 + cli-cursor: 5.0.0 + cli-spinners: 3.4.0 + is-interactive: 2.0.0 + is-unicode-supported: 2.1.0 + log-symbols: 7.0.1 + stdin-discarder: 0.3.2 + string-width: 8.2.2 + + os-tmpdir@1.0.2: {} + + oxlint-tsgolint@7.0.2002: + optionalDependencies: + '@oxlint-tsgolint/darwin-arm64': 7.0.2002 + '@oxlint-tsgolint/darwin-x64': 7.0.2002 + '@oxlint-tsgolint/linux-arm64': 7.0.2002 + '@oxlint-tsgolint/linux-x64': 7.0.2002 + '@oxlint-tsgolint/win32-arm64': 7.0.2002 + '@oxlint-tsgolint/win32-x64': 7.0.2002 + + oxlint@1.83.0(oxlint-tsgolint@7.0.2002): + optionalDependencies: + '@oxlint/binding-android-arm-eabi': 1.83.0 + '@oxlint/binding-android-arm64': 1.83.0 + '@oxlint/binding-darwin-arm64': 1.83.0 + '@oxlint/binding-darwin-x64': 1.83.0 + '@oxlint/binding-freebsd-x64': 1.83.0 + '@oxlint/binding-linux-arm-gnueabihf': 1.83.0 + '@oxlint/binding-linux-arm-musleabihf': 1.83.0 + '@oxlint/binding-linux-arm64-gnu': 1.83.0 + '@oxlint/binding-linux-arm64-musl': 1.83.0 + '@oxlint/binding-linux-ppc64-gnu': 1.83.0 + '@oxlint/binding-linux-riscv64-gnu': 1.83.0 + '@oxlint/binding-linux-riscv64-musl': 1.83.0 + '@oxlint/binding-linux-s390x-gnu': 1.83.0 + '@oxlint/binding-linux-x64-gnu': 1.83.0 + '@oxlint/binding-linux-x64-musl': 1.83.0 + '@oxlint/binding-openharmony-arm64': 1.83.0 + '@oxlint/binding-win32-arm64-msvc': 1.83.0 + '@oxlint/binding-win32-ia32-msvc': 1.83.0 + '@oxlint/binding-win32-x64-msvc': 1.83.0 + oxlint-tsgolint: 7.0.2002 + + p-limit@2.3.0: + dependencies: + p-try: 2.2.0 + + p-limit@3.1.0: + dependencies: + yocto-queue: 0.1.0 + + p-locate@4.1.0: + dependencies: + p-limit: 2.3.0 + + p-try@2.2.0: {} + + package-json-from-dist@1.0.1: {} + + parse-json@5.2.0: + dependencies: + '@babel/code-frame': 7.29.7 + error-ex: 1.3.4 + json-parse-even-better-errors: 2.3.1 + lines-and-columns: 1.2.4 + + parseurl@1.3.3: + optional: true + + path-exists@4.0.0: {} + + path-key@3.1.1: {} + + path-scurry@1.11.1: + dependencies: + lru-cache: 10.4.3 + minipass: 7.1.3 + + path-scurry@2.0.2: + dependencies: + lru-cache: 11.5.3 + minipass: 7.1.3 + + path-to-regexp@8.4.2: {} + + pathe@2.0.3: {} + + perfect-debounce@2.1.0: {} + + pg-cloudflare@1.4.1: + optional: true + + pg-connection-string@2.14.1: {} + + pg-int8@1.0.1: {} + + pg-pool@3.14.0(pg@8.23.1): + dependencies: + pg: 8.23.1 + + pg-protocol@1.16.1: {} + + pg-types@2.2.0: + dependencies: + pg-int8: 1.0.1 + postgres-array: 2.0.0 + postgres-bytea: 1.0.1 + postgres-date: 1.0.7 + postgres-interval: 1.2.0 + + pg@8.23.1: + dependencies: + pg-connection-string: 2.14.1 + pg-pool: 3.14.0(pg@8.23.1) + pg-protocol: 1.16.1 + pg-types: 2.2.0 + pgpass: 1.0.5 + optionalDependencies: + pg-cloudflare: 1.4.1 + + pgpass@1.0.5: + dependencies: + split2: 4.2.0 + + picocolors@1.1.1: {} + + picomatch@2.3.2: {} + + picomatch@4.0.5: {} + + picomatch@4.0.7: {} + + pino-abstract-transport@3.0.0: + dependencies: + split2: 4.2.0 + + pino-http@11.0.0: + dependencies: + get-caller-file: 2.0.5 + pino: 10.3.1 + pino-std-serializers: 7.1.0 + process-warning: 5.1.0 + + pino-pretty@13.1.3: + dependencies: + colorette: 2.0.20 + dateformat: 4.6.3 + fast-copy: 4.1.1 + fast-safe-stringify: 2.1.1 + help-me: 5.0.0 + joycon: 3.1.1 + minimist: 1.2.8 + on-exit-leak-free: 2.1.2 + pino-abstract-transport: 3.0.0 + pump: 3.0.4 + secure-json-parse: 4.1.0 + sonic-boom: 4.2.1 + strip-json-comments: 5.0.3 + + pino-std-serializers@7.1.0: {} + + pino@10.3.1: + dependencies: + '@pinojs/redact': 0.4.0 + atomic-sleep: 1.0.0 + on-exit-leak-free: 2.1.2 + pino-abstract-transport: 3.0.0 + pino-std-serializers: 7.1.0 + process-warning: 5.1.0 + quick-format-unescaped: 4.0.4 + real-require: 0.2.0 + safe-stable-stringify: 2.5.0 + sonic-boom: 4.2.1 + thread-stream: 4.2.0 + + pirates@4.0.7: {} + + pkg-dir@4.2.0: + dependencies: + find-up: 4.1.0 + + pkg-types@2.3.3: + dependencies: + confbox: 0.3.1 + exsolve: 1.1.3 + pathe: 2.0.3 + + pluralize@8.0.0: {} + + postgres-array@2.0.0: {} + + postgres-array@3.0.4: {} + + postgres-bytea@1.0.1: {} + + postgres-date@1.0.7: {} + + postgres-interval@1.2.0: + dependencies: + xtend: 4.0.2 + + postgres@3.4.7: {} + + prettier@3.9.8: {} + + pretty-format@30.5.1: + dependencies: + '@jest/react-is-18': react-is@18.3.1 + '@jest/react-is-19': react-is@19.3.0 + '@jest/schemas': 30.5.0 + ansi-styles: 5.2.0 + + prisma@7.10.0(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(typescript@6.0.3): + dependencies: + '@prisma/config': 7.10.0 + '@prisma/dev': 0.24.17(typescript@6.0.3) + '@prisma/engines': 7.10.0 + '@prisma/studio-core': 0.33.0(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0) + mysql2: 3.15.3 + postgres: 3.4.7 + optionalDependencies: + typescript: 6.0.3 + transitivePeerDependencies: + - '@types/react' + - '@types/react-dom' + - magicast + - react + - react-dom + + process-warning@4.0.1: {} + + process-warning@5.1.0: {} + + proper-lockfile@4.1.2: + dependencies: + graceful-fs: 4.2.11 + retry: 0.12.0 + signal-exit: 3.0.7 + + proxy-addr@2.0.8: + dependencies: + forwarded: 0.2.0 + ipaddr.js: 1.9.1 + optional: true + + pump@3.0.4: + dependencies: + end-of-stream: 1.4.5 + once: 1.4.0 + + pure-rand@6.1.0: {} + + pure-rand@7.0.1: {} + + qs@6.16.0: + dependencies: + es-define-property: 1.0.1 + side-channel: 1.1.1 + + quick-format-unescaped@4.0.4: {} + + range-parser@1.3.0: + optional: true + + raw-body@3.0.2: + dependencies: + bytes: 3.1.2 + http-errors: 2.0.1 + iconv-lite: 0.7.3 + unpipe: 1.0.0 + optional: true + + rc9@3.1.0: + dependencies: + defu: 6.1.7 + destr: 2.0.5 + + react-dom@19.3.0(react@19.3.0): + dependencies: + react: 19.3.0 + scheduler: 0.28.0 + + react-is@18.3.1: {} + + react-is@19.3.0: {} + + react@19.3.0: {} + + readable-stream@3.6.2: + dependencies: + inherits: 2.0.4 + string_decoder: 1.3.0 + util-deprecate: 1.0.2 + + readdirp@5.1.1: {} + + real-require@0.2.0: {} + + real-require@1.0.0: {} + + redis-errors@1.2.0: {} + + reflect-metadata@0.2.2: {} + + remeda@2.33.4: {} + + require-directory@2.1.1: {} + + require-from-string@2.0.2: {} + + resolve-cwd@3.0.0: + dependencies: + resolve-from: 5.0.0 + + resolve-from@5.0.0: {} + + restore-cursor@3.1.0: + dependencies: + onetime: 5.1.2 + signal-exit: 3.0.7 + + restore-cursor@5.1.0: + dependencies: + onetime: 7.0.0 + signal-exit: 4.1.0 + + ret@0.5.0: {} + + retry@0.12.0: {} + + reusify@1.1.0: {} + + rfdc@1.4.1: {} + + robust-predicates@3.0.3: {} + + router@2.2.0: + dependencies: + debug: 4.4.3 + depd: 2.0.0 + is-promise: 4.0.0 + parseurl: 1.3.3 + path-to-regexp: 8.4.2 + transitivePeerDependencies: + - supports-color + optional: true + + run-async@2.4.1: {} + + rxjs@7.8.2: + dependencies: + tslib: 2.8.1 + + safe-buffer@5.2.1: {} + + safe-regex2@5.1.1: + dependencies: + ret: 0.5.0 + + safe-stable-stringify@2.5.0: {} + + safer-buffer@2.1.2: {} + + scheduler@0.28.0: {} + + schema-utils@4.5.0: + dependencies: + '@types/json-schema': 7.0.15 + ajv: 8.20.0 + ajv-formats: 3.0.1(ajv@8.20.0) + ajv-keywords: 5.1.0(ajv@8.20.0) + + secure-json-parse@4.1.0: {} + + semver@6.3.1: {} + + semver@7.8.5: {} + + send@1.2.1: + dependencies: + debug: 4.4.3 + encodeurl: 2.0.0 + escape-html: 1.0.3 + etag: 1.8.1 + fresh: 2.0.0 + http-errors: 2.0.1 + mime-types: 3.0.2 + ms: 2.1.3 + on-finished: 2.4.1 + range-parser: 1.3.0 + statuses: 2.0.2 + transitivePeerDependencies: + - supports-color + optional: true + + seq-queue@0.0.5: {} + + serve-static@2.2.1: + dependencies: + encodeurl: 2.0.0 + escape-html: 1.0.3 + parseurl: 1.3.3 + send: 1.2.1 + transitivePeerDependencies: + - supports-color + optional: true + + set-cookie-parser@2.7.2: {} + + setprototypeof@1.2.0: {} + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + side-channel-list@1.0.1: + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.4 + + side-channel-map@1.0.1: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + + side-channel-weakmap@1.0.2: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + side-channel-map: 1.0.1 + + side-channel@1.1.1: + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.4 + side-channel-list: 1.0.1 + side-channel-map: 1.0.1 + side-channel-weakmap: 1.0.2 + + signal-exit@3.0.7: {} + + signal-exit@4.1.0: {} + + skin-tone@2.0.0: + dependencies: + unicode-emoji-modifier-base: 1.0.0 + + slash@3.0.0: {} + + sonic-boom@4.2.1: + dependencies: + atomic-sleep: 1.0.0 + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + source-map@0.7.6: {} + + split2@4.2.0: {} + + sprintf-js@1.0.3: {} + + sqlstring@2.3.3: {} + + stack-utils@2.0.6: + dependencies: + escape-string-regexp: 2.0.0 + + standard-as-callback@2.1.0: {} + + statuses@2.0.2: {} + + std-env@3.10.0: {} + + stdin-discarder@0.3.2: {} + + streamsearch@1.1.0: + optional: true + + string-length@4.0.2: + dependencies: + char-regex: 1.0.2 + strip-ansi: 6.0.1 + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + string-width@5.1.2: + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 9.2.2 + strip-ansi: 7.2.0 + + string-width@8.2.2: + dependencies: + get-east-asian-width: 1.7.0 + strip-ansi: 7.2.0 + + string_decoder@1.3.0: + dependencies: + safe-buffer: 5.2.1 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-ansi@7.2.0: + dependencies: + ansi-regex: 6.3.0 + + strip-bom@3.0.0: {} + + strip-bom@4.0.0: {} + + strip-final-newline@2.0.0: {} + + strip-json-comments@3.1.1: {} + + strip-json-comments@5.0.3: {} + + strtok3@10.3.5: + dependencies: + '@tokenizer/token': 0.3.0 + + superagent@10.3.0: + dependencies: + component-emitter: 1.3.1 + cookiejar: 2.1.4 + debug: 4.4.3 + fast-safe-stringify: 2.1.1 + form-data: 4.0.6 + formidable: 3.5.4 + methods: 1.1.2 + mime: 2.6.0 + qs: 6.16.0 + transitivePeerDependencies: + - supports-color + + supertest@7.2.2: + dependencies: + cookie-signature: 1.2.2 + methods: 1.1.2 + superagent: 10.3.0 + transitivePeerDependencies: + - supports-color + + supports-color@7.2.0: + dependencies: + has-flag: 4.0.0 + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + + swagger-ui-dist@5.32.14: + dependencies: + '@scarf/scarf': 1.4.0 + + synckit@0.11.13: + dependencies: + '@pkgr/core': 0.3.6 + + tagged-tag@1.0.0: {} + + tapable@2.3.3: {} + + terser@5.51.2: + dependencies: + '@jridgewell/source-map': 0.3.11 + acorn: 8.18.0 + commander: 2.20.3 + source-map-support: 0.5.21 + + test-exclude@7.0.2: + dependencies: + '@istanbuljs/schema': 0.1.6 + glob: 10.5.0 + minimatch: 10.2.6 + + thread-stream@4.2.0: + dependencies: + real-require: 1.0.0 + + through@2.3.8: {} + + tmp@0.0.33: + dependencies: + os-tmpdir: 1.0.2 + + toad-cache@3.7.4: {} + + toidentifier@1.0.1: {} + + token-types@6.1.2: + dependencies: + '@borewit/text-codec': 0.2.2 + '@tokenizer/token': 0.3.0 + ieee754: 1.2.1 + + ts-jest@29.4.12(@babel/core@7.29.7)(@jest/transform@30.5.2)(@jest/types@30.5.1)(babel-jest@30.5.2(@babel/core@7.29.7))(jest-util@30.5.1)(jest@30.5.2(@types/node@24.13.6)(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)))(typescript@6.0.3): + dependencies: + bs-logger: 0.2.6 + fast-json-stable-stringify: 2.1.0 + handlebars: 4.7.9 + jest: 30.5.2(@types/node@24.13.6)(ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3)) + json5: 2.2.3 + lodash.memoize: 4.1.2 + make-error: 1.3.6 + semver: 7.8.5 + type-fest: 4.41.0 + typescript: 6.0.3 + yargs-parser: 21.1.1 + optionalDependencies: + '@babel/core': 7.29.7 + '@jest/transform': 30.5.2 + '@jest/types': 30.5.1 + babel-jest: 30.5.2(@babel/core@7.29.7) + jest-util: 30.5.1 + + ts-loader@9.6.2(typescript@6.0.3)(webpack@5.111.1): + dependencies: + chalk: 4.1.2 + picomatch: 4.0.7 + source-map: 0.7.6 + typescript: 6.0.3 + webpack: 5.111.1 + + ts-node@10.9.2(@types/node@24.13.6)(typescript@6.0.3): + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.13 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.4 + '@types/node': 24.13.6 + acorn: 8.18.0 + acorn-walk: 8.3.5 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.4 + make-error: 1.3.6 + typescript: 6.0.3 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + + tsconfig-paths@4.2.0: + dependencies: + json5: 2.2.3 + minimist: 1.2.8 + strip-bom: 3.0.0 + + tslib@2.8.1: {} + + type-detect@4.0.8: {} + + type-fest@0.21.3: {} + + type-fest@4.41.0: {} + + type-fest@5.10.0: + dependencies: + tagged-tag: 1.0.0 + + type-is@1.6.18: + dependencies: + media-typer: 0.3.0 + mime-types: 2.1.35 + optional: true + + type-is@2.1.0: + dependencies: + content-type: 2.1.0 + media-typer: 1.1.1 + mime-types: 3.0.2 + optional: true + + typescript@6.0.3: {} + + uglify-js@3.19.3: + optional: true + + uid@2.0.2: + dependencies: + '@lukeed/csprng': 1.1.0 + + uint8array-extras@1.5.0: {} + + undici-types@7.18.2: {} + + undici@6.20.1: {} + + unicode-emoji-modifier-base@1.0.0: {} + + unpipe@1.0.0: + optional: true + + unrs-resolver@1.12.2: + dependencies: + napi-postinstall: 0.3.4 + optionalDependencies: + '@unrs/resolver-binding-android-arm-eabi': 1.12.2 + '@unrs/resolver-binding-android-arm64': 1.12.2 + '@unrs/resolver-binding-darwin-arm64': 1.12.2 + '@unrs/resolver-binding-darwin-x64': 1.12.2 + '@unrs/resolver-binding-freebsd-x64': 1.12.2 + '@unrs/resolver-binding-linux-arm-gnueabihf': 1.12.2 + '@unrs/resolver-binding-linux-arm-musleabihf': 1.12.2 + '@unrs/resolver-binding-linux-arm64-gnu': 1.12.2 + '@unrs/resolver-binding-linux-arm64-musl': 1.12.2 + '@unrs/resolver-binding-linux-loong64-gnu': 1.12.2 + '@unrs/resolver-binding-linux-loong64-musl': 1.12.2 + '@unrs/resolver-binding-linux-ppc64-gnu': 1.12.2 + '@unrs/resolver-binding-linux-riscv64-gnu': 1.12.2 + '@unrs/resolver-binding-linux-riscv64-musl': 1.12.2 + '@unrs/resolver-binding-linux-s390x-gnu': 1.12.2 + '@unrs/resolver-binding-linux-x64-gnu': 1.12.2 + '@unrs/resolver-binding-linux-x64-musl': 1.12.2 + '@unrs/resolver-binding-openharmony-arm64': 1.12.2 + '@unrs/resolver-binding-wasm32-wasi': 1.12.2 + '@unrs/resolver-binding-win32-arm64-msvc': 1.12.2 + '@unrs/resolver-binding-win32-ia32-msvc': 1.12.2 + '@unrs/resolver-binding-win32-x64-msvc': 1.12.2 + + update-browserslist-db@1.3.3(browserslist@4.29.0): + dependencies: + browserslist: 4.29.0 + escalade: 3.2.0 + picocolors: 1.1.1 + + util-deprecate@1.0.2: {} + + v8-compile-cache-lib@3.0.1: {} + + v8-to-istanbul@9.3.0: + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + '@types/istanbul-lib-coverage': 2.0.6 + convert-source-map: 2.0.0 + + valibot@1.4.2(typescript@6.0.3): + optionalDependencies: + typescript: 6.0.3 + + vary@1.1.2: + optional: true + + watchpack@2.5.2: + dependencies: + graceful-fs: 4.2.11 + + wcwidth@1.0.1: + dependencies: + defaults: 1.0.4 + + webpack-sources@3.5.1: {} + + webpack@5.111.1: + dependencies: + '@types/estree': 1.0.9 + '@types/json-schema': 7.0.15 + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/wasm-edit': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + browserslist: 4.29.0 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.25.1 + es-module-lexer: 2.3.2 + events: 3.3.0 + graceful-fs: 4.2.11 + mime-db: 1.54.0 + minimizer-webpack-plugin: 5.11.0(webpack@5.111.1) + schema-utils: 4.5.0 + tapable: 2.3.3 + watchpack: 2.5.2 + webpack-sources: 3.5.1 + transitivePeerDependencies: + - '@minify-html/node' + - '@napi-rs/image' + - '@swc/core' + - '@swc/css' + - '@swc/html' + - clean-css + - cssnano + - csso + - esbuild + - html-minifier-terser + - imagemin + - lightningcss + - postcss + - sharp + - svgo + - uglify-js + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + wordwrap@1.0.0: {} + + wrap-ansi@6.2.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrap-ansi@8.1.0: + dependencies: + ansi-styles: 6.2.3 + string-width: 5.1.2 + strip-ansi: 7.2.0 + + wrappy@1.0.2: {} + + write-file-atomic@5.0.1: + dependencies: + imurmurhash: 0.1.4 + signal-exit: 4.1.0 + + xtend@4.0.2: {} + + y18n@5.0.8: {} + + yallist@3.1.1: {} + + yargs-parser@21.1.1: {} + + yargs@17.7.3: + dependencies: + cliui: 8.0.1 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 + + yn@3.1.1: {} + + yocto-queue@0.1.0: {} + + yoctocolors@2.2.0: {} + + zeptomatch@2.1.0: + dependencies: + grammex: 3.1.13 + graphmatch: 1.1.1 + + zod@4.6.5: {} diff --git a/prisma.config.ts b/prisma.config.ts new file mode 100644 index 00000000..74ba9ee2 --- /dev/null +++ b/prisma.config.ts @@ -0,0 +1,8 @@ +import 'dotenv/config'; +import { defineConfig } from 'prisma/config'; + +export default defineConfig({ + schema: 'prisma/schema.prisma', + migrations: { path: 'prisma/migrations' }, + datasource: { url: process.env.DATABASE_URL }, +}); diff --git a/prisma/migrations/20261011140000_initial/migration.sql b/prisma/migrations/20261011140000_initial/migration.sql new file mode 100644 index 00000000..8e449725 --- /dev/null +++ b/prisma/migrations/20261011140000_initial/migration.sql @@ -0,0 +1,56 @@ +CREATE SCHEMA IF NOT EXISTS "public"; + +CREATE TABLE "users" ( + "id" UUID NOT NULL, + "username" VARCHAR(32) NOT NULL, + "display_name" VARCHAR(100) NOT NULL, + "created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "users_pkey" PRIMARY KEY ("id") +); + +CREATE TABLE "chats" ( + "id" UUID NOT NULL, + "title" VARCHAR(100) NOT NULL, + "created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "chats_pkey" PRIMARY KEY ("id") +); + +CREATE TABLE "chat_members" ( + "chat_id" UUID NOT NULL, + "user_id" UUID NOT NULL, + "position" INTEGER NOT NULL, + + CONSTRAINT "chat_members_pkey" PRIMARY KEY ("chat_id","user_id") +); + +CREATE TABLE "messages" ( + "id" UUID NOT NULL, + "chat_id" UUID NOT NULL, + "sender_id" UUID NOT NULL, + "text" VARCHAR(4000) NOT NULL, + "created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + + CONSTRAINT "messages_pkey" PRIMARY KEY ("id") +); + +CREATE UNIQUE INDEX "users_username_key" ON "users"("username"); + +CREATE INDEX "chats_created_at_id_idx" ON "chats"("created_at", "id"); + +CREATE INDEX "chat_members_user_id_chat_id_idx" ON "chat_members"("user_id", "chat_id"); + +CREATE UNIQUE INDEX "chat_members_chat_id_position_key" ON "chat_members"("chat_id", "position"); + +CREATE INDEX "messages_chat_id_created_at_id_idx" ON "messages"("chat_id", "created_at", "id"); + +CREATE INDEX "messages_sender_id_idx" ON "messages"("sender_id"); + +ALTER TABLE "chat_members" ADD CONSTRAINT "chat_members_chat_id_fkey" FOREIGN KEY ("chat_id") REFERENCES "chats"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +ALTER TABLE "chat_members" ADD CONSTRAINT "chat_members_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +ALTER TABLE "messages" ADD CONSTRAINT "messages_chat_id_fkey" FOREIGN KEY ("chat_id") REFERENCES "chats"("id") ON DELETE CASCADE ON UPDATE CASCADE; + +ALTER TABLE "messages" ADD CONSTRAINT "messages_sender_id_fkey" FOREIGN KEY ("sender_id") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20261011160000_auth/migration.sql b/prisma/migrations/20261011160000_auth/migration.sql new file mode 100644 index 00000000..9e0c4a5e --- /dev/null +++ b/prisma/migrations/20261011160000_auth/migration.sql @@ -0,0 +1,20 @@ +ALTER TABLE "users" ADD COLUMN "password_hash" TEXT; + +CREATE TABLE "sessions" ( + "id" UUID NOT NULL, + "user_id" UUID NOT NULL, + "token_hash" CHAR(64) NOT NULL, + "created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "expires_at" TIMESTAMPTZ(3) NOT NULL, + "revoked_at" TIMESTAMPTZ(3), + + CONSTRAINT "sessions_pkey" PRIMARY KEY ("id") +); + +CREATE UNIQUE INDEX "sessions_token_hash_key" ON "sessions"("token_hash"); + +CREATE INDEX "sessions_user_id_idx" ON "sessions"("user_id"); + +CREATE INDEX "sessions_expires_at_idx" ON "sessions"("expires_at"); + +ALTER TABLE "sessions" ADD CONSTRAINT "sessions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20261013093000_cache_epochs/migration.sql b/prisma/migrations/20261013093000_cache_epochs/migration.sql new file mode 100644 index 00000000..0e42114c --- /dev/null +++ b/prisma/migrations/20261013093000_cache_epochs/migration.sql @@ -0,0 +1,2 @@ +ALTER TABLE "users" ADD COLUMN "chats_epoch" BIGINT NOT NULL DEFAULT 0; +ALTER TABLE "chats" ADD COLUMN "messages_epoch" BIGINT NOT NULL DEFAULT 0; diff --git a/prisma/migrations/20261013150000_message_epoch_buckets/migration.sql b/prisma/migrations/20261013150000_message_epoch_buckets/migration.sql new file mode 100644 index 00000000..b1c17169 --- /dev/null +++ b/prisma/migrations/20261013150000_message_epoch_buckets/migration.sql @@ -0,0 +1,13 @@ +CREATE TABLE "chat_message_epochs" ( + "chat_id" UUID NOT NULL, + "bucket" SMALLINT NOT NULL, + "epoch" BIGINT NOT NULL DEFAULT 0, + CONSTRAINT "chat_message_epochs_pkey" PRIMARY KEY ("chat_id", "bucket"), + CONSTRAINT "chat_message_epochs_bucket_check" CHECK ("bucket" BETWEEN 0 AND 15), + CONSTRAINT "chat_message_epochs_chat_id_fkey" FOREIGN KEY ("chat_id") REFERENCES "chats"("id") ON DELETE CASCADE ON UPDATE CASCADE +); + +INSERT INTO "chat_message_epochs" ("chat_id", "bucket", "epoch") +SELECT "id", 0, "messages_epoch" FROM "chats"; + +ALTER TABLE "chats" DROP COLUMN "messages_epoch"; diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml new file mode 100644 index 00000000..2fe25d87 --- /dev/null +++ b/prisma/migrations/migration_lock.toml @@ -0,0 +1 @@ +provider = "postgresql" diff --git a/prisma/schema.prisma b/prisma/schema.prisma new file mode 100644 index 00000000..259f97ec --- /dev/null +++ b/prisma/schema.prisma @@ -0,0 +1,86 @@ +generator client { + provider = "prisma-client" + output = "../src/generated/prisma" + moduleFormat = "cjs" +} + +datasource db { + provider = "postgresql" +} + +model User { + id String @id @default(uuid()) @db.Uuid + username String @unique @db.VarChar(32) + displayName String @map("display_name") @db.VarChar(100) + passwordHash String? @map("password_hash") + createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3) + chatsEpoch BigInt @default(0) @map("chats_epoch") + memberships ChatMember[] + messages Message[] + sessions Session[] + + @@map("users") +} + +model Session { + id String @id @default(uuid()) @db.Uuid + userId String @map("user_id") @db.Uuid + tokenHash String @unique @map("token_hash") @db.Char(64) + createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3) + expiresAt DateTime @map("expires_at") @db.Timestamptz(3) + revokedAt DateTime? @map("revoked_at") @db.Timestamptz(3) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + + @@index([userId]) + @@index([expiresAt]) + @@map("sessions") +} + +model Chat { + id String @id @default(uuid()) @db.Uuid + title String @db.VarChar(100) + createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3) + messageEpochs ChatMessageEpoch[] + members ChatMember[] + messages Message[] + + @@index([createdAt, id]) + @@map("chats") +} + +model ChatMember { + chatId String @map("chat_id") @db.Uuid + userId String @map("user_id") @db.Uuid + position Int + chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade) + user User @relation(fields: [userId], references: [id], onDelete: Restrict) + + @@id([chatId, userId]) + @@unique([chatId, position]) + @@index([userId, chatId]) + @@map("chat_members") +} + +model ChatMessageEpoch { + chatId String @map("chat_id") @db.Uuid + bucket Int @db.SmallInt + epoch BigInt @default(0) + chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade) + + @@id([chatId, bucket]) + @@map("chat_message_epochs") +} + +model Message { + id String @id @default(uuid()) @db.Uuid + chatId String @map("chat_id") @db.Uuid + senderId String @map("sender_id") @db.Uuid + text String @db.VarChar(4000) + createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3) + chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade) + sender User @relation(fields: [senderId], references: [id], onDelete: Restrict) + + @@index([chatId, createdAt, id]) + @@index([senderId]) + @@map("messages") +} diff --git a/scripts/restart.cmd b/scripts/restart.cmd new file mode 100644 index 00000000..1bc9b618 --- /dev/null +++ b/scripts/restart.cmd @@ -0,0 +1,10 @@ +@echo off +setlocal +if defined GIT_BASH goto run +set "GIT_BASH=%ProgramFiles%\Git\bin\bash.exe" +if exist "%GIT_BASH%" goto run +echo Git Bash was not found. Set GIT_BASH to the full path to bash.exe. 1>&2 +exit /b 2 +:run +"%GIT_BASH%" "%~dp0restart.sh" +exit /b %ERRORLEVEL% diff --git a/scripts/restart.sh b/scripts/restart.sh new file mode 100755 index 00000000..c706e4b7 --- /dev/null +++ b/scripts/restart.sh @@ -0,0 +1,16 @@ +#!/bin/sh +set -eu + +project_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) +cd "$project_dir" + +for service in backend postgres redis; do + if [ -z "$(docker compose ps --all --quiet "$service")" ]; then + printf '%s\n' "Missing container for $service; start the Compose stack first." >&2 + exit 1 + fi +done + +docker compose stop --timeout 10 backend postgres redis +docker compose up --detach --no-recreate --no-build --no-deps --wait --wait-timeout 45 postgres redis +docker compose up --detach --no-recreate --no-build --no-deps backend diff --git a/scripts/test-persistence.py b/scripts/test-persistence.py new file mode 100644 index 00000000..e55872fd --- /dev/null +++ b/scripts/test-persistence.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python3 +import argparse +import datetime as dt +import json +import os +from pathlib import Path +import subprocess +import sys +import time + +ROOT = Path(__file__).resolve().parents[1] +SERVICES = {'backend', 'postgres', 'redis'} + + +def snapshot(): + ids = subprocess.check_output( + ['docker', 'compose', 'ps', '--all', '--quiet', *sorted(SERVICES)], + cwd=ROOT, text=True, timeout=30, + ).split() + if len(ids) != len(SERVICES): + raise RuntimeError('Start backend, postgres and redis before this test') + template = ( + '{"service":{{json (index .Config.Labels "com.docker.compose.service")}},' + '"id":{{json .Id}},"started_at":{{json .State.StartedAt}},' + '"running":{{json .State.Running}},"mounts":{{json .Mounts}}}' + ) + output = subprocess.check_output( + ['docker', 'inspect', '--format', template, *ids], + cwd=ROOT, text=True, timeout=30, + ) + result = {} + for line in output.splitlines(): + entry = json.loads(line) + service = entry.pop('service') + entry['volumes'] = [ + {'name': mount['Name'], 'destination': mount['Destination']} + for mount in entry.pop('mounts') if mount['Type'] == 'volume' + ] + result[service] = entry + if set(result) != SERVICES or not all(v['running'] for v in result.values()): + raise RuntimeError('All three services must be running') + return result + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--base-url', default=os.getenv('BASE_URL', 'http://localhost:8080')) + parser.add_argument('--ca-file') + parser.add_argument('--scenario', choices=['public', 'full-restart'], default='public') + parser.add_argument('--output', type=Path, default=ROOT / 'evidence' / 'persistence.json') + args = parser.parse_args() + before = snapshot() + hook = ROOT / 'scripts' / ('restart.cmd' if os.name == 'nt' else 'restart.sh') + if args.scenario == 'public': + command = [sys.executable, '-X', 'utf8', str(ROOT / 'tests' / 'resilience.py'), '--mode', 'persistence'] + else: + command = [sys.executable, '-X', 'utf8', str(ROOT / 'test' / 'full-restart.py')] + command += ['--action-script', str(hook), '--base-url', args.base_url] + if args.ca_file: + command += ['--ca-file', args.ca_file] + started = time.monotonic() + proc = subprocess.run(command, cwd=ROOT, text=True, encoding='utf-8', capture_output=True) + print(proc.stdout, end='') + print(proc.stderr, end='', file=sys.stderr) + if proc.returncode: + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(json.dumps({ + 'recorded_at': dt.datetime.now(dt.timezone.utc).isoformat(), + 'scenario': args.scenario, + 'command': f'python scripts/test-persistence.py --scenario {args.scenario} --base-url {args.base_url}', + 'hook': hook.relative_to(ROOT).as_posix(), + 'result': 'FAIL', 'exit_code': proc.returncode, + 'test_output': proc.stdout.strip(), 'test_error': proc.stderr.strip(), + 'before': before, + }, ensure_ascii=False, indent=2) + '\n', encoding='utf-8') + return proc.returncode + after = snapshot() + for service in sorted(SERVICES): + old, new = before[service], after[service] + if old['id'] != new['id'] or old['started_at'] == new['started_at']: + raise RuntimeError(f'{service}: expected a restart of the same container') + if not old['volumes'] or old['volumes'] != new['volumes']: + raise RuntimeError(f'{service}: persistent volumes changed or are missing') + evidence = { + 'recorded_at': dt.datetime.now(dt.timezone.utc).isoformat(), + 'scenario': args.scenario, + 'command': f'python scripts/test-persistence.py --scenario {args.scenario} --base-url {args.base_url}', + 'hook': hook.relative_to(ROOT).as_posix(), + 'elapsed_seconds': round(time.monotonic() - started, 3), + 'result': 'PASS', 'test_output': proc.stdout.strip(), + 'before': before, 'after': after, + } + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(json.dumps(evidence, ensure_ascii=False, indent=2) + '\n', encoding='utf-8') + print('PASS: backend, postgres and redis restarted; named volumes preserved.') + print(f'Evidence: {args.output}') + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/src/Auth/auth.controller.ts b/src/Auth/auth.controller.ts new file mode 100644 index 00000000..03123c06 --- /dev/null +++ b/src/Auth/auth.controller.ts @@ -0,0 +1,69 @@ +import { + Body, + Controller, + Delete, + HttpCode, + HttpStatus, + Post, + Req, + UseGuards, +} from '@nestjs/common'; +import { + ApiBasicAuth, + ApiBearerAuth, + ApiCreatedResponse, + ApiNoContentResponse, + ApiOperation, + ApiTags, + ApiUnauthorizedResponse, +} from '@nestjs/swagger'; +import { UserGuard, type AuthenticatedRequest } from '../User/user.guard'; +import { AuthService } from './auth.service'; +import { Session } from './auth.schema'; + +@ApiTags('auth') +@Controller('api/v1/auth/sessions') +export class AuthController { + constructor(private readonly auth: AuthService) {} + + @Post() + @HttpCode(HttpStatus.CREATED) + @ApiBasicAuth('basicAuth') + @ApiOperation({ + operationId: 'createSession', + summary: 'Вход', + }) + @ApiCreatedResponse({ type: Session }) + @ApiUnauthorizedResponse({ + headers: { + 'WWW-Authenticate': { + schema: { type: 'string' }, + example: 'Basic realm="messenger", charset="UTF-8"', + }, + }, + }) + create(@Req() request: AuthenticatedRequest, @Body() body: unknown) { + return this.auth.login(request.headers.authorization, body); + } + + @Delete('current') + @HttpCode(HttpStatus.NO_CONTENT) + @UseGuards(UserGuard) + @ApiBearerAuth('bearerAuth') + @ApiOperation({ + operationId: 'revokeSession', + summary: 'Отзыв текущей сессии', + }) + @ApiNoContentResponse() + @ApiUnauthorizedResponse({ + headers: { + 'WWW-Authenticate': { + schema: { type: 'string' }, + example: 'Bearer realm="messenger"', + }, + }, + }) + logout(@Req() request: AuthenticatedRequest) { + return this.auth.logout(request.currentSessionId); + } +} diff --git a/src/Auth/auth.exception.ts b/src/Auth/auth.exception.ts new file mode 100644 index 00000000..e7cc4561 --- /dev/null +++ b/src/Auth/auth.exception.ts @@ -0,0 +1,18 @@ +import { HttpStatus } from '@nestjs/common'; +import { ApiException } from '../common/exceptions/api.exception'; + +export class AuthException extends ApiException { + readonly challenge: string; + + constructor(scheme: 'Basic' | 'Bearer') { + super( + HttpStatus.UNAUTHORIZED, + 'unauthorized', + 'Требуется действительная аутентификация', + ); + this.challenge = + scheme === 'Basic' + ? 'Basic realm="messenger", charset="UTF-8"' + : 'Bearer realm="messenger"'; + } +} diff --git a/src/Auth/auth.schema.ts b/src/Auth/auth.schema.ts new file mode 100644 index 00000000..394f637f --- /dev/null +++ b/src/Auth/auth.schema.ts @@ -0,0 +1,15 @@ +import { ApiProperty } from '@nestjs/swagger'; +import { User } from '../User/user.schema'; + +export class Session { + token!: string; + + @ApiProperty({ enum: ['Bearer'] }) + token_type!: 'Bearer'; + + @ApiProperty({ format: 'date-time' }) + expires_at!: string; + + @ApiProperty({ type: User }) + user!: User; +} diff --git a/src/Auth/auth.service.ts b/src/Auth/auth.service.ts new file mode 100644 index 00000000..2c9ae88f --- /dev/null +++ b/src/Auth/auth.service.ts @@ -0,0 +1,182 @@ +import { Injectable } from '@nestjs/common'; +import { createHash, randomBytes } from 'node:crypto'; +import { TextDecoder } from 'node:util'; +import { PrismaService } from '../prisma/prisma.service'; +import { Prisma } from '../generated/prisma/client'; +import { UserService } from '../User/user.service'; +import type { User } from '../User/user.schema'; +import { invalidRequest, uuid, uuidPattern } from '../common/validation'; +import { ApiException } from '../common/exceptions/api.exception'; +import { AuthException } from './auth.exception'; +import { PasswordService, validPassword } from './password.service'; +import type { Session } from './auth.schema'; + +export interface ChatAccess { + chatId: string; + userId: string; + messagesEpoch: string; +} + +@Injectable() +export class AuthService { + private readonly ttlSeconds: number; + + constructor( + private readonly prisma: PrismaService, + private readonly users: UserService, + private readonly passwords: PasswordService, + ) { + this.ttlSeconds = Number(process.env.SESSION_TTL_SECONDS ?? 3600); + if ( + !Number.isSafeInteger(this.ttlSeconds) || + this.ttlSeconds <= 0 || + Number.isNaN(new Date(Date.now() + this.ttlSeconds * 1000).getTime()) + ) { + throw new Error( + 'SESSION_TTL_SECONDS must be a positive integer representing a valid expiry', + ); + } + } + + async login(authorization: unknown, body: unknown): Promise { + const { username, password } = this.basicCredentials(authorization); + const user = await this.prisma.user.findUnique({ where: { username } }); + const verified = await this.passwords.verify( + password, + user?.passwordHash ?? null, + ); + if (!user || !verified) throw new AuthException('Basic'); + if (body !== undefined) + return invalidRequest('Вход через Basic не принимает тело запроса'); + const token = randomBytes(32).toString('base64url'); + const session = await this.prisma.session.create({ + data: { + userId: user.id, + tokenHash: this.tokenHash(token), + expiresAt: new Date(Date.now() + this.ttlSeconds * 1000), + }, + }); + return { + token, + token_type: 'Bearer', + expires_at: session.expiresAt.toISOString(), + user: this.users.serialize(user), + }; + } + + async authenticate( + authorization: unknown, + chatId?: unknown, + ): Promise<{ + user: User; + sessionId: string; + chatsEpoch: string; + chatAccess?: ChatAccess; + }> { + const match = + typeof authorization === 'string' && + /^Bearer +([A-Za-z0-9_-]{43})$/i.exec(authorization); + if (!match) throw new AuthException('Bearer'); + const requestedChat = + typeof chatId === 'string' && uuidPattern.test(chatId) + ? chatId.toLowerCase() + : null; + const [session] = await this.prisma.$queryRaw< + { + id: string; + userId: string; + username: string; + displayName: string; + createdAt: Date; + chatsEpoch: bigint; + chatId: string | null; + messagesEpoch: bigint | null; + }[] + >(Prisma.sql` + SELECT s.id, s.user_id AS "userId", u.chats_epoch AS "chatsEpoch", + u.username, u.display_name AS "displayName", u.created_at AS "createdAt", + ${ + chatId === undefined + ? Prisma.sql`NULL::uuid AS "chatId", NULL::bigint AS "messagesEpoch"` + : Prisma.sql`c.id AS "chatId", COALESCE((SELECT SUM(e.epoch) FROM "public"."chat_message_epochs" AS e WHERE e.chat_id = c.id), 0)::bigint AS "messagesEpoch"` + } + FROM sessions AS s + JOIN users AS u ON u.id = s.user_id + ${ + chatId === undefined + ? Prisma.empty + : Prisma.sql` + LEFT JOIN chat_members AS cm + ON cm.user_id = s.user_id AND cm.chat_id = ${requestedChat}::uuid + LEFT JOIN chats AS c ON c.id = cm.chat_id + ` + } + WHERE s.token_hash = ${this.tokenHash(match[1])} + AND s.revoked_at IS NULL AND s.expires_at > ${new Date()} + LIMIT 1 + `); + if (!session) throw new AuthException('Bearer'); + if (chatId !== undefined) { + uuid(chatId, 'chat_id'); + if (session.chatId === null || session.messagesEpoch === null) + throw new ApiException(404, 'not_found', 'Объект не найден'); + } + return { + user: this.users.serialize({ ...session, id: session.userId }), + sessionId: session.id, + chatsEpoch: session.chatsEpoch.toString(), + chatAccess: + session.chatId !== null && session.messagesEpoch !== null + ? { + chatId: session.chatId, + userId: session.userId, + messagesEpoch: session.messagesEpoch.toString(), + } + : undefined, + }; + } + + async logout(sessionId: string): Promise { + const now = new Date(); + const result = await this.prisma.session.updateMany({ + where: { id: sessionId, revokedAt: null, expiresAt: { gt: now } }, + data: { revokedAt: now }, + }); + if (result.count !== 1) throw new AuthException('Bearer'); + } + + private tokenHash(token: string): string { + return createHash('sha256').update(token).digest('hex'); + } + + private basicCredentials(authorization: unknown): { + username: string; + password: string; + } { + const match = + typeof authorization === 'string' && + /^Basic +([A-Za-z0-9+/]+={0,2})$/i.exec(authorization); + if (!match) throw new AuthException('Basic'); + try { + const bytes = Buffer.from(match[1], 'base64'); + if ( + bytes.toString('base64').replace(/=+$/, '') !== + match[1].replace(/=+$/, '') + ) + throw new AuthException('Basic'); + const value = new TextDecoder('utf-8', { fatal: true }).decode(bytes); + const colon = value.indexOf(':'); + const username = value.slice(0, colon); + const password = value.slice(colon + 1); + if ( + colon < 0 || + !/^[a-z0-9_]{3,32}$/.test(username) || + !validPassword(password) + ) + throw new AuthException('Basic'); + return { username, password }; + } catch { + throw new AuthException('Basic'); + } + } +} diff --git a/src/Auth/password.service.ts b/src/Auth/password.service.ts new file mode 100644 index 00000000..b1428fd6 --- /dev/null +++ b/src/Auth/password.service.ts @@ -0,0 +1,72 @@ +import { Injectable } from '@nestjs/common'; +import { argon2, randomBytes, timingSafeEqual } from 'node:crypto'; +import { invalidRequest } from '../common/validation'; + +const argonParameters = { + memory: 19456, + passes: 2, + parallelism: 1, + tagLength: 32, +}; +const argonPrefix = '$argon2id$v=19$m=19456,t=2,p=1'; + +function decodeBase64(value: string, length: number) { + const decoded = Buffer.from(value, 'base64'); + return decoded.length === length && + decoded.toString('base64').replace(/=+$/, '') === value + ? decoded + : undefined; +} + +function argonHash(value: string | null) { + const parts = value?.split('$'); + if (parts?.length !== 6 || parts.slice(0, 4).join('$') !== argonPrefix) + return undefined; + const salt = decodeBase64(parts[4], 16); + const key = decodeBase64(parts[5], 32); + return salt && key ? { salt, key } : undefined; +} + +export function validPassword(value: unknown): value is string { + if (typeof value !== 'string' || value.trim().length === 0) return false; + const length = Array.from(value).length; + return length >= 12 && length <= 128; +} + +export function registrationPassword(value: unknown): string { + if (!validPassword(value)) + return invalidRequest('Пароль должен содержать 12–128 Unicode-символов'); + return value; +} + +@Injectable() +export class PasswordService { + async hash(password: string): Promise { + const salt = randomBytes(16); + const key = await this.deriveArgon(password, salt); + return `${argonPrefix}$${salt.toString('base64').replace(/=+$/, '')}$${key.toString('base64').replace(/=+$/, '')}`; + } + + async verify(password: string, storedHash: string | null): Promise { + const stored = argonHash(storedHash); + const key = await this.deriveArgon( + password, + stored?.salt ?? Buffer.alloc(16), + ); + const matches = timingSafeEqual(key, stored?.key ?? Buffer.alloc(32)); + return Boolean(stored && matches); + } + + private deriveArgon(password: string, salt: Buffer): Promise { + return new Promise((resolve, reject) => { + argon2( + 'argon2id', + { ...argonParameters, message: password, nonce: salt }, + (error, key) => { + if (error) reject(error); + else resolve(key); + }, + ); + }); + } +} diff --git a/src/Chat/chat.controller.ts b/src/Chat/chat.controller.ts new file mode 100644 index 00000000..404ff7d9 --- /dev/null +++ b/src/Chat/chat.controller.ts @@ -0,0 +1,114 @@ +import { + Body, + Controller, + Get, + HttpCode, + HttpStatus, + Param, + Post, + Query, + Req, + UseGuards, +} from '@nestjs/common'; +import { + ApiBody, + ApiBearerAuth, + ApiCreatedResponse, + ApiOkResponse, + ApiOperation, + ApiQuery, + ApiTags, +} from '@nestjs/swagger'; +import { UserGuard, type AuthenticatedRequest } from '../User/user.guard'; +import { + CreateChatDto, + CreateMessageDto, + Chat, + Message, + ChatPage, + MessagePage, +} from './chat.schema'; +import { ChatService } from './chat.service'; + +@ApiTags('chats') +@ApiBearerAuth('bearerAuth') +@UseGuards(UserGuard) +@Controller('api/v1/chats') +export class ChatController { + constructor(private readonly chats: ChatService) {} + + @Post() + @HttpCode(HttpStatus.CREATED) + @ApiBody({ type: CreateChatDto }) + @ApiOperation({ operationId: 'createChat' }) + @ApiCreatedResponse({ type: Chat }) + create(@Req() request: AuthenticatedRequest, @Body() body: unknown) { + return this.chats.create(body, request.currentUser.id); + } + + @Get() + @ApiOperation({ operationId: 'listChats' }) + @ApiOkResponse({ type: ChatPage }) + @ApiQuery({ + name: 'limit', + required: false, + schema: { type: 'integer', minimum: 1, maximum: 100, default: 50 }, + }) + @ApiQuery({ name: 'cursor', required: false, type: String }) + list( + @Req() request: AuthenticatedRequest, + @Query('limit') limit: unknown, + @Query('cursor') cursor: unknown, + ) { + return this.chats.list( + request.currentUser.id, + limit, + cursor, + request.currentChatsEpoch, + ); + } + + @Get(':chat_id') + @ApiOperation({ operationId: 'getChat' }) + @ApiOkResponse({ type: Chat }) + get(@Req() request: AuthenticatedRequest, @Param('chat_id') chatId: string) { + return this.chats.get(chatId, request.currentUser.id); + } + + @Post(':chat_id/messages') + @HttpCode(HttpStatus.CREATED) + @ApiBody({ type: CreateMessageDto }) + @ApiOperation({ operationId: 'createMessage' }) + @ApiCreatedResponse({ type: Message }) + createMessage( + @Req() request: AuthenticatedRequest, + @Param('chat_id') chatId: string, + @Body() body: unknown, + ) { + return this.chats.createMessage(chatId, body, request.currentUser.id); + } + + @Get(':chat_id/messages') + @ApiOperation({ operationId: 'listMessages' }) + @ApiOkResponse({ type: MessagePage }) + @ApiQuery({ + name: 'limit', + required: false, + schema: { type: 'integer', minimum: 1, maximum: 100, default: 50 }, + }) + @ApiQuery({ name: 'cursor', required: false, type: String }) + listMessages( + @Req() request: AuthenticatedRequest, + @Param('chat_id') chatId: string, + @Query('limit') limit: unknown, + @Query('cursor') cursor: unknown, + ) { + return this.chats.listMessages( + chatId, + request.currentUser.id, + limit, + cursor, + request.currentChatAccess, + ); + } +} diff --git a/src/Chat/chat.module.ts b/src/Chat/chat.module.ts new file mode 100644 index 00000000..ff1053ba --- /dev/null +++ b/src/Chat/chat.module.ts @@ -0,0 +1,11 @@ +import { Module } from '@nestjs/common'; +import { UserModule } from '../User/user.module'; +import { ChatController } from './chat.controller'; +import { ChatService } from './chat.service'; + +@Module({ + imports: [UserModule], + controllers: [ChatController], + providers: [ChatService], +}) +export class ChatModule {} diff --git a/src/Chat/chat.schema.ts b/src/Chat/chat.schema.ts new file mode 100644 index 00000000..de1eea53 --- /dev/null +++ b/src/Chat/chat.schema.ts @@ -0,0 +1,57 @@ +import { ApiProperty } from '@nestjs/swagger'; + +export class CreateChatDto { + @ApiProperty({ example: 'Проект по ВНП', maxLength: 100 }) + title!: string; + + @ApiProperty({ type: [String], format: 'uuid' }) + member_ids!: string[]; +} + +export class CreateMessageDto { + @ApiProperty({ example: 'Привет, Боб!', maxLength: 4000 }) + text!: string; +} + +export class Chat { + @ApiProperty({ format: 'uuid' }) + id!: string; + @ApiProperty({ maxLength: 100 }) + title!: string; + @ApiProperty({ type: [String], format: 'uuid' }) + member_ids!: string[]; + @ApiProperty({ format: 'date-time' }) + created_at!: string; +} + +export class Message { + @ApiProperty({ format: 'uuid' }) + id!: string; + @ApiProperty({ format: 'uuid' }) + chat_id!: string; + @ApiProperty({ format: 'uuid' }) + sender_id!: string; + @ApiProperty({ maxLength: 4000 }) + text!: string; + @ApiProperty({ format: 'date-time' }) + created_at!: string; +} + +export class ChatPage { + @ApiProperty({ type: [Chat] }) + items!: Chat[]; + @ApiProperty({ type: String, nullable: true }) + next_cursor!: string | null; +} + +export class MessagePage { + @ApiProperty({ type: [Message] }) + items!: Message[]; + @ApiProperty({ type: String, nullable: true }) + next_cursor!: string | null; +} + +export interface Page { + items: T[]; + next_cursor: string | null; +} diff --git a/src/Chat/chat.service.ts b/src/Chat/chat.service.ts new file mode 100644 index 00000000..4e4a4390 --- /dev/null +++ b/src/Chat/chat.service.ts @@ -0,0 +1,335 @@ +import { HttpStatus, Injectable } from '@nestjs/common'; +import { randomUUID } from 'node:crypto'; +import type { ChatAccess } from '../Auth/auth.service'; +import { + Prisma, + type Message as StoredMessage, +} from '../generated/prisma/client'; +import { PrismaService } from '../prisma/prisma.service'; +import { ApiException } from '../common/exceptions/api.exception'; +import { + invalidRequest, + objectBody, + pageLimit, + requiredText, + uuid, +} from '../common/validation'; +import type { Chat, Message, Page } from './chat.schema'; +import { CacheService, CACHE_TTL } from '../cache/cache.service'; + +interface Cursor { + scope: string; + created_at: string; + id: string; +} + +const chatInclude = { + members: { orderBy: { position: 'asc' as const } }, +} satisfies Prisma.ChatInclude; +type StoredChat = Prisma.ChatGetPayload<{ include: typeof chatInclude }>; + +@Injectable() +export class ChatService { + constructor( + private readonly prisma: PrismaService, + private readonly cache: CacheService, + ) {} + + async create(value: unknown, userId: string): Promise { + const body = objectBody(value, ['title', 'member_ids']); + const title = requiredText(body.title, 'title', 100); + if ( + !Array.isArray(body.member_ids) || + body.member_ids.length < 1 || + body.member_ids.length > 100 + ) { + return invalidRequest('Некорректный member_ids'); + } + const memberIds = body.member_ids.map((id: unknown) => + uuid(id, 'member_ids'), + ); + if ( + new Set(memberIds).size !== memberIds.length || + !memberIds.includes(userId) + ) { + return invalidRequest( + 'Список участников содержит дубликат или не содержит вызывающего', + ); + } + try { + const chat = await this.prisma.$transaction(async (tx) => { + const count = await tx.user.count({ where: { id: { in: memberIds } } }); + if (count !== memberIds.length) + return invalidRequest('Неизвестный участник чата'); + const created = await tx.chat.create({ + data: { + title, + members: { + create: memberIds.map((userId, position) => ({ + userId, + position, + })), + }, + }, + include: chatInclude, + }); + await tx.$executeRaw(Prisma.sql` + WITH locked AS MATERIALIZED ( + SELECT id FROM users + WHERE id IN (${Prisma.join(memberIds.map((id) => Prisma.sql`${id}::uuid`))}) + ORDER BY id FOR UPDATE + ) + UPDATE users AS u SET chats_epoch = u.chats_epoch + 1 + FROM locked WHERE u.id = locked.id + `); + return created; + }); + return this.serializeChat(chat); + } catch (error) { + if ( + error instanceof Prisma.PrismaClientKnownRequestError && + error.code === 'P2003' + ) { + return invalidRequest('Неизвестный участник чата'); + } + throw error; + } + } + + async list( + userId: string, + limitValue: unknown, + cursorValue: unknown, + epoch: string, + ): Promise> { + const limit = pageLimit(limitValue); + const scope = `chats:${userId}`; + const cursor = this.decodeCursor(cursorValue, scope); + return this.cache.remember( + scope, + { limit, cursor }, + CACHE_TTL.page, + async () => { + const chats = await this.prisma.chat.findMany({ + where: { members: { some: { userId } }, ...this.after(cursor) }, + include: chatInclude, + orderBy: [{ createdAt: 'asc' }, { id: 'asc' }], + take: limit + 1, + }); + return this.page( + chats.map((chat) => this.serializeChat(chat)), + limit, + scope, + ); + }, + epoch, + ); + } + + async get(value: unknown, userId: string): Promise { + const { id } = await this.authorizeChat(value, userId); + return this.getMetadata(id); + } + + private async authorizeChat(value: unknown, userId: string) { + const id = uuid(value, 'chat_id'); + const [membership] = await this.prisma.$queryRaw< + { id: string; messagesEpoch: bigint }[] + >(Prisma.sql` + SELECT c.id, COALESCE((SELECT SUM(e.epoch) FROM "public"."chat_message_epochs" AS e WHERE e.chat_id = c.id), 0)::bigint AS "messagesEpoch" + FROM chat_members AS cm JOIN chats AS c ON c.id = cm.chat_id + WHERE cm.chat_id = ${id}::uuid AND cm.user_id = ${userId}::uuid + `); + if (!membership) { + throw new ApiException( + HttpStatus.NOT_FOUND, + 'not_found', + 'Объект не найден', + ); + } + return membership; + } + + private getMetadata(id: string): Promise { + return this.cache.remember( + `chat:${id}`, + 'metadata', + CACHE_TTL.entity, + async () => { + const chat = await this.prisma.chat.findUnique({ + where: { id }, + include: chatInclude, + }); + if (!chat) + throw new ApiException( + HttpStatus.NOT_FOUND, + 'not_found', + 'Объект не найден', + ); + return this.serializeChat(chat); + }, + ); + } + + async createMessage( + chatId: unknown, + value: unknown, + userId: string, + ): Promise { + const id = uuid(chatId, 'chat_id'); + const body = objectBody(value, ['text']); + const text = requiredText(body.text, 'text', 4000); + const messageId = randomUUID(); + const bucket = parseInt(messageId.slice(0, 2), 16) % 16; + const [message] = await this.prisma.$queryRaw(Prisma.sql` + WITH updated AS ( + INSERT INTO "public"."chat_message_epochs" AS e (chat_id, bucket, epoch) + SELECT cm.chat_id, ${bucket}::smallint, 1 FROM chat_members AS cm + WHERE cm.chat_id = ${id}::uuid AND cm.user_id = ${userId}::uuid + ON CONFLICT (chat_id, bucket) DO UPDATE SET epoch = e.epoch + 1 + RETURNING chat_id + ) + INSERT INTO messages (id, chat_id, sender_id, text) + SELECT ${messageId}::uuid, updated.chat_id, ${userId}::uuid, ${text} FROM updated + RETURNING id, chat_id AS "chatId", sender_id AS "senderId", text, created_at AS "createdAt" + `); + if (!message) + throw new ApiException( + HttpStatus.NOT_FOUND, + 'not_found', + 'Объект не найден', + ); + return this.serializeMessage(message); + } + + async listMessages( + chatId: unknown, + userId: string, + limitValue: unknown, + cursorValue: unknown, + access?: ChatAccess, + ): Promise> { + const id = uuid(chatId, 'chat_id'); + const chat = + access?.chatId === id && access.userId === userId + ? { id, messagesEpoch: access.messagesEpoch } + : await this.authorizeChat(id, userId); + const limit = pageLimit(limitValue); + const scope = `messages:${chat.id}`; + const cursor = this.decodeCursor(cursorValue, scope); + return this.cache.remember( + scope, + { limit, cursor }, + CACHE_TTL.page, + async () => { + const messages = cursor + ? await this.prisma.$queryRaw(Prisma.sql` + SELECT id, chat_id AS "chatId", sender_id AS "senderId", + text, created_at AS "createdAt" + FROM "public"."messages" + WHERE chat_id = ${chat.id}::uuid + AND (created_at, id) > + (${new Date(cursor.created_at)}::timestamptz, ${cursor.id}::uuid) + ORDER BY created_at ASC, id ASC + LIMIT ${limit + 1} + `) + : await this.prisma.message.findMany({ + where: { chatId: chat.id }, + orderBy: [{ createdAt: 'asc' }, { id: 'asc' }], + take: limit + 1, + }); + return this.page( + messages.map((message) => this.serializeMessage(message)), + limit, + scope, + ); + }, + chat.messagesEpoch.toString(), + ); + } + + private after(cursor: Cursor | null) { + if (!cursor) return {}; + const createdAt = new Date(cursor.created_at); + return { + OR: [ + { createdAt: { gt: createdAt } }, + { createdAt, id: { gt: cursor.id } }, + ], + }; + } + + private serializeChat(chat: StoredChat): Chat { + return { + id: chat.id, + title: chat.title, + member_ids: chat.members.map((member) => member.userId), + created_at: chat.createdAt.toISOString(), + }; + } + + private serializeMessage(message: StoredMessage): Message { + return { + id: message.id, + chat_id: message.chatId, + sender_id: message.senderId, + text: message.text, + created_at: message.createdAt.toISOString(), + }; + } + + private page( + items: T[], + limit: number, + scope: string, + ): Page { + const result = items.slice(0, limit); + const last = result.at(-1); + return { + items: result, + next_cursor: + items.length > limit && last + ? Buffer.from( + JSON.stringify({ + scope, + created_at: last.created_at, + id: last.id, + }), + ).toString('base64url') + : null, + }; + } + + private decodeCursor(value: unknown, scope: string): Cursor | null { + if (value === undefined) return null; + if (typeof value !== 'string' || !/^[A-Za-z0-9_-]+$/.test(value)) + return invalidRequest('Некорректный cursor'); + try { + const cursor: unknown = JSON.parse( + Buffer.from(value, 'base64url').toString('utf8'), + ); + if ( + typeof cursor !== 'object' || + cursor === null || + Array.isArray(cursor) + ) + return invalidRequest('Некорректный cursor'); + const data = cursor as Record; + if ( + data.scope !== scope || + typeof data.created_at !== 'string' || + Number.isNaN(Date.parse(data.created_at)) || + typeof data.id !== 'string' + ) { + return invalidRequest('Некорректный cursor'); + } + return { + scope, + created_at: data.created_at, + id: uuid(data.id, 'cursor'), + }; + } catch { + return invalidRequest('Некорректный cursor'); + } + } +} diff --git a/src/User/user.controller.ts b/src/User/user.controller.ts new file mode 100644 index 00000000..1a34887f --- /dev/null +++ b/src/User/user.controller.ts @@ -0,0 +1,45 @@ +import { + Body, + Controller, + Get, + HttpCode, + HttpStatus, + Post, + Req, + UseGuards, +} from '@nestjs/common'; +import { + ApiBody, + ApiBearerAuth, + ApiCreatedResponse, + ApiOkResponse, + ApiOperation, + ApiTags, +} from '@nestjs/swagger'; +import { UserGuard, type AuthenticatedRequest } from './user.guard'; +import { CreateUserDto, User } from './user.schema'; +import { UserService } from './user.service'; + +@ApiTags('users') +@Controller('api/v1/users') +export class UserController { + constructor(private readonly users: UserService) {} + + @Post() + @HttpCode(HttpStatus.CREATED) + @ApiBody({ type: CreateUserDto }) + @ApiOperation({ operationId: 'registerUser' }) + @ApiCreatedResponse({ type: User }) + create(@Body() body: unknown) { + return this.users.create(body); + } + + @Get('me') + @UseGuards(UserGuard) + @ApiBearerAuth('bearerAuth') + @ApiOperation({ operationId: 'currentUser' }) + @ApiOkResponse({ type: User }) + me(@Req() request: AuthenticatedRequest) { + return request.currentUser; + } +} diff --git a/src/User/user.guard.ts b/src/User/user.guard.ts new file mode 100644 index 00000000..108fca4b --- /dev/null +++ b/src/User/user.guard.ts @@ -0,0 +1,34 @@ +import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'; +import type { FastifyRequest } from 'fastify'; +import { AuthService, type ChatAccess } from '../Auth/auth.service'; +import type { User } from './user.schema'; + +export type AuthenticatedRequest = FastifyRequest & { + currentUser: User; + currentSessionId: string; + currentChatsEpoch: string; + currentChatAccess?: ChatAccess; +}; + +@Injectable() +export class UserGuard implements CanActivate { + constructor(private readonly auth: AuthService) {} + + async canActivate(context: ExecutionContext): Promise { + const request = context.switchToHttp().getRequest(); + const chatId = + request.method === 'GET' && + request.routeOptions.url === '/api/v1/chats/:chat_id/messages' + ? (request.params as { chat_id: string }).chat_id + : undefined; + const session = await this.auth.authenticate( + request.headers.authorization, + chatId, + ); + request.currentUser = session.user; + request.currentSessionId = session.sessionId; + request.currentChatsEpoch = session.chatsEpoch; + request.currentChatAccess = session.chatAccess; + return true; + } +} diff --git a/src/User/user.module.ts b/src/User/user.module.ts new file mode 100644 index 00000000..f90c564f --- /dev/null +++ b/src/User/user.module.ts @@ -0,0 +1,14 @@ +import { Module } from '@nestjs/common'; +import { UserController } from './user.controller'; +import { UserGuard } from './user.guard'; +import { UserService } from './user.service'; +import { AuthController } from '../Auth/auth.controller'; +import { AuthService } from '../Auth/auth.service'; +import { PasswordService } from '../Auth/password.service'; + +@Module({ + controllers: [UserController, AuthController], + providers: [UserService, UserGuard, AuthService, PasswordService], + exports: [UserService, UserGuard, AuthService], +}) +export class UserModule {} diff --git a/src/User/user.schema.ts b/src/User/user.schema.ts new file mode 100644 index 00000000..7974ebba --- /dev/null +++ b/src/User/user.schema.ts @@ -0,0 +1,28 @@ +import { ApiProperty } from '@nestjs/swagger'; + +export class CreateUserDto { + @ApiProperty({ example: 'alice', pattern: '^[a-z0-9_]{3,32}$' }) + username!: string; + + @ApiProperty({ example: 'Алиса', maxLength: 100 }) + display_name!: string; + + @ApiProperty({ + writeOnly: true, + minLength: 12, + maxLength: 128, + example: 'Example-only-not-a-real-secret-123', + }) + password!: string; +} + +export class User { + @ApiProperty({ format: 'uuid' }) + id!: string; + @ApiProperty({ pattern: '^[a-z0-9_]{3,32}$' }) + username!: string; + @ApiProperty({ minLength: 1, maxLength: 100 }) + display_name!: string; + @ApiProperty({ format: 'date-time' }) + created_at!: string; +} diff --git a/src/User/user.service.ts b/src/User/user.service.ts new file mode 100644 index 00000000..bec2bb86 --- /dev/null +++ b/src/User/user.service.ts @@ -0,0 +1,77 @@ +import { HttpStatus, Injectable } from '@nestjs/common'; +import { Prisma, type User as StoredUser } from '../generated/prisma/client'; +import { PrismaService } from '../prisma/prisma.service'; +import { ApiException } from '../common/exceptions/api.exception'; +import { objectBody, requiredText } from '../common/validation'; +import { + PasswordService, + registrationPassword, +} from '../Auth/password.service'; +import type { User } from './user.schema'; +import { CacheService, CACHE_TTL } from '../cache/cache.service'; + +@Injectable() +export class UserService { + constructor( + private readonly prisma: PrismaService, + private readonly passwords: PasswordService, + private readonly cache: CacheService, + ) {} + + async create(value: unknown): Promise { + const body = objectBody(value, ['username', 'display_name', 'password']); + const username = body.username; + if (typeof username !== 'string' || !/^[a-z0-9_]{3,32}$/.test(username)) { + throw new ApiException( + HttpStatus.BAD_REQUEST, + 'invalid_request', + 'Некорректный username', + ); + } + const displayName = requiredText(body.display_name, 'display_name', 100); + const password = registrationPassword(body.password); + const passwordHash = await this.passwords.hash(password); + try { + return this.serialize( + await this.prisma.user.create({ + data: { username, displayName, passwordHash }, + }), + ); + } catch (error) { + if ( + error instanceof Prisma.PrismaClientKnownRequestError && + error.code === 'P2002' + ) { + throw new ApiException( + HttpStatus.CONFLICT, + 'conflict', + 'Username уже занят', + ); + } + throw error; + } + } + + async get(id: string): Promise { + return this.cache.remember( + `user:${id}`, + 'profile', + CACHE_TTL.entity, + async () => { + const user = await this.prisma.user.findUnique({ where: { id } }); + return user ? this.serialize(user) : undefined; + }, + ); + } + + serialize( + user: Pick, + ): User { + return { + id: user.id, + username: user.username, + display_name: user.displayName, + created_at: user.createdAt.toISOString(), + }; + } +} diff --git a/src/app.controller.spec.ts b/src/app.controller.spec.ts new file mode 100644 index 00000000..7925cb42 --- /dev/null +++ b/src/app.controller.spec.ts @@ -0,0 +1,38 @@ +import { Test, TestingModule } from '@nestjs/testing'; +import { AppController } from './app.controller'; +import { AppService } from './app.service'; +import { PrismaService } from './prisma/prisma.service'; + +describe('AppController', () => { + let appController: AppController; + const queryRaw = jest.fn(); + + beforeEach(async () => { + queryRaw.mockReset(); + const app: TestingModule = await Test.createTestingModule({ + controllers: [AppController], + providers: [ + AppService, + { provide: PrismaService, useValue: { $queryRaw: queryRaw } }, + ], + }).compile(); + + appController = app.get(AppController); + }); + + describe('root', () => { + it('should return "Hello World!"', () => { + expect(appController.getHello()).toBe('Hello World!'); + }); + }); + + it('reports ready when PostgreSQL is reachable', async () => { + queryRaw.mockResolvedValue([{ '?column?': 1 }]); + await expect(appController.ready()).resolves.toEqual({ status: 'ok' }); + }); + + it('returns 503 when PostgreSQL is unavailable', async () => { + queryRaw.mockRejectedValue(new Error('connection refused')); + await expect(appController.ready()).rejects.toMatchObject({ status: 503 }); + }); +}); diff --git a/src/app.controller.ts b/src/app.controller.ts new file mode 100644 index 00000000..8f330cc6 --- /dev/null +++ b/src/app.controller.ts @@ -0,0 +1,36 @@ +import { Controller, Get, HttpStatus } from '@nestjs/common'; +import { AppService } from './app.service'; +import { PrismaService } from './prisma/prisma.service'; +import { ApiException } from './common/exceptions/api.exception'; + +@Controller() +export class AppController { + constructor( + private readonly appService: AppService, + private readonly prisma: PrismaService, + ) {} + + @Get() + getHello(): string { + return this.appService.getHello(); + } + + @Get('health/live') + live() { + return { status: 'ok' }; + } + + @Get('health/ready') + async ready() { + try { + await this.prisma.$queryRaw`SELECT 1`; + } catch { + throw new ApiException( + HttpStatus.SERVICE_UNAVAILABLE, + 'unavailable', + 'База данных недоступна', + ); + } + return { status: 'ok' }; + } +} diff --git a/src/app.module.ts b/src/app.module.ts new file mode 100644 index 00000000..12a6825e --- /dev/null +++ b/src/app.module.ts @@ -0,0 +1,58 @@ +import { Module } from '@nestjs/common'; +import { APP_FILTER } from '@nestjs/core'; +import { LoggerModule } from 'nestjs-pino'; +import { AppController } from './app.controller'; +import { AppService } from './app.service'; +import { AllExceptionsFilter } from './common/filters/all-exceptions.filter'; +import { UserModule } from './User/user.module'; +import { ChatModule } from './Chat/chat.module'; +import { PrismaModule } from './prisma/prisma.module'; +import { CacheModule } from './cache/cache.module'; + +@Module({ + imports: [ + PrismaModule, + CacheModule, + UserModule, + ChatModule, + LoggerModule.forRoot({ + pinoHttp: { + level: process.env.NODE_ENV === 'production' ? 'info' : 'debug', + + transport: + process.env.NODE_ENV !== 'production' + ? { + target: 'pino-pretty', + options: { + colorize: true, + singleLine: true, + translateTime: 'SYS:standard', + }, + } + : undefined, + + redact: { + paths: [ + 'req.headers.authorization', + 'req.headers.cookie', + 'res.headers.set-cookie', + ], + censor: '[REDACTED]', + }, + + autoLogging: { + ignore: (request) => request.url === '/health', + }, + }, + }), + ], + controllers: [AppController], + providers: [ + AppService, + { + provide: APP_FILTER, + useClass: AllExceptionsFilter, + }, + ], +}) +export class AppModule {} diff --git a/src/app.service.ts b/src/app.service.ts new file mode 100644 index 00000000..927d7cca --- /dev/null +++ b/src/app.service.ts @@ -0,0 +1,8 @@ +import { Injectable } from '@nestjs/common'; + +@Injectable() +export class AppService { + getHello(): string { + return 'Hello World!'; + } +} diff --git a/src/cache/cache.module.ts b/src/cache/cache.module.ts new file mode 100644 index 00000000..2d194dd8 --- /dev/null +++ b/src/cache/cache.module.ts @@ -0,0 +1,6 @@ +import { Global, Module } from '@nestjs/common'; +import { CacheService } from './cache.service'; + +@Global() +@Module({ providers: [CacheService], exports: [CacheService] }) +export class CacheModule {} diff --git a/src/cache/cache.service.ts b/src/cache/cache.service.ts new file mode 100644 index 00000000..816debf7 --- /dev/null +++ b/src/cache/cache.service.ts @@ -0,0 +1,149 @@ +import { + Injectable, + Logger, + type OnModuleDestroy, + type OnModuleInit, +} from '@nestjs/common'; +import { createHash, randomUUID } from 'node:crypto'; +import Redis from 'ioredis'; + +export const CACHE_TTL = { entity: 300, page: 30 } as const; +const generationTtl = 600; +const storeIfCurrent = ` +if redis.call('GET', KEYS[1]) == ARGV[1] then + return redis.call('SET', KEYS[2], ARGV[2], 'EX', ARGV[3]) +end +return false`; + +@Injectable() +export class CacheService implements OnModuleInit, OnModuleDestroy { + private readonly logger = new Logger(CacheService.name); + private readonly redis?: Redis; + private readonly prefix = process.env.CACHE_PREFIX ?? 'messenger:cache:v1'; + private warned = false; + + constructor() { + if (process.env.CACHE_URL) { + this.redis = new Redis(process.env.CACHE_URL, { + lazyConnect: true, + connectTimeout: 1000, + commandTimeout: 300, + maxRetriesPerRequest: 0, + enableOfflineQueue: false, + autoResendUnfulfilledCommands: false, + retryStrategy: () => 1000, + }); + this.redis.on('error', () => this.unavailable()); + this.redis.on('ready', () => { + this.warned = false; + }); + } + } + + async onModuleInit(): Promise { + try { + await this.redis?.connect(); + } catch { + this.unavailable(); + } + } + + onModuleDestroy(): void { + this.redis?.disconnect(); + } + + async remember( + namespace: string, + parameters: unknown, + ttl: number, + load: () => Promise, + epoch?: string, + ): Promise { + if (!this.redis || this.redis.status !== 'ready') return load(); + if (epoch !== undefined) { + const digest = createHash('sha256') + .update(JSON.stringify(parameters)) + .digest('hex'); + const key = `${this.prefix}:${namespace}:epoch:${epoch}:${digest}`; + try { + const value = await this.redis.get(key); + if (value !== null) return JSON.parse(value) as T; + } catch { + this.unavailable(); + } + const result = await load(); + const serialized = JSON.stringify(result); + if (serialized !== undefined && this.redis.status === 'ready') { + try { + await this.redis.set(key, serialized, 'EX', ttl); + } catch { + this.unavailable(); + } + } + return result; + } + const versionKey = `${this.prefix}:${namespace}:generation`; + let version: string | null = null; + let dataKey = ''; + try { + await this.redis.set(versionKey, randomUUID(), 'EX', generationTtl, 'NX'); + version = await this.redis.get(versionKey); + if (version) { + const digest = createHash('sha256') + .update(JSON.stringify(parameters)) + .digest('hex'); + dataKey = `${this.prefix}:${namespace}:${version}:${digest}`; + const value = await this.redis.get(dataKey); + if (value !== null) return JSON.parse(value) as T; + } + } catch { + this.unavailable(); + } + + const result = await load(); + const serialized = JSON.stringify(result); + if (version && serialized !== undefined && this.redis.status === 'ready') { + try { + await this.redis.eval( + storeIfCurrent, + 2, + versionKey, + dataKey, + version, + serialized, + ttl, + ); + } catch { + this.unavailable(); + } + } + return result; + } + + async invalidate(...namespaces: string[]): Promise { + if (!this.redis || this.redis.status !== 'ready' || namespaces.length === 0) + return; + try { + const transaction = this.redis.multi(); + for (const namespace of new Set(namespaces)) { + transaction.set( + `${this.prefix}:${namespace}:generation`, + randomUUID(), + 'EX', + generationTtl, + ); + } + const results = await transaction.exec(); + if (results?.some(([error]) => error !== null)) this.unavailable(); + } catch { + this.unavailable(); + } + } + + private unavailable(): void { + if (!this.warned) { + this.logger.warn('Redis cache unavailable'); + this.warned = true; + } + } +} diff --git a/src/common/exceptions/api.exception.ts b/src/common/exceptions/api.exception.ts new file mode 100644 index 00000000..067e5cee --- /dev/null +++ b/src/common/exceptions/api.exception.ts @@ -0,0 +1,16 @@ +import { + HttpException, + HttpExceptionOptions, + HttpStatus, +} from '@nestjs/common'; + +export class ApiException extends HttpException { + constructor( + status: HttpStatus, + code: string, + message: string, + options?: HttpExceptionOptions, + ) { + super({ code, message }, status, options); + } +} diff --git a/src/common/filters/all-exceptions.filter.ts b/src/common/filters/all-exceptions.filter.ts new file mode 100644 index 00000000..a25ee70c --- /dev/null +++ b/src/common/filters/all-exceptions.filter.ts @@ -0,0 +1,177 @@ +import { + ArgumentsHost, + Catch, + ExceptionFilter, + HttpException, + HttpStatus, +} from '@nestjs/common'; +import type { FastifyReply, FastifyRequest } from 'fastify'; +import { Prisma } from '../../generated/prisma/client'; +import { ApiException } from '../exceptions/api.exception'; +import { AuthException } from '../../Auth/auth.exception'; + +interface ExceptionPayload { + code?: unknown; +} + +const defaultCodes: Partial> = { + [HttpStatus.BAD_REQUEST]: 'invalid_request', + [HttpStatus.UNAUTHORIZED]: 'unauthorized', + [HttpStatus.FORBIDDEN]: 'forbidden', + [HttpStatus.NOT_FOUND]: 'not_found', + [HttpStatus.CONFLICT]: 'conflict', + [HttpStatus.PAYLOAD_TOO_LARGE]: 'payload_too_large', + [HttpStatus.UNSUPPORTED_MEDIA_TYPE]: 'unsupported_media_type', + [HttpStatus.TOO_MANY_REQUESTS]: 'rate_limited', + [HttpStatus.SERVICE_UNAVAILABLE]: 'unavailable', +}; + +const defaultMessages: Partial> = { + [HttpStatus.BAD_REQUEST]: 'Некорректный запрос', + [HttpStatus.UNAUTHORIZED]: 'Требуется авторизация', + [HttpStatus.FORBIDDEN]: 'Доступ запрещён', + [HttpStatus.NOT_FOUND]: 'Ресурс не найден', + [HttpStatus.METHOD_NOT_ALLOWED]: 'Метод не поддерживается', + [HttpStatus.CONFLICT]: 'Конфликт данных', + [HttpStatus.PAYLOAD_TOO_LARGE]: 'Тело запроса слишком большое', + [HttpStatus.UNSUPPORTED_MEDIA_TYPE]: 'Неподдерживаемый формат данных', + [HttpStatus.TOO_MANY_REQUESTS]: 'Слишком много запросов', + [HttpStatus.INTERNAL_SERVER_ERROR]: 'Внутренняя ошибка сервера', + [HttpStatus.SERVICE_UNAVAILABLE]: 'Сервис временно недоступен', +}; + +const databaseUnavailableCodes = new Set([ + 'P1000', + 'P1001', + 'P1002', + 'P1008', + 'P1017', + 'P2024', + 'P2037', + 'ECONNREFUSED', + 'ECONNRESET', + 'ETIMEDOUT', + 'EPIPE', + 'ENOTFOUND', + 'EAI_AGAIN', + 'EACCES', + '08000', + '08001', + '08003', + '08004', + '08006', + '53300', + '57P01', + '57P02', + '57P03', + '57014', +]); +const driverTimeoutMessages = [ + 'Query read timeout', + 'timeout exceeded when trying to connect', + 'Connection terminated unexpectedly', + 'Connection terminated due to connection timeout', +]; + +function databaseUnavailable(exception: unknown): boolean { + if (exception instanceof Prisma.PrismaClientInitializationError) return true; + if (exception instanceof HttpException || !(exception instanceof Error)) + return false; + const error = exception as Error & { code?: unknown }; + if ( + typeof error.code === 'string' && + databaseUnavailableCodes.has(error.code) + ) + return true; + if (exception instanceof Prisma.PrismaClientKnownRequestError) { + const originalCode = exception.meta?.code; + if ( + typeof originalCode === 'string' && + databaseUnavailableCodes.has(originalCode) + ) + return true; + const adapter = exception.meta?.driverAdapterError; + if (adapter !== null && typeof adapter === 'object' && 'cause' in adapter) { + const cause = adapter.cause; + if (cause !== null && typeof cause === 'object') { + if ('kind' in cause && cause.kind === 'ConnectionClosed') return true; + if ( + 'originalCode' in cause && + typeof cause.originalCode === 'string' && + databaseUnavailableCodes.has(cause.originalCode) + ) + return true; + } + } + } + return driverTimeoutMessages.some((message) => + exception.message.includes(message), + ); +} + +@Catch() +export class AllExceptionsFilter implements ExceptionFilter { + catch(exception: unknown, host: ArgumentsHost): void { + if (databaseUnavailable(exception)) { + exception = new ApiException( + HttpStatus.SERVICE_UNAVAILABLE, + 'unavailable', + 'База данных недоступна', + ); + } + const context = host.switchToHttp(); + const request = context.getRequest(); + const response = context.getResponse(); + if (exception instanceof AuthException) { + void response.header('WWW-Authenticate', exception.challenge); + } + + const status = + exception instanceof HttpException + ? exception.getStatus() + : HttpStatus.INTERNAL_SERVER_ERROR; + const payload = + exception instanceof HttpException ? exception.getResponse() : undefined; + const { code, message } = this.extractError(status, payload); + const requestId = request.id; + + if (status >= HttpStatus.INTERNAL_SERVER_ERROR) { + request.raw.log?.error( + { err: exception, status, requestId }, + 'Request failed', + ); + } + + void response.status(status).send({ + error: { code, message, request_id: requestId }, + }); + } + + private extractError( + status: HttpStatus, + payload: string | object | undefined, + ): { code: string; message: string } { + if (status === HttpStatus.INTERNAL_SERVER_ERROR) { + return { + code: 'internal_error', + message: defaultMessages[status] ?? 'Ошибка сервера', + }; + } + + const body = ( + payload !== null && typeof payload === 'object' ? payload : {} + ) as ExceptionPayload; + + return { + code: + typeof body.code === 'string' + ? body.code + : (defaultCodes[status] ?? 'http_error'), + message: + defaultMessages[status] ?? + (status >= HttpStatus.INTERNAL_SERVER_ERROR + ? 'Ошибка сервера' + : 'Ошибка запроса'), + }; + } +} diff --git a/src/common/http/fastify-adapter.ts b/src/common/http/fastify-adapter.ts new file mode 100644 index 00000000..22a2406d --- /dev/null +++ b/src/common/http/fastify-adapter.ts @@ -0,0 +1,24 @@ +import { randomUUID } from 'node:crypto'; +import { + FastifyAdapter, + NestFastifyApplication, +} from '@nestjs/platform-fastify'; + +const requestIdHeader = 'x-request-id'; + +export function createFastifyAdapter(): FastifyAdapter { + return new FastifyAdapter({ + requestIdHeader, + genReqId: () => randomUUID(), + }); +} + +export function exposeRequestIdHeader(app: NestFastifyApplication): void { + app + .getHttpAdapter() + .getInstance() + .addHook('onRequest', (request, reply, done) => { + void reply.header(requestIdHeader, request.id); + done(); + }); +} diff --git a/src/common/validation.ts b/src/common/validation.ts new file mode 100644 index 00000000..cbbdf046 --- /dev/null +++ b/src/common/validation.ts @@ -0,0 +1,54 @@ +import { ApiException } from './exceptions/api.exception'; +import { HttpStatus } from '@nestjs/common'; + +export const uuidPattern = + /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; + +export function invalidRequest(message: string): never { + throw new ApiException(HttpStatus.BAD_REQUEST, 'invalid_request', message); +} + +export function objectBody( + value: unknown, + keys: string[], +): Record { + if (typeof value !== 'object' || value === null || Array.isArray(value)) { + return invalidRequest('Ожидается JSON-объект'); + } + const body = value as Record; + if (Object.keys(body).some((key) => !keys.includes(key))) { + return invalidRequest('Неизвестное поле запроса'); + } + return body; +} + +export function requiredText( + value: unknown, + field: string, + max: number, +): string { + if (typeof value !== 'string' || value.trim().length === 0) { + return invalidRequest(`Некорректное поле ${field}`); + } + let codePoints = 0; + for (const _character of value) codePoints++; + if (codePoints > max) return invalidRequest(`Некорректное поле ${field}`); + return value; +} + +export function uuid(value: unknown, field: string): string { + if (typeof value !== 'string' || !uuidPattern.test(value)) { + return invalidRequest(`Некорректное поле ${field}`); + } + return value.toLowerCase(); +} + +export function pageLimit(value: unknown): number { + if (value === undefined) return 50; + if (typeof value !== 'string' || !/^[1-9]\d*$/.test(value)) { + return invalidRequest('Некорректный limit'); + } + const limit = Number(value); + if (limit > 100) return invalidRequest('Некорректный limit'); + return limit; +} diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 00000000..23b05f15 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,55 @@ +import { NestFactory } from '@nestjs/core'; +import { NestFastifyApplication } from '@nestjs/platform-fastify'; +import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; +import { apiReference } from '@scalar/nestjs-api-reference'; +import { AppModule } from './app.module'; +import { Logger } from 'nestjs-pino'; +import { + createFastifyAdapter, + exposeRequestIdHeader, +} from './common/http/fastify-adapter'; + +async function bootstrap() { + const app = await NestFactory.create( + AppModule, + createFastifyAdapter(), + { + bufferLogs: true, + }, + ); + + exposeRequestIdHeader(app); + app.useLogger(app.get(Logger)); + app.enableShutdownHooks(); + + const swaggerConfig = new DocumentBuilder() + .setTitle('Messenger API') + .setDescription('Документация API') + .setVersion('1.2.0') + .addBasicAuth({ type: 'http', scheme: 'basic' }, 'basicAuth') + .addBearerAuth( + { type: 'http', scheme: 'bearer', bearerFormat: 'opaque' }, + 'bearerAuth', + ) + .build(); + + const document = SwaggerModule.createDocument(app, swaggerConfig); + + SwaggerModule.setup('swagger', app, document); + + app.use( + '/docs', + apiReference({ + content: document, + theme: 'laserwave', + withFastify: true, + }), + ); + + await app.listen( + Number(process.env.APP_PORT ?? process.env.PORT ?? 8080), + process.env.APP_HOST ?? '0.0.0.0', + ); +} + +void bootstrap(); diff --git a/src/prisma/prisma.module.ts b/src/prisma/prisma.module.ts new file mode 100644 index 00000000..930cb0ff --- /dev/null +++ b/src/prisma/prisma.module.ts @@ -0,0 +1,6 @@ +import { Global, Module } from '@nestjs/common'; +import { PrismaService } from './prisma.service'; + +@Global() +@Module({ providers: [PrismaService], exports: [PrismaService] }) +export class PrismaModule {} diff --git a/src/prisma/prisma.service.ts b/src/prisma/prisma.service.ts new file mode 100644 index 00000000..7ce5cf23 --- /dev/null +++ b/src/prisma/prisma.service.ts @@ -0,0 +1,38 @@ +import 'dotenv/config'; +import { + Injectable, + type OnModuleDestroy, + type OnModuleInit, +} from '@nestjs/common'; +import { PrismaPg } from '@prisma/adapter-pg'; +import { PrismaClient } from '../generated/prisma/client'; + +@Injectable() +export class PrismaService + extends PrismaClient + implements OnModuleInit, OnModuleDestroy +{ + constructor() { + const connectionString = process.env.DATABASE_URL; + if (!connectionString) throw new Error('DATABASE_URL is required'); + super({ + adapter: new PrismaPg({ + connectionString, + max: 10, + connectionTimeoutMillis: 5000, + query_timeout: 5000, + idleTimeoutMillis: 30000, + options: '-c statement_timeout=5000', + }), + transactionOptions: { maxWait: 5000, timeout: 10000 }, + }); + } + + async onModuleInit(): Promise { + await this.$connect(); + } + + async onModuleDestroy(): Promise { + await this.$disconnect(); + } +} diff --git a/test/README.md b/test/README.md new file mode 100644 index 00000000..81c67f4c --- /dev/null +++ b/test/README.md @@ -0,0 +1,74 @@ +# Проверки приложения + +Текущий вариант использует 16 счётчиков эпохи истории, единый SQL проверки сессии и членства и профиль из JOIN. Сравнение трёх оптимизаций: [результаты](../evidence/epoch-variants-summary.md). Итоговый контроль против того же кода без кэша и обслуживания эпох: [методика и результаты](../evidence/cache-strategy-buckets-summary.md), включая точные команды повторения длинной нагрузки. Для актуальной схемы примените миграции и используйте проверки ниже. `epoch-variants-experiment.cjs` предназначен для исторической матрицы до миграции счётчиков; точные исходники вариантов сохранены в `evidence/epoch-variants-sources.json`. + +Нужны Node.js 24.20.0 (как в Dockerfile), установленные зависимости и PostgreSQL с применёнными миграциями. Переменные читаются из локального `.env`; Redis нужен проверкам кэша и отказов. + +```powershell +pnpm.cmd build +node --test test/passwords.mjs test/persistence.mjs test/resilience.mjs +node --test test/cache.mjs test/cache-epochs.mjs test/message-pagination.mjs +pnpm.cmd lint +``` + +`passwords.mjs` проверяет Argon2id в PHC-формате, независимое вычисление ключа, случайные соли, Unicode/NUL, неверные и повреждённые хеши. Поддерживается только Argon2id; прежние scrypt-хеши не принимаются. Пароли, хеши и токены не печатаются. + +Публичные проверки работают по HTTP с уже запущенным Compose: + +```powershell +python -X utf8 tests/smoke.py --base-url http://127.0.0.1:8080 +python -X utf8 scripts/test-persistence.py --scenario public --base-url http://127.0.0.1:8080 --output evidence/persistence-public.json +``` + +Последняя команда использует неизменённую публичную проверку с HTTP-дедлайном 2 секунды. Она создаёт синтетические данные, перезапускает API/PostgreSQL/Redis через `scripts/restart.cmd` (Windows) или `scripts/restart.sh` (Linux), сохраняет volumes и проверяет данные прежним токеном. Windows требует Git Bash. Для Linux сохраните executable bit скрипта (`chmod +x scripts/restart.sh`). + +На Windows можно запустить этот же нормативный сценарий через make: + +```powershell +make test-persistence ACTION_SCRIPT=scripts/restart.cmd PYTHON="python -X utf8" +``` + +Собственный сценарий с HTTP-дедлайном 30 секунд: + +```powershell +python -X utf8 scripts/test-persistence.py --scenario full-restart --base-url http://127.0.0.1:8080 --output evidence/argon2-full-restart.json +``` + +Измерения кэша описаны в `evidence/cache-epochs-summary.md`. Их основное сравнение выполнено до замены KDF, на синтетических сессиях без измерения регистрации/входа. Хеширование паролей не входит в эти RPS. + +Результаты оптимизации записи эпохи одним CTE: [сводка](../evidence/cache-epochs-optimization-summary.md). Повторение замера после сборки и запуска backend: + +```powershell +docker compose -f compose.yaml -f test/compose.benchmark.yaml run --rm --no-deps --pull never benchmark node test/cache-benchmark.mjs after /results/cache-epochs-optimized.json +node test/cache-epochs-optimization-summary.mjs +``` + +Один сравнительный прогон с Redis и со всеми кэшами приложения, отключёнными через отсутствие CACHE_URL. Эпохи в PostgreSQL остаются включены в обоих режимах: + +```powershell +docker compose -f compose.yaml -f test/compose.benchmark.yaml run --rm --no-deps --pull never benchmark node test/cache-benchmark.mjs after /results/redis-comparison.json --compare-redis +node test/redis-comparison-summary.mjs +``` + +[Средние результаты и ограничения](../evidence/redis-comparison-summary.md). Сборка не нужна, если текущий образ уже содержит проверяемую реализацию приложения. + +Сравнение полной стратегии с вариантом без Redis и поддержания эпох: + +```powershell +docker compose -f compose.yaml -f test/compose.benchmark.yaml run --rm --no-deps --pull never benchmark node test/cache-benchmark.mjs after /results/cache-strategy-full.json +node test/no-epochs-experiment.cjs +node test/cache-strategy-summary.mjs +``` + +Второй шаг создаёт временные копии шести модулей, убирает обслуживание эпох, компилирует их TypeScript и подключает в отдельный benchmark-контейнер. Рабочие исходники и backend не меняются; служебные колонки БД сохраняются. По завершении временные файлы удаляются. [Результаты](../evidence/cache-strategy-summary.md). + +Увеличенная нагрузка: 100 000 сообщений, конкурентность 32, чтение по 60 секунд, прогрев 10 секунд, по 4096 записей, три повтора. Дополнительный контроль с частично отключённым кэшем пропущен: + +```powershell +docker compose -f compose.yaml -f test/compose.benchmark.yaml run --rm --no-deps --pull never benchmark node test/cache-benchmark.mjs after /results/cache-strategy-long-full.json --concurrency 32 --duration-seconds 60 --warmup-seconds 10 --repetitions 3 --seed-messages 100000 --cold-burst 64 --writes-per-repeat 4096 --skip-history-control +$env:EXPERIMENT_PREFIX='cache-strategy-long' +node test/no-epochs-experiment.cjs --concurrency 32 --duration-seconds 60 --warmup-seconds 10 --repetitions 3 --seed-messages 100000 --cold-burst 64 --writes-per-repeat 4096 --skip-history-control +node test/cache-strategy-summary.mjs cache-strategy-long +``` + +[Результаты увеличенного прогона](../evidence/cache-strategy-long-summary.md). Старые короткие замеры сохраняются отдельно. diff --git a/test/auth-startup.mjs b/test/auth-startup.mjs new file mode 100644 index 00000000..6bd1c282 --- /dev/null +++ b/test/auth-startup.mjs @@ -0,0 +1,50 @@ +import { createRequire } from 'node:module'; +import { randomUUID } from 'node:crypto'; +import { performance } from 'node:perf_hooks'; +const require = createRequire(`${process.cwd()}/package.json`); +const { NestFactory } = require('@nestjs/core'); +const { AppModule } = require(`${process.cwd()}/dist/app.module`); +const { PrismaService } = require(`${process.cwd()}/dist/prisma/prisma.service`); +const { UserService } = require(`${process.cwd()}/dist/User/user.service`); +const { PasswordService } = require(`${process.cwd()}/dist/Auth/password.service`); +const { createFastifyAdapter } = require(`${process.cwd()}/dist/common/http/fastify-adapter`); +process.env.CACHE_URL = ''; +const app = await NestFactory.create(AppModule, createFastifyAdapter(), { logger: false, abortOnError: false }); +await app.init(); +require('nestjs-pino').PinoLogger.root.level = 'silent'; +const server = app.getHttpAdapter().getInstance(); +await server.ready(); +const prisma = app.get(PrismaService); +const passwords = app.get(PasswordService); +const originalHash = passwords.hash.bind(passwords); +const spans = []; +passwords.hash = async (password) => { + const start = performance.now(); + const value = await originalHash(password); + spans.push({ phase: 'kdf', ms: Math.round(performance.now() - start) }); + return value; +}; +app.get(UserService).prisma = prisma.$extends({ query: { user: { async create({ args, query }) { + const start = performance.now(); + const value = await query(args); + spans.push({ phase: 'sql_user_create', ms: Math.round(performance.now() - start) }); + return value; +} } } }); +const ids = []; +try { + const health = await server.inject({ method: 'GET', url: '/health/ready' }); + console.log(JSON.stringify({ phase: 'health', status: health.statusCode })); + for (let sample = 1; sample <= 3; sample++) { + spans.length = 0; + const start = performance.now(); + const response = await server.inject({ method: 'POST', url: '/api/v1/users', payload: { + username: `warm_${randomUUID().replaceAll('-', '').slice(0, 20)}`, + display_name: 'Synthetic startup diagnostic', password: 'Synthetic-diagnostic-password-123', + } }); + if (response.statusCode === 201) ids.push(response.json().id); + console.log(JSON.stringify({ sample, status: response.statusCode, total_ms: Math.round(performance.now() - start), spans })); + } +} finally { + await prisma.user.deleteMany({ where: { id: { in: ids } } }); + await app.close(); +} diff --git a/test/cache-benchmark.mjs b/test/cache-benchmark.mjs new file mode 100644 index 00000000..67442d2d --- /dev/null +++ b/test/cache-benchmark.mjs @@ -0,0 +1,538 @@ +import assert from 'node:assert/strict'; +import { createHash, randomBytes, randomUUID } from 'node:crypto'; +import { createRequire } from 'node:module'; +import { readFile, writeFile } from 'node:fs/promises'; +import { performance } from 'node:perf_hooks'; +import { faultProxy } from './helpers/fault-proxy.mjs'; +import { messageEpoch } from './helpers/message-epoch.mjs'; + +const require = createRequire(`${process.cwd()}/package.json`); +const pg = require('pg'); +let counts = {}; +const originalQuery = pg.Client.prototype.query; +pg.Client.prototype.query = function (query, ...args) { + const sql = typeof query === 'string' ? query : query.text; + const verb = sql.trim().split(/\s+/)[0].toUpperCase(); + const table = + ['messages', 'chat_members', 'sessions', 'users', 'chats'].find((name) => + new RegExp(`\\b${name}\\b`).test(sql), + ) ?? 'other'; + const label = `${verb}:${table}`; + counts[label] = (counts[label] ?? 0) + 1; + return originalQuery.call(this, query, ...args); +}; +const Redis = require('ioredis').default; +const { NestFactory } = require('@nestjs/core'); +const { AppModule } = require(`${process.cwd()}/dist/app.module`); +const { PrismaService } = require( + `${process.cwd()}/dist/prisma/prisma.service`, +); +const { CacheService } = require(`${process.cwd()}/dist/cache/cache.service`); +const { createFastifyAdapter, exposeRequestIdHeader } = require( + `${process.cwd()}/dist/common/http/fastify-adapter`, +); +const stage = process.argv[2]; +const compareRedis = process.argv.includes('--compare-redis'); +const historyControl = !process.argv.includes('--skip-history-control'); +function integerOption(name, fallback) { + const index = process.argv.indexOf(`--${name}`); + const value = index === -1 ? fallback : Number(process.argv[index + 1]); + assert.ok(Number.isSafeInteger(value) && value > 0, `Invalid --${name}`); + return value; +} +const concurrency = integerOption('concurrency', 16); +const duration = integerOption('duration-seconds', 10); +const warmup = integerOption('warmup-seconds', 3); +const repetitions = integerOption('repetitions', 3); +const seedMessages = integerOption('seed-messages', 10000); +const coldBurst = integerOption('cold-burst', 32); +const writesPerRepeat = integerOption('writes-per-repeat', 512); +assert.ok(['before', 'after'].includes(stage)); +const prefix = `experiment:epochs:${randomUUID()}`; +const proxy = await faultProxy(process.env.CACHE_URL, 6379); +const observer = new Redis(process.env.CACHE_URL); +process.env.CACHE_PREFIX = prefix; +process.env.CACHE_URL = proxy.url; +const apps = []; +async function start() { + const app = await NestFactory.create(AppModule, createFastifyAdapter(), { + logger: false, + abortOnError: false, + }); + apps.push(app); + exposeRequestIdHeader(app); + await app.listen(0, '127.0.0.1'); + require('nestjs-pino').PinoLogger.root.level = 'silent'; + return { app, url: await app.getUrl() }; +} +const first = await start(); +const prisma = first.app.get(PrismaService); +let userId; +const chatIds = []; +const report = { + stage, + recorded_at: new Date().toISOString(), + node: process.version, + methodology: { + requests: + 'real loopback HTTP; instrumented API process in measured backend image', + sql: 'pg.Client.query calls; transaction control counted separately', + concurrency, + duration_seconds: duration, + warmup_seconds: warmup, + repetitions, + seed_messages: seedMessages, + cold_burst_requests: coldBurst, + writes_per_repeat: writesPerRepeat, + history_control: historyControl, + resources: + 'process CPU/RSS includes HTTP generator and instrumentation; not container CPU', + limitations: + 'closed loop, client and API share process/CPU; other Docker workloads share host resources; no capacity/SLA claim; fixtures bypass password KDF', + }, + dist_sha256: {}, + dependencies: {}, + samples: [], + correctness: {}, +}; +for (const name of [ + '@nestjs/core', + '@prisma/adapter-pg', + 'pg', + 'ioredis', + 'fastify', +]) { + try { + report.dependencies[name] = require(`${name}/package.json`).version; + } catch { + report.dependencies[name] = 'package metadata not exported'; + } +} +for (const name of [ + 'Chat/chat.service.js', + 'cache/cache.service.js', + 'Auth/auth.service.js', + 'User/user.guard.js', + 'Chat/chat.controller.js', +]) { + report.dist_sha256[name] = createHash('sha256') + .update(await readFile(`${process.cwd()}/dist/${name}`)) + .digest('hex'); +} +const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); +async function clearCache() { + let cursor = '0'; + do { + const [next, keys] = await observer.scan( + cursor, + 'MATCH', + `${prefix}:*`, + 'COUNT', + 100, + ); + cursor = next; + if (keys.length) await observer.del(...keys); + } while (cursor !== '0'); +} +let token; +async function request(method, path, body, target = first) { + const response = await fetch(`${target.url}${path}`, { + method, + headers: { + authorization: `Bearer ${token}`, + ...(body ? { 'content-type': 'application/json' } : {}), + }, + ...(body ? { body: JSON.stringify(body) } : {}), + signal: AbortSignal.timeout(10000), + }); + const json = await response.json(); + assert.equal( + response.status, + method === 'POST' ? 201 : 200, + `HTTP ${response.status}`, + ); + return json; +} +async function newChat() { + const chat = await prisma.chat.create({ + data: { + title: 'Synthetic epoch benchmark', + members: { create: { userId, position: 0 } }, + }, + }); + chatIds.push(chat.id); + return chat.id; +} +async function measure( + workload, + repeat, + operation, + { + duration: secondsToRun = duration, + total, + concurrency: clients = concurrency, + } = {}, +) { + counts = {}; + const cpu = process.cpuUsage(); + let peakRss = process.memoryUsage().rss; + const timer = setInterval(() => { + peakRss = Math.max(peakRss, process.memoryUsage().rss); + }, 100); + const latencies = []; + let errors = 0, + index = 0; + const start = performance.now(); + await Promise.all( + Array.from({ length: clients }, async () => { + while ( + total === undefined + ? performance.now() - start < secondsToRun * 1000 + : index < total + ) { + const item = index++; + const began = performance.now(); + try { + await operation(item); + latencies.push(performance.now() - began); + } catch { + errors++; + } + } + }), + ); + const seconds = (performance.now() - start) / 1000; + clearInterval(timer); + peakRss = Math.max(peakRss, process.memoryUsage().rss); + const used = process.cpuUsage(cpu); + latencies.sort((a, b) => a - b); + const percentile = (p) => + latencies.length + ? +latencies[Math.ceil(p * latencies.length) - 1].toFixed(3) + : null; + const sql = Object.entries(counts) + .filter(([key]) => !/^(BEGIN|COMMIT|ROLLBACK|SET):/.test(key)) + .reduce((sum, [, n]) => sum + n, 0); + const sample = { + workload, + repeat, + concurrency: clients, + elapsed_seconds: +seconds.toFixed(3), + successes: latencies.length, + errors, + error_ratio: errors / (latencies.length + errors), + successful_rps: +(latencies.length / seconds).toFixed(3), + latency_ms: { + mean: latencies.length + ? +( + latencies.reduce((sum, value) => sum + value, 0) / latencies.length + ).toFixed(3) + : null, + p50: percentile(0.5), + p95: percentile(0.95), + p99: percentile(0.99), + }, + sql_queries: sql, + sql_per_request: +(sql / (latencies.length + errors)).toFixed(4), + sql_calls: { ...counts }, + process_cpu_percent_one_core: +( + (used.user + used.system) / + (seconds * 10000) + ).toFixed(2), + peak_process_rss_mib: +(peakRss / 1048576).toFixed(2), + }; + report.samples.push(sample); + console.log(JSON.stringify(sample)); + assert.equal(errors, 0, 'load errors recorded in report'); +} +try { + const user = await prisma.user.create({ + data: { + username: `epoch_${randomUUID().replaceAll('-', '').slice(0, 20)}`, + displayName: 'Synthetic benchmark', + }, + }); + userId = user.id; + token = randomBytes(32).toString('base64url'); + await prisma.session.create({ + data: { + userId, + tokenHash: createHash('sha256').update(token).digest('hex'), + expiresAt: new Date(Date.now() + 3600000), + }, + }); + const readChat = await newChat(); + for (let offset = 0; offset < seedMessages; offset += 1000) { + await prisma.message.createMany({ + data: Array.from( + { length: Math.min(1000, seedMessages - offset) }, + (_, i) => ({ + chatId: readChat, + senderId: userId, + text: `Synthetic message ${offset + i}`, + createdAt: new Date(1700000000000 + offset + i), + }), + ), + }); + } + await prisma.chatMessageEpoch.createMany({ + data: Array.from({ length: 16 }, (_, bucket) => ({ + chatId: readChat, + bucket, + epoch: BigInt( + Math.floor(seedMessages / 16) + (bucket < seedMessages % 16 ? 1 : 0), + ), + })), + }); + const path = `/api/v1/chats/${readChat}/messages?limit=50`; + if (compareRedis) { + const cacheUrl = process.env.CACHE_URL; + delete process.env.CACHE_URL; + let withoutRedis; + try { + withoutRedis = await start(); + } finally { + process.env.CACHE_URL = cacheUrl; + } + assert.equal(withoutRedis.app.get(CacheService).redis, undefined); + report.methodology.comparison = { + modes: ['redis', 'no-redis'], + no_redis: + 'API started without CACHE_URL; all application Redis caches disabled', + epochs: 'PostgreSQL epochs and atomic CTE writes retained in both modes', + order: 'redis first in repeats 1/3, no-redis first in repeat 2', + processes: + 'both API instances and HTTP generator share one measured Node process', + }; + report.correctness.read_after_write = {}; + for (let repeat = 1; repeat <= repetitions; repeat++) { + const variants = [ + { name: 'redis', target: first }, + { name: 'no-redis', target: withoutRedis }, + ]; + if (repeat % 2 === 0) variants.reverse(); + for (const { name, target } of variants) { + await clearCache(); + await measure( + `cold-history-burst:${name}`, + repeat, + () => request('GET', path, undefined, target), + { total: coldBurst, concurrency: coldBurst }, + ); + const warmUntil = performance.now() + warmup * 1000; + while (performance.now() < warmUntil) + await request('GET', path, undefined, target); + await measure(`warm-history:${name}`, repeat, () => + request('GET', path, undefined, target), + ); + const writeChat = await newChat(); + const writePath = `/api/v1/chats/${writeChat}/messages`; + assert.equal( + (await request('GET', writePath, undefined, target)).items.length, + 0, + ); + await measure( + `writes-single-chat:${name}`, + repeat, + (i) => + request( + 'POST', + writePath, + { text: `Concurrent write ${i}` }, + target, + ), + { total: writesPerRepeat }, + ); + assert.equal( + await prisma.message.count({ where: { chatId: writeChat } }), + writesPerRepeat, + ); + assert.equal( + await messageEpoch(prisma, writeChat), + BigInt(writesPerRepeat), + ); + const page = await request('GET', writePath, undefined, target); + assert.equal(page.items.length, 50); + assert.equal(new Set(page.items.map((message) => message.id)).size, 50); + report.correctness.read_after_write[`${name}:${repeat}`] = true; + } + } + } else { + const cache = first.app.get(CacheService); + const remember = cache.remember.bind(cache); + for (let repeat = 1; repeat <= repetitions; repeat++) { + await clearCache(); + await request('GET', `/api/v1/chats/${readChat}`); + await measure('cold-history-burst', repeat, () => request('GET', path), { + total: coldBurst, + concurrency: coldBurst, + }); + const warmUntil = performance.now() + warmup * 1000; + while (performance.now() < warmUntil) await request('GET', path); + await measure('warm-history', repeat, () => request('GET', path)); + if (historyControl) { + cache.remember = (namespace, parameters, ttl, load) => + namespace.startsWith('messages:') + ? load() + : remember(namespace, parameters, ttl, load); + const directUntil = performance.now() + warmup * 1000; + while (performance.now() < directUntil) await request('GET', path); + await measure('history-cache-bypassed', repeat, () => + request('GET', path), + ); + cache.remember = remember; + } + const writeChat = await newChat(); + await request('GET', `/api/v1/chats/${writeChat}`); + await measure( + 'writes-single-chat', + repeat, + (i) => + request('POST', `/api/v1/chats/${writeChat}/messages`, { + text: `Concurrent write ${i}`, + }), + { total: writesPerRepeat }, + ); + assert.equal( + await prisma.message.count({ where: { chatId: writeChat } }), + writesPerRepeat, + ); + } + const second = await start(); + const faultChat = await newChat(); + const faultPath = `/api/v1/chats/${faultChat}/messages`; + assert.equal( + (await request('GET', faultPath, undefined, second)).items.length, + 0, + ); + const keysBefore = await observer.keys(`${prefix}:messages:${faultChat}:*`); + assert.ok(keysBefore.length); + proxy.setMode('cut'); + await sleep(100); + const written = await request('POST', faultPath, { + text: 'Committed while Redis is unavailable', + }); + const during = await request('GET', faultPath, undefined, second); + proxy.setMode('online'); + for (let i = 0; i < 60; i++) { + if (apps.every((app) => app.get(CacheService).redis?.status === 'ready')) + break; + await sleep(100); + } + assert.ok( + apps.every((app) => app.get(CacheService).redis?.status === 'ready'), + ); + const recovered = await request('GET', faultPath, undefined, second); + report.correctness.redis_reconnect = { + old_keys_retained: + (await observer.exists(...keysBefore)) === keysBefore.length, + read_after_write_during_outage: during.items.some( + (x) => x.id === written.id, + ), + read_after_write_after_reconnect_other_replica: recovered.items.some( + (x) => x.id === written.id, + ), + }; + await clearCache(); + const cold = await request('GET', faultPath, undefined, second); + report.correctness.empty_cache_recovery = cold.items.some( + (x) => x.id === written.id, + ); + const raceChat = await newChat(); + const racePath = `/api/v1/chats/${raceChat}/messages`; + const service = first.app.get( + require(`${process.cwd()}/dist/Chat/chat.service`).ChatService, + ); + const actualPrisma = service.prisma; + let release, began; + const started = new Promise((resolve) => { + began = resolve; + }); + const held = new Promise((resolve) => { + release = resolve; + }); + service.prisma = actualPrisma.$extends({ + query: { + message: { + async findMany({ args, query }) { + const rows = await query(args); + if (args.where?.chatId === raceChat) { + began(); + await held; + } + return rows; + }, + }, + }, + }); + const pending = request('GET', racePath); + let fresh; + try { + await Promise.race([ + started, + sleep(10000).then(() => { + throw new Error('race load did not start'); + }), + ]); + proxy.setMode('cut'); + await sleep(100); + fresh = await request( + 'POST', + racePath, + { text: 'New message after old SELECT' }, + second, + ); + proxy.setMode('online'); + for (let i = 0; i < 60; i++) { + if ( + apps.every((app) => app.get(CacheService).redis?.status === 'ready') + ) + break; + await sleep(100); + } + assert.ok( + apps.every((app) => app.get(CacheService).redis?.status === 'ready'), + ); + } finally { + release(); + service.prisma = actualPrisma; + } + await pending; + report.correctness.delayed_old_fill = ( + await request('GET', racePath, undefined, second) + ).items.some((x) => x.id === fresh.id); + if (stage === 'after') { + assert.equal( + report.correctness.redis_reconnect + .read_after_write_after_reconnect_other_replica, + true, + ); + assert.equal(report.correctness.delayed_old_fill, true); + assert.equal(report.correctness.empty_cache_recovery, true); + } + } + report.completed = true; +} finally { + proxy.setMode('online'); + try { + await prisma.chat.deleteMany({ where: { id: { in: chatIds } } }); + if (userId) await prisma.user.delete({ where: { id: userId } }); + await clearCache(); + report.cleanup = 'only experiment chats/user/cache prefix removed'; + } finally { + for (const app of apps) await app.close(); + observer.disconnect(); + await proxy.close(); + await writeFile( + process.argv[3] ?? `/tmp/cache-epochs-${stage}.json`, + JSON.stringify(report, null, 2) + '\n', + ); + } +} +console.log( + JSON.stringify({ + stage, + correctness: report.correctness, + completed: report.completed, + }), +); diff --git a/test/cache-environment.ps1 b/test/cache-environment.ps1 new file mode 100644 index 00000000..3223737e --- /dev/null +++ b/test/cache-environment.ps1 @@ -0,0 +1,25 @@ +$ErrorActionPreference = 'Stop' +$dockerInfo = docker info --format '{{json .}}' | ConvertFrom-Json +if ($LASTEXITCODE -ne 0) { throw 'docker info failed' } +$processor = Get-CimInstance Win32_Processor | Select-Object -First 1 +$computer = Get-CimInstance Win32_ComputerSystem +$containers = docker inspect mtusi2026lab2-fork-backend-1 mtusi2026lab2-fork-postgres-1 mtusi2026lab2-fork-redis-1 | ConvertFrom-Json +if ($LASTEXITCODE -ne 0) { throw 'docker inspect failed' } +$metadata = [ordered]@{ + recorded_at = [DateTime]::UtcNow.ToString('o') + host_cpu = $processor.Name + host_physical_cores = $processor.NumberOfCores + host_logical_processors = $processor.NumberOfLogicalProcessors + host_ram_bytes = $computer.TotalPhysicalMemory + docker_version = $dockerInfo.ServerVersion + docker_cpu_count = $dockerInfo.NCPU + docker_ram_bytes = $dockerInfo.MemTotal + docker_kernel = $dockerInfo.KernelVersion + containers = @($containers | ForEach-Object { + [ordered]@{ name = $_.Name; image = $_.Image; memory_limit_bytes = $_.HostConfig.Memory; nano_cpus_limit = $_.HostConfig.NanoCpus; cpu_quota = $_.HostConfig.CpuQuota } + }) + before_image = 'sha256:075170aed76a42aa98b435cfb918d83879259b7e17177275d5274e328198e119' + before_image_local_tag = 'lab2-cache-epochs:before' +} +$metadataPath = Join-Path (Get-Location).Path 'evidence/cache-epochs-environment.json' +[System.IO.File]::WriteAllText($metadataPath, ($metadata | ConvertTo-Json -Depth 6) + [Environment]::NewLine, [System.Text.UTF8Encoding]::new($false)) diff --git a/test/cache-epochs-optimization-summary.mjs b/test/cache-epochs-optimization-summary.mjs new file mode 100644 index 00000000..4a896706 --- /dev/null +++ b/test/cache-epochs-optimization-summary.mjs @@ -0,0 +1,91 @@ +import assert from 'node:assert/strict'; +import { readFile, writeFile } from 'node:fs/promises'; + +const reports = await Promise.all( + ['after', 'optimized'].map(async (name) => + JSON.parse(await readFile(`evidence/cache-epochs-${name}.json`, 'utf8')), + ), +); +assert.ok(reports.every((report) => report.completed)); +assert.deepEqual(reports[0].methodology, reports[1].methodology); +const median = (values) => + [...values].sort((a, b) => a - b)[Math.floor(values.length / 2)]; +const labels = ['Отдельная транзакция', 'Один CTE']; +const lines = [ + '# Оптимизация эпохи кэша в PostgreSQL', + '', + `Запуски UTC: ${reports.map((report) => report.recorded_at).join(' → ')}.`, + '', + 'Сравнение сохранённого замера прежней реализации и нового замера после оптимизации. В обоих вариантах эпоха хранится в PostgreSQL; новый вариант объединяет проверку членства, UPDATE эпохи и INSERT сообщения одним запросом. При чтении истории убрано получение неиспользуемых метаданных чата.', + '', + 'Медианы трёх повторов. Перцентили — медианы перцентилей повторов, без объединения выборок.', + '', + '| Сценарий | Вариант | RPS | p50, мс | p95, мс | p99, мс | SQL/HTTP | BEGIN/COMMIT на HTTP | CPU, % ядра | RSS, MiB | Ошибки |', + '| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |', +]; +for (const workload of new Set( + reports[0].samples.map((sample) => sample.workload), +)) { + for (const [index, report] of reports.entries()) { + const samples = report.samples.filter( + (sample) => sample.workload === workload, + ); + assert.equal(samples.length, 3); + const get = (select) => median(samples.map(select)).toFixed(3); + const controls = (sample) => + Object.entries(sample.sql_calls) + .filter(([key]) => /^(BEGIN|COMMIT):/.test(key)) + .reduce((total, [, count]) => total + count, 0) / + (sample.successes + sample.errors); + lines.push( + `| ${workload} | ${labels[index]} | ${get((sample) => sample.successful_rps)} | ${get((sample) => sample.latency_ms.p50)} | ${get((sample) => sample.latency_ms.p95)} | ${get((sample) => sample.latency_ms.p99)} | ${get((sample) => sample.sql_per_request)} | ${get(controls)} | ${get((sample) => sample.process_cpu_percent_one_core)} | ${get((sample) => sample.peak_process_rss_mib)} | ${samples.reduce((total, sample) => total + sample.errors, 0)} |`, + ); + } +} +lines.push( + '', + '| Проверка | Отдельная транзакция | Один CTE |', + '| --- | --- | --- |', +); +for (const [label, select] of [ + [ + 'Чтение после записи при отказе Redis', + (report) => + report.correctness.redis_reconnect.read_after_write_during_outage, + ], + [ + 'Чтение другой репликой после восстановления Redis', + (report) => + report.correctness.redis_reconnect + .read_after_write_after_reconnect_other_replica, + ], + [ + 'Старые ключи сохранились в Redis', + (report) => report.correctness.redis_reconnect.old_keys_retained, + ], + [ + 'Восстановление с пустым кэшем', + (report) => report.correctness.empty_cache_recovery, + ], + [ + 'Задержанная загрузка старой истории', + (report) => report.correctness.delayed_old_fill, + ], +]) { + lines.push( + `| ${label} | ${reports.map((report) => (select(report) ? 'PASS' : 'FAIL')).join(' | ')} |`, + ); +} +lines.push( + '', + 'Методика: тот же `test/cache-benchmark.mjs`, 10 000 сообщений, limit=50, конкурентность 16, 3 с прогрева и 10 с чтения, 512 записей в новый чат, три повтора. Реальный HTTP по loopback в отдельных benchmark-контейнерах; общий PostgreSQL/Redis. Токены и пользователи создаются напрямую, хеширование паролей не измеряется. BEGIN/COMMIT исключены из SQL/HTTP; запрос WITH учитывается как один вызов pg.Client.query.', + '', + 'CPU/RSS включают API, генератор HTTP и инструментацию. Docker-host разделяется с другими работающими сервисами. Старый и новый замеры сделаны в разное время; изменение фоновой нагрузки и состояния host ограничивает сравнение RPS/latency. Замеры не доказывают максимальную ёмкость или SLA. UPDATE общей строки эпохи по-прежнему сериализует записи одного чата.', + '', + 'Сырые результаты: [до оптимизации](cache-epochs-after.json), [после оптимизации](cache-epochs-optimized.json). Хеши измеренных модулей сохранены в JSON. Исторические замеры до введения эпох остаются в `cache-epochs-summary.md`.', +); +await writeFile( + 'evidence/cache-epochs-optimization-summary.md', + lines.join('\n') + '\n', +); +console.log(lines.join('\n')); diff --git a/test/cache-epochs.mjs b/test/cache-epochs.mjs new file mode 100644 index 00000000..9947cc62 --- /dev/null +++ b/test/cache-epochs.mjs @@ -0,0 +1,195 @@ +import 'dotenv/config'; +import assert from 'node:assert/strict'; +import { createHash, randomBytes, randomUUID } from 'node:crypto'; +import { createRequire } from 'node:module'; +import test from 'node:test'; +import { faultProxy } from './helpers/fault-proxy.mjs'; +import { messageEpoch } from './helpers/message-epoch.mjs'; + +const require = createRequire(import.meta.url); +const Redis = require('ioredis').default; +const { NestFactory } = require('@nestjs/core'); +const { AppModule } = require('../dist/app.module'); +const { PrismaService } = require('../dist/prisma/prisma.service'); +const { CacheService } = require('../dist/cache/cache.service'); +const { ChatService } = require('../dist/Chat/chat.service'); +const { + createFastifyAdapter, + exposeRequestIdHeader, +} = require('../dist/common/http/fastify-adapter'); +const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); + +test( + 'DB cache epochs: two replicas, retained Redis keys, concurrent writes and atomic rollback', + { timeout: 90000 }, + async (t) => { + assert.ok(process.env.CACHE_URL && process.env.DATABASE_URL); + const oldUrl = process.env.CACHE_URL; + const oldPrefix = process.env.CACHE_PREFIX; + const prefix = `test:epochs:${randomUUID()}`; + const proxy = await faultProxy(oldUrl, 6379); + const observer = new Redis(oldUrl); + process.env.CACHE_URL = proxy.url; + process.env.CACHE_PREFIX = prefix; + const apps = []; + let prisma, userId; + const chatIds = []; + t.after(async () => { + proxy.setMode('online'); + try { + if (prisma) { + await prisma.chat.deleteMany({ where: { id: { in: chatIds } } }); + if (userId) await prisma.user.delete({ where: { id: userId } }); + } + let cursor = '0'; + do { + const [next, keys] = await observer.scan( + cursor, + 'MATCH', + `${prefix}:*`, + 'COUNT', + 100, + ); + cursor = next; + if (keys.length) await observer.del(...keys); + } while (cursor !== '0'); + } finally { + for (const app of apps) await app.close(); + observer.disconnect(); + await proxy.close(); + process.env.CACHE_URL = oldUrl; + if (oldPrefix === undefined) delete process.env.CACHE_PREFIX; + else process.env.CACHE_PREFIX = oldPrefix; + } + }); + for (let i = 0; i < 2; i++) { + const app = await NestFactory.create(AppModule, createFastifyAdapter(), { + logger: false, + abortOnError: false, + }); + apps.push(app); + exposeRequestIdHeader(app); + await app.init(); + await app.getHttpAdapter().getInstance().ready(); + require('nestjs-pino').PinoLogger.root.level = 'silent'; + } + prisma = apps[0].get(PrismaService); + const user = await prisma.user.create({ + data: { + username: `epoch_${randomUUID().replaceAll('-', '').slice(0, 20)}`, + displayName: 'Synthetic epochs', + }, + }); + userId = user.id; + const token = randomBytes(32).toString('base64url'); + await prisma.session.create({ + data: { + userId, + tokenHash: createHash('sha256').update(token).digest('hex'), + expiresAt: new Date(Date.now() + 600000), + }, + }); + const call = async (replica, method, url, payload) => { + const response = await apps[replica] + .getHttpAdapter() + .getInstance() + .inject({ + method, + url, + headers: { authorization: `Bearer ${token}` }, + ...(payload ? { payload } : {}), + }); + return { status: response.statusCode, body: response.json() }; + }; + const createChat = async () => { + const response = await call(0, 'POST', '/api/v1/chats', { + title: 'Epoch test', + member_ids: [userId], + }); + assert.equal(response.status, 201); + chatIds.push(response.body.id); + return response.body.id; + }; + assert.equal((await call(1, 'GET', '/api/v1/chats')).body.items.length, 0); + proxy.setMode('cut'); + await pause(100); + const chatId = await createChat(); + proxy.setMode('online'); + const reconnect = async () => { + for (let i = 0; i < 60; i++) { + if (apps.every((app) => app.get(CacheService).redis.status === 'ready')) + return; + await pause(100); + } + assert.fail('Redis did not reconnect'); + }; + await reconnect(); + assert.deepEqual( + (await call(1, 'GET', '/api/v1/chats')).body.items.map((x) => x.id), + [chatId], + ); + assert.equal( + (await prisma.user.findUniqueOrThrow({ where: { id: userId } })) + .chatsEpoch, + 1n, + ); + + const path = `/api/v1/chats/${chatId}/messages`; + assert.equal((await call(1, 'GET', path)).body.items.length, 0); + const oldKeys = await observer.keys(`${prefix}:messages:${chatId}:*`); + assert.ok(oldKeys.length); + proxy.setMode('cut'); + await pause(100); + const posted = await call(0, 'POST', path, { + text: 'Write during Redis outage', + }); + assert.equal(posted.status, 201); + proxy.setMode('online'); + await reconnect(); + assert.equal( + await observer.exists(...oldKeys), + oldKeys.length, + 'old cache keys must still exist', + ); + assert.deepEqual( + (await call(1, 'GET', path)).body.items.map((x) => x.id), + [posted.body.id], + ); + + const service = apps[0].get(ChatService); + const original = service.prisma; + service.prisma = original.$extends({ + query: { + $queryRaw({ args, query }) { + const index = args.values.indexOf('Must roll back'); + if (index !== -1) args.values[index] = 'x'.repeat(4001); + return query(args); + }, + }, + }); + try { + assert.equal( + (await call(0, 'POST', path, { text: 'Must roll back' })).status, + 500, + ); + } finally { + service.prisma = original; + } + assert.equal(await prisma.message.count({ where: { chatId } }), 1); + assert.equal(await messageEpoch(prisma, chatId), 1n); + + const writes = await Promise.all( + Array.from({ length: 20 }, (_, i) => + call(i % 2, 'POST', path, { text: `Concurrent ${i}` }), + ), + ); + assert.ok(writes.every((x) => x.status === 201)); + assert.equal(await prisma.message.count({ where: { chatId } }), 21); + assert.equal(await messageEpoch(prisma, chatId), 21n); + const history = (await call(1, 'GET', path)).body.items; + assert.equal(new Set(history.map((x) => x.id)).size, 21); + assert.ok( + writes.every((x) => history.some((message) => message.id === x.body.id)), + ); + }, +); diff --git a/test/cache-metrics-summary.mjs b/test/cache-metrics-summary.mjs new file mode 100644 index 00000000..def3db52 --- /dev/null +++ b/test/cache-metrics-summary.mjs @@ -0,0 +1,73 @@ +import assert from 'node:assert/strict'; +import { readFile, writeFile } from 'node:fs/promises'; +const before = JSON.parse( + await readFile('evidence/cache-epochs-before.json', 'utf8'), +); +const after = JSON.parse( + await readFile('evidence/cache-epochs-after.json', 'utf8'), +); +assert.ok(before.completed && after.completed); +assert.deepEqual(before.methodology, after.methodology); +const median = (values) => + values.sort((a, b) => a - b)[Math.floor(values.length / 2)]; +const lines = [ + '# Эпохи кэша — сравнение 2026-10-13', + '', + 'Медианы трёх повторов. p50/p95/p99 — медианы перцентилей отдельных повторов, не перцентили объединённой выборки.', + '', + '| Сценарий | Вариант | RPS | p50, мс | p95, мс | p99, мс | SQL/HTTP | CPU процесса, % ядра | Пиковый RSS, MiB | Ошибки |', + '| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |', +]; +for (const workload of [...new Set(before.samples.map((x) => x.workload))]) { + for (const report of [before, after]) { + const samples = report.samples.filter((x) => x.workload === workload); + assert.equal(samples.length, 3); + const get = (fn) => median(samples.map(fn)).toFixed(3); + lines.push( + `| ${workload} | ${report.stage} | ${get((x) => x.successful_rps)} | ${get((x) => x.latency_ms.p50)} | ${get((x) => x.latency_ms.p95)} | ${get((x) => x.latency_ms.p99)} | ${get((x) => x.sql_per_request)} | ${get((x) => x.process_cpu_percent_one_core)} | ${get((x) => x.peak_process_rss_mib)} | ${samples.reduce((sum, x) => sum + x.errors, 0)} |`, + ); + } +} +lines.push('', '| Проверка | До | После |', '| --- | --- | --- |'); +for (const [label, select] of [ + [ + 'Чтение после успешной записи при недоступном Redis', + (x) => x.correctness.redis_reconnect.read_after_write_during_outage, + ], + [ + 'Чтение другой репликой после восстановления Redis со старыми ключами', + (x) => + x.correctness.redis_reconnect + .read_after_write_after_reconnect_other_replica, + ], + [ + 'Старые ключи действительно сохранились', + (x) => x.correctness.redis_reconnect.old_keys_retained, + ], + ['Восстановление с пустым кэшем', (x) => x.correctness.empty_cache_recovery], + [ + 'Задержанная загрузка старой истории не отравляет следующий GET', + (x) => x.correctness.delayed_old_fill, + ], +]) + lines.push( + `| ${label} | ${select(before) ? 'PASS' : 'FAIL'} | ${select(after) ? 'PASS' : 'FAIL'} |`, + ); +lines.push( + '', + 'Методика: `test/cache-benchmark.mjs`, сырой результат: `cache-epochs-before.json` и `cache-epochs-after.json`. Конфигурация: `cache-epochs-environment.json`.', + '', + 'Реальный HTTP по loopback, 10 000 синтетических сообщений, первая страница limit=50. На повтор: холодная волна 32 запросов; прогрев 3 с; чтение с конкурентностью 16 в течение 10 с; прогрев 3 с и такой же контроль с отключённым кэшем истории; 512 записей в новый чат с конкурентностью 16. Три повтора. SQL считается на уровне pg.Client.query; BEGIN/COMMIT/ROLLBACK/SET вынесены в raw sql_calls и исключены из SQL/HTTP. Пароли не измеряются: пользователь и сессия создаются напрямую, токен остаётся в памяти.', + '', + 'CPU/RSS относятся к процессу эксперимента, включающему API, генератор HTTP и инструментацию. Docker Desktop: 4 CPU, около 2.80 GiB RAM, отдельные лимиты сервисов не заданы. Замеры closed-loop, короткие и последовательные before → after; разброс и прогрев ограничивают выводы о latency/RPS. Это не тест максимальной ёмкости или SLA. Первый холодный повтор также включает прогрев runtime.', + '', + 'Первичные короткие замеры (1 с прогрева, 5 с чтений, 128 записей) сохранены отдельно в cache-epochs-before-short.json и cache-epochs-after-short.json. Из-за большого разброса сделано одно повторное сравнение с увеличенным прогревом и нагрузкой; основные результаты получены в отдельных контейнерах benchmark из соответствующих образов. PostgreSQL/Redis и остальные контейнеры разделяют ресурсы Docker-host. Другие проекты на этом host не останавливались. Формулировки provenance в основных JSON уточнены после перехода от docker exec к отдельному контейнеру; численные измерения не менялись.', + '', + 'До изменений использован фактически запущенный образ (локальный тег lab2-cache-epochs:before), после — пересобранный проект. Старый образ ещё использовал OR для курсорной пагинации; измеряемая первая страница не содержит курсора, поэтому этот путь в нагрузочном сравнении не выполняется. Хеши измеренных модулей записаны в JSON.', + '', + 'Эпоха истории читается JOIN-ом вместе с проверкой членства; эпоха списка чатов — JOIN-ом с проверкой сессии. Для отдельного запроса дополнительного чтения эпохи нет. Однако raw JOIN проверки членства не использует прежний batching findUnique в Prisma: под конкуренцией суммарный SQL/HTTP может вырасти. Запись добавляет UPDATE чата и транзакционные команды; обновления одного чата сериализуются. Старые ключи недоступны новым читателям и удаляются по TTL.', + '', + 'Корректность зависит от основного PostgreSQL и обновления эпох во всех путях изменения данных. Прямые SQL-изменения в обход приложения требуют увеличения соответствующей эпохи. После восстановления PostgreSQL из старого backup следует сменить CACHE_PREFIX или очистить кэш, чтобы исключить повторное использование эпох. Сохранность Docker-host и высокая доступность PostgreSQL не исследовались. Cache stampede не устраняется этим изменением.', +); +await writeFile('evidence/cache-epochs-summary.md', lines.join('\n') + '\n'); +console.log(lines.slice(0, 14).join('\n')); diff --git a/test/cache-strategy-summary.mjs b/test/cache-strategy-summary.mjs new file mode 100644 index 00000000..e7b2cc7b --- /dev/null +++ b/test/cache-strategy-summary.mjs @@ -0,0 +1,117 @@ +import assert from 'node:assert/strict'; +import { readFile, writeFile } from 'node:fs/promises'; + +const resultPrefix = process.argv[2] ?? 'cache-strategy'; +assert.match(resultPrefix, /^[a-z0-9-]+$/); + +const reports = await Promise.all( + ['full', 'no-redis-no-epochs'].map(async (name) => + JSON.parse(await readFile(`evidence/${resultPrefix}-${name}.json`, 'utf8')), + ), +); +const provenance = JSON.parse( + await readFile(`evidence/${resultPrefix}-experiment.json`, 'utf8'), +); +assert.ok(reports.every((report) => report.completed)); +assert.deepEqual(reports[0].methodology, reports[1].methodology); +assert.equal(provenance.exit_code, 0); +assert.ok(provenance.sources_unchanged); +assert.ok(reports[1].correctness.epochs_unchanged); +assert.ok(reports[1].correctness.no_redis_client); +const median = (values) => + [...values].sort((a, b) => a - b)[Math.floor(values.length / 2)]; +const labels = ['Redis и эпохи', 'Без Redis и эпох']; +const aggregates = []; +const settings = reports[0].methodology; +const lines = [ + '# Полная стратегия кэша и вариант без Redis и эпох', + '', + `Запуски UTC: ${reports.map((report) => report.recorded_at).join(' → ')}.`, + '', + 'Сначала выполнен свежий прогон текущего образа с Redis, PostgreSQL-эпохами и записью сообщения через CTE. Затем шесть модулей приложения заменены временными версиями без поддержания эпох: убраны изменения счётчиков и чтения эпох в проверках сессии/членства. Объединённые проверки сессии, публичного профиля и доступа к истории сохранены. Сообщение вставляется одним INSERT ... SELECT с проверкой членства, без обновления счётчиков. Второй API запущен без CACHE_URL: все кэши приложения отключены. Исходники рабочего проекта и запущенный backend не изменены.', + '', + `Параметры обоих прогонов совпадают: ${settings.repetitions} повтора, конкурентность ${settings.concurrency}, ${settings.seed_messages} сообщений, limit=50, прогрев ${settings.warmup_seconds} с и чтение ${settings.duration_seconds} с, ${settings.writes_per_repeat} записей в новый чат. RPS = общее число успешных запросов / общее время повторов. Средняя задержка взвешена по числу успешных запросов. p95 — среднее отдельных p95, не перцентиль объединённой выборки. SQL/HTTP исключает команды транзакций.`, + '', + '| Сценарий | Вариант | Средний RPS | Средняя задержка, мс | Среднее p95, мс | SQL/HTTP | Медиана RPS | Ошибки |', + '| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: |', +]; +for (const [workload, label] of [ + ['cold-history-burst', 'Холодная волна истории'], + ['warm-history', 'Прогретая история'], + ['history-cache-bypassed', 'Контроль без кэша истории'], + ['writes-single-chat', 'Запись в один чат'], +]) { + if ( + reports.every( + (report) => + !report.samples.some((sample) => sample.workload === workload), + ) + ) + continue; + for (const [index, report] of reports.entries()) { + const samples = report.samples.filter( + (sample) => sample.workload === workload, + ); + assert.equal(samples.length, settings.repetitions); + const sum = (select) => + samples.reduce((total, sample) => total + select(sample), 0); + const successes = sum((sample) => sample.successes); + const errors = sum((sample) => sample.errors); + const aggregate = { + workload, + variant: labels[index], + successes, + errors, + mean_rps: successes / sum((sample) => sample.elapsed_seconds), + mean_latency_ms: + sum((sample) => sample.latency_ms.mean * sample.successes) / successes, + mean_p95_ms: sum((sample) => sample.latency_ms.p95) / samples.length, + sql_per_request: + sum((sample) => sample.sql_queries) / (successes + errors), + median_rps: median(samples.map((sample) => sample.successful_rps)), + repeat_rps: samples.map((sample) => sample.successful_rps), + }; + aggregates.push(aggregate); + lines.push( + `| ${label} | ${labels[index]} | ${aggregate.mean_rps.toFixed(3)} | ${aggregate.mean_latency_ms.toFixed(3)} | ${aggregate.mean_p95_ms.toFixed(3)} | ${aggregate.sql_per_request.toFixed(3)} | ${aggregate.median_rps.toFixed(3)} | ${errors} |`, + ); + } +} +lines.push( + '', + `Учтено успешных HTTP-запросов: ${reports.map((report, index) => `${labels[index]} — ${report.samples.reduce((sum, sample) => sum + sample.successes, 0)}`).join('; ')}.`, + '', + ...['warm-history', 'writes-single-chat'].map((workload) => { + const pair = aggregates.filter( + (aggregate) => aggregate.workload === workload, + ); + return `${workload}: отношение среднего RPS полной стратегии к варианту без стратегии — ${(pair[0].mean_rps / pair[1].mean_rps).toFixed(3)}. RPS по повторам: ${pair.map((aggregate) => `${aggregate.variant}: ${aggregate.repeat_rps.join(' / ')}`).join('; ')}.`; + }), + '', + settings.history_control === false + ? 'Дополнительный контроль с частично отключённым кэшем в этом прогоне пропущен. Сравниваются только полная стратегия и отсутствие Redis/поддержания эпох.' + : 'В контрольном сценарии у первого API отключён только кэш истории; кэш профиля продолжает работать. У второго API отключены все кэши. Поэтому этот контроль не измеряет отдельно чистую стоимость эпох.', + '', + `Проверки полной стратегии: чтение после записи при отказе Redis, чтение другой репликой после восстановления со старыми ключами, восстановление с пустым кэшем, задержанная загрузка старой истории. Проверки варианта без стратегии: приложение не создало Redis-клиент, эпохи синтетических пользователей/чатов остались равны 0 после всех записей, ${settings.writes_per_repeat} сообщений записаны в каждом новом чате, история читается после записи без повторяющихся ID.`, + '', + `Оба прогона используют один базовый образ; изменённые модули временной версии скомпилированы TypeScript без полной пересборки контейнера и подключены отдельными bind mounts. Хеши исходников и JS сохранены в [метаданных эксперимента](${resultPrefix}-experiment.json). Колонки эпох остаются в схеме; это исключает миграцию и позволяет сохранить рабочую БД. SQL-проверки профиля и членства во втором варианте не используют эпохи. Временные файлы удалены, хеши рабочих исходников проверены.`, + '', + 'Ограничения: прогоны последовательные, Docker-host разделяется с другими сервисами; большой разброс ограничивает выводы о скорости. CPU/RSS процесса включают API, HTTP-генератор и инструментацию; CPU PostgreSQL отдельно не измерен. Синтетические сессии обходят KDF. Холодная волна означает пустой кэш приложения, а не холодный PostgreSQL. Отдельные цены Redis и эпох этим сравнением не разделяются: меняется вся стратегия. Данные рабочей БД и volumes сохранены, удалены только фикстуры эксперимента.', + '', + 'Повторение:', + '', + '```powershell', + `docker compose -f compose.yaml -f test/compose.benchmark.yaml run --rm --no-deps --pull never benchmark node test/cache-benchmark.mjs after /results/${resultPrefix}-full.json --concurrency ${settings.concurrency} --duration-seconds ${settings.duration_seconds} --warmup-seconds ${settings.warmup_seconds} --repetitions ${settings.repetitions} --seed-messages ${settings.seed_messages} --cold-burst ${settings.cold_burst_requests} --writes-per-repeat ${settings.writes_per_repeat}${settings.history_control === false ? ' --skip-history-control' : ''}`, + `$env:EXPERIMENT_PREFIX='${resultPrefix}'`, + `node test/no-epochs-experiment.cjs --concurrency ${settings.concurrency} --duration-seconds ${settings.duration_seconds} --warmup-seconds ${settings.warmup_seconds} --repetitions ${settings.repetitions} --seed-messages ${settings.seed_messages} --cold-burst ${settings.cold_burst_requests} --writes-per-repeat ${settings.writes_per_repeat}${settings.history_control === false ? ' --skip-history-control' : ''}`, + `node test/cache-strategy-summary.mjs ${resultPrefix}`, + '```', + '', + `Сырые результаты: [полная стратегия](${resultPrefix}-full.json), [без Redis и эпох](${resultPrefix}-no-redis-no-epochs.json).`, +); +await writeFile(`evidence/${resultPrefix}-summary.md`, lines.join('\n') + '\n'); +await writeFile( + `evidence/${resultPrefix}-averages.json`, + JSON.stringify(aggregates, null, 2) + '\n', +); +console.log(lines.slice(0, 18).join('\n')); diff --git a/test/cache.mjs b/test/cache.mjs new file mode 100644 index 00000000..855cd58a --- /dev/null +++ b/test/cache.mjs @@ -0,0 +1,287 @@ +import 'dotenv/config'; +import assert from 'node:assert/strict'; +import { createHash, randomBytes, randomUUID } from 'node:crypto'; +import { createRequire } from 'node:module'; +import test from 'node:test'; + +const require = createRequire(import.meta.url); +const Redis = require('ioredis').default; +const { NestFactory } = require('@nestjs/core'); +const { AppModule } = require('../dist/app.module'); +const { PrismaService } = require('../dist/prisma/prisma.service'); +const { CacheService } = require('../dist/cache/cache.service'); +const { + createFastifyAdapter, + exposeRequestIdHeader, +} = require('../dist/common/http/fastify-adapter'); + +async function isolatedCache(t) { + assert.ok(process.env.CACHE_URL, 'Set CACHE_URL to a running Redis instance'); + const previous = process.env.CACHE_PREFIX; + const prefix = `test:cache:${randomUUID()}`; + process.env.CACHE_PREFIX = prefix; + const observer = new Redis(process.env.CACHE_URL, { + maxRetriesPerRequest: 0, + connectTimeout: 1000, + commandTimeout: 1000, + }); + observer.on('error', () => {}); + await observer.ping(); + t.after(async () => { + try { + let cursor = '0'; + do { + const [next, keys] = await observer.scan( + cursor, + 'MATCH', + `${prefix}:*`, + 'COUNT', + 100, + ); + cursor = next; + if (keys.length) await observer.del(...keys); + } while (cursor !== '0'); + } finally { + observer.disconnect(); + if (previous === undefined) delete process.env.CACHE_PREFIX; + else process.env.CACHE_PREFIX = previous; + } + }); + return { prefix, observer }; +} + +test('Redis cache: hits, expiry, invalidation race and unavailable-server fallback', async (t) => { + await isolatedCache(t); + const cache = new CacheService(); + t.after(() => cache.onModuleDestroy()); + await cache.onModuleInit(); + let reads = 0; + const load = async () => ({ value: ++reads }); + assert.deepEqual(await cache.remember('hits', 'page', 30, load), { + value: 1, + }); + assert.deepEqual(await cache.remember('hits', 'page', 30, load), { + value: 1, + }); + assert.equal(reads, 1); + assert.deepEqual(await cache.remember('expiry', 'page', 1, load), { + value: 2, + }); + await new Promise((resolve) => setTimeout(resolve, 1100)); + assert.deepEqual(await cache.remember('expiry', 'page', 1, load), { + value: 3, + }); + await cache.invalidate('expiry'); + assert.deepEqual(await cache.remember('expiry', 'page', 1, load), { + value: 4, + }); + + let resolveOld; + let began; + const started = new Promise((resolve) => { + began = resolve; + }); + const pending = cache.remember('race', 'page', 30, () => { + began(); + return new Promise((resolve) => { + resolveOld = resolve; + }); + }); + await started; + await cache.invalidate('race'); + resolveOld({ value: 'old' }); + await pending; + assert.deepEqual( + await cache.remember('race', 'page', 30, async () => ({ value: 'new' })), + { value: 'new' }, + ); + assert.deepEqual( + await cache.remember('race', 'page', 30, async () => { + throw new Error('cache miss'); + }), + { value: 'new' }, + ); + await assert.rejects( + cache.remember('db-error', 'page', 30, async () => { + throw new Error('database failure'); + }), + /database failure/, + ); + + const previous = process.env.CACHE_URL; + process.env.CACHE_URL = 'redis://127.0.0.1:1/0'; + const offline = new CacheService(); + process.env.CACHE_URL = previous; + t.after(() => offline.onModuleDestroy()); + await offline.onModuleInit(); + assert.deepEqual( + await offline.remember('offline', 'page', 30, async () => ({ + value: 'database', + })), + { value: 'database' }, + ); + await offline.invalidate('offline'); +}); + +test('API cache: fewer SQL reads, write invalidation, permissions, logout and Redis fallback', async (t) => { + assert.ok(process.env.DATABASE_URL); + const { prefix, observer } = await isolatedCache(t); + const app = await NestFactory.create(AppModule, createFastifyAdapter(), { + logger: false, + abortOnError: false, + }); + exposeRequestIdHeader(app); + await app.init(); + const server = app.getHttpAdapter().getInstance(); + await server.ready(); + const prisma = app.get(PrismaService); + const userIds = []; + const chatIds = []; + t.after(async () => { + try { + await prisma.chat.deleteMany({ where: { id: { in: chatIds } } }); + await prisma.user.deleteMany({ where: { id: { in: userIds } } }); + } finally { + await app.close(); + } + }); + const actors = []; + for (let i = 0; i < 2; i++) { + const user = await prisma.user.create({ + data: { + username: `cache_${randomUUID().replaceAll('-', '').slice(0, 20)}`, + displayName: 'Cache test', + }, + }); + userIds.push(user.id); + const token = randomBytes(32).toString('base64url'); + const session = await prisma.session.create({ + data: { + userId: user.id, + tokenHash: createHash('sha256').update(token).digest('hex'), + expiresAt: new Date(Date.now() + 600000), + }, + }); + actors.push({ id: user.id, token, sessionId: session.id }); + } + const [alice, outsider] = actors; + const request = (method, url, payload, actor = alice) => + server.inject({ + method, + url, + headers: { authorization: `Bearer ${actor.token}` }, + ...(payload === undefined ? {} : { payload }), + }); + const counts = new Map(); + const tracked = prisma.$extends({ + query: { + $allModels: { + $allOperations({ model, operation, args, query }) { + const key = `${model}:${operation}`; + counts.set(key, (counts.get(key) ?? 0) + 1); + return query(args); + }, + }, + }, + }); + for (const name of [ + 'User/user.service', + 'Chat/chat.service', + 'Auth/auth.service', + ]) { + const exported = require(`../dist/${name}`); + const Service = Object.values(exported)[0]; + app.get(Service).prisma = tracked; + } + const spy = (model, operation) => ({ + mock: { callCount: () => counts.get(`${model}:${operation}`) ?? 0 }, + }); + const profileReads = spy('User', 'findUnique'); + assert.equal((await request('GET', '/api/v1/users/me')).statusCode, 200); + assert.equal((await request('GET', '/api/v1/users/me')).statusCode, 200); + assert.equal(profileReads.mock.callCount(), 0); + + const chatListReads = spy('Chat', 'findMany'); + assert.equal((await request('GET', '/api/v1/chats')).json().items.length, 0); + assert.equal((await request('GET', '/api/v1/chats')).json().items.length, 0); + assert.equal(chatListReads.mock.callCount(), 1); + const created = await request('POST', '/api/v1/chats', { + title: 'Cached chat', + member_ids: [alice.id], + }); + assert.equal(created.statusCode, 201); + const chatId = created.json().id; + chatIds.push(chatId); + assert.deepEqual( + (await request('GET', '/api/v1/chats')).json().items.map((x) => x.id), + [chatId], + ); + assert.equal(chatListReads.mock.callCount(), 2); + + const metadataReads = spy('Chat', 'findUnique'); + const messageReads = spy('Message', 'findMany'); + const path = `/api/v1/chats/${chatId}/messages`; + assert.equal((await request('GET', path)).json().items.length, 0); + assert.equal((await request('GET', path)).json().items.length, 0); + assert.equal(metadataReads.mock.callCount(), 0); + assert.equal(messageReads.mock.callCount(), 1); + const message = await request('POST', path, { + text: 'Invalidate cached empty history', + }); + assert.equal(message.statusCode, 201); + assert.deepEqual( + (await request('GET', path)).json().items.map((x) => x.id), + [message.json().id], + ); + assert.equal(messageReads.mock.callCount(), 2); + assert.equal( + (await request('GET', path, undefined, outsider)).statusCode, + 404, + ); + await prisma.chatMember.delete({ + where: { chatId_userId: { chatId, userId: alice.id } }, + }); + assert.equal((await request('GET', path)).statusCode, 404); + await prisma.chatMember.create({ + data: { chatId, userId: alice.id, position: 0 }, + }); + await prisma.session.update({ + where: { id: outsider.sessionId }, + data: { revokedAt: new Date() }, + }); + assert.equal( + (await request('GET', '/api/v1/users/me', undefined, outsider)).statusCode, + 401, + ); + + const keys = []; + let cursor = '0'; + do { + const [next, batch] = await observer.scan( + cursor, + 'MATCH', + `${prefix}:*`, + 'COUNT', + 100, + ); + cursor = next; + keys.push(...batch); + } while (cursor !== '0'); + assert.ok(keys.length >= 4, 'Redis must contain the cached responses'); + for (const key of keys) { + const value = await observer.get(key); + assert.ok( + !value.includes('password_hash') && !value.includes('passwordHash'), + ); + for (const actor of actors) assert.ok(!value.includes(actor.token)); + } + app.get(CacheService).onModuleDestroy(); + assert.equal((await request('GET', path)).statusCode, 200); + assert.equal(messageReads.mock.callCount(), 3); + assert.equal( + (await request('POST', path, { text: 'Write while Redis is unavailable' })) + .statusCode, + 201, + ); + assert.equal((await request('GET', path)).json().items.length, 2); +}); diff --git a/test/compose.benchmark.yaml b/test/compose.benchmark.yaml new file mode 100644 index 00000000..445d2d53 --- /dev/null +++ b/test/compose.benchmark.yaml @@ -0,0 +1,12 @@ +services: + benchmark: + image: ${BENCHMARK_IMAGE:-mtusi2026lab2-fork-backend} + working_dir: /app + environment: + NODE_ENV: production + DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-local_dev_password}@postgres:5432/${POSTGRES_DB:-chat} + CACHE_URL: redis://redis:6379/0 + volumes: + - ./test:/app/test:ro + - ./evidence:/results + command: ['node', 'test/cache-benchmark.mjs', '${BENCHMARK_STAGE:-after}', '/results/cache-epochs-${BENCHMARK_STAGE:-after}.json'] diff --git a/test/epoch-variants-benchmark.mjs b/test/epoch-variants-benchmark.mjs new file mode 100644 index 00000000..52dbb55b --- /dev/null +++ b/test/epoch-variants-benchmark.mjs @@ -0,0 +1,475 @@ +import assert from 'node:assert/strict'; +import { createHash, randomBytes, randomUUID } from 'node:crypto'; +import { createRequire } from 'node:module'; +import Module from 'node:module'; +import { readFile, writeFile } from 'node:fs/promises'; +import { performance } from 'node:perf_hooks'; +import { faultProxy } from './helpers/fault-proxy.mjs'; + +const require = createRequire('/app/package.json'); +const manifest = JSON.parse(await readFile('/variants/manifest.json', 'utf8')); +const pg = require('pg'); +let counts = {}; +const originalQuery = pg.Client.prototype.query; +pg.Client.prototype.query = function (query, ...args) { + const sql = typeof query === 'string' ? query : query.text; + const verb = sql.trim().split(/\s+/)[0].toUpperCase(); + counts[verb] = (counts[verb] ?? 0) + 1; + return originalQuery.call(this, query, ...args); +}; +const { NestFactory } = require('@nestjs/core'); +const { AppModule } = require('/app/dist/app.module'); +const { PrismaService } = require('/app/dist/prisma/prisma.service'); +const { CacheService } = require('/app/dist/cache/cache.service'); +const { ChatService } = require('/app/dist/Chat/chat.service'); +const { + createFastifyAdapter, + exposeRequestIdHeader, +} = require('/app/dist/common/http/fastify-adapter'); +const exportedClasses = { + 'Auth/auth.service.ts': 'AuthService', + 'User/user.service.ts': 'UserService', + 'User/user.guard.ts': 'UserGuard', + 'Chat/chat.service.ts': 'ChatService', + 'Chat/chat.controller.ts': 'ChatController', +}; +const originals = {}; +const variants = {}; +for (const [relative, name] of Object.entries(exportedClasses)) { + const filename = `/app/dist/${relative.replace(/\.ts$/, '.js')}`; + originals[name] = require(filename)[name]; +} +for (const variant of manifest.variants) { + variants[variant.name] = {}; + for (const [relative, name] of Object.entries(exportedClasses)) { + const filename = `/app/dist/${relative.replace(/\.ts$/, '.js')}`; + const source = await readFile( + `/variants/${variant.name}/${relative.replace(/\.ts$/, '.js')}`, + 'utf8', + ); + const loaded = new Module(filename); + loaded.filename = filename; + loaded.paths = Module._nodeModulePaths('/app'); + loaded._compile(source, filename); + variants[variant.name][name] = loaded.exports[name]; + } +} +function activate(name) { + for (const [className, replacement] of Object.entries(variants[name])) { + const target = originals[className].prototype; + for (const method of Object.getOwnPropertyNames(replacement.prototype)) { + if (method === 'constructor') continue; + const descriptor = Object.getOwnPropertyDescriptor( + replacement.prototype, + method, + ); + const previous = target[method]; + if ( + typeof descriptor.value === 'function' && + typeof previous === 'function' + ) { + for (const key of Reflect.getMetadataKeys(previous)) + Reflect.defineMetadata( + key, + Reflect.getMetadata(key, previous), + descriptor.value, + ); + } + Object.defineProperty(target, method, descriptor); + } + } +} + +const Redis = require('ioredis').default; +const prefix = `experiment:epoch-variants:${randomUUID()}`; +const proxy = await faultProxy(process.env.CACHE_URL, 6379); +const observer = new Redis(process.env.CACHE_URL); +process.env.CACHE_URL = proxy.url; +const apps = {}; +const chatIds = []; +const userIds = []; +let prisma, token; +const report = { + recorded_at: new Date().toISOString(), + methodology: { + concurrency: 32, + duration_seconds: 60, + warmup_seconds: 10, + repetitions: 3, + seed_messages: 100000, + writes_per_repeat: 4096, + order: [ + ['baseline', 'profile-join', 'access-join', 'striped'], + ['striped', 'access-join', 'profile-join', 'baseline'], + ['profile-join', 'striped', 'baseline', 'access-join'], + ], + requests: + 'Real loopback HTTP; shared read fixtures, separate write chats and cache prefixes', + resources: + 'Four idle/active API instances and HTTP generator share one Node process; only one workload active at a time', + sql: 'pg.Client.query; transaction-control commands excluded; no changes to database pool size', + }, + variants: manifest.variants, + samples: [], + correctness: {}, + completed: false, +}; +const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); + +async function request(name, method, url, body, bearer = token) { + const response = await fetch(`${apps[name].url}${url}`, { + method, + headers: { + authorization: `Bearer ${bearer}`, + ...(body ? { 'content-type': 'application/json' } : {}), + }, + ...(body ? { body: JSON.stringify(body) } : {}), + signal: AbortSignal.timeout(10000), + }); + const json = await response.json(); + return { status: response.status, json }; +} +async function call(name, method, url, body) { + const result = await request(name, method, url, body); + assert.equal(result.status, method === 'POST' ? 201 : 200); + return result.json; +} +async function clearCache() { + let cursor = '0'; + do { + const [next, keys] = await observer.scan( + cursor, + 'MATCH', + `${prefix}:*`, + 'COUNT', + 100, + ); + cursor = next; + if (keys.length) await observer.del(...keys); + } while (cursor !== '0'); +} +async function newChat(userId) { + const chat = await prisma.chat.create({ + data: { + title: 'Variant benchmark', + members: { create: { userId, position: 0 } }, + }, + }); + chatIds.push(chat.id); + return chat.id; +} +async function epoch(name, chatId) { + if (name !== 'striped') + return (await prisma.chat.findUniqueOrThrow({ where: { id: chatId } })) + .messagesEpoch; + const [row] = await prisma.$queryRawUnsafe( + `SELECT COALESCE(SUM(epoch), 0)::bigint AS epoch FROM "${manifest.schema}".chat_message_epochs WHERE chat_id = $1::uuid`, + chatId, + ); + return row.epoch; +} +async function measure(name, workload, repeat, operation, total) { + counts = {}; + const latencies = []; + let errors = 0, + index = 0; + const cpu = process.cpuUsage(); + const start = performance.now(); + await Promise.all( + Array.from({ length: 32 }, async () => { + while ( + total === undefined ? performance.now() - start < 60000 : index < total + ) { + const item = index++; + const began = performance.now(); + try { + await operation(item); + latencies.push(performance.now() - began); + } catch { + errors++; + } + } + }), + ); + const seconds = (performance.now() - start) / 1000; + const used = process.cpuUsage(cpu); + latencies.sort((a, b) => a - b); + const calls = { ...counts }; + const queries = Object.entries(calls) + .filter(([verb]) => !['BEGIN', 'COMMIT', 'ROLLBACK', 'SET'].includes(verb)) + .reduce((sum, [, count]) => sum + count, 0); + const sample = { + variant: name, + workload, + repeat, + successes: latencies.length, + errors, + elapsed_seconds: +seconds.toFixed(3), + rps: +(latencies.length / seconds).toFixed(3), + mean_latency_ms: +( + latencies.reduce((sum, value) => sum + value, 0) / latencies.length + ).toFixed(3), + p95_ms: +latencies[Math.ceil(latencies.length * 0.95) - 1]?.toFixed(3), + sql_queries: queries, + sql_per_request: +(queries / (latencies.length + errors)).toFixed(4), + sql_calls: calls, + cpu_percent_one_core: +( + (used.user + used.system) / + (seconds * 10000) + ).toFixed(2), + rss_mib: +(process.memoryUsage().rss / 1048576).toFixed(2), + }; + report.samples.push(sample); + console.log(JSON.stringify(sample)); + assert.equal(errors, 0, 'HTTP workload errors'); +} +async function reconnect() { + proxy.setMode('online'); + for (let attempt = 0; attempt < 80; attempt++) { + if ( + Object.values(apps).every( + ({ app }) => app.get(CacheService).redis.status === 'ready', + ) + ) + return; + await pause(100); + } + assert.fail('Redis reconnect timeout'); +} +async function correctness(name, userId, otherToken) { + activate(name); + await clearCache(); + const replica = Object.keys(apps).find((candidate) => candidate !== name); + const chatId = await newChat(userId); + const url = `/api/v1/chats/${chatId}/messages`; + assert.equal( + ( + await request( + name, + 'GET', + url, + undefined, + randomBytes(32).toString('base64url'), + ) + ).status, + 401, + ); + assert.equal( + (await request(name, 'GET', url, undefined, otherToken)).status, + 404, + ); + assert.equal( + (await request(name, 'POST', url, { text: 'Forbidden' }, otherToken)) + .status, + 404, + ); + assert.equal( + (await request(name, 'GET', '/api/v1/chats/invalid/messages')).status, + 400, + ); + assert.equal( + ( + await request( + name, + 'GET', + '/api/v1/chats/invalid/messages', + undefined, + randomBytes(32).toString('base64url'), + ) + ).status, + 401, + ); + assert.equal((await call(replica, 'GET', url)).items.length, 0); + const keys = await observer.keys(`${prefix}:${replica}:messages:${chatId}:*`); + assert.ok(keys.length); + proxy.setMode('cut'); + await pause(100); + const posted = await call(name, 'POST', url, { text: 'During outage' }); + assert.equal((await call(replica, 'GET', url)).items[0].id, posted.id); + await reconnect(); + assert.equal(await observer.exists(...keys), keys.length); + assert.equal((await call(replica, 'GET', url)).items[0].id, posted.id); + const service = apps[name].app.get(ChatService); + const actual = service.prisma; + service.prisma = actual.$extends({ + query: { + $queryRaw({ args, query }) { + const index = args.values.indexOf('Must roll back'); + if (index !== -1) args.values[index] = 'x'.repeat(4001); + return query(args); + }, + }, + }); + try { + assert.equal( + (await request(name, 'POST', url, { text: 'Must roll back' })).status, + 500, + ); + } finally { + service.prisma = actual; + } + assert.equal(await epoch(name, chatId), 1n); + assert.equal(await prisma.message.count({ where: { chatId } }), 1); + const raceChat = await newChat(userId); + const raceUrl = `/api/v1/chats/${raceChat}/messages`; + let began, release; + const started = new Promise((resolve) => { + began = resolve; + }); + const held = new Promise((resolve) => { + release = resolve; + }); + service.prisma = actual.$extends({ + query: { + message: { + async findMany({ args, query }) { + const rows = await query(args); + if (args.where?.chatId === raceChat) { + began(); + await held; + } + return rows; + }, + }, + }, + }); + const pending = call(name, 'GET', raceUrl); + try { + await Promise.race([ + started, + pause(10000).then(() => { + throw new Error('Race load timeout'); + }), + ]); + const fresh = await call(replica, 'POST', raceUrl, { + text: 'After old SELECT', + }); + release(); + await pending; + assert.equal((await call(name, 'GET', raceUrl)).items[0].id, fresh.id); + } finally { + release(); + service.prisma = actual; + } + await clearCache(); + assert.equal((await call(name, 'GET', url)).items[0].id, posted.id); + report.correctness[name] = { + access_statuses: true, + redis_outage_and_retained_keys: true, + rollback: true, + delayed_old_fill: true, + empty_cache: true, + }; + console.log(JSON.stringify({ correctness: name, result: 'PASS' })); +} + +try { + for (const variant of manifest.variants) { + activate(variant.name); + process.env.CACHE_PREFIX = `${prefix}:${variant.name}`; + const app = await NestFactory.create(AppModule, createFastifyAdapter(), { + logger: false, + abortOnError: false, + }); + apps[variant.name] = { app }; + exposeRequestIdHeader(app); + await app.listen(0, '127.0.0.1'); + require('nestjs-pino').PinoLogger.root.level = 'silent'; + apps[variant.name].url = await app.getUrl(); + } + prisma = apps.baseline.app.get(PrismaService); + const user = await prisma.user.create({ + data: { + username: `variant_${randomUUID().replaceAll('-', '').slice(0, 20)}`, + displayName: 'Variant user', + }, + }); + userIds.push(user.id); + token = randomBytes(32).toString('base64url'); + await prisma.session.create({ + data: { + userId: user.id, + tokenHash: createHash('sha256').update(token).digest('hex'), + expiresAt: new Date(Date.now() + 3600000), + }, + }); + const other = await prisma.user.create({ + data: { + username: `other_${randomUUID().replaceAll('-', '').slice(0, 20)}`, + displayName: 'Other user', + }, + }); + userIds.push(other.id); + const otherToken = randomBytes(32).toString('base64url'); + await prisma.session.create({ + data: { + userId: other.id, + tokenHash: createHash('sha256').update(otherToken).digest('hex'), + expiresAt: new Date(Date.now() + 3600000), + }, + }); + for (const name of Object.keys(apps)) + await correctness(name, user.id, otherToken); + const readChat = await newChat(user.id); + for (let offset = 0; offset < 100000; offset += 1000) { + await prisma.message.createMany({ + data: Array.from({ length: 1000 }, (_, i) => ({ + chatId: readChat, + senderId: user.id, + text: `Synthetic message ${offset + i}`, + createdAt: new Date(1700000000000 + offset + i), + })), + }); + } + await prisma.chat.update({ where: { id: readChat }, data: { messagesEpoch: 100000n } }); + await prisma.$executeRawUnsafe(`INSERT INTO "${manifest.schema}".chat_message_epochs (chat_id, bucket, epoch) SELECT $1::uuid, bucket::smallint, 6250 FROM generate_series(0, 15) AS bucket ON CONFLICT (chat_id, bucket) DO UPDATE SET epoch = EXCLUDED.epoch`, readChat); + for (const [index, order] of report.methodology.order.entries()) { + for (const name of order) { + activate(name); + await clearCache(); + const url = `/api/v1/chats/${readChat}/messages?limit=50`; + const warmUntil = performance.now() + 10000; + while (performance.now() < warmUntil) await call(name, 'GET', url); + await measure(name, 'warm-history', index + 1, () => + call(name, 'GET', url), + ); + const writeChat = await newChat(user.id); + const writeUrl = `/api/v1/chats/${writeChat}/messages`; + assert.equal((await call(name, 'GET', writeUrl)).items.length, 0); + await measure( + name, + 'writes-single-chat', + index + 1, + (i) => call(name, 'POST', writeUrl, { text: `Concurrent ${i}` }), + 4096, + ); + assert.equal( + await prisma.message.count({ where: { chatId: writeChat } }), + 4096, + ); + assert.equal(await epoch(name, writeChat), 4096n); + assert.equal((await call(name, 'GET', writeUrl)).items.length, 50); + } + } + report.completed = true; +} finally { + await reconnect(); + if (prisma) { + await prisma.chat.deleteMany({ where: { id: { in: chatIds } } }); + await prisma.user.deleteMany({ where: { id: { in: userIds } } }); + } + await clearCache(); + for (const { app } of Object.values(apps)) await app.close(); + observer.disconnect(); + await proxy.close(); + await writeFile( + '/results/epoch-variants.json', + JSON.stringify(report, null, 2) + '\n', + ); +} +console.log( + JSON.stringify({ + completed: report.completed, + correctness: report.correctness, + }), +); diff --git a/test/epoch-variants-experiment.cjs b/test/epoch-variants-experiment.cjs new file mode 100644 index 00000000..77fed41b --- /dev/null +++ b/test/epoch-variants-experiment.cjs @@ -0,0 +1,261 @@ +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const os = require('node:os'); +const path = require('node:path'); +const { randomUUID, createHash } = require('node:crypto'); +const { spawn } = require('node:child_process'); +const ts = require('typescript'); +require('dotenv').config({ quiet: true }); + +const root = path.resolve(__dirname, '..'); +const statePath = path.join(root, '.epoch-variants-state.json'); +const files = [ + 'Auth/auth.service.ts', + 'User/user.service.ts', + 'User/user.guard.ts', + 'Chat/chat.service.ts', + 'Chat/chat.controller.ts', +]; +const digest = (value) => createHash('sha256').update(value).digest('hex'); +const command = process.argv[2]; + +async function main() { + let state; + if (command === 'init') { + assert.ok(!fs.existsSync(statePath)); + assert.ok( + /messagesEpoch\s+BigInt/.test( + fs.readFileSync(path.join(root, 'prisma/schema.prisma'), 'utf8'), + ), + 'Historical comparison requires the pre-bucket schema. Original sources are saved in evidence/epoch-variants-sources.json', + ); + state = { + directory: fs.mkdtempSync(path.join(os.tmpdir(), 'lab2-epoch-variants-')), + schema: 'epoch_variants_' + randomUUID().replaceAll('-', ''), + variants: [], + }; + await database(async (client) => { + await client.query(`CREATE SCHEMA "${state.schema}"`); + await client.query( + `CREATE TABLE "${state.schema}".chat_message_epochs (chat_id uuid NOT NULL REFERENCES public.chats(id) ON DELETE CASCADE, bucket smallint NOT NULL CHECK (bucket BETWEEN 0 AND 15), epoch bigint NOT NULL DEFAULT 0, PRIMARY KEY (chat_id, bucket))`, + ); + }); + capture(state, 'baseline'); + } else { + state = JSON.parse(fs.readFileSync(statePath, 'utf8')); + } + if (command === 'capture') capture(state, process.argv[3]); + if (command === 'capture-striped') capture(state, 'striped', true); + if (command === 'apply-striped') { + const sources = {}; + for (const variant of state.variants) { + sources[variant.name] = Object.fromEntries( + files.map((relative) => [ + relative, + fs.readFileSync( + path.join(state.directory, variant.name, relative), + 'utf8', + ), + ]), + ); + } + fs.writeFileSync( + path.join(root, 'evidence/epoch-variants-sources.json'), + JSON.stringify(sources, null, 2) + '\n', + ); + for (const relative of ['Auth/auth.service.ts', 'Chat/chat.service.ts']) { + const source = sources.striped[relative].replaceAll( + `"${state.schema}".chat_message_epochs`, + '"public"."chat_message_epochs"', + ); + fs.writeFileSync(path.join(root, 'src', relative), source); + } + console.log( + 'Applied striped epochs to application sources; saved all source snapshots', + ); + } + if (['init', 'capture', 'capture-striped'].includes(command)) { + fs.writeFileSync(statePath, JSON.stringify(state, null, 2)); + console.log( + 'Captured:', + state.variants.map((variant) => variant.name).join(', '), + ); + return; + } + if (command === 'run') { + assert.equal(state.variants.length, 4); + fs.writeFileSync( + path.join(state.directory, 'manifest.json'), + JSON.stringify(state, null, 2), + ); + const override = path.join(state.directory, 'compose.json'); + fs.writeFileSync( + override, + JSON.stringify({ + services: { + benchmark: { + volumes: [ + { + type: 'bind', + source: state.directory, + target: '/variants', + read_only: true, + }, + ], + }, + }, + }), + ); + const args = [ + 'compose', + '-f', + 'compose.yaml', + '-f', + 'test/compose.benchmark.yaml', + '-f', + override, + 'run', + '--rm', + '--no-deps', + '--pull', + 'never', + 'benchmark', + 'node', + 'test/epoch-variants-benchmark.mjs', + ]; + const code = await new Promise((resolve, reject) => { + const child = spawn('docker', args, { cwd: root, stdio: 'inherit' }); + child.once('error', reject); + child.once('exit', resolve); + }); + fs.writeFileSync( + path.join(root, 'evidence/epoch-variants-code.json'), + JSON.stringify( + { + variants: state.variants, + schema: state.schema, + exit_code: code, + implementation: + 'TypeScript source snapshots; variant methods activated sequentially before HTTP workloads. Separate cache prefixes and API instances, shared fixtures and Node process.', + }, + null, + 2, + ), + ); + process.exitCode = code ?? 1; + } + if (command === 'seed-read-fixture') { + await database(async (client) => { + const result = await client.query( + `SELECT c.id FROM public.chats c JOIN public.messages m ON m.chat_id = c.id WHERE c.title = 'Variant benchmark' GROUP BY c.id HAVING COUNT(*) = 100000`, + ); + assert.equal(result.rows.length, 1); + const chatId = result.rows[0].id; + await client.query( + 'UPDATE public.chats SET messages_epoch = 100000 WHERE id = $1::uuid', + [chatId], + ); + await client.query( + `INSERT INTO "${state.schema}".chat_message_epochs (chat_id, bucket, epoch) SELECT $1::uuid, bucket::smallint, 6250 FROM generate_series(0, 15) AS bucket ON CONFLICT (chat_id, bucket) DO UPDATE SET epoch = EXCLUDED.epoch`, + [chatId], + ); + console.log('Seeded read fixture with 16 nonzero epoch buckets'); + }); + } + if (command === 'cleanup') { + await database((client) => + client.query(`DROP SCHEMA "${state.schema}" CASCADE`), + ); + const resolved = path.resolve(state.directory); + assert.equal(path.dirname(resolved), path.resolve(os.tmpdir())); + assert.ok(path.basename(resolved).startsWith('lab2-epoch-variants-')); + fs.rmSync(resolved, { recursive: true, force: true }); + fs.unlinkSync(statePath); + console.log('Removed experiment schema and temporary source snapshots'); + } +} + +function capture(state, name, striped = false) { + assert.match(name, /^[a-z-]+$/); + assert.ok(!state.variants.some((variant) => variant.name === name)); + const modules = {}; + const table = `"${state.schema}".chat_message_epochs`; + for (const relative of files) { + let source = fs + .readFileSync(path.join(root, 'src', relative), 'utf8') + .replace(/\r\n/g, '\n'); + if ( + striped && + ['Auth/auth.service.ts', 'Chat/chat.service.ts'].includes(relative) + ) { + source = source.replaceAll( + 'c.messages_epoch', + `COALESCE((SELECT SUM(e.epoch) FROM ${table} AS e WHERE e.chat_id = c.id), 0)::bigint`, + ); + if (relative === 'Chat/chat.service.ts') { + const start = source.indexOf(' const [message] ='); + const end = source.indexOf(' if (!message)', start); + assert.ok(start !== -1 && end > start); + source = + source.slice(0, start) + + ' const messageId = randomUUID();\n' + + ' const bucket = parseInt(messageId.slice(0, 2), 16) % 16;\n' + + ' const [message] = await this.prisma.$queryRaw(Prisma.sql`\n' + + ` WITH updated AS (\n INSERT INTO ${table} AS e (chat_id, bucket, epoch)\n` + + ' SELECT cm.chat_id, ${bucket}::smallint, 1 FROM chat_members AS cm\n' + + ' WHERE cm.chat_id = ${id}::uuid AND cm.user_id = ${userId}::uuid\n' + + ' ON CONFLICT (chat_id, bucket) DO UPDATE SET epoch = e.epoch + 1\n' + + ' RETURNING chat_id\n )\n' + + ' INSERT INTO messages (id, chat_id, sender_id, text)\n' + + ' SELECT ${messageId}::uuid, updated.chat_id, ${userId}::uuid, ${text} FROM updated\n' + + ' RETURNING id, chat_id AS "chatId", sender_id AS "senderId", text, created_at AS "createdAt"\n' + + ' `);\n' + + source.slice(end); + } + } + const compiled = ts.transpileModule(source, { + compilerOptions: { + target: ts.ScriptTarget.ES2023, + module: ts.ModuleKind.CommonJS, + experimentalDecorators: true, + emitDecoratorMetadata: true, + }, + reportDiagnostics: true, + }); + assert.ok( + !compiled.diagnostics.some( + (diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error, + ), + ); + const destination = path.join( + state.directory, + name, + relative.replace(/\.ts$/, '.js'), + ); + fs.mkdirSync(path.dirname(destination), { recursive: true }); + fs.writeFileSync(destination, compiled.outputText); + fs.writeFileSync(destination.replace(/\.js$/, '.ts'), source); + modules[relative] = { + source_sha256: digest(source), + js_sha256: digest(compiled.outputText), + }; + } + state.variants.push({ name, modules, striped }); +} + +async function database(operation) { + const client = new (require('pg').Client)({ + connectionString: process.env.DATABASE_URL, + }); + await client.connect(); + try { + return await operation(client); + } finally { + await client.end(); + } +} + +main().catch((error) => { + console.error(error.message); + process.exitCode = 1; +}); diff --git a/test/epoch-variants-summary.mjs b/test/epoch-variants-summary.mjs new file mode 100644 index 00000000..4055449c --- /dev/null +++ b/test/epoch-variants-summary.mjs @@ -0,0 +1,72 @@ +import assert from 'node:assert/strict'; +import { readFile, writeFile } from 'node:fs/promises'; + +const report = JSON.parse( + await readFile('evidence/epoch-variants.json', 'utf8'), +); +assert.ok(report.completed); +const labels = { + baseline: 'Текущая схема', + 'profile-join': 'Профиль из JOIN', + 'access-join': 'Профиль + единая проверка доступа', + striped: 'Единая проверка + 16 счётчиков', +}; +const aggregates = []; +const lines = [ + '# Сравнение трёх оптимизаций эпох и текущей схемы', + '', + `Дата UTC: ${report.recorded_at}.`, + '', + 'Все режимы используют Redis. Варианты последовательно добавляют оптимизации: профиль из запроса сессии; объединённую проверку сессии, членства и эпохи; 16 счётчиков истории, увеличиваемых независимо, с суммой как версией кэша. Порядок вариантов меняется между тремя повторами. Чтения: 100 000 сообщений, limit=50, конкурентность 32, прогрев 10 с, измерение 60 с. Запись: 4096 сообщений в отдельный новый чат на вариант/повтор. Только один workload активен одновременно.', + '', + 'RPS рассчитан по общему числу успешных запросов и времени повторов. Средняя задержка взвешена по числу запросов. p95 — среднее p95 отдельных повторов, а не перцентиль объединённой выборки. SQL/HTTP исключает BEGIN/COMMIT/ROLLBACK/SET.', + '', + '| Сценарий | Вариант | Средний RPS | Средняя задержка, мс | Среднее p95, мс | SQL/HTTP | RPS по повторам | Ошибки |', + '| --- | --- | ---: | ---: | ---: | ---: | --- | ---: |', +]; +for (const workload of ['warm-history', 'writes-single-chat']) { + for (const [name, label] of Object.entries(labels)) { + const samples = report.samples.filter( + (sample) => sample.variant === name && sample.workload === workload, + ); + assert.equal(samples.length, 3); + const sum = (select) => + samples.reduce((total, sample) => total + select(sample), 0); + const successes = sum((sample) => sample.successes); + const errors = sum((sample) => sample.errors); + const aggregate = { + variant: name, + workload, + successes, + errors, + rps: successes / sum((sample) => sample.elapsed_seconds), + mean_latency_ms: + sum((sample) => sample.mean_latency_ms * sample.successes) / successes, + mean_p95_ms: sum((sample) => sample.p95_ms) / samples.length, + sql_per_request: + sum((sample) => sample.sql_queries) / (successes + errors), + repeat_rps: samples.map((sample) => sample.rps), + }; + aggregates.push(aggregate); + lines.push( + `| ${workload} | ${label} | ${aggregate.rps.toFixed(3)} | ${aggregate.mean_latency_ms.toFixed(3)} | ${aggregate.mean_p95_ms.toFixed(3)} | ${aggregate.sql_per_request.toFixed(3)} | ${aggregate.repeat_rps.map((value) => value.toFixed(1)).join(' / ')} | ${errors} |`, + ); + assert.ok(Object.values(report.correctness[name]).every(Boolean)); + } +} +lines.push( + '', + 'Все варианты прошли проверки 401/404/400, доступа постороннего пользователя, чтения после записи при недоступном Redis и после восстановления со старыми ключами, отката счётчика при ошибке INSERT, задержанного заполнения старого кэша и работы с пустым кэшем. После каждого нагрузочного блока проверены число сообщений и значение эпохи 4096.', + '', + 'Четыре API и HTTP-генератор работают в одном Node-процессе, каждый API имеет отдельный Redis-prefix и пул Prisma прежнего размера. Методы переключаются между скомпилированными снимками исходников перед каждым workload; скрипт сохраняет метаданные маршрутов. Idle-экземпляры присутствуют во всех режимах. CPU/RSS включает генератор и все экземпляры. Другие сервисы Docker-host продолжают работать. Сессии создаются напрямую, KDF не измеряется. Порядок меняется, но три повтора и фоновые нагрузки всё ещё ограничивают выводы об устойчивых коэффициентах ускорения.', + '', + 'Распределённые счётчики находятся в отдельной временной схеме. Рабочая схема приложения не переключается на них. В нагрузочном чате 16 ненулевых счётчиков; стоимость их суммирования входит в запрос доступа. Первое чтение baseline выполнено до заполнения счётчиков временной схемы; данные истории неизменны, счётчики подготовлены до первого измерения striped. Это изменение подготовки фикстуры добавлено в скрипт для следующих запусков.', + '', + 'Сырые результаты: [epoch-variants.json](epoch-variants.json). Хеши исходников вариантов: [epoch-variants-code.json](epoch-variants-code.json).', +); +await writeFile('evidence/epoch-variants-summary.md', lines.join('\n') + '\n'); +await writeFile( + 'evidence/epoch-variants-averages.json', + JSON.stringify(aggregates, null, 2) + '\n', +); +console.log(lines.slice(0, 19).join('\n')); diff --git a/test/explain-history.mjs b/test/explain-history.mjs new file mode 100644 index 00000000..f2560fa0 --- /dev/null +++ b/test/explain-history.mjs @@ -0,0 +1,195 @@ +import 'dotenv/config'; +import assert from 'node:assert/strict'; +import { createHash, randomUUID } from 'node:crypto'; +import { mkdir, writeFile } from 'node:fs/promises'; +import { createRequire } from 'node:module'; +import { resolve } from 'node:path'; +import { spawnSync } from 'node:child_process'; + +const require = createRequire(import.meta.url); +const { Client } = require('pg'); +assert.ok(process.env.DATABASE_URL, 'Set DATABASE_URL for the project PostgreSQL'); +const output = resolve('evidence'); +const schema = `explain_history_${randomUUID().replaceAll('-', '')}`; +const table = `"${schema}"."messages"`; +const client = new Client({ + connectionString: process.env.DATABASE_URL, + connectionTimeoutMillis: 5000, + query_timeout: 60000, + options: '-c statement_timeout=60000 -c lock_timeout=2000', +}); +const seed = ` +WITH base AS ( + SELECT n, CASE WHEN (n - 1) % 6 < 2 THEN 0 ELSE (n - 1) % 6 - 1 END AS chat_no + FROM generate_series(1, 60000) AS n +), ranked AS ( + SELECT n, chat_no, row_number() OVER (PARTITION BY chat_no ORDER BY n) AS chat_seq + FROM base +) +INSERT INTO ${table} (id, chat_id, sender_id, text, created_at) +SELECT md5('message:' || n)::uuid, md5('chat:' || chat_no)::uuid, + md5('sender:' || (n % 20))::uuid, + rpad('Synthetic message ' || n || ' ', 256, '.'), + '2026-01-01T00:00:00Z'::timestamptz + ((chat_seq - 1) / 10) * interval '1 second' +FROM ranked ORDER BY n`; +const columns = 'id, chat_id, sender_id, text, created_at'; +const firstSql = `SELECT ${columns} FROM ${table} +WHERE chat_id = $1::uuid ORDER BY created_at ASC, id ASC LIMIT $2`; +const orSql = `SELECT ${columns} FROM ${table} +WHERE chat_id = $1::uuid + AND (created_at > $2::timestamptz OR (created_at = $2::timestamptz AND id > $3::uuid)) +ORDER BY created_at ASC, id ASC LIMIT $4`; +const tupleSql = `SELECT ${columns} FROM ${table} +WHERE chat_id = $1::uuid AND (created_at, id) > ($2::timestamptz, $3::uuid) +ORDER BY created_at ASC, id ASC LIMIT $4`; + +function nodes(plan) { + return [plan, ...(plan.Plans ?? []).flatMap(nodes)]; +} + +function median(values) { + const sorted = [...values].sort((a, b) => a - b); + return sorted[Math.floor(sorted.length / 2)]; +} + +function inspectDocker() { + const template = '{"cpus":{{.NCPU}},"memory_bytes":{{.MemTotal}},"server_version":{{json .ServerVersion}},"os":{{json .OperatingSystem}},"arch":{{json .Architecture}}}'; + const result = spawnSync('docker', ['info', '--format', template], { + encoding: 'utf8', timeout: 10000, windowsHide: true, + }); + try { + if (result.status !== 0) return null; + const info = JSON.parse(result.stdout); + const ids = spawnSync('docker', ['compose', 'ps', '--quiet', 'postgres'], { + encoding: 'utf8', timeout: 10000, windowsHide: true, + }); + if (ids.status === 0 && ids.stdout.trim()) { + const limitsTemplate = '{"image":{{json .Config.Image}},"memory_limit_bytes":{{.HostConfig.Memory}},"nano_cpus":{{.HostConfig.NanoCpus}},"cpu_quota":{{.HostConfig.CpuQuota}},"cpu_period":{{.HostConfig.CpuPeriod}},"cpuset_cpus":{{json .HostConfig.CpusetCpus}}}'; + const limits = spawnSync('docker', ['inspect', '--format', limitsTemplate, ids.stdout.trim()], { + encoding: 'utf8', timeout: 10000, windowsHide: true, + }); + if (limits.status === 0) info.postgres_container = JSON.parse(limits.stdout); + } + return info; + } catch { + return null; + } +} + +await client.connect(); +const runs = []; +const raw = []; +const signatures = new Map(); +let metadata; +let queries; +let cleanup = false; +let sourceIndexes; +try { + sourceIndexes = (await client.query("SELECT indexname, indexdef FROM pg_indexes WHERE schemaname = 'public' AND tablename = 'messages' ORDER BY indexname")).rows; + await client.query('BEGIN'); + await client.query(`CREATE SCHEMA "${schema}"`); + await client.query(`CREATE TABLE ${table} (LIKE public.messages INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING STORAGE)`); + await client.query(seed); + await client.query(`ANALYZE ${table}`); + const distribution = (await client.query(`SELECT chat_id, count(*)::integer AS messages FROM ${table} GROUP BY chat_id ORDER BY messages DESC, chat_id`)).rows; + assert.equal(distribution.reduce((sum, row) => sum + row.messages, 0), 60000); + const chatId = distribution.find((row) => row.messages === 20000).chat_id; + const cursor = async (offset) => (await client.query( + `SELECT id, created_at FROM ${table} WHERE chat_id = $1::uuid ORDER BY created_at, id OFFSET $2 LIMIT 1`, + [chatId, offset], + )).rows[0]; + const middle = await cursor(9999); + const late = await cursor(17999); + queries = [ + { name: 'first_page', sql: firstSql, parameters: [chatId, 51] }, + { name: 'middle_page_or', sql: orSql, parameters: [chatId, middle.created_at.toISOString(), middle.id, 51] }, + { name: 'late_page_or', sql: orSql, parameters: [chatId, late.created_at.toISOString(), late.id, 51] }, + { name: 'late_page_tuple', sql: tupleSql, parameters: [chatId, late.created_at.toISOString(), late.id, 51] }, + ]; + const settings = (await client.query( + 'SELECT name, setting, unit FROM pg_settings WHERE name = ANY($1::text[]) ORDER BY name', + [['server_version', 'shared_buffers', 'work_mem', 'random_page_cost', 'effective_cache_size', 'max_parallel_workers_per_gather', 'jit', 'block_size']], + )).rows; + metadata = { + recorded_at: new Date().toISOString(), + command: 'node test/explain-history.mjs', + node_version: process.version, + docker: inspectDocker(), + settings, + source_table_indexes_before: sourceIndexes, + dataset: { total_messages: 60000, target_chat_messages: 20000, chats: 5, distribution, text_length: 256, timestamp_ties: 10, insertion_order: 'interleaved chats' }, + method: { warmup_runs_per_query_per_phase: 1, measured_runs: 5, page_size: 50, fetched_rows: 51, cursor_positions: [10000, 18000], cache: 'warm PostgreSQL buffers; Redis is bypassed', cleanup: 'ROLLBACK the experiment schema; live tables and indexes unchanged', planner: 'default scan settings; no forced index or disabled sequential scans', schema_difference: 'copied columns/checks/defaults; foreign keys omitted equally in all phases', tuple_variant: 'current cursor SQL in ChatService.listMessages; OR is the pre-fix baseline' }, + }; + const phases = [ + { name: 'no_indexes', ddl: [] }, + { name: 'without_history_index', ddl: [`CREATE UNIQUE INDEX messages_pkey ON ${table} (id)`, `CREATE INDEX messages_sender_id_idx ON ${table} (sender_id)`] }, + { name: 'with_history_index', ddl: [`CREATE INDEX messages_chat_id_created_at_id_idx ON ${table} (chat_id, created_at, id)`] }, + ]; + for (const phase of phases) { + for (const ddl of phase.ddl) await client.query(ddl); + await client.query(`ANALYZE ${table}`); + const indexes = (await client.query('SELECT indexname, indexdef FROM pg_indexes WHERE schemaname = $1 ORDER BY indexname', [schema])).rows; + const phaseRuns = new Map(queries.map((query) => [query.name, []])); + for (const query of queries) { + const rows = (await client.query(query.sql, query.parameters)).rows; + assert.equal(rows.length, 51); + const signature = createHash('sha256').update(JSON.stringify(rows)).digest('hex'); + if (signatures.has(query.name)) assert.equal(signature, signatures.get(query.name)); + else signatures.set(query.name, signature); + if (query.name === 'late_page_tuple') assert.equal(signature, signatures.get('late_page_or')); + await client.query(`EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) ${query.sql}`, query.parameters); + } + for (let repetition = 1; repetition <= 5; repetition++) { + for (const query of queries) { + const plan = (await client.query(`EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) ${query.sql}`, query.parameters)).rows[0]['QUERY PLAN'][0]; + phaseRuns.get(query.name).push(plan); + } + } + for (const query of queries) { + const plans = phaseRuns.get(query.name); + const medianMs = median(plans.map((plan) => plan['Execution Time'])); + const representative = plans.find((plan) => plan['Execution Time'] === medianMs); + const flat = nodes(representative.Plan); + const scan = flat.find((node) => node['Node Type'].includes('Scan')); + runs.push({ + phase: phase.name, query: query.name, indexes, sql: query.sql, parameters: query.parameters, + result_sha256: signatures.get(query.name), execution_ms: plans.map((plan) => plan['Execution Time']), + median_execution_ms: medianMs, representative_plan: representative, + scan_type: scan?.['Node Type'], index_name: scan?.['Index Name'] ?? null, + rows_removed_by_filter: scan?.['Rows Removed by Filter'] ?? 0, + scanned_rows: ((scan?.['Actual Rows'] ?? 0) + (scan?.['Rows Removed by Filter'] ?? 0)) * (scan?.['Actual Loops'] ?? 1), + sort: flat.some((node) => node['Node Type'] === 'Sort'), + shared_buffer_hits: representative.Plan['Shared Hit Blocks'] ?? 0, + shared_buffer_reads: representative.Plan['Shared Read Blocks'] ?? 0, + raw_plans: plans, + }); + const textPlan = (await client.query(`EXPLAIN (ANALYZE, BUFFERS) ${query.sql}`, query.parameters)).rows.map((row) => row['QUERY PLAN']).join('\n'); + raw.push(`=== ${phase.name} / ${query.name} ===\nIndexes: ${indexes.map((index) => index.indexname).join(', ') || '(none)'}\nSQL:\n${query.sql}\nParameters: ${JSON.stringify(query.parameters)}\n\n${textPlan}\n`); + console.log(`${phase.name} / ${query.name}: median ${medianMs.toFixed(3)} ms; ${scan?.['Node Type']}; scanned ${runs.at(-1).scanned_rows}; sort=${runs.at(-1).sort}`); + } + } +} finally { + try { + await client.query('ROLLBACK'); + if (metadata) { + metadata.source_table_indexes_after = (await client.query("SELECT indexname, indexdef FROM pg_indexes WHERE schemaname = 'public' AND tablename = 'messages' ORDER BY indexname")).rows; + assert.deepEqual(metadata.source_table_indexes_after, sourceIndexes); + const leftovers = (await client.query('SELECT count(*)::integer AS count FROM pg_namespace WHERE nspname = $1', [schema])).rows[0].count; + assert.equal(leftovers, 0); + metadata.experiment_schema_absent = true; + } + cleanup = true; + } finally { + await client.end(); + } +} +assert.equal(cleanup, true); +await mkdir(output, { recursive: true }); +await writeFile(resolve(output, 'history-index-explain.json'), JSON.stringify({ ...metadata, cleanup_completed: cleanup, runs }, null, 2) + '\n'); +await writeFile(resolve(output, 'history-index-plans.txt'), raw.join('\n')); +const labels = { no_indexes: 'Без индексов', without_history_index: 'PK + sender_id, без индекса истории', with_history_index: 'С индексом истории' }; +const tableRows = runs.map((row) => `| ${labels[row.phase]} | ${row.query} | ${row.median_execution_ms.toFixed(3)} | ${row.scan_type} | ${row.scanned_rows} | ${row.sort ? 'да' : 'нет'} | ${row.shared_buffer_hits} / ${row.shared_buffer_reads} |`).join('\n'); +const speedup = (query) => runs.find((row) => row.query === query && row.phase === 'no_indexes').median_execution_ms / runs.find((row) => row.query === query && row.phase === 'with_history_index').median_execution_ms; +const summary = `# EXPLAIN истории сообщений: с индексами и без\n\nДата UTC: ${metadata.recorded_at}. PostgreSQL ${metadata.settings.find((setting) => setting.name === 'server_version').setting}.\n\nКоманда: \`node test/explain-history.mjs\` (нужен \`DATABASE_URL\`; PostgreSQL проекта с применёнными миграциями).\n\n60 000 синтетических сообщений в пяти чатах; в целевом чате 20 000. Чаты перемежаются при вставке, текст 256 символов, по 10 сообщений имеют одинаковый created_at. Страница API: 50 сообщений + 1 для next_cursor. Курсоры после 10 000-го и 18 000-го сообщений. Запросы первой страницы и с OR соответствуют прежнему \`ChatService.listMessages\`; tuple — исправленное условие курсора, используемое в текущем API. Скрипт сравнивает прежний и исправленный запросы; сам код API не меняет.\n\n| Индексы | Запрос | Медиана, мс | Scan | Проверено строк | Sort | Buffers hit/read |\n| --- | --- | ---: | --- | ---: | --- | ---: |\n${tableRows}\n\nПервая страница с индексом быстрее варианта без индексов в ${speedup('first_page').toFixed(1)} раза на этом наборе и стенде. Само наличие PK и индекса sender_id не заменяет индекс истории. Составной B-tree \`(chat_id, created_at, id)\` соответствует равенству chat_id и порядку истории; наличие Sort и границы Index Cond видны в сохранённых планах. ORDER BY нужен и при наличии индекса.\n\nПоздняя страница с OR: ${runs.find((row) => row.phase === 'with_history_index' && row.query === 'late_page_or').scanned_rows} проверенных строк. Эквивалентное сравнение пары: ${runs.find((row) => row.phase === 'with_history_index' && row.query === 'late_page_tuple').scanned_rows} строк. Это показывает, удалось ли передать границу курсора в Index Cond или она осталась Filter. Совпадение результатов всех фаз и OR/tuple проверено SHA-256 от полных 51 строк.\n\nМетодика: отдельная таблица с колонками текущей public.messages в случайной схеме; одинаковые данные во всех фазах; ANALYZE после загрузки и изменений индексов; 1 прогрев + 5 измерений каждого запроса в каждой фазе, медиана PostgreSQL Execution Time. Планы не принуждались настройками enable_seqscan/enable_indexscan. Фаза с индексом сохраняет PK и sender_id. Все создание таблиц, данных и индексов выполнены внутри транзакции; ROLLBACK удалил экспериментальную схему. Рабочие таблицы и индексы не изменялись.\n\nОграничения: это прогретый SQL-тест без HTTP, Redis, аутентификации и конкуренции; не cold-cache benchmark, не измерение RPS и не доказательство latency всего API. FK не копировались, поскольку сравнивается чтение; это одинаково во всех фазах. Измерения зависят от ресурсов и нагрузки Docker-host. Лимиты и настройки PostgreSQL записаны в JSON; текстовые планы сняты отдельным запуском, поэтому их времена могут отличаться от медиан JSON.\n\nФайлы: [полные текстовые планы](history-index-plans.txt), [JSON, пять повторов, настройки и результаты](history-index-explain.json).\n`; +await writeFile(resolve(output, 'history-index-summary.md'), summary); +console.log(`Saved EXPLAIN evidence to ${output}; experiment schema rolled back.`); diff --git a/test/full-restart.py b/test/full-restart.py new file mode 100644 index 00000000..0c2d813e --- /dev/null +++ b/test/full-restart.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 +import argparse +from pathlib import Path +import subprocess +import sys +import time + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'tests')) +from client import Client, Failure, check, run +from resilience import history + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--base-url', default='http://127.0.0.1:8080') + parser.add_argument('--ca-file') + parser.add_argument('--action-script', required=True) + args = parser.parse_args() + client = Client(args.base_url, args.ca_file, timeout=30) + alice, bob, eve, chat = client.bootstrap() + original = client.message(alice, chat, 'Сохранность после полного перезапуска')['json'] + check(history(client, bob, chat) == [original], 'pre-restart history mismatch') + hook = Path(args.action_script).resolve() + check(hook.is_file(), 'restart hook not found') + print('Restarting backend, PostgreSQL and Redis; hook output suppressed.', flush=True) + try: + proc = subprocess.run([str(hook)], cwd=ROOT, stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, timeout=90) + except subprocess.TimeoutExpired: + raise Failure('restart hook exceeded 90 seconds') from None + check(proc.returncode == 0, 'restart hook failed') + deadline = time.monotonic() + 90 + while True: + try: + client.call('GET', '/health/ready', schema='Health') + break + except Failure: + check(time.monotonic() < deadline, 'API did not recover within 90 seconds') + time.sleep(0.5) + for actor in (alice, bob, eve): + check(client.call('GET', '/api/v1/users/me', actor=actor, schema='User')['json'] + == actor['user'], 'user or existing session changed after restart') + check(client.call('GET', '/api/v1/chats/' + chat['id'], actor=bob, schema='Chat')['json'] + == chat, 'chat or membership changed after restart') + check(history(client, bob, chat) == [original], 'confirmed message lost, changed or duplicated') + client.call('GET', '/api/v1/chats/' + chat['id'], 404, actor=eve, schema='Error') + followup = client.message(bob, chat, 'Запись после восстановления')['json'] + check(history(client, alice, chat) == [original, followup], 'post-restart write/read mismatch') + client.call('DELETE', '/api/v1/auth/sessions/current', 204, actor=alice) + client.call('GET', '/api/v1/users/me', 401, actor=alice, schema='Error') + print('PASS: users, chat, membership, confirmed message and all existing sessions survived; ' + 'access control, new writes and logout work after restart.') + + +if __name__ == '__main__': + run(main) diff --git a/test/helpers/fault-proxy.mjs b/test/helpers/fault-proxy.mjs new file mode 100644 index 00000000..223dbf45 --- /dev/null +++ b/test/helpers/fault-proxy.mjs @@ -0,0 +1,56 @@ +import assert from 'node:assert/strict'; +import net from 'node:net'; + +export async function faultProxy(connectionUrl, defaultPort) { + const upstreamUrl = new URL(connectionUrl); + const host = upstreamUrl.hostname.replace(/^\[|\]$/g, ''); + const port = Number(upstreamUrl.port || defaultPort); + let mode = 'online'; + const sockets = new Set(); + const track = (socket) => { + sockets.add(socket); + socket.on('error', () => {}); + socket.on('close', () => sockets.delete(socket)); + return socket; + }; + const server = net.createServer((client) => { + track(client); + if (mode === 'cut') { + client.destroy(); + return; + } + const upstream = track(net.connect({ host, port })); + client.on('data', (chunk) => { + if (mode === 'online' && !upstream.destroyed) upstream.write(chunk); + }); + upstream.on('data', (chunk) => { + if (mode === 'online' && !client.destroyed) client.write(chunk); + }); + client.on('close', () => upstream.destroy()); + upstream.on('close', () => client.destroy()); + }); + await new Promise((resolve, reject) => { + server.once('error', reject); + server.listen(0, '127.0.0.1', () => { + server.off('error', reject); + resolve(); + }); + }); + const relayUrl = new URL(connectionUrl); + relayUrl.hostname = '127.0.0.1'; + relayUrl.port = String(server.address().port); + return { + url: relayUrl.toString(), + setMode(nextMode) { + assert.ok(['online', 'cut', 'hang'].includes(nextMode)); + mode = nextMode; + if (mode === 'cut') { + for (const socket of sockets) socket.destroy(); + } + }, + async close() { + for (const socket of sockets) socket.destroy(); + await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve())); + }, + }; +} diff --git a/test/helpers/message-epoch.mjs b/test/helpers/message-epoch.mjs new file mode 100644 index 00000000..1e2f49a4 --- /dev/null +++ b/test/helpers/message-epoch.mjs @@ -0,0 +1,7 @@ +export async function messageEpoch(prisma, chatId) { + const [row] = await prisma.$queryRawUnsafe( + 'SELECT COALESCE(SUM(epoch), 0)::bigint AS epoch FROM public.chat_message_epochs WHERE chat_id = $1::uuid', + chatId, + ); + return row.epoch; +} diff --git a/test/message-pagination.mjs b/test/message-pagination.mjs new file mode 100644 index 00000000..bc92b1e3 --- /dev/null +++ b/test/message-pagination.mjs @@ -0,0 +1,137 @@ +import 'dotenv/config'; +import assert from 'node:assert/strict'; +import { createHash, randomBytes, randomUUID } from 'node:crypto'; +import { createRequire } from 'node:module'; +import test from 'node:test'; + +const require = createRequire(import.meta.url); +const { NestFactory } = require('@nestjs/core'); +const { AppModule } = require('../dist/app.module'); +const { PrismaService } = require('../dist/prisma/prisma.service'); +const { + createFastifyAdapter, + exposeRequestIdHeader, +} = require('../dist/common/http/fastify-adapter'); + +test('message keyset pagination: timestamp ties, chat isolation and deleted cursor row', async (t) => { + assert.ok(process.env.DATABASE_URL); + const previousCacheUrl = process.env.CACHE_URL; + process.env.CACHE_URL = ''; + const app = await NestFactory.create(AppModule, createFastifyAdapter(), { + logger: false, + abortOnError: false, + }); + const prisma = app.get(PrismaService); + let userId; + const chatIds = []; + t.after(async () => { + try { + await prisma.chat.deleteMany({ where: { id: { in: chatIds } } }); + if (userId) await prisma.user.delete({ where: { id: userId } }); + } finally { + await app.close(); + if (previousCacheUrl === undefined) delete process.env.CACHE_URL; + else process.env.CACHE_URL = previousCacheUrl; + } + }); + exposeRequestIdHeader(app); + await app.init(); + const server = app.getHttpAdapter().getInstance(); + await server.ready(); + const user = await prisma.user.create({ + data: { + username: `page_${randomUUID().replaceAll('-', '').slice(0, 20)}`, + displayName: 'Synthetic pagination test', + }, + }); + userId = user.id; + const token = randomBytes(32).toString('base64url'); + await prisma.session.create({ + data: { + userId, + tokenHash: createHash('sha256').update(token).digest('hex'), + expiresAt: new Date(Date.now() + 600000), + }, + }); + for (let i = 0; i < 2; i++) { + const chat = await prisma.chat.create({ + data: { + title: `Pagination ${i}`, + members: { create: { userId, position: 0 } }, + }, + }); + chatIds.push(chat.id); + } + const [chatId, otherChatId] = chatIds; + const rows = Array.from({ length: 140 }, (_, i) => ({ + id: randomUUID(), + chatId, + senderId: userId, + text: `Message ${i}`, + createdAt: new Date(Date.UTC(2026, 0, 1) + Math.floor(i / 10) * 1000), + })); + await prisma.message.createMany({ + data: [ + ...rows, + ...rows.map((row) => ({ + ...row, + id: randomUUID(), + chatId: otherChatId, + text: 'Other chat', + })), + ], + }); + const expected = [...rows] + .sort( + (a, b) => + a.createdAt - b.createdAt || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0), + ) + .map((row) => ({ + id: row.id, + chat_id: chatId, + sender_id: userId, + text: row.text, + created_at: row.createdAt.toISOString(), + })); + const request = (cursor, selectedChat = chatId) => + server.inject({ + method: 'GET', + url: `/api/v1/chats/${selectedChat}/messages?limit=7${cursor ? `&cursor=${encodeURIComponent(cursor)}` : ''}`, + headers: { authorization: `Bearer ${token}` }, + }); + const seen = []; + let cursor; + let firstCursor; + do { + const response = await request(cursor); + assert.equal(response.statusCode, 200); + const page = response.json(); + assert.ok(page.items.length <= 7); + seen.push(...page.items); + if (!firstCursor) firstCursor = page.next_cursor; + cursor = page.next_cursor; + assert.ok( + seen.length <= rows.length, + 'pagination must terminate without duplicates', + ); + } while (cursor); + assert.deepEqual(seen, expected); + const anchor = JSON.parse( + Buffer.from(firstCursor, 'base64url').toString('utf8'), + ); + await prisma.message.delete({ where: { id: anchor.id } }); + const afterDeletion = await request(firstCursor); + assert.equal(afterDeletion.statusCode, 200); + assert.deepEqual(afterDeletion.json().items, expected.slice(7, 14)); + assert.equal((await request(firstCursor, otherChatId)).statusCode, 400); + const pastEnd = Buffer.from( + JSON.stringify({ + scope: `messages:${chatId}`, + id: randomUUID(), + created_at: '2027-01-01T00:00:00.000Z', + }), + ).toString('base64url'); + const empty = await request(pastEnd); + assert.equal(empty.statusCode, 200); + assert.deepEqual(empty.json(), { items: [], next_cursor: null }); +}); diff --git a/test/no-epochs-experiment.cjs b/test/no-epochs-experiment.cjs new file mode 100644 index 00000000..8867ff1f --- /dev/null +++ b/test/no-epochs-experiment.cjs @@ -0,0 +1,268 @@ +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const os = require('node:os'); +const path = require('node:path'); +const { createHash } = require('node:crypto'); +const { spawn, execFileSync } = require('node:child_process'); +const ts = require('typescript'); + +const root = path.resolve(__dirname, '..'); +const resultPrefix = process.env.EXPERIMENT_PREFIX ?? 'cache-strategy'; +assert.match(resultPrefix, /^[a-z0-9-]+$/); +const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'lab2-no-epochs-')); +const hashes = {}; +const volumes = []; +const replace = (source, from, to) => { + assert.ok(source.includes(from), `Missing replacement: ${from}`); + assert.equal( + source.indexOf(from), + source.lastIndexOf(from), + `Ambiguous replacement: ${from}`, + ); + return source.replace(from, to); +}; +const section = (source, from, to, replacement) => { + const start = source.indexOf(from); + const end = source.indexOf(to, start); + assert.ok(start !== -1 && end > start, `Missing section: ${from}`); + return source.slice(0, start) + replacement + source.slice(end); +}; +const digest = (value) => createHash('sha256').update(value).digest('hex'); + +const transforms = { + 'Chat/chat.service.ts': (source) => { + source = section( + source, + ' await tx.$executeRaw(', + ' return created;', + '', + ); + source = replace(source, ' epoch: string,\n', ''); + source = replace(source, ' epoch,\n', ''); + source = section( + source, + ' const [membership] =', + ' if (!membership)', + ' const [membership] = await this.prisma.$queryRaw<{ id: string }[]>(Prisma.sql`\n' + + ' SELECT cm.chat_id AS id FROM chat_members AS cm\n' + + ' WHERE cm.chat_id = ${id}::uuid AND cm.user_id = ${userId}::uuid\n' + + ' `);\n', + ); + source = section( + source, + ' const [message] =', + ' if (!message)', + ' const [message] = await this.prisma.$queryRaw(Prisma.sql`\n' + + ' INSERT INTO messages (id, chat_id, sender_id, text)\n' + + ' SELECT ${randomUUID()}::uuid, cm.chat_id, ${userId}::uuid, ${text}\n' + + ' FROM chat_members AS cm\n' + + ' WHERE cm.chat_id = ${id}::uuid AND cm.user_id = ${userId}::uuid\n' + + ' RETURNING id, chat_id AS "chatId", sender_id AS "senderId",\n' + + ' text, created_at AS "createdAt"\n' + + ' `);\n', + ); + return replace(source, ' chat.messagesEpoch.toString(),\n', ''); + }, + 'Auth/auth.service.ts': (source) => { + source = source.replace( + /COALESCE\(\(SELECT SUM\(e\.epoch\)[\s\S]*?0\)::bigint AS "messagesEpoch"/g, + '0::bigint AS "messagesEpoch"', + ); + return source + .replaceAll('u.chats_epoch', '0::bigint') + .replaceAll('c.messages_epoch', '0::bigint'); + }, + 'User/user.guard.ts': (source) => { + source = replace(source, ' currentChatsEpoch: string;\n', ''); + return replace( + source, + ' request.currentChatsEpoch = session.chatsEpoch;\n', + '', + ); + }, + 'Chat/chat.controller.ts': (source) => + replace(source, ' request.currentChatsEpoch,\n', ''), + 'cache/cache.service.ts': (source) => { + source = replace(source, ' epoch?: string,\n', ''); + return section( + source, + ' if (epoch !== undefined)', + ' const versionKey =', + '', + ); + }, + 'User/user.service.ts': (source) => { + source = replace( + source, + 'const user = await this.prisma.user.findUnique({ where: { id } });', + 'const user = await this.prisma.user.findUnique({ where: { id }, select: { id: true, username: true, displayName: true, createdAt: true } });', + ); + return source; + }, +}; + +try { + for (const [relative, transform] of Object.entries(transforms)) { + const original = fs.readFileSync(path.join(root, 'src', relative), 'utf8'); + const source = transform(original.replace(/\r\n/g, '\n')); + assert.ok( + !/messages_epoch|chats_epoch|chat_message_epochs/.test(source), + relative, + ); + const compiled = ts.transpileModule(source, { + compilerOptions: { + target: ts.ScriptTarget.ES2023, + module: ts.ModuleKind.CommonJS, + experimentalDecorators: true, + emitDecoratorMetadata: true, + }, + reportDiagnostics: true, + }); + assert.equal( + compiled.diagnostics.filter( + (item) => item.category === ts.DiagnosticCategory.Error, + ).length, + 0, + ); + const sourcePath = path.join(directory, relative); + const compiledPath = sourcePath.replace(/\.ts$/, '.js'); + fs.mkdirSync(path.dirname(sourcePath), { recursive: true }); + fs.writeFileSync(sourcePath, source); + fs.writeFileSync(compiledPath, compiled.outputText); + hashes[relative] = { + original_source: digest(original), + experiment_source: digest(source), + experiment_js: digest(compiled.outputText), + }; + volumes.push({ + type: 'bind', + source: compiledPath, + target: `/app/dist/${relative.replace(/\.ts$/, '.js')}`, + read_only: true, + }); + } + let benchmark = fs + .readFileSync(path.join(root, 'test/cache-benchmark.mjs'), 'utf8') + .replace(/\r\n/g, '\n'); + benchmark = replace( + benchmark, + 'process.env.CACHE_URL = proxy.url;', + 'delete process.env.CACHE_URL;', + ); + benchmark = section( + benchmark, + ' await prisma.chatMessageEpoch.createMany(', + ' const path =', + '', + ); + benchmark = section( + benchmark, + ' const second = await start();', + ' report.completed = true;', + ' assert.equal(first.app.get(CacheService).redis, undefined);\n' + + ' for (const chatId of chatIds) {\n' + + ' assert.equal(await messageEpoch(prisma, chatId), 0n);\n' + + ' }\n' + + ' assert.equal((await prisma.user.findUniqueOrThrow({ where: { id: userId } })).chatsEpoch, 0n);\n' + + ' for (const chatId of chatIds.slice(1)) {\n' + + ' const page = await request("GET", `/api/v1/chats/${chatId}/messages`);\n' + + ' assert.equal(page.items.length, 50);\n' + + ' assert.equal(new Set(page.items.map(message => message.id)).size, 50);\n' + + ' }\n' + + ' report.correctness = { no_redis_client: true, epochs_unchanged: true, read_after_write: true };\n' + + ' }\n', + ); + const benchmarkPath = path.join(directory, 'cache-benchmark.mjs'); + fs.writeFileSync(benchmarkPath, benchmark); + volumes.push({ + type: 'bind', + source: benchmarkPath, + target: '/experiment/cache-benchmark.mjs', + read_only: true, + }); + volumes.push({ + type: 'bind', + source: path.join(root, 'test/helpers'), + target: '/experiment/helpers', + read_only: true, + }); + const override = path.join(directory, 'compose.no-epochs.yaml'); + fs.writeFileSync( + override, + JSON.stringify({ services: { benchmark: { volumes } } }, null, 2), + ); + const args = [ + 'compose', + '-f', + 'compose.yaml', + '-f', + 'test/compose.benchmark.yaml', + '-f', + override, + 'run', + '--rm', + '--no-deps', + '--pull', + 'never', + 'benchmark', + 'node', + '/experiment/cache-benchmark.mjs', + 'after', + `/results/${resultPrefix}-no-redis-no-epochs.json`, + ...process.argv.slice(2), + ]; + const metadata = { + recorded_at: new Date().toISOString(), + image: execFileSync( + 'docker', + ['image', 'inspect', 'mtusi2026lab2-fork-backend', '--format', '{{.Id}}'], + { encoding: 'utf8' }, + ).trim(), + modified_sources: hashes, + command: ['docker', ...args], + implementation: + 'Separate temporary source copies compiled with TypeScript and mounted over six application modules. Workspace sources and running backend remain unchanged.', + schema: + 'Epoch storage remains in the database; experiment API paths do not update counters or read authoritative epoch values.', + redis: + 'Application starts without CACHE_URL. Observer/proxy are retained only for benchmark setup and cleanup.', + full_result: `${resultPrefix}-full.json`, + experiment_result: `${resultPrefix}-no-redis-no-epochs.json`, + }; + const child = spawn('docker', args, { + cwd: root, + stdio: 'inherit', + env: process.env, + }); + child.once('error', finish); + child.once('exit', (code, signal) => finish(null, code, signal)); + let finished = false; + function finish(error, code, signal) { + if (finished) return; + finished = true; + metadata.exit_code = error ? 1 : code; + metadata.signal = signal; + metadata.sources_unchanged = Object.entries(hashes).every( + ([relative, hash]) => + digest(fs.readFileSync(path.join(root, 'src', relative), 'utf8')) === + hash.original_source, + ); + fs.writeFileSync( + path.join(root, `evidence/${resultPrefix}-experiment.json`), + JSON.stringify(metadata, null, 2) + '\n', + ); + cleanup(); + if (error) console.error(error.message); + process.exitCode = error ? 1 : (code ?? 1); + } +} catch (error) { + cleanup(); + throw error; +} + +function cleanup() { + const resolved = path.resolve(directory); + assert.equal(path.dirname(resolved), path.resolve(os.tmpdir())); + assert.ok(path.basename(resolved).startsWith('lab2-no-epochs-')); + fs.rmSync(resolved, { recursive: true, force: true }); +} diff --git a/test/passwords.mjs b/test/passwords.mjs new file mode 100644 index 00000000..17c4eef0 --- /dev/null +++ b/test/passwords.mjs @@ -0,0 +1,63 @@ +import assert from 'node:assert/strict'; +import { argon2 } from 'node:crypto'; +import { createRequire } from 'node:module'; +import test from 'node:test'; + +const require = createRequire(import.meta.url); +const { PasswordService } = require('../dist/Auth/password.service'); +const password = '🔐'.repeat(40) + ':Синтетический пароль\0'; + +test('Argon2id only: PHC format, independent derivation, unique salts, Unicode and invalid hashes', async () => { + const service = new PasswordService(); + const first = await service.hash(password); + const second = await service.hash(password); + assert.notEqual( + first, + second, + 'same password must have independently salted hashes', + ); + assert.match( + first, + /^\$argon2id\$v=19\$m=19456,t=2,p=1\$[A-Za-z0-9+/]{22}\$[A-Za-z0-9+/]{43}$/, + ); + assert.ok(!first.includes(password)); + const parts = first.split('$'); + const independent = await new Promise((resolve, reject) => + argon2( + 'argon2id', + { + message: password, + nonce: Buffer.from(parts[4], 'base64'), + memory: 19456, + passes: 2, + parallelism: 1, + tagLength: 32, + }, + (error, key) => (error ? reject(error) : resolve(key)), + ), + ); + assert.deepEqual(Buffer.from(parts[5], 'base64'), independent); + assert.equal(await service.verify(password, first), true); + assert.equal( + await service.verify(password.replace('🔐', '🔑'), first), + false, + ); + assert.equal( + await service.verify(password.slice(0, -1), first), + false, + 'NUL must not be silently truncated', + ); + for (const invalid of [ + null, + '', + 'scrypt$131072$8$1$unsupported$unsupported', + '$argon2id$v=19$m=999999999,t=999999999,p=1$x$x', + first.replace('v=19', 'v=16'), + first.replace('argon2id', 'argon2i'), + first + '$extra', + first.replace(parts[5], 'a'), + first.replace(parts[4], parts[4] + '='), + ]) { + assert.equal(await service.verify(password, invalid), false); + } +}); diff --git a/test/persistence.mjs b/test/persistence.mjs new file mode 100644 index 00000000..e2d86490 --- /dev/null +++ b/test/persistence.mjs @@ -0,0 +1,346 @@ +import 'dotenv/config'; +import assert from 'node:assert/strict'; +import { randomUUID } from 'node:crypto'; +import { createRequire } from 'node:module'; +import test from 'node:test'; + +const require = createRequire(import.meta.url); +const { NestFactory } = require('@nestjs/core'); +const { AppModule } = require('../dist/app.module'); +const { PrismaService } = require('../dist/prisma/prisma.service'); +const { + createFastifyAdapter, + exposeRequestIdHeader, +} = require('../dist/common/http/fastify-adapter'); + +async function start() { + const app = await NestFactory.create(AppModule, createFastifyAdapter(), { + logger: false, + abortOnError: false, + }); + try { + exposeRequestIdHeader(app); + await app.init(); + const server = app.getHttpAdapter().getInstance(); + await server.ready(); + return { app, server, prisma: app.get(PrismaService) }; + } catch (error) { + await app.close(); + throw error; + } +} + +test('PostgreSQL storage: constraints, pagination, access and application restart', async (t) => { + assert.ok( + process.env.DATABASE_URL, + 'Set DATABASE_URL and apply migrations before running this test', + ); + let context = await start(); + const userIds = []; + const chatIds = []; + t.after(async () => { + try { + await context.prisma.chat.deleteMany({ where: { id: { in: chatIds } } }); + await context.prisma.user.deleteMany({ where: { id: { in: userIds } } }); + } finally { + await context.app.close(); + } + }); + const suffix = randomUUID().replaceAll('-', '').slice(0, 16); + const password = '🔐'.repeat(40) + ':пароль с пробелами '; + const tokens = new Map(); + const request = (method, url, payload, userId) => + context.server.inject({ + method, + url, + ...(payload === undefined ? {} : { payload }), + ...(userId + ? { headers: { authorization: `Bearer ${tokens.get(userId)}` } } + : {}), + }); + + const registrations = await Promise.all( + Array.from({ length: 4 }, () => + request('POST', '/api/v1/users', { + username: `race_${suffix}`, + display_name: 'Race', + password, + }), + ), + ); + for (const response of registrations) { + if (response.statusCode === 201) userIds.push(response.json().id); + } + assert.deepEqual( + registrations.map((response) => response.statusCode).sort(), + [201, 409, 409, 409], + ); + const userId = userIds[0]; + const outsider = await request('POST', '/api/v1/users', { + username: `other_${suffix}`, + display_name: 'Other', + password, + }); + assert.equal(outsider.statusCode, 201); + userIds.push(outsider.json().id); + + const login = (username, secret = password, payload) => + context.server.inject({ + method: 'POST', + url: '/api/v1/auth/sessions', + headers: { + authorization: `Basic ${Buffer.from(`${username}:${secret}`, 'utf8').toString('base64')}`, + }, + ...(payload === undefined ? {} : { payload }), + }); + for (const user of [ + registrations.find((r) => r.statusCode === 201).json(), + outsider.json(), + ]) { + assert.deepEqual(Object.keys(user).sort(), [ + 'created_at', + 'display_name', + 'id', + 'username', + ]); + const response = await login(user.username); + assert.equal(response.statusCode, 201); + assert.equal(response.json().token_type, 'Bearer'); + assert.match(response.json().token, /^[A-Za-z0-9_-]{43}$/); + assert.deepEqual(response.json().user, user); + tokens.set(user.id, response.json().token); + const stored = await context.prisma.user.findUniqueOrThrow({ + where: { id: user.id }, + }); + assert.match(stored.passwordHash, /^\$argon2id\$v=19\$m=19456,t=2,p=1\$/); + assert.ok(!stored.passwordHash.includes(password)); + } + const sessions = await context.prisma.session.findMany({ where: { userId } }); + assert.equal(sessions.length, 1); + assert.match(sessions[0].tokenHash, /^[a-f0-9]{64}$/); + assert.notEqual(sessions[0].tokenHash, tokens.get(userId)); + const wrong = await login(`race_${suffix}`, 'wrong-password'); + const unknown = await login(`missing_${suffix}`, 'wrong-password'); + assert.equal(wrong.statusCode, 401); + assert.equal(unknown.statusCode, 401); + assert.equal(wrong.json().error.message, unknown.json().error.message); + assert.equal( + wrong.headers['www-authenticate'], + 'Basic realm="messenger", charset="UTF-8"', + ); + assert.equal((await login(`race_${suffix}`, password, {})).statusCode, 400); + for (const invalid of [ + undefined, + 'short', + ' '.repeat(12), + '🔐'.repeat(129), + ]) { + assert.equal( + ( + await request('POST', '/api/v1/users', { + username: `bad_${suffix}`, + display_name: 'Bad', + ...(invalid === undefined ? {} : { password: invalid }), + }) + ).statusCode, + 400, + ); + } + for (const authorization of [ + undefined, + 'Bearer unknown', + `Basic ${Buffer.from(`race_${suffix}:${password}`).toString('base64')}`, + ]) { + const response = await context.server.inject({ + method: 'GET', + url: '/api/v1/users/me', + headers: { + 'x-user-id': userId, + ...(authorization ? { authorization } : {}), + }, + }); + assert.equal(response.statusCode, 401); + assert.equal( + response.headers['www-authenticate'], + 'Bearer realm="messenger"', + ); + } + const identity = await context.server.inject({ + method: 'GET', + url: '/api/v1/users/me', + headers: { + authorization: `Bearer ${tokens.get(userId)}`, + 'x-user-id': outsider.json().id, + }, + }); + assert.equal(identity.json().id, userId); + + const ready = await request('GET', '/health/ready'); + assert.equal(ready.statusCode, 200); + + const invalidChat = await request( + 'POST', + '/api/v1/chats', + { + title: `invalid_${suffix}`, + member_ids: [userId, randomUUID()], + }, + userId, + ); + assert.equal(invalidChat.statusCode, 400); + assert.equal( + await context.prisma.chat.count({ where: { title: `invalid_${suffix}` } }), + 0, + ); + + const rolledBackId = randomUUID(); + chatIds.push(rolledBackId); + await assert.rejects( + context.prisma.$transaction(async (tx) => { + await tx.chat.create({ data: { id: rolledBackId, title: 'Rollback' } }); + await tx.chatMember.create({ + data: { chatId: rolledBackId, userId: randomUUID(), position: 0 }, + }); + }), + { code: 'P2003' }, + ); + assert.equal( + await context.prisma.chat.count({ where: { id: rolledBackId } }), + 0, + ); + + const createdChat = await request( + 'POST', + '/api/v1/chats', + { title: 'Persisted chat', member_ids: [userId] }, + userId, + ); + assert.equal(createdChat.statusCode, 201); + const chatId = createdChat.json().id; + chatIds.push(chatId); + const forbidden = await request( + 'GET', + `/api/v1/chats/${chatId}`, + undefined, + outsider.json().id, + ); + assert.equal(forbidden.statusCode, 404); + const unauthorized = await request('GET', `/api/v1/chats/${chatId}`); + assert.equal(unauthorized.statusCode, 401); + + const messageIds = []; + for (let i = 0; i < 5; i++) { + const message = await request( + 'POST', + `/api/v1/chats/${chatId}/messages`, + { text: `Message ${i}` }, + userId, + ); + assert.equal(message.statusCode, 201); + messageIds.push(message.json().id); + } + await context.prisma.message.updateMany({ + where: { chatId }, + data: { createdAt: new Date('2026-01-01T00:00:00.000Z') }, + }); + const first = await request( + 'GET', + `/api/v1/chats/${chatId}/messages?limit=2`, + undefined, + userId, + ); + assert.equal(first.statusCode, 200); + assert.equal(first.json().items.length, 2); + assert.ok(first.json().next_cursor); + + await context.app.close(); + context = await start(); + const me = await request('GET', '/api/v1/users/me', undefined, userId); + assert.equal(me.statusCode, 200); + const chat = await request( + 'GET', + `/api/v1/chats/${chatId}`, + undefined, + userId, + ); + assert.equal(chat.statusCode, 200); + assert.deepEqual(chat.json().member_ids, [userId]); + const listed = await request( + 'GET', + '/api/v1/chats?limit=1', + undefined, + userId, + ); + assert.deepEqual( + listed.json().items.map((item) => item.id), + [chatId], + ); + + const seen = first.json().items.map((message) => message.id); + let cursor = first.json().next_cursor; + while (cursor) { + const page = await request( + 'GET', + `/api/v1/chats/${chatId}/messages?limit=2&cursor=${cursor}`, + undefined, + userId, + ); + assert.equal(page.statusCode, 200); + assert.ok(page.json().items.length <= 2); + seen.push(...page.json().items.map((message) => message.id)); + cursor = page.json().next_cursor; + } + assert.deepEqual(seen, [...messageIds].sort()); + assert.equal(new Set(seen).size, 5); + + const logouts = await Promise.all( + Array.from({ length: 2 }, () => + request('DELETE', '/api/v1/auth/sessions/current', undefined, userId), + ), + ); + assert.deepEqual(logouts.map((r) => r.statusCode).sort(), [204, 401]); + assert.equal(logouts.find((r) => r.statusCode === 204).body, ''); + assert.equal( + (await request('GET', '/api/v1/users/me', undefined, userId)).statusCode, + 401, + ); + assert.equal( + ( + await request( + 'DELETE', + '/api/v1/auth/sessions/current', + undefined, + userId, + ) + ).statusCode, + 401, + ); + await context.app.close(); + const originalTtl = process.env.SESSION_TTL_SECONDS; + process.env.SESSION_TTL_SECONDS = '2'; + try { + context = await start(); + } finally { + if (originalTtl === undefined) delete process.env.SESSION_TTL_SECONDS; + else process.env.SESSION_TTL_SECONDS = originalTtl; + } + const short = await login(`race_${suffix}`); + assert.equal(short.statusCode, 201); + tokens.set(userId, short.json().token); + assert.equal( + (await request('GET', '/api/v1/users/me', undefined, userId)).statusCode, + 200, + ); + await context.app.close(); + context = await start(); + await new Promise((resolve) => + setTimeout( + resolve, + Math.max(0, Date.parse(short.json().expires_at) - Date.now()) + 100, + ), + ); + assert.equal( + (await request('GET', '/api/v1/users/me', undefined, userId)).statusCode, + 401, + ); +}); diff --git a/test/redis-comparison-summary.mjs b/test/redis-comparison-summary.mjs new file mode 100644 index 00000000..1e4be20d --- /dev/null +++ b/test/redis-comparison-summary.mjs @@ -0,0 +1,85 @@ +import assert from 'node:assert/strict'; +import { readFile, writeFile } from 'node:fs/promises'; + +const report = JSON.parse( + await readFile('evidence/redis-comparison.json', 'utf8'), +); +assert.ok(report.completed); +assert.ok(Object.values(report.correctness.read_after_write).every(Boolean)); +const lines = [ + '# Redis и работа без кэша приложения', + '', + `Дата UTC: ${report.recorded_at}. Node.js ${report.node}.`, + '', + 'Один прогон на одном образе: три повтора каждого режима с чередованием порядка. Второй экземпляр API запущен без CACHE_URL: отключены все кэши приложения, включая профиль пользователя. PostgreSQL-эпохи и запись одним CTE сохранены в обоих режимах. Контейнер Redis не останавливался; экземпляр без кэша не создаёт Redis-клиент.', + '', + 'RPS = суммарное число успешных запросов / суммарное время трёх повторов. Средняя задержка взвешена по числу успешных запросов. p95 — среднее трёх отдельных p95, не перцентиль объединённой выборки. SQL/HTTP = суммарные SQL-вызовы / все HTTP-запросы; команды транзакций исключены.', + '', + '| Сценарий | Режим | Средний RPS | Средняя задержка, мс | Среднее p95, мс | SQL/HTTP | CPU, % ядра | Ошибки |', + '| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: |', +]; +const aggregates = []; +for (const [workload, label] of [ + ['cold-history-burst', 'Холодная волна истории'], + ['warm-history', 'Прогретая история'], + ['writes-single-chat', 'Запись в один чат'], +]) { + for (const mode of ['redis', 'no-redis']) { + const samples = report.samples.filter( + (sample) => sample.workload === `${workload}:${mode}`, + ); + assert.equal(samples.length, 3); + const sum = (select) => + samples.reduce((total, sample) => total + select(sample), 0); + const successes = sum((sample) => sample.successes); + const errors = sum((sample) => sample.errors); + const seconds = sum((sample) => sample.elapsed_seconds); + const aggregate = { + workload, + mode, + successes, + errors, + rps: successes / seconds, + mean_latency_ms: + sum((sample) => sample.latency_ms.mean * sample.successes) / successes, + mean_p95_ms: sum((sample) => sample.latency_ms.p95) / samples.length, + sql_per_request: + sum((sample) => sample.sql_queries) / (successes + errors), + cpu_percent_one_core: + sum( + (sample) => + sample.process_cpu_percent_one_core * sample.elapsed_seconds, + ) / seconds, + }; + aggregates.push(aggregate); + lines.push( + `| ${label} | ${mode === 'redis' ? 'Redis' : 'Без Redis'} | ${aggregate.rps.toFixed(3)} | ${aggregate.mean_latency_ms.toFixed(3)} | ${aggregate.mean_p95_ms.toFixed(3)} | ${aggregate.sql_per_request.toFixed(3)} | ${aggregate.cpu_percent_one_core.toFixed(2)} | ${errors} |`, + ); + } +} +lines.push( + '', + 'В этом прогоне кэш полезен для прогретого чтения истории: выше пропускная способность, ниже средняя задержка и меньше SQL-вызовов. Для холодной волны и записи преимущество по времени не показано. Первый повтор с Redis значительно медленнее остальных; средние включают его, поэтому вывод о стабильной скорости записи ограничен. Это сравнение режимов кэша на текущей реализации, а не отдельное измерение цены PostgreSQL-эпох.', + '', + 'Нагрузка: 10 000 сообщений, первая страница limit=50, конкурентность 16, 3 с прогрева и 10 с чтения на режим/повтор, холодная волна 32 запроса, 512 записей в новый чат на режим/повтор. Реальный HTTP по loopback; синтетические пользователи и сессии обходят хеширование паролей. Проверены 512 сообщений и эпоха 512 после каждого сценария записи, а также чтение истории после записи.', + '', + 'Оба API и генератор HTTP работают в одном Node-процессе. CPU включает генератор, API и инструментацию; RSS общий и не показывает разницу памяти между режимами. PostgreSQL и Redis разделяют Docker-host с другими сервисами. Это короткая нагрузка, не предел производительности; холодные SQL-данные не имитируются. Уменьшение SQL/HTTP показывает снижение числа запросов, но не доказывает пропорциональное снижение CPU PostgreSQL. Цена самих эпох отдельно не измеряется.', + '', + 'Команда повторения:', + '', + '```powershell', + 'docker compose -f compose.yaml -f test/compose.benchmark.yaml run --rm --no-deps --pull never benchmark node test/cache-benchmark.mjs after /results/redis-comparison.json --compare-redis', + 'node test/redis-comparison-summary.mjs', + '```', + '', + 'Сырые результаты и хеши измеренных модулей: [redis-comparison.json](redis-comparison.json).', +); +await writeFile( + 'evidence/redis-comparison-summary.md', + lines.join('\n') + '\n', +); +await writeFile( + 'evidence/redis-comparison-averages.json', + JSON.stringify(aggregates, null, 2) + '\n', +); +console.log(lines.slice(0, 16).join('\n')); diff --git a/test/resilience.mjs b/test/resilience.mjs new file mode 100644 index 00000000..0937ef7e --- /dev/null +++ b/test/resilience.mjs @@ -0,0 +1,441 @@ +import 'dotenv/config'; +import assert from 'node:assert/strict'; +import { randomBytes, randomUUID } from 'node:crypto'; +import { createRequire } from 'node:module'; +import { performance } from 'node:perf_hooks'; +import test from 'node:test'; +import { faultProxy } from './helpers/fault-proxy.mjs'; + +const require = createRequire(import.meta.url); +const Redis = require('ioredis').default; +const { NestFactory } = require('@nestjs/core'); +const { AppModule } = require('../dist/app.module'); +const { PrismaService } = require('../dist/prisma/prisma.service'); +const { + createFastifyAdapter, + exposeRequestIdHeader, +} = require('../dist/common/http/fastify-adapter'); +const pause = (milliseconds) => + new Promise((resolve) => setTimeout(resolve, milliseconds)); + +test( + 'Auth and dependency failures remain bounded and fail closed', + { timeout: 120000 }, + async (t) => { + assert.ok( + process.env.DATABASE_URL, + 'Set DATABASE_URL and apply migrations', + ); + assert.ok( + process.env.CACHE_URL, + 'Set CACHE_URL to a running Redis instance', + ); + const original = { + DATABASE_URL: process.env.DATABASE_URL, + CACHE_URL: process.env.CACHE_URL, + CACHE_PREFIX: process.env.CACHE_PREFIX, + SESSION_TTL_SECONDS: process.env.SESSION_TTL_SECONDS, + }; + const prefix = `test:resilience:${randomUUID()}`; + const db = await faultProxy(original.DATABASE_URL, 5432); + const redis = await faultProxy(original.CACHE_URL, 6379); + Object.assign(process.env, { + DATABASE_URL: db.url, + CACHE_URL: redis.url, + CACHE_PREFIX: prefix, + SESSION_TTL_SECONDS: '2', + }); + const observer = new Redis(original.CACHE_URL, { + connectTimeout: 1000, + commandTimeout: 1000, + maxRetriesPerRequest: 0, + }); + observer.on('error', () => {}); + let app; + let prisma; + let userId; + let chatId; + t.after(async () => { + db.setMode('online'); + redis.setMode('online'); + try { + if (prisma) { + if (chatId) await prisma.chat.deleteMany({ where: { id: chatId } }); + if (userId) await prisma.user.deleteMany({ where: { id: userId } }); + } + let cursor = '0'; + do { + const [next, keys] = await observer.scan( + cursor, + 'MATCH', + `${prefix}:*`, + 'COUNT', + 100, + ); + cursor = next; + if (keys.length) await observer.del(...keys); + } while (cursor !== '0'); + } finally { + observer.disconnect(); + if (app) await app.close(); + await db.close(); + await redis.close(); + for (const [key, value] of Object.entries(original)) { + if (value === undefined) delete process.env[key]; + else process.env[key] = value; + } + } + }); + await observer.ping(); + app = await NestFactory.create(AppModule, createFastifyAdapter(), { + logger: false, + abortOnError: false, + }); + exposeRequestIdHeader(app); + await app.init(); + const server = app.getHttpAdapter().getInstance(); + await server.ready(); + prisma = app.get(PrismaService); + let token; + const request = async ( + method, + url, + { + payload, + authorization = token ? `Bearer ${token}` : undefined, + headers = {}, + budget = 8000, + } = {}, + ) => { + const start = performance.now(); + let timer; + try { + const response = await Promise.race([ + server.inject({ + method, + url, + headers: { + ...headers, + ...(authorization ? { authorization } : {}), + }, + ...(payload === undefined ? {} : { payload }), + }), + new Promise((_, reject) => { + timer = setTimeout( + () => reject(new Error(`${method} ${url} exceeded ${budget}ms`)), + budget, + ); + }), + ]); + assert.ok( + performance.now() - start < budget, + 'request exceeded its deadline', + ); + return response; + } finally { + clearTimeout(timer); + } + }; + const errorResponse = (response, status, code, challenge) => { + assert.equal( + response.statusCode, + status, + `${response.statusCode}: ${response.body}`, + ); + const body = response.json(); + assert.deepEqual(Object.keys(body), ['error']); + assert.deepEqual(Object.keys(body.error).sort(), [ + 'code', + 'message', + 'request_id', + ]); + assert.equal(body.error.code, code); + assert.equal(body.error.request_id, response.headers['x-request-id']); + assert.ok(body.error.request_id); + assert.ok(body.error.message.length <= 200); + for (const secret of [ + original.DATABASE_URL, + original.CACHE_URL, + token, + ].filter(Boolean)) + assert.ok(!response.body.includes(secret)); + assert.ok( + !/Prisma|SELECT |INSERT |stack|ECONN|postgresql:\/\//i.test( + response.body, + ), + 'error leaks implementation details', + ); + if (challenge) + assert.equal(response.headers['www-authenticate'], challenge); + }; + const username = `fault_${randomUUID().replaceAll('-', '').slice(0, 20)}`; + const password = 'Synthetic-test-password:🔐123'; + const basic = (secret) => + `Basic ${Buffer.from(`${username}:${secret}`, 'utf8').toString('base64')}`; + const login = (secret = password) => + request('POST', '/api/v1/auth/sessions', { + authorization: basic(secret), + }); + const registered = await request('POST', '/api/v1/users', { + payload: { username, display_name: 'Fault test', password }, + budget: 15000, + }); + assert.equal(registered.statusCode, 201); + userId = registered.json().id; + + await t.test('incorrect password is 401 with Basic challenge', async () => { + const wrong = await login('wrong-password'); + errorResponse( + wrong, + 401, + 'unauthorized', + 'Basic realm="messenger", charset="UTF-8"', + ); + assert.equal(await prisma.session.count({ where: { userId } }), 0); + }); + await t.test( + 'SESSION_TTL_SECONDS=2 expires without renewing on reads', + async () => { + const response = await login(); + assert.equal(response.statusCode, 201); + token = response.json().token; + const stored = await prisma.session.findFirstOrThrow({ + where: { userId }, + }); + assert.ok( + Math.abs( + stored.expiresAt.getTime() - stored.createdAt.getTime() - 2000, + ) < 500, + ); + assert.equal( + (await request('GET', '/api/v1/users/me')).statusCode, + 200, + ); + await pause( + Math.max(0, Date.parse(response.json().expires_at) - Date.now()) + + 100, + ); + errorResponse( + await request('GET', '/api/v1/users/me'), + 401, + 'unauthorized', + 'Bearer realm="messenger"', + ); + errorResponse( + await request('DELETE', '/api/v1/auth/sessions/current'), + 401, + 'unauthorized', + 'Bearer realm="messenger"', + ); + }, + ); + await t.test( + 'logout revokes immediately, including with a cached profile', + async () => { + const response = await login(); + assert.equal(response.statusCode, 201); + token = response.json().token; + assert.equal( + (await request('GET', '/api/v1/users/me')).statusCode, + 200, + ); + const logout = await request('DELETE', '/api/v1/auth/sessions/current'); + assert.equal(logout.statusCode, 204); + assert.equal(logout.body, ''); + errorResponse( + await request('GET', '/api/v1/users/me'), + 401, + 'unauthorized', + 'Bearer realm="messenger"', + ); + errorResponse( + await request('DELETE', '/api/v1/auth/sessions/current'), + 401, + 'unauthorized', + 'Bearer realm="messenger"', + ); + }, + ); + token = randomBytes(32).toString('base64url'); + const { createHash } = await import('node:crypto'); + await prisma.session.create({ + data: { + userId, + tokenHash: createHash('sha256').update(token).digest('hex'), + expiresAt: new Date(Date.now() + 600000), + }, + }); + const chat = await request('POST', '/api/v1/chats', { + payload: { title: 'Fault isolation', member_ids: [userId] }, + }); + assert.equal(chat.statusCode, 201); + chatId = chat.json().id; + const history = `/api/v1/chats/${chatId}/messages`; + assert.equal( + (await request('POST', history, { payload: { text: 'Before fault' } })) + .statusCode, + 201, + ); + assert.equal((await request('GET', history)).json().items.length, 1); + + const anonymousChecks = async () => { + for (const authorization of ['', 'Bearer invalid', basic(password)]) { + const headers = { 'x-user-id': userId }; + errorResponse( + await request('GET', history, { authorization, headers }), + 401, + 'unauthorized', + 'Bearer realm="messenger"', + ); + errorResponse( + await request('POST', history, { + authorization, + headers, + payload: { text: 'Must not be stored' }, + }), + 401, + 'unauthorized', + 'Bearer realm="messenger"', + ); + } + }; + await t.test( + 'Redis disconnect: SQL fallback and anonymous callers remain unauthorized', + async () => { + redis.setMode('cut'); + await anonymousChecks(); + assert.equal( + (await request('GET', history, { budget: 3000 })).statusCode, + 200, + ); + assert.equal( + ( + await request('POST', history, { + payload: { text: 'Redis offline' }, + budget: 3000, + }) + ).statusCode, + 201, + ); + assert.equal( + (await request('GET', history, { budget: 3000 })).json().items.length, + 2, + ); + redis.setMode('online'); + await pause(1300); + }, + ); + await t.test('Redis hangs: command timeout bypasses cache', async () => { + redis.setMode('hang'); + try { + assert.equal( + (await request('GET', `${history}?limit=10`, { budget: 3000 })) + .statusCode, + 200, + ); + assert.equal( + ( + await request('POST', history, { + payload: { text: 'Redis blackhole' }, + budget: 3000, + }) + ).statusCode, + 201, + ); + await anonymousChecks(); + } finally { + redis.setMode('cut'); + redis.setMode('online'); + } + await pause(1300); + }); + await t.test( + 'PostgreSQL disconnect: bounded 503, no cached authorization bypass', + async () => { + db.setMode('cut'); + try { + await anonymousChecks(); + errorResponse( + await request('GET', '/api/v1/users/me'), + 503, + 'unavailable', + ); + errorResponse(await request('GET', history), 503, 'unavailable'); + errorResponse( + await request('POST', history, { payload: { text: 'DB offline' } }), + 503, + 'unavailable', + ); + errorResponse( + await request('DELETE', '/api/v1/auth/sessions/current'), + 503, + 'unavailable', + ); + errorResponse(await login(), 503, 'unavailable'); + errorResponse( + await request('GET', '/health/ready'), + 503, + 'unavailable', + ); + assert.equal((await request('GET', '/health/live')).statusCode, 200); + } finally { + db.setMode('online'); + } + assert.equal( + (await request('GET', '/api/v1/users/me')).statusCode, + 200, + ); + }, + ); + await t.test( + 'PostgreSQL hangs on an established connection: client query timeout', + async () => { + assert.equal( + (await request('GET', '/api/v1/users/me')).statusCode, + 200, + ); + db.setMode('hang'); + try { + await anonymousChecks(); + errorResponse(await request('GET', history), 503, 'unavailable'); + } finally { + db.setMode('cut'); + db.setMode('online'); + } + assert.equal( + (await request('GET', '/api/v1/users/me')).statusCode, + 200, + ); + }, + ); + await t.test( + 'both services unavailable: fail closed and recover confirmed data', + async () => { + db.setMode('cut'); + redis.setMode('cut'); + try { + await anonymousChecks(); + errorResponse(await request('GET', history), 503, 'unavailable'); + errorResponse( + await request('GET', history, { + authorization: `Bearer ${randomBytes(32).toString('base64url')}`, + }), + 503, + 'unavailable', + ); + } finally { + db.setMode('online'); + redis.setMode('online'); + } + const recovered = await request('GET', `${history}?limit=100`); + assert.equal(recovered.statusCode, 200); + assert.deepEqual( + recovered.json().items.map((message) => message.text), + ['Before fault', 'Redis offline', 'Redis blackhole'], + ); + assert.equal(await prisma.message.count({ where: { chatId } }), 3); + assert.equal((await request('GET', '/health/ready')).statusCode, 200); + }, + ); + }, +); diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 00000000..2eafee0e --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": "./src" + }, + "include": ["src"], + "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..f15de1db --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "nodenext", + "moduleResolution": "nodenext", + "resolvePackageJsonExports": true, + "esModuleInterop": true, + "isolatedModules": true, + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, + "target": "ES2023", + "types": ["node", "jest"], + "sourceMap": true, + "outDir": "./dist", + "rootDir": ".", + "incremental": true, + "skipLibCheck": true, + "strict": true, + "strictPropertyInitialization": false + } +}